Skip to content

events: fix runtime diff reporting and add runtime_vote_write - #12236

Open
kbhargava-jump wants to merge 1 commit into
mainfrom
kbhargava/events-boot-baseline
Open

kbhargava-jump wants to merge 1 commit into
mainfrom
kbhargava/events-boot-baseline

Conversation

@kbhargava-jump

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI balanced review requested due to automatic review settings October 13, 2026 21:03
Comment thread src/disco/events/fd_event_report.h Resolved
Comment thread src/app/firedancer/config/default.toml Resolved

Copilot AI left a comment

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.

🟡 Changes recommended

Event pacing can crash or indefinitely throttle producers, and telemetry schema compatibility and vote-write accuracy need correction.

4 open findings
What changed in this PR

Expands runtime event reporting, improves bundle telemetry parity, and adds configurable event upload pacing.

Changes:

  • Adds Alpenglow vote-write and richer reward/stake events.
  • Captures bundle transaction diffs and stake mutations.
  • Adds event backpressure, draining, pacing configuration, and tests.
File Description
src/​flamenco/​stakes/​fd_stakes.c Refines epoch vote counts and reward state initialization.
src/​flamenco/​runtime/​tests/​test_inflation_rewards.c Tests zero-commission reward behavior.
src/​flamenco/​runtime/​tests/​test_accdb_svm.c Tests zero-value vote credits.
src/​flamenco/​runtime/​test_bundle_exec.c Tests bundle event parity.
src/​flamenco/​runtime/​Local.mk Links bundle tests with Tango.
src/​flamenco/​runtime/​fd_runtime.h Adds bundle event capture context.
src/​flamenco/​runtime/​fd_runtime_stack.h Tracks commission entries.
src/​flamenco/​runtime/​fd_accdb_svm.c Emits zero-value vote reward events.
src/​flamenco/​rewards/​fd_rewards.c Handles zero-commission entries and delegation metadata.
src/​flamenco/​events/​fd_event_runtime.h Declares new capture and vote-write APIs.
src/​flamenco/​events/​fd_event_runtime.c Implements bundle, reward, and vote-write events.
src/​flamenco/​alpenglow/​fd_alpenglow.c Reports certificate-driven vote writes.
src/​discof/​replay/​fd_replay_tile.c Removes boot delegation baseline emission.
src/​discof/​execle/​fd_execle_tile.c Captures bundle events.
src/​discof/​backtest/​fd_backtest_tile.c Drains telemetry before exit.
src/​disco/​topo/​fd_topo.h Adds event upload-rate topology state.
src/​disco/​events/​test_event_client.c Updates pacing tests and constructor calls.
src/​disco/​events/​schema/​runtime_vote_write.json Defines vote-write events.
src/​disco/​events/​schema/​runtime_txn.json Clarifies transaction diff semantics.
src/​disco/​events/​schema/​runtime_stake_delegation.json Removes boot baseline semantics.
src/​disco/​events/​schema/​runtime_reward.json Adds delegated vote account metadata.
src/​disco/​events/​schema/​runtime_epoch.json Updates VAT documentation.
src/​disco/​events/​schema/​runtime_block.json References vote-write exclusions.
src/​disco/​events/​schema/​events.proto Updates protobuf event contracts.
src/​disco/​events/​generated/​fd_event_gen.h Updates generated event types.
src/​disco/​events/​generated/​fd_event_gen.c Serializes new event fields.
src/​disco/​events/​generated/​fd_event_gen_test.h Adds generated serialization coverage.
src/​disco/​events/​fd_event_tile.c Returns event-link credit and configures pacing.
src/​disco/​events/​fd_event_report.h Adds producer backpressure.
src/​disco/​events/​fd_event_report.c Connects reporters to consumer progress.
src/​disco/​events/​fd_event_client.h Exposes configurable upload rate.
src/​disco/​events/​fd_event_client.c Implements pacing and batch draining.
src/​app/​shared/​fd_config.h Adds upload-rate configuration.
src/​app/​shared/​fd_config_parse.c Parses upload rate.
src/​app/​shared/​fd_config_json.c Exports upload rate.
src/​app/​firedancer/​topology.c Propagates upload rate.
src/​app/​firedancer/​config/​default.toml Documents the new setting.
contrib/​blockstore/​blockstore2shredcap.c Reports bank-hash sources and omissions.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/disco/events/fd_event_client.c Resolved
Comment thread src/disco/events/schema/events.proto Resolved
Comment thread src/disco/events/fd_event_report.h Resolved
Comment thread src/flamenco/alpenglow/fd_alpenglow.c Resolved
Copilot AI balanced review requested due to automatic review settings October 14, 2026 17:45

Copilot AI left a comment

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.

🔵 Needs a closer look

Event draining can lose unacknowledged data, pacing accepts crashing rates, and an existing protobuf enum value is renumbered.

3 open findings
1 resolved since last review
Previously missed (1)

In code that hasn't changed since last review

Medium severity Drain waits only for unsent events, dropping unacknowledged events

src/​discof/​backtest/​fd_backtest_tile.c:371

This drain condition ignores events that have been sent but not yet acknowledged. QUEUE_UNSENT_COUNT reaches zero as soon as the circq cursor advances, while QUEUE_USED explicitly includes sent-but-unacknowledged events; the immediate process exit can therefore drop in-flight runtime events. Wait for QUEUE_USED to reach zero and report that pending count in timeout/disconnect warnings.

🧠 Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 14, 2026 20:45

Copilot AI left a comment

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.

🔵 Needs a closer look

Account-closure diffs and failed-redeem commission tracking can produce incorrect runtime events.

3 open findings
Previously missed (2)

In code that hasn't changed since last review

Medium severity Normalize captured account post-state for closure events

src/​flamenco/​events/​fd_event_runtime.c:277

Bundle capture runs before commit. When a transaction drains an account to zero, it captures the old owner, data length and executable flag, but follower events run after fd_runtime_lthash_account() clears those fields. This makes leader and follower diffs disagree for account closures. Normalize the captured post-state without modifying the shared account.

Medium severity Set commission flag only after successful reward redemption

src/​flamenco/​rewards/​fd_rewards.c:1446

When redeem_rewards() fails, the rent-adjustment or block-reward fallback can still reach this line with zero voter rewards. Those stakes need a partition entry, but did not produce a successful commission redeem. Setting this flag makes the new payout filters treat them as commission entries and can emit an extra zero vote-reward row. Set the flag only for successful redeems, preserving any entry established by another delegation.

🧠 Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 14, 2026 21:16
@kbhargava-jump
kbhargava-jump force-pushed the kbhargava/events-boot-baseline branch from f8ff0e1 to a4aada0 Compare October 14, 2026 21:16
@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
 ┌─ ⚡ PERF · 9ccca11 vs main@a480289 ─────────────────────────────────
 │ SUITE                               BASELINE          NEW         Δ
 │ replay tps, mainnet               14,459 tps   14,369 tps  ·  -0.62%
 │ bench tps, localnet              660,808 tps  656,103 tps  ·  -0.71%
 │ snapshot load, testnet                4.97 s       4.96 s  ·  -0.19%
 │ snapshot load, mainnet               67.57 s      68.28 s  ·  +1.05%
 │ epoch boundary, mainnet             144.6 ms     146.6 ms  ·  +1.36%
+│ mem total, mainnet                142.88 GiB   142.88 GiB  ▼   0.00%
+│ mem total, testnet                 80.19 GiB    80.19 GiB  ▼   0.00%
 │ clean compile, firedancer             3.26 s       3.25 s  ·  -0.23%
 │ binary size, firedancer             59.18 MB     59.21 MB  ·  +0.05%
 ├─────────────────────────────────────────────────────────────────────
@@ 0 REGRESSIONS · 0 WARNINGS · 2 IMPROVED · 7 NOISE @@
 └─────────────────────────────────────────────────────────────────────
history · 10 pushes
 ┌─ HISTORY · Δ vs main, per push, newest first ───────────────────────────────────────────
 │ HEAD         TPS    BENCH   SNAP·T   SNAP·M    EPOCH    MEM·M    MEM·T  COMPILE   BINARY
+│ 9ccca11   -0.62%   -0.71%   -0.19%   +1.05%   +1.36%    0.00%    0.00%   -0.23%   +0.05%
!│ 9806cbc   +0.84%   -0.58%   +0.01%   +0.10%   +1.23%    0.00%    0.00%   +0.02%   +0.05%
!│ 95bc2b7   -0.73%   -0.43%   -0.39%   +0.40%   +0.56%    0.00%    0.00%   -0.46%   +0.05%
+│ 1fbfedc   -0.14%   -0.44%   -0.37%        …        …    0.00%    0.00%   +0.86%   +0.05%
-│ 05357f0   +0.34%   +0.16%   +5.58%        …        …    0.00%    0.00%   +0.49%   +0.06%
-│ 707b371   +0.22%   -0.05%   +5.61%        …        …   +0.03%   +0.04%        …   +0.07%
!│ 929a4b7   -1.56%   +0.35%   +1.70%        …        …   +0.03%   +0.11%   +0.03%   +0.07%
!│ a71923d   +0.49%   +3.58%   +2.44%        …        …   +0.03%   +0.11%   +0.96%   +0.07%
!│ 1827508   +0.69%   -0.52%   +0.72%        …        …    0.00%    0.00%   +2.97%   +0.05%
!│ a4aada0   -0.55%   -0.70%   +2.67%        …        …    0.00%    0.00%   +1.62%   +0.05%
 └─────────────────────────────────────────────────────────────────────────────────────────

Copilot AI left a comment

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.

🟡 Changes recommended

Protobuf enum renumbering breaks compatibility, and bundle account-closure events disagree with follower events.

5 open findings

🧠 Review effort: Balanced

Comment thread src/flamenco/events/fd_event_runtime.c Resolved
Copilot AI balanced review requested due to automatic review settings October 14, 2026 21:26

Copilot AI left a comment

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.

Copilot AI balanced review requested due to automatic review settings October 14, 2026 22:33

Copilot AI left a comment

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.

🔵 Needs a closer look

Reported compatibility and telemetry correctness concerns remain unresolved; their exclusion as duplicate feedback does not establish that they were fixed.

5 open findings

🧠 Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 14, 2026 22:53

Copilot AI left a comment

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.

🟡 Changes recommended

Timestamp overflow and event-drain synchronization remain unresolved correctness issues.

4 open findings
2 resolved since last review
Previously missed (1)

In code that hasn't changed since last review

Medium severity Use a post-metrics completion marker for queue draining

src/​discof/​backtest/​fd_backtest_tile.c:374

A newer heartbeat does not guarantee that QUEUE_USED is current: src/disco/stem/fd_stem_run1.c:247–252 publishes the heartbeat before calling metrics_write, which updates the queue gauge. If events were consumed after the previous metrics update reported an empty queue, this loop can observe the new heartbeat with the old zero gauge and exit with events still pending. Use an explicit drain acknowledgement or a completion marker published after the queue metrics, rather than the generic heartbeat.

🧠 Review effort: Balanced

Comment thread src/flamenco/alpenglow/fd_alpenglow.c Resolved
Copilot AI balanced review requested due to automatic review settings October 14, 2026 23:01
@kbhargava-jump
kbhargava-jump force-pushed the kbhargava/events-boot-baseline branch from 22837d9 to 929a4b7 Compare October 14, 2026 23:01

Copilot AI left a comment

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.

Comment thread src/discof/backtest/fd_backtest_tile.c Resolved
Copilot AI balanced review requested due to automatic review settings October 15, 2026 19:50

Copilot AI left a comment

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.

🔵 Needs a closer look

The reported wire-compatibility and timestamp-overflow concerns remain unresolved; duplicate exclusion does not establish that they were fixed.

4 open findings

🧠 Review effort: Balanced

Comment thread src/disco/events/fd_event_client.h Outdated
fd_x509_ca_store_t const * ca_store,
ulong tx_rate_bps );

#define FD_EVENT_CLIENT_TX_RATE_BPS_DEFAULT (4UL*1000UL*1000UL)

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.

add comment for 32 Mb/s (also makes it more obvious it bytes and not bits)

Copilot AI balanced review requested due to automatic review settings October 22, 2026 17:43
@kbhargava-jump
kbhargava-jump force-pushed the kbhargava/events-boot-baseline branch from 707b371 to 5c63106 Compare October 22, 2026 17:43

Copilot AI left a comment

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.

🟡 Changes recommended

Migration-epoch vote-write events report older Tower credits instead of the updated Alpenglow credit total.

1 open issue
4 resolved since last review

Review effort: Balanced

Comment thread src/flamenco/alpenglow/fd_alpenglow.c Resolved
Copilot AI balanced review requested due to automatic review settings October 22, 2026 21:34

Copilot AI left a comment

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.

🔵 Needs a closer look

Previously reported wire-compatibility and timestamp-correctness issues remain unresolved in the supplied changes.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@kbhargava-jump
kbhargava-jump force-pushed the kbhargava/events-boot-baseline branch from 72a6596 to 05357f0 Compare October 28, 2026 21:12
Copilot AI balanced review requested due to automatic review settings October 28, 2026 21:12
@kbhargava-jump
kbhargava-jump changed the base branch from main to kbhargava/event-links-replay-diff October 28, 2026 21:12

Copilot AI left a comment

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.

🟡 Changes recommended

Unresolved critical issues break protobuf wire compatibility, introduce signed overflow for valid vote timestamps, and cause V4/V5 parity tests to fail.

2 open issues

Review effort: Balanced

Comment thread src/flamenco/alpenglow/fd_alpenglow.c Resolved
Comment thread src/flamenco/alpenglow/fd_alpenglow.c Resolved
@kbhargava-jump
kbhargava-jump force-pushed the kbhargava/events-boot-baseline branch from 05357f0 to 1fbfedc Compare October 28, 2026 21:37
Base automatically changed from kbhargava/event-links-replay-diff to main November 3, 2026 23:09
@kbhargava-jump
kbhargava-jump force-pushed the kbhargava/events-boot-baseline branch from 1fbfedc to 95bc2b7 Compare November 3, 2026 23:21
Copilot AI balanced review requested due to automatic review settings November 3, 2026 23:21

Copilot AI left a comment

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.

🔵 Needs a closer look

Removing bootup renumbers reward from wire value 4 to 3, breaking compatibility by causing collectors to misinterpret new and historical events.

2 open issues

Review effort: Balanced

@kbhargava-jump
kbhargava-jump force-pushed the kbhargava/events-boot-baseline branch from 95bc2b7 to 9806cbc Compare November 3, 2026 23:46
Copilot AI balanced review requested due to automatic review settings November 3, 2026 23:46
@kbhargava-jump kbhargava-jump changed the title Kbhargava/events boot baseline events: fix runtime diff reporting and add runtime_vote_write Nov 3, 2026

Copilot AI left a comment

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.

🟡 Changes recommended

Critical issues remain: removing bootup breaks protobuf enum compatibility, and closed delegated accounts can leave stale delegations in the event stream.

1 open issue
2 resolved since last review

Review effort: Balanced

Comment thread src/flamenco/events/fd_event_runtime.c Resolved
@kbhargava-jump
kbhargava-jump force-pushed the kbhargava/events-boot-baseline branch from 9806cbc to 9ccca11 Compare November 4, 2026 00:12
Copilot AI balanced review requested due to automatic review settings November 4, 2026 00:12

Copilot AI left a comment

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.

🟡 Changes recommended

Removing bootup renumbers reward from wire value 4 to 3, breaking compatibility with existing collectors and historical data.

1 open issue
1 resolved since last review

Review effort: Balanced

upd->stored_vote_slot = v5->latest_vote;
upd->stored_vote_ts = v5->last_timestamp.timestamp;
upd->stored_root_slot = v5->root_slot;
upd->stored_credits = epoch_credits_at( acc, vs, upd->current_epoch );

This branch has not been deployed

No deployments
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.

4 participants