Fix - `enable_alt_bn128_syscall` (#32083)
* Fixes test_runtime_feature_enable_with_program_cache. * Adds enable_alt_bn128_syscall to FEATURES_AFFECTING_RBPF.
This commit is contained in:
parent
6280c63e1a
commit
d0ae8c38bd
|
@ -7730,6 +7730,7 @@ impl Bank {
|
||||||
feature_set::reject_callx_r10::id(),
|
feature_set::reject_callx_r10::id(),
|
||||||
feature_set::switch_to_new_elf_parser::id(),
|
feature_set::switch_to_new_elf_parser::id(),
|
||||||
feature_set::bpf_account_data_direct_mapping::id(),
|
feature_set::bpf_account_data_direct_mapping::id(),
|
||||||
|
feature_set::enable_alt_bn128_syscall::id(),
|
||||||
];
|
];
|
||||||
if !only_apply_transitions_for_new_features
|
if !only_apply_transitions_for_new_features
|
||||||
|| FEATURES_AFFECTING_RBPF
|
|| FEATURES_AFFECTING_RBPF
|
||||||
|
|
|
@ -57,7 +57,7 @@ use {
|
||||||
entrypoint::MAX_PERMITTED_DATA_INCREASE,
|
entrypoint::MAX_PERMITTED_DATA_INCREASE,
|
||||||
epoch_schedule::{EpochSchedule, MINIMUM_SLOTS_PER_EPOCH},
|
epoch_schedule::{EpochSchedule, MINIMUM_SLOTS_PER_EPOCH},
|
||||||
feature::{self, Feature},
|
feature::{self, Feature},
|
||||||
feature_set::{self, reject_callx_r10, FeatureSet},
|
feature_set::{self, FeatureSet},
|
||||||
fee::FeeStructure,
|
fee::FeeStructure,
|
||||||
fee_calculator::FeeRateGovernor,
|
fee_calculator::FeeRateGovernor,
|
||||||
genesis_config::{create_genesis_config, ClusterType, GenesisConfig},
|
genesis_config::{create_genesis_config, ClusterType, GenesisConfig},
|
||||||
|
@ -12348,7 +12348,6 @@ fn test_runtime_feature_enable_with_program_cache() {
|
||||||
|
|
||||||
// Execute before feature is enabled to get program into the cache.
|
// Execute before feature is enabled to get program into the cache.
|
||||||
let result_without_feature_enabled = bank.process_transaction(&transaction1);
|
let result_without_feature_enabled = bank.process_transaction(&transaction1);
|
||||||
// Should fail when executing here
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
result_without_feature_enabled,
|
result_without_feature_enabled,
|
||||||
Err(TransactionError::InstructionError(
|
Err(TransactionError::InstructionError(
|
||||||
|
@ -12358,31 +12357,23 @@ fn test_runtime_feature_enable_with_program_cache() {
|
||||||
);
|
);
|
||||||
|
|
||||||
// Activate feature
|
// Activate feature
|
||||||
bank.activate_feature(&reject_callx_r10::id());
|
let feature_account_balance =
|
||||||
|
std::cmp::max(genesis_config.rent.minimum_balance(Feature::size_of()), 1);
|
||||||
|
bank.store_account(
|
||||||
|
&feature_set::reject_callx_r10::id(),
|
||||||
|
&feature::create_account(&Feature { activated_at: None }, feature_account_balance),
|
||||||
|
);
|
||||||
|
bank.apply_feature_activations(ApplyFeatureActivationsCaller::NewFromParent, false);
|
||||||
|
|
||||||
// Execute after feature is enabled
|
// Execute after feature is enabled to check it was pruned and reverified.
|
||||||
let result_with_feature_enabled = bank.process_transaction(&transaction2);
|
let result_with_feature_enabled = bank.process_transaction(&transaction2);
|
||||||
// Feature should have been activated thus causing the TX to fail at
|
assert_eq!(
|
||||||
// verification. It should fail here with new Executor Cache because feature
|
result_with_feature_enabled,
|
||||||
// activations should force the program to recompile with the new feature,
|
Err(TransactionError::InstructionError(
|
||||||
// and in this case the feature should cause the TX to fail at verification.
|
0,
|
||||||
// Note: `ProgramFailedToComplete` error appearing again means the account
|
InstructionError::InvalidAccountData
|
||||||
// was not recompiled by the cache upon feature activation and thus fails in
|
))
|
||||||
// the same way.
|
);
|
||||||
match &result_with_feature_enabled {
|
|
||||||
Err(x) => {
|
|
||||||
if *x
|
|
||||||
== TransactionError::InstructionError(0, InstructionError::ProgramFailedToComplete)
|
|
||||||
{
|
|
||||||
println!("ERROR: Program was not recompiled after runtime feature was enabled.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Ok(_) => println!("ERROR: Program should fail during execution."),
|
|
||||||
}
|
|
||||||
// assert_eq!(
|
|
||||||
// result_with_feature_enabled,
|
|
||||||
// Err(TransactionError::InstructionError(0, InstructionError::InvalidAccountData))
|
|
||||||
// );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
Loading…
Reference in New Issue