Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: group handlers #1030

Merged
merged 6 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 8 additions & 4 deletions crates/revm/src/inspector/handler_register.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,44 +308,48 @@ mod tests {

fn call(
&mut self,
_context: &mut EvmContext<DB>,
context: &mut EvmContext<DB>,
_call: &mut CallInputs,
_return_memory_offset: Range<usize>,
) -> Option<CallOutcome> {
if self.call {
unreachable!("call should not be called twice")
}
self.call = true;
assert_eq!(context.journaled_state.depth(), 0);
None
}

fn call_end(
&mut self,
_context: &mut EvmContext<DB>,
context: &mut EvmContext<DB>,
_inputs: &CallInputs,
outcome: CallOutcome,
) -> CallOutcome {
if self.call_end {
unreachable!("call_end should not be called twice")
}
assert_eq!(context.journaled_state.depth(), 0);
self.call_end = true;
outcome
}

fn create(
&mut self,
_context: &mut EvmContext<DB>,
context: &mut EvmContext<DB>,
_call: &mut CreateInputs,
) -> Option<CreateOutcome> {
assert_eq!(context.journaled_state.depth(), 0);
None
}

fn create_end(
&mut self,
_context: &mut EvmContext<DB>,
context: &mut EvmContext<DB>,
_inputs: &CreateInputs,
outcome: CreateOutcome,
) -> CreateOutcome {
assert_eq!(context.journaled_state.depth(), 0);
outcome
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/revm/src/optimism/handler_register.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ pub fn optimism_handle_register<DB: Database, EXT>(handler: &mut EvmHandler<'_,
spec_to_generic!(handler.spec_id, {
// load l1 data
handler.pre_execution.load_accounts = Arc::new(load_accounts::<SPEC, EXT, DB>);
// Refund is calculated differently then mainnet.
handler.execution.last_frame_return = Arc::new(last_frame_return::<SPEC, EXT, DB>);
// An estimated batch cost is charged from the caller and added to L1 Fee Vault.
handler.pre_execution.deduct_caller = Arc::new(deduct_caller::<SPEC, EXT, DB>);
// Refund is calculated differently then mainnet.
handler.execution.last_frame_return = Arc::new(last_frame_return::<SPEC, EXT, DB>);
handler.post_execution.reward_beneficiary = Arc::new(reward_beneficiary::<SPEC, EXT, DB>);
// In case of halt of deposit transaction return Error.
handler.post_execution.output = Arc::new(output::<SPEC, EXT, DB>);
Expand Down
Loading