Skip to content

Defend against transactions that source nonce account addresses from lookup tables #309

Open
@steveluscher

Description

@steveluscher

Motivation

solana-foundation/solana-improvement-documents#242 will make it impossible to load a nonce account from an address lookup table, so we must adjust the ergonomics of the JS SDK to prohibit creating such a transaction message.

Details

  1. Make sure that createAdvanceNonceAccountInstruction() does not produce an IAccountLookupMeta (already the case, I think)
  2. isAdvanceNonceAccountInstructionForNonce() must assert that the nonce account in an AdvanceNonce instruction is not an IAccountLookupMeta
  3. compressTransactionMessageUsingAddressLookupTables() should refuse to convert an AdvanceNonce instruction's nonce account from an IAccountMeta to an IAccountLookupMeta. Note: this will be bad for package efficiency, because this will mean putting nonce-specific logic in a place where it will almost never be used. Think hard about whether this is worth it or not.
  4. getAddressMapFromInstructions() should always upgrade lookup table entries to static entries if they belong to a nonce account that is subject to an AdvanceNonce instruction. Note: like 3, this will be bad for package efficiency, because this will mean putting nonce-specific logic into the message compiler where it will almost never be used. Think hard about whether this is worth it or not.

Note

There is a world where, if we're OK with taking the hit on package efficiency to implement 4, then we can ignore all of the other changes. That is to say we can play fast and loose with whether we allow an AdvanceNonceInstruction to contain an IAccountLookupMeta knowing that eventually the transaction message compiler will ‘upgrade’ it to a static entry. Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions