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
13 changes: 9 additions & 4 deletions banks-server/src/banks_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use {
TransactionSimulationDetails, TransactionStatus,
},
solana_client::connection_cache::ConnectionCache,
solana_feature_set::{move_precompile_verification_to_svm, FeatureSet},
solana_feature_set::{enable_loader_v4, move_precompile_verification_to_svm, FeatureSet},
solana_runtime::{
bank::{Bank, TransactionSimulationResult},
bank_forks::BankForks,
Expand Down Expand Up @@ -185,6 +185,7 @@ fn simulate_transaction(
Some(false), // is_simple_vote_tx
bank,
bank.get_reserved_account_keys(),
bank.feature_set.is_active(&enable_loader_v4::id()),
) {
Err(err) => {
return BanksTransactionResultWithSimulation {
Expand Down Expand Up @@ -322,6 +323,7 @@ impl Banks for BanksServer {
Some(false), // is_simple_vote_tx
bank.as_ref(),
bank.get_reserved_account_keys(),
bank.feature_set.is_active(&enable_loader_v4::id()),
) {
Ok(tx) => tx,
Err(err) => return Some(Err(err)),
Expand Down Expand Up @@ -405,9 +407,12 @@ impl Banks for BanksServer {
commitment: CommitmentLevel,
) -> Option<u64> {
let bank = self.bank(commitment);
let sanitized_message =
SanitizedMessage::try_from_legacy_message(message, bank.get_reserved_account_keys())
.ok()?;
let sanitized_message = SanitizedMessage::try_from_legacy_message(
message,
bank.get_reserved_account_keys(),
bank.feature_set.is_active(&enable_loader_v4::id()),
)
.ok()?;
bank.get_fee_for_message(&sanitized_message)
}
}
Expand Down
6 changes: 5 additions & 1 deletion cli-output/src/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,11 @@ fn write_transaction<W: io::Write>(
for (account_index, account) in account_keys.iter().enumerate() {
let account_meta = CliAccountMeta {
is_signer: message.is_signer(account_index),
is_writable: message.is_maybe_writable(account_index, Some(&reserved_account_keys)),
is_writable: message.is_maybe_writable(
account_index,
Some(&reserved_account_keys),
true,
),
is_invoked: message.is_invoked(account_index),
};

Expand Down
1 change: 1 addition & 0 deletions core/src/banking_stage/consume_worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1175,6 +1175,7 @@ mod tests {
None,
loader,
&HashSet::default(),
true,
)
.unwrap()
};
Expand Down
1 change: 1 addition & 0 deletions core/src/banking_stage/consumer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2072,6 +2072,7 @@ mod tests {
Some(false),
bank.as_ref(),
&ReservedAccountKeys::empty_key_set(),
true,
)
.unwrap();

Expand Down
4 changes: 3 additions & 1 deletion core/src/banking_stage/immutable_deserialized_packet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use {
solana_sanitize::SanitizeError,
solana_sdk::{
clock::Slot,
feature_set::FeatureSet,
feature_set::{self, FeatureSet},
hash::Hash,
message::{v0::LoadedAddresses, AddressLoaderError, Message, SimpleAddressLoader},
pubkey::Pubkey,
Expand Down Expand Up @@ -148,6 +148,8 @@ impl ImmutableDeserializedPacket {
tx,
address_loader,
reserved_account_keys,
bank.feature_set
.is_active(&feature_set::enable_loader_v4::id()),
)
})
.ok()?;
Expand Down
1 change: 1 addition & 0 deletions core/src/banking_stage/read_write_account_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ mod tests {
Some(false),
bank,
bank.get_reserved_account_keys(),
true,
)
.unwrap()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use {
crossbeam_channel::{RecvTimeoutError, TryRecvError},
solana_accounts_db::account_locks::validate_account_locks,
solana_cost_model::cost_model::CostModel,
solana_feature_set::enable_loader_v4,
solana_measure::measure_us,
solana_runtime::{bank::Bank, bank_forks::BankForks},
solana_runtime_transaction::{
Expand Down Expand Up @@ -507,6 +508,7 @@ impl TransactionViewReceiveAndBuffer {
view,
loaded_addresses,
root_bank.get_reserved_account_keys(),
root_bank.feature_set.is_active(&enable_loader_v4::id()),
) else {
return Err(());
};
Expand Down
2 changes: 2 additions & 0 deletions cost-model/src/transaction_cost.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ mod tests {
Some(true),
SimpleAddressLoader::Disabled,
&ReservedAccountKeys::empty_key_set(),
true,
)
.unwrap();

Expand All @@ -333,6 +334,7 @@ mod tests {
Some(false),
SimpleAddressLoader::Disabled,
&ReservedAccountKeys::empty_key_set(),
true,
)
.unwrap();

Expand Down
2 changes: 2 additions & 0 deletions entry/benches/entry_sigverify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ fn bench_gpusigverify(bencher: &mut Bencher) {
None,
SimpleAddressLoader::Disabled,
&ReservedAccountKeys::empty_key_set(),
true,
)
}?;

Expand Down Expand Up @@ -89,6 +90,7 @@ fn bench_cpusigverify(bencher: &mut Bencher) {
None,
SimpleAddressLoader::Disabled,
&ReservedAccountKeys::empty_key_set(),
true,
)
}?;

Expand Down
1 change: 1 addition & 0 deletions entry/src/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1081,6 +1081,7 @@ mod tests {
None,
SimpleAddressLoader::Disabled,
&ReservedAccountKeys::empty_key_set(),
true,
)
}?;

Expand Down
1 change: 1 addition & 0 deletions ledger-tool/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,7 @@ fn compute_slot_cost(
None,
SimpleAddressLoader::Disabled,
&reserved_account_keys.active,
true,
)
.map_err(|err| {
warn!("Failed to compute cost of transaction: {:?}", err);
Expand Down
2 changes: 2 additions & 0 deletions programs/sbf/tests/programs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3443,6 +3443,7 @@ fn test_program_fees() {
let sanitized_message = SanitizedMessage::try_from_legacy_message(
message.clone(),
&ReservedAccountKeys::empty_key_set(),
true,
)
.unwrap();
let fee_budget_limits = FeeBudgetLimits::from(
Expand Down Expand Up @@ -3476,6 +3477,7 @@ fn test_program_fees() {
let sanitized_message = SanitizedMessage::try_from_legacy_message(
message.clone(),
&ReservedAccountKeys::empty_key_set(),
true,
)
.unwrap();
let fee_budget_limits = FeeBudgetLimits::from(
Expand Down
22 changes: 18 additions & 4 deletions rpc/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3870,6 +3870,9 @@ pub mod rpc_full {
unsanitized_tx,
preflight_bank,
preflight_bank.get_reserved_account_keys(),
preflight_bank
.feature_set
.is_active(&feature_set::enable_loader_v4::id()),
)?;
let signature = *transaction.signature();

Expand Down Expand Up @@ -4003,8 +4006,13 @@ pub mod rpc_full {
});
}

let transaction =
sanitize_transaction(unsanitized_tx, bank, bank.get_reserved_account_keys())?;
let transaction = sanitize_transaction(
unsanitized_tx,
bank,
bank.get_reserved_account_keys(),
bank.feature_set
.is_active(&feature_set::enable_loader_v4::id()),
)?;
if sig_verify {
verify_transaction(&transaction, &bank.feature_set)?;
}
Expand Down Expand Up @@ -4260,6 +4268,8 @@ pub mod rpc_full {
sanitized_versioned_message,
bank,
bank.get_reserved_account_keys(),
bank.feature_set
.is_active(&feature_set::enable_loader_v4::id()),
)
.map_err(|err| Error::invalid_params(format!("invalid transaction message: {err}")))?;
let fee = bank.get_fee_for_message(&sanitized_message);
Expand Down Expand Up @@ -4395,13 +4405,15 @@ fn sanitize_transaction(
transaction: VersionedTransaction,
address_loader: impl AddressLoader,
reserved_account_keys: &HashSet<Pubkey>,
enable_loader_v4: bool,
) -> Result<RuntimeTransaction<SanitizedTransaction>> {
RuntimeTransaction::try_create(
transaction,
MessageHash::Compute,
None,
address_loader,
reserved_account_keys,
enable_loader_v4,
)
.map_err(|err| Error::invalid_params(format!("invalid transaction: {err}")))
}
Expand Down Expand Up @@ -8838,7 +8850,8 @@ pub mod tests {
sanitize_transaction(
unsanitary_versioned_tx,
SimpleAddressLoader::Disabled,
&ReservedAccountKeys::empty_key_set()
&ReservedAccountKeys::empty_key_set(),
true,
)
.unwrap_err(),
expect58
Expand All @@ -8863,7 +8876,8 @@ pub mod tests {
sanitize_transaction(
versioned_tx,
SimpleAddressLoader::Disabled,
&ReservedAccountKeys::empty_key_set()
&ReservedAccountKeys::empty_key_set(),
true,
)
.unwrap_err(),
Error::invalid_params(
Expand Down
3 changes: 3 additions & 0 deletions rpc/src/transaction_status_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ pub(crate) mod tests {
None,
SimpleAddressLoader::Disabled,
&ReservedAccountKeys::empty_key_set(),
true,
)
.unwrap();

Expand Down Expand Up @@ -469,6 +470,7 @@ pub(crate) mod tests {
None,
SimpleAddressLoader::Disabled,
&ReservedAccountKeys::empty_key_set(),
true,
)
.unwrap();

Expand All @@ -480,6 +482,7 @@ pub(crate) mod tests {
None,
SimpleAddressLoader::Disabled,
&ReservedAccountKeys::empty_key_set(),
true,
)
.unwrap();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ impl RuntimeTransaction<SanitizedTransaction> {
is_simple_vote_tx: Option<bool>,
address_loader: impl AddressLoader,
reserved_account_keys: &HashSet<Pubkey>,
enable_loader_v4: bool,
) -> Result<Self> {
let statically_loaded_runtime_tx =
RuntimeTransaction::<SanitizedVersionedTransaction>::try_from(
Expand All @@ -87,6 +88,7 @@ impl RuntimeTransaction<SanitizedTransaction> {
statically_loaded_runtime_tx,
address_loader,
reserved_account_keys,
enable_loader_v4,
)
}

Expand All @@ -97,6 +99,7 @@ impl RuntimeTransaction<SanitizedTransaction> {
statically_loaded_runtime_tx: RuntimeTransaction<SanitizedVersionedTransaction>,
address_loader: impl AddressLoader,
reserved_account_keys: &HashSet<Pubkey>,
enable_loader_v4: bool,
) -> Result<Self> {
let hash = *statically_loaded_runtime_tx.message_hash();
let is_simple_vote_tx = statically_loaded_runtime_tx.is_simple_vote_transaction();
Expand All @@ -106,6 +109,7 @@ impl RuntimeTransaction<SanitizedTransaction> {
is_simple_vote_tx,
address_loader,
reserved_account_keys,
enable_loader_v4,
)?;

let mut tx = Self {
Expand Down Expand Up @@ -144,6 +148,7 @@ impl RuntimeTransaction<SanitizedTransaction> {
None,
solana_message::SimpleAddressLoader::Disabled,
&HashSet::new(),
true,
)
.expect("failed to create RuntimeTransaction from Transaction")
}
Expand Down Expand Up @@ -290,6 +295,7 @@ mod tests {
statically_loaded_transaction,
SimpleAddressLoader::Disabled,
&ReservedAccountKeys::empty_key_set(),
true,
);
let dynamically_loaded_transaction =
dynamically_loaded_transaction.expect("created from statically loaded tx");
Expand Down
16 changes: 13 additions & 3 deletions runtime-transaction/src/runtime_transaction/transaction_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,20 @@ impl<D: TransactionData> RuntimeTransaction<ResolvedTransactionView<D>> {
statically_loaded_runtime_tx: RuntimeTransaction<SanitizedTransactionView<D>>,
loaded_addresses: Option<LoadedAddresses>,
reserved_account_keys: &HashSet<Pubkey>,
enable_loader_v4: bool,
) -> Result<Self> {
let RuntimeTransaction { transaction, meta } = statically_loaded_runtime_tx;
// transaction-view does not distinguish between different types of errors here.
// return generic sanitize failure error here.
// these transactions should be immediately dropped, and we generally
// will not care about the specific error at this point.
let transaction =
ResolvedTransactionView::try_new(transaction, loaded_addresses, reserved_account_keys)
.map_err(|_| TransactionError::SanitizeFailure)?;
let transaction = ResolvedTransactionView::try_new(
transaction,
loaded_addresses,
reserved_account_keys,
enable_loader_v4,
)
.map_err(|_| TransactionError::SanitizeFailure)?;
let mut tx = Self { transaction, meta };
tx.load_dynamic_metadata()?;

Expand Down Expand Up @@ -233,6 +238,7 @@ mod tests {
static_runtime_transaction,
None,
&ReservedAccountKeys::empty_key_set(),
true,
)
.unwrap();

Expand All @@ -259,6 +265,7 @@ mod tests {
runtime_transaction,
loaded_addresses,
reserved_account_keys,
true,
)
.unwrap();

Expand Down Expand Up @@ -325,6 +332,7 @@ mod tests {
runtime_transaction,
loaded_addresses,
reserved_account_keys,
true,
)
.unwrap();

Expand All @@ -350,6 +358,7 @@ mod tests {
None,
SimpleAddressLoader::Disabled,
&reserved_key_set,
true,
)
.unwrap();
assert_translation(sanitized_transaction, None, &reserved_key_set);
Expand Down Expand Up @@ -382,6 +391,7 @@ mod tests {
None,
SimpleAddressLoader::Enabled(loaded_addresses.clone()),
&reserved_key_set,
true,
)
.unwrap();
assert_translation(
Expand Down
Loading