Skip to content

Commit

Permalink
use verify_precompiles
Browse files Browse the repository at this point in the history
  • Loading branch information
apfitzge committed Oct 2, 2024
1 parent 3a5f523 commit d6121a6
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
3 changes: 2 additions & 1 deletion banks-server/src/banks_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use {
bank::{Bank, TransactionSimulationResult},
bank_forks::BankForks,
commitment::BlockCommitmentCache,
verify_precompiles::verify_precompiles,
},
solana_sdk::{
account::Account,
Expand Down Expand Up @@ -167,7 +168,7 @@ fn verify_transaction(
let move_precompile_verification_to_svm =
feature_set.is_active(&move_precompile_verification_to_svm::id());
if !move_precompile_verification_to_svm {
transaction.verify_precompiles(feature_set)?;
verify_precompiles(transaction, feature_set)?;
}

Ok(())
Expand Down
5 changes: 3 additions & 2 deletions core/src/banking_stage/consumer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use {
solana_runtime::{
bank::{Bank, LoadAndExecuteTransactionsOutput},
transaction_batch::TransactionBatch,
verify_precompiles::verify_precompiles,
},
solana_runtime_transaction::instructions_processor::process_compute_budget_instructions,
solana_sdk::{
Expand Down Expand Up @@ -401,7 +402,7 @@ impl Consumer {
.map(|(tx, result)| match result {
Ok(_) => {
if !move_precompile_verification_to_svm {
tx.verify_precompiles(&bank.feature_set)
verify_precompiles(tx, &bank.feature_set)
} else {
Ok(())
}
Expand Down Expand Up @@ -452,7 +453,7 @@ impl Consumer {
} else {
// Verify pre-compiles.
if !move_precompile_verification_to_svm {
tx.verify_precompiles(&bank.feature_set)?;
verify_precompiles(tx, &bank.feature_set)?;
}

// Any transaction executed between sanitization time and now may have closed the lookup table(s).
Expand Down
3 changes: 2 additions & 1 deletion rpc/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ use {
prioritization_fee_cache::PrioritizationFeeCache,
snapshot_config::SnapshotConfig,
snapshot_utils,
verify_precompiles::verify_precompiles,
},
solana_sdk::{
account::{AccountSharedData, ReadableAccount},
Expand Down Expand Up @@ -2260,7 +2261,7 @@ fn verify_transaction(
let move_precompile_verification_to_svm =
feature_set.is_active(&feature_set::move_precompile_verification_to_svm::id());
if !move_precompile_verification_to_svm {
if let Err(e) = transaction.verify_precompiles(feature_set) {
if let Err(e) = verify_precompiles(transaction, feature_set) {
return Err(RpcCustomError::TransactionPrecompileVerificationFailure(e).into());
}
}
Expand Down
3 changes: 2 additions & 1 deletion runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ use {
stakes::{InvalidCacheEntryReason, Stakes, StakesCache, StakesEnum},
status_cache::{SlotDelta, StatusCache},
transaction_batch::{OwnedOrBorrowed, TransactionBatch},
verify_precompiles::verify_precompiles,
},
byteorder::{ByteOrder, LittleEndian},
dashmap::{DashMap, DashSet},
Expand Down Expand Up @@ -5664,7 +5665,7 @@ impl Bank {
verification_mode == TransactionVerificationMode::HashAndVerifyPrecompiles
|| verification_mode == TransactionVerificationMode::FullVerification
} {
sanitized_tx.verify_precompiles(&self.feature_set)?;
verify_precompiles(&sanitized_tx, &self.feature_set)?;
}

Ok(sanitized_tx)
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub mod stakes;
pub mod static_ids;
pub mod status_cache;
pub mod transaction_batch;
mod verify_precompiles;
pub mod verify_precompiles;
pub mod vote_sender_types;

#[macro_use]
Expand Down

0 comments on commit d6121a6

Please sign in to comment.