Skip to content

Commit

Permalink
feat: optimize dep
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhAnGeek committed Nov 11, 2024
1 parent 4197e85 commit b8d59fa
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion crates/precompile/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ portable = ["revm-primitives/portable", "c-kzg?/portable"]
# Use `secp256k1` as a faster alternative to `k256`.
# The problem that `secp256k1` has is it fails to build for `wasm` target on Windows and Mac as it is c lib.
# In Linux it passes. If you don't require to build wasm on win/mac, it is safe to use it and it is enabled by default.
secp256k1 = ["dep:secp256k1"]
secp256k1 = ["dep:secp256k1", "tendermint"]

# Enables the BLS12-381 precompiles.
blst = ["dep:blst"]
Expand Down
2 changes: 2 additions & 0 deletions crates/precompile/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
//! 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
4 changes: 0 additions & 4 deletions crates/precompile/src/tm_secp256k1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
use crate::{Bytes, Error, Precompile, PrecompileError, PrecompileResult, PrecompileWithAddress};
use revm_primitives::PrecompileOutput;
use secp256k1::{ecdsa, Message, PublicKey};
#[cfg(feature = "bsc")]
use tendermint::{account, public_key};

/// Tendermint SECP256K1 signature recover precompile for BSC.
#[cfg(feature = "bsc")]
pub(crate) const TM_SECP256K1_SIGNATURE_RECOVER: PrecompileWithAddress = PrecompileWithAddress(
crate::u64_to_address(105),
Precompile::Standard(tm_secp256k1_signature_recover_run),
Expand All @@ -24,7 +22,6 @@ const SECP256K1_SIGNATURE_MSGHASH_LENGTH: usize = 32;
/// | PubKey | Signature | SignatureMsgHash |
///
/// | 33 bytes | 64 bytes | 32 bytes |
#[cfg(feature = "bsc")]
fn tm_secp256k1_signature_recover_run(input: &Bytes, gas_limit: u64) -> PrecompileResult {
const TM_SECP256K1_SIGNATURE_RECOVER_BASE: u64 = 3_000;

Expand Down Expand Up @@ -76,7 +73,6 @@ fn tm_secp256k1_signature_recover_run(input: &Bytes, gas_limit: u64) -> Precompi
}

#[cfg(test)]
#[cfg(feature = "bsc")]
mod tests {
use super::*;
use revm_primitives::hex;
Expand Down

0 comments on commit b8d59fa

Please sign in to comment.