Repair authorization payloads left naming a ticker - #343
Open
F-OBrien wants to merge 3 commits into
Open
Conversation
ts-node ignores tsconfig `include` unless `files` is set, so the injected `api`/`store`/`logger` types never reached scripts. authorization-payloads.ts could not compile at all; eth-transact-senders.ts papered over it with a local `declare global`, which now conflicts and is removed.
Moves nextFetchSize, printDryRun and a new resumeFrom into historical.ts so both backfills use one implementation instead of each carrying its own.
The chain's v6 to v7 ticker_migrations rewrote TransferAssetOwnership and BecomeAgent payloads to asset ids without emitting an event, so rows indexed before that upgrade still name a ticker. The asset id is derivable from the ticker, so both the upgrade-time repair and the backfill run offline.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
authorizations.datarecords the payload theAuthorizationAddedevent carried at creation. Thechain's v6 → v7
ticker_migrationsrewroteTransferAssetOwnershipandBecomeAgentpayloads fromtickers to asset ids, but emitted no event, so every row indexed before that upgrade still names a
ticker. Resolving that ticker today can point at a different asset than accepting the authorization
would actually transfer, because a ticker can be unlinked and relinked in between.
The migration is deterministic —
AssetId::from(ticker)isblake2_128(("legacy_ticker", ticker))normalised to a v8 UUID — and the ticker is already stored,so the asset id is derived locally. Neither the repair nor the backfill reads chain state.
Verified against live testnet authorization 54631: the stored ticker derives to
0x7edf86b7e651823cb21c2574e61c6ff3, which is the value the chain holds. That vector is pinned inthe unit tests.
Changes
repairAuthorizationsAfterUpgrade(src/mappings/entities/identities/repairAuthorizations.ts):rewrites still-pending
TransferAssetOwnership/BecomeAgentrows whose payload is a 12 byteticker rather than a 16 byte asset id. Wired into the existing
mapChainUpgradehook alongsidethe multiSig repair, gated on 7.x and later — the transaction version bumped 4 → 7 at v7.0.0, so
a genesis resync repairs itself when it crosses that upgrade block.
scripts/backfill/authorization-payloads.ts: same logic for instances that indexed past theupgrade before this ships. Dry run by default,
--applyto write. Runs entirely against thedatabase — no chain connection and no archive node required.
nextFetchSize/printDryRun/resumeFromhelpers extracted intoscripts/backfill/historical.ts, now used by both backfills.tsconfig.json:ts-node.filesso scripts see SubQuery's injected globals. Without itauthorization-payloads.tsdoes not compile at all — a pre-existing gap the eth-transact backfillhad been working around with a local
declare global.Notes
_block_rangerevisions are readand written, so the pre-repair payload stays queryable at its own block height.
candidate on a later pass.
revive.ethTransact#342 and based onethTransact. Retarget toalphaonce that merges.Testing
yarn lint && yarn build && yarn test:unitgreen (198 tests). New unit suite covers payloadparsing, the
BecomeAgentpair case, the repair decision, idempotency, the pre-7.x no-op, and thestaging chain that migrated without UUID normalisation.
Breaking Changes
None.
JIRA Link
Checklist