Skip to content

Commit

Permalink
Refactor create op (scroll-tech#1000)
Browse files Browse the repository at this point in the history
* create_op: fix memory size (scroll-tech#990)

* create: refactor lifetime

* fmt

* add more tests

* update access list in create

* refactor create

* build

* fix

* try

* ci
  • Loading branch information
lispc authored Oct 16, 2023
1 parent 7a42d3c commit 2e06a0f
Show file tree
Hide file tree
Showing 7 changed files with 657 additions and 594 deletions.
19 changes: 19 additions & 0 deletions bus-mapping/src/circuit_input_builder/input_state_ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -920,6 +920,7 @@ impl<'a> CircuitInputStateRef<'a> {
Ok(address)
}

/// read reversion info
pub(crate) fn reversion_info_read(
&mut self,
step: &mut ExecStep,
Expand All @@ -937,6 +938,24 @@ impl<'a> CircuitInputStateRef<'a> {
Ok(())
}

/// write reversion info
pub(crate) fn reversion_info_write(
&mut self,
step: &mut ExecStep,
call: &Call,
) -> Result<(), Error> {
for (field, value) in [
(
CallContextField::RwCounterEndOfReversion,
call.rw_counter_end_of_reversion.to_word(),
),
(CallContextField::IsPersistent, call.is_persistent.to_word()),
] {
self.call_context_write(step, call.call_id, field, value)?;
}
Ok(())
}

/// Check if address is a precompiled or not.
pub fn is_precompiled(&self, address: &Address) -> bool {
address.0[0..19] == [0u8; 19] && (1..=9).contains(&address.0[19])
Expand Down
1 change: 1 addition & 0 deletions bus-mapping/src/evm/opcodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ pub fn gen_associated_ops(
let check_level = if *CHECK_MEM_STRICT { 2 } else { 0 }; // 0: no check, 1: check and log error and fix, 2: check and assert_eq
if check_level >= 1 {
let memory_enabled = !geth_steps.iter().all(|s| s.memory.is_empty());
assert!(memory_enabled);
if memory_enabled {
#[allow(clippy::collapsible_else_if)]
if state.call_ctx()?.memory != geth_steps[0].memory {
Expand Down
Loading

0 comments on commit 2e06a0f

Please sign in to comment.