From f24b8f06a47afc21b387203c5bb483a6b3b9395c Mon Sep 17 00:00:00 2001 From: Bartosz Zawistowski Date: Mon, 25 Nov 2024 11:02:11 +0100 Subject: [PATCH 1/9] Save --- zilliqa/src/api/eth.rs | 44 ++++++++++++++++++++++++++++++ zilliqa/src/api/types/eth.rs | 28 +++++++++++++++++++ zilliqa/src/state.rs | 51 ++++++++++++++++++++++++++++++++++- zilliqa/tests/it/eth.rs | 52 +++++++++++++++++++++++++++++++++--- 4 files changed, 171 insertions(+), 4 deletions(-) diff --git a/zilliqa/src/api/eth.rs b/zilliqa/src/api/eth.rs index 3624b6bcde..6911b3dc9b 100644 --- a/zilliqa/src/api/eth.rs +++ b/zilliqa/src/api/eth.rs @@ -24,6 +24,7 @@ use jsonrpsee::{ }, PendingSubscriptionSink, RpcModule, SubscriptionMessage, }; +use revm::primitives::Bytecode; use serde::Deserialize; use tracing::*; @@ -44,6 +45,7 @@ use crate::{ time::SystemTime, transaction::{EvmGas, Log, SignedTransaction}, }; +use crate::api::types::eth::{Proof, StorageProof}; pub fn rpc_module(node: Arc>) -> RpcModule>> { let mut module = super::declare_module!( @@ -59,6 +61,7 @@ pub fn rpc_module(node: Arc>) -> RpcModule>> { ("eth_getStorageAt", get_storage_at), ("eth_getTransactionCount", get_transaction_count), ("eth_gasPrice", get_gas_price), + ("eth_getProof", get_proof), ("eth_getBlockByNumber", get_block_by_number), ("eth_getBlockByHash", get_block_by_hash), ( @@ -90,6 +93,7 @@ pub fn rpc_module(node: Arc>) -> RpcModule>> { ("eth_syncing", syncing), ("net_peerCount", net_peer_count), ("net_listening", net_listening), + ], ); @@ -894,6 +898,46 @@ fn net_listening(_: Params, _: &Arc>) -> Result { Ok(true) } +fn get_proof(params: Params, node: &Arc>) -> Result { + let mut params = params.sequence(); + let address: Address = params.next()?; + let storage_keys: Vec = params.next()?; + let storage_keys = storage_keys + .into_iter() + .map(|key| B256::new(key.to_be_bytes())) + .collect::>(); + let block_id: BlockId = params.next()?; + expect_end_of_params(&mut params, 3, 3)?; + + let node = node.lock().unwrap(); + + let block = node.get_block(block_id)?; + + let block = build_errored_response_for_missing_block(block_id, block)?; + + let state = node.consensus.state().at_root(block.state_root_hash().into()); + + let computed_proof = state.get_proof(address, &storage_keys)?; + + let acc_code = Bytecode::new_raw(computed_proof.account.code.evm_code().unwrap_or_default().into()); + + info!("Block state root is: {:?}", block.state_root_hash()); + + Ok(Proof { + address, + account_proof: computed_proof.account_proof, + storage_proof: computed_proof.storage_proofs.into_iter().map(|single_item| StorageProof { + proof: single_item.proof, + key: single_item.key, + value: single_item.value + }).collect(), + nonce: computed_proof.account.nonce, + balance: computed_proof.account.balance, + storage_hash: computed_proof.account.storage_root, + code_hash: acc_code.hash_slow() + }) +} + #[allow(clippy::redundant_allocation)] async fn subscribe( params: Params<'_>, diff --git a/zilliqa/src/api/types/eth.rs b/zilliqa/src/api/types/eth.rs index cd97342dfb..44d5484101 100644 --- a/zilliqa/src/api/types/eth.rs +++ b/zilliqa/src/api/types/eth.rs @@ -469,6 +469,34 @@ pub enum SyncingResult { Struct(SyncingStruct), } +#[derive(Debug, Clone, Serialize)] +pub struct StorageProof { + #[serde(serialize_with = "hex")] + pub key: B256, + #[serde(serialize_with = "hex")] + pub value: Vec, + #[serde(serialize_with = "vec_hex")] + pub proof: Vec>, +} + +#[derive(Debug, Clone, Serialize)] +pub struct Proof { + #[serde(serialize_with = "hex")] + pub address: Address, + #[serde(serialize_with = "hex")] + pub balance: u128, + #[serde(rename = "codeHash", serialize_with = "hex")] + pub code_hash: B256, + #[serde(serialize_with = "hex")] + pub nonce: u64, + #[serde(rename = "storageHash", serialize_with = "hex")] + pub storage_hash: B256, + #[serde(rename = "accountProof", serialize_with = "vec_hex")] + pub account_proof: Vec>, + #[serde(rename = "storageProof")] + pub storage_proof: Vec, +} + #[cfg(test)] mod tests { use alloy::primitives::B256; diff --git a/zilliqa/src/state.rs b/zilliqa/src/state.rs index 4c352aaeee..a23f80fa06 100644 --- a/zilliqa/src/state.rs +++ b/zilliqa/src/state.rs @@ -13,7 +13,7 @@ use eth_trie::{EthTrie as PatriciaTrie, Trie}; use ethabi::Token; use serde::{Deserialize, Serialize}; use sha3::{Digest, Keccak256}; - +use tracing::info; use crate::{ block_store::BlockStore, cfg::{Amount, NodeConfig, ScillaExtLibsPath}, @@ -26,6 +26,19 @@ use crate::{ transaction::EvmGas, }; +#[derive(Debug, Default, Clone, Serialize, Deserialize)] +pub struct StorageProof { + pub key: B256, + pub value: Vec, + pub proof: Vec>, +} +#[derive(Debug, Default, Clone, Serialize, Deserialize)] +pub struct Proof { + pub account: Account, + pub account_proof: Vec>, + pub storage_proofs: Vec, +} + #[derive(Clone, Debug)] /// The state of the blockchain, consisting of: /// - state - a database of Map> @@ -324,6 +337,42 @@ impl State { &bincode::serialize(&account)?, )?) } + + pub fn get_proof(&self, address: Address, storage_keys: &[B256]) -> Result { + if !self.has_account(address)? { + return Ok(Proof::default()); + }; + + // get_proof() requires &mut so clone state and don't mutate the origin + let mut state = self.clone(); + + let _root = state.root_hash()?; + info!("Enforced root is: {:?}", _root); + + let account = state.get_account(address)?; + + let account_proof = state.accounts.get_proof(Self::account_key(address).as_slice())?; + + let mut storage_trie = state.get_account_trie(address.into())?; + + let storage_proofs = { + let mut storage_proofs = Vec::new(); + for key in storage_keys { + let Some(value) = storage_trie.get(key.as_slice())? else { + continue; + }; + let proof = storage_trie.get_proof(key.as_slice())?; + storage_proofs.push(StorageProof { proof, key: *key, value }); + } + storage_proofs + }; + + Ok(Proof { + account, + account_proof, + storage_proofs, + }) + } } pub mod contract_addr { diff --git a/zilliqa/tests/it/eth.rs b/zilliqa/tests/it/eth.rs index 54d55ed002..64c5c7e41c 100644 --- a/zilliqa/tests/it/eth.rs +++ b/zilliqa/tests/it/eth.rs @@ -1,5 +1,6 @@ +use tracing::info; use std::{fmt::Debug, ops::DerefMut}; - +use std::sync::Arc; use alloy::primitives::{hex, Address}; use ethabi::{ethereum_types::U64, Token}; use ethers::{ @@ -18,9 +19,11 @@ use ethers::{ }; use futures::{future::join_all, StreamExt}; use primitive_types::{H160, H256}; +use alloy::primitives::B256; use serde::{Deserialize, Serialize}; - -use crate::{deploy_contract, LocalRpcClient, Network, Wallet}; +use eth_trie::{EthTrie, MemoryDB, Trie}; +use zilliqa::state::{Account, State}; +use crate::{deploy_contract, node, LocalRpcClient, Network, Wallet}; #[zilliqa_macros::test] async fn call_block_number(mut network: Network) { @@ -1437,3 +1440,46 @@ async fn test_eth_syncing(mut network: Network) { .unwrap(); assert_eq!(result, SyncingResult::Bool(false)) } + +#[zilliqa_macros::test] +async fn test_eth_get_proof(mut network: Network) { + let wallet = network.genesis_wallet().await; + + // Example from https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getstorageat. + let (hash, abi) = deploy_contract( + "tests/it/contracts/Storage.sol", + "Storage", + &wallet, + &mut network, + ) + .await; + + let sender_address = wallet.address(); + let receipt = wallet.get_transaction_receipt(hash).await.unwrap().unwrap(); + let contract_address = receipt.contract_address.unwrap(); + + let latest_block = wallet.get_block_number().await.unwrap(); + + let latest_block = wallet.get_block(latest_block).await.unwrap().unwrap(); + info!("In test latest bloock root hash is: {:?}", latest_block.state_root); + + let proof = wallet.get_proof(contract_address, vec![], None).await.unwrap(); + + let memdb = Arc::new(MemoryDB::new(true)); + let mut trie = EthTrie::new(Arc::clone(&memdb)); + + let account_proof = proof.account_proof.iter().map(|elem| elem.to_vec()).collect::>(); + + let _verif_result = trie.verify_proof(B256::from_slice(latest_block.state_root.as_bytes()), State::account_key(Address::from(contract_address.0)).as_slice(), account_proof).unwrap().unwrap(); + + let recovered_account = bincode::deserialize::(&_verif_result).unwrap(); + assert_eq!(recovered_account.balance, 0); + + let node = &network.nodes[0]; + let _second = node.inner.lock().unwrap().consensus.state().get_proof(Address::from(contract_address.0), &*vec![]); + + let _value = trie.get(contract_address.as_bytes()).unwrap(); + + + assert_eq!(proof.address, contract_address); +} From f4729a01296d0d5f62ab35949199e2bbbf6b798d Mon Sep 17 00:00:00 2001 From: Bartosz Zawistowski Date: Wed, 8 Jan 2025 14:46:59 +0100 Subject: [PATCH 2/9] Save --- zilliqa/src/api/eth.rs | 7 ------- zilliqa/src/state.rs | 6 +++++- zilliqa/tests/it/eth.rs | 24 ++++++++++++++++++++++-- 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/zilliqa/src/api/eth.rs b/zilliqa/src/api/eth.rs index f14cd1c8e0..cbe60d0e3b 100644 --- a/zilliqa/src/api/eth.rs +++ b/zilliqa/src/api/eth.rs @@ -82,7 +82,6 @@ pub fn rpc_module( ("eth_getFilterChanges", get_filter_changes), ("eth_getFilterLogs", get_filter_logs), ("eth_getLogs", get_logs), - ("eth_getProof", get_proof), ("eth_getStorageAt", get_storage_at), ( "eth_getTransactionByBlockHashAndIndex", @@ -1089,12 +1088,6 @@ fn get_filter_logs(_params: Params, _node: &Arc>) -> Result<()> { todo!("Endpoint not implemented yet") } -/// eth_getProof -/// Returns the account and storage values of the specified account including the Merkle-proof. -fn get_proof(_params: Params, _node: &Arc>) -> Result<()> { - todo!("Endpoint not implemented yet") -} - /// eth_hashrate /// Returns the number of hashes per second that the node is mining with. fn hashrate(_params: Params, _node: &Arc>) -> Result<()> { diff --git a/zilliqa/src/state.rs b/zilliqa/src/state.rs index 95de33df2f..91c4a3c148 100644 --- a/zilliqa/src/state.rs +++ b/zilliqa/src/state.rs @@ -413,15 +413,19 @@ impl State { let account_proof = state.accounts.get_proof(Self::account_key(address).as_slice())?; let mut storage_trie = state.get_account_trie(address.into())?; + let _root = storage_trie.root_hash()?; + + info!("Trie root is: {:?}, account storage root is: {:?}", storage_trie.root_hash()?, account.storage_root); let storage_proofs = { let mut storage_proofs = Vec::new(); for key in storage_keys { + let key = Self::account_storage_key(address, *key); let Some(value) = storage_trie.get(key.as_slice())? else { continue; }; let proof = storage_trie.get_proof(key.as_slice())?; - storage_proofs.push(StorageProof { proof, key: *key, value }); + storage_proofs.push(StorageProof { proof, key, value }); } storage_proofs }; diff --git a/zilliqa/tests/it/eth.rs b/zilliqa/tests/it/eth.rs index 9118e255f7..9dc9f0f0d3 100644 --- a/zilliqa/tests/it/eth.rs +++ b/zilliqa/tests/it/eth.rs @@ -1,6 +1,9 @@ use tracing::info; use std::{fmt::Debug, ops::DerefMut}; +use std::io::Read; +use std::str::FromStr; use std::sync::Arc; +use alloy::consensus::EMPTY_ROOT_HASH; use alloy::primitives::{hex, Address}; use ethabi::{ethereum_types::U64, Token}; use ethers::{ @@ -20,6 +23,7 @@ use ethers::{ use futures::{future::join_all, StreamExt}; use primitive_types::{H160, H256}; use alloy::primitives::B256; +use ethers::prelude::contract; use serde::{Deserialize, Serialize}; use eth_trie::{EthTrie, MemoryDB, Trie}; use zilliqa::state::{Account, State}; @@ -1499,7 +1503,23 @@ async fn test_eth_get_proof(mut network: Network) { let latest_block = wallet.get_block(latest_block).await.unwrap().unwrap(); info!("In test latest bloock root hash is: {:?}", latest_block.state_root); - let proof = wallet.get_proof(contract_address, vec![], None).await.unwrap(); + + let storage_keys: Vec = { + let node = network.nodes[0].inner.lock().unwrap(); + let contract_account = node.consensus.state().get_account(Address::from(contract_address.0)).unwrap(); + let db = node.db.clone().state_trie().unwrap(); + let storage_trie = EthTrie::new(Arc::new(db)); + let storage_trie = storage_trie.at_root(contract_account.storage_root.into()); + storage_trie.iter().map(|(key, _)| H256::from_slice(&key)).collect::>() + }; + + let mut bytes = [0u8; 32]; + bytes[31] = 0; + let storage_keys = vec![H256::from(bytes)]; + //let storage_keys = vec![]; + //let storage_keys = storage_trie. + + let proof = wallet.get_proof(contract_address, storage_keys, None).await.unwrap(); let memdb = Arc::new(MemoryDB::new(true)); let mut trie = EthTrie::new(Arc::clone(&memdb)); @@ -1517,5 +1537,5 @@ async fn test_eth_get_proof(mut network: Network) { let _value = trie.get(contract_address.as_bytes()).unwrap(); - assert_eq!(proof.address, contract_address); + assert_eq!(proof.address.0, contract_address.0); } \ No newline at end of file From 2bee94686f045f4afdbd4bca29f59563be516945 Mon Sep 17 00:00:00 2001 From: Bartosz Zawistowski Date: Wed, 8 Jan 2025 17:50:05 +0100 Subject: [PATCH 3/9] Saving progress --- zilliqa/src/api/eth.rs | 41 ++++++++---- zilliqa/src/state.rs | 16 ++--- zilliqa/tests/it/eth.rs | 141 +++++++++++++++++++++++++++------------- 3 files changed, 129 insertions(+), 69 deletions(-) diff --git a/zilliqa/src/api/eth.rs b/zilliqa/src/api/eth.rs index cbe60d0e3b..7f6298907a 100644 --- a/zilliqa/src/api/eth.rs +++ b/zilliqa/src/api/eth.rs @@ -35,7 +35,10 @@ use super::{ }, }; use crate::{ - api::zilliqa::ZilAddress, + api::{ + types::eth::{Proof, StorageProof}, + zilliqa::ZilAddress, + }, cfg::EnabledApi, crypto::Hash, error::ensure_success, @@ -46,7 +49,6 @@ use crate::{ time::SystemTime, transaction::{EvmGas, Log, SignedTransaction}, }; -use crate::api::types::eth::{Proof, StorageProof}; pub fn rpc_module( node: Arc>, @@ -910,26 +912,39 @@ fn get_proof(params: Params, node: &Arc>) -> Result { let block = build_errored_response_for_missing_block(block_id, block)?; - let state = node.consensus.state().at_root(block.state_root_hash().into()); - + let mut state = node + .consensus + .state() + .at_root(block.state_root_hash().into()); + // recover from db root node using given root hash + let _ = state.root_hash()?; let computed_proof = state.get_proof(address, &storage_keys)?; - let acc_code = Bytecode::new_raw(computed_proof.account.code.evm_code().unwrap_or_default().into()); - - info!("Block state root is: {:?}", block.state_root_hash()); + let acc_code = Bytecode::new_raw( + computed_proof + .account + .code + .evm_code() + .unwrap_or_default() + .into(), + ); Ok(Proof { address, account_proof: computed_proof.account_proof, - storage_proof: computed_proof.storage_proofs.into_iter().map(|single_item| StorageProof { - proof: single_item.proof, - key: single_item.key, - value: single_item.value - }).collect(), + storage_proof: computed_proof + .storage_proofs + .into_iter() + .map(|single_item| StorageProof { + proof: single_item.proof, + key: single_item.key, + value: single_item.value, + }) + .collect(), nonce: computed_proof.account.nonce, balance: computed_proof.account.balance, storage_hash: computed_proof.account.storage_root, - code_hash: acc_code.hash_slow() + code_hash: acc_code.hash_slow(), }) } diff --git a/zilliqa/src/state.rs b/zilliqa/src/state.rs index 91c4a3c148..088ec949d8 100644 --- a/zilliqa/src/state.rs +++ b/zilliqa/src/state.rs @@ -14,7 +14,6 @@ use ethabi::Token; use once_cell::sync::Lazy; use serde::{Deserialize, Serialize}; use sha3::{Digest, Keccak256}; -use tracing::info; use tracing::debug; use crate::{ @@ -404,18 +403,15 @@ impl State { // get_proof() requires &mut so clone state and don't mutate the origin let mut state = self.clone(); - - let _root = state.root_hash()?; - info!("Enforced root is: {:?}", _root); - + state.root_hash()?; let account = state.get_account(address)?; - let account_proof = state.accounts.get_proof(Self::account_key(address).as_slice())?; - - let mut storage_trie = state.get_account_trie(address.into())?; - let _root = storage_trie.root_hash()?; + let account_proof = state + .accounts + .get_proof(Self::account_key(address).as_slice())?; - info!("Trie root is: {:?}, account storage root is: {:?}", storage_trie.root_hash()?, account.storage_root); + let mut storage_trie = state.get_account_trie(address)?; + storage_trie.root_hash()?; let storage_proofs = { let mut storage_proofs = Vec::new(); diff --git a/zilliqa/tests/it/eth.rs b/zilliqa/tests/it/eth.rs index 9dc9f0f0d3..a671db7933 100644 --- a/zilliqa/tests/it/eth.rs +++ b/zilliqa/tests/it/eth.rs @@ -1,14 +1,12 @@ -use tracing::info; -use std::{fmt::Debug, ops::DerefMut}; -use std::io::Read; -use std::str::FromStr; -use std::sync::Arc; -use alloy::consensus::EMPTY_ROOT_HASH; -use alloy::primitives::{hex, Address}; +use std::{fmt::Debug, ops::DerefMut, sync::Arc}; + +use alloy::primitives::{hex, Address, B256}; +use eth_trie::{EthTrie, MemoryDB, Trie}; use ethabi::{ethereum_types::U64, Token}; use ethers::{ abi::FunctionExt, core::types::{Bytes, Signature}, + prelude::contract, providers::{Middleware, MiddlewareError, Provider}, types::{ transaction::{ @@ -22,11 +20,12 @@ use ethers::{ }; use futures::{future::join_all, StreamExt}; use primitive_types::{H160, H256}; -use alloy::primitives::B256; -use ethers::prelude::contract; use serde::{Deserialize, Serialize}; -use eth_trie::{EthTrie, MemoryDB, Trie}; -use zilliqa::state::{Account, State}; +use zilliqa::{ + scilla::storage_key, + state::{Account, State}, +}; + use crate::{deploy_contract, node, LocalRpcClient, Network, Wallet}; #[zilliqa_macros::test] @@ -1492,50 +1491,100 @@ async fn test_eth_get_proof(mut network: Network) { &wallet, &mut network, ) - .await; + .await; - let sender_address = wallet.address(); let receipt = wallet.get_transaction_receipt(hash).await.unwrap().unwrap(); let contract_address = receipt.contract_address.unwrap(); - let latest_block = wallet.get_block_number().await.unwrap(); - - let latest_block = wallet.get_block(latest_block).await.unwrap().unwrap(); - info!("In test latest bloock root hash is: {:?}", latest_block.state_root); + let deployed_at_block = receipt.block_number.unwrap().as_u64(); + let deployed_at_block = wallet.get_block(deployed_at_block).await.unwrap().unwrap(); - - let storage_keys: Vec = { + let contract_account = { let node = network.nodes[0].inner.lock().unwrap(); - let contract_account = node.consensus.state().get_account(Address::from(contract_address.0)).unwrap(); - let db = node.db.clone().state_trie().unwrap(); - let storage_trie = EthTrie::new(Arc::new(db)); - let storage_trie = storage_trie.at_root(contract_account.storage_root.into()); - storage_trie.iter().map(|(key, _)| H256::from_slice(&key)).collect::>() + node.consensus + .state() + .get_account(Address::from(contract_address.0)) + .unwrap() }; - let mut bytes = [0u8; 32]; - bytes[31] = 0; - let storage_keys = vec![H256::from(bytes)]; - //let storage_keys = vec![]; - //let storage_keys = storage_trie. - - let proof = wallet.get_proof(contract_address, storage_keys, None).await.unwrap(); - - let memdb = Arc::new(MemoryDB::new(true)); - let mut trie = EthTrie::new(Arc::clone(&memdb)); - - let account_proof = proof.account_proof.iter().map(|elem| elem.to_vec()).collect::>(); - - let _verif_result = trie.verify_proof(B256::from_slice(latest_block.state_root.as_bytes()), State::account_key(Address::from(contract_address.0)).as_slice(), account_proof).unwrap().unwrap(); - - let recovered_account = bincode::deserialize::(&_verif_result).unwrap(); - assert_eq!(recovered_account.balance, 0); + // A single storage item with slot = 0 + let storage_key = H256::from([0u8; 32]); + let storage_keys = vec![storage_key]; + let proof = wallet + .get_proof( + contract_address, + storage_keys, + Some(BlockNumber::from(deployed_at_block.number.unwrap()).into()), + ) + .await + .unwrap(); - let node = &network.nodes[0]; - let _second = node.inner.lock().unwrap().consensus.state().get_proof(Address::from(contract_address.0), &*vec![]); + let storage_value = { + let node = network.nodes[0].inner.lock().unwrap(); + node.consensus + .state() + .get_account_storage( + Address::from(contract_address.0), + B256::from_slice(storage_key.as_bytes()), + ) + .unwrap() + }; - let _value = trie.get(contract_address.as_bytes()).unwrap(); + // Verify account + { + let memdb = Arc::new(MemoryDB::new(true)); + let trie = EthTrie::new(Arc::clone(&memdb)); + + let account_proof = proof + .account_proof + .iter() + .map(|elem| elem.to_vec()) + .collect::>(); + + let verify_result = trie + .verify_proof( + B256::from_slice(deployed_at_block.state_root.as_bytes()), + State::account_key(Address::from(contract_address.0)).as_slice(), + account_proof, + ) + .unwrap() + .unwrap(); + + let recovered_account = bincode::deserialize::(&verify_result).unwrap(); + assert_eq!(recovered_account.balance, 0); + assert_eq!( + recovered_account.storage_root, + contract_account.storage_root + ); + } + // Verify storage key + { + let memdb = Arc::new(MemoryDB::new(true)); + let trie = EthTrie::new(Arc::clone(&memdb)); + + let mut storage_proof = vec![]; + + for single_proof in proof.storage_proof { + let bytes = &single_proof.proof; + for byte in bytes { + storage_proof.push(byte.to_vec()); + } + } + + let verify_result = trie + .verify_proof( + B256::from_slice(contract_account.storage_root.as_slice()), + State::account_storage_key( + Address::from(contract_address.0), + B256::from_slice(storage_key.as_bytes()), + ) + .as_slice(), + storage_proof, + ) + .unwrap() + .unwrap(); - assert_eq!(proof.address.0, contract_address.0); -} \ No newline at end of file + assert_eq!(verify_result.as_slice(), storage_value.as_slice()); + } +} From 90ade3dd56c58423ac8a3d68cde1a3cad7361f11 Mon Sep 17 00:00:00 2001 From: Bartosz Zawistowski Date: Fri, 10 Jan 2025 13:44:08 +0100 Subject: [PATCH 4/9] Further progress --- eth-trie.rs/src/trie.rs | 1 + zilliqa/src/api/eth.rs | 4 +--- zilliqa/tests/it/eth.rs | 16 ++++++++-------- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/eth-trie.rs/src/trie.rs b/eth-trie.rs/src/trie.rs index 8ce809cd30..66b03419d7 100644 --- a/eth-trie.rs/src/trie.rs +++ b/eth-trie.rs/src/trie.rs @@ -380,6 +380,7 @@ where /// nodes of the longest existing prefix of the key (at least the root node), ending /// with the node that proves the absence of the key. fn get_proof(&mut self, key: &[u8]) -> TrieResult>> { + self.commit()?; let key_path = &Nibbles::from_raw(key, true); let result = self.get_path_at(&self.root, key_path, 0); diff --git a/zilliqa/src/api/eth.rs b/zilliqa/src/api/eth.rs index 7f6298907a..b88d4efc91 100644 --- a/zilliqa/src/api/eth.rs +++ b/zilliqa/src/api/eth.rs @@ -912,12 +912,10 @@ fn get_proof(params: Params, node: &Arc>) -> Result { let block = build_errored_response_for_missing_block(block_id, block)?; - let mut state = node + let state = node .consensus .state() .at_root(block.state_root_hash().into()); - // recover from db root node using given root hash - let _ = state.root_hash()?; let computed_proof = state.get_proof(address, &storage_keys)?; let acc_code = Bytecode::new_raw( diff --git a/zilliqa/tests/it/eth.rs b/zilliqa/tests/it/eth.rs index a671db7933..8ca6191726 100644 --- a/zilliqa/tests/it/eth.rs +++ b/zilliqa/tests/it/eth.rs @@ -1563,14 +1563,14 @@ async fn test_eth_get_proof(mut network: Network) { let memdb = Arc::new(MemoryDB::new(true)); let trie = EthTrie::new(Arc::clone(&memdb)); - let mut storage_proof = vec![]; - - for single_proof in proof.storage_proof { - let bytes = &single_proof.proof; - for byte in bytes { - storage_proof.push(byte.to_vec()); - } - } + // There's only a single key we want to proove + let single_proof = proof.storage_proof.last().unwrap(); + + let storage_proof = single_proof + .proof + .iter() + .map(|elem| elem.to_vec()) + .collect::>(); let verify_result = trie .verify_proof( From c58b2c9cd0bf37e824770c25895bf7cd56c9af74 Mon Sep 17 00:00:00 2001 From: Bartosz Zawistowski Date: Sat, 11 Jan 2025 12:14:11 +0100 Subject: [PATCH 5/9] Clippy --- zilliqa/tests/it/eth.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/zilliqa/tests/it/eth.rs b/zilliqa/tests/it/eth.rs index 8ca6191726..b067a61486 100644 --- a/zilliqa/tests/it/eth.rs +++ b/zilliqa/tests/it/eth.rs @@ -6,7 +6,6 @@ use ethabi::{ethereum_types::U64, Token}; use ethers::{ abi::FunctionExt, core::types::{Bytes, Signature}, - prelude::contract, providers::{Middleware, MiddlewareError, Provider}, types::{ transaction::{ @@ -21,12 +20,9 @@ use ethers::{ use futures::{future::join_all, StreamExt}; use primitive_types::{H160, H256}; use serde::{Deserialize, Serialize}; -use zilliqa::{ - scilla::storage_key, - state::{Account, State}, -}; +use zilliqa::state::{Account, State}; -use crate::{deploy_contract, node, LocalRpcClient, Network, Wallet}; +use crate::{deploy_contract, LocalRpcClient, Network, Wallet}; #[zilliqa_macros::test] async fn call_block_number(mut network: Network) { @@ -1485,7 +1481,7 @@ async fn test_eth_get_proof(mut network: Network) { let wallet = network.genesis_wallet().await; // Example from https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getstorageat. - let (hash, abi) = deploy_contract( + let (hash, _) = deploy_contract( "tests/it/contracts/Storage.sol", "Storage", &wallet, From e9d5c48c7e7b9ca9c8e82d1b9a236eb10a898b95 Mon Sep 17 00:00:00 2001 From: Bartosz Zawistowski Date: Tue, 29 Jul 2025 16:03:23 +0200 Subject: [PATCH 6/9] Missing changes --- Cargo.lock | 385 +++++++++++++++++++++++++++++++--------- zilliqa/src/api/eth.rs | 9 +- zilliqa/tests/it/eth.rs | 7 +- 3 files changed, 304 insertions(+), 97 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 594d501471..1b78569e65 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -101,9 +101,9 @@ checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] name = "alloy" -version = "0.12.5" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ec9b8795b2083585293bd3d19033e9d67e725917c95c44cb154e3400529ccd" +checksum = "2b4ae82946772d69f868b9ef81fc66acb1b149ef9b4601849bec4bcf5da6552e" dependencies = [ "alloy-consensus", "alloy-core", @@ -129,9 +129,9 @@ dependencies = [ [[package]] name = "alloy-consensus" -version = "0.12.5" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a84efb7b8ddb9223346bfad9d8094e1a100c254037a3b5913243bfa8e04be266" +checksum = "6fbf458101ed6c389e9bb70a34ebc56039868ad10472540614816cdedc8f5265" dependencies = [ "alloy-eips", "alloy-primitives", @@ -152,9 +152,9 @@ dependencies = [ [[package]] name = "alloy-consensus-any" -version = "0.12.5" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fafded0c1ff8f0275c4a484239058e1c01c0c2589f8a16e03669ef7094a06f9b" +checksum = "fc982af629e511292310fe85b433427fd38cb3105147632b574abc997db44c91" dependencies = [ "alloy-consensus", "alloy-eips", @@ -231,9 +231,9 @@ dependencies = [ [[package]] name = "alloy-eips" -version = "0.12.5" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f4bffedaddc627520eabdcbfe27a2d2c2f716e15295e2ed1010df3feae67040" +checksum = "6e86967eb559920e4b9102e4cb825fe30f2e9467988353ce4809f0d3f2c90cd4" dependencies = [ "alloy-eip2124", "alloy-eip2930", @@ -264,9 +264,9 @@ dependencies = [ [[package]] name = "alloy-json-rpc" -version = "0.12.5" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6929e607b0a56803c69c68adc6e8aae1644c94e37ea458aa2d0713fc77490e70" +checksum = "27434beae2514d4a2aa90f53832cbdf6f23e4b5e2656d95eaf15f9276e2418b6" dependencies = [ "alloy-primitives", "alloy-sol-types", @@ -278,9 +278,9 @@ dependencies = [ [[package]] name = "alloy-network" -version = "0.12.5" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2b14524c3605ed5ee173b966333089474415416a8cfd80ceb003c18fd6d1736" +checksum = "26a33a38c7486b1945f8d093ff027add2f3a8f83c7300dbad6165cc49150085e" dependencies = [ "alloy-consensus", "alloy-consensus-any", @@ -304,9 +304,9 @@ dependencies = [ [[package]] name = "alloy-network-primitives" -version = "0.12.5" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c06932646544ea341f0fda48d2c0fe4fda75bc132379cb84019cdfb6ddcb0fb" +checksum = "db973a7a23cbe96f2958e5687c51ce2d304b5c6d0dc5ccb3de8667ad8476f50b" dependencies = [ "alloy-consensus", "alloy-eips", @@ -345,9 +345,9 @@ dependencies = [ [[package]] name = "alloy-provider" -version = "0.12.5" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff1ec2eabd9b3acc46e59247c35f75545960372431c68f7fdbfcfb970a486c30" +checksum = "8b03bde77ad73feae14aa593bcabb932c8098c0f0750ead973331cfc0003a4e1" dependencies = [ "alloy-chains", "alloy-consensus", @@ -402,14 +402,15 @@ dependencies = [ [[package]] name = "alloy-rpc-client" -version = "0.12.5" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6213829d8eabc239c2f9572452a5993ebdf78b04c020abc450ae48c54261d4ce" +checksum = "445a3298c14fae7afb5b9f2f735dead989f3dd83020c2ab8e48ed95d7b6d1acb" dependencies = [ "alloy-json-rpc", "alloy-primitives", "alloy-transport", "alloy-transport-http", + "async-stream", "futures", "pin-project", "serde", @@ -418,14 +419,15 @@ dependencies = [ "tokio-stream", "tower 0.5.2", "tracing", + "tracing-futures", "wasmtimer", ] [[package]] name = "alloy-rpc-types" -version = "0.12.5" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a153db94cf231b03238fe4da48f59dc6f36e01b5e4d5a2e30de33b95395380fa" +checksum = "9157deaec6ba2ad7854f16146e4cd60280e76593eed79fdcb06e0fa8b6c60f77" dependencies = [ "alloy-primitives", "alloy-rpc-types-eth", @@ -436,9 +438,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-any" -version = "0.12.5" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cd4ceea38ea27eeb26f021df34ed5b7b793704ad7a2a009f16137a19461e7ca" +checksum = "604dea1f00fd646debe8033abe8e767c732868bf8a5ae9df6321909ccbc99c56" dependencies = [ "alloy-consensus-any", "alloy-rpc-types-eth", @@ -447,9 +449,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-eth" -version = "0.12.5" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e18d94b1036302720b987564560e4a5b85035a17553c53a50afa2bd8762b487" +checksum = "7e13d71eac04513a71af4b3df580f52f2b4dcbff9d971cc9a52519acf55514cb" dependencies = [ "alloy-consensus", "alloy-consensus-any", @@ -467,9 +469,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-trace" -version = "0.12.5" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ef4bba67ec601730ceb23e542980d73ae9f718819604dfdd8289b13a506e762" +checksum = "4747763aee39c1b0f5face79bde9be8932be05b2db7d8bdcebb93490f32c889c" dependencies = [ "alloy-primitives", "alloy-rpc-types-eth", @@ -481,9 +483,9 @@ dependencies = [ [[package]] name = "alloy-serde" -version = "0.12.5" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9824e1bf92cd7848ca6fabb01c9aca15c9c5fb0ab96da5514ef0543f021c69f6" +checksum = "3a1cd73fc054de6353c7f22ff9b846b0f0f145cd0112da07d4119e41e9959207" dependencies = [ "alloy-primitives", "serde", @@ -492,9 +494,9 @@ dependencies = [ [[package]] name = "alloy-signer" -version = "0.12.5" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81755ed6a6a33061302ac95e9bb7b40ebf7078e4568397168024242bc31a3e58" +checksum = "c96fbde54bee943cd94ebacc8a62c50b38c7dfd2552dcd79ff61aea778b1bfcc" dependencies = [ "alloy-primitives", "async-trait", @@ -507,9 +509,9 @@ dependencies = [ [[package]] name = "alloy-signer-local" -version = "0.12.5" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa857621a5c95c13e640e18bb9c4720f4338a666d6276f55446477a6bc3912ff" +checksum = "cc6e72002cc1801d8b41e9892165e3a6551b7bd382bd9d0414b21e90c0c62551" dependencies = [ "alloy-consensus", "alloy-network", @@ -597,13 +599,16 @@ dependencies = [ [[package]] name = "alloy-transport" -version = "0.12.5" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c74598eb65cefa886be6ba624c14a6856d9d84339ec720520f3efcc03311716" +checksum = "9aec325c2af8562ef355c02aeb527c755a07e9d8cf6a1e65dda8d0bf23e29b2c" dependencies = [ "alloy-json-rpc", "base64 0.22.1", + "derive_more 2.0.1", + "futures", "futures-utils-wasm", + "parking_lot", "serde", "serde_json", "thiserror 2.0.12", @@ -616,9 +621,9 @@ dependencies = [ [[package]] name = "alloy-transport-http" -version = "0.12.5" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcd2f8ab2f053cd848ead5d625cb1b63716562951101588c1fa49300e3c6418" +checksum = "a082c9473c6642cce8b02405a979496126a03b096997888e86229afad05db06c" dependencies = [ "alloy-transport", "url", @@ -1034,11 +1039,12 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" [[package]] name = "attohttpc" -version = "0.24.1" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d9a9bf8b79a749ee0b911b91b671cc2b6c670bdbc7e3dfd537576ddc94bb2a2" +checksum = "16e2cdb6d5ed835199484bb92bb8b3edd526effe995c61732580439c1a67e2e9" dependencies = [ - "http 0.2.12", + "base64 0.22.1", + "http 1.3.1", "log", "url", ] @@ -2122,9 +2128,9 @@ dependencies = [ [[package]] name = "crc" -version = "3.2.1" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636" +checksum = "9710d3b3739c2e349eb44fe848ad0b7c8cb1e42bd87ee49371df2f7acaf3e675" dependencies = [ "crc-catalog", ] @@ -3941,7 +3947,7 @@ dependencies = [ "idna", "ipnet", "once_cell", - "rand 0.9.0", + "rand 0.9.2", "ring 0.17.14", "socket2", "thiserror 2.0.12", @@ -3964,7 +3970,7 @@ dependencies = [ "moka", "once_cell", "parking_lot", - "rand 0.9.0", + "rand 0.9.2", "resolv-conf", "smallvec", "thiserror 2.0.12", @@ -4401,9 +4407,9 @@ dependencies = [ [[package]] name = "igd-next" -version = "0.16.1" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d06464e726471718db9ad3fefc020529fabcde03313a0fc3967510e2db5add12" +checksum = "516893339c97f6011282d5825ac94fc1c7aad5cad26bdc2d0cee068c0bf97f97" dependencies = [ "async-trait", "attohttpc", @@ -4414,7 +4420,7 @@ dependencies = [ "hyper 1.6.0", "hyper-util", "log", - "rand 0.9.0", + "rand 0.9.2", "tokio", "url", "xmltree", @@ -4749,18 +4755,34 @@ version = "0.24.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37b26c20e2178756451cfeb0661fb74c47dd5988cb7e3939de7e9241fd604d42" dependencies = [ - "jsonrpsee-client-transport", - "jsonrpsee-core", - "jsonrpsee-http-client", + "jsonrpsee-client-transport 0.24.9", + "jsonrpsee-core 0.24.9", + "jsonrpsee-http-client 0.24.9", "jsonrpsee-proc-macros", - "jsonrpsee-server", - "jsonrpsee-types", - "jsonrpsee-wasm-client", - "jsonrpsee-ws-client", + "jsonrpsee-server 0.24.9", + "jsonrpsee-types 0.24.9", + "jsonrpsee-wasm-client 0.24.9", + "jsonrpsee-ws-client 0.24.9", "tokio", "tracing", ] +[[package]] +name = "jsonrpsee" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fba77a59c4c644fd48732367624d1bcf6f409f9c9a286fbc71d2f1fc0b2ea16" +dependencies = [ + "jsonrpsee-client-transport 0.25.1", + "jsonrpsee-core 0.25.1", + "jsonrpsee-http-client 0.25.1", + "jsonrpsee-server 0.25.1", + "jsonrpsee-types 0.25.1", + "jsonrpsee-wasm-client 0.25.1", + "jsonrpsee-ws-client 0.25.1", + "tokio", +] + [[package]] name = "jsonrpsee-client-transport" version = "0.24.9" @@ -4772,7 +4794,7 @@ dependencies = [ "futures-util", "gloo-net", "http 1.3.1", - "jsonrpsee-core", + "jsonrpsee-core 0.24.9", "pin-project", "rustls 0.23.25", "rustls-pki-types", @@ -4786,6 +4808,31 @@ dependencies = [ "url", ] +[[package]] +name = "jsonrpsee-client-transport" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2a320a3f1464e4094f780c4d48413acd786ce5627aaaecfac9e9c7431d13ae1" +dependencies = [ + "base64 0.22.1", + "futures-channel", + "futures-util", + "gloo-net", + "http 1.3.1", + "jsonrpsee-core 0.25.1", + "pin-project", + "rustls 0.23.25", + "rustls-pki-types", + "rustls-platform-verifier", + "soketto", + "thiserror 2.0.12", + "tokio", + "tokio-rustls 0.26.2", + "tokio-util", + "tracing", + "url", +] + [[package]] name = "jsonrpsee-core" version = "0.24.9" @@ -4799,7 +4846,7 @@ dependencies = [ "http 1.3.1", "http-body 1.0.1", "http-body-util", - "jsonrpsee-types", + "jsonrpsee-types 0.24.9", "parking_lot", "pin-project", "rand 0.8.5", @@ -4813,6 +4860,34 @@ dependencies = [ "wasm-bindgen-futures", ] +[[package]] +name = "jsonrpsee-core" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "693c93cbb7db25f4108ed121304b671a36002c2db67dff2ee4391a688c738547" +dependencies = [ + "async-trait", + "bytes", + "futures-timer", + "futures-util", + "http 1.3.1", + "http-body 1.0.1", + "http-body-util", + "jsonrpsee-types 0.25.1", + "parking_lot", + "pin-project", + "rand 0.9.2", + "rustc-hash 2.1.1", + "serde", + "serde_json", + "thiserror 2.0.12", + "tokio", + "tokio-stream", + "tower 0.5.2", + "tracing", + "wasm-bindgen-futures", +] + [[package]] name = "jsonrpsee-http-client" version = "0.24.9" @@ -4825,8 +4900,8 @@ dependencies = [ "hyper 1.6.0", "hyper-rustls 0.27.5", "hyper-util", - "jsonrpsee-core", - "jsonrpsee-types", + "jsonrpsee-core 0.24.9", + "jsonrpsee-types 0.24.9", "rustls 0.23.25", "rustls-platform-verifier", "serde", @@ -4838,6 +4913,29 @@ dependencies = [ "url", ] +[[package]] +name = "jsonrpsee-http-client" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6962d2bd295f75e97dd328891e58fce166894b974c1f7ce2e7597f02eeceb791" +dependencies = [ + "base64 0.22.1", + "http-body 1.0.1", + "hyper 1.6.0", + "hyper-rustls 0.27.5", + "hyper-util", + "jsonrpsee-core 0.25.1", + "jsonrpsee-types 0.25.1", + "rustls 0.23.25", + "rustls-platform-verifier", + "serde", + "serde_json", + "thiserror 2.0.12", + "tokio", + "tower 0.5.2", + "url", +] + [[package]] name = "jsonrpsee-proc-macros" version = "0.24.9" @@ -4863,8 +4961,8 @@ dependencies = [ "http-body-util", "hyper 1.6.0", "hyper-util", - "jsonrpsee-core", - "jsonrpsee-types", + "jsonrpsee-core 0.24.9", + "jsonrpsee-types 0.24.9", "pin-project", "route-recognizer", "serde", @@ -4878,6 +4976,33 @@ dependencies = [ "tracing", ] +[[package]] +name = "jsonrpsee-server" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d38b0bcf407ac68d241f90e2d46041e6a06988f97fe1721fb80b91c42584fae6" +dependencies = [ + "futures-util", + "http 1.3.1", + "http-body 1.0.1", + "http-body-util", + "hyper 1.6.0", + "hyper-util", + "jsonrpsee-core 0.25.1", + "jsonrpsee-types 0.25.1", + "pin-project", + "route-recognizer", + "serde", + "serde_json", + "soketto", + "thiserror 2.0.12", + "tokio", + "tokio-stream", + "tokio-util", + "tower 0.5.2", + "tracing", +] + [[package]] name = "jsonrpsee-types" version = "0.24.9" @@ -4890,15 +5015,39 @@ dependencies = [ "thiserror 1.0.69", ] +[[package]] +name = "jsonrpsee-types" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66df7256371c45621b3b7d2fb23aea923d577616b9c0e9c0b950a6ea5c2be0ca" +dependencies = [ + "http 1.3.1", + "serde", + "serde_json", + "thiserror 2.0.12", +] + [[package]] name = "jsonrpsee-wasm-client" version = "0.24.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6558a9586cad43019dafd0b6311d0938f46efc116b34b28c74778bc11a2edf6" dependencies = [ - "jsonrpsee-client-transport", - "jsonrpsee-core", - "jsonrpsee-types", + "jsonrpsee-client-transport 0.24.9", + "jsonrpsee-core 0.24.9", + "jsonrpsee-types 0.24.9", +] + +[[package]] +name = "jsonrpsee-wasm-client" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b67695cbcf4653f39f8f8738925547e0e23fd9fe315bccf951097b9f6a38781" +dependencies = [ + "jsonrpsee-client-transport 0.25.1", + "jsonrpsee-core 0.25.1", + "jsonrpsee-types 0.25.1", + "tower 0.5.2", ] [[package]] @@ -4908,9 +5057,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "01b3323d890aa384f12148e8d2a1fd18eb66e9e7e825f9de4fa53bcc19b93eef" dependencies = [ "http 1.3.1", - "jsonrpsee-client-transport", - "jsonrpsee-core", - "jsonrpsee-types", + "jsonrpsee-client-transport 0.24.9", + "jsonrpsee-core 0.24.9", + "jsonrpsee-types 0.24.9", + "url", +] + +[[package]] +name = "jsonrpsee-ws-client" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2da2694c9ff271a9d3ebfe520f6b36820e85133a51be77a3cb549fd615095261" +dependencies = [ + "http 1.3.1", + "jsonrpsee-client-transport 0.25.1", + "jsonrpsee-core 0.25.1", + "jsonrpsee-types 0.25.1", + "tower 0.5.2", "url", ] @@ -7058,13 +7221,12 @@ dependencies = [ [[package]] name = "rand" -version = "0.9.0" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3779b94aeb87e8bd4e834cee3650289ee9e0d5677f976ecdb6d219e5f4f6cd94" +checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ "rand_chacha 0.9.0", "rand_core 0.9.3", - "zerocopy 0.8.23", ] [[package]] @@ -7184,6 +7346,26 @@ dependencies = [ "thiserror 2.0.12", ] +[[package]] +name = "ref-cast" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a0ae411dbe946a674d89546582cea4ba2bb8defac896622d6496f14c23ba5cf" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1165225c21bff1f3bbce98f5a1f889949bc902d3575308cc7b0de30b4f6d27c7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.104", +] + [[package]] name = "regex" version = "1.11.1" @@ -7338,30 +7520,29 @@ dependencies = [ [[package]] name = "reth-ipc" -version = "1.3.12" -source = "git+https://github.com/paradigmxyz/reth#db885ccae8ccd3a6c41e4c77b1e19c29fd756d14" +version = "1.6.0" +source = "git+https://github.com/paradigmxyz/reth#489f262d9511a156e072e24a2222f16c09eb172b" dependencies = [ - "async-trait", "bytes", "futures", "futures-util", "interprocess", - "jsonrpsee", + "jsonrpsee 0.25.1", "pin-project", "serde_json", "thiserror 2.0.12", "tokio", "tokio-stream", "tokio-util", - "tower 0.4.13", + "tower 0.5.2", "tracing", ] [[package]] name = "revm" -version = "19.6.0" +version = "19.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b906766b7ba049b515848952b5ae74f363d456e98de2021048a513e442b4f42" +checksum = "c175ecec83bba464aa8406502fe5bf670491c2ace81a153264891d43bc7fa332" dependencies = [ "auto_impl", "cfg-if", @@ -7404,9 +7585,9 @@ dependencies = [ [[package]] name = "revm-precompile" -version = "16.1.0" +version = "16.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6caa1a7ff2cc4a09a263fcf9de99151706f323d30f33d519ed329f017a02b046" +checksum = "99743c3a2cac341084cc15ac74286c4bf34a0941ebf60aa420cfdb9f81f72f9f" dependencies = [ "aurora-engine-modexp", "blst", @@ -7907,6 +8088,30 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "schemars" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd191f9397d57d581cddd31014772520aa448f65ef991055d7f61582c65165f" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + +[[package]] +name = "schemars" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82d20c4491bc164fa2f6c5d44565947a52ad80b9505d8e36f8d54c27c739fcd0" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + [[package]] name = "scilla-parser" version = "1.0.0" @@ -8183,15 +8388,17 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.12.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6b6f7f2fcb69f747921f79f3926bd1e203fce4fef62c268dd3abfb6d86029aa" +checksum = "f2c45cd61fefa9db6f254525d46e392b852e0e61d9a1fd36e5bd183450a556d5" dependencies = [ "base64 0.22.1", "chrono", "hex", "indexmap 1.9.3", "indexmap 2.8.0", + "schemars 0.9.0", + "schemars 1.0.4", "serde", "serde_derive", "serde_json", @@ -8201,9 +8408,9 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.12.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d00caa5193a3c8362ac2b73be6b9e768aa5a4b2f721d8f4b339600c3cb51f8e" +checksum = "de90945e6565ce0d9a25098082ed4ee4002e047cb59892c318d66821e14bb30f" dependencies = [ "darling", "proc-macro2", @@ -9221,9 +9428,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.9.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed0aee96c12fa71097902e0bb061a5e1ebd766a6636bb605ba401c45c1650eac" +checksum = "e06723639aaded957e5a80be250c1f82f274b9d23ebb4d94163668470623461c" dependencies = [ "indexmap 2.8.0", "serde", @@ -9417,6 +9624,8 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" dependencies = [ + "futures", + "futures-task", "pin-project", "tracing", ] @@ -10675,7 +10884,7 @@ dependencies = [ "home", "indicatif", "itertools 0.14.0", - "jsonrpsee", + "jsonrpsee 0.24.9", "k256", "lazy_static", "libp2p", @@ -10703,7 +10912,7 @@ dependencies = [ "thiserror 2.0.12", "tokio", "tokio-stream", - "toml 0.9.2", + "toml 0.9.3", "tracing", "url", "zilliqa", @@ -10844,7 +11053,7 @@ dependencies = [ "hyper 1.6.0", "indicatif", "itertools 0.14.0", - "jsonrpsee", + "jsonrpsee 0.24.9", "k256", "libp2p", "lru-mem", @@ -10879,7 +11088,7 @@ dependencies = [ "time", "tokio", "tokio-stream", - "toml 0.9.2", + "toml 0.9.3", "tower 0.4.13", "tower-http", "tracing", @@ -10912,7 +11121,7 @@ dependencies = [ "convert_case 0.6.0", "eth-keystore", "hex", - "jsonrpsee", + "jsonrpsee 0.24.9", "k256", "primitive-types", "prost 0.12.6", diff --git a/zilliqa/src/api/eth.rs b/zilliqa/src/api/eth.rs index 5eca5b7eac..4d8559f494 100644 --- a/zilliqa/src/api/eth.rs +++ b/zilliqa/src/api/eth.rs @@ -24,10 +24,9 @@ use jsonrpsee::{ }, }; use parking_lot::{RwLock, RwLockReadGuard}; -use revm::primitives::keccak256; -use serde_json::json; -use revm::primitives::Bytecode; +use revm::primitives::{Bytecode, keccak256}; use serde::Deserialize; +use serde_json::json; use tracing::*; use super::{ @@ -38,9 +37,9 @@ use super::{ }, }; use crate::{ - api::{types::eth::GetAccountResult, zilliqa::ZilAddress}, api::{ - types::eth::{Proof, StorageProof}, + types::eth::{GetAccountResult, Proof, StorageProof}, + zilliqa::ZilAddress, }, cfg::EnabledApi, crypto::Hash, diff --git a/zilliqa/tests/it/eth.rs b/zilliqa/tests/it/eth.rs index 59ce672811..b1fc78aa86 100644 --- a/zilliqa/tests/it/eth.rs +++ b/zilliqa/tests/it/eth.rs @@ -1,9 +1,8 @@ use std::{fmt::Debug, ops::DerefMut, sync::Arc}; -use ethabi::{Token, ethereum_types::U64}; -use alloy::primitives::{hex, Address, B256}; +use alloy::primitives::{Address, B256, hex}; use eth_trie::{EthTrie, MemoryDB, Trie}; - +use ethabi::{Token, ethereum_types::U64}; use ethers::{ abi::FunctionExt, core::types::{Bytes, Signature}, @@ -21,8 +20,8 @@ use ethers::{ use futures::{StreamExt, future::join_all}; use primitive_types::{H160, H256}; use serde::{Deserialize, Serialize}; -use zilliqa::state::{Account, State}; use serde_json::{Value, json}; +use zilliqa::state::{Account, State}; use crate::{LocalRpcClient, Network, Wallet, deploy_contract}; From 5dc7e72b196e212e7a6106b9fcabe8504ceb1c6f Mon Sep 17 00:00:00 2001 From: Bartosz Zawistowski Date: Tue, 29 Jul 2025 16:04:53 +0200 Subject: [PATCH 7/9] Lock file --- Cargo.lock | 385 ++++++++++++----------------------------------------- 1 file changed, 88 insertions(+), 297 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1b78569e65..594d501471 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -101,9 +101,9 @@ checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] name = "alloy" -version = "0.12.6" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b4ae82946772d69f868b9ef81fc66acb1b149ef9b4601849bec4bcf5da6552e" +checksum = "89ec9b8795b2083585293bd3d19033e9d67e725917c95c44cb154e3400529ccd" dependencies = [ "alloy-consensus", "alloy-core", @@ -129,9 +129,9 @@ dependencies = [ [[package]] name = "alloy-consensus" -version = "0.12.6" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fbf458101ed6c389e9bb70a34ebc56039868ad10472540614816cdedc8f5265" +checksum = "a84efb7b8ddb9223346bfad9d8094e1a100c254037a3b5913243bfa8e04be266" dependencies = [ "alloy-eips", "alloy-primitives", @@ -152,9 +152,9 @@ dependencies = [ [[package]] name = "alloy-consensus-any" -version = "0.12.6" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc982af629e511292310fe85b433427fd38cb3105147632b574abc997db44c91" +checksum = "fafded0c1ff8f0275c4a484239058e1c01c0c2589f8a16e03669ef7094a06f9b" dependencies = [ "alloy-consensus", "alloy-eips", @@ -231,9 +231,9 @@ dependencies = [ [[package]] name = "alloy-eips" -version = "0.12.6" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e86967eb559920e4b9102e4cb825fe30f2e9467988353ce4809f0d3f2c90cd4" +checksum = "5f4bffedaddc627520eabdcbfe27a2d2c2f716e15295e2ed1010df3feae67040" dependencies = [ "alloy-eip2124", "alloy-eip2930", @@ -264,9 +264,9 @@ dependencies = [ [[package]] name = "alloy-json-rpc" -version = "0.12.6" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27434beae2514d4a2aa90f53832cbdf6f23e4b5e2656d95eaf15f9276e2418b6" +checksum = "6929e607b0a56803c69c68adc6e8aae1644c94e37ea458aa2d0713fc77490e70" dependencies = [ "alloy-primitives", "alloy-sol-types", @@ -278,9 +278,9 @@ dependencies = [ [[package]] name = "alloy-network" -version = "0.12.6" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26a33a38c7486b1945f8d093ff027add2f3a8f83c7300dbad6165cc49150085e" +checksum = "c2b14524c3605ed5ee173b966333089474415416a8cfd80ceb003c18fd6d1736" dependencies = [ "alloy-consensus", "alloy-consensus-any", @@ -304,9 +304,9 @@ dependencies = [ [[package]] name = "alloy-network-primitives" -version = "0.12.6" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db973a7a23cbe96f2958e5687c51ce2d304b5c6d0dc5ccb3de8667ad8476f50b" +checksum = "4c06932646544ea341f0fda48d2c0fe4fda75bc132379cb84019cdfb6ddcb0fb" dependencies = [ "alloy-consensus", "alloy-eips", @@ -345,9 +345,9 @@ dependencies = [ [[package]] name = "alloy-provider" -version = "0.12.6" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b03bde77ad73feae14aa593bcabb932c8098c0f0750ead973331cfc0003a4e1" +checksum = "ff1ec2eabd9b3acc46e59247c35f75545960372431c68f7fdbfcfb970a486c30" dependencies = [ "alloy-chains", "alloy-consensus", @@ -402,15 +402,14 @@ dependencies = [ [[package]] name = "alloy-rpc-client" -version = "0.12.6" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445a3298c14fae7afb5b9f2f735dead989f3dd83020c2ab8e48ed95d7b6d1acb" +checksum = "6213829d8eabc239c2f9572452a5993ebdf78b04c020abc450ae48c54261d4ce" dependencies = [ "alloy-json-rpc", "alloy-primitives", "alloy-transport", "alloy-transport-http", - "async-stream", "futures", "pin-project", "serde", @@ -419,15 +418,14 @@ dependencies = [ "tokio-stream", "tower 0.5.2", "tracing", - "tracing-futures", "wasmtimer", ] [[package]] name = "alloy-rpc-types" -version = "0.12.6" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9157deaec6ba2ad7854f16146e4cd60280e76593eed79fdcb06e0fa8b6c60f77" +checksum = "a153db94cf231b03238fe4da48f59dc6f36e01b5e4d5a2e30de33b95395380fa" dependencies = [ "alloy-primitives", "alloy-rpc-types-eth", @@ -438,9 +436,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-any" -version = "0.12.6" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "604dea1f00fd646debe8033abe8e767c732868bf8a5ae9df6321909ccbc99c56" +checksum = "2cd4ceea38ea27eeb26f021df34ed5b7b793704ad7a2a009f16137a19461e7ca" dependencies = [ "alloy-consensus-any", "alloy-rpc-types-eth", @@ -449,9 +447,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-eth" -version = "0.12.6" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e13d71eac04513a71af4b3df580f52f2b4dcbff9d971cc9a52519acf55514cb" +checksum = "8e18d94b1036302720b987564560e4a5b85035a17553c53a50afa2bd8762b487" dependencies = [ "alloy-consensus", "alloy-consensus-any", @@ -469,9 +467,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-trace" -version = "0.12.6" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4747763aee39c1b0f5face79bde9be8932be05b2db7d8bdcebb93490f32c889c" +checksum = "5ef4bba67ec601730ceb23e542980d73ae9f718819604dfdd8289b13a506e762" dependencies = [ "alloy-primitives", "alloy-rpc-types-eth", @@ -483,9 +481,9 @@ dependencies = [ [[package]] name = "alloy-serde" -version = "0.12.6" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a1cd73fc054de6353c7f22ff9b846b0f0f145cd0112da07d4119e41e9959207" +checksum = "9824e1bf92cd7848ca6fabb01c9aca15c9c5fb0ab96da5514ef0543f021c69f6" dependencies = [ "alloy-primitives", "serde", @@ -494,9 +492,9 @@ dependencies = [ [[package]] name = "alloy-signer" -version = "0.12.6" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c96fbde54bee943cd94ebacc8a62c50b38c7dfd2552dcd79ff61aea778b1bfcc" +checksum = "81755ed6a6a33061302ac95e9bb7b40ebf7078e4568397168024242bc31a3e58" dependencies = [ "alloy-primitives", "async-trait", @@ -509,9 +507,9 @@ dependencies = [ [[package]] name = "alloy-signer-local" -version = "0.12.6" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc6e72002cc1801d8b41e9892165e3a6551b7bd382bd9d0414b21e90c0c62551" +checksum = "aa857621a5c95c13e640e18bb9c4720f4338a666d6276f55446477a6bc3912ff" dependencies = [ "alloy-consensus", "alloy-network", @@ -599,16 +597,13 @@ dependencies = [ [[package]] name = "alloy-transport" -version = "0.12.6" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aec325c2af8562ef355c02aeb527c755a07e9d8cf6a1e65dda8d0bf23e29b2c" +checksum = "6c74598eb65cefa886be6ba624c14a6856d9d84339ec720520f3efcc03311716" dependencies = [ "alloy-json-rpc", "base64 0.22.1", - "derive_more 2.0.1", - "futures", "futures-utils-wasm", - "parking_lot", "serde", "serde_json", "thiserror 2.0.12", @@ -621,9 +616,9 @@ dependencies = [ [[package]] name = "alloy-transport-http" -version = "0.12.6" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a082c9473c6642cce8b02405a979496126a03b096997888e86229afad05db06c" +checksum = "cfcd2f8ab2f053cd848ead5d625cb1b63716562951101588c1fa49300e3c6418" dependencies = [ "alloy-transport", "url", @@ -1039,12 +1034,11 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" [[package]] name = "attohttpc" -version = "0.30.1" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16e2cdb6d5ed835199484bb92bb8b3edd526effe995c61732580439c1a67e2e9" +checksum = "8d9a9bf8b79a749ee0b911b91b671cc2b6c670bdbc7e3dfd537576ddc94bb2a2" dependencies = [ - "base64 0.22.1", - "http 1.3.1", + "http 0.2.12", "log", "url", ] @@ -2128,9 +2122,9 @@ dependencies = [ [[package]] name = "crc" -version = "3.3.0" +version = "3.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9710d3b3739c2e349eb44fe848ad0b7c8cb1e42bd87ee49371df2f7acaf3e675" +checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636" dependencies = [ "crc-catalog", ] @@ -3947,7 +3941,7 @@ dependencies = [ "idna", "ipnet", "once_cell", - "rand 0.9.2", + "rand 0.9.0", "ring 0.17.14", "socket2", "thiserror 2.0.12", @@ -3970,7 +3964,7 @@ dependencies = [ "moka", "once_cell", "parking_lot", - "rand 0.9.2", + "rand 0.9.0", "resolv-conf", "smallvec", "thiserror 2.0.12", @@ -4407,9 +4401,9 @@ dependencies = [ [[package]] name = "igd-next" -version = "0.16.2" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "516893339c97f6011282d5825ac94fc1c7aad5cad26bdc2d0cee068c0bf97f97" +checksum = "d06464e726471718db9ad3fefc020529fabcde03313a0fc3967510e2db5add12" dependencies = [ "async-trait", "attohttpc", @@ -4420,7 +4414,7 @@ dependencies = [ "hyper 1.6.0", "hyper-util", "log", - "rand 0.9.2", + "rand 0.9.0", "tokio", "url", "xmltree", @@ -4755,34 +4749,18 @@ version = "0.24.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37b26c20e2178756451cfeb0661fb74c47dd5988cb7e3939de7e9241fd604d42" dependencies = [ - "jsonrpsee-client-transport 0.24.9", - "jsonrpsee-core 0.24.9", - "jsonrpsee-http-client 0.24.9", + "jsonrpsee-client-transport", + "jsonrpsee-core", + "jsonrpsee-http-client", "jsonrpsee-proc-macros", - "jsonrpsee-server 0.24.9", - "jsonrpsee-types 0.24.9", - "jsonrpsee-wasm-client 0.24.9", - "jsonrpsee-ws-client 0.24.9", + "jsonrpsee-server", + "jsonrpsee-types", + "jsonrpsee-wasm-client", + "jsonrpsee-ws-client", "tokio", "tracing", ] -[[package]] -name = "jsonrpsee" -version = "0.25.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fba77a59c4c644fd48732367624d1bcf6f409f9c9a286fbc71d2f1fc0b2ea16" -dependencies = [ - "jsonrpsee-client-transport 0.25.1", - "jsonrpsee-core 0.25.1", - "jsonrpsee-http-client 0.25.1", - "jsonrpsee-server 0.25.1", - "jsonrpsee-types 0.25.1", - "jsonrpsee-wasm-client 0.25.1", - "jsonrpsee-ws-client 0.25.1", - "tokio", -] - [[package]] name = "jsonrpsee-client-transport" version = "0.24.9" @@ -4794,7 +4772,7 @@ dependencies = [ "futures-util", "gloo-net", "http 1.3.1", - "jsonrpsee-core 0.24.9", + "jsonrpsee-core", "pin-project", "rustls 0.23.25", "rustls-pki-types", @@ -4808,31 +4786,6 @@ dependencies = [ "url", ] -[[package]] -name = "jsonrpsee-client-transport" -version = "0.25.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2a320a3f1464e4094f780c4d48413acd786ce5627aaaecfac9e9c7431d13ae1" -dependencies = [ - "base64 0.22.1", - "futures-channel", - "futures-util", - "gloo-net", - "http 1.3.1", - "jsonrpsee-core 0.25.1", - "pin-project", - "rustls 0.23.25", - "rustls-pki-types", - "rustls-platform-verifier", - "soketto", - "thiserror 2.0.12", - "tokio", - "tokio-rustls 0.26.2", - "tokio-util", - "tracing", - "url", -] - [[package]] name = "jsonrpsee-core" version = "0.24.9" @@ -4846,7 +4799,7 @@ dependencies = [ "http 1.3.1", "http-body 1.0.1", "http-body-util", - "jsonrpsee-types 0.24.9", + "jsonrpsee-types", "parking_lot", "pin-project", "rand 0.8.5", @@ -4860,34 +4813,6 @@ dependencies = [ "wasm-bindgen-futures", ] -[[package]] -name = "jsonrpsee-core" -version = "0.25.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693c93cbb7db25f4108ed121304b671a36002c2db67dff2ee4391a688c738547" -dependencies = [ - "async-trait", - "bytes", - "futures-timer", - "futures-util", - "http 1.3.1", - "http-body 1.0.1", - "http-body-util", - "jsonrpsee-types 0.25.1", - "parking_lot", - "pin-project", - "rand 0.9.2", - "rustc-hash 2.1.1", - "serde", - "serde_json", - "thiserror 2.0.12", - "tokio", - "tokio-stream", - "tower 0.5.2", - "tracing", - "wasm-bindgen-futures", -] - [[package]] name = "jsonrpsee-http-client" version = "0.24.9" @@ -4900,8 +4825,8 @@ dependencies = [ "hyper 1.6.0", "hyper-rustls 0.27.5", "hyper-util", - "jsonrpsee-core 0.24.9", - "jsonrpsee-types 0.24.9", + "jsonrpsee-core", + "jsonrpsee-types", "rustls 0.23.25", "rustls-platform-verifier", "serde", @@ -4913,29 +4838,6 @@ dependencies = [ "url", ] -[[package]] -name = "jsonrpsee-http-client" -version = "0.25.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6962d2bd295f75e97dd328891e58fce166894b974c1f7ce2e7597f02eeceb791" -dependencies = [ - "base64 0.22.1", - "http-body 1.0.1", - "hyper 1.6.0", - "hyper-rustls 0.27.5", - "hyper-util", - "jsonrpsee-core 0.25.1", - "jsonrpsee-types 0.25.1", - "rustls 0.23.25", - "rustls-platform-verifier", - "serde", - "serde_json", - "thiserror 2.0.12", - "tokio", - "tower 0.5.2", - "url", -] - [[package]] name = "jsonrpsee-proc-macros" version = "0.24.9" @@ -4961,8 +4863,8 @@ dependencies = [ "http-body-util", "hyper 1.6.0", "hyper-util", - "jsonrpsee-core 0.24.9", - "jsonrpsee-types 0.24.9", + "jsonrpsee-core", + "jsonrpsee-types", "pin-project", "route-recognizer", "serde", @@ -4976,33 +4878,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "jsonrpsee-server" -version = "0.25.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d38b0bcf407ac68d241f90e2d46041e6a06988f97fe1721fb80b91c42584fae6" -dependencies = [ - "futures-util", - "http 1.3.1", - "http-body 1.0.1", - "http-body-util", - "hyper 1.6.0", - "hyper-util", - "jsonrpsee-core 0.25.1", - "jsonrpsee-types 0.25.1", - "pin-project", - "route-recognizer", - "serde", - "serde_json", - "soketto", - "thiserror 2.0.12", - "tokio", - "tokio-stream", - "tokio-util", - "tower 0.5.2", - "tracing", -] - [[package]] name = "jsonrpsee-types" version = "0.24.9" @@ -5015,39 +4890,15 @@ dependencies = [ "thiserror 1.0.69", ] -[[package]] -name = "jsonrpsee-types" -version = "0.25.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66df7256371c45621b3b7d2fb23aea923d577616b9c0e9c0b950a6ea5c2be0ca" -dependencies = [ - "http 1.3.1", - "serde", - "serde_json", - "thiserror 2.0.12", -] - [[package]] name = "jsonrpsee-wasm-client" version = "0.24.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6558a9586cad43019dafd0b6311d0938f46efc116b34b28c74778bc11a2edf6" dependencies = [ - "jsonrpsee-client-transport 0.24.9", - "jsonrpsee-core 0.24.9", - "jsonrpsee-types 0.24.9", -] - -[[package]] -name = "jsonrpsee-wasm-client" -version = "0.25.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b67695cbcf4653f39f8f8738925547e0e23fd9fe315bccf951097b9f6a38781" -dependencies = [ - "jsonrpsee-client-transport 0.25.1", - "jsonrpsee-core 0.25.1", - "jsonrpsee-types 0.25.1", - "tower 0.5.2", + "jsonrpsee-client-transport", + "jsonrpsee-core", + "jsonrpsee-types", ] [[package]] @@ -5057,23 +4908,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "01b3323d890aa384f12148e8d2a1fd18eb66e9e7e825f9de4fa53bcc19b93eef" dependencies = [ "http 1.3.1", - "jsonrpsee-client-transport 0.24.9", - "jsonrpsee-core 0.24.9", - "jsonrpsee-types 0.24.9", - "url", -] - -[[package]] -name = "jsonrpsee-ws-client" -version = "0.25.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2da2694c9ff271a9d3ebfe520f6b36820e85133a51be77a3cb549fd615095261" -dependencies = [ - "http 1.3.1", - "jsonrpsee-client-transport 0.25.1", - "jsonrpsee-core 0.25.1", - "jsonrpsee-types 0.25.1", - "tower 0.5.2", + "jsonrpsee-client-transport", + "jsonrpsee-core", + "jsonrpsee-types", "url", ] @@ -7221,12 +7058,13 @@ dependencies = [ [[package]] name = "rand" -version = "0.9.2" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" +checksum = "3779b94aeb87e8bd4e834cee3650289ee9e0d5677f976ecdb6d219e5f4f6cd94" dependencies = [ "rand_chacha 0.9.0", "rand_core 0.9.3", + "zerocopy 0.8.23", ] [[package]] @@ -7346,26 +7184,6 @@ dependencies = [ "thiserror 2.0.12", ] -[[package]] -name = "ref-cast" -version = "1.0.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a0ae411dbe946a674d89546582cea4ba2bb8defac896622d6496f14c23ba5cf" -dependencies = [ - "ref-cast-impl", -] - -[[package]] -name = "ref-cast-impl" -version = "1.0.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1165225c21bff1f3bbce98f5a1f889949bc902d3575308cc7b0de30b4f6d27c7" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.104", -] - [[package]] name = "regex" version = "1.11.1" @@ -7520,29 +7338,30 @@ dependencies = [ [[package]] name = "reth-ipc" -version = "1.6.0" -source = "git+https://github.com/paradigmxyz/reth#489f262d9511a156e072e24a2222f16c09eb172b" +version = "1.3.12" +source = "git+https://github.com/paradigmxyz/reth#db885ccae8ccd3a6c41e4c77b1e19c29fd756d14" dependencies = [ + "async-trait", "bytes", "futures", "futures-util", "interprocess", - "jsonrpsee 0.25.1", + "jsonrpsee", "pin-project", "serde_json", "thiserror 2.0.12", "tokio", "tokio-stream", "tokio-util", - "tower 0.5.2", + "tower 0.4.13", "tracing", ] [[package]] name = "revm" -version = "19.7.0" +version = "19.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c175ecec83bba464aa8406502fe5bf670491c2ace81a153264891d43bc7fa332" +checksum = "7b906766b7ba049b515848952b5ae74f363d456e98de2021048a513e442b4f42" dependencies = [ "auto_impl", "cfg-if", @@ -7585,9 +7404,9 @@ dependencies = [ [[package]] name = "revm-precompile" -version = "16.2.0" +version = "16.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99743c3a2cac341084cc15ac74286c4bf34a0941ebf60aa420cfdb9f81f72f9f" +checksum = "6caa1a7ff2cc4a09a263fcf9de99151706f323d30f33d519ed329f017a02b046" dependencies = [ "aurora-engine-modexp", "blst", @@ -8088,30 +7907,6 @@ dependencies = [ "windows-sys 0.59.0", ] -[[package]] -name = "schemars" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cd191f9397d57d581cddd31014772520aa448f65ef991055d7f61582c65165f" -dependencies = [ - "dyn-clone", - "ref-cast", - "serde", - "serde_json", -] - -[[package]] -name = "schemars" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82d20c4491bc164fa2f6c5d44565947a52ad80b9505d8e36f8d54c27c739fcd0" -dependencies = [ - "dyn-clone", - "ref-cast", - "serde", - "serde_json", -] - [[package]] name = "scilla-parser" version = "1.0.0" @@ -8388,17 +8183,15 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.14.0" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2c45cd61fefa9db6f254525d46e392b852e0e61d9a1fd36e5bd183450a556d5" +checksum = "d6b6f7f2fcb69f747921f79f3926bd1e203fce4fef62c268dd3abfb6d86029aa" dependencies = [ "base64 0.22.1", "chrono", "hex", "indexmap 1.9.3", "indexmap 2.8.0", - "schemars 0.9.0", - "schemars 1.0.4", "serde", "serde_derive", "serde_json", @@ -8408,9 +8201,9 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.14.0" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de90945e6565ce0d9a25098082ed4ee4002e047cb59892c318d66821e14bb30f" +checksum = "8d00caa5193a3c8362ac2b73be6b9e768aa5a4b2f721d8f4b339600c3cb51f8e" dependencies = [ "darling", "proc-macro2", @@ -9428,9 +9221,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.9.3" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e06723639aaded957e5a80be250c1f82f274b9d23ebb4d94163668470623461c" +checksum = "ed0aee96c12fa71097902e0bb061a5e1ebd766a6636bb605ba401c45c1650eac" dependencies = [ "indexmap 2.8.0", "serde", @@ -9624,8 +9417,6 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" dependencies = [ - "futures", - "futures-task", "pin-project", "tracing", ] @@ -10884,7 +10675,7 @@ dependencies = [ "home", "indicatif", "itertools 0.14.0", - "jsonrpsee 0.24.9", + "jsonrpsee", "k256", "lazy_static", "libp2p", @@ -10912,7 +10703,7 @@ dependencies = [ "thiserror 2.0.12", "tokio", "tokio-stream", - "toml 0.9.3", + "toml 0.9.2", "tracing", "url", "zilliqa", @@ -11053,7 +10844,7 @@ dependencies = [ "hyper 1.6.0", "indicatif", "itertools 0.14.0", - "jsonrpsee 0.24.9", + "jsonrpsee", "k256", "libp2p", "lru-mem", @@ -11088,7 +10879,7 @@ dependencies = [ "time", "tokio", "tokio-stream", - "toml 0.9.3", + "toml 0.9.2", "tower 0.4.13", "tower-http", "tracing", @@ -11121,7 +10912,7 @@ dependencies = [ "convert_case 0.6.0", "eth-keystore", "hex", - "jsonrpsee 0.24.9", + "jsonrpsee", "k256", "primitive-types", "prost 0.12.6", From 5443e456d98f289caf02f52259798fedc0cebce1 Mon Sep 17 00:00:00 2001 From: Bartosz Zawistowski Date: Tue, 29 Jul 2025 16:18:30 +0200 Subject: [PATCH 8/9] Compilation fixes --- zilliqa/src/api/eth.rs | 7 ++----- zilliqa/src/state.rs | 12 +++++------- zilliqa/tests/it/eth.rs | 7 ++++--- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/zilliqa/src/api/eth.rs b/zilliqa/src/api/eth.rs index 4d8559f494..722e244d71 100644 --- a/zilliqa/src/api/eth.rs +++ b/zilliqa/src/api/eth.rs @@ -25,7 +25,6 @@ use jsonrpsee::{ }; use parking_lot::{RwLock, RwLockReadGuard}; use revm::primitives::{Bytecode, keccak256}; -use serde::Deserialize; use serde_json::json; use tracing::*; @@ -913,13 +912,11 @@ fn get_proof(params: Params, node: &Arc>) -> Result { let block_id: BlockId = params.next()?; expect_end_of_params(&mut params, 3, 3)?; - let node = node.lock().unwrap(); - - let block = node.get_block(block_id)?; + let block = node.read().get_block(block_id)?; let block = build_errored_response_for_missing_block(block_id, block)?; - let state = node + let mut state = node.read() .consensus .state() .at_root(block.state_root_hash().into()); diff --git a/zilliqa/src/state.rs b/zilliqa/src/state.rs index f54a000b3b..e36e204bb0 100644 --- a/zilliqa/src/state.rs +++ b/zilliqa/src/state.rs @@ -455,21 +455,19 @@ impl State { )?) } - pub fn get_proof(&self, address: Address, storage_keys: &[B256]) -> Result { + pub fn get_proof(&mut self, address: Address, storage_keys: &[B256]) -> Result { if !self.has_account(address)? { return Ok(Proof::default()); }; // get_proof() requires &mut so clone state and don't mutate the origin - let mut state = self.clone(); - state.root_hash()?; - let account = state.get_account(address)?; + let account = self.get_account(address)?; - let account_proof = state - .accounts + let account_proof = self + .accounts.lock().unwrap() .get_proof(Self::account_key(address).as_slice())?; - let mut storage_trie = state.get_account_trie(address)?; + let mut storage_trie = self.get_account_trie(address)?; storage_trie.root_hash()?; let storage_proofs = { diff --git a/zilliqa/tests/it/eth.rs b/zilliqa/tests/it/eth.rs index b1fc78aa86..8214b460ef 100644 --- a/zilliqa/tests/it/eth.rs +++ b/zilliqa/tests/it/eth.rs @@ -1564,6 +1564,7 @@ async fn test_eth_get_proof(mut network: Network) { let (hash, _) = deploy_contract( "tests/it/contracts/Storage.sol", "Storage", + 0u128, &wallet, &mut network, ) @@ -1576,7 +1577,7 @@ async fn test_eth_get_proof(mut network: Network) { let deployed_at_block = wallet.get_block(deployed_at_block).await.unwrap().unwrap(); let contract_account = { - let node = network.nodes[0].inner.lock().unwrap(); + let node = network.nodes[0].inner.read(); node.consensus .state() .get_account(Address::from(contract_address.0)) @@ -1596,7 +1597,7 @@ async fn test_eth_get_proof(mut network: Network) { .unwrap(); let storage_value = { - let node = network.nodes[0].inner.lock().unwrap(); + let node = network.nodes[0].inner.read(); node.consensus .state() .get_account_storage( @@ -1626,7 +1627,7 @@ async fn test_eth_get_proof(mut network: Network) { .unwrap() .unwrap(); - let recovered_account = bincode::deserialize::(&verify_result).unwrap(); + let recovered_account: Account = bincode::serde::decode_from_slice(&verify_result, bincode::config::legacy()).unwrap().0; assert_eq!(recovered_account.balance, 0); assert_eq!( recovered_account.storage_root, From 2b2e148674db1196859d80a7fe849e93f94cc541 Mon Sep 17 00:00:00 2001 From: Bartosz Zawistowski Date: Tue, 29 Jul 2025 16:36:15 +0200 Subject: [PATCH 9/9] Fmt --- zilliqa/src/api/eth.rs | 3 ++- zilliqa/src/state.rs | 4 +++- zilliqa/tests/it/eth.rs | 5 ++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/zilliqa/src/api/eth.rs b/zilliqa/src/api/eth.rs index 722e244d71..57ee10bac3 100644 --- a/zilliqa/src/api/eth.rs +++ b/zilliqa/src/api/eth.rs @@ -916,7 +916,8 @@ fn get_proof(params: Params, node: &Arc>) -> Result { let block = build_errored_response_for_missing_block(block_id, block)?; - let mut state = node.read() + let mut state = node + .read() .consensus .state() .at_root(block.state_root_hash().into()); diff --git a/zilliqa/src/state.rs b/zilliqa/src/state.rs index e36e204bb0..66d7945f0b 100644 --- a/zilliqa/src/state.rs +++ b/zilliqa/src/state.rs @@ -464,7 +464,9 @@ impl State { let account = self.get_account(address)?; let account_proof = self - .accounts.lock().unwrap() + .accounts + .lock() + .unwrap() .get_proof(Self::account_key(address).as_slice())?; let mut storage_trie = self.get_account_trie(address)?; diff --git a/zilliqa/tests/it/eth.rs b/zilliqa/tests/it/eth.rs index 8214b460ef..597671f1a8 100644 --- a/zilliqa/tests/it/eth.rs +++ b/zilliqa/tests/it/eth.rs @@ -1627,7 +1627,10 @@ async fn test_eth_get_proof(mut network: Network) { .unwrap() .unwrap(); - let recovered_account: Account = bincode::serde::decode_from_slice(&verify_result, bincode::config::legacy()).unwrap().0; + let recovered_account: Account = + bincode::serde::decode_from_slice(&verify_result, bincode::config::legacy()) + .unwrap() + .0; assert_eq!(recovered_account.balance, 0); assert_eq!( recovered_account.storage_root,