Skip to content

Commit

Permalink
fix witness generation
Browse files Browse the repository at this point in the history
  • Loading branch information
Mason Liang committed Apr 25, 2024
1 parent 8a80e02 commit 8b95ad3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
4 changes: 2 additions & 2 deletions eth-types/src/evm_types/opcode_ids.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1240,8 +1240,8 @@ impl FromStr for OpcodeId {
"BASEFEE" => OpcodeId::BASEFEE,
"BLOBHASH" => OpcodeId::INVALID(0x49),
"BLOBBASEFEE" => OpcodeId::INVALID(0x4a),
"TLOAD" => OpcodeId::INVALID(0x5c),
"TSTORE" => OpcodeId::INVALID(0x5d),
"TLOAD" => OpcodeId::TLOAD,
"TSTORE" => OpcodeId::TSTORE,
"MCOPY" => OpcodeId::INVALID(0x5e),
_ => {
// Parse an invalid opcode value as reported by geth
Expand Down
16 changes: 16 additions & 0 deletions zkevm-circuits/src/witness/rw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -933,6 +933,22 @@ impl From<&operation::OperationContainer> for RwMap {
})
.collect(),
);
rws.insert(
RwTableTag::TransientStorage,
container
.transient_storage
.iter()
.map(|op| Rw::AccountTransientStorage {
rw_counter: op.rwc().into(),
is_write: op.rw().is_write(),
account_address: op.op().address,
storage_key: op.op().key,
value: op.op().value,
value_prev: op.op().value_prev,
tx_id: op.op().tx_id,
})
.collect(),
);
rws.insert(
RwTableTag::CallContext,
container
Expand Down
2 changes: 2 additions & 0 deletions zkevm-circuits/src/witness/step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ impl From<&circuit_input_builder::ExecStep> for ExecutionState {
OpcodeId::SHL | OpcodeId::SHR => ExecutionState::SHL_SHR,
OpcodeId::SLOAD => ExecutionState::SLOAD,
OpcodeId::SSTORE => ExecutionState::SSTORE,
OpcodeId::TLOAD => ExecutionState::TLOAD,
OpcodeId::TSTORE => ExecutionState::TSTORE,
OpcodeId::CALLDATASIZE => ExecutionState::CALLDATASIZE,
OpcodeId::CALLDATACOPY => ExecutionState::CALLDATACOPY,
OpcodeId::CHAINID => ExecutionState::CHAINID,
Expand Down

0 comments on commit 8b95ad3

Please sign in to comment.