Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Commit

Permalink
add feature gate
Browse files Browse the repository at this point in the history
  • Loading branch information
tao-stones committed Jan 31, 2023
1 parent 2efc012 commit 3a702c7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
7 changes: 2 additions & 5 deletions ledger/src/blockstore_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ use {
},
solana_sdk::{
clock::{Slot, MAX_PROCESSING_AGE},
feature_set::self,
genesis_config::GenesisConfig,
hash::Hash,
pubkey::Pubkey,
Expand Down Expand Up @@ -342,10 +343,7 @@ fn execute_batches(
})
.collect::<Vec<_>>();

// TAO TODO - accumulate transaction cost to bank's cost_tracker, retunr error if cost limits
// would be breached.
// This change needs to be feature gated
{
if bank.feature_set.is_active(&feature_set::apply_cost_tracker_during_replay::id()) {
let mut cost_tracker = bank.write_cost_tracker().unwrap();
for tx_cost in &tx_costs {
match cost_tracker.try_add(tx_cost) {
Expand Down Expand Up @@ -1802,7 +1800,6 @@ pub mod tests {
solana_sdk::{
account::{AccountSharedData, WritableAccount},
epoch_schedule::EpochSchedule,
feature_set,
hash::Hash,
native_token::LAMPORTS_PER_SOL,
pubkey::Pubkey,
Expand Down
5 changes: 5 additions & 0 deletions sdk/src/feature_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,10 @@ pub mod disable_builtin_loader_ownership_chains {
solana_sdk::declare_id!("4UDcAfQ6EcA6bdcadkeHpkarkhZGJ7Bpq7wTAiRMjkoi");
}

pub mod apply_cost_tracker_during_replay {
solana_sdk::declare_id!("2ry7ygxiYURULZCrypHhveanvP5tzZ4toRwVp89oCNSj");
}

lazy_static! {
/// Map of feature identifiers to user-visible description
pub static ref FEATURE_NAMES: HashMap<Pubkey, &'static str> = [
Expand Down Expand Up @@ -737,6 +741,7 @@ lazy_static! {
(update_hashes_per_tick::id(), "Update desired hashes per tick on epoch boundary"),
(enable_big_mod_exp_syscall::id(), "add big_mod_exp syscall #28503"),
(disable_builtin_loader_ownership_chains::id(), "disable builtin loader ownership chains #29956"),
(apply_cost_tracker_during_replay::id(), "apply cost tracker to blocks during replay #29595"),
/*************** ADD NEW FEATURES HERE ***************/
]
.iter()
Expand Down

0 comments on commit 3a702c7

Please sign in to comment.