Skip to content
Open

fix #481

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
254 changes: 127 additions & 127 deletions Cargo.lock

Large diffs are not rendered by default.

98 changes: 49 additions & 49 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -140,59 +140,59 @@ alloy-signer-local = { version = "1.0.37", default-features = false }
alloy-transport = { version = "1.0.37", default-features = false }

# scroll-alloy
scroll-alloy-consensus = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
scroll-alloy-hardforks = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
scroll-alloy-network = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
scroll-alloy-provider = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
scroll-alloy-evm = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
scroll-alloy-rpc-types = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
scroll-alloy-rpc-types-engine = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
scroll-alloy-consensus = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }
scroll-alloy-hardforks = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }
scroll-alloy-network = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }
scroll-alloy-provider = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }
scroll-alloy-evm = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }
scroll-alloy-rpc-types = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }
scroll-alloy-rpc-types-engine = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }

# reth
reth-chainspec = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
reth-e2e-test-utils = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4" }
reth-eth-wire = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
reth-eth-wire-types = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
reth-network = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
reth-network-api = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
reth-network-p2p = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
reth-network-peers = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
reth-network-types = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
reth-node-builder = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
reth-node-core = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
reth-node-api = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
reth-node-types = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
reth-payload-primitives = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
reth-primitives = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
reth-primitives-traits = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
reth-provider = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
reth-rpc-api = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
reth-rpc-eth-api = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
reth-rpc-eth-types = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
reth-rpc-layer = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
reth-rpc-server-types = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
reth-storage-api = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
reth-tasks = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
reth-tokio-util = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
reth-tracing = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
reth-transaction-pool = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
reth-trie-db = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
reth-testing-utils = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
reth-revm = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
reth-evm = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
reth-engine-local = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
reth-cli-util = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
reth-chainspec = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }
reth-e2e-test-utils = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork" }
reth-eth-wire = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }
reth-eth-wire-types = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }
reth-network = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }
reth-network-api = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }
reth-network-p2p = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }
reth-network-peers = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }
reth-network-types = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }
reth-node-builder = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }
reth-node-core = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }
reth-node-api = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }
reth-node-types = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }
reth-payload-primitives = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }
reth-primitives = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }
reth-primitives-traits = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }
reth-provider = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }
reth-rpc-api = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }
reth-rpc-eth-api = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }
reth-rpc-eth-types = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }
reth-rpc-layer = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }
reth-rpc-server-types = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }
reth-storage-api = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }
reth-tasks = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }
reth-tokio-util = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }
reth-tracing = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }
reth-transaction-pool = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }
reth-trie-db = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }
reth-testing-utils = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }
reth-revm = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }
reth-evm = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }
reth-engine-local = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }
reth-cli-util = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }

# reth-scroll
reth-scroll-chainspec = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
reth-scroll-consensus = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
reth-scroll-cli = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
reth-scroll-evm = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
reth-scroll-rpc = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
reth-scroll-engine-primitives = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
reth-scroll-forks = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
reth-scroll-node = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
reth-scroll-primitives = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.4", default-features = false }
reth-scroll-chainspec = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }
reth-scroll-consensus = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }
reth-scroll-cli = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }
reth-scroll-evm = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }
reth-scroll-rpc = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }
reth-scroll-engine-primitives = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }
reth-scroll-forks = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }
reth-scroll-node = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }
reth-scroll-primitives = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/shadow_fork", default-features = false }

# rollup node
rollup-node = { path = "crates/node" }
Expand Down
2 changes: 1 addition & 1 deletion crates/chain-orchestrator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ impl<
.as_mut()
.expect("signer must be present")
.sign_block(block.clone())?;
self.metric_handler.finish_block_building_recording();
self.metric_handler.finish_block_building_recording(block.header.gas_used);
return Ok(Some(ChainOrchestratorEvent::BlockSequenced(block)));
}
}
Expand Down
23 changes: 20 additions & 3 deletions crates/chain-orchestrator/src/metrics.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use metrics::Histogram;
use metrics::{Counter, Histogram};
use metrics_derive::Metrics;
use std::{collections::HashMap, time::Instant};
use strum::{EnumIter, IntoEnumIterator};
Expand Down Expand Up @@ -27,10 +27,21 @@ impl MetricsHandler {
}

/// The duration of the current block building task if any.
pub(crate) fn finish_block_building_recording(&mut self) {
pub(crate) fn finish_block_building_recording(&mut self, gas_used: u64) {
// Always increment the cumulative gas counter (similar to geth's commitGasCounter)
self.block_building_meter.metric.commit_gas.increment(gas_used);

let duration = self.block_building_meter.start.take().map(|start| start.elapsed());
if let Some(duration) = duration {
self.block_building_meter.metric.block_building_duration.record(duration.as_secs_f64());
let duration_secs = duration.as_secs_f64();
self.block_building_meter.metric.block_building_duration.record(duration_secs);
self.block_building_meter.metric.gas_per_block.record(gas_used as f64);
if duration_secs > 0.0 {
self.block_building_meter
.metric
.gas_per_second
.record(gas_used as f64 / duration_secs);
}
}
}
}
Expand Down Expand Up @@ -113,4 +124,10 @@ pub(crate) struct BlockBuildingMeter {
pub(crate) struct BlockBuildingMetric {
/// The duration of the block building task.
block_building_duration: Histogram,
/// The gas used per block.
pub(crate) gas_per_block: Histogram,
/// The gas throughput in gas/second.
pub(crate) gas_per_second: Histogram,
/// The cumulative gas used across all committed blocks (similar to geth's `miner/commit_gas`).
pub(crate) commit_gas: Counter,
}
3 changes: 1 addition & 2 deletions crates/node/src/add_ons/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//! The [`ScrollRollupNodeAddOns`] implementation for the Scroll rollup node.

use super::args::ScrollRollupNodeConfig;
use crate::constants;

use reth_evm::{ConfigureEngineEvm, EvmFactory, EvmFactoryFor};
use reth_network::NetworkProtocols;
Expand Down Expand Up @@ -80,7 +79,7 @@ where
.with_min_suggested_priority_fee(
config.gas_price_oracle_args.default_suggested_priority_fee,
)
.with_payload_size_limit(constants::DEFAULT_PAYLOAD_SIZE_LIMIT)
.with_payload_size_limit(config.sequencer_args.payload_size_limit)
.with_sequencer(config.network_args.sequencer_url.clone()),
ScrollEngineValidatorBuilder::default(),
BasicEngineApiBuilder::default(),
Expand Down
3 changes: 3 additions & 0 deletions crates/node/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,9 @@ pub struct SequencerArgs {
/// The payload building duration for the sequencer (milliseconds)
#[arg(long = "sequencer.payload-building-duration", id = "sequencer_payload_building_duration", value_name = "SEQUENCER_PAYLOAD_BUILDING_DURATION", default_value_t = constants::DEFAULT_PAYLOAD_BUILDING_DURATION)]
pub payload_building_duration: u64,
/// The payload size limit for the sequencer (bytes)
#[arg(long = "sequencer.payload-size-limit", id = "sequencer_payload_size_limit", value_name = "SEQUENCER_PAYLOAD_SIZE_LIMIT", default_value_t = constants::DEFAULT_PAYLOAD_SIZE_LIMIT)]
pub payload_size_limit: u64,
/// The fee recipient for the sequencer.
#[arg(long = "sequencer.fee-recipient", id = "sequencer_fee_recipient", value_name = "SEQUENCER_FEE_RECIPIENT", default_value_t = SCROLL_FEE_VAULT_ADDRESS)]
pub fee_recipient: Address,
Expand Down
2 changes: 1 addition & 1 deletion crates/node/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub(crate) const DEFAULT_BLOCK_TIME: u64 = 1000;
pub(crate) const DEFAULT_PAYLOAD_BUILDING_DURATION: u64 = 800;

/// The default payload size limit in bytes for the sequencer.
pub(crate) const DEFAULT_PAYLOAD_SIZE_LIMIT: u64 = 122_880;
pub(crate) const DEFAULT_PAYLOAD_SIZE_LIMIT: u64 = 122_8800;

/// The gap in blocks between the P2P and EN which triggers sync.
pub(crate) const BLOCK_GAP_TRIGGER: u64 = 1_000;
Expand Down
3 changes: 2 additions & 1 deletion crates/node/src/test_utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ pub use network_helpers::{
use crate::{
BlobProviderArgs, ChainOrchestratorArgs, ConsensusArgs, EngineDriverArgs, L1ProviderArgs,
PprofArgs, RollupNodeDatabaseArgs, RollupNodeNetworkArgs, RpcArgs, ScrollRollupNode,
ScrollRollupNodeConfig, SequencerArgs,
ScrollRollupNodeConfig, SequencerArgs, constants,
};
use alloy_primitives::Bytes;
use reth_chainspec::EthChainSpec;
Expand Down Expand Up @@ -274,6 +274,7 @@ pub fn default_sequencer_test_scroll_rollup_node_config() -> ScrollRollupNodeCon
l1_message_inclusion_mode: L1MessageInclusionMode::BlockDepth(0),
allow_empty_blocks: true,
max_l1_messages: None,
payload_size_limit: constants::DEFAULT_PAYLOAD_SIZE_LIMIT,
},
blob_provider_args: BlobProviderArgs { mock: true, ..Default::default() },
signer_args: Default::default(),
Expand Down