|
1 | 1 | use {
|
| 2 | + super::pyth_accumulator::MESSAGE_BUFFER_PID, |
2 | 3 | crate::{
|
| 4 | + accounts_db::AccountShrinkThreshold, |
| 5 | + accounts_index::{ |
| 6 | + AccountIndex, AccountSecondaryIndexes, AccountSecondaryIndexesIncludeExclude, |
| 7 | + }, |
3 | 8 | bank::{
|
4 | 9 | pyth_accumulator::{get_accumulator_keys, ACCUMULATOR_RING_SIZE, ORACLE_PID},
|
5 | 10 | Bank,
|
|
25 | 30 | epoch_schedule::EpochSchedule,
|
26 | 31 | feature::{self, Feature},
|
27 | 32 | feature_set,
|
| 33 | + genesis_config::GenesisConfig, |
28 | 34 | hash::hashv,
|
29 | 35 | pubkey::Pubkey,
|
30 | 36 | signature::keypair_from_seed,
|
|
33 | 39 | std::{io::Read, mem::size_of, sync::Arc},
|
34 | 40 | };
|
35 | 41 |
|
| 42 | +fn create_new_bank_for_tests_with_index(genesis_config: &GenesisConfig) -> Bank { |
| 43 | + Bank::new_with_config_for_tests( |
| 44 | + genesis_config, |
| 45 | + AccountSecondaryIndexes { |
| 46 | + keys: Some(AccountSecondaryIndexesIncludeExclude { |
| 47 | + exclude: false, |
| 48 | + keys: [*ORACLE_PID, *MESSAGE_BUFFER_PID].into_iter().collect(), |
| 49 | + }), |
| 50 | + indexes: [AccountIndex::ProgramId].into_iter().collect(), |
| 51 | + }, |
| 52 | + false, |
| 53 | + AccountShrinkThreshold::default(), |
| 54 | + ) |
| 55 | +} |
| 56 | + |
36 | 57 | // Create Message Account Bytes
|
37 | 58 | //
|
38 | 59 | // NOTE: This was serialized by hand, but should be replaced with the pythnet-sdk
|
@@ -107,7 +128,7 @@ fn test_update_accumulator_sysvar() {
|
107 | 128 | // due to slot 0 having special handling.
|
108 | 129 | let slots_in_epoch = 32;
|
109 | 130 | genesis_config.epoch_schedule = EpochSchedule::new(slots_in_epoch);
|
110 |
| - let mut bank = Bank::new_for_tests(&genesis_config); |
| 131 | + let mut bank = create_new_bank_for_tests_with_index(&genesis_config); |
111 | 132 | bank = new_from_parent(&Arc::new(bank));
|
112 | 133 | bank = new_from_parent(&Arc::new(bank));
|
113 | 134 |
|
@@ -392,7 +413,7 @@ fn test_update_accumulator_end_of_block() {
|
392 | 413 | // due to slot 0 having special handling.
|
393 | 414 | let slots_in_epoch = 32;
|
394 | 415 | genesis_config.epoch_schedule = EpochSchedule::new(slots_in_epoch);
|
395 |
| - let mut bank = Bank::new_for_tests(&genesis_config); |
| 416 | + let mut bank = create_new_bank_for_tests_with_index(&genesis_config); |
396 | 417 | bank = new_from_parent(&Arc::new(bank));
|
397 | 418 | bank = new_from_parent(&Arc::new(bank));
|
398 | 419 |
|
@@ -683,7 +704,7 @@ fn test_accumulator_v2(generate_buffers: [bool; 4]) {
|
683 | 704 | // due to slot 0 having special handling.
|
684 | 705 | let slots_in_epoch = 32;
|
685 | 706 | genesis_config.epoch_schedule = EpochSchedule::new(slots_in_epoch);
|
686 |
| - let mut bank = Bank::new_for_tests(&genesis_config); |
| 707 | + let mut bank = create_new_bank_for_tests_with_index(&genesis_config); |
687 | 708 |
|
688 | 709 | let generate_price = |seeds, generate_buffers: bool| {
|
689 | 710 | let (price_feed_key, _bump) = Pubkey::find_program_address(&[seeds], &ORACLE_PID);
|
|
0 commit comments