Repository navigation
refactor(apriori): move the aprMON ABI to the explorer tier - #198
Conversation
The aprMON implementation is verified on MonadScan, so the ABI moves from the vendored tier to the explorer tier per ADR 0007. The full implementation ABI is fetched from the explorer and committed as typed as const via update:abis. An offline test asserts it is exact renderAbiModule output and a keyed online test cross-checks it against the verified implementation with compareDeployedAbi. The exported AprMonAbi now includes the viewRedeemRequest and getUserRequestData view helpers.
…ish the explorer-tier wording - test/abis.test.ts asserts SOURCES fetches the implementation abis.json pins, so the offline derivation and the keyed cross-check cannot point at different contracts; drop the dead fallbacks. - test-online keeps the implementation bytecode check the deleted selector test used to carry. - vitest.online.config.ts describes the keyed suite; README states what the offline test does and does not defend. - Changeset minor: the exported AprMonAbi widens from 11 to 165 entries.
nishuzumi
left a comment
There was a problem hiding this comment.
Audited exact head 709f8cea against main@8a3bc89, plus my follow-up commit.
The tier switch is correct and complete for #197: the committed 165-entry artifact is byte-for-byte the explorer ABI MonadScan serves for 0x7D2F… today (independently fetched and compared), every one of the eleven previously vendored signatures has an identical entry (indexed layouts included; only the two convertTo* outputs gained names), and the keyed compareDeployedAbi cross-check fails closed on added/removed/changed entries and on any indexed flip. #192's real-log Redeem tests still fail on a mutated layout against the full artifact, so the offline suite keeps a content anchor for the three decoded events. Type cost is unchanged (fewer instantiations than the parseAbi string parsing it replaces); dist/index.d.ts grows to 61 KB, in line with kuru.
Deleting the bytecode selector/topic test was the right call — against exact-match verified source it adds nothing compareDeployedAbi lacks and cannot see indexed or outputs — so I did not ask for it back.
Pushed before the squash:
test/abis.test.tsnow assertsSOURCES[0].address === abis.json.aprMon.implementation(#197 item 4); a typo'd source address that MonadScan still knows would otherwise render a valid module and stay green offline. Dead??fallbacks removed.- the online suite keeps the implementation-bytecode check that lived inside the deleted selector test.
vitest.online.config.tsno longer describes the suite as keyless/vendored/"tracked in #197" (item 5), and the README states precisely what the offline test defends: canonical rendering and the recorded address, not ABI content, which the keyed cross-check and the real-log test cover.- Changeset
minor:AprMonAbiis a public export and widens.
Verification: frozen install, lint, build, typecheck, offline suite; apriori live 23/23 with zero-Warning stake/unstake simulations; keyed test:abi:online 7/7. Remaining live failures (Aave #201, Kuru #194) are baseline.
|
@zkasuran merged as |
What and why
The aprMON EIP-1967 implementation
0x7D2F8dc5a67CA1911bb1A2429552CDf507d106F2is now verified on MonadScan (contractaprMON, compilerv0.8.28+commit.7893614a, exact bytecode match). ADR 0007 orders ABI provenancecompiled > explorer > vendoredand moves a vendored ABI up once the chain allows a live explorer cross-check. The chain now allows one, so this moves@themoss/protocol-apriorifrom the vendored tier to the explorer tier. Closes #197.src/abis/apriori.tsis now the full implementation ABI fetched from the explorer and committed as typedas const, generated byrenderAbiModulefrom ascripts/abis.tssource table, replacing the curated hand-vendored signature list. The full artifact also brings in theviewRedeemRequestandgetUserRequestDataview helpers the curated ABI never carried.Type of change
Framework and package impact
@themoss/protocol-apriorionly. The exportedAprMonAbibecomes the full explorer ABI (165 entries) instead of the 11-entry curated list. Every function and event the adapter uses keeps its signature and the three decoded events keep their parameter names, so the Capabilities, Receipt parsers and typed Handles are unchanged. No change to the MCP composition. Adds atsxdevDependency and anupdate:abisscript, matching the other explorer-tier packages.Verification
pnpm buildpnpm typecheckpnpm lintpnpm testProtocol changes
@ts-expect-errorfixtures cover exported type behaviorEvidence
pnpm --filter @themoss/protocol-apriori test:abi:online(keyed, Monad mainnet) passes 7/7: proxy pin, deployed bytecode, the EIP-1967 slot resolving to the recorded implementation, on-chainname/symbol/decimalsagainst the exported constants, aconvertToShares/convertToAssetsround-trip andcompareDeployedAbi(AprMonAbi, fetchAbi(implementation))returning zero issues.pnpm --filter @themoss/protocol-apriori testpasses 23/23 including the live stake and unstake simulations with zero Warnings, plus the chain-derived Redeem-tx fixture, all against the full ABI.test/abis.test.tsasserts the committed module is exactrenderAbiModuleoutput, so a hand-edit or a drift fails closed.abis.jsonpins the proxy/implementation pair with an emptyallowedExplorerOnly.AI assistance (Claude, Anthropic) was used in developing this change. The design, review and verification were done by the author. Verified locally before submitting:
pnpm build,pnpm typecheck,pnpm lint,pnpm test(23/23, including the live Monad stake and unstake simulations) and the keyedpnpm --filter @themoss/protocol-apriori test:abi:online(7/7) all pass.