Skip to content

fix(x2ethereum): finalize prophecies and separate prophecy ids - #1345

Open
vipwzw wants to merge 1 commit into
masterfrom
fix-x2ethereum-prophecy-replay
Open

vipwzw wants to merge 1 commit into
masterfrom
fix-x2ethereum-prophecy-replay

Conversation

@vipwzw

@vipwzw vipwzw commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator

问题

  1. 跨链 prophecy 非终态导致重复铸币/放款:Oracle.ProcessClaim 只拒绝 Failed 状态的 prophecy。已达 Success 的 prophecy 仍允许尚未投票的验证人继续提交相同 claim,processCompletion 再次返回 Success,procEth2Chain33_lock 随即再次执行 ProcessSuccessfulClaimForLock(accDB.Mint),burn 方向则重复从桥账户付款。按 70% 阈值,正常会有约 30% 验证人“迟到”;控制任一迟到验证人即可对同一笔跨链资产反复增发,验证人集变更后还能继续重复。
  2. prophecy ID 无分隔符拼接碰撞:chainID+nonce+sender+token+type 直接拼接,(chainID=1,nonce=23) 与 (chainID=12,nonce=3) 产生相同 ID;不同链的跨链 claim 会互相污染,可让合法 claim 命中已存在的 prophecy 被判 Failed 而资金卡死。

修复

  • 新增 ForkX2EthFixReplayCollisionNormalize:
    • ProcessClaim 将 Success/Failed 都视为终态,后续投票直接拒绝;
    • 新增 calcProphecyID,分叉后使用 : 分隔字段生成 ID,lock/burn 处理与 oracle claim 创建统一走该函数;
  • 分叉前保留旧 ID 与旧状态机,默认高度 0 生效。
  • 更新 x2ethereum 测试中的 prophecy ID 断言,并新增 ID 分隔符单元测试。

验证

  • go build ./plugin/dapp/x2ethereum/... 通过
  • go test ./plugin/dapp/x2ethereum/executor/ -count=1 通过(含原有 prophecy 套件)

Two related bridge safety defects:

1. ProcessClaim only rejected prophecies whose status was Failed. A prophecy in
   Success status still accepted claims from validators that had not voted yet;
   each of those transactions returned Success again and procEth2Chain33_lock /
   procEth2Chain33_burn re-ran ProcessSuccessfulClaimForLock (accDB.Mint) or the
   burn transfer, minting/paying the same cross-chain transfer repeatedly.
2. Prophecy IDs concatenated chainID, nonce, sender, token and claim type
   without separators, so (chainID=1,nonce=23) and (chainID=12,nonce=3) collided
   and unrelated cross-chain claims could poison each other.

Behind ForkX2EthFixReplayCollisionNormalize:

- Treat Success and Failed as terminal in ProcessClaim.
- Build the prophecy ID with ':' separated fields via calcProphecyID, used by
  both oracle claim creation and the lock/burn handlers.
- Update tests to derive prophecy ids with the same helper.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant