Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Rollbackable fields private #239

Draft
wants to merge 5 commits into
base: era_vm_integration_v2
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,16 @@ impl BootloaderState {
memory
}

pub(crate) fn last_l2_block(&self) -> &BootloaderL2Block {
self.l2_blocks.last().unwrap()
}
pub(crate) fn get_pubdata_information(&self) -> &PubdataInput {
self.pubdata_information
.get()
.expect("Pubdata information is not set")
}

pub(crate) fn last_l2_block(&self) -> &BootloaderL2Block {
self.l2_blocks.last().unwrap()
}

fn last_mut_l2_block(&mut self) -> &mut BootloaderL2Block {
self.l2_blocks.last_mut().unwrap()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use std::collections::HashSet;

use itertools::Itertools;
use zksync_state::ReadStorage;
use zksync_system_constants::CONTRACT_DEPLOYER_ADDRESS;
use zksync_test_account::Account;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use era_vm::{
store::StorageKey,
};
use zksync_state::ReadStorage;
use zksync_types::{ExecuteTransactionCommon, Transaction, H160, U256};
use zksync_types::{ExecuteTransactionCommon, Transaction, U256};

use super::VmTester;
use crate::{
Expand Down Expand Up @@ -213,11 +213,11 @@ impl<S: ReadStorage> Vm<S> {
state: VmStateDump {
storage_changes: self.inner.state.storage_changes().clone(),
transient_storage: self.inner.state.transient_storage().clone(),
l2_to_l1_logs: self.inner.state.l2_to_l1_logs().clone(),
events: self.inner.state.events().clone(),
l2_to_l1_logs: self.inner.state.l2_to_l1_logs().to_vec(),
events: self.inner.state.events().to_vec(),
pubdata: self.inner.state.pubdata().clone(),
pubdata_costs: self.inner.state.pubdata_costs().clone(),
refunds: self.inner.state.refunds().clone(),
pubdata_costs: self.inner.state.pubdata_costs().to_vec(),
refunds: self.inner.state.refunds().to_vec(),
decommitted_hashes: self.inner.state.decommitted_hashes().clone(),
},
}
Expand Down
4 changes: 0 additions & 4 deletions core/lib/multivm/src/versions/era_vm/tests/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ use crate::vm_latest::CurrentExecutionState;
pub(crate) static BASE_SYSTEM_CONTRACTS: Lazy<BaseSystemContracts> =
Lazy::new(BaseSystemContracts::load_from_disk);

pub fn lambda_storage_key_to_zk(key: StorageKey) -> ZKStorageKey {
ZKStorageKey::new(AccountTreeId::new(key.address), u256_to_h256(key.key))
}

pub fn zk_storage_key_to_lambda(key: &ZKStorageKey) -> StorageKey {
StorageKey {
address: key.address().clone(),
Expand Down
4 changes: 2 additions & 2 deletions core/lib/multivm/src/versions/era_vm/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -560,8 +560,8 @@ impl<S: ReadStorage> VmInterface for Vm<S> {
.map(|log| log.into_system_log())
.collect(),
user_l2_to_l1_logs,
storage_refunds: state.refunds().clone(),
pubdata_costs: state.pubdata_costs().clone(),
storage_refunds: state.refunds().to_vec(),
pubdata_costs: state.pubdata_costs().to_vec(),
}
}

Expand Down
Loading