Skip to content

Commit

Permalink
chore: add kzg-rs feature to revm-interpreter
Browse files Browse the repository at this point in the history
  • Loading branch information
0xWOLAND committed Jul 8, 2024
1 parent ac5f264 commit 51a9fca
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 11 deletions.
2 changes: 2 additions & 0 deletions crates/interpreter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,5 @@ optional_eip3607 = ["revm-primitives/optional_eip3607"]
optional_gas_refund = ["revm-primitives/optional_gas_refund"]
optional_no_base_fee = ["revm-primitives/optional_no_base_fee"]
optional_beneficiary_reward = ["revm-primitives/optional_beneficiary_reward"]

kzg-rs = ["revm-primitives/kzg-rs"]
4 changes: 2 additions & 2 deletions crates/precompile/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ p256 = { version = "0.13.2", optional = true, default-features = false, features
"ecdsa",
] }

# Utility
cfg-if = "1"
# utils
cfg-if = { version = "1.0", default-features = false }

[dev-dependencies]
criterion = "0.5"
Expand Down
11 changes: 5 additions & 6 deletions crates/precompile/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,16 @@ pub use fatal_precompile::fatal_precompile;
#[cfg(feature = "kzg-rs")]
// silence lint
use kzg_rs as _;

use core::hash::Hash;
use once_cell::race::OnceBox;
#[doc(hidden)]
pub use revm_primitives as primitives;
pub use revm_primitives::{
pub use primitives::{
precompile::{PrecompileError as Error, *},
Address, Bytes, HashMap, HashSet, Log, B256,
};
#[doc(hidden)]
pub use revm_primitives as primitives;

use cfg_if::cfg_if;
use core::hash::Hash;
use once_cell::race::OnceBox;
use std::{boxed::Box, vec::Vec};

pub fn calc_linear_cost_u32(len: usize, base: u64, word: u64) -> u64 {
Expand Down
2 changes: 1 addition & 1 deletion crates/primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ serde = { version = "1.0", default-features = false, features = [
hex = { version = "0.4", default-features = false }

[features]
default = ["std", "kzg-rs"]
default = ["std", "c-kzg", "portable"]
std = [
"serde?/std",
"alloy-eips/std",
Expand Down
3 changes: 1 addition & 2 deletions crates/primitives/src/kzg/env_settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ use super::{
trusted_setup_points::{G1_POINTS, G2_POINTS},
KzgSettings,
};
use core::hash::Hash;
use once_cell::race::OnceBox;
use std::{boxed::Box, sync::Arc};

cfg_if::cfg_if! {
if #[cfg(feature = "c-kzg")] {
/// KZG Settings that allow us to specify a custom trusted setup.
/// or use hardcoded default settings.
#[derive(Debug, Clone, Default, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Default, PartialEq, Eq )]
pub enum EnvKzgSettings {
/// Default mainnet trusted setup
#[default]
Expand Down
1 change: 1 addition & 0 deletions crates/revm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ optional_beneficiary_reward = ["revm-interpreter/optional_beneficiary_reward"]
# See comments in `revm-precompile`
secp256k1 = ["revm-precompile/secp256k1"]
c-kzg = ["revm-precompile/c-kzg"]
kzg-rs = ["revm-precompile/kzg-rs"]
blst = ["revm-precompile/blst"]

[[example]]
Expand Down

0 comments on commit 51a9fca

Please sign in to comment.