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 3dff0d3
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 32 deletions.
12 changes: 6 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions crates/precompile/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ secp256k1 = { version = ">=0.28, <=0.29", default-features = false, features = [
"rand",
"global-context",
], optional = true }
cometbft = { git = "https://github.com/bnb-chain/greenfield-cometbft-rs.git", rev = "5582327" }
cometbft-light-client-verifier = { git = "https://github.com/bnb-chain/greenfield-cometbft-rs.git", rev = "5582327" }
cometbft-proto = { git = "https://github.com/bnb-chain/greenfield-cometbft-rs.git", rev = "5582327" }
cometbft-light-client = { git = "https://github.com/bnb-chain/greenfield-cometbft-rs.git", rev = "5582327", default-features = false }
cometbft = { git = "https://github.com/bnb-chain/greenfield-cometbft-rs.git", rev = "ccf58da" }
cometbft-light-client-verifier = { git = "https://github.com/bnb-chain/greenfield-cometbft-rs.git", rev = "ccf58da" }
cometbft-proto = { git = "https://github.com/bnb-chain/greenfield-cometbft-rs.git", rev = "ccf58da" }
cometbft-light-client = { git = "https://github.com/bnb-chain/greenfield-cometbft-rs.git", rev = "ccf58da", default-features = false }
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
55 changes: 36 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,17 @@ 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 +257,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
3 changes: 2 additions & 1 deletion crates/precompile/src/tm_secp256k1.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![allow(unused_imports)]
#![allow(dead_code)]
#![cfg_attr(feature = "bsc", warn(dead_code))]

use crate::{Bytes, Error, Precompile, PrecompileError, PrecompileResult, PrecompileWithAddress};
use revm_primitives::PrecompileOutput;
use secp256k1::{ecdsa, Message, PublicKey};
Expand Down

0 comments on commit 3dff0d3

Please sign in to comment.