feat: adding cli --rpc.txfeecap flag (#15654)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
rrrengineer
2025-04-15 11:30:12 -07:00
committed by GitHub
parent a21769686c
commit 4850bd5ebc
10 changed files with 226 additions and 3 deletions

View File

@@ -685,6 +685,15 @@ pub enum RpcPoolError {
/// When the transaction exceeds the block gas limit
#[error("exceeds block gas limit")]
ExceedsGasLimit,
/// Thrown when a new transaction is added to the pool, but then immediately discarded to
/// respect the tx fee exceeds the configured cap
#[error("tx fee ({max_tx_fee_wei} wei) exceeds the configured cap ({tx_fee_cap_wei} wei)")]
ExceedsFeeCap {
/// max fee in wei of new tx submitted to the pull (e.g. 0.11534 ETH)
max_tx_fee_wei: u128,
/// configured tx fee cap in wei (e.g. 1.0 ETH)
tx_fee_cap_wei: u128,
},
/// When a negative value is encountered
#[error("negative value")]
NegativeValue,
@@ -750,6 +759,9 @@ impl From<InvalidPoolTransactionError> for RpcPoolError {
match err {
InvalidPoolTransactionError::Consensus(err) => Self::Invalid(err.into()),
InvalidPoolTransactionError::ExceedsGasLimit(_, _) => Self::ExceedsGasLimit,
InvalidPoolTransactionError::ExceedsFeeCap { max_tx_fee_wei, tx_fee_cap_wei } => {
Self::ExceedsFeeCap { max_tx_fee_wei, tx_fee_cap_wei }
}
InvalidPoolTransactionError::ExceedsMaxInitCodeSize(_, _) => {
Self::ExceedsMaxInitCodeSize
}

View File

@@ -54,6 +54,9 @@ pub const DEFAULT_MAX_SIMULATE_BLOCKS: u64 = 256;
/// The default eth historical proof window.
pub const DEFAULT_ETH_PROOF_WINDOW: u64 = 0;
/// The default eth tx fee cap is 1 ETH
pub const DEFAULT_TX_FEE_CAP_WEI: u128 = 1_000_000_000_000_000_000u128;
/// Maximum eth historical proof window. Equivalent to roughly 6 months of data on a 12
/// second block time, and a month on a 2 second block time.
pub const MAX_ETH_PROOF_WINDOW: u64 = 28 * 24 * 60 * 60 / 2;