Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[experimental] Consider making address of IAccountLookupMeta optional #2744

Open
steveluscher opened this issue May 28, 2024 · 1 comment
Open
Labels
enhancement New feature or request

Comments

@steveluscher
Copy link
Collaborator

Background

Consider this type:

export interface IAccountLookupMeta<TAddress extends string = string, TLookupTableAddress extends string = string> {
readonly address: Address<TAddress>;
readonly addressIndex: number;
readonly lookupTableAddress: Address<TLookupTableAddress>;
readonly role: AccountRole.READONLY | AccountRole.WRITABLE;
}

One could argue that address doesn't need to be there. When you go to compile the message, the address gets dropped in favour of its index in the LUT.

The reason that address is there is so that the compiler can do some extra tricks:

  • if the message already requires one of the addresses in the lookup table to be among the static addresses (eg. because it must sign) then omit the LUT entry (code)
  • roll all lookups into the LUT whose address has the lowest rank, until you can drop a LUT completely (code)

Problem

The problem is that the presence of this property implies that in order to decompileMessage() a message with LUTs, you need to know the addresses so that the decompiler can rehydrate the TransactionMessage.

There are some use cases for which knowing the addresses is not important though. You might want to decompile a transaction to look at something other than the account addresses. You might also just like to add an instruction and recompile it. Knowing the LUT addresses is not a prerequisite for this; you can recompile the message just fine without knowing them.

Summary

This issue considers the possibility of relaxing this type by making address optional. Alternatively we could add a type to this union like IAccountIndeterminateLookupMeta that has the indexes but not the `address.

@steveluscher steveluscher added bug Something isn't working enhancement New feature or request and removed bug Something isn't working labels May 28, 2024
@steveluscher
Copy link
Collaborator Author

steveluscher commented Jun 26, 2024

Actually, this idea might be dead on arrival. The addresses themselves are used for deduplication – ie. to prevent the same address from showing up in the accounts list and among one of the looked-up-addresses.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant