Skip to content

Commit

Permalink
test: add spdx-header, use runtime_metadata_url remove uneed env_var
Browse files Browse the repository at this point in the history
Signed-off-by: Raymond Yeh <extraymond@gmail.com>
  • Loading branch information
extraymond committed Jun 19, 2023
1 parent fd741a0 commit fefbe78
Show file tree
Hide file tree
Showing 26 changed files with 47 additions and 23 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ on:
pull_request:
workflow_dispatch:

# FIXME: currently needed to bypass a transient dependency using nightly feature
env:
RUSTC_BOOTSTRAP: 1

jobs:
repolinter:
name: Repolinter
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ Cargo.lock
bundle.ll

.helix/
.vscode/
1 change: 1 addition & 0 deletions integration/subxt-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
edition = "2021"
name = "subxt-tests"
version = "0.1.0"
license = "Apache-2.0"

[dependencies]
anyhow = "1.0.71"
Expand Down
Binary file removed integration/subxt-tests/metadata.scale
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use contract_transcode::ContractMessageTranscoder;
use parity_scale_codec::{Decode, Encode};
use sp_core::{hexdisplay::AsBytesRef, U256};
Expand Down
2 changes: 2 additions & 0 deletions integration/subxt-tests/src/cases/arrays.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use crate::{Contract, DeployContract, Execution, ReadContract, WriteContract, API};
use contract_transcode::{ContractMessageTranscoder, Value};
use hex::FromHex;
Expand Down
2 changes: 2 additions & 0 deletions integration/subxt-tests/src/cases/asserts.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use crate::{node, Contract, WriteContract};
use contract_transcode::ContractMessageTranscoder;
use hex::FromHex;
Expand Down
2 changes: 2 additions & 0 deletions integration/subxt-tests/src/cases/balances.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use std::time::Duration;

use crate::{free_balance_of, node, Contract, WriteContract};
Expand Down
2 changes: 2 additions & 0 deletions integration/subxt-tests/src/cases/builtins.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use std::time::{Instant, SystemTime, UNIX_EPOCH};

use crate::{node, Contract, DeployContract, Execution, ReadContract, API};
Expand Down
2 changes: 2 additions & 0 deletions integration/subxt-tests/src/cases/builtins2.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use contract_transcode::ContractMessageTranscoder;
use parity_scale_codec::{Decode, Encode};
use sp_core::hexdisplay::AsBytesRef;
Expand Down
2 changes: 2 additions & 0 deletions integration/subxt-tests/src/cases/create_contract.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use std::str::FromStr;

use contract_transcode::ContractMessageTranscoder;
Expand Down
2 changes: 2 additions & 0 deletions integration/subxt-tests/src/cases/destruct.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use contract_transcode::ContractMessageTranscoder;
use parity_scale_codec::{Decode, Encode};
use sp_core::hexdisplay::AsBytesRef;
Expand Down
2 changes: 2 additions & 0 deletions integration/subxt-tests/src/cases/events.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use contract_transcode::ContractMessageTranscoder;
use parity_scale_codec::{Compact, Decode, Input};
use sp_core::{crypto::AccountId32, hexdisplay::AsBytesRef};
Expand Down
2 changes: 2 additions & 0 deletions integration/subxt-tests/src/cases/external_call.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use contract_transcode::ContractMessageTranscoder;
use parity_scale_codec::{Decode, Encode};
use sp_core::{crypto::AccountId32, hexdisplay::AsBytesRef};
Expand Down
2 changes: 2 additions & 0 deletions integration/subxt-tests/src/cases/flipper.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use contract_transcode::ContractMessageTranscoder;
use parity_scale_codec::{Decode, Encode};
use sp_core::hexdisplay::AsBytesRef;
Expand Down
2 changes: 2 additions & 0 deletions integration/subxt-tests/src/cases/issue666.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use crate::{Contract, API};

#[tokio::test]
Expand Down
2 changes: 2 additions & 0 deletions integration/subxt-tests/src/cases/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

mod arrays;

mod array_struct_mapping_storage;
Expand Down
2 changes: 2 additions & 0 deletions integration/subxt-tests/src/cases/msg_sender.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use contract_transcode::ContractMessageTranscoder;
use parity_scale_codec::{Decode, Encode, Input};
use sp_core::{crypto::AccountId32, hexdisplay::AsBytesRef};
Expand Down
2 changes: 2 additions & 0 deletions integration/subxt-tests/src/cases/primitives.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use std::str::FromStr;

use contract_transcode::ContractMessageTranscoder;
Expand Down
2 changes: 2 additions & 0 deletions integration/subxt-tests/src/cases/randomizer.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use contract_transcode::ContractMessageTranscoder;
use parity_scale_codec::{Decode, Encode};
use sp_core::{hexdisplay::AsBytesRef, keccak_256};
Expand Down
2 changes: 2 additions & 0 deletions integration/subxt-tests/src/cases/store.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use contract_transcode::ContractMessageTranscoder;
use hex::FromHex;
use parity_scale_codec::{Decode, DecodeAll, Encode};
Expand Down
2 changes: 2 additions & 0 deletions integration/subxt-tests/src/cases/structs.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use contract_transcode::ContractMessageTranscoder;
use hex::FromHex;
use parity_scale_codec::{Decode, DecodeAll, Encode};
Expand Down
2 changes: 2 additions & 0 deletions integration/subxt-tests/src/cases/uniswapv2_erc20.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use contract_transcode::ContractMessageTranscoder;
use hex::FromHex;

Expand Down
2 changes: 2 additions & 0 deletions integration/subxt-tests/src/cases/uniswapv2_factory.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use contract_transcode::ContractMessageTranscoder;
use hex::FromHex;
use parity_scale_codec::{Decode, DecodeAll, Encode, Input};
Expand Down
2 changes: 2 additions & 0 deletions integration/subxt-tests/src/cases/uniswapv2_pair.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use std::ops::Mul;

use contract_transcode::ContractMessageTranscoder;
Expand Down
22 changes: 3 additions & 19 deletions integration/subxt-tests/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use contract_transcode::ContractMessageTranscoder;

use node::runtime_types::pallet_contracts::wasm::Determinism;
Expand All @@ -24,7 +26,7 @@ mod cases;

// metadata file obtained from the latest substrate-contracts-node
#[subxt::subxt(
runtime_metadata_path = "./metadata.scale",
runtime_metadata_url = "ws://localhost:9944",
substitute_type(
type = "sp_weights::weight_v2::Weight",
with = "::subxt::utils::Static<::sp_weights::Weight>"
Expand Down Expand Up @@ -219,14 +221,6 @@ impl Execution for ReadContract {
return_value: rv.result.map(|v| v.data.to_vec()).unwrap_or_default(),
})
}

// if rv.did_revert() {
// Err(anyhow::anyhow!("reverted"))
// } else {
// Ok(output::ReadSuccess {
// return_value: rv.data.to_vec(),
// })
// }
}
}

Expand Down Expand Up @@ -390,16 +384,6 @@ async fn read_call(
&mut rv.as_bytes_ref(),
)?;

// rv.result.map_err(|e| {
// if let DispatchError::Module(m) = e {
// if let Ok(d) = api.metadata().error(m.index, m.error[0]) {
// return anyhow::anyhow!("{d:?}");
// }
// }

// anyhow::anyhow!("{e:?}")
// })

Ok(rv)
}

Expand Down

0 comments on commit fefbe78

Please sign in to comment.