Move remaining nonce utils from runtime to SDK
This commit is contained in:
parent
65b868f4eb
commit
3c7b9c2938
|
@ -3,9 +3,9 @@ use itertools::izip;
|
||||||
use solana_ledger::{blockstore::Blockstore, blockstore_processor::TransactionStatusBatch};
|
use solana_ledger::{blockstore::Blockstore, blockstore_processor::TransactionStatusBatch};
|
||||||
use solana_runtime::{
|
use solana_runtime::{
|
||||||
bank::{Bank, HashAgeKind},
|
bank::{Bank, HashAgeKind},
|
||||||
nonce_utils,
|
|
||||||
transaction_utils::OrderedIterator,
|
transaction_utils::OrderedIterator,
|
||||||
};
|
};
|
||||||
|
use solana_sdk::nonce;
|
||||||
use solana_transaction_status::{InnerInstructions, TransactionStatusMeta};
|
use solana_transaction_status::{InnerInstructions, TransactionStatusMeta};
|
||||||
use std::{
|
use std::{
|
||||||
sync::{
|
sync::{
|
||||||
|
@ -75,7 +75,7 @@ impl TransactionStatusService {
|
||||||
if Bank::can_commit(&status) && !transaction.signatures.is_empty() {
|
if Bank::can_commit(&status) && !transaction.signatures.is_empty() {
|
||||||
let fee_calculator = match hash_age_kind {
|
let fee_calculator = match hash_age_kind {
|
||||||
Some(HashAgeKind::DurableNonce(_, account)) => {
|
Some(HashAgeKind::DurableNonce(_, account)) => {
|
||||||
nonce_utils::fee_calculator_of(&account)
|
nonce::utils::fee_calculator_of(&account)
|
||||||
}
|
}
|
||||||
_ => bank.get_fee_calculator(&transaction.message().recent_blockhash),
|
_ => bank.get_fee_calculator(&transaction.message().recent_blockhash),
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ use crate::{
|
||||||
bank::{HashAgeKind, TransactionProcessResult},
|
bank::{HashAgeKind, TransactionProcessResult},
|
||||||
blockhash_queue::BlockhashQueue,
|
blockhash_queue::BlockhashQueue,
|
||||||
feature_set::{self, FeatureSet},
|
feature_set::{self, FeatureSet},
|
||||||
nonce_utils,
|
|
||||||
rent_collector::RentCollector,
|
rent_collector::RentCollector,
|
||||||
system_instruction_processor::{get_system_account_kind, SystemAccountKind},
|
system_instruction_processor::{get_system_account_kind, SystemAccountKind},
|
||||||
transaction_utils::OrderedIterator,
|
transaction_utils::OrderedIterator,
|
||||||
|
@ -316,7 +315,7 @@ impl Accounts {
|
||||||
((_, tx), (Ok(()), hash_age_kind)) => {
|
((_, tx), (Ok(()), hash_age_kind)) => {
|
||||||
let fee_calculator = match hash_age_kind.as_ref() {
|
let fee_calculator = match hash_age_kind.as_ref() {
|
||||||
Some(HashAgeKind::DurableNonce(_, account)) => {
|
Some(HashAgeKind::DurableNonce(_, account)) => {
|
||||||
nonce_utils::fee_calculator_of(account)
|
nonce::utils::fee_calculator_of(account)
|
||||||
}
|
}
|
||||||
_ => hash_queue
|
_ => hash_queue
|
||||||
.get_fee_calculator(&tx.message().recent_blockhash)
|
.get_fee_calculator(&tx.message().recent_blockhash)
|
||||||
|
|
|
@ -17,7 +17,6 @@ use crate::{
|
||||||
instruction_recorder::InstructionRecorder,
|
instruction_recorder::InstructionRecorder,
|
||||||
log_collector::LogCollector,
|
log_collector::LogCollector,
|
||||||
message_processor::{Executors, MessageProcessor},
|
message_processor::{Executors, MessageProcessor},
|
||||||
nonce_utils,
|
|
||||||
process_instruction::{Executor, ProcessInstruction, ProcessInstructionWithContext},
|
process_instruction::{Executor, ProcessInstruction, ProcessInstructionWithContext},
|
||||||
rent_collector::RentCollector,
|
rent_collector::RentCollector,
|
||||||
stakes::Stakes,
|
stakes::Stakes,
|
||||||
|
@ -1828,7 +1827,7 @@ impl Bank {
|
||||||
.map(|acc| (*nonce_pubkey, acc))
|
.map(|acc| (*nonce_pubkey, acc))
|
||||||
})
|
})
|
||||||
.filter(|(_pubkey, nonce_account)| {
|
.filter(|(_pubkey, nonce_account)| {
|
||||||
nonce_utils::verify_nonce_account(nonce_account, &tx.message().recent_blockhash)
|
nonce::utils::verify_nonce_account(nonce_account, &tx.message().recent_blockhash)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2244,7 +2243,7 @@ impl Bank {
|
||||||
.map(|((_, tx), (res, hash_age_kind))| {
|
.map(|((_, tx), (res, hash_age_kind))| {
|
||||||
let (fee_calculator, is_durable_nonce) = match hash_age_kind {
|
let (fee_calculator, is_durable_nonce) = match hash_age_kind {
|
||||||
Some(HashAgeKind::DurableNonce(_, account)) => {
|
Some(HashAgeKind::DurableNonce(_, account)) => {
|
||||||
(nonce_utils::fee_calculator_of(account), true)
|
(nonce::utils::fee_calculator_of(account), true)
|
||||||
}
|
}
|
||||||
_ => (
|
_ => (
|
||||||
hash_queue
|
hash_queue
|
||||||
|
|
|
@ -22,7 +22,6 @@ pub mod loader_utils;
|
||||||
pub mod log_collector;
|
pub mod log_collector;
|
||||||
pub mod message_processor;
|
pub mod message_processor;
|
||||||
mod native_loader;
|
mod native_loader;
|
||||||
pub mod nonce_utils;
|
|
||||||
pub mod process_instruction;
|
pub mod process_instruction;
|
||||||
pub mod rent_collector;
|
pub mod rent_collector;
|
||||||
pub mod serde_snapshot;
|
pub mod serde_snapshot;
|
||||||
|
|
|
@ -2,3 +2,4 @@ pub mod account;
|
||||||
pub use account::{create_account, Account};
|
pub use account::{create_account, Account};
|
||||||
pub mod state;
|
pub mod state;
|
||||||
pub use state::State;
|
pub use state::State;
|
||||||
|
pub mod utils;
|
||||||
|
|
Loading…
Reference in New Issue