Skip to content

feat: optimize layouts and procedures for little-endian#2512

Open
PhilippGackstatter wants to merge 10 commits intopgackst-bele-migrationfrom
pgackst-bele-migration-followup
Open

feat: optimize layouts and procedures for little-endian#2512
PhilippGackstatter wants to merge 10 commits intopgackst-bele-migrationfrom
pgackst-bele-migration-followup

Conversation

@PhilippGackstatter
Copy link
Contributor

@PhilippGackstatter PhilippGackstatter commented Feb 25, 2026

Broken out of #2508 to reduce diff size. This PR optimizes a few things for the new little-endian-based word layout:

  • Reorders tx summary on the stack so it has natural order and can be hashed without swapping.
  • Remove auth::adv_insert_hqword in favor of adv.insert_hqword.
  • Optimize account ID seed validation for the new hasher layout.
  • Optimize $kernel::account::is_slot_id_lt for the new little-endian stack layout by running suffix comparison first.
  • Optimize account_id::validate for the new little-endian stack layout by running suffix validation first.
  • Use the first half word of the seed digest to extract the account ID:
    • An account ID seed digest [digest0, digest1, digest2, digest3] now defines suffix = digest0 (+ shaping) and prefix = digest1.
    • This is consistent with how slot IDs (also half-words) are extracted from their hashes using push.SLOT_NAME[0..2] which pushes the first two elements in little-endian order.
    • We could also use the second half-word, so that the prefixes are actually the most significant elements of the digests, but I think this is probably an arbitrary decision. Let me know if you have different opinions!
  • Replace AccountId::try_from([prefix, suffix]) with AccountId::try_from_elements(suffix, prefix) which is better than the [Felt; 2] API that has unnamed fields (and used the "wrong" order). Fixes the order to be suffix, prefix. This is now finally consistent with the APIs of AssetId and StorageSlotId (the other "half-word types").
  • Consistently use RATE0, RATE1, CAPACITY as the hasher layout.
  • Rename the Falcon512Rpo variants in Signature, AuthScheme, AuthSecretKey to Falcon512Poseidon2.

@PhilippGackstatter PhilippGackstatter added the pr-from-maintainers PRs that come from internal contributors or integration partners. They should be given priority label Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-from-maintainers PRs that come from internal contributors or integration partners. They should be given priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant