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

merge develop branch to merge-v14.0.0 #73

Merged
merged 3 commits into from
Sep 13, 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
3 changes: 1 addition & 2 deletions crates/interpreter/src/function_stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,8 @@ impl FunctionStack {

/// Pops a frame from the stack and sets current_code_idx to the popped frame's idx.
pub fn pop(&mut self) -> Option<FunctionReturnFrame> {
self.return_stack.pop().map(|frame| {
self.return_stack.pop().inspect(|frame| {
self.current_code_idx = frame.idx;
frame
})
}

Expand Down
8 changes: 4 additions & 4 deletions crates/precompile/src/bls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ fn bls_signature_validation_run(input: &Bytes, gas_limit: u64) -> PrecompileResu
if (pub_keys.len() == 1 && !bls::verify(&pub_keys[0], msg_hash, signature, &BLS_DST.to_vec()))
|| !bls::aggregate_verify(pub_keys, msg_hashes, signature, &BLS_DST.to_vec())
{
output = Bytes::from(vec![0]);
output = Bytes::from(vec![]);
}

Ok(PrecompileOutput::new(cost, output))
Expand Down Expand Up @@ -118,7 +118,7 @@ mod tests {
input.extend_from_slice(&signature);
input.extend_from_slice(&pub_key);

let excepted_output = Bytes::from(vec![0]);
let excepted_output = Bytes::from(vec![]);
let result = match bls_signature_validation_run(&Bytes::from(input.clone()), 100_000_000) {
Ok(o) => o.bytes,
Err(e) => panic!("BLS signature validation failed, {:?}", e),
Expand Down Expand Up @@ -187,7 +187,7 @@ mod tests {
input.extend_from_slice(&pub_key1);
input.extend_from_slice(&pub_key2);
input.extend_from_slice(&pub_key3);
let excepted_output = Bytes::from(vec![0]);
let excepted_output = Bytes::from(vec![]);
let result = match bls_signature_validation_run(&Bytes::from(input.clone()), 100_000_000) {
Ok(o) => o.bytes,
Err(e) => panic!("BLS signature validation failed, {:?}", e),
Expand Down Expand Up @@ -242,7 +242,7 @@ mod tests {
input.extend_from_slice(&pub_key1);
input.extend_from_slice(&pub_key2);
input.extend_from_slice(&pub_key3);
let excepted_output = Bytes::from(vec![0]);
let excepted_output = Bytes::from(vec![]);
let result = match bls_signature_validation_run(&Bytes::from(input.clone()), 100_000_000) {
Ok(o) => o.bytes,
Err(e) => panic!("BLS signature validation failed, {:?}", e),
Expand Down
6 changes: 5 additions & 1 deletion crates/precompile/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -486,14 +486,18 @@ impl PrecompileSpecId {
PRAGUE | PRAGUE_EOF => Self::PRAGUE,
#[cfg(feature = "optimism")]
BEDROCK | REGOLITH | CANYON => Self::BERLIN,
#[cfg(feature = "optimism")]
#[cfg(all(feature = "optimism", not(feature = "opbnb")))]
ECOTONE | FJORD | GRANITE => Self::CANCUN,
#[cfg(all(feature = "optimism", feature = "opbnb"))]
ECOTONE | GRANITE => Self::CANCUN,
#[cfg(feature = "opbnb")]
FERMAT => Self::FERMAT,
#[cfg(any(feature = "bsc", feature = "opbnb"))]
HABER => Self::HABER,
#[cfg(feature = "opbnb")]
WRIGHT => Self::HABER,
#[cfg(all(feature = "optimism", feature = "opbnb"))]
FJORD => Self::HABER,
#[cfg(feature = "bsc")]
HABER_FIX | BOHR => Self::HABER,
LATEST => Self::LATEST,
Expand Down
6 changes: 2 additions & 4 deletions crates/revm/src/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,8 @@ impl<EXT, DB: Database> Evm<'_, EXT, DB> {
.handler
.validation()
.initial_tx_gas(&self.context.evm.env)
.map_err(|e| {
.inspect_err(|_| {
self.clear();
e
})?;
let output = self.transact_preverified_inner(initial_gas_spend);
let output = self.handler.post_execution().end(&mut self.context, output);
Expand All @@ -228,9 +227,8 @@ impl<EXT, DB: Database> Evm<'_, EXT, DB> {
/// This function will validate the transaction.
#[inline]
pub fn transact(&mut self) -> EVMResult<DB::Error> {
let initial_gas_spend = self.preverify_transaction_inner().map_err(|e| {
let initial_gas_spend = self.preverify_transaction_inner().inspect_err(|_| {
self.clear();
e
})?;

let output = self.transact_preverified_inner(initial_gas_spend);
Expand Down
2 changes: 1 addition & 1 deletion crates/revm/src/optimism/handler_register.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ pub fn refund<SPEC: Spec, EXT, DB: Database>(
pub fn load_precompiles<SPEC: Spec, EXT, DB: Database>() -> ContextPrecompiles<DB> {
let mut precompiles = ContextPrecompiles::new(PrecompileSpecId::from_spec_id(SPEC::SPEC_ID));

if SPEC::enabled(SpecId::FJORD) {
if SPEC::enabled(SpecId::FJORD) || SPEC::enabled(SpecId::HABER) {
precompiles.extend([
// EIP-7212: secp256r1 P256verify
secp256r1::P256VERIFY,
Expand Down