Repository navigation
fix(sdk-coin-eth): enforce strict ERC-7984 consolidation verification on test/staging (CECHO-2719) - #10192
fix(sdk-coin-eth): enforce strict ERC-7984 consolidation verification on test/staging (CECHO-2719)#10192nvrakesh06 wants to merge 2 commits into
Conversation
|
|
|
@claude review |
|
Claude finished @nvrakesh06's task in 33s —— View job Review of #10192 (CECHO-2719 strict ERC-7984 consolidation verification)I read the diff and did not run the tests. The PR is stacked on #10191, so the diff includes the CECHO-2720 commits. I only reviewed the 2719 logic closely. The design is sound: the destination is bound to locally derived CREATE2 forwarders and the value words are decoded from the original bytes. Two points below are worth fixing before merge. 1. The strict checks mix two sources of truth (
2. The outer value check uses
3. The index cap can reject legitimate consolidations (
4. Derivation cost
5. The destination set includes
6. Misplaced JSDoc (
7. Swallowed errors (nit)
8. Tests
Rollout note
|
bb9fd93 to
92cb494
Compare
|
Review disposition — all findings addressed in 92cb494 (force-pushed; suites: sdk-coin-eth 590 passing, abstract-eth 192, statics 42,051; Blocking (🔴), all fixed:
From the summary:
|
92cb494 to
b951a0d
Compare
…on decoders (CECHO-2719) decodeFlushERC7984ForwarderTokenCalldata decoded the callFromParent uint256 value but never returned it, and decodeSendMultiSigFlushERC7984Data skipped the sendMultiSig amount word entirely. Both are now surfaced (callFromParentValue as bigint, amount as a base-10 string) so verifiers can enforce that a consolidation moves no native value. Additive only; legacy consumers are unaffected.
b951a0d to
317636e
Compare
|
@claude review |
|
Claude finished @nvrakesh06's task in 34s —— View job Review of #10192 (CECHO-2719 strict ERC-7984 consolidation verification), re-review of 92cb494I read the current Verdict: no blocking issues. The earlier findings are resolved in the code:
Remaining points, none blocking:
Carried from the stacked #10191 (CECHO-2720), outside this PR's scope:
Please land these in #10191 before the release train ships. Rollout: CECHO-2719 must stay open after Release N. The staging and testnet validation of real TSS-direct and multisig consolidations is still outstanding. |
There was a problem hiding this comment.
Still open from earlier reviews (1):
- Unresolved: 1 blocking on lines changed since (possibly already fixed).
If you have decided not to act on one of these findings, resolve its thread (a reply alone leaves it open) and the next review stops counting it. To review this commit again now, use Re-run on its "Claude Code Review" check.
317636e to
a3fd18e
Compare
|
@claude Please do a thorough review of this PR. Focus especially on: • any bugs or incorrect logic in the changes. Please call out concrete issues clearly and separate them by severity if possible. |
|
Claude finished @nvrakesh06's task in 49s —— View job Review of #10192 (CECHO-2719 strict ERC-7984 consolidation verification), head a3fd18eI read the full diff of the abstract-eth decoders and Verdict: no blocking bugs found. The earlier blocking findings are fixed in the code:
What remains is mostly rollout risk and test gaps. 🟠 Medium: rollout and regression risk (worth confirming before the staging window)1. The txHex-less rejection changes behavior for every
2. The env gate is narrower than "non-prod" (
3. Index scan bound of 10000 is still a hard false-reject cliff (
🟡 Low: validation gaps and nits4. Unvalidated
5. The base address is accepted as a destination (
6. Redundant double decode.
7. Swallowed derivation errors.
8. Unsupported tx types.
Test coverage gapsThe hostile-prebuild, prod-gate and fee-address regression tests look thorough. Missing cases:
Alignment with design
|
… on test/staging (CECHO-2719) verifyConfidentialConsolidation never checked the outer transaction value, the sendMultiSig amount, or the callFromParent native value; returned true with zero inspection on consolidateId-only prebuilds; and compared the flush destination only against txPrebuild.recipients, the same untrusted server response as txHex. Strict tier (env test/staging; prod keeps legacy behavior for one release cycle, gate removal tracked in the ticket): - requires txHex: a consolidateId alone proves nothing about the signed bytes (every SDK signing path supplies txHex — the TSS txRequest flows pass signableHex/serializedTxHex, and the prebuild flow cannot sign without bytes) - binds every field from the ORIGINAL signed bytes (ethers parseTransaction, after addHexPrefix — the builder accepts unprefixed txHex, ethers does not): outer value 0, outer to (multisig shape must call the wallet contract), token contract, parent, handle, sendMultiSig amount 0, callFromParent value 0. The TransactionBuilder from()/build() round trip re-encodes flush calldata with a hardcoded value 0, which would normalize a hostile value word out of the inspected tx while the wallet signs the original bytes - the flushed forwarder must be a wallet-owned address derived locally from wallet data (CREATE2 forwarders of the base address with per-version salt layouts — v4 only with the wallet's fee address — early-exit index scan up to 10000, measured ~15us per derivation so a full miss costs ~450ms on the reject path only), never from the prebuild; fails closed when none can be derived. The wallet's own base address is NOT a valid flush destination — a legitimate consolidation always targets a forwarder contract - v4-salted forwarders are not derivable offline when the wallet record carries no fee address (the fee is part of the v4 CREATE2 salt); the rejection then names the missing fee address instead of silently dropping the v4 layout - applies regardless of which server-controlled flag routed the prebuild into the consolidation verifier Tests: the ticket's hostile prebuilds (direct theft, direct arbitrary call, multisig theft, multisig arbitrary call, wrong outer contract, non-zero callFromParent value, txHex-less consolidateId, underivable forwarders) are rejected on test and staging; the same prebuilds still verify on prod, proving the gate in both directions. Review regressions: unprefixed txHex accepted, fee-address wallets keep their v1/v2/v5 forwarders, v4-salted forwarders rejected with a named cause when the wallet fee address is missing and verified when it is present (TSS and multisig shapes), the base address rejected as a flush destination, multisig non-zero outer value rejected, and the derivation index cap is documented by test. The consolidation fixtures use a locally derived CREATE2 forwarder instead of an arbitrary address.
a3fd18e to
bd60198
Compare
|
Review disposition (head 🟠 Medium:
🟡 Low:
Test gaps:
CECHO-2719 stays open after Release N; staging/testnet validation remains the outstanding pre-GA item. |
|
@claude Please do a thorough review of this PR. Focus especially on: • any bugs or incorrect logic in the changes. Please call out concrete issues clearly and separate them by severity if possible. |
|
Claude finished @nvrakesh06's task in 45s —— View job Review of #10192 (CECHO-2719), head
|
Description
Fixes the client-side verification gap from CECHO-2719:
Erc7984Token.verifyConfidentialConsolidation— the verifier for ERC-7984 forwarder consolidation (flush) prebuilds — never checked the transaction value on any of the three levels that can move native funds (outer tx value,sendMultiSigamount,callFromParentvalue), returnedtruewith zero inspection onconsolidateId-only prebuilds, and compared the flush destination only againsttxPrebuild.recipients— the same untrusted server response astxHex. Sibling of #10191 (CECHO-2720); same rollout plan, riding the same release train. (Rebased onto master after #10191 merged, so this diff is purely the CECHO-2719 changes.)What this PR does (env-gated on
bitgo.env === 'test' || 'staging'; prod keeps legacy behavior for one release cycle):Value-word surfacing (
feat(abstract-eth)):decodeFlushERC7984ForwarderTokenCalldatanow returns thecallFromParentvalue it already decoded but dropped, anddecodeSendMultiSigFlushERC7984Datasurfaces thesendMultiSigamount word it previously skipped. Additive; legacy decode consumers unaffected.Strict verifier (
fix(sdk-coin-eth)): on test/staging,verifyConfidentialConsolidation:txHex— aconsolidateIdalone proves nothing about the signed bytes (every SDK signing path supplies the bytes: the TSS txRequest flows passsignableHex/serializedTxHex, and the prebuild flow cannot sign without them);parseTransactionafteraddHexPrefix— the builder accepts unprefixed txHex, ethers does not): outer tx value 0, outerto, token contract, parent, handle,sendMultiSigamount 0, andcallFromParentvalue 0. TheTransactionBuilder.from()/build()round trip re-encodes flush calldata with a hardcoded value 0 and would silently normalize a hostile non-zero value word out of the inspected transaction while the wallet signs the original bytes (found while testing the ticket's hostile prebuilds);feeAddress; a v4-salted flush whose wallet record carries no fee fails closed with a named cause; the wallet's own base address is not a valid flush destination — a legit consolidation always targets a forwarder contract), the same mathderiveAddress/isWalletAddressuse — via an early-exit index scan bounded at 10000 (measured ~15µs per derivation; a full miss costs ~450ms on the reject path only) — never againsttxPrebuild.recipients; fails closed when no wallet-owned forwarder can be derived;tomust be the wallet contract (base address);Unlike the enable-token verifier (CECHO-2720) there is no structural backstop here:
to = attackerwith a zero value still executes an arbitrary call as the wallet, which is why destination binding cannot be skipped.Rollout plan (tracked in CECHO-2719): this is Release N — strict checks on test/staging only, prod unchanged (no prod rollback concern: prod behavior in this release is identical to current). After staging/testnet validation of real consolidation flows (TSS direct + multisig shapes), Release N+1 removes the env gate and enforces everywhere, published as a minor bump. The ticket must not be closed after Release N alone. Release N+1 hardening proposed on the ticket: pipe the flushed address record's index/salt + forwarderVersion + feeAddress into the prebuild verification data so the derivation can use exact hints instead of a bounded scan.
Issue Number
CECHO-2719
Type of change
How Has This Been Tested?
Unit tests — 20 new cases in
modules/sdk-coin-eth/test/unit/erc7984Token.tsand 4 decoder cases inmodules/abstract-eth/test/unit/zamaUtils.ts:to = attacker,value = balance) rejectedto = attacker,value = 0) rejected — the no-backstop casesendMultiSig(attacker, balance, flush)) and multisig arbitrary-call (sendMultiSig(attacker, 0, flush)) rejectedtois not the wallet contract rejectedcallFromParentvalue rejected even when the destination is a derived forwarder (proves the original-bytes decode)consolidateId-only prebuild rejectedfeeAddress) when the wallet record carries no fee, and verified when it doesstagingenv as well astestenv === 'prod'(legacy path), demonstrating the gate works in both directionscallFromParentValue0n on builder output, 123n on hand-encoded non-zero calldata;sendMultiSigamount0/non-zero throughdecodeSendMultiSigFlushERC7984DataThe consolidation fixtures use a locally derived CREATE2 forwarder (Hoodi v1 factory) instead of an arbitrary address, so the existing valid-consolidation tests exercise the strict path without false positives.
Full-module runs on the final head:
modules/sdk-coin-eth598 passing (578 on master-with-#10191 + 20 new),modules/abstract-eth192 passing (188 + 4),modules/statics42,051 passing — zero failures.npx commitlint --from=origin/master -Vclean;yarn lintandcheck-fmtclean.Reproduce:
cd modules/sdk-coin-eth && npx mocha(alsomodules/abstract-eth,modules/statics).Remaining pre-GA work (per the ticket): exercise real consolidation flows against staging/testnet in strict mode (TSS direct + multisig shapes) before Release N+1 removes the gate — shared validation window with #10191.
Checklist