Skip to content
This repository was archived by the owner on Apr 18, 2025. It is now read-only.

(WIP): add sstore op #107

Closed
wants to merge 49 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
f00aaee
update
0xmountaintop Feb 13, 2022
afcde83
fix clippy
0xmountaintop Feb 13, 2022
20de4a7
clean up
0xmountaintop Feb 13, 2022
ef434f4
cargo fmt
0xmountaintop Feb 13, 2022
958aa40
cargo clippy
0xmountaintop Feb 13, 2022
29a59f9
minor
0xmountaintop Feb 14, 2022
45e18fc
Merge remote-tracking branch 'origin/main' into re-init
0xmountaintop Feb 15, 2022
8c3987c
Merge branch 'main' into re-init
0xmountaintop Feb 17, 2022
3e1aaa0
merge with master
0xmountaintop Feb 21, 2022
6e7e4d2
Merge remote-tracking branch 'origin/main' into re-init
0xmountaintop Feb 21, 2022
6555051
minor
0xmountaintop Feb 21, 2022
8541fe9
cargo fmt
0xmountaintop Feb 21, 2022
9a53e70
add more to StorageOp
0xmountaintop Feb 21, 2022
a438997
skip for now
0xmountaintop Feb 21, 2022
167b1c3
cargo fmt
0xmountaintop Feb 21, 2022
2473e5b
minor
0xmountaintop Feb 21, 2022
e087cf9
minor
0xmountaintop Feb 21, 2022
43bee1e
minor
0xmountaintop Feb 21, 2022
191c86f
minor
0xmountaintop Feb 21, 2022
5250724
minor
0xmountaintop Feb 21, 2022
bb21899
minor
0xmountaintop Feb 21, 2022
c14aa07
minor
0xmountaintop Feb 22, 2022
69a97a0
minor
0xmountaintop Feb 22, 2022
d0c03a0
update
0xmountaintop Feb 22, 2022
be6fe59
fix
0xmountaintop Feb 22, 2022
d4de9bd
cargo fmt
0xmountaintop Feb 22, 2022
bf79194
cargo clippy
0xmountaintop Feb 22, 2022
f8c7887
update
0xmountaintop Feb 23, 2022
350d881
Merge remote-tracking branch 'origin/main' into deal_with_call_context
0xmountaintop Feb 23, 2022
2283e97
fix
0xmountaintop Feb 23, 2022
58b80a0
Merge branch 'main' into re-init
0xmountaintop Feb 24, 2022
6f978b9
merge and fix conflicts
0xmountaintop Feb 25, 2022
d1babf3
Merge branch 'main' into re-init
0xmountaintop Feb 27, 2022
ecaac3d
merge and fix conflicts
0xmountaintop Feb 27, 2022
3d44162
update eth-types/src/evm_types.rs
0xmountaintop Feb 27, 2022
29f0ff9
update zkevm-circuits/src/evm_circuit/execution.rs
0xmountaintop Feb 27, 2022
a6de489
update zkevm-circuits/src/evm_circuit/execution/storage.rs
0xmountaintop Feb 27, 2022
652da71
update zkevm-circuits/src/evm_circuit/witness.rs
0xmountaintop Feb 27, 2022
71b3874
update zkevm-circuits/src/evm_circuit/util/constraint_builder.rs
0xmountaintop Feb 27, 2022
2837d40
update zkevm-circuits/src/evm_circuit/execution/storage/sstore.rs
0xmountaintop Feb 27, 2022
501c868
update
0xmountaintop Feb 27, 2022
4b1edea
fix zkevm-circuits/src/evm_circuit/witness.rs
0xmountaintop Feb 27, 2022
5c00a90
implement gas (#108)
0xmountaintop Feb 27, 2022
7eb8525
minor
0xmountaintop Feb 27, 2022
9f627db
update test cases
0xmountaintop Feb 28, 2022
9a083dc
merge
0xmountaintop Mar 9, 2022
43d2201
cargo fmt
0xmountaintop Mar 9, 2022
936e1e4
use cell
0xmountaintop Mar 9, 2022
92b90f0
fix
0xmountaintop Mar 9, 2022
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
10 changes: 10 additions & 0 deletions eth-types/src/evm_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,16 @@ impl GasCost {
pub const COLD_ACCOUNT_ACCESS_COST: Self = Self(2600);
/// Constant cost for a warm storage read
pub const WARM_STORAGE_READ_COST: Self = Self(100);

/// Constant cost for a warm storage read XXXXXX
pub const SLOAD_GAS: Self = Self(100);
/// Constant cost for a warm storage read XXXXXX
pub const SSTORE_SET_GAS: Self = Self(20000);
/// Constant cost for a warm storage read XXXXXX
pub const SSTORE_RESET_GAS: Self = Self(2900);
/// Constant cost for a warm storage read XXXXXX
pub const SSTORE_CLEARS_SCHEDULE: Self = Self(15000);

/// Constant cost for a non-creation transaction
pub const TX: Self = Self(21000);
/// Constant cost for creation transaction
Expand Down
5 changes: 5 additions & 0 deletions zkevm-circuits/src/evm_circuit/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ mod selfbalance;
mod signed_comparator;
mod signextend;
mod sload;
mod sstore;
mod stop;
mod swap;
mod timestamp;
Expand Down Expand Up @@ -75,6 +76,7 @@ use selfbalance::SelfbalanceGadget;
use signed_comparator::SignedComparatorGadget;
use signextend::SignextendGadget;
use sload::SloadGadget;
use sstore::SstoreGadget;
use stop::StopGadget;
use swap::SwapGadget;
use timestamp::TimestampGadget;
Expand Down Expand Up @@ -133,6 +135,7 @@ pub(crate) struct ExecutionConfig<F> {
timestamp_gadget: TimestampGadget<F>,
selfbalance_gadget: SelfbalanceGadget<F>,
sload_gadget: SloadGadget<F>,
sstore_gadget: SstoreGadget<F>,
}

impl<F: Field> ExecutionConfig<F> {
Expand Down Expand Up @@ -268,6 +271,7 @@ impl<F: Field> ExecutionConfig<F> {
coinbase_gadget: configure_gadget!(),
timestamp_gadget: configure_gadget!(),
sload_gadget: configure_gadget!(),
sstore_gadget: configure_gadget!(),
step: step_curr,
presets_map,
};
Expand Down Expand Up @@ -524,6 +528,7 @@ impl<F: Field> ExecutionConfig<F> {
}
ExecutionState::SELFBALANCE => assign_exec_step!(self.selfbalance_gadget),
ExecutionState::SLOAD => assign_exec_step!(self.sload_gadget),
ExecutionState::SSTORE => assign_exec_step!(self.sstore_gadget),
ExecutionState::CALLDATACOPY => {
assign_exec_step!(self.calldatacopy_gadget)
}
Expand Down
Loading