Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reuse alloy-eips constants #6540

Merged
merged 3 commits into from
Feb 11, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
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
27 changes: 19 additions & 8 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ alloy-dyn-abi = "0.6"
alloy-sol-types = "0.6"
alloy-rlp = "0.3"
alloy-trie = "0.2"
alloy-eips = { git = "https://github.com/alloy-rs/alloy", rev = "098ad56" }
alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "098ad56" }
alloy-rpc-trace-types = { git = "https://github.com/alloy-rs/alloy", rev = "098ad56" }
alloy-rpc-engine-types = { git = "https://github.com/alloy-rs/alloy", rev = "098ad56" }
Expand Down
1 change: 1 addition & 0 deletions crates/primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ alloy-trie = { workspace = true, features = ["serde"] }
ethers-core = { workspace = true, default-features = false, optional = true }
nybbles = { version = "0.1.2", features = ["serde", "rlp"] }
alloy-genesis.workspace = true
alloy-eips.workspace = true
# crypto
secp256k1 = { workspace = true, features = ["global-context", "recovery"] }

Expand Down
30 changes: 1 addition & 29 deletions crates/primitives/src/constants/eip4844.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,7 @@
#[cfg(feature = "c-kzg")]
pub use trusted_setup::*;

/// Size a single field element in bytes.
pub const FIELD_ELEMENT_BYTES: u64 = 32;

/// How many field elements are stored in a single data blob.
pub const FIELD_ELEMENTS_PER_BLOB: u64 = 4096;

/// Gas consumption of a single data blob.
pub const DATA_GAS_PER_BLOB: u64 = 131_072u64; // 32*4096 = 131072 == 2^17 == 0x20000

/// Maximum data gas for data blobs in a single block.
pub const MAX_DATA_GAS_PER_BLOCK: u64 = 786_432u64; // 0xC0000

/// Target data gas for data blobs in a single block.
pub const TARGET_DATA_GAS_PER_BLOCK: u64 = 393_216u64; // 0x60000

/// Maximum number of data blobs in a single block.
pub const MAX_BLOBS_PER_BLOCK: usize = (MAX_DATA_GAS_PER_BLOCK / DATA_GAS_PER_BLOB) as usize; // 786432 / 131072 = 6

/// Target number of data blobs in a single block.
pub const TARGET_BLOBS_PER_BLOCK: u64 = TARGET_DATA_GAS_PER_BLOCK / DATA_GAS_PER_BLOB; // 393216 / 131072 = 3

/// Determines the maximum rate of change for blob fee
pub const BLOB_GASPRICE_UPDATE_FRACTION: u64 = 3_338_477u64; // 3338477

/// Minimum gas price for a data blob
pub const BLOB_TX_MIN_BLOB_GASPRICE: u128 = 1u128;

/// Commitment version of a KZG commitment
pub const VERSIONED_HASH_VERSION_KZG: u8 = 0x01;
pub use alloy_eips::eip4844::*;
Copy link
Collaborator

@mattsse mattsse Feb 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want this to be exhaustive, so we can see directly what we have available. this makes it slightly easier to navigate.

so replace * with all constants


#[cfg(feature = "c-kzg")]
mod trusted_setup {
Expand Down