Skip to content

Commit

Permalink
chore(blockifier_reexecution): remove const for json rpc version
Browse files Browse the repository at this point in the history
commit-id:81012ae2
  • Loading branch information
Itay-Tsabary-Starkware committed Dec 10, 2024
1 parent 855b928 commit 73181bc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 deletions.
6 changes: 1 addition & 5 deletions crates/blockifier_reexecution/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use blockifier_reexecution::state_reader::utils::{
guess_chain_id_from_node_url,
reexecute_and_verify_correctness,
write_block_reexecution_data_to_file,
JSON_RPC_VERSION,
};
use clap::{Args, Parser, Subcommand};
use google_cloud_storage::client::{Client, ClientConfig};
Expand Down Expand Up @@ -181,10 +180,7 @@ async fn main() {
rpc_args.node_url
);

let config = RpcStateReaderConfig {
url: rpc_args.node_url.clone(),
json_rpc_version: JSON_RPC_VERSION.to_string(),
};
let config = RpcStateReaderConfig::from_url(rpc_args.node_url.clone());

// RPC calls are "synchronous IO" (see, e.g., https://stackoverflow.com/questions/74547541/when-should-you-use-tokios-spawn-blocking)
// for details), so should be executed in a blocking thread.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ pub fn get_test_block_id() -> BlockId {
}

pub fn get_test_rpc_config() -> RpcStateReaderConfig {
RpcStateReaderConfig { url: get_test_url(), json_rpc_version: "2.0".to_string() }
RpcStateReaderConfig::from_url(get_test_url())
}

#[fixture]
Expand Down
11 changes: 3 additions & 8 deletions crates/blockifier_reexecution/src/state_reader/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ pub static RPC_NODE_URL: LazyLock<String> = LazyLock::new(|| {
env::var("TEST_URL")
.unwrap_or_else(|_| "https://free-rpc.nethermind.io/mainnet-juno/".to_string())
});
pub const JSON_RPC_VERSION: &str = "2.0";

pub fn guess_chain_id_from_node_url(node_url: &str) -> ReexecutionResult<ChainId> {
match (
Expand Down Expand Up @@ -59,12 +58,9 @@ pub fn get_fee_token_addresses(chain_id: &ChainId) -> FeeTokenAddresses {
}
}

/// Returns the RPC state reader configuration with the constants RPC_NODE_URL and JSON_RPC_VERSION.
/// Returns the RPC state reader configuration with the constant RPC_NODE_URL.
pub fn get_rpc_state_reader_config() -> RpcStateReaderConfig {
RpcStateReaderConfig {
url: RPC_NODE_URL.clone(),
json_rpc_version: JSON_RPC_VERSION.to_string(),
}
RpcStateReaderConfig::from_url(RPC_NODE_URL.clone())
}

/// Returns the chain info of mainnet.
Expand Down Expand Up @@ -260,8 +256,7 @@ pub fn write_block_reexecution_data_to_file(
node_url: String,
chain_id: ChainId,
) {
let config =
RpcStateReaderConfig { url: node_url, json_rpc_version: JSON_RPC_VERSION.to_string() };
let config = RpcStateReaderConfig::from_url(node_url);

let consecutive_state_readers = ConsecutiveTestStateReaders::new(
block_number.prev().expect("Should not run with block 0"),
Expand Down

0 comments on commit 73181bc

Please sign in to comment.