Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
229 changes: 120 additions & 109 deletions Cargo.lock

Large diffs are not rendered by default.

20 changes: 1 addition & 19 deletions crates/interpreter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,14 @@ readme = "../../README.md"
[dependencies]
revm-primitives = { path = "../primitives", version = "1.1.2", default-features = false }

#utility
derive_more = "0.99"
enumn = "0.1"

# optional
serde = { version = "1.0", features = ["derive", "rc"], optional = true }
arbitrary = { version = "1.3", features = ["derive"], optional = true }
proptest = { version = "1.1", optional = true }
proptest-derive = { version = "0.4", optional = true }

[dev-dependencies]
arbitrary = { version = "1.3", features = ["derive"] }
proptest = "1.1"
proptest-derive = "0.4"

[features]
default = ["std"]
std = ["revm-primitives/std"]
serde = ["dep:serde", "revm-primitives/serde"]
arbitrary = [
"std",
"dep:arbitrary",
"dep:proptest",
"dep:proptest-derive",
"revm-primitives/arbitrary",
]
arbitrary = ["std", "revm-primitives/arbitrary"]

dev = [
"memory_limit",
Expand Down
1 change: 1 addition & 0 deletions crates/interpreter/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![warn(unused_crate_dependencies)]

extern crate alloc;

Expand Down
27 changes: 16 additions & 11 deletions crates/precompile/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,37 +14,42 @@ exclude = ["build.rs", "src/blob/kzg_settings/*.txt"]
[dependencies]
revm-primitives = { path = "../primitives", version = "1.1.2", default-features = false }
bn = { package = "substrate-bn", version = "0.6", default-features = false }
k256 = { version = "0.13", default-features = false, features = ["ecdsa"] }
num = { version = "0.4.0", default-features = false, features = ["alloc"] }
once_cell = { version = "1.17", default-features = false, features = ["alloc"] }
ripemd = { version = "0.1", default-features = false }
sha2 = { version = "0.10", default-features = false }

# Optional KZG precompile
c-kzg = { git = "https://github.com/ethereum/c-kzg-4844", default-features = false, optional = true }

# Either one enable the ``
k256 = { version = "0.13", default-features = false, features = [
"ecdsa",
], optional = true }
secp256k1 = { version = "0.27.0", default-features = false, features = [
"alloc",
"recovery",
], optional = true }
sha2 = { version = "0.10.5", default-features = false }
sha3 = { version = "0.10.7", default-features = false }
c-kzg = { git = "https://github.com/ethereum/c-kzg-4844", default-features = false, optional = true }

[features]
default = ["std", "c-kzg", "secp256k1"]
std = [
"revm-primitives/std",
"k256/std",
"num/std",
"once_cell/std",
"ripemd/std",
"sha2/std",
"sha3/std",
"c-kzg?/std",
"k256?/std",
"secp256k1?/std",
]

# The following features may not work on all platforms as they depend on C libraries.
# Enables the KZG point evaluation precompile.
# * Enables the KZG point evaluation precompile.
c-kzg = ["dep:c-kzg", "revm-primitives/c-kzg"]

# 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.
# Either enables the ecRecover precompile
k256 = ["dep:k256"]
Comment thread
DaniPopes marked this conversation as resolved.
Outdated
# * `secp256k1` as a faster alternative to `k256`.
Comment thread
DaniPopes marked this conversation as resolved.
secp256k1 = ["dep:secp256k1"]

# * = This library may not work on all platforms as it depends on C libraries.
1 change: 1 addition & 0 deletions crates/precompile/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![no_std]
#![warn(unused_crate_dependencies)]

#[macro_use]
extern crate alloc;
Expand Down
16 changes: 15 additions & 1 deletion crates/precompile/src/secp256k1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pub const ECRECOVER: PrecompileAddress = PrecompileAddress(
Precompile::Standard(ec_recover_run as StandardPrecompileFn),
);

#[cfg(not(feature = "secp256k1"))]
#[cfg(all(not(feature = "secp256k1"), feature = "k256"))]
#[allow(clippy::module_inception)]
mod secp256k1 {
use crate::B256;
Expand Down Expand Up @@ -44,6 +44,10 @@ mod secp256k1 {
Message, Secp256k1,
};

// In case that both features are enabled we prefer `secp256k1`, so silence the unused warning.
#[cfg(feature = "k256")]
use k256 as _;

pub fn ecrecover(sig: &[u8; 65], msg: &B256) -> Result<B256, secp256k1::Error> {
let sig =
RecoverableSignature::from_compact(&sig[0..64], RecoveryId::from_i32(sig[64] as i32)?)?;
Expand All @@ -57,6 +61,16 @@ mod secp256k1 {
}
}

#[cfg(not(any(feature = "k256", feature = "secp256k1")))]
mod secp256k1 {
use crate::B256;

#[deprecated = "warning: no `ecRecover` backend is enabled"]
pub fn ecrecover(_sig: &[u8; 65], _msg: &B256) -> Result<B256, ()> {
unimplemented!("no `ecRecover` backend is enabled")
}
}
Comment thread
DaniPopes marked this conversation as resolved.
Outdated

fn ec_recover_run(i: &[u8], target_gas: u64) -> PrecompileResult {
use alloc::vec::Vec;
use core::cmp::min;
Expand Down
37 changes: 5 additions & 32 deletions crates/primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@ readme = "../../README.md"

[dependencies]
alloy-primitives = { version = "0.3", default-features = false, features = [
"rlp"
"rlp",
] }
alloy-rlp = { version = "0.3", default-features = false, features = ["derive"] }
bytes = { version = "1.5", default-features = false }
hashbrown = "0.14"
primitive-types = { version = "0.12", default-features = false }
auto_impl = "1.1"
bitvec = { version = "1", default-features = false, features = ["alloc"] }
bitflags = { version = "2.4.0", default-features = false }
Expand All @@ -25,53 +23,28 @@ bitflags = { version = "2.4.0", default-features = false }
c-kzg = { git = "https://github.com/ethereum/c-kzg-4844", default-features = false, optional = true }

# utility
derive_more = "0.99"
enumn = "0.1"
once_cell = { version = "1.18", default-features = false }
once_cell = { version = "1.18", default-features = false, optional = true }

# optional
serde = { version = "1.0", features = ["derive", "rc"], optional = true }
arbitrary = { version = "1.3", features = ["derive"], optional = true }
proptest = { version = "1.1", optional = true }
proptest-derive = { version = "0.4", optional = true }

[dev-dependencies]
arbitrary = { version = "1.3", features = ["derive"] }
proptest = "1.1"
proptest-derive = "0.4"
ruint = { version = "1.10.1", features = [
"primitive-types",
"rlp",
"proptest",
"arbitrary",
] }

[build-dependencies]
hex = "0.4"

[features]
default = ["std", "c-kzg"]
std = ["bytes/std", "alloy-rlp/std", "hex/std", "bitvec/std", "bitflags/std"]
std = ["alloy-rlp/std", "hex/std", "bitvec/std", "bitflags/std"]
serde = [
"dep:serde",
"alloy-primitives/serde",
"hex/serde",
"hashbrown/serde",
"ruint/serde",
"bytes/serde",
"bitvec/serde",
"bitflags/serde",
"c-kzg?/serde",
]
arbitrary = [
"std",
"ruint/arbitrary",
"ruint/proptest",
"dep:arbitrary",
"dep:proptest",
"dep:proptest-derive",
"bitflags/arbitrary",
]
arbitrary = ["std", "alloy-primitives/arbitrary", "bitflags/arbitrary"]

dev = [
"memory_limit",
Expand All @@ -90,4 +63,4 @@ optional_gas_refund = []
optional_no_base_fee = []

# See comments in `revm-precompile`
c-kzg = ["dep:c-kzg"]
c-kzg = ["dep:c-kzg", "dep:once_cell"]
1 change: 1 addition & 0 deletions crates/primitives/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![warn(unused_crate_dependencies)]

extern crate alloc;

Expand Down
10 changes: 9 additions & 1 deletion crates/revm/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![warn(unreachable_pub)]
#![warn(unused_crate_dependencies, unreachable_pub)]

#[macro_use]
extern crate alloc;

// Actually used in benches and examples
#[cfg(test)]
mod unused {
use anyhow as _;
use criterion as _;
use ethers_contract as _;
}
Comment thread
DaniPopes marked this conversation as resolved.
Outdated

pub mod db;
mod evm;
mod evm_impl;
Expand Down