forked from privacy-scaling-explorations/zkevm-circuits
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bus-mapping: Implement OutOfGas(Constant) (privacy-scaling-exploratio…
- Loading branch information
1 parent
a75c9aa
commit 38b4fd4
Showing
2 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use crate::circuit_input_builder::{CircuitInputStateRef, ExecStep}; | ||
use crate::evm::Opcode; | ||
use crate::Error; | ||
use eth_types::GethExecStep; | ||
|
||
#[derive(Debug, Copy, Clone)] | ||
pub(crate) struct ErrorStackOogConstant; | ||
|
||
impl Opcode for ErrorStackOogConstant { | ||
fn gen_associated_ops( | ||
state: &mut CircuitInputStateRef, | ||
geth_steps: &[GethExecStep], | ||
) -> Result<Vec<ExecStep>, Error> { | ||
let geth_step = &geth_steps[0]; | ||
let mut exec_step = state.new_step(geth_step)?; | ||
let next_step = geth_steps.get(1); | ||
exec_step.error = state.get_step_err(geth_step, next_step).unwrap(); | ||
|
||
// handles all required steps | ||
state.gen_restore_context_ops(&mut exec_step, geth_steps)?; | ||
state.handle_return(geth_step)?; | ||
|
||
Ok(vec![exec_step]) | ||
} | ||
} |