Skip to content

Commit

Permalink
Merge branch 'main' into sb-system-context-debug
Browse files Browse the repository at this point in the history
  • Loading branch information
StanislavBreadless authored May 30, 2024
2 parents f96beae + c8c8ea9 commit 5665553
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/build-prover-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
- proof-fri-compressor
- proof-fri-gpu-compressor
outputs:
protocol_version: ${{ steps.protocol-version.outputs.protocol_version }}
protocol_version: ${{ steps.protocolversion.outputs.protocol_version }}
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
with:
Expand Down Expand Up @@ -148,10 +148,11 @@ jobs:
exit 1
- name: protocol-version
id: protocolversion
# TODO: use -C flag, when it will become stable.
shell: bash
run: |
ci_run cargo build --release --manifest-path prover/Cargo.toml --bin prover_version
ci_run bash -c "cd prover && cargo build --release --bin prover_version"
PPV=$(ci_run prover/target/release/prover_version)
echo Protocol version is ${PPV}
echo "protocol_version=${PPV}" >> $GITHUB_OUTPUT
Expand Down
1 change: 1 addition & 0 deletions core/lib/multivm/src/versions/vm_latest/oracles/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ impl<S: WriteStorage> OracleWithHistory for StorageOracle<S, HistoryEnabled> {
fn rollback_to_timestamp(&mut self, timestamp: Timestamp) {
self.storage.rollback_to_timestamp(timestamp);
self.storage_frames_stack.rollback_to_timestamp(timestamp);
self.transient_storage.rollback_to_timestamp(timestamp);
self.transient_storage_frames_stack
.rollback_to_timestamp(timestamp);
self.paid_changes.rollback_to_timestamp(timestamp);
Expand Down
22 changes: 15 additions & 7 deletions core/lib/multivm/src/versions/vm_latest/tests/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use zksync_contracts::{load_contract, read_bytecode};
use zksync_types::{fee::Fee, Address, Execute, U256};

use crate::{
interface::{TxExecutionMode, VmExecutionMode, VmInterface},
interface::{TxExecutionMode, VmExecutionMode, VmInterface, VmInterfaceHistoryEnabled},
vm_latest::{tests::tester::VmTesterBuilder, HistoryEnabled},
};

Expand All @@ -28,21 +28,23 @@ fn test_storage(txs: Vec<TestTxInfo>) -> u32 {
.with_empty_in_memory_storage()
.with_execution_mode(TxExecutionMode::VerifyExecute)
.with_deployer()
.with_random_rich_accounts(1)
.with_random_rich_accounts(txs.len() as u32)
.with_custom_contracts(vec![(bytecode, test_contract_address, false)])
.build();

let account = &mut vm.rich_accounts[0];

let mut last_result = None;

for tx in txs {
for (id, tx) in txs.into_iter().enumerate() {
let TestTxInfo {
calldata,
fee_overrides,
should_fail,
} = tx;

let account = &mut vm.rich_accounts[id];

vm.vm.make_snapshot();

let tx = account.get_l2_tx_for_execute(
Execute {
contract_address: test_contract_address,
Expand All @@ -57,8 +59,10 @@ fn test_storage(txs: Vec<TestTxInfo>) -> u32 {
let result = vm.vm.execute(VmExecutionMode::OneTx);
if should_fail {
assert!(result.result.is_failed(), "Transaction should fail");
vm.vm.rollback_to_the_latest_snapshot();
} else {
assert!(!result.result.is_failed(), "Transaction should not fail");
vm.vm.pop_snapshot_no_rollback();
}

last_result = Some(result);
Expand Down Expand Up @@ -151,7 +155,7 @@ fn test_transient_storage_behavior_panic() {
"etc/contracts-test-data/artifacts-zk/contracts/storage/storage.sol/StorageTester.json",
);

let first_tstore_test = contract
let basic_tstore_test = contract
.function("tStoreAndRevert")
.unwrap()
.encode_input(&[Token::Uint(U256::one()), Token::Bool(false)])
Expand All @@ -165,13 +169,17 @@ fn test_transient_storage_behavior_panic() {

test_storage(vec![
TestTxInfo {
calldata: first_tstore_test,
calldata: basic_tstore_test.clone(),
..TestTxInfo::default()
},
TestTxInfo {
fee_overrides: Some(small_fee),
should_fail: true,
..TestTxInfo::default()
},
TestTxInfo {
calldata: basic_tstore_test,
..TestTxInfo::default()
},
]);
}

0 comments on commit 5665553

Please sign in to comment.