Skip to content

Commit 46cce87

Browse files
committed
Add new feature
1 parent adbe591 commit 46cce87

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

runtime/src/bank/pyth_accumulator.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,8 @@ pub fn update_v2(bank: &Bank) -> std::result::Result<(), AccumulatorUpdateErrorV
380380
let mut any_v1_aggregations = false;
381381
let mut v2_messages = Vec::new();
382382

383-
compute_publisher_stake_caps(&accounts, bank.clock().unix_timestamp, &mut v2_messages, true);
383+
let add_publisher_stake_caps = bank.feature_set.is_active(&feature_set::add_publisher_stake_caps_to_the_accumulator::id());
384+
compute_publisher_stake_caps(&accounts, bank.clock().unix_timestamp, &mut v2_messages, add_publisher_stake_caps);
384385

385386
for (pubkey, mut account) in accounts {
386387
let mut price_account_data = account.data().to_owned();
@@ -415,14 +416,16 @@ pub fn compute_publisher_stake_caps(
415416
messages : &mut Vec<Vec<u8>>,
416417
is_active : bool
417418
) {
419+
info!("We are computing publisher stake caps");
420+
418421
let account_datas : Vec<&[u8]> = accounts
419422
.iter()
420423
.map(|(_, account)| account.data().borrow())
421424
.collect();
422425
let message = pyth_oracle::validator::compute_publisher_stake_caps(account_datas, timestamp);
423426

424427
if is_active {
425-
info!("Computing publisher caps");
428+
info!("Send publisher stake caps");
426429
messages.push(message);
427430
}
428431
}

sdk/src/feature_set.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,10 @@ pub mod redo_move_accumulator_to_end_of_block {
564564
solana_sdk::declare_id!("skyhwRBbP1LoHzWy1QrwLWy3vo2uHkzVV1zpN9UsGuw");
565565
}
566566

567+
pub mod add_publisher_stake_caps_to_the_accumulator {
568+
solana_sdk::declare_id!("J5u6Vrgj7de8zLcjQVhuRAPzEzfDamrxAQMz3q6HSmi1");
569+
}
570+
567571
lazy_static! {
568572
/// Map of feature identifiers to user-visible description
569573
pub static ref FEATURE_NAMES: HashMap<Pubkey, &'static str> = [
@@ -699,6 +703,7 @@ lazy_static! {
699703
(zero_wormhole_message_timestamps::id(), "use zeroed timestamps in wormhole messages"),
700704
(undo_move_accumulator_to_end_of_block::id(), "undo accumulator end of block change"),
701705
(redo_move_accumulator_to_end_of_block::id(), "redo accumulator end of block change"),
706+
(add_publisher_stake_caps_to_the_accumulator::id(), "add publisher stake caps to the accumulator")
702707
/*************** ADD NEW FEATURES HERE ***************/
703708
]
704709
.iter()

0 commit comments

Comments
 (0)