Skip to content

Commit

Permalink
v2.0: Scheduler: Improve TTL (backport of solana-labs#3161) (solana-l…
Browse files Browse the repository at this point in the history
…abs#3179)

* Scheduler: Improve TTL (solana-labs#3161)

Co-authored-by: Justin Starry <[email protected]>
(cherry picked from commit 7b0a573)

# Conflicts:
#	accounts-db/src/accounts.rs
#	core/src/banking_stage/consumer.rs
#	core/src/banking_stage/immutable_deserialized_packet.rs
#	core/src/banking_stage/latest_unprocessed_votes.rs
#	core/src/banking_stage/transaction_scheduler/scheduler_controller.rs
#	runtime/src/bank/address_lookup_table.rs

* resolve conflicts

---------

Co-authored-by: Andrew Fitzgerald <[email protected]>
  • Loading branch information
mergify[bot] and apfitzge authored Oct 17, 2024
1 parent 192460b commit 8561902
Show file tree
Hide file tree
Showing 14 changed files with 505 additions and 119 deletions.
42 changes: 25 additions & 17 deletions accounts-db/src/accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,14 @@ impl Accounts {
}
}

/// Return loaded addresses and the deactivation slot.
/// If the table hasn't been deactivated, the deactivation slot is `u64::MAX`.
pub fn load_lookup_table_addresses(
&self,
ancestors: &Ancestors,
address_table_lookup: &MessageAddressTableLookup,
slot_hashes: &SlotHashes,
) -> std::result::Result<LoadedAddresses, AddressLookupError> {
) -> std::result::Result<(LoadedAddresses, Slot), AddressLookupError> {
let table_account = self
.accounts_db
.load_with_fixed_root(ancestors, &address_table_lookup.account_key)
Expand All @@ -140,18 +142,21 @@ impl Accounts {
let lookup_table = AddressLookupTable::deserialize(table_account.data())
.map_err(|_ix_err| AddressLookupError::InvalidAccountData)?;

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,
slot_hashes,
)?,
readonly: lookup_table.lookup(
current_slot,
&address_table_lookup.readonly_indexes,
slot_hashes,
)?,
},
lookup_table.meta.deactivation_slot,
))
} else {
Err(AddressLookupError::InvalidAccountOwner)
}
Expand Down Expand Up @@ -1045,10 +1050,13 @@ mod tests {
&address_table_lookup,
&SlotHashes::default(),
),
Ok(LoadedAddresses {
writable: vec![table_addresses[0]],
readonly: vec![table_addresses[1]],
}),
Ok((
LoadedAddresses {
writable: vec![table_addresses[0]],
readonly: vec![table_addresses[1]],
},
u64::MAX
)),
);
}

Expand Down
Loading

0 comments on commit 8561902

Please sign in to comment.