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

Consider changing account ID's SQL backing type #602

Open
igamigo opened this issue Dec 26, 2024 · 0 comments
Open

Consider changing account ID's SQL backing type #602

igamigo opened this issue Dec 26, 2024 · 0 comments
Labels
enhancement New feature or request optimization Code optimization

Comments

@igamigo
Copy link
Collaborator

igamigo commented Dec 26, 2024

Following #591, the node supports the new account ID format, which fits into two felts instead of just one. As a consequence, 64-bit long types do not work as a backing type for account IDs anymore, which means we can't use fixed64 on protobuf or u64 for SQL.

Currently, the SQL type for account_id is BLOB which is fine because we can deserialize and serialize as needed, but since the account ID prefix (which fits into 64 bits) is a unique identifier of the account itself, we can separate the ID into two columns (first felt or prefix, and second felt or suffix) in order to speed up lookups and improve indexing. This should also reduce allocations because it means less (de)serialization (would also leverage the fact that AccountId only contains the two felts so instantiation would still be simple). One thing to note is that the prefix being a unique identifier might be relaxed in the future, so this only really applies while this is still the case.

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

No branches or pull requests

1 participant