@@ -88,17 +88,17 @@ fd_runtime_fuzz_txn_ctx_create( fd_runtime_fuzz_runner_t * runner,
88
88
89
89
/* Set epoch bank variables if not present (defaults obtained from GenesisConfig::default() in Agave) */
90
90
fd_epoch_schedule_t default_epoch_schedule = {
91
- .slots_per_epoch = 432000 ,
92
- .leader_schedule_slot_offset = 432000 ,
93
- .warmup = 1 ,
94
- .first_normal_epoch = 14 ,
95
- .first_normal_slot = 524256
96
- };
97
- fd_rent_t default_rent = {
98
- .lamports_per_uint8_year = 3480 ,
99
- .exemption_threshold = 2.0 ,
100
- .burn_percent = 50
101
- };
91
+ .slots_per_epoch = 432000 ,
92
+ .leader_schedule_slot_offset = 432000 ,
93
+ .warmup = 1 ,
94
+ .first_normal_epoch = 14 ,
95
+ .first_normal_slot = 524256
96
+ };
97
+ fd_rent_t default_rent = {
98
+ .lamports_per_uint8_year = 3480 ,
99
+ .exemption_threshold = 2.0 ,
100
+ .burn_percent = 50
101
+ };
102
102
fd_bank_epoch_schedule_set ( slot_ctx -> bank , default_epoch_schedule );
103
103
104
104
fd_bank_rent_set ( slot_ctx -> bank , default_rent );
@@ -195,7 +195,7 @@ fd_runtime_fuzz_txn_ctx_create( fd_runtime_fuzz_runner_t * runner,
195
195
196
196
/* Blockhash queue init */
197
197
ulong blockhash_seed ; FD_TEST ( fd_rng_secure ( & blockhash_seed , sizeof (ulong ) ) );
198
- fd_blockhashes_init ( fd_bank_block_hash_queue_modify ( slot_ctx -> bank ), blockhash_seed );
198
+ fd_blockhashes_t * blockhashes = fd_blockhashes_init ( fd_bank_block_hash_queue_modify ( slot_ctx -> bank ), blockhash_seed );
199
199
200
200
// Save lamports per signature for most recent blockhash, if sysvar cache contains recent block hashes
201
201
fd_recent_block_hashes_t const * rbh_sysvar = fd_sysvar_recent_hashes_read ( funk , funk_txn , runner -> spad );
@@ -219,10 +219,14 @@ fd_runtime_fuzz_txn_ctx_create( fd_runtime_fuzz_runner_t * runner,
219
219
memcpy ( genesis_hash -> hash , test_ctx -> blockhash_queue [0 ]-> bytes , sizeof (fd_hash_t ) );
220
220
221
221
for ( ulong i = 0 ; i < num_blockhashes ; ++ i ) {
222
+ fd_hash_t blockhash = FD_LOAD ( fd_hash_t , test_ctx -> blockhash_queue [i ]-> bytes );
223
+ /* Drop duplicate blockhashes */
224
+ if ( FD_UNLIKELY ( fd_blockhash_map_idx_remove ( blockhashes -> map , & blockhash , ULONG_MAX , blockhashes -> d .deque )!= ULONG_MAX ) ) {
225
+ FD_LOG_WARNING (( "Fuzz input has a duplicate blockhash %s at index %lu" ,
226
+ FD_BASE58_ENC_32_ALLOCA ( blockhash .hash ), i ));
227
+ }
222
228
// Recent block hashes cap is 150 (actually 151), while blockhash queue capacity is 300 (actually 301)
223
- fd_block_block_hash_entry_t blockhash_entry ;
224
- memcpy ( & blockhash_entry .blockhash , test_ctx -> blockhash_queue [i ]-> bytes , sizeof (fd_hash_t ) );
225
- fd_bank_poh_set ( slot_ctx -> bank , blockhash_entry .blockhash );
229
+ fd_bank_poh_set ( slot_ctx -> bank , blockhash );
226
230
fd_sysvar_recent_hashes_update ( slot_ctx , runner -> spad );
227
231
}
228
232
} else {
0 commit comments