Skip to content

Commit

Permalink
add enable_secp256r1_precompile feature
Browse files Browse the repository at this point in the history
  • Loading branch information
kbhargava-jump committed Nov 15, 2024
1 parent 9981618 commit 3994555
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
8 changes: 8 additions & 0 deletions src/flamenco/features/fd_features_generated.c
Original file line number Diff line number Diff line change
Expand Up @@ -1229,6 +1229,12 @@ fd_feature_id_t const ids[] = {
.name = "partitioned_epoch_rewards_superfeature",
.cleaned_up = {UINT_MAX, UINT_MAX, UINT_MAX} },

{ .index = offsetof(fd_features_t, enable_secp256r1_precompile)>>3,
.id = {"\x0d\x06\x71\xf0\x4f\xe3\x38\x2c\x46\xac\x54\x4a\xad\x9b\x98\x50\xa8\xa0\x26\x18\x41\x58\x58\xbf\xe8\xf0\xca\x6c\x04\x32\x18\x93"},
/* sr11RdZWgbHTHxSroPALe6zgaT5A1K9LcE4nfsZS4gi */
.name = "enable_secp256r1_precompile",
.cleaned_up = {UINT_MAX, UINT_MAX, UINT_MAX} },

{ .index = ULONG_MAX }
};

Expand Down Expand Up @@ -1443,6 +1449,7 @@ fd_feature_id_query( ulong prefix ) {
case 0x0b9047b5bb9ef961: return &ids[ 200 ];
case 0xa5a66405d0ab6309: return &ids[ 201 ];
case 0x81fcbfa0d0f6b105: return &ids[ 202 ];
case 0x2c38e34ff071060d: return &ids[ 203 ];
default: break;
}

Expand Down Expand Up @@ -1654,5 +1661,6 @@ FD_STATIC_ASSERT( offsetof( fd_features_t, zk_elgamal_proof_program_enabled
FD_STATIC_ASSERT( offsetof( fd_features_t, move_stake_and_move_lamports_ixs )>>3==200UL, layout );
FD_STATIC_ASSERT( offsetof( fd_features_t, deprecate_legacy_vote_ixs )>>3==201UL, layout );
FD_STATIC_ASSERT( offsetof( fd_features_t, partitioned_epoch_rewards_superfeature )>>3==202UL, layout );
FD_STATIC_ASSERT( offsetof( fd_features_t, enable_secp256r1_precompile )>>3==203UL, layout );

FD_STATIC_ASSERT( sizeof( fd_features_t )>>3==FD_FEATURE_ID_CNT, layout );
3 changes: 2 additions & 1 deletion src/flamenco/features/fd_features_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

/* FEATURE_ID_CNT is the number of features in ids */

#define FD_FEATURE_ID_CNT (203UL)
#define FD_FEATURE_ID_CNT (204UL)

union fd_features {

Expand Down Expand Up @@ -216,6 +216,7 @@ union fd_features {
/* 0x0b9047b5bb9ef961 */ ulong move_stake_and_move_lamports_ixs;
/* 0xa5a66405d0ab6309 */ ulong deprecate_legacy_vote_ixs;
/* 0x81fcbfa0d0f6b105 */ ulong partitioned_epoch_rewards_superfeature;
/* 0x2c38e34ff071060d */ ulong enable_secp256r1_precompile;
};

};
3 changes: 2 additions & 1 deletion src/flamenco/features/feature_map.json
Original file line number Diff line number Diff line change
Expand Up @@ -201,5 +201,6 @@
{"name":"zk_elgamal_proof_program_enabled","pubkey":"zkhiy5oLowR7HY4zogXjCjeMXyruLqBwSWH21qcFtnv"},
{"name":"move_stake_and_move_lamports_ixs","pubkey":"7bTK6Jis8Xpfrs8ZoUfiMDPazTcdPcTWheZFJTA5Z6X4"},
{"name":"deprecate_legacy_vote_ixs","pubkey":"depVvnQ2UysGrhwdiwU42tCadZL8GcBb1i2GYhMopQv"},
{"name":"partitioned_epoch_rewards_superfeature","pubkey":"PERzQrt5gBD1XEe2c9XdFWqwgHY3mr7cYWbm5V772V8"}
{"name":"partitioned_epoch_rewards_superfeature","pubkey":"PERzQrt5gBD1XEe2c9XdFWqwgHY3mr7cYWbm5V772V8"},
{"name": "enable_secp256r1_precompile","pubkey":"sr11RdZWgbHTHxSroPALe6zgaT5A1K9LcE4nfsZS4gi"}
]
2 changes: 1 addition & 1 deletion src/flamenco/runtime/fd_executor.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ fd_executor_verify_precompiles( fd_exec_txn_ctx_t * txn_ctx ) {
FD_TXN_ERR_FOR_LOG_INSTR( txn_ctx, err, i );
return FD_RUNTIME_TXN_ERR_INSTRUCTION_ERROR;
}
} else if( !memcmp( program_id, &fd_solana_secp256r1_program_id, sizeof(fd_pubkey_t) )) {
} else if( !memcmp( program_id, &fd_solana_secp256r1_program_id, sizeof(fd_pubkey_t)) && FD_FEATURE_ACTIVE(txn_ctx->slot_ctx, enable_secp256r1_precompile) ) {
err = fd_precompile_secp256r1_verify( txn_ctx, instr );
if( FD_UNLIKELY( err ) ) {
FD_TXN_ERR_FOR_LOG_INSTR( txn_ctx, err, i );
Expand Down

0 comments on commit 3994555

Please sign in to comment.