Decouple aens claim and preclaim transactions#3159
Decouple aens claim and preclaim transactions#3159CedrikNikita wants to merge 1 commit intodevelopfrom
Conversation
f2f96fd to
4145a13
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| update: 'update', | ||
| extend: 'extend', | ||
| }, | ||
| AE_AENS_NAME_AUCTION_MAX_LENGTH: 12, |
There was a problem hiding this comment.
Test mocks incorrect auction max length constant
Low Severity
The test mocks AE_AENS_NAME_AUCTION_MAX_LENGTH as 12, but in production (src/protocols/aeternity/config.ts) it is 12 + AE_AENS_DOMAIN.length which equals 18 (since AE_AENS_DOMAIN is '.chain'). This means the test uses a different threshold than production for deciding whether a name requires a pointer update. Names between 13–18 characters would incorrectly trigger pointer updates in tests but not in production, so edge-case tests around that boundary would give false confidence.
| address, | ||
| name, | ||
| salt: nameSalt, | ||
| blockHeight: topBlockHeight.value, |
There was a problem hiding this comment.
Stored blockHeight may be zero causing premature claim
Medium Severity
In addNameToClaimQueue, blockHeight is set to topBlockHeight.value, which is a polled computed value defaulting to 0. If the top header hasn't been fetched yet when preclaim completes, blockHeight is stored as 0. Later in claimName, the guard topBlockHeight.value < blockHeight + 1 becomes topBlockHeight.value < 1, which is almost always false, causing the claim to be attempted immediately—potentially before the required one-block delay after preclaim, leading to a failed claim transaction.


This PR includes several improvements:
NamePreclaimTxandNameClaimTxin AENS claiming process #2200;Note
Medium Risk
Introduces persisted, auto-processed AENS claim queueing and pointer-update handling, changing how name transactions are created/signed and resumed across sessions. Risk is moderate due to on-chain transaction flow changes and new encrypted state persistence that could affect claim/pointer behavior if edge cases are missed.
Overview
Decouples AENS name registration into a persisted preclaim/claim queue (
preclaimedNames) stored in secure storage and resumed automatically, so accounts aren’t blocked while waiting for claim mining and the process can survive navigation/extension restarts.Updates the name claim UI to enqueue a preclaim (and prevent re-preclaiming the same name while it’s in progress), and updates the names list to show pending queued names immediately while preferring the owned entry once the name is active.
Adds queue processing in
useAeNamesto submit/rehydrate claim txs (reusing existing pendingNameClaimTxwhen present), poll for mining, perform pointer updates for long names, and retry pointer updates without dropping the queued entry; includes new unit tests covering these scenarios.Written by Cursor Bugbot for commit 4145a13. This will update automatically on new commits. Configure here.