Skip to content

Commit

Permalink
resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
apfitzge committed Oct 15, 2024
1 parent 99cc101 commit 99178e9
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 156 deletions.
19 changes: 2 additions & 17 deletions accounts-db/src/accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,36 +142,21 @@ impl Accounts {
let lookup_table = AddressLookupTable::deserialize(table_account.data())
.map_err(|_ix_err| AddressLookupError::InvalidAccountData)?;

<<<<<<< HEAD
Ok(LoadedAddresses {
writable: lookup_table.lookup(
current_slot,
&address_table_lookup.writable_indexes,
slot_hashes,
)?,
readonly: lookup_table.lookup(
current_slot,
&address_table_lookup.readonly_indexes,
slot_hashes,
)?,
})
=======
Ok((
LoadedAddresses {
writable: lookup_table.lookup(
current_slot,
address_table_lookup.writable_indexes,
&address_table_lookup.writable_indexes,
slot_hashes,
)?,
readonly: lookup_table.lookup(
current_slot,
address_table_lookup.readonly_indexes,
&address_table_lookup.readonly_indexes,
slot_hashes,
)?,
},
lookup_table.meta.deactivation_slot,
))
>>>>>>> 7b0a57316d (Scheduler: Improve TTL (#3161))
} else {
Err(AddressLookupError::InvalidAccountOwner)
}
Expand Down
3 changes: 1 addition & 2 deletions core/src/banking_stage/consume_worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,6 @@ mod tests {
MessageHash, SanitizedTransaction, TransactionError, VersionedTransaction,
},
},
solana_svm_transaction::svm_message::SVMMessage,
std::{
collections::HashSet,
sync::{atomic::AtomicBool, RwLock},
Expand Down Expand Up @@ -1120,7 +1119,7 @@ mod tests {
for tx in &txs {
bank.process_transaction(&system_transaction::transfer(
mint_keypair,
&tx.account_keys()[0],
&tx.message().account_keys()[0],
2,
genesis_config.hash(),
))
Expand Down
23 changes: 4 additions & 19 deletions core/src/banking_stage/consumer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,8 @@ use {
transaction_batch::TransactionBatch,
},
solana_sdk::{
<<<<<<< HEAD
clock::{Slot, FORWARD_TRANSACTIONS_TO_LEADER_AT_SLOT_OFFSET, MAX_PROCESSING_AGE},
feature_set,
=======
clock::{FORWARD_TRANSACTIONS_TO_LEADER_AT_SLOT_OFFSET, MAX_PROCESSING_AGE},
fee::FeeBudgetLimits,
>>>>>>> 7b0a57316d (Scheduler: Improve TTL (#3161))
feature_set,
message::SanitizedMessage,
saturating_add_assign,
timing::timestamp,
Expand Down Expand Up @@ -474,23 +469,13 @@ impl Consumer {
// valid, and we can continue with processing.
// If they do not, then the ATL has expired and the transaction
// can be dropped.
let (_addresses, _deactivation_slot) =
bank.load_addresses_from_ref(tx.message_address_table_lookups())?;
let (_addresses, _deactivation_slot) = bank.load_addresses_from_ref(
tx.message().message_address_table_lookups().iter(),
)?;
}

// Verify pre-compiles.
<<<<<<< HEAD
tx.verify_precompiles(&bank.feature_set)?;
// Any transaction executed between sanitization time and now may have closed the lookup table(s).
// Above re-sanitization already loads addresses, so don't need to re-check in that case.
let lookup_tables = tx.message().message_address_table_lookups();
if !lookup_tables.is_empty() {
bank.load_addresses(lookup_tables)?;
=======
if !move_precompile_verification_to_svm {
verify_precompiles(tx, &bank.feature_set)?;
>>>>>>> 7b0a57316d (Scheduler: Improve TTL (#3161))
}
}

Ok(())
Expand Down
24 changes: 5 additions & 19 deletions core/src/banking_stage/immutable_deserialized_packet.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
use {
super::packet_filter::PacketFilterFailure,
solana_perf::packet::Packet,
<<<<<<< HEAD
solana_runtime::compute_budget_details::{ComputeBudgetDetails, GetComputeBudgetDetails},
=======
solana_runtime::bank::Bank,
solana_runtime_transaction::instructions_processor::process_compute_budget_instructions,
solana_sanitize::SanitizeError,
>>>>>>> 7b0a57316d (Scheduler: Improve TTL (#3161))
solana_runtime::{
bank::Bank,
compute_budget_details::{ComputeBudgetDetails, GetComputeBudgetDetails},
},
solana_sdk::{
clock::Slot,
hash::Hash,
Expand All @@ -18,13 +15,6 @@ use {
signature::Signature,
transaction::{SanitizedTransaction, SanitizedVersionedTransaction, VersionedTransaction},
},
<<<<<<< HEAD
=======
solana_short_vec::decode_shortu16_len,
solana_svm_transaction::{
instruction::SVMInstruction, message_address_table_lookup::SVMMessageAddressTableLookup,
},
>>>>>>> 7b0a57316d (Scheduler: Improve TTL (#3161))
std::{cmp::Ordering, collections::HashSet, mem::size_of},
thiserror::Error,
};
Expand Down Expand Up @@ -150,11 +140,7 @@ impl ImmutableDeserializedPacket {
return Ok((LoadedAddresses::default(), Slot::MAX));
};

bank.load_addresses_from_ref(
address_table_lookups
.iter()
.map(SVMMessageAddressTableLookup::from),
)
bank.load_addresses_from_ref(address_table_lookups.iter())
}
}

Expand Down
47 changes: 2 additions & 45 deletions core/src/banking_stage/latest_unprocessed_votes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,6 @@ impl LatestUnprocessedVotes {
) -> usize {
let mut continue_forwarding = true;
let pubkeys_by_stake = self.weighted_random_order_by_stake();
<<<<<<< HEAD
pubkeys_by_stake
.into_iter()
.filter(|&pubkey| {
Expand All @@ -363,8 +362,8 @@ impl LatestUnprocessedVotes {
let mut vote = lock.write().unwrap();
if !vote.is_vote_taken() && !vote.is_forwarded() {
let deserialized_vote_packet = vote.vote.as_ref().unwrap().clone();
if let Some(sanitized_vote_transaction) = deserialized_vote_packet
.build_sanitized_transaction(
if let Some((sanitized_vote_transaction, _deactivation_slot)) =
deserialized_vote_packet.build_sanitized_transaction(
bank.vote_only_bank(),
bank.as_ref(),
bank.get_reserved_account_keys(),
Expand All @@ -390,48 +389,6 @@ impl LatestUnprocessedVotes {
false
})
.count()
=======
let mut forwarded_count: usize = 0;
for pubkey in pubkeys_by_stake {
let Some(vote) = self.get_entry(pubkey) else {
continue;
};

let mut vote = vote.write().unwrap();
if vote.is_vote_taken() || vote.is_forwarded() {
continue;
}

let deserialized_vote_packet = vote.vote.as_ref().unwrap().clone();
let Some((sanitized_vote_transaction, _deactivation_slot)) = deserialized_vote_packet
.build_sanitized_transaction(
bank.vote_only_bank(),
bank.as_ref(),
bank.get_reserved_account_keys(),
)
else {
continue;
};

let forwarding_successful = forward_packet_batches_by_accounts.try_add_packet(
&sanitized_vote_transaction,
deserialized_vote_packet,
&bank.feature_set,
);

if !forwarding_successful {
// To match behavior of regular transactions we stop forwarding votes as soon as one
// fails. We are assuming that failure (try_add_packet) means no more space
// available.
break;
}

vote.forwarded = true;
forwarded_count += 1;
}

forwarded_count
>>>>>>> 7b0a57316d (Scheduler: Improve TTL (#3161))
}

/// Drains all votes yet to be processed sorted by a weighted random ordering by stake
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,8 @@ use {
forwarder::Forwarder,
immutable_deserialized_packet::ImmutableDeserializedPacket,
packet_deserializer::PacketDeserializer,
<<<<<<< HEAD
ForwardOption, TOTAL_BUFFERED_PACKETS,
=======
scheduler_messages::MaxAge,
ForwardOption, LikeClusterInfo, TOTAL_BUFFERED_PACKETS,
>>>>>>> 7b0a57316d (Scheduler: Improve TTL (#3161))
ForwardOption, TOTAL_BUFFERED_PACKETS,
},
crossbeam_channel::RecvTimeoutError,
solana_compute_budget::compute_budget_processor::process_compute_budget_instructions,
Expand Down Expand Up @@ -518,21 +514,14 @@ impl SchedulerController {

const CHUNK_SIZE: usize = 128;
let lock_results: [_; CHUNK_SIZE] = core::array::from_fn(|_| Ok(()));
<<<<<<< HEAD
=======

let mut arc_packets = ArrayVec::<_, CHUNK_SIZE>::new();
let mut transactions = ArrayVec::<_, CHUNK_SIZE>::new();
let mut max_ages = ArrayVec::<_, CHUNK_SIZE>::new();
let mut fee_budget_limits_vec = ArrayVec::<_, CHUNK_SIZE>::new();

>>>>>>> 7b0a57316d (Scheduler: Improve TTL (#3161))
let mut error_counts = TransactionErrorMetrics::default();
for chunk in packets.chunks(CHUNK_SIZE) {
let mut post_sanitization_count: usize = 0;

let mut arc_packets = Vec::with_capacity(chunk.len());
let mut transactions = Vec::with_capacity(chunk.len());
let mut max_ages = Vec::with_capacity(chunk.len());
let mut fee_budget_limits_vec = Vec::with_capacity(chunk.len());

chunk
Expand All @@ -547,30 +536,18 @@ impl SchedulerController {
.map(|(tx, deactivation_slot)| (packet.clone(), tx, deactivation_slot))
})
.inspect(|_| saturating_add_assign!(post_sanitization_count, 1))
<<<<<<< HEAD
.filter(|(_packet, tx)| {
.filter(|(_packet, tx, _deactivation_slot)| {
SanitizedTransaction::validate_account_locks(
tx.message(),
=======
.filter(|(_packet, tx, _deactivation_slot)| {
validate_account_locks(
tx.message().account_keys(),
>>>>>>> 7b0a57316d (Scheduler: Improve TTL (#3161))
transaction_account_lock_limit,
)
.is_ok()
})
<<<<<<< HEAD
.filter_map(|(packet, tx)| {
process_compute_budget_instructions(tx.message().program_instructions_iter())
.map(|compute_budget| (packet, tx, compute_budget.into()))
=======
.filter_map(|(packet, tx, deactivation_slot)| {
process_compute_budget_instructions(SVMMessage::program_instructions_iter(&tx))
process_compute_budget_instructions(tx.message().program_instructions_iter())
.map(|compute_budget| {
(packet, tx, deactivation_slot, compute_budget.into())
})
>>>>>>> 7b0a57316d (Scheduler: Improve TTL (#3161))
.ok()
})
.for_each(|(packet, tx, deactivation_slot, fee_budget_limits)| {
Expand Down Expand Up @@ -600,23 +577,13 @@ impl SchedulerController {
let mut post_transaction_check_count: usize = 0;
let mut num_dropped_on_capacity: usize = 0;
let mut num_buffered: usize = 0;
<<<<<<< HEAD
for (((packet, transaction), fee_budget_limits), _) in arc_packets
for ((((packet, transaction), max_age), fee_budget_limits), _) in arc_packets
.into_iter()
.zip(transactions)
.zip(max_ages)
.zip(fee_budget_limits_vec)
.zip(check_results)
.filter(|(_, check_result)| check_result.is_ok())
=======
for ((((packet, transaction), max_age), fee_budget_limits), _check_result) in
arc_packets
.drain(..)
.zip(transactions.drain(..))
.zip(max_ages.drain(..))
.zip(fee_budget_limits_vec.drain(..))
.zip(check_results)
.filter(|(_, check_result)| check_result.is_ok())
>>>>>>> 7b0a57316d (Scheduler: Improve TTL (#3161))
{
saturating_add_assign!(post_transaction_check_count, 1);
let transaction_id = self.transaction_id_generator.next();
Expand Down
18 changes: 3 additions & 15 deletions runtime/src/bank/address_lookup_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,8 @@ impl AddressLoader for &Bank {
self,
address_table_lookups: &[MessageAddressTableLookup],
) -> Result<LoadedAddresses, AddressLoaderError> {
<<<<<<< HEAD
=======
self.load_addresses_from_ref(
address_table_lookups
.iter()
.map(SVMMessageAddressTableLookup::from),
)
.map(|(loaded_addresses, _deactivation_slot)| loaded_addresses)
self.load_addresses_from_ref(address_table_lookups.iter())
.map(|(loaded_addresses, _deactivation_slot)| loaded_addresses)
}
}

Expand All @@ -43,22 +37,16 @@ impl Bank {
/// additionally returning the minimum deactivation slot across all referenced ALTs
pub fn load_addresses_from_ref<'a>(
&self,
address_table_lookups: impl Iterator<Item = SVMMessageAddressTableLookup<'a>>,
address_table_lookups: impl Iterator<Item = &'a MessageAddressTableLookup>,
) -> Result<(LoadedAddresses, Slot), AddressLoaderError> {
>>>>>>> 7b0a57316d (Scheduler: Improve TTL (#3161))
let slot_hashes = self
.transaction_processor
.sysvar_cache()
.get_slot_hashes()
.map_err(|_| AddressLoaderError::SlotHashesSysvarNotFound)?;

<<<<<<< HEAD
address_table_lookups
.iter()
=======
let mut deactivation_slot = u64::MAX;
let loaded_addresses = address_table_lookups
>>>>>>> 7b0a57316d (Scheduler: Improve TTL (#3161))
.map(|address_table_lookup| {
self.rc
.accounts
Expand Down

0 comments on commit 99178e9

Please sign in to comment.