Skip to content

Commit

Permalink
sync alloy-zksync version with base alloy crate
Browse files Browse the repository at this point in the history
  • Loading branch information
itegulov committed Jan 24, 2025
1 parent 7c72273 commit 110acac
Show file tree
Hide file tree
Showing 14 changed files with 334 additions and 955 deletions.
545 changes: 116 additions & 429 deletions Cargo.lock

Large diffs are not rendered by default.

11 changes: 5 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ zksync_web3_decl = { git = "https://github.com/matter-labs/zksync-era.git", rev
#########################
# External dependencies #
#########################

# Keep `alloy-zksync` version in sync with base `alloy` crate to avoid two different sets of dependencies
alloy-zksync = "0.9.0"
alloy = { version = "0.9.2", default-features = false }

anyhow = "1.0"
alloy-signer-local = { version = "0.5.4", features = ["mnemonic"] }
alloy-signer = { version = "0.5.4", default-features = false }
alloy-dyn-abi = "0.5.4"
alloy-primitives = { version = "0.5.4" }
alloy-json-abi = "0.5.4"
async-trait = "0.1.85"
chrono = { version = "0.4.31", default-features = false }
clap = { version = "4.2.4", features = ["derive", "env"] }
Expand Down Expand Up @@ -87,7 +87,6 @@ url = "2.5.4"
httptest = "0.15.4"
tempdir = "0.3.7"
maplit = "1.0.2"
alloy-zksync = "0.9.0"
test-case = "3.3.1"
backon = "1.3.0"

Expand Down
4 changes: 2 additions & 2 deletions crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ anvil_zksync_config.workspace = true
anvil_zksync_api_server.workspace = true
anvil_zksync_types.workspace = true

alloy = { workspace = true, default-features = false, features = ["signer-mnemonic"] }

zksync_types.workspace = true
zksync_web3_decl.workspace = true

alloy-signer-local.workspace = true
anyhow.workspace = true
clap.workspace = true
eyre.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::utils::parse_genesis_file;
use alloy_signer_local::coins_bip39::{English, Mnemonic};
use alloy::signers::local::coins_bip39::{English, Mnemonic};
use anvil_zksync_config::constants::{
DEFAULT_DISK_CACHE_DIR, DEFAULT_MNEMONIC, TEST_NODE_NETWORK_ID,
};
Expand Down
4 changes: 2 additions & 2 deletions crates/config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ anvil_zksync_types.workspace = true
zksync_types.workspace = true
zksync_vm_interface.workspace = true

alloy-signer.workspace = true
alloy-signer-local.workspace = true
alloy = { workspace = true, default-features = false, features = ["signer-mnemonic"] }

clap.workspace = true
colored.workspace = true
hex.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/config/src/config.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::constants::*;
use crate::types::*;
use crate::utils::{format_eth, format_gwei};
use alloy_signer_local::PrivateKeySigner;
use alloy::signers::local::PrivateKeySigner;
use anvil_zksync_types::{
LogLevel, ShowCalls, ShowGasDetails, ShowStorageLogs, ShowVMDetails, TransactionOrder,
};
Expand Down
6 changes: 3 additions & 3 deletions crates/config/src/types/account_generator.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::constants::{DERIVATION_PATH, TEST_NODE_NETWORK_ID};
use alloy_signer::Signer;
use alloy_signer_local::coins_bip39::{English, Mnemonic};
use alloy_signer_local::{MnemonicBuilder, PrivateKeySigner};
use alloy::signers::local::coins_bip39::{English, Mnemonic};
use alloy::signers::local::{MnemonicBuilder, PrivateKeySigner};
use alloy::signers::Signer;
use serde::Deserialize;

/// Account Generator
Expand Down
4 changes: 1 addition & 3 deletions crates/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ tokio.workspace = true
futures.workspace = true
once_cell.workspace = true

alloy-json-abi.workspace = true
alloy-primitives.workspace = true
alloy-dyn-abi.workspace = true
alloy = { workspace = true, default-features = false, features = ["json-abi", "dyn-abi"] }

reqwest.workspace = true
serde.workspace = true
Expand Down
9 changes: 4 additions & 5 deletions crates/core/src/console_log.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use std::{collections::HashMap, str::FromStr};

use crate::utils::format_token;
use alloy_dyn_abi::JsonAbiExt;
use alloy_json_abi::{Function, Param, StateMutability};
use alloy_primitives::Selector;
use alloy::dyn_abi::JsonAbiExt;
use alloy::json_abi::{Function, Param, StateMutability};
use alloy::primitives::Selector;
use colored::Colorize;
use itertools::Itertools;
use zksync_multivm::interface::Call;
Expand Down Expand Up @@ -71,8 +71,7 @@ impl ConsoleLogHandler {
self.signature_map
.get(signature)
.map_or("Unknown log call.".to_owned(), |func| {
let tokens: Result<Vec<alloy_dyn_abi::DynSolValue>, alloy_dyn_abi::Error> =
func.abi_decode_input(&current_call.input.as_slice()[4..], false);
let tokens = func.abi_decode_input(&current_call.input.as_slice()[4..], false);
tokens.map_or("Failed to parse inputs for log.".to_owned(), |tokens| {
tokens.iter().map(|t| format_token(t, false)).join(" ")
})
Expand Down
12 changes: 6 additions & 6 deletions crates/core/src/node/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ impl InMemoryNode {

#[cfg(test)]
mod tests {
use alloy_dyn_abi::{DynSolValue, FunctionExt, JsonAbiExt};
use alloy_json_abi::{Function, Param};
use alloy_primitives::{Address as AlloyAddress, U256 as AlloyU256};
use alloy::dyn_abi::{DynSolValue, FunctionExt, JsonAbiExt};
use alloy::json_abi::{Function, Param, StateMutability};
use alloy::primitives::{Address as AlloyAddress, U256 as AlloyU256};
use anvil_zksync_config::constants::DEFAULT_ACCOUNT_BALANCE;
use zksync_types::{
transaction_request::CallRequestBuilder, utils::deployed_address_create, Address,
Expand Down Expand Up @@ -209,7 +209,7 @@ mod tests {
components: vec![],
internal_type: None,
}],
state_mutability: alloy_json_abi::StateMutability::NonPayable,
state_mutability: StateMutability::NonPayable,
};

let calldata = func
Expand Down Expand Up @@ -284,7 +284,7 @@ mod tests {
internal_type: None,
}],
outputs: vec![],
state_mutability: alloy_json_abi::StateMutability::NonPayable,
state_mutability: StateMutability::NonPayable,
};

let calldata = func
Expand Down Expand Up @@ -330,7 +330,7 @@ mod tests {
name: "shouldRevert".to_string(),
inputs: vec![],
outputs: vec![],
state_mutability: alloy_json_abi::StateMutability::NonPayable,
state_mutability: StateMutability::NonPayable,
};

// trace a call to the primary contract
Expand Down
8 changes: 4 additions & 4 deletions crates/core/src/node/inner/in_memory_inner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1417,8 +1417,8 @@ impl InMemoryNodeInner {
calldata: Option<Vec<u8>>,
nonce: zksync_types::Nonce,
) -> H256 {
use alloy_dyn_abi::{DynSolValue, JsonAbiExt};
use alloy_json_abi::{Function, Param, StateMutability};
use alloy::dyn_abi::{DynSolValue, JsonAbiExt};
use alloy::json_abi::{Function, Param, StateMutability};
use alloy_zksync::network::unsigned_tx::eip712::hash_bytecode;

let salt = [0u8; 32];
Expand Down Expand Up @@ -1563,8 +1563,8 @@ mod tests {
use crate::node::inner::fork_storage::ForkStorage;
use crate::testing;
use crate::testing::{TransactionBuilder, STORAGE_CONTRACT_BYTECODE};
use alloy_dyn_abi::{DynSolType, DynSolValue};
use alloy_primitives::U256 as AlloyU256;
use alloy::dyn_abi::{DynSolType, DynSolValue};
use alloy::primitives::U256 as AlloyU256;
use anvil_zksync_config::constants::{
DEFAULT_ACCOUNT_BALANCE, DEFAULT_ESTIMATE_GAS_PRICE_SCALE_FACTOR,
DEFAULT_ESTIMATE_GAS_SCALE_FACTOR, DEFAULT_FAIR_PUBDATA_PRICE, DEFAULT_L2_GAS_PRICE,
Expand Down
4 changes: 2 additions & 2 deletions crates/core/src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use alloy_dyn_abi::DynSolValue;
use alloy_primitives::{Sign, I256, U256 as AlloyU256};
use alloy::dyn_abi::DynSolValue;
use alloy::primitives::{Sign, I256, U256 as AlloyU256};
use anyhow::Context;
use chrono::{DateTime, Utc};
use colored::Colorize;
Expand Down
Loading

0 comments on commit 110acac

Please sign in to comment.