@@ -1885,13 +1885,19 @@ impl Bank {
1885
1885
new.update_stake_history(Some(parent_epoch));
1886
1886
new.update_clock(Some(parent_epoch));
1887
1887
new.update_fees();
1888
+ },
1889
+ (),
1890
+ "update_sysvars",
1891
+ );
1888
1892
1893
+ let (_, update_accumulator_time) = Measure::this(
1894
+ |_| {
1889
1895
// Update the accumulator last to make sure that all sysvars are in a
1890
1896
// fully updated state before the accumulator sysvar updates.
1891
1897
new.update_accumulator();
1892
1898
},
1893
1899
(),
1894
- "update_sysvars ",
1900
+ "update_accumulator ",
1895
1901
);
1896
1902
1897
1903
let (_, fill_sysvar_cache_time) = Measure::this(
@@ -1934,6 +1940,11 @@ impl Bank {
1934
1940
("ancestors_us", ancestors_time.as_us(), i64),
1935
1941
("update_epoch_us", update_epoch_time.as_us(), i64),
1936
1942
("update_sysvars_us", update_sysvars_time.as_us(), i64),
1943
+ (
1944
+ "update_accumulator_us",
1945
+ update_accumulator_time.as_us(),
1946
+ i64
1947
+ ),
1937
1948
("fill_sysvar_cache_us", fill_sysvar_cache_time.as_us(), i64),
1938
1949
);
1939
1950
@@ -2484,20 +2495,6 @@ impl Bank {
2484
2495
});
2485
2496
}
2486
2497
2487
- /// Loads the Accumulator Sysvar from disk, creating an empty account for it if it does not
2488
- /// exist already. See `clock` to see a similar sysvar this is based on.
2489
- pub fn accumulator(
2490
- &self,
2491
- ) -> sysvar::accumulator::MerkleAccumulator<pythnet_sdk::hashers::keccak256_160::Keccak160>
2492
- {
2493
- from_account(
2494
- &self
2495
- .get_account(&sysvar::accumulator::id())
2496
- .unwrap_or_default(),
2497
- )
2498
- .unwrap_or_default()
2499
- }
2500
-
2501
2498
/// Updates the Accumulator Sysvar at the start of a new slot. See `update_clock` to see a similar
2502
2499
/// sysvar this is based on.
2503
2500
///
@@ -2510,10 +2507,13 @@ impl Bank {
2510
2507
.feature_set
2511
2508
.is_active(&feature_set::enable_accumulator_sysvar::id())
2512
2509
{
2513
- info!("Accumulator: Skipping because the feature is disabled. Slot: {}", self.slot());
2510
+ info!(
2511
+ "Accumulator: Skipping because the feature is disabled. Slot: {}",
2512
+ self.slot()
2513
+ );
2514
2514
return;
2515
2515
}
2516
-
2516
+
2517
2517
info!("Accumulator: Updating accumulator. Slot: {}", self.slot());
2518
2518
if let Err(e) = self.update_accumulator_impl() {
2519
2519
error!("Error updating accumulator: {:?}", e);
@@ -2625,7 +2625,10 @@ impl Bank {
2625
2625
2626
2626
// Write the Account Set into `accumulator_state` so that the hermes application can
2627
2627
// request historical data to prove.
2628
- info!("Accumulator: Writing accumulator state to {:?}", accumulator_account);
2628
+ info!(
2629
+ "Accumulator: Writing accumulator state to {:?}",
2630
+ accumulator_account
2631
+ );
2629
2632
self.store_account_and_update_capitalization(&accumulator_account, &accumulator_data);
2630
2633
2631
2634
Ok(())
@@ -15111,10 +15114,7 @@ pub(crate) mod tests {
15111
15114
15112
15115
// Derive the Wormhole Message Account that will be generated by the sysvar updater.
15113
15116
let (wormhole_message_pubkey, _bump) = Pubkey::find_program_address(
15114
- &[
15115
- b"AccumulatorMessage",
15116
- &(bank.slot() as u32).to_be_bytes(),
15117
- ],
15117
+ &[b"AccumulatorMessage", &(bank.slot() as u32).to_be_bytes()],
15118
15118
&Pubkey::new_from_array(pythnet_sdk::pythnet::WORMHOLE_PID),
15119
15119
);
15120
15120
@@ -15242,16 +15242,14 @@ pub(crate) mod tests {
15242
15242
);
15243
15243
15244
15244
// verify ring buffer cycles
15245
- let ring_index_before_buffer_cycle =
15246
- (bank.slot() % ACCUMULATOR_RING_SIZE as u64) as u32;
15245
+ let ring_index_before_buffer_cycle = (bank.slot() % ACCUMULATOR_RING_SIZE as u64) as u32;
15247
15246
let target_slot = bank.slot() + ACCUMULATOR_RING_SIZE as u64;
15248
15247
// advance ACCUMULATOR_RING_SIZE slots using warp_from_parent since doing large loops
15249
15248
// with new_from_parent takes a long time. warp_from_parent results in a bank that is frozen.
15250
15249
bank = Bank::warp_from_parent(&Arc::new(bank), &Pubkey::default(), target_slot);
15251
15250
15252
15251
// accumulator messages should still be the same before looping around
15253
- let ring_index_after_buffer_cycle =
15254
- (bank.slot() % ACCUMULATOR_RING_SIZE as u64) as u32;
15252
+ let ring_index_after_buffer_cycle = (bank.slot() % ACCUMULATOR_RING_SIZE as u64) as u32;
15255
15253
assert_eq!(
15256
15254
ring_index_before_buffer_cycle,
15257
15255
ring_index_after_buffer_cycle
0 commit comments