Skip to content

Commit

Permalink
flamenco: change hardcoded to use cluster version
Browse files Browse the repository at this point in the history
  • Loading branch information
kbhargava-jump committed Jul 10, 2024
1 parent 604cc53 commit 25e2637
Show file tree
Hide file tree
Showing 9 changed files with 263 additions and 259 deletions.
2 changes: 1 addition & 1 deletion src/app/fddev/configure/genesis.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ create_genesis( config_t * const config,

fd_features_t features[1];
fd_features_disable_all( features );
fd_features_enable_hardcoded( features );
fd_features_enable_hardcoded( features, 1900 );
default_enable_features( features );

options->features = features;
Expand Down
3 changes: 2 additions & 1 deletion src/app/ledger/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -965,6 +965,7 @@ replay( fd_ledger_args_t * args ) {
args->epoch_ctx = fd_exec_epoch_ctx_join( fd_exec_epoch_ctx_new( epoch_ctx_mem, args->vote_acct_max ) );

args->epoch_ctx->epoch_bank.cluster_version = args->cluster_version;
fd_features_enable_hardcoded( &args->epoch_ctx->features, args->epoch_ctx->epoch_bank.cluster_version );

args->slot_ctx = fd_exec_slot_ctx_join( fd_exec_slot_ctx_new( slot_ctx_mem, valloc ) );
args->slot_ctx->epoch_ctx = args->epoch_ctx;
Expand Down Expand Up @@ -1332,7 +1333,7 @@ initial_setup( int argc, char ** argv, fd_ledger_args_t * args ) {
int use_funk_wksp = fd_env_strip_cmdline_int ( &argc, &argv, "--use-funk-wksp", NULL, 1 );
char const * rocksdb_list = fd_env_strip_cmdline_cstr ( &argc, &argv, "--rocksdb", NULL, NULL );
char const * rocksdb_list_starts = fd_env_strip_cmdline_cstr ( &argc, &argv, "--rocksdb-starts", NULL, NULL );
uint cluster_version = fd_env_strip_cmdline_uint ( &argc, &argv, "--cluster-version", NULL, 2000 );
uint cluster_version = fd_env_strip_cmdline_uint ( &argc, &argv, "--cluster-version", NULL, 1900 );


#ifdef _ENABLE_LTHASH
Expand Down
2 changes: 1 addition & 1 deletion src/flamenco/features/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# python3.8 -m pip install fd58 --user
# PYTHON=python3.8 make

PYTHON?=python3
PYTHON?=python3.8
BLACK?=$(PYTHON) -m black

.PHONY: generate
Expand Down
6 changes: 4 additions & 2 deletions src/flamenco/features/fd_features.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ fd_features_disable_all( fd_features_t * f ) {
}

void
fd_features_enable_hardcoded( fd_features_t * f ) {
fd_features_enable_hardcoded( fd_features_t * f, uint cluster_version ) {
for( fd_feature_id_t const * id = fd_feature_iter_init();
!fd_feature_iter_done( id );
id = fd_feature_iter_next( id ) ) {
if( id->hardcoded ) {
if( id->hardcoded && id->hardcoded <= cluster_version ) {
fd_features_set( f, id, 0UL );
} else {
fd_features_set( f, id, FD_FEATURE_DISABLED );
}
}
}
4 changes: 2 additions & 2 deletions src/flamenco/features/fd_features.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ struct fd_feature_id {
ulong index; /* index of feature in fd_features_t */
fd_pubkey_t id; /* pubkey of feature */
char const * name; /* feature name cstr */
uint hardcoded : 1; /* is always enabled in Firedancer? */
uint hardcoded; /* is always enabled in Firedancer? */
};
typedef struct fd_feature_id fd_feature_id_t;

Expand All @@ -69,7 +69,7 @@ fd_features_enable_all( fd_features_t * );
of the Firedancer software and can't be disabled. */

void
fd_features_enable_hardcoded( fd_features_t * );
fd_features_enable_hardcoded( fd_features_t *, uint);

/* fd_feature_iter_{...} is an iterator-style API over all supported
features in this version of Firedancer. Usage:
Expand Down
249 changes: 125 additions & 124 deletions src/flamenco/features/fd_features_generated.c

Large diffs are not rendered by default.

248 changes: 124 additions & 124 deletions src/flamenco/features/feature_map.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/flamenco/features/gen_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ def pubkey_to_c_array(pubkey):
file=body,
end="",
)
if x.get("hardcoded") == 1:
print(f",\n .hardcoded = 1", file=body, end="")
if x.get("hardcoded"):
print(f",\n .hardcoded = {x.get('hardcoded')}", file=body, end="")
print(" },\n", file=body)
print(
f""" {{ .index = ULONG_MAX }}
Expand Down
4 changes: 2 additions & 2 deletions src/flamenco/runtime/context/fd_exec_epoch_ctx.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ fd_exec_epoch_ctx_new( void * mem,
self->layout = *layout;

fd_features_disable_all( &self->features );
fd_features_enable_hardcoded( &self->features );
fd_features_enable_hardcoded( &self->features, self->epoch_bank.cluster_version );

fd_epoch_bank_new( &self->epoch_bank );

self->epoch_bank.cluster_version = 2000;
self->epoch_bank.cluster_version = 1900;

void * stake_votes_mem = (void *)( (ulong)mem + layout->stake_votes_off );
void * stake_delegations_mem = (void *)( (ulong)mem + layout->stake_delegations_off );
Expand Down

0 comments on commit 25e2637

Please sign in to comment.