feat(sdk-coin-polyx): replace placeholder v8 testnet metadata with live RPC#9145
Conversation
93e9e2e to
912862d
Compare
…ttlement builders Replace placeholder testnetV8.ts with metadata from testnet-rpc.polymesh.live (specVersion 8000000, txVersion 8) so V8 builders encode real v8 call indices (e.g. transferWithMemo @ 0x0528, HSM method ID 1320). Material is committed statically in src/resources/testnetV8.ts — no runtime or build-time RPC fetch. mainnetV8.ts remains placeholder until mainnet fork. V8TokenTransferBuilder/V8HexTokenTransferBuilder now build the real v8 settlement.addAndAffirmWithMediators arg shape: `holderSet` with AssetHolder-wrapped legs (v7 used bare `portfolios`/PortfolioId and throws on real v8 metadata). Transaction.toJson()/loadInputsAndOutputs() gained dual-path decoding for v7 bare `did` and v8 `portfolio.did`. Added V8RegisterDidBuilder for identity.registerDid (0x0718), BitGo's v8 DID Registrar path. Verified against testnetV8Material that registerDid takes only `targetAccount` (no secondaryKeys/expiry, unlike the CDD path). All encode-decode paths verified against committed testnetV8Material. Fixed V8TransferBuilder call-index test to assert raw method hex on the unsigned tx. TICKET: CECHO-1471 Co-authored-by: Cursor <cursoragent@cursor.com> Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
912862d to
9818176
Compare
|
@claude review this PR |
|
Claude finished @ArunBala-Bitgo's task —— View job PR Review: Replace placeholder v8 testnet metadata with live RPCOverall Assessment: ✅ Approved with Minor CommentsThis is a well-structured PR that successfully replaces placeholder v8 metadata with real testnet data and implements proper v8 builders. The changes are technically sound with excellent test coverage. Review SummaryStrengths:
Key Technical Improvements:
Minor Issues/Questions:
Security Considerations:
Testing:
This PR successfully delivers the v8 metadata integration with high code quality. The implementation is production-ready pending the HSM and WP dependency PRs mentioned in the description. |
Summary
testnetV8.tsfromtestnet-rpc.polymesh.live(specVersion: 8000000,txVersion: 8) — metadata bytes now differ from v7 (no longer a placeholder copy).scripts/regenerateTestnetV8Material.tsfor future refreshes.V8TransferBuildertests: metadata ≠ v7,transferWithMemoencodes call index0x0528(HSM method ID 1320).mainnetV8.tsremains placeholder until mainnet v8 fork (mainnet still on spec 7004001).V8TokenTransferBuilder/V8HexTokenTransferBuildernow build the real v8 settlement arg shape. Previously they reused the v7portfolios/bare-PortfolioIdargs against v8 metadata, which throws at build time (Method settlement::addAndAffirmWithMediators expects argument holderSet, but got undefined) — confirmed by re-running the existing test suite. v8 renamesportfoliostoholderSetand wraps every legsender/receiverin anAssetHolderenum ({ Portfolio: { did, kind } }).Transaction.toJson()/loadInputsAndOutputs()gained dual-path decoding (v7 baredid, v8portfolio.did) since the sharedTransactionclass serves both v7 and v8 SendToken txs.V8RegisterDidBuilderforidentity.registerDid(0x0718) — BitGo's actual v8 DID Registrar path. The existingV8RegisterDidWithCDDBuilderonly rebuilds the oldcddRegisterDidWithCdd(0x0714) call against v8 metadata. Verified against the realtestnetV8MaterialthatregisterDidtakes onlytargetAccount(nosecondaryKeys/expiry, unlike the CDD path) — this corrects the migration plan's dry-run note, which claimed an identical arg shape.V8TransferBuildercall-index test, which asserted.toBroadcastFormat().method(a plain string —.methodisundefinedon it) instead of the raw method hex on the unsigned transaction.All new/changed encode-decode paths were verified against the real committed
testnetV8Materialmetadata registry (call indices, field names, and exact enum-variant casing for encode vs. decode), not just spec/tx version pass-through.Why
CECHO-1471 shipped V8 builders with v7-mirroring metadata. Real v8 testnet signing requires actual chain metadata so builders emit correct call indices — and, for settlement/DID-registration, the correct v8 argument shape, since those two extrinsics genuinely changed on v8.
Depends on / pairs with
feat/CECHO-1473-real-v8-hsm-method-ids-and-parsers(registers method IDs 1320 + 1816)feat/CECHO-1471-wp-preserve-v8-builder-material(stops overwriting v8 builder material with IMS v7 metadata)Follow-ups (not in this PR)
mainnetV8.tsafter mainnet fork (~July 22, 2026)V8RejectInstructionBuilder— verifysettlement.reject_instructionarg diff on v8 (plan §9, still open)identity.registerDidis accepted (plan §6.2, open question Incorporate API changes #2) —V8RegisterDidBuilderis ready but untested against a live registrar-permissioned keyTest plan
yarn unit-testforsdk-coin-polyx— 220 passing, 0 failingtsc --noEmitclean,eslintclean (0 errors)testnetV8Material.metadata !== testnetMaterial.metadataV8TokenTransferBuilderencodesholderSet+AssetHolder-wrapped legs and round-trips through decode against real v8 metadataV8RegisterDidBuilderencodes call index0x0718(identity.registerDid) and round-trips through decodeMade with Cursor + Claude Code