Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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.

3 changes: 3 additions & 0 deletions crates/scroll/chainspec/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ use alloy_primitives::{address, b256, Address, B256};
/// The transaction fee recipient on the L2.
pub const SCROLL_FEE_VAULT_ADDRESS: Address = address!("5300000000000000000000000000000000000005");

/// The maximum size in bytes of the payload for a block.
pub const MAX_TX_PAYLOAD_BYTES_PER_BLOCK: usize = 120 * 1024;

/// The system contract on L2 mainnet.
pub const SCROLL_MAINNET_L2_SYSTEM_CONFIG_CONTRACT_ADDRESS: Address =
address!("331A873a2a85219863d80d248F9e2978fE88D0Ea");
Expand Down
18 changes: 16 additions & 2 deletions crates/scroll/chainspec/src/genesis.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
//! Scroll types for genesis data.

use crate::{
constants::{SCROLL_FEE_VAULT_ADDRESS, SCROLL_MAINNET_L1_CONFIG, SCROLL_SEPOLIA_L1_CONFIG},
constants::{
MAX_TX_PAYLOAD_BYTES_PER_BLOCK, SCROLL_FEE_VAULT_ADDRESS, SCROLL_MAINNET_L1_CONFIG,
SCROLL_SEPOLIA_L1_CONFIG,
},
SCROLL_DEV_L1_CONFIG,
};

use alloy_primitives::Address;
use alloy_serde::OtherFields;
use serde::de::Error;
Expand Down Expand Up @@ -113,6 +117,8 @@ pub struct ScrollChainConfig {
/// This is an optional field that, when set, specifies where L2 transaction fees
/// will be sent or stored.
pub fee_vault_address: Option<Address>,
/// The maximum tx payload size of blocks that we produce.
pub max_tx_payload_bytes_per_block: usize,
/// The L1 configuration.
/// This field encapsulates specific settings and parameters required for L1
pub l1_config: L1Config,
Expand All @@ -129,6 +135,7 @@ impl ScrollChainConfig {
pub const fn mainnet() -> Self {
Self {
fee_vault_address: Some(SCROLL_FEE_VAULT_ADDRESS),
max_tx_payload_bytes_per_block: MAX_TX_PAYLOAD_BYTES_PER_BLOCK,
l1_config: SCROLL_MAINNET_L1_CONFIG,
}
}
Expand All @@ -137,13 +144,18 @@ impl ScrollChainConfig {
pub const fn sepolia() -> Self {
Self {
fee_vault_address: Some(SCROLL_FEE_VAULT_ADDRESS),
max_tx_payload_bytes_per_block: MAX_TX_PAYLOAD_BYTES_PER_BLOCK,
l1_config: SCROLL_SEPOLIA_L1_CONFIG,
}
}

/// Returns the [`ScrollChainConfig`] for Scroll dev.
pub const fn dev() -> Self {
Self { fee_vault_address: Some(SCROLL_FEE_VAULT_ADDRESS), l1_config: SCROLL_DEV_L1_CONFIG }
Self {
fee_vault_address: Some(SCROLL_FEE_VAULT_ADDRESS),
max_tx_payload_bytes_per_block: MAX_TX_PAYLOAD_BYTES_PER_BLOCK,
l1_config: SCROLL_DEV_L1_CONFIG,
}
}
}

Expand Down Expand Up @@ -209,6 +221,7 @@ mod tests {
"feynmanTime": 100,
"scroll": {
"feeVaultAddress": "0x5300000000000000000000000000000000000005",
"maxTxPayloadBytesPerBlock": 122880,
"l1Config": {
"l1ChainId": 1,
"l1MessageQueueAddress": "0x0d7E906BD9cAFa154b048cFa766Cc1E54E39AF9B",
Expand Down Expand Up @@ -237,6 +250,7 @@ mod tests {
}),
scroll_chain_config: ScrollChainConfig {
fee_vault_address: Some(address!("5300000000000000000000000000000000000005")),
max_tx_payload_bytes_per_block: MAX_TX_PAYLOAD_BYTES_PER_BLOCK,
l1_config: L1Config {
l1_chain_id: 1,
l1_message_queue_address: address!("0d7E906BD9cAFa154b048cFa766Cc1E54E39AF9B"),
Expand Down
48 changes: 25 additions & 23 deletions crates/scroll/chainspec/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ extern crate alloc;

mod constants;
pub use constants::{
SCROLL_BASE_FEE_PARAMS_FEYNMAN, SCROLL_DEV_L1_CONFIG, SCROLL_DEV_L1_MESSAGE_QUEUE_ADDRESS,
SCROLL_DEV_L1_MESSAGE_QUEUE_V2_ADDRESS, SCROLL_DEV_L1_PROXY_ADDRESS,
SCROLL_DEV_L2_SYSTEM_CONFIG_CONTRACT_ADDRESS, SCROLL_DEV_MAX_L1_MESSAGES,
SCROLL_EIP1559_BASE_FEE_MAX_CHANGE_DENOMINATOR_FEYNMAN,
MAX_TX_PAYLOAD_BYTES_PER_BLOCK, SCROLL_BASE_FEE_PARAMS_FEYNMAN, SCROLL_DEV_L1_CONFIG,
SCROLL_DEV_L1_MESSAGE_QUEUE_ADDRESS, SCROLL_DEV_L1_MESSAGE_QUEUE_V2_ADDRESS,
SCROLL_DEV_L1_PROXY_ADDRESS, SCROLL_DEV_L2_SYSTEM_CONFIG_CONTRACT_ADDRESS,
SCROLL_DEV_MAX_L1_MESSAGES, SCROLL_EIP1559_BASE_FEE_MAX_CHANGE_DENOMINATOR_FEYNMAN,
SCROLL_EIP1559_DEFAULT_ELASTICITY_MULTIPLIER_FEYNMAN, SCROLL_FEE_VAULT_ADDRESS,
SCROLL_MAINNET_GENESIS_HASH, SCROLL_MAINNET_L1_CONFIG, SCROLL_MAINNET_L1_MESSAGE_QUEUE_ADDRESS,
SCROLL_MAINNET_L1_MESSAGE_QUEUE_V2_ADDRESS, SCROLL_MAINNET_L1_PROXY_ADDRESS,
Expand Down Expand Up @@ -653,26 +653,26 @@ mod tests {
#[test]
fn parse_scroll_hardforks() {
let geth_genesis = r#"
{
"config": {
"bernoulliBlock": 10,
"curieBlock": 20,
"darwinTime": 30,
"darwinV2Time": 31,
"scroll": {
"feeVaultAddress": "0x5300000000000000000000000000000000000005",
"l1Config": {
"l1ChainId": 1,
"l1MessageQueueAddress": "0x0d7E906BD9cAFa154b048cFa766Cc1E54E39AF9B",
"l1MessageQueueV2Address": "0x56971da63A3C0205184FEF096E9ddFc7A8C2D18a",
"l2SystemConfigAddress": "0x331A873a2a85219863d80d248F9e2978fE88D0Ea",
"scrollChainAddress": "0xa13BAF47339d63B743e7Da8741db5456DAc1E556",
"numL1MessagesPerBlock": 10
{
"config": {
"bernoulliBlock": 10,
"curieBlock": 20,
"darwinTime": 30,
"darwinV2Time": 31,
"scroll": {
"feeVaultAddress": "0x5300000000000000000000000000000000000005",
"maxTxPayloadBytesPerBlock": 122880,
"l1Config": {
"l1ChainId": 1,
"l1MessageQueueAddress": "0x0d7E906BD9cAFa154b048cFa766Cc1E54E39AF9B",
"l1MessageQueueV2Address": "0x56971da63A3C0205184FEF096E9ddFc7A8C2D18a",
"l2SystemConfigAddress": "0x331A873a2a85219863d80d248F9e2978fE88D0Ea",
"scrollChainAddress": "0xa13BAF47339d63B743e7Da8741db5456DAc1E556",
"numL1MessagesPerBlock": 10
}
}
}
}
}
}
"#;
}"#;
let genesis: Genesis = serde_json::from_str(geth_genesis).unwrap();

let actual_bernoulli_block = genesis.config.extra_fields.get("bernoulliBlock");
Expand All @@ -688,6 +688,7 @@ mod tests {
scroll_object,
&serde_json::json!({
"feeVaultAddress": "0x5300000000000000000000000000000000000005",
"maxTxPayloadBytesPerBlock": 122880,
"l1Config": {
"l1ChainId": 1,
"l1MessageQueueAddress": "0x0d7E906BD9cAFa154b048cFa766Cc1E54E39AF9B",
Expand Down Expand Up @@ -741,6 +742,7 @@ mod tests {
String::from("scroll"),
serde_json::json!({
"feeVaultAddress": "0x5300000000000000000000000000000000000005",
"maxTxPayloadBytesPerBlock": 122880,
"l1Config": {
"l1ChainId": 1,
"l1MessageQueueAddress": "0x0d7E906BD9cAFa154b048cFa766Cc1E54E39AF9B",
Expand Down
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;
Loading
Loading