Skip to content

fix(api): honour and bound StateWaitMsg confidence - #6567

Open
LinZexiao wants to merge 1 commit into
masterfrom
fix/state-wait-msg-confidence
Open

fix(api): honour and bound StateWaitMsg confidence#6567
LinZexiao wants to merge 1 commit into
masterfrom
fix/state-wait-msg-confidence

Conversation

@LinZexiao

@LinZexiao LinZexiao commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

描述

正确实现 StateWaitMsg 的 confidence 参数处理。

参考: Lotus PR #13705 (filecoin-project/lotus#13705)

改动

pkg/chain/waiter.go

  • 新增 MaxMessageConfidence 常量(=ChainFinality, 900 epochs), 超限 confidence 拒绝返回 ErrConfidenceTooHigh
  • 新增 confidenceReached() 辅助函数, 溢出安全
  • Bug 修复: 当消息在调用时的当前头被找到时不再忽略 confidence 立即返回, 改为等待 confidence 深度
  • 在 Waiter.Wait 入口增加 confidence 上限检查

pkg/chain/waiter_internal_test.go (新增)

  • TestConfidenceReached: 6个场景覆盖(零/精确/负candidate/不足/candidate高于current/current等于candidate)

前置检查

  • 编译通过 / gofmt / gen-all / compatible-all / git status / golangci-lint / 全量单元测试

- Add MaxMessageConfidence constant (= ChainFinality, 900 epochs)
- Add ErrConfidenceTooHigh error for over-limit confidence
- Add confidenceReached helper for overflow-safe comparison
- Fix: don't return immediately when message found in current head,
  wait for confidence depth instead (matching Lotus #13705)
- Add confidence bound check in Waiter.Wait entry point
- Add TestConfidenceReached unit test (6 cases)

Migration of Lotus PR #13705
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 47.82609% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 22%. Comparing base (30e71cd) to head (efba823).

Additional details and impacted files
@@          Coverage Diff           @@
##           master   #6567   +/-   ##
======================================
- Coverage      22%     22%   -1%     
======================================
  Files         790     790           
  Lines       83767   83776    +9     
======================================
- Hits        18603   18597    -6     
- Misses      62293   62306   +13     
- Partials     2871    2873    +2     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

2 participants