forked from privacy-scaling-explorations/zkevm-circuits
-
Notifications
You must be signed in to change notification settings - Fork 391
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'scroll-stable' into goerli-0215
- Loading branch information
Showing
21 changed files
with
276 additions
and
52 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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,43 @@ | ||
use crate::circuit_input_builder::{CircuitInputStateRef, ExecStep}; | ||
use crate::error::ExecError; | ||
use crate::evm::Opcode; | ||
use crate::Error; | ||
use eth_types::evm_types::OpcodeId; | ||
use eth_types::GethExecStep; | ||
|
||
#[derive(Debug, Copy, Clone)] | ||
pub(crate) struct PrecompileFailed; | ||
|
||
impl Opcode for PrecompileFailed { | ||
fn gen_associated_ops( | ||
state: &mut CircuitInputStateRef, | ||
geth_steps: &[GethExecStep], | ||
) -> Result<Vec<ExecStep>, Error> { | ||
let geth_step = &geth_steps[0]; | ||
let stack_input_num = match geth_step.op { | ||
OpcodeId::CALL | OpcodeId::CALLCODE => 7, | ||
OpcodeId::DELEGATECALL | OpcodeId::STATICCALL => 6, | ||
op => unreachable!("{op} should not happen in PrecompileFailed"), | ||
}; | ||
|
||
let mut exec_step = state.new_step(geth_step)?; | ||
exec_step.error = Some(ExecError::PrecompileFailed); | ||
|
||
for i in 0..stack_input_num { | ||
state.stack_read( | ||
&mut exec_step, | ||
geth_step.stack.nth_last_filled(i), | ||
geth_step.stack.nth_last(i)?, | ||
)?; | ||
} | ||
|
||
state.stack_write( | ||
&mut exec_step, | ||
geth_step.stack.nth_last_filled(stack_input_num - 1), | ||
// Must fail. | ||
(0_u64).into(), | ||
)?; | ||
|
||
Ok(vec![exec_step]) | ||
} | ||
} |
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
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
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
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 |
---|---|---|
|
@@ -62,3 +62,4 @@ enable-sign-verify = [] | |
codehash = [] | ||
reject-eip2718 = [] | ||
poseidon-codehash = [] | ||
scroll = [] |
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
Oops, something went wrong.