Updates to the address lookup table proposal (#22269)
This commit is contained in:
parent
9665da9d0b
commit
ca5591bfa0
|
@ -53,11 +53,16 @@ store up to 256 addresses each. In addition to stored addresses, address table
|
||||||
accounts also tracks various metadata explained below.
|
accounts also tracks various metadata explained below.
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
|
/// The maximum number of addresses that a lookup table can hold
|
||||||
|
pub const LOOKUP_TABLE_MAX_ADDRESSES: usize = 256;
|
||||||
|
|
||||||
|
/// The serialized size of lookup table metadata
|
||||||
|
pub const LOOKUP_TABLE_META_SIZE: usize = 56;
|
||||||
|
|
||||||
pub struct LookupTableMeta {
|
pub struct LookupTableMeta {
|
||||||
/// The slot used to derive the table's address. The table cannot
|
/// Lookup tables cannot be closed until the deactivation slot is
|
||||||
/// be closed until the derivation slot is no longer "recent"
|
/// no longer "recent" (not accessible in the `SlotHashes` sysvar).
|
||||||
/// (not accessible in the `SlotHashes` sysvar).
|
pub ddeactivation_slot: Slot,
|
||||||
pub derivation_slot: Slot,
|
|
||||||
/// The slot that the table was last extended. Address tables may
|
/// The slot that the table was last extended. Address tables may
|
||||||
/// only be used to lookup addresses that were extended before
|
/// only be used to lookup addresses that were extended before
|
||||||
/// the current bank's slot.
|
/// the current bank's slot.
|
||||||
|
@ -67,6 +72,8 @@ pub struct LookupTableMeta {
|
||||||
pub last_extended_slot_start_index: u8,
|
pub last_extended_slot_start_index: u8,
|
||||||
/// Authority address which must sign for each modification.
|
/// Authority address which must sign for each modification.
|
||||||
pub authority: Option<Pubkey>,
|
pub authority: Option<Pubkey>,
|
||||||
|
// Padding to keep addresses 8-byte aligned
|
||||||
|
pub _padding: u16,
|
||||||
// Raw list of addresses follows this serialized structure in
|
// Raw list of addresses follows this serialized structure in
|
||||||
// the account's data, starting from `LOOKUP_TABLE_META_SIZE`.
|
// the account's data, starting from `LOOKUP_TABLE_META_SIZE`.
|
||||||
}
|
}
|
||||||
|
@ -88,11 +95,17 @@ pub struct BufferMeta {
|
||||||
|
|
||||||
#### Cleanup
|
#### Cleanup
|
||||||
|
|
||||||
Once an address lookup table is no longer needed, it can be closed
|
Once an address lookup table is no longer needed, it can be deactivated and closed
|
||||||
and have its rent balance reclaimed. Address lookup tables may not be recreated
|
to have its rent balance reclaimed. Address lookup tables may not be recreated
|
||||||
at the same address because each new lookup table must be initialized at an address
|
at the same address because each new lookup table must be initialized at an address
|
||||||
derived from a recent slot.
|
derived from a recent slot.
|
||||||
|
|
||||||
|
Address lookup tables can be deactivated at any time but can continue to be used
|
||||||
|
by transactions until the deactivation slot is no longer present in the slot hashes
|
||||||
|
sysvar. This cool-down period ensures that in-flight transactions cannot be
|
||||||
|
censored and that address lookup tables cannot be closed and recreated for the same
|
||||||
|
slot.
|
||||||
|
|
||||||
#### Cost
|
#### Cost
|
||||||
|
|
||||||
Since address lookups require extra overhead during transaction processing,
|
Since address lookups require extra overhead during transaction processing,
|
||||||
|
@ -226,7 +239,7 @@ If an address lookup table can be closed and re-initialized with new addresses,
|
||||||
any client which is unaware of the change could inadvertently lookup unexpected
|
any client which is unaware of the change could inadvertently lookup unexpected
|
||||||
addresses. To avoid this, all address lookup tables must be initialized at an
|
addresses. To avoid this, all address lookup tables must be initialized at an
|
||||||
address derived from a recent slot and they cannot be closed until the slot
|
address derived from a recent slot and they cannot be closed until the slot
|
||||||
used for derivation is no longer "recent."
|
used for deactivation is no longer in the slot hashes sysvar.
|
||||||
|
|
||||||
### Resource consumption
|
### Resource consumption
|
||||||
|
|
||||||
|
@ -259,7 +272,8 @@ similar to sysvar accounts.
|
||||||
For this reason, special handling should be given to address lookup tables.
|
For this reason, special handling should be given to address lookup tables.
|
||||||
When an address lookup table is used to lookup addresses for a transaction,
|
When an address lookup table is used to lookup addresses for a transaction,
|
||||||
it can be loaded without waiting for a read lock. To avoid race conditions,
|
it can be loaded without waiting for a read lock. To avoid race conditions,
|
||||||
only the addresses appended in previous blocks can be used for lookups.
|
only the addresses appended in previous blocks can be used for lookups and
|
||||||
|
deactivation requires a cool-down period.
|
||||||
|
|
||||||
### Duplicate accounts
|
### Duplicate accounts
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue