Skip to content
This repository has been archived by the owner on Nov 5, 2023. It is now read-only.

Commit

Permalink
Add Optimism EIP1559 elasticity multiplier / max base fee change deno…
Browse files Browse the repository at this point in the history
…minator
  • Loading branch information
clabby committed Mar 19, 2023
1 parent 2e4bdb9 commit ca2a249
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
10 changes: 10 additions & 0 deletions crates/primitives/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,21 @@ pub const SELECTOR_LEN: usize = 4;
pub const EIP1559_INITIAL_BASE_FEE: u64 = 1_000_000_000;

/// Base fee max change denominator as defined in [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559)
#[cfg(not(feature = "optimism"))]
pub const EIP1559_BASE_FEE_MAX_CHANGE_DENOMINATOR: u64 = 8;

/// Elasticity multiplier as defined in [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559)
#[cfg(not(feature = "optimism"))]
pub const EIP1559_ELASTICITY_MULTIPLIER: u64 = 2;

/// Base fee max change denominator for Optimism.
#[cfg(feature = "optimism")]
pub const EIP1559_BASE_FEE_MAX_CHANGE_DENOMINATOR: u64 = 50;

/// Elasticity multiplier for Optimism.
#[cfg(feature = "optimism")]
pub const EIP1559_ELASTICITY_MULTIPLIER: u64 = 10;

/// Multiplier for converting gwei to wei.
pub const GWEI_TO_WEI: u64 = 1_000_000_000;

Expand Down
8 changes: 4 additions & 4 deletions crates/primitives/src/transaction/tx_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub const EIP1559_TX_TYPE_ID: u8 = 2;

/// Identifier for [TxDeposit](crate::TxDeposit) transaction.
#[cfg(feature = "optimism")]
pub(crate) const DEPOSIT_TX_TYPE_ID: u8 = 126;
use crate::DEPOSIT_TX_TYPE;

/// Transaction Type
#[derive_arbitrary(compact)]
Expand All @@ -28,7 +28,7 @@ pub enum TxType {
EIP1559 = 2_isize,
/// OP Deposit transaction.
#[cfg(feature = "optimism")]
DEPOSIT = 126_isize,
DEPOSIT = DEPOSIT_TX_TYPE as isize,
}

impl From<TxType> for u8 {
Expand All @@ -38,7 +38,7 @@ impl From<TxType> for u8 {
TxType::EIP2930 => EIP2930_TX_TYPE_ID,
TxType::EIP1559 => EIP1559_TX_TYPE_ID,
#[cfg(feature = "optimism")]
TxType::DEPOSIT => DEPOSIT_TX_TYPE_ID,
TxType::DEPOSIT => DEPOSIT_TX_TYPE,
}
}
}
Expand All @@ -50,7 +50,7 @@ impl Compact for TxType {
TxType::EIP2930 => EIP2930_TX_TYPE_ID as usize,
TxType::EIP1559 => EIP1559_TX_TYPE_ID as usize,
#[cfg(feature = "optimism")]
TxType::DEPOSIT => DEPOSIT_TX_TYPE_ID as usize,
TxType::DEPOSIT => DEPOSIT_TX_TYPE as usize,
}
}

Expand Down
2 changes: 2 additions & 0 deletions crates/revm/revm-primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ repository = "https://github.com/paradigmxyz/reth"
description = "core reth specific revm utilities"

[dependencies]
# reth
reth-primitives = { path = "../../primitives" }

revm = { version = "3.0.0" }

[features]
Expand Down

0 comments on commit ca2a249

Please sign in to comment.