diff --git a/account-decoder/src/parse_nonce.rs b/account-decoder/src/parse_nonce.rs index 0b589b0cd04cb4..fc279e4ec47128 100644 --- a/account-decoder/src/parse_nonce.rs +++ b/account-decoder/src/parse_nonce.rs @@ -20,7 +20,8 @@ pub fn parse_nonce(data: &[u8]) -> Result { State::Initialized(data) => Ok(UiNonceState::Initialized(UiNonceData { authority: data.authority.to_string(), blockhash: data.blockhash().to_string(), - fee_calculator: data.fee_calculator.into(), + // NOTE: plug a dummy fee_calculator for decorder for now. + fee_calculator: UiFeeCalculator::default(), })), } } diff --git a/accounts-db/src/accounts.rs b/accounts-db/src/accounts.rs index 0c0058703503d0..531d7f8beaff3a 100644 --- a/accounts-db/src/accounts.rs +++ b/accounts-db/src/accounts.rs @@ -657,7 +657,6 @@ impl Accounts { loaded: &mut [TransactionLoadResult], rent_collector: &RentCollector, durable_nonce: &DurableNonce, - lamports_per_signature: u64, ) { let (accounts_to_store, transactions) = self.collect_accounts_to_store( txs, @@ -665,7 +664,6 @@ impl Accounts { loaded, rent_collector, durable_nonce, - lamports_per_signature, ); self.accounts_db .store_cached_inline_update_index((slot, &accounts_to_store[..]), Some(&transactions)); @@ -691,7 +689,6 @@ impl Accounts { load_results: &'a mut [TransactionLoadResult], _rent_collector: &RentCollector, durable_nonce: &DurableNonce, - lamports_per_signature: u64, ) -> ( Vec<(&'a Pubkey, &'a AccountSharedData)>, Vec>, @@ -741,7 +738,6 @@ impl Accounts { is_fee_payer, maybe_nonce, durable_nonce, - lamports_per_signature, ); if execution_status.is_ok() || is_nonce_account || is_fee_payer { @@ -763,7 +759,6 @@ fn prepare_if_nonce_account( is_fee_payer: bool, maybe_nonce: Option<(&NonceFull, bool)>, &durable_nonce: &DurableNonce, - lamports_per_signature: u64, ) -> bool { if let Some((nonce, rollback)) = maybe_nonce { if address == nonce.address() { @@ -786,7 +781,6 @@ fn prepare_if_nonce_account( let nonce_state = NonceState::new_initialized( &data.authority, durable_nonce, - lamports_per_signature, ); let nonce_versions = NonceVersions::new(nonce_state); account.set_state(&nonce_versions).unwrap(); @@ -1583,7 +1577,6 @@ mod tests { loaded.as_mut_slice(), &rent_collector, &DurableNonce::default(), - 0, ); assert_eq!(collected_accounts.len(), 2); assert!(collected_accounts @@ -1639,7 +1632,6 @@ mod tests { AccountSharedData, AccountSharedData, DurableNonce, - u64, Option, ) { let data = NonceVersions::new(NonceState::Initialized(nonce::state::Data::default())); @@ -1652,7 +1644,6 @@ mod tests { pre_account, account, durable_nonce, - 1234, None, ) } @@ -1664,7 +1655,6 @@ mod tests { is_fee_payer: bool, maybe_nonce: Option<(&NonceFull, bool)>, durable_nonce: &DurableNonce, - lamports_per_signature: u64, expect_account: &AccountSharedData, ) -> bool { // Verify expect_account's relationship @@ -1684,7 +1674,6 @@ mod tests { is_fee_payer, maybe_nonce, durable_nonce, - lamports_per_signature, ); assert_eq!(expect_account, account); expect_account == account @@ -1697,7 +1686,6 @@ mod tests { pre_account, mut post_account, blockhash, - lamports_per_signature, maybe_fee_payer_account, ) = create_accounts_prepare_if_nonce_account(); let post_account_address = pre_account_address; @@ -1710,7 +1698,7 @@ mod tests { let mut expect_account = pre_account; expect_account .set_state(&NonceVersions::new(NonceState::Initialized( - nonce::state::Data::new(Pubkey::default(), blockhash, lamports_per_signature), + nonce::state::Data::new(Pubkey::default(), blockhash), ))) .unwrap(); @@ -1721,7 +1709,6 @@ mod tests { false, Some((&nonce, true)), &blockhash, - lamports_per_signature, &expect_account, )); } @@ -1733,7 +1720,6 @@ mod tests { _pre_account, _post_account, blockhash, - lamports_per_signature, _maybe_fee_payer_account, ) = create_accounts_prepare_if_nonce_account(); let post_account_address = pre_account_address; @@ -1747,7 +1733,6 @@ mod tests { false, None, &blockhash, - lamports_per_signature, &expect_account, )); } @@ -1759,7 +1744,6 @@ mod tests { pre_account, mut post_account, blockhash, - lamports_per_signature, maybe_fee_payer_account, ) = create_accounts_prepare_if_nonce_account(); @@ -1774,7 +1758,6 @@ mod tests { false, Some((&nonce, true)), &blockhash, - lamports_per_signature, &expect_account, )); } @@ -1786,7 +1769,6 @@ mod tests { pre_account, mut post_account, blockhash, - lamports_per_signature, maybe_fee_payer_account, ) = create_accounts_prepare_if_nonce_account(); let post_account_address = pre_account_address; @@ -1796,7 +1778,7 @@ mod tests { expect_account .set_state(&NonceVersions::new(NonceState::Initialized( - nonce::state::Data::new(Pubkey::default(), blockhash, lamports_per_signature), + nonce::state::Data::new(Pubkey::default(), blockhash), ))) .unwrap(); @@ -1810,7 +1792,6 @@ mod tests { false, Some((&nonce, true)), &blockhash, - lamports_per_signature, &expect_account, )); } @@ -1838,7 +1819,6 @@ mod tests { false, Some((&nonce, true)), &DurableNonce::default(), - 1, &post_fee_payer_account, )); @@ -1849,7 +1829,6 @@ mod tests { true, Some((&nonce, true)), &DurableNonce::default(), - 1, &post_fee_payer_account, )); @@ -1863,7 +1842,6 @@ mod tests { true, None, &DurableNonce::default(), - 1, &post_fee_payer_account, )); @@ -1877,7 +1855,6 @@ mod tests { true, Some((&nonce, true)), &DurableNonce::default(), - 1, &pre_fee_payer_account, )); } @@ -1895,7 +1872,6 @@ mod tests { let nonce_state = NonceVersions::new(NonceState::Initialized(nonce::state::Data::new( nonce_authority.pubkey(), durable_nonce, - 0, ))); let nonce_account_post = AccountSharedData::new_data(43, &nonce_state, &system_program::id()).unwrap(); @@ -1923,7 +1899,6 @@ mod tests { let nonce_state = NonceVersions::new(NonceState::Initialized(nonce::state::Data::new( nonce_authority.pubkey(), durable_nonce, - 0, ))); let nonce_account_pre = AccountSharedData::new_data(42, &nonce_state, &system_program::id()).unwrap(); @@ -1964,7 +1939,6 @@ mod tests { loaded.as_mut_slice(), &rent_collector, &durable_nonce, - 0, ); assert_eq!(collected_accounts.len(), 2); assert_eq!( @@ -2005,7 +1979,6 @@ mod tests { let nonce_state = NonceVersions::new(NonceState::Initialized(nonce::state::Data::new( nonce_authority.pubkey(), durable_nonce, - 0, ))); let nonce_account_post = AccountSharedData::new_data(43, &nonce_state, &system_program::id()).unwrap(); @@ -2033,7 +2006,6 @@ mod tests { let nonce_state = NonceVersions::new(NonceState::Initialized(nonce::state::Data::new( nonce_authority.pubkey(), durable_nonce, - 0, ))); let nonce_account_pre = AccountSharedData::new_data(42, &nonce_state, &system_program::id()).unwrap(); @@ -2073,7 +2045,6 @@ mod tests { loaded.as_mut_slice(), &rent_collector, &durable_nonce, - 0, ); assert_eq!(collected_accounts.len(), 1); let collected_nonce_account = collected_accounts diff --git a/accounts-db/src/nonce_info.rs b/accounts-db/src/nonce_info.rs index 8a6d3a40fc7ecc..a46b76abbfc487 100644 --- a/accounts-db/src/nonce_info.rs +++ b/accounts-db/src/nonce_info.rs @@ -3,7 +3,6 @@ use { solana_sdk::{ account::{AccountSharedData, ReadableAccount, WritableAccount}, message::SanitizedMessage, - nonce_account, pubkey::Pubkey, transaction::{self, TransactionError}, transaction_context::TransactionAccount, @@ -13,7 +12,6 @@ use { pub trait NonceInfo { fn address(&self) -> &Pubkey; fn account(&self) -> &AccountSharedData; - fn lamports_per_signature(&self) -> Option; fn fee_payer_account(&self) -> Option<&AccountSharedData>; } @@ -37,9 +35,6 @@ impl NonceInfo for NoncePartial { fn account(&self) -> &AccountSharedData { &self.account } - fn lamports_per_signature(&self) -> Option { - nonce_account::lamports_per_signature_of(&self.account) - } fn fee_payer_account(&self) -> Option<&AccountSharedData> { None } @@ -108,9 +103,6 @@ impl NonceInfo for NonceFull { fn account(&self) -> &AccountSharedData { &self.account } - fn lamports_per_signature(&self) -> Option { - nonce_account::lamports_per_signature_of(&self.account) - } fn fee_payer_account(&self) -> Option<&AccountSharedData> { self.fee_payer_account.as_ref() } @@ -139,8 +131,6 @@ mod tests { #[test] fn test_nonce_info() { - let lamports_per_signature = 42; - let nonce_authority = keypair_from_seed(&[0; 32]).unwrap(); let nonce_address = nonce_authority.pubkey(); let from = keypair_from_seed(&[1; 32]).unwrap(); @@ -153,7 +143,6 @@ mod tests { &nonce::state::Versions::new(nonce::State::Initialized(nonce::state::Data::new( Pubkey::default(), durable_nonce, - lamports_per_signature, ))), &system_program::id(), ) @@ -183,10 +172,6 @@ mod tests { let partial = NoncePartial::new(nonce_address, rent_collected_nonce_account.clone()); assert_eq!(*partial.address(), nonce_address); assert_eq!(*partial.account(), rent_collected_nonce_account); - assert_eq!( - partial.lamports_per_signature(), - Some(lamports_per_signature) - ); assert_eq!(partial.fee_payer_account(), None); // Add rent debits to ensure the rollback captures accounts without rent fees @@ -225,7 +210,6 @@ mod tests { NonceFull::from_partial(&partial, &message, &accounts, &rent_debits).unwrap(); assert_eq!(*full.address(), nonce_address); assert_eq!(*full.account(), rent_collected_nonce_account); - assert_eq!(full.lamports_per_signature(), Some(lamports_per_signature)); assert_eq!( full.fee_payer_account(), Some(&from_account), @@ -256,7 +240,6 @@ mod tests { NonceFull::from_partial(&partial, &message, &accounts, &rent_debits).unwrap(); assert_eq!(*full.address(), nonce_address); assert_eq!(*full.account(), nonce_account); - assert_eq!(full.lamports_per_signature(), Some(lamports_per_signature)); assert_eq!(full.fee_payer_account(), None); } diff --git a/accounts-db/src/transaction_results.rs b/accounts-db/src/transaction_results.rs index bcfe185856ace4..994737505f989d 100644 --- a/accounts-db/src/transaction_results.rs +++ b/accounts-db/src/transaction_results.rs @@ -6,7 +6,7 @@ pub use solana_sdk::inner_instruction::{InnerInstruction, InnerInstructionsList}; use { crate::{ - nonce_info::{NonceFull, NonceInfo, NoncePartial}, + nonce_info::{NonceFull, NoncePartial}, rent_debits::RentDebits, }, solana_program_runtime::loaded_programs::LoadedProgramsForTxBatch, @@ -87,6 +87,7 @@ pub struct TransactionExecutionDetails { pub accounts_data_len_delta: i64, } +// TODO - remove `DurableNonceFee` as it'd always be Invalid. #[derive(Debug, Clone)] pub enum DurableNonceFee { Valid(u64), @@ -94,11 +95,8 @@ pub enum DurableNonceFee { } impl From<&NonceFull> for DurableNonceFee { - fn from(nonce: &NonceFull) -> Self { - match nonce.lamports_per_signature() { - Some(lamports_per_signature) => Self::Valid(lamports_per_signature), - None => Self::Invalid, - } + fn from(_nonce: &NonceFull) -> Self { + Self::Invalid } } diff --git a/cli/src/nonce.rs b/cli/src/nonce.rs index bc6fd981cea951..9284c723804fd7 100644 --- a/cli/src/nonce.rs +++ b/cli/src/nonce.rs @@ -597,7 +597,9 @@ pub fn process_show_nonce_account( }; if let Some(data) = data { nonce_account.nonce = Some(data.blockhash().to_string()); - nonce_account.lamports_per_signature = Some(data.fee_calculator.lamports_per_signature); + // TODO - shoudl also nonce_account's lamports_per_signature in this PR? or do it in + // separate one. + nonce_account.lamports_per_signature = None; nonce_account.authority = Some(data.authority.to_string()); } @@ -1001,7 +1003,6 @@ mod tests { let data = Versions::new(State::Initialized(nonce::state::Data::new( nonce_pubkey, durable_nonce, - 0, ))); let valid = Account::new_data(1, &data, &system_program::ID); assert!(check_nonce_account(&valid.unwrap(), &nonce_pubkey, &blockhash).is_ok()); @@ -1024,7 +1025,6 @@ mod tests { let data = Versions::new(State::Initialized(nonce::state::Data::new( nonce_pubkey, invalid_durable_nonce, - 0, ))); let invalid_hash = Account::new_data(1, &data, &system_program::ID).unwrap(); if let CliError::InvalidNonce(err) = @@ -1043,7 +1043,6 @@ mod tests { let data = Versions::new(State::Initialized(nonce::state::Data::new( new_nonce_authority, durable_nonce, - 0, ))); let invalid_authority = Account::new_data(1, &data, &system_program::ID); if let CliError::InvalidNonce(err) = @@ -1092,7 +1091,7 @@ mod tests { assert_eq!(state_from_account(&nonce_account), Ok(State::Uninitialized)); let durable_nonce = DurableNonce::from_blockhash(&Hash::new(&[42u8; 32])); - let data = nonce::state::Data::new(Pubkey::from([1u8; 32]), durable_nonce, 42); + let data = nonce::state::Data::new(Pubkey::from([1u8; 32]), durable_nonce); nonce_account .set_state(&Versions::new(State::Initialized(data.clone()))) .unwrap(); @@ -1122,7 +1121,7 @@ mod tests { ); let durable_nonce = DurableNonce::from_blockhash(&Hash::new(&[42u8; 32])); - let data = nonce::state::Data::new(Pubkey::from([1u8; 32]), durable_nonce, 42); + let data = nonce::state::Data::new(Pubkey::from([1u8; 32]), durable_nonce); nonce_account .set_state(&Versions::new(State::Initialized(data.clone()))) .unwrap(); diff --git a/core/src/banking_stage/consumer.rs b/core/src/banking_stage/consumer.rs index d5dccca98a0fae..994e181062bbdb 100644 --- a/core/src/banking_stage/consumer.rs +++ b/core/src/banking_stage/consumer.rs @@ -825,7 +825,6 @@ mod tests { state::{AddressLookupTable, LookupTableMeta}, }, compute_budget, - fee_calculator::FeeCalculator, hash::Hash, instruction::InstructionError, message::{ @@ -1164,7 +1163,6 @@ mod tests { let nonce_state = nonce::State::Initialized(nonce::state::Data { authority: mint_keypair.pubkey(), durable_nonce, - fee_calculator: FeeCalculator::new(5000), }); store_nonce_account(&bank, nonce_pubkey, nonce_state); diff --git a/programs/system/src/system_instruction.rs b/programs/system/src/system_instruction.rs index 0c9daf22d4b024..06fb3a650f4803 100644 --- a/programs/system/src/system_instruction.rs +++ b/programs/system/src/system_instruction.rs @@ -54,7 +54,6 @@ pub fn advance_nonce_account( let new_data = nonce::state::Data::new( data.authority, next_durable_nonce, - invoke_context.lamports_per_signature, ); account.set_state( &Versions::new(State::Initialized(new_data)), @@ -187,7 +186,6 @@ pub fn initialize_nonce_account( let data = nonce::state::Data::new( *nonce_authority, durable_nonce, - invoke_context.lamports_per_signature, ); let state = State::Initialized(data); account.set_state(&Versions::new(state), &invoke_context.feature_set) @@ -350,7 +348,6 @@ mod test { let data = nonce::state::Data::new( data.authority, DurableNonce::from_blockhash(&invoke_context.blockhash), - invoke_context.lamports_per_signature, ); // First nonce instruction drives state from Uninitialized to Initialized assert_eq!(versions.state(), &State::Initialized(data.clone())); @@ -360,7 +357,6 @@ mod test { let data = nonce::state::Data::new( data.authority, DurableNonce::from_blockhash(&invoke_context.blockhash), - invoke_context.lamports_per_signature, ); // Second nonce instruction consumes and replaces stored nonce assert_eq!(versions.state(), &State::Initialized(data.clone())); @@ -370,7 +366,6 @@ mod test { let data = nonce::state::Data::new( data.authority, DurableNonce::from_blockhash(&invoke_context.blockhash), - invoke_context.lamports_per_signature, ); // Third nonce instruction for fun and profit assert_eq!(versions.state(), &State::Initialized(data)); @@ -429,7 +424,6 @@ mod test { let data = nonce::state::Data::new( authority, DurableNonce::from_blockhash(&invoke_context.blockhash), - invoke_context.lamports_per_signature, ); assert_eq!(versions.state(), &State::Initialized(data)); // Nonce account did not sign @@ -741,7 +735,6 @@ mod test { let data = nonce::state::Data::new( authority, DurableNonce::from_blockhash(&invoke_context.blockhash), - invoke_context.lamports_per_signature, ); assert_eq!(versions.state(), &State::Initialized(data.clone())); let withdraw_lamports = 42; @@ -770,7 +763,6 @@ mod test { let data = nonce::state::Data::new( data.authority, DurableNonce::from_blockhash(&invoke_context.blockhash), - invoke_context.lamports_per_signature, ); assert_eq!(versions.state(), &State::Initialized(data)); assert_eq!(nonce_account.get_lamports(), from_expect_lamports); @@ -962,7 +954,6 @@ mod test { let data = nonce::state::Data::new( authorized, DurableNonce::from_blockhash(&invoke_context.blockhash), - invoke_context.lamports_per_signature, ); assert_eq!(result, Ok(())); let versions = nonce_account.get_state::().unwrap(); @@ -1033,7 +1024,6 @@ mod test { let data = nonce::state::Data::new( authority, DurableNonce::from_blockhash(&invoke_context.blockhash), - invoke_context.lamports_per_signature, ); authorize_nonce_account(&mut nonce_account, &authority, &signers, &invoke_context).unwrap(); let versions = nonce_account.get_state::().unwrap(); diff --git a/programs/system/src/system_processor.rs b/programs/system/src/system_processor.rs index 2a66b388103f9a..5811bc411a2c72 100644 --- a/programs/system/src/system_processor.rs +++ b/programs/system/src/system_processor.rs @@ -545,7 +545,6 @@ mod tests { #[allow(deprecated)] use solana_sdk::{ account::{self, Account, AccountSharedData, ReadableAccount}, - fee_calculator::FeeCalculator, hash::{hash, Hash}, instruction::{AccountMeta, Instruction, InstructionError}, nonce::{ @@ -2007,9 +2006,6 @@ mod tests { let data = NonceData { authority: Pubkey::new_unique(), durable_nonce, - fee_calculator: FeeCalculator { - lamports_per_signature: 2718, - }, }; let versions = NonceVersions::Legacy(Box::new(NonceState::Initialized(data.clone()))); let nonce_account = new_nonce_account(versions); diff --git a/rpc-client-nonce-utils/src/blockhash_query.rs b/rpc-client-nonce-utils/src/blockhash_query.rs index 08a296a70b7125..3dd0e8568c1d94 100644 --- a/rpc-client-nonce-utils/src/blockhash_query.rs +++ b/rpc-client-nonce-utils/src/blockhash_query.rs @@ -33,11 +33,9 @@ impl Source { .value; Ok((res.0, res.1)) } - Self::NonceAccount(ref pubkey) => { - #[allow(clippy::redundant_closure)] - let data = crate::get_account_with_commitment(rpc_client, pubkey, commitment) - .and_then(|ref a| crate::data_from_account(a))?; - Ok((data.blockhash(), data.fee_calculator)) + Self::NonceAccount(ref _pubkey) => { + // Note - to break or to gut entire deprecated function? + Err("Deprecated, NonceAccount no longer support fee_calculator".into()) } } } @@ -60,12 +58,9 @@ impl Source { .value; Ok(res) } - Self::NonceAccount(ref pubkey) => { - let res = crate::get_account_with_commitment(rpc_client, pubkey, commitment)?; - let res = crate::data_from_account(&res)?; - Ok(Some(res) - .filter(|d| d.blockhash() == *blockhash) - .map(|d| d.fee_calculator)) + Self::NonceAccount(ref _pubkey) => { + // Note - to break or to gut entire deprecated function? + Err("Deprecated, NonceAccount no longer support fee_calculator".into()) } } } @@ -420,7 +415,6 @@ mod tests { let data = nonce::state::Data { authority: Pubkey::from([3u8; 32]), durable_nonce, - fee_calculator: nonce_fee_calc, }; let nonce_account = Account::new_data_with_space( 42, diff --git a/rpc-client-nonce-utils/src/nonblocking/blockhash_query.rs b/rpc-client-nonce-utils/src/nonblocking/blockhash_query.rs index 879bfe5f622441..130847a15cbd0b 100644 --- a/rpc-client-nonce-utils/src/nonblocking/blockhash_query.rs +++ b/rpc-client-nonce-utils/src/nonblocking/blockhash_query.rs @@ -126,7 +126,6 @@ mod tests { }, solana_sdk::{ account::Account, - fee_calculator::FeeCalculator, hash::hash, nonce::{self, state::DurableNonce}, system_program, @@ -361,11 +360,9 @@ mod tests { let durable_nonce = DurableNonce::from_blockhash(&Hash::new(&[2u8; 32])); let nonce_blockhash = *durable_nonce.as_hash(); - let nonce_fee_calc = FeeCalculator::new(4242); let data = nonce::state::Data { authority: Pubkey::from([3u8; 32]), durable_nonce, - fee_calculator: nonce_fee_calc, }; let nonce_account = Account::new_data_with_space( 42, diff --git a/rpc/src/rpc.rs b/rpc/src/rpc.rs index 5cc5b82344e0d1..f86ff273e5fbc9 100644 --- a/rpc/src/rpc.rs +++ b/rpc/src/rpc.rs @@ -5773,7 +5773,6 @@ pub mod tests { &nonce::state::Versions::new(nonce::State::new_initialized( &authority, DurableNonce::default(), - 1000, )), &system_program::id(), ) diff --git a/rpc/src/transaction_status_service.rs b/rpc/src/transaction_status_service.rs index 68640362b2182c..bc644e4a47b437 100644 --- a/rpc/src/transaction_status_service.rs +++ b/rpc/src/transaction_status_service.rs @@ -345,7 +345,7 @@ pub(crate) mod tests { let mut nonce_account = nonce_account::create_account(1).into_inner(); let durable_nonce = DurableNonce::from_blockhash(&Hash::new(&[42u8; 32])); - let data = nonce::state::Data::new(Pubkey::from([1u8; 32]), durable_nonce, 42); + let data = nonce::state::Data::new(Pubkey::from([1u8; 32]), durable_nonce); nonce_account .set_state(&nonce::state::Versions::new(nonce::State::Initialized( data, diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index ecca773a401d09..2054bd8e71ebeb 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -91,7 +91,7 @@ use { ancestors::{Ancestors, AncestorsForSerialization}, blockhash_queue::BlockhashQueue, epoch_accounts_hash::EpochAccountsHash, - nonce_info::{NonceInfo, NoncePartial}, + nonce_info::NoncePartial, partitioned_rewards::PartitionedEpochRewardsConfig, rent_collector::{CollectedInfo, RentCollector, RENT_EXEMPT_RENT_EPOCH}, rent_debits::RentDebits, @@ -5075,11 +5075,9 @@ impl Bank { if let ((Ok(()), nonce), tx) = etx { if nonce .as_ref() - .map(|nonce| nonce.lamports_per_signature()) - .unwrap_or_else(|| { - hash_queue.get_lamports_per_signature(tx.message().recent_blockhash()) - }) - .is_some() + // NOTE: doesn't need lamports_per_signature to determine if nonce or blockhash is valid + .map(|_nonce| true ) + .unwrap_or_else(|| hash_queue.is_hash_valid(tx.message().recent_blockhash())) { tx.message() .account_keys() @@ -5587,7 +5585,7 @@ impl Bank { loaded_txs: &mut [TransactionLoadResult], execution_results: Vec, last_blockhash: Hash, - lamports_per_signature: u64, + _lamports_per_signature: u64, counts: CommitTransactionCounts, timings: &mut ExecuteTimings, ) -> TransactionResults { @@ -5631,7 +5629,6 @@ impl Bank { loaded_txs, &self.rent_collector, &durable_nonce, - lamports_per_signature, ); let rent_debits = self.collect_rent(&execution_results, loaded_txs); diff --git a/runtime/src/bank/tests.rs b/runtime/src/bank/tests.rs index 763b8c7db42df7..38231710737c71 100644 --- a/runtime/src/bank/tests.rs +++ b/runtime/src/bank/tests.rs @@ -5202,7 +5202,6 @@ fn test_nonce_must_be_advanceable() { &nonce::state::Versions::new(nonce::State::Initialized(nonce::state::Data::new( nonce_authority, durable_nonce, - 5000, ))), &system_program::id(), ) @@ -5685,14 +5684,14 @@ fn test_nonce_fee_calculator_updates() { let custodian_pubkey = custodian_keypair.pubkey(); let nonce_pubkey = nonce_keypair.pubkey(); - // Grab the hash and fee_calculator stored in the nonce account - let (stored_nonce_hash, stored_fee_calculator) = bank + // Grab the hash stored in the nonce account + let stored_nonce_hash = bank .get_account(&nonce_pubkey) .and_then(|acc| { let nonce_versions = StateMut::::state(&acc); match nonce_versions.ok()?.state() { nonce::State::Initialized(ref data) => { - Some((data.blockhash(), data.fee_calculator)) + Some(data.blockhash()) } _ => None, } @@ -5721,14 +5720,14 @@ fn test_nonce_fee_calculator_updates() { ); bank.process_transaction(&nonce_tx).unwrap(); - // Grab the new hash and fee_calculator; both should be updated - let (nonce_hash, fee_calculator) = bank + // Grab the new hash; both should be updated + let nonce_hash = bank .get_account(&nonce_pubkey) .and_then(|acc| { let nonce_versions = StateMut::::state(&acc); match nonce_versions.ok()?.state() { nonce::State::Initialized(ref data) => { - Some((data.blockhash(), data.fee_calculator)) + Some(data.blockhash()) } _ => None, } @@ -5736,7 +5735,6 @@ fn test_nonce_fee_calculator_updates() { .unwrap(); assert_ne!(stored_nonce_hash, nonce_hash); - assert_ne!(stored_fee_calculator, fee_calculator); } #[test] @@ -5753,14 +5751,14 @@ fn test_nonce_fee_calculator_updates_tx_wide_cap() { let custodian_pubkey = custodian_keypair.pubkey(); let nonce_pubkey = nonce_keypair.pubkey(); - // Grab the hash and fee_calculator stored in the nonce account - let (stored_nonce_hash, stored_fee_calculator) = bank + // Grab the hash stored in the nonce account + let stored_nonce_hash = bank .get_account(&nonce_pubkey) .and_then(|acc| { let nonce_versions = StateMut::::state(&acc); match nonce_versions.ok()?.state() { nonce::State::Initialized(ref data) => { - Some((data.blockhash(), data.fee_calculator)) + Some(data.blockhash()) } _ => None, } @@ -5789,14 +5787,14 @@ fn test_nonce_fee_calculator_updates_tx_wide_cap() { ); bank.process_transaction(&nonce_tx).unwrap(); - // Grab the new hash and fee_calculator; both should be updated - let (nonce_hash, fee_calculator) = bank + // Grab the new hash, should be updated + let nonce_hash = bank .get_account(&nonce_pubkey) .and_then(|acc| { let nonce_versions = StateMut::::state(&acc); match nonce_versions.ok()?.state() { nonce::State::Initialized(ref data) => { - Some((data.blockhash(), data.fee_calculator)) + Some(data.blockhash()) } _ => None, } @@ -5804,7 +5802,6 @@ fn test_nonce_fee_calculator_updates_tx_wide_cap() { .unwrap(); assert_ne!(stored_nonce_hash, nonce_hash); - assert_ne!(stored_fee_calculator, fee_calculator); } #[test] diff --git a/sdk/program/src/example_mocks.rs b/sdk/program/src/example_mocks.rs index 48f3355710e1f2..44edc54e72d772 100644 --- a/sdk/program/src/example_mocks.rs +++ b/sdk/program/src/example_mocks.rs @@ -101,7 +101,6 @@ pub mod solana_rpc_client_nonce_utils { Ok(Data::new( Pubkey::new_unique(), DurableNonce::default(), - 5000, )) } } diff --git a/sdk/program/src/nonce/state/current.rs b/sdk/program/src/nonce/state/current.rs index 447cdff97f50bf..2c403e8b1d4bac 100644 --- a/sdk/program/src/nonce/state/current.rs +++ b/sdk/program/src/nonce/state/current.rs @@ -1,6 +1,5 @@ use { crate::{ - fee_calculator::FeeCalculator, hash::{hashv, Hash}, pubkey::Pubkey, }, @@ -21,8 +20,6 @@ pub struct Data { pub authority: Pubkey, /// Durable nonce value derived from a valid previous blockhash. pub durable_nonce: DurableNonce, - /// The fee calculator associated with the blockhash. - pub fee_calculator: FeeCalculator, } impl Data { @@ -30,12 +27,10 @@ impl Data { pub fn new( authority: Pubkey, durable_nonce: DurableNonce, - lamports_per_signature: u64, ) -> Self { Data { authority, durable_nonce, - fee_calculator: FeeCalculator::new(lamports_per_signature), } } @@ -45,11 +40,6 @@ impl Data { pub fn blockhash(&self) -> Hash { self.durable_nonce.0 } - - /// Get the cost per signature for the next transaction to use this nonce. - pub fn get_lamports_per_signature(&self) -> u64 { - self.fee_calculator.lamports_per_signature - } } impl DurableNonce { @@ -79,9 +69,8 @@ impl State { pub fn new_initialized( authority: &Pubkey, durable_nonce: DurableNonce, - lamports_per_signature: u64, ) -> Self { - Self::Initialized(Data::new(*authority, durable_nonce, lamports_per_signature)) + Self::Initialized(Data::new(*authority, durable_nonce)) } /// Get the serialized size of the nonce state. diff --git a/sdk/program/src/nonce/state/mod.rs b/sdk/program/src/nonce/state/mod.rs index d55bc9063afcff..15bd2f950223ce 100644 --- a/sdk/program/src/nonce/state/mod.rs +++ b/sdk/program/src/nonce/state/mod.rs @@ -90,7 +90,6 @@ impl Versions { let data = Data::new( authority, data.durable_nonce, - data.get_lamports_per_signature(), ); let state = Box::new(State::Initialized(data)); // Preserve Version variant since cannot @@ -115,7 +114,7 @@ impl From for State { mod tests { use { super::*, - crate::{fee_calculator::FeeCalculator, pubkey::Pubkey}, + crate::pubkey::Pubkey, std::iter::repeat_with, }; @@ -132,9 +131,6 @@ mod tests { let data = Data { authority: Pubkey::new_unique(), durable_nonce, - fee_calculator: FeeCalculator { - lamports_per_signature: 2718, - }, }; let versions = Versions::Legacy(Box::new(State::Initialized(data.clone()))); assert_eq!(versions.verify_recent_blockhash(&Hash::default()), None); @@ -174,9 +170,6 @@ mod tests { let data = Data { authority: Pubkey::new_unique(), durable_nonce, - fee_calculator: FeeCalculator { - lamports_per_signature: 2718, - }, }; let versions = Versions::Legacy(Box::new(State::Initialized(data.clone()))); let durable_nonce = DurableNonce::from_blockhash(durable_nonce.as_hash()); @@ -213,9 +206,6 @@ mod tests { let data = Data { authority: Pubkey::new_unique(), durable_nonce, - fee_calculator: FeeCalculator { - lamports_per_signature: 2718, - }, }; let account_authority = data.authority; let versions = Versions::Legacy(Box::new(State::Initialized(data.clone()))); diff --git a/sdk/src/nonce_account.rs b/sdk/src/nonce_account.rs index 255011a7bb6402..6170fdca27058e 100644 --- a/sdk/src/nonce_account.rs +++ b/sdk/src/nonce_account.rs @@ -41,19 +41,11 @@ pub fn verify_nonce_account( .flatten() } -pub fn lamports_per_signature_of(account: &AccountSharedData) -> Option { - match StateMut::::state(account).ok()?.state() { - State::Initialized(data) => Some(data.fee_calculator.lamports_per_signature), - State::Uninitialized => None, - } -} - #[cfg(test)] mod tests { use { super::*, crate::{ - fee_calculator::FeeCalculator, nonce::state::{Data, DurableNonce}, pubkey::Pubkey, system_program, @@ -98,9 +90,6 @@ mod tests { let data = Data { authority: Pubkey::new_unique(), durable_nonce, - fee_calculator: FeeCalculator { - lamports_per_signature: 2718, - }, }; let versions = Versions::Legacy(Box::new(State::Initialized(data.clone()))); let account = new_nonce_account(versions); diff --git a/send-transaction-service/src/send_transaction_service.rs b/send-transaction-service/src/send_transaction_service.rs index dd09ccc69698f5..d27d23400cf0a3 100644 --- a/send-transaction-service/src/send_transaction_service.rs +++ b/send-transaction-service/src/send_transaction_service.rs @@ -1194,7 +1194,7 @@ mod test { let nonce_address = Pubkey::new_unique(); let durable_nonce = DurableNonce::from_blockhash(&Hash::new_unique()); let nonce_state = nonce::state::Versions::new(nonce::State::Initialized( - nonce::state::Data::new(Pubkey::default(), durable_nonce, 42), + nonce::state::Data::new(Pubkey::default(), durable_nonce), )); let nonce_account = AccountSharedData::new_data(43, &nonce_state, &system_program::id()).unwrap(); @@ -1453,7 +1453,7 @@ mod test { } let new_durable_nonce = DurableNonce::from_blockhash(&Hash::new_unique()); let new_nonce_state = nonce::state::Versions::new(nonce::State::Initialized( - nonce::state::Data::new(Pubkey::default(), new_durable_nonce, 42), + nonce::state::Data::new(Pubkey::default(), new_durable_nonce), )); let nonce_account = AccountSharedData::new_data(43, &new_nonce_state, &system_program::id()).unwrap();