Skip to content

refactor(tx-forwarding): stop journaling TXPOOL_BUILDER_FORWARD_FAILURE - #6519

Merged
fahimahmedx merged 1 commit into
mainfrom
fahim/chain-6721-dedupe-forward-failure-events
Nov 9, 2026
Merged

fahimahmedx merged 1 commit into
mainfrom
fahim/chain-6721-dedupe-forward-failure-events

Conversation

@fahimahmedx

@fahimahmedx fahimahmedx commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Part of CHAIN-6721 (cut transaction event volume so the Snowflake pipeline fits in an hour).

Problem. Each mainnet mempool node forwards every transaction to all 7 builders in --builder-rpc-urls: the 5 production HA sequencers plus 2 canary sequencers that never build canonical blocks. Every builder that rejected a transaction made the node journal a TXPOOL_BUILDER_FORWARD_FAILURE row. On 2026-11-08 09:00 UTC that was 20.2M rows/hour, 17.6% of all mainnet transaction events, and 88% of them were canary rejections (destinations recovered from the event-ID hash).

The receiving builder already journals the same rejection as TXPOOL_VALIDATED_INSERT_REJECTED, with the reason, and only while it is the active sequencer. So every node-side failure row was one of: a duplicate of the leader's own verdict, a standby's verdict, or a canary's verdict. The last two never decide inclusion.

Fix. Stop emitting TXPOOL_BUILDER_FORWARD_FAILURE and retire the event type (the enum variant stays so historical rows parse, like TXPOOL_BUILDER_CONSUMED). Pool rejections are recorded once, by the leader.

Unchanged. Forwarding, retries, failure reports to the reader (resends), and the per-builder rejection metric txpool_forwarder_num_tx_rejected_in_batch. TXPOOL_BUILDER_FORWARD_ATTEMPT and TXPOOL_BUILDER_FORWARD_DROPPED stay: a send that never reaches a builder has no builder-side record.

Effect. −20.2M rows/hour (−17.6% of all mainnet transaction events) at peak. No new flags or deployment config.

Trade-off. Until sequencer transaction events are re-enabled (the goal of CHAIN-6721, for which this is a prerequisite), builder pool rejections appear only in metrics, not in the journal.

Testing

cargo +nightly fmt, cargo clippy -p base-tx-forwarding -p base-observability-events --all-targets -- -D warnings, cargo test -p base-tx-forwarding -p base-observability-events, etc/scripts/ci/check-crate-deps.sh. The devnet integration test builder_rejection_is_journaled_by_both_sides now asserts a rejected transaction's journal is exactly TXPOOL_SEND_RAW_TRANSACTION, TXPOOL_PENDING, TXPOOL_VALIDATED_INSERT_REJECTED, so re-adding the emit fails it.

type=routine
risk=low
impact=sev5

@cb-heimdall

cb-heimdall commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Heimdall Review Status

Requirement Status More Info
Reviews ✅ 1/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
1 if authored by an app that is not allowlisted and lacks verified human attribution 0
Sum 1

) {
data.entry("target".to_string()).or_insert_with(|| json!("builder_forwarder"));
data.entry("rpc_method".to_string()).or_insert_with(|| json!(rpc_method));
data.entry("builder".to_string()).or_insert_with(|| json!(self.url_label.as_ref()));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

url_label is the full builder_url.to_string(), so any userinfo or API-key query parameter in a configured builder URL now goes into every forwarder transaction event, a store that is wider and longer-lived than the metrics label. Consider journaling a redacted form (scheme://host:port) instead.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch. data.builder is now the URL origin (scheme://host[:port], via Url::origin().ascii_serialization()), so userinfo, path and query never reach the event store (8397df9). The metrics label is unchanged.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Moot after the rework (34c165f): the PR now retires TXPOOL_BUILDER_FORWARD_FAILURE outright, so neither the builder data field nor the rejection classifier exists anymore.

impl RejectionClass {
/// Classifies a builder insert rejection by its message.
pub fn classify(message: &str) -> Self {
if message.contains("already imported") {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This adds a second hard-coded "already imported" match next to base_execution_txpool::is_already_imported_rejection, which task.rs already uses to decide whether to resend. If the txpool constant (whose test pins it to reth's Display) ever changes, the class label will silently disagree with resend behaviour. Reuse the txpool helper or a shared constant instead.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed. RejectionClass::classify now takes the ErrorObjectOwned and defers the already-imported case to base_execution_txpool::is_already_imported_rejection, the same check that drives the resend decision, so the two cannot drift (8397df9).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Moot after the rework (34c165f): the PR now retires TXPOOL_BUILDER_FORWARD_FAILURE outright, so neither the builder data field nor the rejection classifier exists anymore.

@fahimahmedx fahimahmedx changed the title fix(tx-forwarding): journal one structured forward failure per tx and rejection class feat(tx-forwarding): stop journaling canary builder rejections and structure forward failures Nov 9, 2026
A mempool node forwards every transaction to every configured builder, and
each builder that rejected it made the node journal a forward failure. The
receiving builder already journals the same rejection as
TXPOOL_VALIDATED_INSERT_REJECTED while it is the active sequencer, so the
node-side row either duplicated the leader's verdict or recorded a standby or
canary verdict that never decides inclusion. On mainnet (2026-11-08 09:00 UTC)
these were 20.2M rows/hour, 17.6% of all transaction events, 88% of them from
the two canary sequencers.

Drop the emit and retire the event type; historical rows stay readable.
Forwarding, failure reports to the reader, and the per-builder rejection
metric are unchanged. TXPOOL_BUILDER_FORWARD_ATTEMPT and _DROPPED stay, since
a send that never reaches a builder has no builder-side record.

CHAIN-6721
@fahimahmedx
fahimahmedx force-pushed the fahim/chain-6721-dedupe-forward-failure-events branch from addc44f to 34c165f Compare November 9, 2026 21:50
@fahimahmedx fahimahmedx changed the title feat(tx-forwarding): stop journaling canary builder rejections and structure forward failures refactor(tx-forwarding): stop journaling TXPOOL_BUILDER_FORWARD_FAILURE Nov 9, 2026
// the leader's and add standby and canary verdicts that never decide
// inclusion; the rejection metric below covers them in aggregate.
Ok(()) => ok_count += 1,
Err(e) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The builder only journals TXPOOL_VALIDATED_INSERT_REJECTED from finish_insert (rejection_stage = "pool_insert"). Rejections from prepare_insert never emit an event: extensions disabled, extension validation, decode failure, and validity_signature_mode checks (txpool/src/builder/rpc.rs). They come back here as per-item Errs that were previously journaled as TXPOOL_BUILDER_FORWARD_FAILURE and now have no journal record on either side. A builder-wide policy rejection, such as a validity-signature rollout mismatch, also drops every affected tx before the leader's pool sees it. Either have the builder journal pre-pool rejections, or keep the node-side event for non-pool rejected transaction errors. Then update the README/doc claim that the builder records every send that reaches it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Correct that pre-pool rejections (disabled/invalid extensions, undecodable tx, validity-signature policy) have no builder-side journal record after this change. In the 2026-11-08 09:00 mainnet sample every one of the 20.2M failure rows was a pool rejection, so the gap is ~0 rows today, and those failures are visible in the builder's extension_errors / decode_errors metrics and the forwarder's rejected counter. Keeping the node-side event only for non-pool rejections is a small follow-up if we want the journal to cover a builder policy mismatch; leaving this PR as the plain retirement.

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

One finding. The PR assumes every per-item rejection a forwarded send gets back is also journaled by the builder as TXPOOL_VALIDATED_INSERT_REJECTED. That only holds for pool-insert rejections. Pre-pool rejections in prepare_insert (decode, extensions, validity-signature policy) emit no builder event, and they now emit no node-side event either, so they disappear from the journal entirely. Removing the event for pool rejections only, or adding builder-side events for the earlier stages, keeps the volume savings without the gap. Not block-production-sensitive.

@fahimahmedx
fahimahmedx enabled auto-merge November 9, 2026 21:55
@fahimahmedx
fahimahmedx added this pull request to the merge queue Nov 9, 2026
Merged via the queue into main with commit 375e110 Nov 9, 2026
27 checks passed
@fahimahmedx
fahimahmedx deleted the fahim/chain-6721-dedupe-forward-failure-events branch November 9, 2026 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants