Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/flamenco/features/fd_features.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#define FD_FEATURE_ACTIVE(_slot, _features, _feature_name) FD_FEATURE_ACTIVE_( _slot, _features, _feature_name )
#define FD_FEATURE_ACTIVE_BANK(_bank, _feature_name) FD_FEATURE_ACTIVE_( fd_bank_slot_get( _bank ), fd_bank_features_query( _bank ), _feature_name )
#define FD_FEATURE_ACTIVE_BANK_OFFSET(_bank, _offset) FD_FEATURE_ACTIVE_OFFSET_( fd_bank_slot_get( _bank ), fd_bank_features_query( _bank ), _offset )
#define FD_FEATURE_JUST_ACTIVATED_BANK(_bank, _feature_name) FD_FEATURE_JUST_ACTIVATED_( fd_bank_slot_get( _bank ), fd_bank_features_query( _bank ), _feature_name )


/* fd_features_t is the current set of enabled feature flags.
Expand Down
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 @@ -1715,6 +1715,12 @@ fd_feature_id_t const ids[] = {
.name = "increase_cpi_account_info_limit",
.cleaned_up = {UINT_MAX, UINT_MAX, UINT_MAX} },

{ .index = offsetof(fd_features_t, deprecate_rent_exemption_threshold)>>3,
.id = {"\x0c\xb8\x30\xab\xeb\x2f\x79\xf4\x53\xf9\xb1\x27\x15\xb8\x75\x56\xc4\x82\x1a\x67\xe0\x03\xa8\x07\x5e\x13\xa7\x58\xdd\xf7\xa2\x1d"},
/* rent6iVy6PDoViPBeJ6k5EJQrkj62h7DPyLbWGHwjrC */
.name = "deprecate_rent_exemption_threshold",
.cleaned_up = {UINT_MAX, UINT_MAX, UINT_MAX} },

{ .index = ULONG_MAX }
};
/* TODO replace this with fd_map_perfect */
Expand Down Expand Up @@ -1972,6 +1978,7 @@ fd_feature_id_query( ulong prefix ) {
case 0x7c4802b8ba3fa849: return &ids[ 248 ];
case 0xab2a2311ca83eb09: return &ids[ 249 ];
case 0x55792888a8cf31ef: return &ids[ 250 ];
case 0xf4792febab30b80c: return &ids[ 251 ];
default: break;
}
return NULL;
Expand Down Expand Up @@ -2228,4 +2235,5 @@ FD_STATIC_ASSERT( offsetof( fd_features_t, relax_intrabatch_account_locks
FD_STATIC_ASSERT( offsetof( fd_features_t, provide_instruction_data_offset_in_vm_r2 )>>3==248UL, layout );
FD_STATIC_ASSERT( offsetof( fd_features_t, enforce_fixed_fec_set )>>3==249UL, layout );
FD_STATIC_ASSERT( offsetof( fd_features_t, increase_cpi_account_info_limit )>>3==250UL, layout );
FD_STATIC_ASSERT( offsetof( fd_features_t, deprecate_rent_exemption_threshold )>>3==251UL, layout );
FD_STATIC_ASSERT( sizeof( fd_features_t )>>3==FD_FEATURE_ID_CNT, layout );
5 changes: 3 additions & 2 deletions src/flamenco/features/fd_features_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
#endif

/* FEATURE_ID_CNT is the number of features in ids */
#define FD_FEATURE_ID_CNT (251UL)
#define FD_FEATURE_ID_CNT (252UL)

/* Feature set ID calculated from all feature names */
#define FD_FEATURE_SET_ID (1776864602U)
#define FD_FEATURE_SET_ID (2346311975U)

union fd_features {
ulong f[ FD_FEATURE_ID_CNT ];
Expand Down Expand Up @@ -267,5 +267,6 @@ union fd_features {
/* 0x7c4802b8ba3fa849 */ ulong provide_instruction_data_offset_in_vm_r2;
/* 0xab2a2311ca83eb09 */ ulong enforce_fixed_fec_set;
/* 0x55792888a8cf31ef */ ulong increase_cpi_account_info_limit;
/* 0xf4792febab30b80c */ ulong deprecate_rent_exemption_threshold;
};
};
3 changes: 2 additions & 1 deletion src/flamenco/features/feature_map.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,5 +249,6 @@
{"name":"relax_intrabatch_account_locks","pubkey":"ENTRYnPAoT5Swwx73YDGzMp3XnNH1kxacyvLosRHza1i"},
{"name":"provide_instruction_data_offset_in_vm_r2","pubkey":"5xXZc66h4UdB6Yq7FzdBxBiRAFMMScMLwHxk2QZDaNZL"},
{"name":"enforce_fixed_fec_set","pubkey":"fixfecLZYMfkGzwq6NJA11Yw6KYztzXiK9QcL3K78in"},
{"name":"increase_cpi_account_info_limit","pubkey":"H6iVbVaDZgDphcPbcZwc5LoznMPWQfnJ1AM7L1xzqvt5"}
{"name":"increase_cpi_account_info_limit","pubkey":"H6iVbVaDZgDphcPbcZwc5LoznMPWQfnJ1AM7L1xzqvt5"},
{"name":"deprecate_rent_exemption_threshold","pubkey":"rent6iVy6PDoViPBeJ6k5EJQrkj62h7DPyLbWGHwjrC"}
]
6 changes: 6 additions & 0 deletions src/flamenco/runtime/Local.mk
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ ifdef FD_HAS_ATOMIC
ifdef FD_HAS_INT128
$(call add-hdrs,fd_runtime.h fd_runtime_err.h fd_runtime_const.h fd_runtime_stack.h fd_runtime_helpers.h)
$(call add-objs,fd_runtime,fd_flamenco)
ifdef FD_HAS_HOSTED
ifdef FD_HAS_SECP256K1
$(call make-unit-test,test_deprecate_rent_exemption_threshold,test_deprecate_rent_exemption_threshold,fd_flamenco fd_funk fd_ballet fd_util)
$(call run-unit-test,test_deprecate_rent_exemption_threshold,)
endif
endif
endif
endif

Expand Down
28 changes: 28 additions & 0 deletions src/flamenco/runtime/fd_runtime.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "fd_runtime.h"
#include "../capture/fd_capture_ctx.h"
#include "../types/fd_cast.h"
#include "fd_acc_mgr.h"
#include "fd_alut_interp.h"
#include "fd_bank.h"
Expand Down Expand Up @@ -560,6 +561,29 @@ fd_features_activate( fd_bank_t * bank,
}
}

/* SIMD-0194: deprecate_rent_exemption_threshold
https://github.com/anza-xyz/agave/blob/v3.1.4/runtime/src/bank.rs#L5322-L5329 */
static void
deprecate_rent_exemption_threshold( fd_bank_t * bank,
fd_accdb_user_t * accdb,
fd_funk_txn_xid_t const * xid,
fd_capture_ctx_t * capture_ctx,
fd_funk_t * funk ) {
fd_rent_t rent[1] = {0};
if( FD_UNLIKELY( !fd_sysvar_rent_read( funk, xid, rent ) ) ) {
FD_LOG_CRIT(( "fd_sysvar_rent_read failed" ));
}
rent->lamports_per_uint8_year = fd_rust_cast_double_to_ulong(
(double)rent->lamports_per_uint8_year * rent->exemption_threshold );
rent->exemption_threshold = FD_SIMD_0194_NEW_RENT_EXEMPTION_THRESHOLD;

/* We don't refresh the sysvar cache here. The cache is refreshed in
fd_sysvar_cache_restore, which is called at the start of every block
in fd_runtime_block_execute_prepare, after this function. */
fd_sysvar_rent_write( bank, accdb, xid, capture_ctx, rent );
fd_bank_rent_set( bank, *rent );
}

/* Starting a new epoch.
New epoch: T
Just ended epoch: T-1
Expand Down Expand Up @@ -604,6 +628,10 @@ fd_runtime_process_new_epoch( fd_banks_t * banks,
fd_features_activate( bank, accdb, xid, capture_ctx );
fd_features_restore( bank, funk, xid );

if( FD_UNLIKELY( FD_FEATURE_JUST_ACTIVATED_BANK( bank, deprecate_rent_exemption_threshold ) ) ) {
deprecate_rent_exemption_threshold( bank, accdb, xid, capture_ctx, funk );
}

/* Apply builtin program feature transitions
https://github.com/anza-xyz/agave/blob/v2.1.0/runtime/src/bank.rs#L6621-L6624 */

Expand Down
4 changes: 4 additions & 0 deletions src/flamenco/runtime/sysvar/fd_sysvar_rent.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
#include "../../accdb/fd_accdb_user.h"
#include "../../types/fd_types.h"

/* SIMD-0194: deprecate_rent_exemption_threshold
https://github.com/anza-xyz/agave/blob/v3.1.4/runtime/src/bank.rs#L5322-L5329 */
#define FD_SIMD_0194_NEW_RENT_EXEMPTION_THRESHOLD (1.0)

FD_PROTOTYPES_BEGIN

/* fd_sysvar_rent_init copies the cached rent sysvar stored from
Expand Down
Loading
Loading