Skip to content

runtime: implement vat pt1#8740

Merged
ibhatt-jumptrading merged 20 commits intomainfrom
ibhatt/vat
Mar 10, 2026
Merged

runtime: implement vat pt1#8740
ibhatt-jumptrading merged 20 commits intomainfrom
ibhatt/vat

Conversation

@ibhatt-jumptrading
Copy link
Copy Markdown
Contributor

@ibhatt-jumptrading ibhatt-jumptrading commented Mar 5, 2026

todo: ledger with vat enabled, pass vat set of validators across replay_epoch,

Copilot AI review requested due to automatic review settings March 5, 2026 14:43
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 5, 2026

Performance Measurements ⏳

Suite Baseline New Change
backtest mainnet-368528500-perf per slot 0.089377 s 0.089175 s -0.226%
backtest mainnet-368528500-perf snapshot load 5.684 s 4.383 s -22.889%
backtest mainnet-368528500-perf total elapsed 89.376603 s 89.174998 s -0.226%
firedancer mem usage with mainnet.toml 963.38 GiB 963.38 GiB 0.000%

Copy link
Copy Markdown
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 starts integrating “VAT” support into the runtime by introducing a new CoW-managed fd_top_votes_t state tracked per bank and stored in a shared pool alongside existing CoW fields (e.g. epoch leaders, cost tracker).

Changes:

  • Add a fixed maximum footprint constant for fd_top_votes_t storage.
  • Extend fd_bank/fd_banks shared-memory layout with a new top_votes CoW pool, per-bank dirty/index tracking, and a dedicated pool lock.
  • Implement fd_bank_top_votes_query() / fd_bank_top_votes_modify() and wire pool initialization/join/release paths into banks lifecycle (new/join/advance_root/prune/clear).

Reviewed changes

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

File Description
src/flamenco/stakes/fd_top_votes.h Introduces FD_TOP_VOTES_MAX_FOOTPRINT used to size bank-owned top-votes storage.
src/flamenco/runtime/fd_bank.h Adds fd_bank_top_votes_t pool type, bank/banks offsets + locks + query/modify API declarations.
src/flamenco/runtime/fd_bank.c Allocates/joins top-votes pool in shared memory and implements bank-level query/modify + pool release logic.

Comment thread src/flamenco/runtime/fd_bank.c Outdated
Comment on lines +458 to +463
bank->top_votes_pool_offset = (ulong)top_votes_pool - (ulong)bank;
}

static inline fd_bank_top_votes_t *
fd_bank_get_top_votes_pool( fd_bank_data_t * bank ) {
return fd_type_pun( (uchar *)bank + bank->top_votes_pool_offset );
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

fd_bank_set_top_votes_pool()/fd_bank_get_top_votes_pool() store and recover the pool pointer via fd_type_pun rather than using fd_bank_top_votes_pool_leave()/fd_bank_top_votes_pool_join(). This deviates from the existing epoch_leaders/cost_tracker pool pattern and makes the NULL checks in fd_bank_top_votes_{query,modify} ineffective (the getter cannot fail/validate magic). Consider mirroring the established pattern: store the "leave" pointer (shared-memory base) and have the getter return fd_bank_top_votes_pool_join(...), so misconfiguration/corruption is detected early and behavior is consistent across CoW pools.

Suggested change
bank->top_votes_pool_offset = (ulong)top_votes_pool - (ulong)bank;
}
static inline fd_bank_top_votes_t *
fd_bank_get_top_votes_pool( fd_bank_data_t * bank ) {
return fd_type_pun( (uchar *)bank + bank->top_votes_pool_offset );
void * top_votes_pool_mem = fd_bank_top_votes_pool_leave( top_votes_pool );
if( FD_UNLIKELY( !top_votes_pool_mem ) ) {
FD_LOG_CRIT(( "Failed to leave top votes pool" ));
}
bank->top_votes_pool_offset = (ulong)top_votes_pool_mem - (ulong)bank;
}
static inline fd_bank_top_votes_t *
fd_bank_get_top_votes_pool( fd_bank_data_t * bank ) {
return fd_bank_top_votes_pool_join( (uchar *)bank + bank->top_votes_pool_offset );

Copilot uses AI. Check for mistakes.
Comment on lines 25 to +28
#define FD_TOP_VOTES_ALIGN (128UL)

#define FD_TOP_VOTES_MAX_FOOTPRINT (1000000UL)

Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

FD_TOP_VOTES_MAX_FOOTPRINT is set to a hard-coded 1,000,000 bytes and is used to size every fd_bank_top_votes pool element. Given fd_top_votes is always constructed with vote_accounts_max=2000 in this PR, this constant likely over-allocates shared memory per fork by a large margin. Consider defining an explicit FD_TOP_VOTES_VOTE_ACCOUNTS_MAX and sizing the footprint constant to match fd_top_votes_footprint(FD_TOP_VOTES_VOTE_ACCOUNTS_MAX) (and/or adding a runtime assert that the computed footprint fits) to avoid unnecessary memory/IPC pressure as max_fork_width grows.

Suggested change
#define FD_TOP_VOTES_ALIGN (128UL)
#define FD_TOP_VOTES_MAX_FOOTPRINT (1000000UL)
#define FD_TOP_VOTES_ALIGN (128UL)
#define FD_TOP_VOTES_VOTE_ACCOUNTS_MAX (2000UL)
#define FD_TOP_VOTES_MAX_FOOTPRINT \
fd_top_votes_footprint( FD_TOP_VOTES_VOTE_ACCOUNTS_MAX )

Copilot uses AI. Check for mistakes.
Comment thread src/flamenco/runtime/fd_bank.c Outdated
Comment on lines +307 to +312
for( ulong i=0UL; i<max_fork_width; i++ ) {
fd_bank_top_votes_t * top_votes_ele = fd_bank_top_votes_pool_ele( top_votes_pool, i );
fd_top_votes_t * top_votes = fd_top_votes_join( fd_top_votes_new( top_votes_ele->data, 2000UL, seed ) ); /* TODO:FIXME: Magic number*/
if( FD_UNLIKELY( !top_votes ) ) {
FD_LOG_WARNING(( "Failed to create top votes" ));
return NULL;
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

In fd_banks_new(), fd_top_votes_new() is called with a hard-coded 2000UL ("TODO:FIXME: Magic number"). This should be a named constant shared with the VAT design (e.g. FD_TOP_VOTES_VOTE_ACCOUNTS_MAX) so the value is not duplicated and future changes don’t risk inconsistent sizing/logic (especially since the backing buffer size is also fixed via FD_TOP_VOTES_MAX_FOOTPRINT).

Copilot uses AI. Check for mistakes.
Comment thread src/flamenco/runtime/fd_bank.c Outdated
Comment on lines +301 to +316
fd_bank_top_votes_t * top_votes_pool = fd_bank_top_votes_pool_join( fd_bank_top_votes_pool_new( top_votes_pool_mem, max_fork_width ) );
if( FD_UNLIKELY( !top_votes_pool ) ) {
FD_LOG_WARNING(( "Failed to create top votes pool" ));
return NULL;
}
fd_banks_set_top_votes_pool( banks_data, top_votes_pool );
for( ulong i=0UL; i<max_fork_width; i++ ) {
fd_bank_top_votes_t * top_votes_ele = fd_bank_top_votes_pool_ele( top_votes_pool, i );
fd_top_votes_t * top_votes = fd_top_votes_join( fd_top_votes_new( top_votes_ele->data, 2000UL, seed ) ); /* TODO:FIXME: Magic number*/
if( FD_UNLIKELY( !top_votes ) ) {
FD_LOG_WARNING(( "Failed to create top votes" ));
return NULL;
}
fd_top_votes_init( top_votes );
}

Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

The new top-votes CoW pool integration adds non-trivial behavior (pool init in fd_banks_new, CoW modify/query, and pool-element release during advance_root/prune/clear) but there are no corresponding bank-level tests. There are existing unit tests in runtime/test_bank.c that exercise epoch_leaders CoW/pool behavior; adding analogous coverage for top_votes would help catch regressions (e.g., cloning vs reset, correct release on root advance).

Copilot uses AI. Check for mistakes.
Comment on lines +724 to +733
static inline fd_bank_top_votes_t *
fd_banks_get_top_votes_pool( fd_banks_data_t * banks_data ) {
return fd_type_pun( (uchar *)banks_data + banks_data->top_votes_pool_offset );
}

static inline void
fd_banks_set_top_votes_pool( fd_banks_data_t * banks_data,
fd_bank_top_votes_t * top_votes_pool ) {
banks_data->top_votes_pool_offset = (ulong)top_votes_pool - (ulong)banks_data;
}
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

fd_banks_set_top_votes_pool()/fd_banks_get_top_votes_pool() also use raw pointer arithmetic + fd_type_pun instead of the fd_bank_top_votes_pool_{leave,join} APIs. This makes joins less robust (no magic/alignment validation) and is inconsistent with fd_banks_set_epoch_leaders_pool()/get_epoch_leaders_pool. Consider storing the pool "leave" pointer and re-joining via fd_bank_top_votes_pool_join() for consistency and better corruption detection.

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 5, 2026

Performance Measurements ⏳

Suite Baseline New Change
backtest mainnet-368528500-perf per slot 0.07477 s 0.074981 s 0.282%
backtest mainnet-368528500-perf snapshot load 4.268 s 3.102 s -27.320%
backtest mainnet-368528500-perf total elapsed 74.77018 s 74.980905 s 0.282%
firedancer mem usage with mainnet.toml 963.38 GiB 963.38 GiB 0.000%

Copilot AI review requested due to automatic review settings March 5, 2026 15:46
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 5, 2026

Performance Measurements ⏳

Suite Baseline New Change
backtest mainnet-368528500-perf per slot 0.09022 s 0.0885 s -1.906%
backtest mainnet-368528500-perf snapshot load 5.775 s 4.359 s -24.519%
backtest mainnet-368528500-perf total elapsed 90.219846 s 88.500164 s -1.906%
firedancer mem usage with mainnet.toml 963.38 GiB 963.38 GiB 0.000%

Copy link
Copy Markdown
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 10 out of 10 changed files in this pull request and generated 7 comments.

Comment on lines +13 to +17
FD_TEST( fd_top_votes_query( top_votes, vote_pubkey, &node_out, &stake_out, &slot_out, &timestamp_out ) );
FD_TEST( !memcmp( &node_out, expected_node, sizeof(fd_pubkey_t) ) );
FD_TEST( stake_out==expected_stake );
FD_TEST( slot_out==expected_stake );
FD_TEST( timestamp_out==(long)expected_stake );
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

assert_vote_present compares slot_out and timestamp_out against expected_stake, which means the test will still pass even if last_vote_slot/last_vote_timestamp are wired incorrectly. Consider extending assert_vote_present to take expected_slot and expected_timestamp (and use different values in inserts) so the metadata fields are actually validated.

Copilot uses AI. Check for mistakes.

ulong last_vote_slot;
long last_vote_timestamp;
int found = fd_top_votes_query( top_votes, &pubkey, NULL, NULL, &last_vote_slot, &last_vote_timestamp );
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

fd_sysvar_clock.c calls fd_top_votes_query(top_votes, ...) unconditionally, but fd_bank_top_votes_query() can return NULL when the bank hasn't allocated a top-votes pool element yet. This will dereference a NULL pointer inside fd_top_votes_query; add a NULL check and fall back to the accdb path when top_votes is NULL.

Suggested change
int found = fd_top_votes_query( top_votes, &pubkey, NULL, NULL, &last_vote_slot, &last_vote_timestamp );
int found = 0;
if( FD_LIKELY( top_votes ) )
found = fd_top_votes_query( top_votes, &pubkey, NULL, NULL, &last_vote_slot, &last_vote_timestamp );

Copilot uses AI. Check for mistakes.
Comment thread src/discof/replay/fd_replay_tile.c Outdated
Comment thread src/flamenco/stakes/fd_top_votes.h Outdated
Comment thread src/flamenco/stakes/fd_top_votes.h Outdated
Comment on lines +69 to +76
/* fd_top_votes_update inserts a new vote account into the top votes set
given a vote account, node account, last vote slot, last vote
timestamp, and a stake. The node account, last vote slot, and last
vote timestamp are just metadata for the structure. If the vote
account isn't in the top max_vote_accounts in terms of stake, it is
ignored and is treated as a no-op. If the vote account ties the
minimum stake and the struct is full, all elements with that stake
are removed. */
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

The doc comment for fd_top_votes_insert still says "fd_top_votes_update inserts ...". This is confusing now that fd_top_votes_update exists again with different semantics; update the comment to refer to fd_top_votes_insert (and consider tightening wording around the parameters order: stake vs last_vote_slot/timestamp).

Copilot uses AI. Check for mistakes.
Comment on lines +226 to +239
void
fd_top_votes_update( fd_top_votes_t * top_votes,
fd_pubkey_t const * pubkey,
ulong last_vote_slot,
long last_vote_timestamp ) {
vote_ele_t * pool = get_pool( top_votes );
map_t * map = get_map( top_votes );

ushort idx = (ushort)map_idx_query_const( map, pubkey, USHORT_MAX, pool );
if( FD_UNLIKELY( idx==USHORT_MAX ) ) return;
vote_ele_t * ele = pool_ele( pool, idx );
ele->last_vote_slot = last_vote_slot;
ele->last_vote_timestamp = last_vote_timestamp;
}
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

fd_top_votes_update is new behavior (updates slot/timestamp for an existing entry) but there are no unit tests exercising it or verifying that fd_top_votes_query returns the updated metadata. Add a test case that inserts an entry, calls fd_top_votes_update with different values, and then queries the metadata to ensure it changes as expected.

Copilot uses AI. Check for mistakes.
Comment thread src/flamenco/stakes/fd_top_votes.c
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 5, 2026

Performance Measurements ⏳

Suite Baseline New Change
backtest mainnet-368528500-perf per slot 0.061158 s 0.060466 s -1.131%
backtest mainnet-368528500-perf snapshot load 3.226 s 2.766 s -14.259%
backtest mainnet-368528500-perf total elapsed 61.158493 s 60.466187 s -1.132%
firedancer mem usage with mainnet.toml 963.38 GiB 963.38 GiB 0.000%

Copilot AI review requested due to automatic review settings March 5, 2026 19:55
Copy link
Copy Markdown
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 11 out of 11 changed files in this pull request and generated 6 comments.

Comment thread src/flamenco/runtime/sysvar/fd_sysvar_clock.c
Comment thread src/flamenco/runtime/fd_bank.c
Comment thread src/flamenco/stakes/fd_top_votes.h Outdated
Comment thread src/flamenco/stakes/fd_top_votes.h Outdated
Comment thread src/flamenco/stakes/fd_top_votes.h Outdated
Comment thread src/flamenco/stakes/fd_top_votes.c
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 5, 2026

Performance Measurements ⏳

Suite Baseline New Change
backtest mainnet-368528500-perf per slot 0.072235 s 0.071998 s -0.328%
backtest mainnet-368528500-perf snapshot load 3.204 s 2.787 s -13.015%
backtest mainnet-368528500-perf total elapsed 72.234639 s 71.997765 s -0.328%
firedancer mem usage with mainnet.toml 963.38 GiB 963.38 GiB 0.000%

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 5, 2026

Performance Measurements ⏳

Suite Baseline New Change
backtest mainnet-368528500-perf per slot 0.083966 s 0.082917 s -1.249%
backtest mainnet-368528500-perf snapshot load 3.855 s 3.324 s -13.774%
backtest mainnet-368528500-perf total elapsed 83.966161 s 82.9167 s -1.250%
firedancer mem usage with mainnet.toml 963.38 GiB 963.38 GiB 0.000%

Copilot AI review requested due to automatic review settings March 5, 2026 22:57
Copy link
Copy Markdown
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 14 out of 14 changed files in this pull request and generated 8 comments.

Comment thread src/flamenco/stakes/fd_top_votes.h Outdated
Comment thread src/flamenco/stakes/fd_top_votes.c
Comment thread src/flamenco/stakes/fd_top_votes.c
Comment thread src/flamenco/runtime/fd_bank.c Outdated
Comment thread src/flamenco/runtime/sysvar/fd_sysvar_clock.c
Comment thread src/discof/replay/fd_replay_tile.c
Comment thread src/flamenco/runtime/fd_bank.c
Comment thread src/flamenco/stakes/fd_top_votes.h
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 5, 2026

Performance Measurements ⏳

Suite Baseline New Change
backtest mainnet-368528500-perf per slot 0.061173 s 0.060897 s -0.451%
backtest mainnet-368528500-perf snapshot load 3.155 s 2.39 s -24.247%
backtest mainnet-368528500-perf total elapsed 61.172539 s 60.897139 s -0.450%
firedancer mem usage with mainnet.toml 963.38 GiB 963.38 GiB 0.000%

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 9, 2026

Performance Measurements ⏳

Suite Baseline New Change
backtest mainnet-368528500-perf per slot 0.089631 s 0.088689 s -1.051%
backtest mainnet-368528500-perf snapshot load 5.788 s 4.42 s -23.635%
backtest mainnet-368528500-perf total elapsed 89.630558 s 88.688961 s -1.051%
firedancer mem usage with mainnet.toml 963.38 GiB 963.38 GiB 0.000%

@github-actions
Copy link
Copy Markdown

Performance Measurements ⏳

Suite Baseline New Change
backtest mainnet-368528500-perf per slot 0.061152 s 0.060947 s -0.335%
backtest mainnet-368528500-perf snapshot load 3.216 s 2.422 s -24.689%
backtest mainnet-368528500-perf total elapsed 61.152432 s 60.94654 s -0.337%
firedancer mem usage with mainnet.toml 963.38 GiB 963.38 GiB 0.000%

Copy link
Copy Markdown
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 19 out of 19 changed files in this pull request and generated 3 comments.

Comment thread src/flamenco/runtime/fd_bank.c
Comment thread src/flamenco/runtime/sysvar/fd_sysvar_clock.c
Comment thread src/flamenco/runtime/fd_runtime.c
@github-actions
Copy link
Copy Markdown

Performance Measurements ⏳

Suite Baseline New Change
backtest mainnet-368528500-perf per slot 0.06107 s 0.060889 s -0.296%
backtest mainnet-368528500-perf snapshot load 3.101 s 2.384 s -23.122%
backtest mainnet-368528500-perf total elapsed 61.069675 s 60.889374 s -0.295%
firedancer mem usage with mainnet.toml 963.4 GiB 963.4 GiB 0.000%

Copilot AI review requested due to automatic review settings March 10, 2026 15:49
@github-actions
Copy link
Copy Markdown

Performance Measurements ⏳

Suite Baseline New Change
backtest mainnet-368528500-perf per slot 0.060897 s 0.060569 s -0.539%
backtest mainnet-368528500-perf snapshot load 3.122 s 2.376 s -23.895%
backtest mainnet-368528500-perf total elapsed 60.897493 s 60.569148 s -0.539%
firedancer mem usage with mainnet.toml 963.4 GiB 963.4 GiB 0.000%

Copy link
Copy Markdown
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 19 out of 19 changed files in this pull request and generated 5 comments.

Comment thread src/flamenco/stakes/fd_top_votes.c Outdated
Comment on lines +104 to +106
FD_SCRATCH_ALLOC_FINI( l, fd_top_votes_align() );

if( FD_UNLIKELY( FD_SCRATCH_ALLOC_FINI( l, fd_top_votes_align() ) != (ulong)top_votes + fd_top_votes_footprint( vote_accounts_max ) ) ) {
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

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

fd_top_votes_new calls FD_SCRATCH_ALLOC_FINI( l, fd_top_votes_align() ) twice in a row. The macro mutates l, so calling it twice is redundant/confusing and makes it easier to accidentally introduce layout bugs later. Consider capturing the return value from a single FD_SCRATCH_ALLOC_FINI call and using that for the layout check (or remove the first call).

Suggested change
FD_SCRATCH_ALLOC_FINI( l, fd_top_votes_align() );
if( FD_UNLIKELY( FD_SCRATCH_ALLOC_FINI( l, fd_top_votes_align() ) != (ulong)top_votes + fd_top_votes_footprint( vote_accounts_max ) ) ) {
ulong l_end = FD_SCRATCH_ALLOC_FINI( l, fd_top_votes_align() );
if( FD_UNLIKELY( l_end != (ulong)top_votes + fd_top_votes_footprint( vote_accounts_max ) ) ) {

Copilot uses AI. Check for mistakes.
Comment thread src/flamenco/stakes/fd_top_votes.c
Comment thread src/flamenco/runtime/sysvar/fd_sysvar_clock.c
Comment thread src/flamenco/runtime/sysvar/fd_sysvar_clock.c
Comment thread src/discof/replay/fd_replay_tile.c
@ibhatt-jumptrading ibhatt-jumptrading changed the title runtime: implement vat [wip] runtime: implement vat Mar 10, 2026
@github-actions
Copy link
Copy Markdown

Performance Measurements ⏳

Suite Baseline New Change
backtest mainnet-368528500-perf per slot 0.083843 s 0.083092 s -0.896%
backtest mainnet-368528500-perf snapshot load 3.9 s 3.432 s -12.000%
backtest mainnet-368528500-perf total elapsed 83.843314 s 83.091833 s -0.896%
firedancer mem usage with mainnet.toml 963.4 GiB 963.4 GiB 0.000%

Copilot AI review requested due to automatic review settings March 10, 2026 19:27
@github-actions
Copy link
Copy Markdown

Performance Measurements ⏳

Suite Baseline New Change
backtest mainnet-368528500-perf per slot 0.089903 s 0.088946 s -1.064%
backtest mainnet-368528500-perf snapshot load 5.814 s 4.42 s -23.977%
backtest mainnet-368528500-perf total elapsed 89.903214 s 88.945981 s -1.065%
firedancer mem usage with mainnet.toml 994.41 GiB 994.41 GiB 0.000%

Copy link
Copy Markdown
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 20 out of 20 changed files in this pull request and generated 4 comments.

Comment thread src/flamenco/stakes/fd_stakes.c
Comment thread src/flamenco/stakes/fd_stakes.c Outdated
Comment thread src/discof/replay/fd_replay_tile.c
Comment thread src/flamenco/runtime/fd_bank.c
@github-actions
Copy link
Copy Markdown

Performance Measurements ⏳

Suite Baseline New Change
backtest mainnet-368528500-perf per slot 0.061288 s 0.060802 s -0.793%
backtest mainnet-368528500-perf snapshot load 3.186 s 2.383 s -25.204%
backtest mainnet-368528500-perf total elapsed 61.28805 s 60.801991 s -0.793%
firedancer mem usage with mainnet.toml 994.41 GiB 994.41 GiB 0.000%

Copilot AI review requested due to automatic review settings March 10, 2026 20:12
@github-actions
Copy link
Copy Markdown

Performance Measurements ⏳

Suite Baseline New Change
backtest mainnet-368528500-perf per slot 0.061286 s 0.060904 s -0.623%
backtest mainnet-368528500-perf snapshot load 3.246 s 2.479 s -23.629%
backtest mainnet-368528500-perf total elapsed 61.286082 s 60.904384 s -0.623%
firedancer mem usage with mainnet.toml 994.41 GiB 994.41 GiB 0.000%

Copy link
Copy Markdown
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 21 out of 21 changed files in this pull request and generated 4 comments.

Comment on lines +1142 to 1144
fd_top_votes_t * top_votes = fd_bank_top_votes_modify( bank );
for( ushort i=0; i<txn_out->accounts.cnt; i++ ) {
/* We are only interested in saving writable accounts and the fee
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

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

fd_runtime_commit_txn unconditionally calls fd_bank_top_votes_modify( bank ) before scanning accounts. This can trigger an unnecessary CoW allocation + ~194KB memcpy for transactions that don't touch any vote accounts. Consider lazily calling fd_bank_top_votes_modify only when a vote-program-owned account is encountered (or when the VAT feature is active and the cache is actually needed).

Copilot uses AI. Check for mistakes.
Comment thread src/flamenco/stakes/fd_vote_stakes_private.h
Comment thread src/flamenco/runtime/fd_bank.c
Comment thread src/flamenco/stakes/fd_top_votes.c
@ibhatt-jumptrading ibhatt-jumptrading changed the title runtime: implement vat runtime: implement vat pt1 Mar 10, 2026
@ibhatt-jumptrading ibhatt-jumptrading merged commit 0d394a6 into main Mar 10, 2026
21 checks passed
@ibhatt-jumptrading ibhatt-jumptrading deleted the ibhatt/vat branch March 10, 2026 21:21
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