Skip to content

Commit

Permalink
Historical release: v0.141.1
Browse files Browse the repository at this point in the history
  • Loading branch information
popzxc committed Aug 15, 2024
1 parent 4c787b8 commit 2c212fc
Show file tree
Hide file tree
Showing 103 changed files with 3,446 additions and 3,940 deletions.
8 changes: 5 additions & 3 deletions crates/circuit_encodings/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "circuit_encodings"
version = "0.140.1"
version = "0.141.1"
edition = "2021"
authors = ["The Matter Labs Team <[email protected]>"]
homepage = "https://zksync.io/"
Expand All @@ -13,12 +13,14 @@ description = "ZKsync Era circuits encodings"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
zkevm_circuits = { version = "0.140", path = "../zkevm_circuits" } # Not pinned, because it's an old version used only by MultiVM.
zk_evm = { version = "0.140", path = "../zk_evm" } # Not pinned, because it's an old version used only by MultiVM
zkevm_circuits = { version = "0.141", path = "../zkevm_circuits" } # Not pinned, because it's an old dependency used by MultiVM
zk_evm = { version = "0.141", path = "../zk_evm" } # Not pinned, because it's an old dependency used by MultiVM


derivative = "2.2"
serde = {version = "1", features = ["derive"]}


[features]
default = []
log_tracing = ["zkevm_circuits/log_tracing"]
10 changes: 4 additions & 6 deletions crates/circuit_sequencer_api/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "circuit_sequencer_api"
version = "0.140.1"
version = "0.141.1"
edition = "2021"
authors = ["The Matter Labs Team <[email protected]>"]
homepage = "https://zksync.io/"
Expand All @@ -13,16 +13,14 @@ description = "ZKsync Era circuits API for sequencer"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
circuit_encodings = { version = "0.140", path = "../circuit_encodings" } # Not pinned, because it's an old version used only by MultiVM

zk_evm = { version = "0.140", path = "../zk_evm" } # Not pinned, because it's an old version used only by MultiVM
bellman = { package = "bellman_ce", version = "0" } # Not pinned, because it's an old version used only by MultiVM

circuit_encodings = { version = "0.141", path = "../circuit_encodings" } # Not pinned, because it's an old dependency used by MultiVM
zk_evm = { version = "0.141", path = "../zk_evm" } # Not pinned, because it's an old dependency used by MultiVM
bellman = { package = "bellman_ce", version = "0" } # Not pinned, because it's an old dependency used by MultiVM

derivative = "2.2"
serde = {version = "1", features = ["derive"]}
rayon = "1.10"


[features]
default = []
6 changes: 3 additions & 3 deletions crates/circuit_sequencer_api/src/geometry_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ use crate::toolset::GeometryConfig;

pub const fn get_geometry_config() -> GeometryConfig {
GeometryConfig {
cycles_per_vm_snapshot: 5692,
cycles_per_vm_snapshot: 5585,
cycles_code_decommitter_sorter: 117500,
cycles_per_log_demuxer: 58750,
cycles_per_storage_sorter: 46921,
cycles_per_events_or_l1_messages_sorter: 31287,
cycles_per_ram_permutation: 136714,
cycles_per_code_decommitter: 2845,
cycles_per_storage_application: 33,
cycles_per_keccak256_circuit: 672,
cycles_per_keccak256_circuit: 293,
cycles_per_sha256_circuit: 2206,
cycles_per_ecrecover_circuit: 2,
cycles_per_ecrecover_circuit: 7,
limit_for_l1_messages_pudata_hasher: 774,
}
}
5 changes: 3 additions & 2 deletions crates/zk_evm/.github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ jobs:
- uses: actions/checkout@v3
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: nightly-2023-04-17
toolchain: stable
- run: cargo build --verbose --all-features
- run: RUSTFLAGS="-Awarnings" cargo test --verbose --all-features
# OOMs on ubuntu-latest.
# - run: RUSTFLAGS="-Awarnings" cargo test --verbose --all-features

formatting:
name: cargo fmt
Expand Down
6 changes: 3 additions & 3 deletions crates/zk_evm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "zk_evm"
version = "0.140.0"
version = "0.141.0"
edition = "2021"
authors = ["The Matter Labs Team <[email protected]>"]
homepage = "https://zksync.io/"
Expand All @@ -18,8 +18,8 @@ serde_json = "1.0"
anyhow = "1.0"
num = { version = "0.4"}
static_assertions = "1"
zkevm_opcode_defs = { version = "=0.132.0", path = "../zkevm_opcode_defs" }
zk_evm_abstractions = { version = "=0.140.0", path = "../zk_evm_abstractions" }
zkevm_opcode_defs = { version = "=0.141.0", path = "../zkevm_opcode_defs" }
zk_evm_abstractions = { version = "=0.141.0", path = "../zk_evm_abstractions" }
lazy_static = "1.4"

[dev-dependencies]
Expand Down
13 changes: 0 additions & 13 deletions crates/zk_evm/eraLogo.svg

This file was deleted.

1 change: 0 additions & 1 deletion crates/zk_evm/src/opcodes/execution/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use super::*;

impl<const N: usize, E: VmEncodingMode<N>> DecodedOpcode<N, E> {
pub fn add_opcode_apply<
'a,
S: zk_evm_abstractions::vm::Storage,
M: zk_evm_abstractions::vm::Memory,
EV: zk_evm_abstractions::vm::EventSink,
Expand Down
1 change: 0 additions & 1 deletion crates/zk_evm/src/opcodes/execution/binop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use zkevm_opcode_defs::{BinopOpcode, Opcode};

impl<const N: usize, E: VmEncodingMode<N>> DecodedOpcode<N, E> {
pub fn binop_opcode_apply<
'a,
S: zk_evm_abstractions::vm::Storage,
M: zk_evm_abstractions::vm::Memory,
EV: zk_evm_abstractions::vm::EventSink,
Expand Down
1 change: 0 additions & 1 deletion crates/zk_evm/src/opcodes/execution/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use zkevm_opcode_defs::{ContextOpcode, Opcode};

impl<const N: usize, E: VmEncodingMode<N>> DecodedOpcode<N, E> {
pub fn context_opcode_apply<
'a,
S: zk_evm_abstractions::vm::Storage,
M: zk_evm_abstractions::vm::Memory,
EV: zk_evm_abstractions::vm::EventSink,
Expand Down
1 change: 0 additions & 1 deletion crates/zk_evm/src/opcodes/execution/div.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use super::*;

impl<const N: usize, E: VmEncodingMode<N>> DecodedOpcode<N, E> {
pub fn div_opcode_apply<
'a,
S: zk_evm_abstractions::vm::Storage,
M: zk_evm_abstractions::vm::Memory,
EV: zk_evm_abstractions::vm::EventSink,
Expand Down
3 changes: 2 additions & 1 deletion crates/zk_evm/src/opcodes/execution/far_call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ use zkevm_opcode_defs::{FarCallABI, FarCallForwardPageType, FarCallOpcode, FatPo

impl<const N: usize, E: VmEncodingMode<N>> DecodedOpcode<N, E> {
pub fn far_call_opcode_apply<
'a,
S: zk_evm_abstractions::vm::Storage,
M: zk_evm_abstractions::vm::Memory,
EV: zk_evm_abstractions::vm::EventSink,
Expand Down Expand Up @@ -96,6 +95,7 @@ impl<const N: usize, E: VmEncodingMode<N>> DecodedOpcode<N, E> {
let remaining_ergs = current_stack.ergs_remaining;
let current_context_u128 = current_stack.context_u128_value;

#[allow(dropping_references)]
drop(current_stack);

let timestamp_for_storage_read = vm_state.timestamp_for_first_decommit_or_precompile_read();
Expand Down Expand Up @@ -368,6 +368,7 @@ impl<const N: usize, E: VmEncodingMode<N>> DecodedOpcode<N, E> {
FarCallForwardPageType::ForwardFatPointer => 0u32,
};

#[allow(dropping_references)]
drop(current_stack_mut);

// MEMORY_GROWTH_ERGS_PER_BYTE is always 1
Expand Down
1 change: 0 additions & 1 deletion crates/zk_evm/src/opcodes/execution/jump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use super::*;

impl<const N: usize, E: VmEncodingMode<N>> DecodedOpcode<N, E> {
pub fn jump_opcode_apply<
'a,
S: zk_evm_abstractions::vm::Storage,
M: zk_evm_abstractions::vm::Memory,
EV: zk_evm_abstractions::vm::EventSink,
Expand Down
74 changes: 34 additions & 40 deletions crates/zk_evm/src/opcodes/execution/log.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
use super::*;

use zk_evm_abstractions::queries::LogQuery;
use zkevm_opcode_defs::{
LogOpcode, Opcode, PrecompileCallABI, PrecompileCallInnerABI, FIRST_MESSAGE_FLAG_IDX,
};
use zkevm_opcode_defs::{LogOpcode, Opcode, PrecompileCallABI, FIRST_MESSAGE_FLAG_IDX};

use zkevm_opcode_defs::system_params::{
EVENT_AUX_BYTE, L1_MESSAGE_AUX_BYTE, PRECOMPILE_AUX_BYTE, STORAGE_AUX_BYTE,
};

impl<const N: usize, E: VmEncodingMode<N>> DecodedOpcode<N, E> {
pub fn log_opcode_apply<
'a,
S: zk_evm_abstractions::vm::Storage,
M: zk_evm_abstractions::vm::Memory,
EV: zk_evm_abstractions::vm::EventSink,
Expand Down Expand Up @@ -78,6 +75,8 @@ impl<const N: usize, E: VmEncodingMode<N>> DecodedOpcode<N, E> {
let current_context = vm_state.local_state.callstack.get_current_stack();
let address = current_context.this_address;
let shard_id = current_context.this_shard_id;

#[allow(dropping_references)]
drop(current_context);

// we do not need all the values here, but we DO need the written value
Expand Down Expand Up @@ -156,7 +155,10 @@ impl<const N: usize, E: VmEncodingMode<N>> DecodedOpcode<N, E> {
let current_context = vm_state.local_state.callstack.get_current_stack();
let address = current_context.this_address;
let shard_id = current_context.this_shard_id;

#[allow(dropping_references)]
drop(current_context);

match inner_variant {
LogOpcode::StorageRead => {
assert!(not_enough_power == false);
Expand Down Expand Up @@ -261,65 +263,57 @@ impl<const N: usize, E: VmEncodingMode<N>> DecodedOpcode<N, E> {
return;
}

let precompile_abi = PrecompileCallABI::from_u256(src0);
let PrecompileCallABI {
input_memory_offset,
input_memory_length,
output_memory_offset,
output_memory_length,
per_precompile_interpreted,
} = precompile_abi;

let mut precompile_abi = PrecompileCallABI::from_u256(src0);
// normal execution
vm_state
.local_state
.callstack
.get_current_stack_mut()
.ergs_remaining = ergs_remaining;
let memory_page_to_read = CallStackEntry::<N, E>::heap_page_from_base(
vm_state
.local_state
.callstack
.get_current_stack()
.base_memory_page,
);
let memory_page_to_write = CallStackEntry::<N, E>::heap_page_from_base(
vm_state
.local_state
.callstack
.get_current_stack()
.base_memory_page,
);
if precompile_abi.memory_page_to_read == 0 {
let memory_page_to_read = CallStackEntry::<N, E>::heap_page_from_base(
vm_state
.local_state
.callstack
.get_current_stack()
.base_memory_page,
);
precompile_abi.memory_page_to_read = memory_page_to_read.0;
}

if precompile_abi.memory_page_to_write == 0 {
let memory_page_to_write = CallStackEntry::<N, E>::heap_page_from_base(
vm_state
.local_state
.callstack
.get_current_stack()
.base_memory_page,
);
precompile_abi.memory_page_to_write = memory_page_to_write.0;
}

let timestamp_to_read = vm_state.timestamp_for_first_decommit_or_precompile_read();
debug_assert!(timestamp_to_read == timestamp_for_log);
let timestamp_to_write =
vm_state.timestamp_for_second_decommit_or_precompile_write();
assert!(timestamp_to_read.0 + 1 == timestamp_to_write.0);

let precompile_inner_abi = PrecompileCallInnerABI {
input_memory_offset,
input_memory_length,
output_memory_offset,
output_memory_length,
memory_page_to_read: memory_page_to_read.0,
memory_page_to_write: memory_page_to_write.0,
precompile_interpreted_data: per_precompile_interpreted,
};
let precompile_inner_abi = precompile_inner_abi.to_u256();
debug_assert!(timestamp_to_read.0 + 1 == timestamp_to_write.0);

let precompile_abi_encoded = precompile_abi.to_u256();

let query = LogQuery {
timestamp: timestamp_for_log,
tx_number_in_block,
aux_byte: PRECOMPILE_AUX_BYTE,
shard_id,
address,
key: precompile_inner_abi,
key: precompile_abi_encoded,
read_value: U256::zero(),
written_value: U256::zero(),
rw_flag: false,
rollback: false,
is_service: is_first_message,
};

vm_state.call_precompile(vm_state.local_state.monotonic_cycle_counter, query);
let result = PrimitiveValue {
value: U256::from(1u64),
Expand Down
1 change: 0 additions & 1 deletion crates/zk_evm/src/opcodes/execution/mul.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use super::*;

impl<const N: usize, E: VmEncodingMode<N>> DecodedOpcode<N, E> {
pub fn mul_opcode_apply<
'a,
S: zk_evm_abstractions::vm::Storage,
M: zk_evm_abstractions::vm::Memory,
EV: zk_evm_abstractions::vm::EventSink,
Expand Down
1 change: 0 additions & 1 deletion crates/zk_evm/src/opcodes/execution/near_call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use super::*;

impl<const N: usize, E: VmEncodingMode<N>> DecodedOpcode<N, E> {
pub fn near_call_opcode_apply<
'a,
S: zk_evm_abstractions::vm::Storage,
M: zk_evm_abstractions::vm::Memory,
EV: zk_evm_abstractions::vm::EventSink,
Expand Down
1 change: 0 additions & 1 deletion crates/zk_evm/src/opcodes/execution/noop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use super::*;

impl<const N: usize, E: VmEncodingMode<N>> DecodedOpcode<N, E> {
pub fn noop_opcode_apply<
'a,
S: zk_evm_abstractions::vm::Storage,
M: zk_evm_abstractions::vm::Memory,
EV: zk_evm_abstractions::vm::EventSink,
Expand Down
1 change: 0 additions & 1 deletion crates/zk_evm/src/opcodes/execution/ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use zkevm_opcode_defs::{FatPointer, Opcode, PtrOpcode};

impl<const N: usize, E: VmEncodingMode<N>> DecodedOpcode<N, E> {
pub fn ptr_opcode_apply<
'a,
S: zk_evm_abstractions::vm::Storage,
M: zk_evm_abstractions::vm::Memory,
EV: zk_evm_abstractions::vm::EventSink,
Expand Down
Loading

0 comments on commit 2c212fc

Please sign in to comment.