Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions feature-set/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1204,6 +1204,10 @@ pub mod alt_bn128_little_endian {
solana_pubkey::declare_id!("bnS3pWfLrxHRJvMyLm6EaYQkP7A2Fe9DxoKv4aGA8YM");
}

pub mod assign_ed25519_precompile_to_native_loader {
solana_pubkey::declare_id!("ownrov5XivPciuSz7cUNRUpJ4WC82H6N4KXvemHmHpU");
}

pub static FEATURE_NAMES: LazyLock<AHashMap<Pubkey, &'static str>> = LazyLock::new(|| {
[
(secp256k1_program_enabled::id(), "secp256k1 program"),
Expand Down Expand Up @@ -2159,6 +2163,10 @@ pub static FEATURE_NAMES: LazyLock<AHashMap<Pubkey, &'static str>> = LazyLock::n
alt_bn128_little_endian::id(),
"SIMD-0284: Add little-endian compatibility for alt_bn128",
),
(
assign_ed25519_precompile_to_native_loader::id(),
"Assign Ed25519 Precompile to native loader",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going to suggest prefixing this message with "Testnet:", but that might actually be more confusing. Leaving this comment here for anyone who might want the prefix.

),
/*************** ADD NEW FEATURES HERE ***************/
]
.iter()
Expand Down
24 changes: 24 additions & 0 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5359,6 +5359,30 @@ impl Bank {
self.update_rent();
}

if new_feature_activations
.contains(&feature_set::assign_ed25519_precompile_to_native_loader::id())
{
if let Some(account) = self
.get_account_with_fixed_root(&solana_sdk_ids::ed25519_program::id())
.and_then(|account| {
if !native_loader::check_id(account.owner()) {
Some(account)
} else {
None
}
})
{
let new_account = AccountSharedData::from(Account {
owner: native_loader::ID,
executable: true,
data: b"ed25519_program".to_vec(),
..Account::from(account)
});
Comment on lines +5375 to +5380
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just use the WritableAccount trait to mutate the retrieved account directly, then store it back.

https://github.com/anza-xyz/solana-sdk/blob/336ebba61c778518a60a781475a4e9e625212b63/account/src/lib.rs#L185


self.store_account(&solana_sdk_ids::ed25519_program::id(), &new_account);
}
}

if new_feature_activations.contains(&feature_set::pico_inflation::id()) {
*self.inflation.write().unwrap() = Inflation::pico();
self.fee_rate_governor.burn_percent = solana_fee_calculator::DEFAULT_BURN_PERCENT; // 50% fee burn
Expand Down