Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions substrate/frame/revive/dev-node/node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,13 @@ impl SubstrateCli for Cli {
}
}

/// Parse and run command line arguments
pub fn run() -> sc_cli::Result<()> {
let args = std::env::args_os().collect::<Vec<_>>();
let args = std::env::args_os().map(|s| s.to_string_lossy().to_string()).collect::<Vec<_>>();
return run_with_args(args);
}

/// Parse and run command line arguments
pub fn run_with_args(args: Vec<String>) -> sc_cli::Result<()> {
let mut cli = Cli::from_iter(args);

match &cli.subcommand {
Expand Down
1 change: 1 addition & 0 deletions substrate/frame/revive/dev-node/node/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@

pub mod chain_spec;
pub(crate) mod cli;
pub mod command;
pub mod rpc;
pub mod service;
2 changes: 1 addition & 1 deletion substrate/frame/revive/rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ tokio = { workspace = true, features = ["full"] }
env_logger = { workspace = true }
pallet-revive-fixtures = { workspace = true, default-features = true }
pretty_assertions = { workspace = true }
revive-dev-node = { workspace = true }
sp-io = { workspace = true, default-features = true }
static_init = { workspace = true }
substrate-cli-test-utils = { workspace = true }

[build-dependencies]
git2 = { workspace = true }
Expand Down
18 changes: 9 additions & 9 deletions substrate/frame/revive/rpc/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ use pallet_revive::{
};
use static_init::dynamic;
use std::{collections::BTreeMap, sync::Arc, thread};
use substrate_cli_test_utils::*;
use subxt::{
backend::rpc::RpcClient,
ext::subxt_rpcs::rpc_params,
Expand Down Expand Up @@ -72,14 +71,12 @@ struct SharedResources {

impl SharedResources {
fn start() -> Self {
// Start the node.
// Start revive-dev-node
let _node_handle = thread::spawn(move || {
if let Err(e) = start_node_inline(vec![
"--dev",
"--rpc-port=45789",
"--no-telemetry",
"--no-prometheus",
"-lerror,evm=debug,sc_rpc_server=info,runtime::revive=trace",
if let Err(e) = revive_dev_node::command::run_with_args(vec![
"--dev".to_string(),
"--rpc-port=45789".to_string(),
"-lerror,sc_rpc_server=info,runtime::revive=debug".to_string(),
]) {
panic!("Node exited with error: {e:?}");
}
Expand Down Expand Up @@ -443,7 +440,10 @@ async fn runtime_api_dry_run_addr_works() -> anyhow::Result<()> {
None,
);

let nonce = client.get_transaction_count(account.address(), BlockTag::Latest.into()).await?;
// runtime_api.at_latest() uses the latest finalized block, query nonce accordingly
let nonce = client
.get_transaction_count(account.address(), BlockTag::Finalized.into())
.await?;
Comment on lines +434 to +437
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should not matter which tag you use does it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test was failing intermittently when the test order was not fixed, because the nonce retrieved using get_transaction_count was using BlockTag::Latest while the instantiate method was using BlockTag::Finalized. The first one was returning a higher value than the second one, typically the second one was returning 1.

let contract_address = create1(&account.address(), nonce.try_into().unwrap());

let c = OnlineClient::<SrcChainConfig>::from_url("ws://localhost:45789").await?;
Expand Down
Loading