Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
2 changes: 1 addition & 1 deletion .github/workflows/pr-main_l1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ jobs:
test_pattern: engine-(auth|exchange-capabilities)/
- name: "Cancun Engine tests"
simulation: ethereum/engine
test_pattern: "engine-cancun/Blob Transactions On Block 1|Blob Transaction Ordering|Parallel Blob Transactions|ForkchoiceUpdatedV3|ForkchoiceUpdatedV2|ForkchoiceUpdated Version|GetPayload|NewPayloadV3 After Cancun|NewPayloadV3 Before Cancun|NewPayloadV3 Versioned Hashes|Incorrect BlobGasUsed|ParentHash equals BlockHash|RPC:|in ForkchoiceState|Unknown SafeBlockHash|Unknown FinalizedBlockHash|Unique|Re-Execute Payload|Multiple New Payloads|NewPayload with|Build Payload with|Re-org to Previously|Safe Re-Org to Side Chain|Transaction Re-Org|Re-Org Back into Canonical Chain|Suggested Fee Recipient Test|PrevRandao Opcode|Fork ID: *|Request Blob Pooled Transactions Single|Invalid NewPayload, Incomplete Transactions|Re-Org Back to Canonical Chain*|Invalid PayloadAttributes*|Invalid NewPayload, VersionedHashes|Invalid NewPayload, Incomplete VersionedHashes|Invalid NewPayload, Extra VersionedHashes|Bad Hash on NewPayload|Unknown HeadBlockHash|In-Order Consecutive Payload Execution|Valid NewPayload->ForkchoiceUpdated|Invalid NewPayload, ParentHash|Syncing=False|Payload Build after New Invalid Payload|Invalid NewPayload|Invalid Missing Ancestor ReOrg|Invalid Missing Ancestor Syncing ReOrG"
test_pattern: "engine-cancun"
- name: "Paris Engine tests"
simulation: ethereum/engine
test_pattern: "engine-api/RPC|Bad Hash on NewPayload|Build Payload|Fork ID|In-Order Consecutive Payload Execution|Inconsistent|Invalid Missing Ancestor ReOrg|Invalid NewPayload|Invalid PayloadAttributes|Multiple New Payloads|NewPayload with|ParentHash equals BlockHash on NewPayload|Payload Build|PrevRandao Opcode Transactions|Re-Execute Payload|Re-Org Back|Re-org to Previously Validated Sidechain Payload|RPC:|Safe Re-Org|Suggested Fee|Transaction Re-Org|Unique Payload ID|Unknown|Valid NewPayload->ForkchoiceUpdated" # |Invalid P9 -> flaky
Expand Down
9 changes: 9 additions & 0 deletions cmd/ethrex/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,14 @@ pub struct Options {
help_heading = "P2P options"
)]
pub discovery_port: String,
#[arg(
long = "p2p.tx-broadcasting-interval",
default_value = "1000",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you put this as a constant instead of hardcoding it here?

value_name = "INTERVAL_MS",
help = "Transaction Broadcasting Time Interval (ms) for batching transactions before broadcasting them.",
help_heading = "P2P options"
)]
pub tx_broadcasting_time_interval: u64,
#[arg(
long = "block-producer.extra-data",
default_value = get_minimal_client_version(),
Expand Down Expand Up @@ -246,6 +254,7 @@ impl Default for Options {
dev: Default::default(),
force: false,
mempool_max_size: Default::default(),
tx_broadcasting_time_interval: Default::default(),
Copy link
Collaborator

@mpaulucci mpaulucci Oct 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isnt this 0? Do we actually want the default?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I set the default value with the one that was used previously here and then with this pr when hive launches ethrex I set the interval value to what I tested works.

extra_data: get_minimal_client_version(),
}
}
Expand Down
1 change: 1 addition & 0 deletions cmd/ethrex/initializers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ pub async fn init_network(
blockchain.clone(),
get_client_version(),
based_context,
opts.tx_broadcasting_time_interval,
)
.await
.expect("P2P context could not be created");
Expand Down
15 changes: 10 additions & 5 deletions crates/networking/p2p/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,22 @@ impl P2PContext {
blockchain: Arc<Blockchain>,
client_version: String,
based_context: Option<P2PBasedContext>,
tx_broadcasting_time_interval: u64,
) -> Result<Self, NetworkError> {
let (channel_broadcast_send_end, _) = tokio::sync::broadcast::channel::<(
tokio::task::Id,
Arc<Message>,
)>(MAX_MESSAGES_TO_BROADCAST);

let tx_broadcaster = TxBroadcaster::spawn(peer_table.clone(), blockchain.clone())
.await
.inspect_err(|e| {
error!("Failed to start Tx Broadcaster: {e}");
})?;
let tx_broadcaster = TxBroadcaster::spawn(
peer_table.clone(),
blockchain.clone(),
tx_broadcasting_time_interval,
)
.await
.inspect_err(|e| {
error!("Failed to start Tx Broadcaster: {e}");
})?;

Ok(P2PContext {
local_node,
Expand Down
6 changes: 2 additions & 4 deletions crates/networking/p2p/tx_broadcaster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ const PRUNE_WAIT_TIME_SECS: u64 = 600; // 10 minutes
// Amount of seconds between each prune
const PRUNE_INTERVAL_SECS: u64 = 360; // 6 minutes

// Amount of seconds between each broadcast
const BROADCAST_INTERVAL_SECS: u64 = 1; // 1 second

#[derive(Debug, Clone, Default)]
struct PeerMask {
bits: Vec<u64>,
Expand Down Expand Up @@ -115,6 +112,7 @@ impl TxBroadcaster {
pub async fn spawn(
kademlia: PeerTableHandle,
blockchain: Arc<Blockchain>,
tx_broadcasting_time_interval: u64,
) -> Result<GenServerHandle<TxBroadcaster>, TxBroadcasterError> {
info!("Starting Transaction Broadcaster");

Expand All @@ -129,7 +127,7 @@ impl TxBroadcaster {
let server = state.clone().start();

send_interval(
Duration::from_secs(BROADCAST_INTERVAL_SECS),
Duration::from_millis(tx_broadcasting_time_interval),
server.clone(),
InMessage::BroadcastTxs,
);
Expand Down
5 changes: 5 additions & 0 deletions docs/CLI.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ P2P options:
UDP port for P2P discovery.

[default: 30303]

--p2p.tx-broadcasting-interval <INTERVAL_MS>
Transaction Broadcasting Time Interval (ms) for batching transactions before broadcasting them.

[default: 1000]

RPC options:
--http.addr <ADDRESS>
Expand Down
Loading