From 4245f68a23a4df42a83091be53caaefe07869d10 Mon Sep 17 00:00:00 2001 From: Richard Patel Date: Sun, 21 Apr 2024 01:37:50 +0000 Subject: [PATCH] genesis: use flamenco features API --- .../fddev/configure/dump_genesis_features.py | 187 ------------------ src/app/fddev/configure/genesis.c | 84 +++++++- src/app/fddev/configure/genesis_features.bin | Bin 5728 -> 0 bytes src/flamenco/features/fd_features.h | 4 +- src/flamenco/genesis/fd_genesis_create.c | 31 ++- src/flamenco/genesis/fd_genesis_create.h | 15 +- src/flamenco/genesis/test_genesis_create.c | 16 +- 7 files changed, 117 insertions(+), 220 deletions(-) delete mode 100644 src/app/fddev/configure/dump_genesis_features.py delete mode 100644 src/app/fddev/configure/genesis_features.bin diff --git a/src/app/fddev/configure/dump_genesis_features.py b/src/app/fddev/configure/dump_genesis_features.py deleted file mode 100644 index 671221feda..0000000000 --- a/src/app/fddev/configure/dump_genesis_features.py +++ /dev/null @@ -1,187 +0,0 @@ -import base58 -import sys - -features = """16FMCmgLzCNNz6eTwGanbyN2ZxvTBSLuQ6DZhgeMshg -SAdVFw3RZvzbo6DvySbSdBnHN4gkzSTH9dSxesyKKPj -SVn36yVApPLYsa8koK3qUcy14zXDnqkNYWyUh1f4oK1 -St8k9dVXP97xT6faW24YmRSYConLbhsMJA4TJTBLmMT -Vo5siZ442SaZBKPXNocthiXysNviW4UYPwRFggmbgAp -capRxUrBjNkkCpjrJxPGfPaWijB7q3JoDfsWXAnt46r -dupPajaLy2SSn8ko42aZz4mHANDNrLe8Nw8VQgFecLa -eca6zf6JJRjQsYYPkBHF3N32MTzur4n2WL4QiiacPCL -meRgp4ArRPhD3KtCY9c5yAf2med7mBLsjKTPeVUHqBL -nWBqjr3gpETbiaVj3CBJ3HFC5TMdnJDGt21hnvSTvVZ -noRuG2kzACwgaY7TVmLRnUNPLKNVQE1fb7X55YWBehp -prpFrMtgNmzaNzkPJg9o753fVvbHKqNrNTm76foJ2wm -qywiJyZmqTKspFg2LeuUHqcA5nNvBgob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', 'wb') as f: - for feature in features: - f.write(base58.b58decode(feature)) - diff --git a/src/app/fddev/configure/genesis.c b/src/app/fddev/configure/genesis.c index edbe94539c..62a2ae1600 100644 --- a/src/app/fddev/configure/genesis.c +++ b/src/app/fddev/configure/genesis.c @@ -11,13 +11,80 @@ #include "../../../ballet/poh/fd_poh.h" #include "../../../disco/keyguard/fd_keyload.h" +#include "../../../flamenco/features/fd_features.h" #include "../../../flamenco/genesis/fd_genesis_create.h" #include "../../../flamenco/types/fd_types_custom.h" #include "../../../flamenco/runtime/sysvar/fd_sysvar_clock.h" #define NAME "genesis" -FD_IMPORT( feature_gate, "src/app/fddev/configure/genesis_features.bin", fd_pubkey_t, 5, "" ); +/* default_enable_features is a table of features enabled by default */ + +static void +default_enable_features( fd_features_t * features ) { + features->index_erasure_conflict_duplicate_proofs = 0UL; + features->curve25519_restrict_msm_length = 0UL; + features->commission_updates_only_allowed_in_first_half_of_epoch = 0UL; + features->validate_fee_collector_account = 0UL; + features->zk_token_sdk_enabled = 0UL; + features->enable_zk_transfer_with_fee = 0UL; + features->incremental_snapshot_only_incremental_hash_calculation = 0UL; + features->stake_redelegate_instruction = 0UL; + features->timely_vote_credits = 0UL; + features->apply_cost_tracker_during_replay = 0UL; + features->reject_callx_r10 = 0UL; + features->update_hashes_per_tick = 0UL; + features->enable_partitioned_epoch_reward = 0UL; + features->pico_inflation = 0UL; + features->libsecp256k1_fail_on_bad_count2 = 0UL; + features->remaining_compute_units_syscall_enabled = 0UL; + features->simplify_writable_program_account_check = 0UL; + features->set_exempt_rent_epoch_max = 0UL; + features->enable_bpf_loader_set_authority_checked_ix = 0UL; + features->consume_blockstore_duplicate_proofs = 0UL; + features->disable_deploy_of_alloc_free_syscall = 0UL; + features->disable_bpf_loader_instructions = 0UL; + features->full_inflation_enable = 0UL; + features->vote_state_add_vote_latency = 0UL; + features->curve25519_syscall_enabled = 0UL; + features->error_on_syscall_bpf_function_hash_collisions = 0UL; + features->update_hashes_per_tick3 = 0UL; + features->update_hashes_per_tick4 = 0UL; + features->enable_bpf_loader_extend_program_ix = 0UL; + features->libsecp256k1_fail_on_bad_count = 0UL; + features->enable_program_runtime_v2_and_loader_v4 = 0UL; + features->increase_tx_account_lock_limit = 0UL; + features->stake_raise_minimum_delegation_to_1_sol = 0UL; + features->enable_alt_bn128_syscall = 0UL; + features->revise_turbine_epoch_stakes = 0UL; + features->clean_up_delegation_errors = 0UL; + features->update_hashes_per_tick5 = 0UL; + features->full_inflation_vote = 0UL; + features->skip_rent_rewrites = 0UL; + features->switch_to_new_elf_parser = 0UL; + features->require_rent_exempt_split_destination = 0UL; + features->enable_turbine_fanout_experiments = 0UL; + features->devnet_and_testnet = 0UL; + features->enable_big_mod_exp_syscall = 0UL; + features->enable_alt_bn128_compression_syscall = 0UL; + features->update_hashes_per_tick2 = 0UL; + features->include_loaded_accounts_data_size_in_fee_calculation = 0UL; + features->bpf_account_data_direct_mapping = 0UL; + features->relax_authority_signer_check_for_lookup_table_creation = 0UL; + features->update_hashes_per_tick6 = 0UL; + features->enable_poseidon_syscall = 0UL; + features->better_error_codes_for_tx_lamport_check = 0UL; + features->stake_minimum_delegation_for_rewards = 0UL; + features->loosen_cpi_size_restriction = 0UL; + features->drop_legacy_shreds = 0UL; + features->deprecate_rewards_sysvar = 0UL; + features->warp_timestamp_again = 0UL; + features->reduce_stake_warmup_cooldown = 0UL; + features->disable_turbine_fanout_experiments = 0UL; + features->blake3_syscall_enabled = 0UL; + features->last_restart_slot_sysvar = 0UL; + features->disable_fees_sysvar = 0UL; +} /* estimate_hashes_per_tick approximates the PoH hashrate of the current tile. Spins PoH hashing for estimate_dur_ns nanoseconds. Returns @@ -120,15 +187,12 @@ create_genesis( config_t * const config, options->fund_initial_accounts = config->development.genesis.fund_initial_accounts; options->fund_initial_amount_lamports = config->development.genesis.fund_initial_amount_lamports; - /* Enable features gates */ - ulong feature_gate_cnt = feature_gate_sz/32UL; - FD_LOG_INFO(( "Enabling %lu feature gates", feature_gate_cnt )); - for( ulong i=0UL; ifeatures = features; /* Serialize blob */ @@ -137,7 +201,7 @@ create_genesis( config_t * const config, fd_scratch_attach( scratch_smem, scratch_fmem, sizeof(scratch_smem), sizeof(scratch_fmem)/sizeof(ulong) ); - ulong blob_len = fd_genesis_create( blob, blob_sz, options, feature_gate, feature_gate_sz/32UL ); + ulong blob_len = fd_genesis_create( blob, blob_sz, options ); if( FD_UNLIKELY( !blob_sz ) ) FD_LOG_ERR(( "Failed to create genesis blob" )); FD_LOG_DEBUG(( "Created genesis blob (sz=%lu)", blob_len )); diff --git a/src/app/fddev/configure/genesis_features.bin b/src/app/fddev/configure/genesis_features.bin deleted file mode 100644 index cae1a3061c64a03eea3ea2c80c5006ecd87ada2f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5728 zcmV-m7N6+=1@7pd*ikQ0oWXX=yWsXZIbjLfrA?Z*n46bUP8Bab21_4EQbCDhz`=%x|U~;5iF4dcelyK)C88~w@i;@`*%Nt))M3f zp;k)2abtfL$$efBNh1ekY$K6A|w=IyyxJ1=lADbfGI8a4uQ) z3HxoTM;ABrrNa9Q*=sY)lf(?&Mo%LNqP4t;P?f$-;aFOK^J8+sZ$LVlNDtFd)3c?< z3`>y2LZ7Z< zDJ+btlo{dnwAmJ3L$t@SAK;w<*$TxRaDNmGj6=-()0t? zdWVShfx9^j?9UH79q#k|(X0U6KbSGDYo~`6N0g;^x`#mXD1;Uc%Dz%!V?@6UZ2D^ad6!BSrjEcOsWzN z=5EuF1B2D2vh3#At)pOHO)9Y4tL`qElx9>$(PB0b9^>Y*Lsf+d58!OJr5@-qNh<7? zbl{qn$A-v&XqYqvYTeIyXMms#`2_ANf~kwj#LTg0Ok2y)O1Fx)Q+;3r!EximF) z@h;_4BcAboRpGr#9#$h6AfW>8?5zf;ULD>F&+pOOIdf%-qK+d0b%X0|x1u~5!4oWM z)gh3Nb_BHResuKkB7SV$#tNsBXgKX9NQ7@=e(#fugq;6cy6 zJG>67Mk3yu8-{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)@ZYc0U1Aj)ZQlC98)X#AO~(d;MFRPh>IoKwusWp5!h=|(3^qhw^nqfHgYjd zU%75>hZ=8shf0b3G1Mp2s_#=vTA{6w_({1FMI}5;IYub7wzT>|4YeMjPpI|O+Tv=D z@JVcBWIiWc$iS3!8SRn_VIg1<_nIxPk z@SPA)CqTHT6K&oS?^AUSI_JXJmD5Q0#VX(}l;WVb0p`dE70#0vc2lKFe;vaa;{1Eq zmD7?_N351@W`{y1v0J64oi>aH(juH*o>Di3&-ssfRwzs|XCCQ+=C0k! zXJ(y)!h%+~PV}zX$V3DPn#p@1n_dzdR&d3{;&W$*X_9yz(AsClE^PMM`AMkiYjhz> zOcaFDa|buUm9^a5&6#+- z66jUkNf#6*5Ao=shu}L)fL-3yQqz!56ilMUnK?fd@;8OxG0n#u_gGY&pIAGk>xDX-)Q;g5nL?c zYNjWV>^<7zJ7Y-S?%1ZWpkR)6ub!-r1VpsOCd&;Dukxl*yVhIe&Nii{l));SOPv`$ zUR7roXLpT0;_4~jqy+7VB_{Xfr&Hw0)T zH(DM@CujX~_KQU*3Ql4HDLSQNp#x2s2q|2Tx&y53m09mMmDi z>7PvOfufX@iKP1L%1yPJUnv87yM%sp|m?nZ(Ko+w1Iunqa{Zu#oj zRa{G3XY3$^MCALGcf1}Bvbt11=NVp*vk;o`hWMP6@6r4PW}iXvo=Buew)oK|ws(Dp z-W+t`lm8L%*73iNR5?UFDN?Y+1a0&$1M8K;6TGc#8<7p;y?lc7fV@9k-Qva8t$_;fX&RKyJZi5FO6rHm9 zxD!i`W*a~#9PPe*c#N4Fla@5r$qU}DxZ7F=eTR70 z(bsUejF7uU)5-Vz37l84apkZR4d=`e@+Nl8m_ SP1Ai%#n>%gq08(|`$>~?Haofi diff --git a/src/flamenco/features/fd_features.h b/src/flamenco/features/fd_features.h index 9a0cf6ca52..d3e9f12796 100644 --- a/src/flamenco/features/fd_features.h +++ b/src/flamenco/features/fd_features.h @@ -75,9 +75,9 @@ fd_features_enable_hardcoded( fd_features_t * ); for( fd_feature_id_t const * id = fd_feature_iter_init(); !fd_feature_iter_done( id ); - id = fd_feature_iter_next( id ) ) {{ + id = fd_feature_iter_next( id ) ) { ... - }} */ + } */ static inline fd_feature_id_t const * fd_feature_iter_init( void ) { diff --git a/src/flamenco/genesis/fd_genesis_create.c b/src/flamenco/genesis/fd_genesis_create.c index 6150d66143..b80f68f855 100644 --- a/src/flamenco/genesis/fd_genesis_create.c +++ b/src/flamenco/genesis/fd_genesis_create.c @@ -16,9 +16,7 @@ static ulong genesis_create( void * buf, ulong bufsz, - fd_genesis_options_t const * options, - fd_pubkey_t const * feature_gates, - ulong feature_gate_cnt ) { + fd_genesis_options_t const * options ) { # define REQUIRE(c) \ do { \ @@ -183,12 +181,27 @@ genesis_create( void * buf, REQUIRE( fd_stake_state_v2_encode( state, &encode ) == FD_BINCODE_SUCCESS ); } while(0); + /* Read enabled features */ + + ulong feature_cnt = 0UL; + fd_pubkey_t * features = + fd_scratch_alloc( alignof(fd_pubkey_t), FD_FEATURE_ID_CNT * sizeof(fd_pubkey_t) ); + + if( options->features ) { + for( fd_feature_id_t const * id = fd_feature_iter_init(); + !fd_feature_iter_done( id ); + id = fd_feature_iter_next( id ) ) { + if( fd_features_get( options->features, id ) == 0UL ) + features[ feature_cnt++ ] = id->id; + } + } + /* Allocate the account table */ ulong default_funded_cnt = options->fund_initial_accounts; ulong default_funded_idx = genesis->accounts_len; genesis->accounts_len += default_funded_cnt; - ulong feature_gate_idx = genesis->accounts_len; genesis->accounts_len += feature_gate_cnt; + ulong feature_gate_idx = genesis->accounts_len; genesis->accounts_len += feature_cnt; genesis->accounts = fd_scratch_alloc( alignof(fd_pubkey_account_pair_t), genesis->accounts_len * sizeof(fd_pubkey_account_pair_t) ); @@ -241,10 +254,10 @@ genesis_create( void * buf, ulong default_feature_enabled_balance = fd_rent_exempt_minimum_balance2( &genesis->rent, FEATURE_ENABLED_SZ ); /* Set up feature gate accounts */ - for( ulong j=0UL; jaccounts[ feature_gate_idx+j ]; - pair->key = feature_gates[ j ]; + pair->key = features[ j ]; pair->account = (fd_solana_account_t) { .lamports = default_feature_enabled_balance, .data_len = FEATURE_ENABLED_SZ, @@ -286,11 +299,9 @@ genesis_create( void * buf, ulong fd_genesis_create( void * buf, ulong bufsz, - fd_genesis_options_t const * options, - fd_pubkey_t const * feature_gates, - ulong feature_gate_cnt ) { + fd_genesis_options_t const * options ) { fd_scratch_push(); - ulong ret = genesis_create( buf, bufsz, options, feature_gates, feature_gate_cnt ); + ulong ret = genesis_create( buf, bufsz, options ); fd_scratch_pop(); return ret; } diff --git a/src/flamenco/genesis/fd_genesis_create.h b/src/flamenco/genesis/fd_genesis_create.h index 4af6cafcb4..527dea6aeb 100644 --- a/src/flamenco/genesis/fd_genesis_create.h +++ b/src/flamenco/genesis/fd_genesis_create.h @@ -5,6 +5,7 @@ A genesis blob is used to bootstrap a Solana ledger. */ #include "../fd_flamenco_base.h" +#include "../features/fd_features.h" /* fd_genesis_options_t exists as a convenient way to specify options @@ -25,6 +26,11 @@ struct fd_genesis_options { ulong fund_initial_accounts; ulong fund_initial_amount_lamports; + + /* features points to an externally owned feature map. + Adds a feature account to the genesis blob for feature enabled at + slot 0. If features==NULL, creates no feature accounts. */ + fd_features_t const * features; }; typedef struct fd_genesis_options fd_genesis_options_t; @@ -35,9 +41,6 @@ FD_PROTOTYPES_BEGIN (Bincode encoded fd_genesis_solana_t) [buf,bufsz) it the output memory region into which the genesis blob will be written. options points to a struct containing the genesis configuration parameters. - Additionally, the feature gates corresponding to the pubkeys - feature_gates[ i ] for i in [0, feature_gate_cnt) will be active from - genesis. feature_gates==NULL is okay if feature_gate_cnt==0. Returns the number of bytes in the output memory region used on success. On failure, returns 0UL and logs reason for error. @@ -51,11 +54,9 @@ FD_PROTOTYPES_BEGIN ulong fd_genesis_create( void * buf, ulong bufsz, - fd_genesis_options_t const * options, - fd_pubkey_t const * feature_gates, - ulong feature_gate_cnt ); + fd_genesis_options_t const * options ); -/* TODO Add method to estimate the scratch and genesis blob size given a pod */ +/* TODO Add method to estimate the scratch and genesis blob size given options */ FD_PROTOTYPES_END diff --git a/src/flamenco/genesis/test_genesis_create.c b/src/flamenco/genesis/test_genesis_create.c index f61ca74cbf..b565b70532 100644 --- a/src/flamenco/genesis/test_genesis_create.c +++ b/src/flamenco/genesis/test_genesis_create.c @@ -13,7 +13,7 @@ main( int argc, int log_level = fd_log_level_logfile(); fd_log_level_logfile_set( fd_int_max( log_level, 4 ) ); - static uchar scratch_smem[ 8192 ]; + static uchar scratch_smem[ 16384 ]; ulong scratch_fmem[ 4 ]; fd_scratch_attach( scratch_smem, scratch_fmem, sizeof(scratch_smem), sizeof(scratch_fmem)/sizeof(ulong) ); @@ -32,7 +32,7 @@ main( int argc, /* Buffer too small */ - FD_TEST( !fd_genesis_create( NULL, 0UL, options, NULL, 0UL ) ); + FD_TEST( !fd_genesis_create( NULL, 0UL, options ) ); /* No more warnings expected */ @@ -41,13 +41,21 @@ main( int argc, /* Serialize to buffer */ static uchar result_mem[ BUFSZ ]; - ulong result_sz = fd_genesis_create( result_mem, sizeof(result_mem), options, NULL, 0UL ); + ulong result_sz = fd_genesis_create( result_mem, sizeof(result_mem), options ); FD_TEST( result_sz ); /* Now try adding a few accounts */ options->fund_initial_accounts = 16UL; - result_sz = fd_genesis_create( result_mem, sizeof(result_mem), options, NULL, 0UL ); + result_sz = fd_genesis_create( result_mem, sizeof(result_mem), options ); + FD_TEST( result_sz ); + + /* Add a feature gate */ + fd_features_t features[1]; + fd_features_disable_all( features ); + features->full_inflation_vote = 0UL; + options->features = features; + result_sz = fd_genesis_create( result_mem, sizeof(result_mem), options ); FD_TEST( result_sz ); /* TODO load this into a Firedancer runtime and verify the resulting slot context */