Skip to content

Commit

Permalink
fix: removed unneccesary global mark
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhAnGeek committed Nov 12, 2024
1 parent b8d59fa commit 37ee2e8
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 21 deletions.
4 changes: 2 additions & 2 deletions crates/precompile/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ cometbft-light-client = { git = "https://github.com/bnb-chain/greenfield-cometb
prost = { version = "0.12.6" }
bls_on_arkworks = "0.3.0"
tendermint = { git = "https://github.com/bnb-chain/tendermint-rs-parlia", rev = "8c21ccbd58a174e07eed2c9343e63ccd00f0fbd5", optional = true, features = ["secp256k1"] }
parity-bytes = { version = "0.1.2", default-features = false }
parity-bytes = { version = "0.1.2", default-features = false, optional = true }

# SHA2-256 and RIPEMD-160
sha2 = { version = "0.10", default-features = false }
Expand Down Expand Up @@ -99,7 +99,7 @@ std = [
hashbrown = ["revm-primitives/hashbrown"]
asm-keccak = ["revm-primitives/asm-keccak"]

bsc = ["revm-primitives/bsc", "secp256k1", "secp256r1", "tendermint"]
bsc = ["revm-primitives/bsc", "secp256k1", "secp256r1", "tendermint", "parity-bytes"]

optimism = ["revm-primitives/optimism", "secp256r1"]
# Optimism default handler enabled Optimism handler register by default in EvmBuilder.
Expand Down
54 changes: 35 additions & 19 deletions crates/precompile/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
//! Implementations of EVM precompiled contracts.
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
#![cfg_attr(not(feature = "std"), no_std)]
#![allow(unused_mut)]
#![allow(unused_crate_dependencies)]

#[macro_use]
#[cfg(not(feature = "std"))]
Expand Down Expand Up @@ -185,12 +183,17 @@ impl Precompiles {
pub fn nano() -> &'static Self {
static INSTANCE: OnceBox<Precompiles> = OnceBox::new();
INSTANCE.get_or_init(|| {
let mut precompiles = Self::istanbul().clone();
let precompiles = Self::istanbul().clone();

#[cfg(feature = "bsc")]
precompiles.extend([
tendermint::TENDERMINT_HEADER_VALIDATION_NANO,
iavl::IAVL_PROOF_VALIDATION_NANO,
]);
let precompiles = {
let mut precompiles = precompiles;
precompiles.extend([
tendermint::TENDERMINT_HEADER_VALIDATION_NANO,
iavl::IAVL_PROOF_VALIDATION_NANO,
]);
precompiles
};

Box::new(precompiles)
})
Expand All @@ -200,12 +203,17 @@ impl Precompiles {
pub fn moran() -> &'static Self {
static INSTANCE: OnceBox<Precompiles> = OnceBox::new();
INSTANCE.get_or_init(|| {
let mut precompiles = Self::istanbul().clone();
let precompiles = Self::istanbul().clone();
#[cfg(feature = "bsc")]
precompiles.extend([
tendermint::TENDERMINT_HEADER_VALIDATION,
iavl::IAVL_PROOF_VALIDATION_MORAN,
]);
let precompiles = {
let mut precompiles = precompiles;
precompiles.extend([
tendermint::TENDERMINT_HEADER_VALIDATION,
iavl::IAVL_PROOF_VALIDATION_MORAN,
]);
precompiles
};


Box::new(precompiles)
})
Expand All @@ -215,12 +223,16 @@ impl Precompiles {
pub fn planck() -> &'static Self {
static INSTANCE: OnceBox<Precompiles> = OnceBox::new();
INSTANCE.get_or_init(|| {
let mut precompiles = Self::istanbul().clone();
let precompiles = Self::istanbul().clone();
#[cfg(feature = "bsc")]
precompiles.extend([
tendermint::TENDERMINT_HEADER_VALIDATION,
iavl::IAVL_PROOF_VALIDATION_PLANCK,
]);
let precompiles = {
let mut precompiles = precompiles;
precompiles.extend([
tendermint::TENDERMINT_HEADER_VALIDATION,
iavl::IAVL_PROOF_VALIDATION_PLANCK,
]);
precompiles
};

Box::new(precompiles)
})
Expand All @@ -244,9 +256,13 @@ impl Precompiles {
pub fn plato() -> &'static Self {
static INSTANCE: OnceBox<Precompiles> = OnceBox::new();
INSTANCE.get_or_init(|| {
let mut precompiles = Self::luban().clone();
let precompiles = Self::luban().clone();
#[cfg(feature = "bsc")]
precompiles.extend([iavl::IAVL_PROOF_VALIDATION_PLATO]);
let precompiles = {
let mut precompiles = precompiles;
precompiles.extend([iavl::IAVL_PROOF_VALIDATION_PLATO]);
precompiles
};

Box::new(precompiles)
})
Expand Down

0 comments on commit 37ee2e8

Please sign in to comment.