Skip to content

replay, leader pipeline: implement remove_simple_vote_from_cost_model#8386

Merged
topointon-jump merged 1 commit intomainfrom
stop-use-static-simple-vote-tx-cost
Feb 27, 2026
Merged

replay, leader pipeline: implement remove_simple_vote_from_cost_model#8386
topointon-jump merged 1 commit intomainfrom
stop-use-static-simple-vote-tx-cost

Conversation

@topointon-jump
Copy link
Contributor

@topointon-jump topointon-jump commented Feb 20, 2026

Cost model changes needed for remove_simple_vote_from_cost_model and bls_pubkey_management_in_vote_account.

As of remove_simple_vote_from_cost_model, simple vote transactions no longer have a hardcoded value in the cost model.

As of bls_pubkey_management_in_vote_account, the vote program is no longer treated as a builtin in the cost model, and some vote instructions are more expensive (those which perform BLS proof-of-possession verification).

To avoid feature-gating pack code, we increase the estimate for simple vote transactions which pack uses. Once remove_simple_vote_from_cost_model has been activated everywhere, we can make the is_simple_vote classifier stricter and use a tighter estimate.

@github-actions
Copy link

Performance Measurements ⏳

Suite Baseline New Change
backtest mainnet-368528500-perf per slot 0.073941 s 0.074394 s 0.613%
backtest mainnet-368528500-perf snapshot load 4.69 s 3.224 s -31.258%
backtest mainnet-368528500-perf total elapsed 73.941393 s 74.393821 s 0.612%
firedancer mem usage with mainnet.toml 984.34 GiB 984.34 GiB 0.000%

@topointon-jump topointon-jump mentioned this pull request Feb 21, 2026
11 tasks
@topointon-jump topointon-jump force-pushed the stop-use-static-simple-vote-tx-cost branch from 8a3a0ec to f2fae06 Compare February 21, 2026 00:38
@github-actions
Copy link

Performance Measurements ⏳

Suite Baseline New Change
backtest mainnet-368528500-perf per slot 0.07408 s 0.074012 s -0.092%
backtest mainnet-368528500-perf snapshot load 4.666 s 3.208 s -31.247%
backtest mainnet-368528500-perf total elapsed 74.080002 s 74.011698 s -0.092%
firedancer mem usage with mainnet.toml 984.34 GiB 984.34 GiB 0.000%

Copilot AI review requested due to automatic review settings February 25, 2026 18:57
@topointon-jump topointon-jump force-pushed the stop-use-static-simple-vote-tx-cost branch from f2fae06 to 07a2963 Compare February 25, 2026 18:57
@github-actions
Copy link

Performance Measurements ⏳

Suite Baseline New Change
backtest mainnet-368528500-perf per slot 0.063044 s 0.063811 s 1.217%
backtest mainnet-368528500-perf snapshot load 3.463 s 2.271 s -34.421%
backtest mainnet-368528500-perf total elapsed 63.043761 s 63.810867 s 1.217%
firedancer mem usage with mainnet.toml 980.26 GiB 980.26 GiB 0.000%

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements cost model changes needed for the stop_use_static_simple_vote_tx_cost and bls_pubkey_management_in_vote_account features. Before stop_use_static_simple_vote_tx_cost, simple vote transactions had a hardcoded cost value (3428 CUs). After the feature activates, they go through the full cost model calculation. Additionally, after bls_pubkey_management_in_vote_account, some vote instructions (authorize instructions) charge additional CUs for BLS proof-of-possession verification.

The PR adds the new feature flag, updates the cost tracker to conditionally use the static cost, adds proper feature-gating in execution tiles, and updates pack's cost estimates to use a conservative upper bound that works both before and after the features activate.

Note: This PR is marked as WIP and contains known issues (FIXME comments) in fd_bank_tile.c that need to be addressed.

Changes:

  • Added stop_use_static_simple_vote_tx_cost feature flag registration
  • Updated cost tracker to feature-gate simple vote static cost usage
  • Updated execution tiles to feature-gate simple vote cost overrides
  • Updated pack cost estimates to use upper bounds for simple votes to avoid feature-gating
  • Removed vote program from builtin cost table

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/flamenco/features/feature_map.json Added stop_use_static_simple_vote_tx_cost feature registration
src/flamenco/features/fd_features_generated.h Generated header updates for new feature (count and ID)
src/flamenco/features/fd_features_generated.c Generated implementation for new feature lookup
src/flamenco/runtime/fd_cost_tracker.h Added FD_SIMPLE_VOTE_USAGE_COST constant (3428 CUs)
src/flamenco/runtime/fd_cost_tracker.c Feature-gated simple vote cost logic; changed cost checks to use is_simple_vote flag
src/disco/pack/fd_pack_cost.h Removed vote program from builtin table; added BLS verification cost; updated simple vote cost to use upper bound
src/discof/execle/fd_execle_tile.c Feature-gated simple vote fixed cost logic in microblock and bundle handlers
src/discoh/bank/fd_bank_tile.c Added FIXME comments noting missing feature-gating (known WIP issue)
Comments suppressed due to low confidence (1)

src/discoh/bank/fd_bank_tile.c:262

  • The FIXME comment correctly identifies that this code needs to be feature-gated on stop_use_static_simple_vote_tx_cost. Currently, the code always uses FD_PACK_VOTE_DEFAULT_COMPUTE_UNITS for simple votes regardless of whether the feature is active, which means it will continue using the static cost even after the feature activates. This is inconsistent with the changes in fd_execle_tile.c where proper feature-gating was added. The missing feature gate could cause overpacked blocks to go undetected after the feature activates, as the FIXME notes.
    /* FIXME: we likely have to feature-gate this on
         stop_use_static_simple_vote_tx_cost otherwise we could fail to
         detect overpacked blocks.  */
    int is_simple_vote = 0;
    if( FD_UNLIKELY( is_simple_vote = fd_txn_is_simple_vote_transaction( TXN(txn), txn->payload ) ) ) {
      /* Simple votes are charged fixed amounts of compute regardless of
      the real cost they incur.  fd_ext_bank_load_and_execute_txns
      returns the real cost, however, so we override it here. */
      actual_execution_cus = FD_PACK_VOTE_DEFAULT_COMPUTE_UNITS;
      actual_acct_data_cus = 0U;

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@topointon-jump topointon-jump force-pushed the stop-use-static-simple-vote-tx-cost branch from 07a2963 to 7ea3111 Compare February 25, 2026 19:09
@github-actions
Copy link

Performance Measurements ⏳

Suite Baseline New Change
backtest mainnet-368528500-perf per slot 0.062016 s 0.062674 s 1.061%
backtest mainnet-368528500-perf snapshot load 2.454 s 2.17 s -11.573%
backtest mainnet-368528500-perf total elapsed 62.015544 s 62.674153 s 1.062%
firedancer mem usage with mainnet.toml 980.26 GiB 980.26 GiB 0.000%

Copilot AI review requested due to automatic review settings February 25, 2026 20:01
@topointon-jump topointon-jump force-pushed the stop-use-static-simple-vote-tx-cost branch from 7ea3111 to 1a1e60d Compare February 25, 2026 20:01
@github-actions
Copy link

Performance Measurements ⏳

Suite Baseline New Change
backtest mainnet-368528500-perf per slot 0.052323 s 0.052512 s 0.361%
backtest mainnet-368528500-perf snapshot load 2.473 s 1.82 s -26.405%
backtest mainnet-368528500-perf total elapsed 52.323164 s 52.512475 s 0.362%
firedancer mem usage with mainnet.toml 980.26 GiB 980.26 GiB 0.000%

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@topointon-jump topointon-jump force-pushed the stop-use-static-simple-vote-tx-cost branch from 1a1e60d to 9881f93 Compare February 26, 2026 21:19
@topointon-jump topointon-jump changed the title [WIP] replay, leader pipeline: implement stop_use_static_simple_vote_tx_cost [WIP] replay, leader pipeline: implement remove_simple_vote_from_cost_model Feb 26, 2026
Copilot AI review requested due to automatic review settings February 26, 2026 21:30
@topointon-jump topointon-jump force-pushed the stop-use-static-simple-vote-tx-cost branch from 9881f93 to b8919a9 Compare February 26, 2026 21:30
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link

Performance Measurements ⏳

Suite Baseline New Change
backtest mainnet-368528500-perf per slot 0.0743 s 0.074599 s 0.402%
backtest mainnet-368528500-perf snapshot load 4.654 s 3.205 s -31.135%
backtest mainnet-368528500-perf total elapsed 74.299979 s 74.599132 s 0.403%
firedancer mem usage with mainnet.toml 986.37 GiB 986.37 GiB 0.000%

@topointon-jump topointon-jump force-pushed the stop-use-static-simple-vote-tx-cost branch from b8919a9 to 94e9874 Compare February 26, 2026 22:43
@github-actions
Copy link

Performance Measurements ⏳

Suite Baseline New Change
backtest mainnet-368528500-perf per slot 0.052713 s 0.052343 s -0.702%
backtest mainnet-368528500-perf snapshot load 2.545 s 1.824 s -28.330%
backtest mainnet-368528500-perf total elapsed 52.712989 s 52.343187 s -0.702%
firedancer mem usage with mainnet.toml 986.37 GiB 986.37 GiB 0.000%

Copilot AI review requested due to automatic review settings February 26, 2026 23:08
@topointon-jump topointon-jump force-pushed the stop-use-static-simple-vote-tx-cost branch from 94e9874 to 4a73896 Compare February 26, 2026 23:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Comments suppressed due to low confidence (1)

src/discoh/bank/fd_bank_tile.c:270

  • In bank tile, simple-vote CU overrides are applied unconditionally. Once remove_simple_vote_from_cost_model is active, these overrides will under-report actual execution / loaded-account costs, which can inflate rebates and hide cases where actual CUs exceed requested (potentially letting pack overfill a block). Please gate this override on the feature being inactive (similar to fd_execle_tile.c), or plumb a feature-activation query from the ext bank so the tile can make the decision correctly.
    int is_simple_vote = 0;
    if( FD_UNLIKELY( is_simple_vote = fd_txn_is_simple_vote_transaction( TXN(txn), txn->payload ) ) ) {
      /* TODO: remove this once remove_simple_vote_from_cost_model is
               activated */

      /* Simple votes are charged fixed amounts of compute regardless of
      the real cost they incur.  fd_ext_bank_load_and_execute_txns
      returns the real cost, however, so we override it here. */
      actual_execution_cus = FD_PACK_VOTE_DEFAULT_COMPUTE_UNITS;
      actual_acct_data_cus = 0U;

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link

Performance Measurements ⏳

Suite Baseline New Change
backtest mainnet-368528500-perf per slot 0.074373 s 0.074609 s 0.317%
backtest mainnet-368528500-perf snapshot load 4.638 s 3.183 s -31.371%
backtest mainnet-368528500-perf total elapsed 74.373099 s 74.609334 s 0.318%
firedancer mem usage with mainnet.toml 986.37 GiB 986.37 GiB 0.000%

@topointon-jump topointon-jump force-pushed the stop-use-static-simple-vote-tx-cost branch from 4a73896 to a3798f9 Compare February 27, 2026 00:03
Copilot AI review requested due to automatic review settings February 27, 2026 00:04
@topointon-jump topointon-jump force-pushed the stop-use-static-simple-vote-tx-cost branch from a3798f9 to 6dc1397 Compare February 27, 2026 00:04
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link

Performance Measurements ⏳

Suite Baseline New Change
backtest mainnet-368528500-perf per slot 0.06339 s 0.063674 s 0.448%
backtest mainnet-368528500-perf snapshot load 3.499 s 2.227 s -36.353%
backtest mainnet-368528500-perf total elapsed 63.390484 s 63.673904 s 0.447%
firedancer mem usage with mainnet.toml 986.37 GiB 986.37 GiB 0.000%

@topointon-jump topointon-jump force-pushed the stop-use-static-simple-vote-tx-cost branch from 6dc1397 to 2d8a820 Compare February 27, 2026 00:32
@topointon-jump topointon-jump changed the title [WIP] replay, leader pipeline: implement remove_simple_vote_from_cost_model replay, leader pipeline: implement remove_simple_vote_from_cost_model Feb 27, 2026
@github-actions
Copy link

Performance Measurements ⏳

Suite Baseline New Change
backtest mainnet-368528500-perf per slot 0.052187 s 0.052534 s 0.665%
backtest mainnet-368528500-perf snapshot load 2.507 s 1.86 s -25.808%
backtest mainnet-368528500-perf total elapsed 52.186918 s 52.533986 s 0.665%
firedancer mem usage with mainnet.toml 986.37 GiB 986.37 GiB 0.000%

@topointon-jump topointon-jump enabled auto-merge (squash) February 27, 2026 19:15
Copilot AI review requested due to automatic review settings February 27, 2026 21:01
@topointon-jump topointon-jump force-pushed the stop-use-static-simple-vote-tx-cost branch from 2d8a820 to b143be4 Compare February 27, 2026 21:01
Copy link
Contributor

@ptaffet-jump ptaffet-jump left a comment

Choose a reason for hiding this comment

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

Looks good

@github-actions
Copy link

Performance Measurements ⏳

Suite Baseline New Change
backtest mainnet-368528500-perf per slot 0.061209 s 0.061016 s -0.315%
backtest mainnet-368528500-perf snapshot load 3.212 s 2.423 s -24.564%
backtest mainnet-368528500-perf total elapsed 61.209241 s 61.015515 s -0.316%
firedancer mem usage with mainnet.toml 983.37 GiB 983.37 GiB 0.000%

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

src/discoh/bank/fd_bank_tile.c:271

  • The simple-vote CU override here is unconditional. Once the remove_simple_vote_from_cost_model feature is active, simple votes should be charged their real execution + loaded-account-data cost (e.g., authorize w/ BLS PoP verification), so overriding to FD_PACK_VOTE_DEFAULT_COMPUTE_UNITS/0 will under-account consumed CUs and over-rebate. Gate this override on !FD_FEATURE_ACTIVE_BANK(ctx->_bank, remove_simple_vote_from_cost_model) (similar to fd_execle_tile.c), and only apply the fixed-cost override pre-activation.
    int is_simple_vote = 0;
    if( FD_UNLIKELY( is_simple_vote = fd_txn_is_simple_vote_transaction( TXN(txn), txn->payload ) ) ) {
      /* TODO: remove this once remove_simple_vote_from_cost_model is
               activated */

      /* Simple votes are charged fixed amounts of compute regardless of
      the real cost they incur.  fd_ext_bank_load_and_execute_txns
      returns the real cost, however, so we override it here. */
      actual_execution_cus = FD_PACK_VOTE_DEFAULT_COMPUTE_UNITS;
      actual_acct_data_cus = 0U;
    }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +453 to 467
/* TODO: remove this once remove_simple_vote_from_cost_model is
activated */
if( FD_UNLIKELY( fd_txn_is_simple_vote_transaction( TXN(txns + i), txns[ i ].payload ) ) ) {
/* Although bundles dont typically contain simple votes, we want
to charge them correctly anyways. */
/* FIXME: before remove_simple_vote_from_cost_model is activated
we need to change fd_ext_bank_load_and_execute_txns to
return the real cost of the transaction and remove
this conditional logic.

The plan is to do this in the next version of
Frankendancer as remove_simple_vote_from_cost_model is
an Agave 4.0 feature. */
consumed_cus[ i ] = FD_PACK_VOTE_DEFAULT_COMPUTE_UNITS;
} else {
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

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

Same as handle_microblock: this simple-vote override should be conditional on remove_simple_vote_from_cost_model not being active. After activation, forcing consumed_cus[i] to FD_PACK_VOTE_DEFAULT_COMPUTE_UNITS will under-account real vote instruction costs and can distort rebates/scheduling.

Copilot uses AI. Check for mistakes.
@topointon-jump topointon-jump merged commit bddfc8d into main Feb 27, 2026
17 checks passed
@topointon-jump topointon-jump deleted the stop-use-static-simple-vote-tx-cost branch February 27, 2026 21:08
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