Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
itegulov committed Mar 26, 2024
1 parent 68398d4 commit 0b76b99
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion core/lib/zksync_core/src/block_reverter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ impl BlockReverter {
tracing::info!("opening DB with state keeper cache...");
let sk_cache = RocksdbStorage::builder(self.state_keeper_cache_path.as_ref())
.await
.expect("Failed initializing state keeper");
.expect("Failed initializing state keeper cache");

if sk_cache.l1_batch_number().await > Some(last_l1_batch_to_keep + 1) {
let mut storage = self.connection_pool.connection().await.unwrap();
Expand Down
34 changes: 17 additions & 17 deletions core/lib/zksync_core/src/state_keeper/batch_executor/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fn assert_reverted(execution_result: &TxExecutionResult) {
}
}

#[derive(Debug, Clone)]
#[derive(Debug, Clone, Copy)]
enum StorageType {
AsyncRocksdbCache,
Rocksdb,
Expand All @@ -50,7 +50,7 @@ async fn execute_l2_tx(storage_type: StorageType) {
let mut tester = Tester::new(connection_pool);
tester.genesis().await;
tester.fund(&[alice.address()]).await;
let executor = tester.create_batch_executor(&storage_type).await;
let executor = tester.create_batch_executor(storage_type).await;

let res = executor.execute_tx(alice.execute()).await;
assert_executed(&res);
Expand Down Expand Up @@ -130,7 +130,7 @@ async fn execute_l1_tx() {
tester.genesis().await;
tester.fund(&[alice.address()]).await;
let executor = tester
.create_batch_executor(&StorageType::AsyncRocksdbCache)
.create_batch_executor(StorageType::AsyncRocksdbCache)
.await;

let res = executor.execute_tx(alice.l1_execute(PriorityOpId(1))).await;
Expand All @@ -148,7 +148,7 @@ async fn execute_l2_and_l1_txs() {
tester.genesis().await;
tester.fund(&[alice.address()]).await;
let executor = tester
.create_batch_executor(&StorageType::AsyncRocksdbCache)
.create_batch_executor(StorageType::AsyncRocksdbCache)
.await;

let res = executor.execute_tx(alice.execute()).await;
Expand All @@ -171,7 +171,7 @@ async fn rollback() {
tester.genesis().await;
tester.fund(&[alice.address()]).await;
let executor = tester
.create_batch_executor(&StorageType::AsyncRocksdbCache)
.create_batch_executor(StorageType::AsyncRocksdbCache)
.await;

let tx = alice.execute();
Expand Down Expand Up @@ -216,7 +216,7 @@ async fn reject_tx() {

tester.genesis().await;
let executor = tester
.create_batch_executor(&StorageType::AsyncRocksdbCache)
.create_batch_executor(StorageType::AsyncRocksdbCache)
.await;

// Wallet is not funded, it can't pay for fees.
Expand All @@ -234,7 +234,7 @@ async fn too_big_gas_limit() {
tester.genesis().await;
tester.fund(&[alice.address()]).await;
let executor = tester
.create_batch_executor(&StorageType::AsyncRocksdbCache)
.create_batch_executor(StorageType::AsyncRocksdbCache)
.await;

let bad_tx = alice.execute_with_gas_limit(u32::MAX);
Expand Down Expand Up @@ -283,7 +283,7 @@ async fn tx_cant_be_reexecuted() {
tester.genesis().await;
tester.fund(&[alice.address()]).await;
let executor = tester
.create_batch_executor(&StorageType::AsyncRocksdbCache)
.create_batch_executor(StorageType::AsyncRocksdbCache)
.await;

let tx = alice.execute();
Expand All @@ -305,7 +305,7 @@ async fn deploy_and_call_loadtest() {
tester.genesis().await;
tester.fund(&[alice.address()]).await;
let executor = tester
.create_batch_executor(&StorageType::AsyncRocksdbCache)
.create_batch_executor(StorageType::AsyncRocksdbCache)
.await;

let tx = alice.deploy_loadnext_tx();
Expand Down Expand Up @@ -334,7 +334,7 @@ async fn execute_reverted_tx() {
tester.genesis().await;
tester.fund(&[alice.address()]).await;
let executor = tester
.create_batch_executor(&StorageType::AsyncRocksdbCache)
.create_batch_executor(StorageType::AsyncRocksdbCache)
.await;

let tx = alice.deploy_loadnext_tx();
Expand Down Expand Up @@ -365,7 +365,7 @@ async fn execute_realistic_scenario() {
tester.fund(&[alice.address()]).await;
tester.fund(&[bob.address()]).await;
let executor = tester
.create_batch_executor(&StorageType::AsyncRocksdbCache)
.create_batch_executor(StorageType::AsyncRocksdbCache)
.await;

// A good tx should be executed successfully.
Expand Down Expand Up @@ -424,7 +424,7 @@ async fn bootloader_out_of_gas_for_any_tx() {
tester.genesis().await;
tester.fund(&[alice.address()]).await;
let executor = tester
.create_batch_executor(&StorageType::AsyncRocksdbCache)
.create_batch_executor(StorageType::AsyncRocksdbCache)
.await;

let res = executor.execute_tx(alice.execute()).await;
Expand All @@ -443,7 +443,7 @@ async fn bootloader_tip_out_of_gas() {
tester.genesis().await;
tester.fund(&[alice.address()]).await;
let executor = tester
.create_batch_executor(&StorageType::AsyncRocksdbCache)
.create_batch_executor(StorageType::AsyncRocksdbCache)
.await;

let res = executor.execute_tx(alice.execute()).await;
Expand All @@ -462,7 +462,7 @@ async fn bootloader_tip_out_of_gas() {
});

let second_executor = tester
.create_batch_executor(&StorageType::AsyncRocksdbCache)
.create_batch_executor(StorageType::AsyncRocksdbCache)
.await;

let res = second_executor.execute_tx(alice.execute()).await;
Expand All @@ -481,7 +481,7 @@ async fn catchup_rocksdb_cache() {
tester.fund(&[alice.address(), bob.address()]).await;

// Execute a bunch of transactions to populate Postgres-based storage (note that RocksDB stays empty)
let executor = tester.create_batch_executor(&StorageType::Postgres).await;
let executor = tester.create_batch_executor(StorageType::Postgres).await;
for _ in 0..10 {
let res = executor.execute_tx(alice.execute()).await;
assert_executed(&res);
Expand All @@ -495,7 +495,7 @@ async fn catchup_rocksdb_cache() {

// Async RocksDB cache should be aware of the tx and should reject it
let executor = tester
.create_batch_executor(&StorageType::AsyncRocksdbCache)
.create_batch_executor(StorageType::AsyncRocksdbCache)
.await;
let res = executor.execute_tx(tx.clone()).await;
assert_rejected(&res);
Expand All @@ -508,7 +508,7 @@ async fn catchup_rocksdb_cache() {
tester.wait_for_tasks().await;

// Sync RocksDB storage should be aware of the tx and should reject it
let executor = tester.create_batch_executor(&StorageType::Rocksdb).await;
let executor = tester.create_batch_executor(StorageType::Rocksdb).await;
let res = executor.execute_tx(tx).await;
assert_rejected(&res);
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ impl Tester {
/// This function intentionally uses sensible defaults to not introduce boilerplate.
pub(super) async fn create_batch_executor(
&mut self,
storage_type: &StorageType,
storage_type: StorageType,
) -> BatchExecutorHandle {
let (l1_batch_env, system_env) = self.default_batch_params();
match storage_type {
Expand Down Expand Up @@ -513,7 +513,7 @@ impl StorageSnapshot {
drop(storage);

let executor = tester
.create_batch_executor(&StorageType::AsyncRocksdbCache)
.create_batch_executor(StorageType::AsyncRocksdbCache)
.await;
let mut l2_block_env = L2BlockEnv {
number: 1,
Expand Down

0 comments on commit 0b76b99

Please sign in to comment.