Skip to content
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
1 change: 1 addition & 0 deletions Cargo.lock

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

4 changes: 4 additions & 0 deletions crates/scroll/consensus/src/constants.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
use alloy_primitives::U256;

/// The maximum value Rollup fee.
pub const MAX_ROLLUP_FEE: U256 = U256::from_limbs([u64::MAX, 0, 0, 0]);
4 changes: 3 additions & 1 deletion crates/scroll/consensus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

extern crate alloc;

mod constants;
pub use constants::MAX_ROLLUP_FEE;

mod error;
pub use error::ScrollConsensusError;

mod validation;

pub use validation::ScrollBeaconConsensus;
1 change: 1 addition & 0 deletions crates/scroll/txpool/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ reth-transaction-pool.workspace = true
revm-scroll.workspace = true

# reth-scroll
reth-scroll-consensus.workspace = true
reth-scroll-evm.workspace = true
reth-scroll-forks.workspace = true
reth-scroll-primitives.workspace = true
Expand Down
9 changes: 9 additions & 0 deletions crates/scroll/txpool/src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use reth_primitives_traits::{
transaction::error::InvalidTransactionError, Block, GotExpected, SealedBlock,
};
use reth_revm::database::StateProviderDatabase;
use reth_scroll_consensus::MAX_ROLLUP_FEE;
use reth_scroll_evm::{
compute_compression_ratio, spec_id_at_timestamp_and_number, RethL1BlockInfo,
};
Expand Down Expand Up @@ -181,6 +182,14 @@ where
return TransactionValidationOutcome::Error(*valid_tx.hash(), Box::new(err))
}
};
// Check rollup fee is under u64::MAX.
if cost_addition >= MAX_ROLLUP_FEE {
return TransactionValidationOutcome::Invalid(
valid_tx.into_transaction(),
InvalidTransactionError::GasUintOverflow.into(),
)
}

let cost = valid_tx.transaction().cost().saturating_add(cost_addition);

// Checks for max cost
Expand Down
Loading