Skip to content

Commit 165ce18

Browse files
committed
fixes after rebase
1 parent a1ac032 commit 165ce18

File tree

12 files changed

+24
-33
lines changed

12 files changed

+24
-33
lines changed

Cargo.lock

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/lib/dal/src/eth_sender_dal.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,8 +492,8 @@ impl EthSenderDal<'_, '_> {
492492
"INSERT INTO eth_txs (raw_tx, nonce, tx_type, contract_address, predicted_gas_cost, created_at, updated_at) \
493493
VALUES ('\\x00', 0, $1, $2, 0, now(), now()) \
494494
RETURNING id",
495+
tx_type.to_string(),
495496
format!("{:#x}", H160::zero()),
496-
tx_type.to_string()
497497
)
498498
.fetch_one(transaction.conn())
499499
.await?;

core/lib/vm_executor/src/oneshot/block.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
use std::time::SystemTime;
22

3-
use std::str::FromStr;
4-
use std::time::SystemTime;
5-
63
use anyhow::Context;
74
use zksync_dal::{Connection, Core, CoreDal, DalError};
85
use zksync_multivm::{

core/node/l1_recovery/src/l1_fetcher/l1_fetcher.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use rand::random;
66
use thiserror::Error;
77
use tokio::time::{sleep, Duration};
88
use zksync_basic_types::{
9+
bytecode::BytecodeHash,
910
protocol_version::{L1VerifierConfig, ProtocolSemanticVersion},
1011
web3::{contract::Tokenizable, BlockId, BlockNumber, FilterBuilder, Log, Transaction},
1112
Address, L1BatchNumber, PriorityOpId, H256, U256, U64,
@@ -15,7 +16,7 @@ use zksync_dal::eth_watcher_dal::EventType;
1516
use zksync_eth_client::{CallFunctionArgs, EthInterface};
1617
use zksync_l1_contract_interface::i_executor::structures::StoredBatchInfo;
1718
use zksync_types::{l1::L1Tx, ProtocolVersion};
18-
use zksync_utils::{bytecode::hash_bytecode, env::Workspace};
19+
use zksync_utils::env::Workspace;
1920
use zksync_web3_decl::client::{DynClient, L1};
2021

2122
use crate::l1_fetcher::{
@@ -464,7 +465,7 @@ impl L1Fetcher {
464465
.priority_ops_onchain_data
465466
.push(priority_tx.common_data.onchain_data());
466467
for factory_dep in &priority_tx.execute.factory_deps {
467-
let hashed = hash_bytecode(factory_dep);
468+
let hashed = BytecodeHash::for_bytecode(factory_dep).value();
468469
if factory_deps_hashes.contains_key(&hashed) {
469470
continue;
470471
} else {
@@ -695,9 +696,11 @@ mod tests {
695696
use std::{num::NonZero, str::FromStr, sync::Arc};
696697

697698
use tempfile::TempDir;
698-
use zksync_basic_types::{url::SensitiveUrl, web3::keccak256, L1BatchNumber, H256, U64};
699+
use zksync_basic_types::{
700+
bytecode::BytecodeHash, url::SensitiveUrl, web3::keccak256, L1BatchNumber, H256, U64,
701+
};
699702
use zksync_dal::{ConnectionPool, Core};
700-
use zksync_utils::{bytecode::hash_bytecode, env::Workspace};
703+
use zksync_utils::env::Workspace;
701704
use zksync_web3_decl::client::{Client, DynClient, L1};
702705

703706
use crate::{
@@ -760,7 +763,7 @@ mod tests {
760763
let block = &blocks[0];
761764
assert_eq!(9, block.factory_deps.len());
762765
assert_eq!(
763-
hash_bytecode(&block.factory_deps[0]),
766+
BytecodeHash::for_bytecode(&block.factory_deps[0]).value(),
764767
H256::from_str("0x010000418c2c6cddb87cc900cb58ff9fd387862d6f77d4e7d40dc35694ba1ae4")
765768
.unwrap()
766769
);
@@ -790,7 +793,7 @@ mod tests {
790793
let block = &blocks[0];
791794
assert_eq!(6, block.factory_deps.len());
792795
assert_eq!(
793-
hash_bytecode(&block.factory_deps[0]),
796+
BytecodeHash::for_bytecode(&block.factory_deps[0]).value(),
794797
H256::from_str("0x0100009ffa898e7aa96817a2267079a0c8e92ce719b16b2be4cb17a4db04b0e2")
795798
.unwrap()
796799
);

core/node/l1_recovery/src/l1_fetcher/types/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ use ethabi;
44
use indexmap::IndexMap;
55
use serde::{Deserialize, Serialize};
66
use thiserror::Error;
7-
use zksync_basic_types::{web3::keccak256, Address, H160, H256, U256};
7+
use zksync_basic_types::{u256_to_h256, web3::keccak256, Address, H160, H256, U256};
88
use zksync_types::{priority_op_onchain_data::PriorityOpOnchainData, L2_TO_L1_LOGS_TREE_ROOT_KEY};
9-
use zksync_utils::u256_to_h256;
109

1110
use self::{v1::V1, v2::V2, v3::V3};
1211
use crate::{

core/node/l1_recovery/src/processor/db_recovery.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ use zksync_types::{
2626
SYSTEM_CONTEXT_CURRENT_L2_BLOCK_HASHES_POSITION, SYSTEM_CONTEXT_CURRENT_L2_BLOCK_INFO_POSITION,
2727
SYSTEM_CONTEXT_CURRENT_TX_ROLLING_HASH_POSITION, SYSTEM_CONTEXT_STORED_L2_BLOCK_HASHES,
2828
};
29-
use zksync_utils::{h256_to_u256, u256_to_h256};
3029
use zksync_vm_interface::{
3130
CircuitStatistic, L2Block, TransactionExecutionResult, TxExecutionStatus, VmExecutionMetrics,
3231
};

core/node/l1_recovery/src/processor/genesis.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
use std::{collections::HashSet, fs, path::PathBuf, str::FromStr};
22

33
use serde_json::Value;
4-
use zksync_basic_types::{Address, H160, H256, U256};
4+
use zksync_basic_types::{bytecode::BytecodeHash, Address, H160, H256, U256};
55
use zksync_contracts::BaseSystemContracts;
66
use zksync_merkle_tree::TreeEntry;
77
use zksync_node_genesis::get_storage_logs;
88
use zksync_types::system_contracts::get_system_smart_contracts;
9-
use zksync_utils::{be_words_to_bytes, bytecode::hash_bytecode};
109

1110
use crate::utils::derive_final_address_for_params;
1211

@@ -101,15 +100,15 @@ pub fn get_genesis_factory_deps() -> Vec<Vec<u8>> {
101100
let mut hashes: HashSet<H256> = HashSet::new();
102101
let mut bytecodes: Vec<Vec<u8>> = vec![];
103102
for contract in &contracts {
104-
if hashes.contains(&hash_bytecode(&contract.bytecode)) {
103+
if hashes.contains(&BytecodeHash::for_bytecode(&contract.bytecode).value()) {
105104
continue;
106105
}
107106
bytecodes.push(contract.bytecode.clone());
108-
hashes.insert(hash_bytecode(&contract.bytecode));
107+
hashes.insert(BytecodeHash::for_bytecode(&contract.bytecode).value());
109108
}
110109
let base_contracts = BaseSystemContracts::load_from_disk();
111-
bytecodes.push(be_words_to_bytes(&base_contracts.bootloader.code.clone()));
112-
bytecodes.push(be_words_to_bytes(&base_contracts.default_aa.code.clone()));
110+
bytecodes.push(base_contracts.bootloader.code.clone());
111+
bytecodes.push(base_contracts.default_aa.code.clone());
113112
tracing::info!("Found {} system contracts", bytecodes.len());
114113

115114
bytecodes

core/node/l1_recovery/src/processor/snapshot/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use zksync_types::{
66
snapshots::{SnapshotFactoryDependency, SnapshotStorageLog},
77
StorageKey, SYSTEM_CONTEXT_ADDRESS, SYSTEM_CONTEXT_CURRENT_L2_BLOCK_INFO_POSITION,
88
};
9-
use zksync_utils::h256_to_u256;
109
use zksync_vm_interface::L2Block;
1110

1211
use crate::{

core/node/l1_recovery/src/processor/tree/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ use std::{path::PathBuf, sync::Arc};
44

55
use anyhow::Result;
66
use tokio::sync::Mutex;
7-
use zksync_basic_types::{web3::keccak256, AccountTreeId, L2BlockNumber, H256, U256};
7+
use zksync_basic_types::{
8+
h256_to_u256, u256_to_h256, web3::keccak256, AccountTreeId, L2BlockNumber, H256, U256,
9+
};
810
use zksync_merkle_tree::TreeEntry;
911
use zksync_types::{
1012
block::unpack_block_info, snapshots::SnapshotStorageLog, StorageKey, SYSTEM_CONTEXT_ADDRESS,
1113
SYSTEM_CONTEXT_CURRENT_L2_BLOCK_HASHES_POSITION, SYSTEM_CONTEXT_CURRENT_L2_BLOCK_INFO_POSITION,
1214
SYSTEM_CONTEXT_CURRENT_TX_ROLLING_HASH_POSITION, SYSTEM_CONTEXT_STORED_L2_BLOCK_HASHES,
1315
};
14-
use zksync_utils::{h256_to_u256, u256_to_h256};
1516
use zksync_vm_interface::L2Block;
1617

1718
use self::tree_wrapper::TreeWrapper;

core/node/l1_recovery/src/processor/tree/tree_wrapper.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ use zksync_basic_types::{H256, U256};
1111
use zksync_merkle_tree::{Database, Key, MerkleTree, RocksDBWrapper, TreeEntry};
1212
use zksync_storage::{RocksDB, RocksDBOptions};
1313
use zksync_types::{snapshots::SnapshotStorageLog, StorageKey};
14-
use zksync_utils::h256_to_u256;
1514

1615
use super::RootHash;
1716
use crate::{

0 commit comments

Comments
 (0)