* Fix ed25519 builtin program handling (#23182)
* Fix ed25519 builtin program handling
* Fix tests
* Add integration tests for processing transactions with ed25519 ixs
* Fix another test
* fix formatting
(cherry picked from commit 813725dfec
)
* fix tests
Co-authored-by: Justin Starry <justin@solana.com>
Co-authored-by: Jack May <jack@solana.com>
This commit is contained in:
@ -7101,7 +7101,7 @@ pub(crate) mod tests {
|
||||
cluster_type: ClusterType::MainnetBeta,
|
||||
..GenesisConfig::default()
|
||||
}));
|
||||
let sysvar_and_builtin_program_delta0 = 11;
|
||||
let sysvar_and_builtin_program_delta0 = 12;
|
||||
assert_eq!(
|
||||
bank0.capitalization(),
|
||||
42 * 42 + sysvar_and_builtin_program_delta0
|
||||
@ -8856,7 +8856,7 @@ pub(crate) mod tests {
|
||||
// not being eagerly-collected for exact rewards calculation
|
||||
bank0.restore_old_behavior_for_fragile_tests();
|
||||
|
||||
let sysvar_and_builtin_program_delta0 = 11;
|
||||
let sysvar_and_builtin_program_delta0 = 12;
|
||||
assert_eq!(
|
||||
bank0.capitalization(),
|
||||
42 * 1_000_000_000 + sysvar_and_builtin_program_delta0
|
||||
@ -8991,7 +8991,7 @@ pub(crate) mod tests {
|
||||
// not being eagerly-collected for exact rewards calculation
|
||||
bank.restore_old_behavior_for_fragile_tests();
|
||||
|
||||
let sysvar_and_builtin_program_delta = 11;
|
||||
let sysvar_and_builtin_program_delta = 12;
|
||||
assert_eq!(
|
||||
bank.capitalization(),
|
||||
42 * 1_000_000_000 + sysvar_and_builtin_program_delta
|
||||
@ -13041,25 +13041,25 @@ pub(crate) mod tests {
|
||||
if bank.slot == 0 {
|
||||
assert_eq!(
|
||||
bank.hash().to_string(),
|
||||
"DqaWg7EVKzb5Fpe92zNBtXAWqLwcedgHDicYrCBnf3QK"
|
||||
"CMCWTWsU67zjmayMhSMGBTzHbW1WMCtkM5m7xk9qSnY5"
|
||||
);
|
||||
}
|
||||
if bank.slot == 32 {
|
||||
assert_eq!(
|
||||
bank.hash().to_string(),
|
||||
"AYdhzhKrM74r9XuZBDGcHeFzg2DEtp1boggnEnzDjZSq"
|
||||
"4kbXeShX8vMnRuuADCkxSEir1oc2PrBNbx6vPkWcDtJU"
|
||||
);
|
||||
}
|
||||
if bank.slot == 64 {
|
||||
assert_eq!(
|
||||
bank.hash().to_string(),
|
||||
"EsbPVYzo1qz5reEUH5okKW4ExB6WbcidkVdW5mzpFn7C"
|
||||
"CSZ8QCDF8qhqKDxafPzjNJpHcRAXmQzAb8eUi1Emt35E"
|
||||
);
|
||||
}
|
||||
if bank.slot == 128 {
|
||||
assert_eq!(
|
||||
bank.hash().to_string(),
|
||||
"H3DWrQ6FqbLkFNDxbWQ62UKRbw2dbuxf3oVF2VpBk6Ga"
|
||||
"Ewh1SYKy8eiSE77sEvjav33SznfWYSwa5TwqbiYWseG2"
|
||||
);
|
||||
break;
|
||||
}
|
||||
@ -13287,7 +13287,7 @@ pub(crate) mod tests {
|
||||
// No more slots should be shrunk
|
||||
assert_eq!(bank2.shrink_candidate_slots(), 0);
|
||||
// alive_counts represents the count of alive accounts in the three slots 0,1,2
|
||||
assert_eq!(alive_counts, vec![10, 1, 7]);
|
||||
assert_eq!(alive_counts, vec![11, 1, 7]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -13335,7 +13335,7 @@ pub(crate) mod tests {
|
||||
.map(|_| bank.process_stale_slot_with_budget(0, force_to_return_alive_account))
|
||||
.sum();
|
||||
// consumed_budgets represents the count of alive accounts in the three slots 0,1,2
|
||||
assert_eq!(consumed_budgets, 11);
|
||||
assert_eq!(consumed_budgets, 12);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -129,10 +129,15 @@ fn genesis_builtins() -> Vec<Builtin> {
|
||||
solana_sdk::secp256k1_program::id(),
|
||||
dummy_process_instruction,
|
||||
),
|
||||
Builtin::new(
|
||||
"ed25519_program",
|
||||
solana_sdk::ed25519_program::id(),
|
||||
dummy_process_instruction,
|
||||
),
|
||||
]
|
||||
}
|
||||
|
||||
/// place holder for secp256k1, remove when the precompile program is deactivated via feature activation
|
||||
/// place holder for precompile programs, remove when the precompile program is deactivated via feature activation
|
||||
fn dummy_process_instruction(
|
||||
_first_instruction_account: usize,
|
||||
_data: &[u8],
|
||||
@ -172,6 +177,18 @@ fn feature_builtins() -> Vec<(Builtin, Pubkey, ActivationType)> {
|
||||
feature_set::prevent_calling_precompiles_as_programs::id(),
|
||||
ActivationType::RemoveProgram,
|
||||
),
|
||||
// TODO when feature `prevent_calling_precompiles_as_programs` is
|
||||
// cleaned up also remove "ed25519_program" from the main builtins
|
||||
// list
|
||||
(
|
||||
Builtin::new(
|
||||
"ed25519_program",
|
||||
solana_sdk::ed25519_program::id(),
|
||||
dummy_process_instruction,
|
||||
),
|
||||
feature_set::prevent_calling_precompiles_as_programs::id(),
|
||||
ActivationType::RemoveProgram,
|
||||
),
|
||||
(
|
||||
Builtin::new(
|
||||
"address_lookup_table_program",
|
||||
|
@ -278,7 +278,7 @@ mod tests {
|
||||
..GenesisConfig::default()
|
||||
};
|
||||
let mut bank = Arc::new(Bank::new_for_tests(&genesis_config));
|
||||
let sysvar_and_native_program_delta = 11;
|
||||
let sysvar_and_native_program_delta = 12;
|
||||
assert_eq!(
|
||||
bank.capitalization(),
|
||||
(num_genesis_accounts + num_non_circulating_accounts + num_stake_accounts) * balance
|
||||
|
Reference in New Issue
Block a user