Skip to content

Commit

Permalink
Merge pull request #71 from bnb-chain/develop
Browse files Browse the repository at this point in the history
Prepare for release v1.0.2
  • Loading branch information
unclezoro authored Sep 6, 2024
2 parents 0ba000f + dc4cc14 commit 7922c22
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 12 deletions.
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 @@ -485,14 +485,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 => Self::CANCUN,
#[cfg(all(feature = "optimism", feature = "opbnb"))]
ECOTONE => 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 => Self::HABER,
#[cfg(feature = "bsc")]
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 @@ -149,7 +149,7 @@ pub fn last_frame_return<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

0 comments on commit 7922c22

Please sign in to comment.