Skip to content

chore: upgrade dependencies and restore build/test coverage - #321

Merged
huo-ju merged 2 commits into
rumsystem:mainfrom
liujuanjuan1984:codex/fix-p2p-test-build
Jun 22, 2026
Merged

chore: upgrade dependencies and restore build/test coverage#321
huo-ju merged 2 commits into
rumsystem:mainfrom
liujuanjuan1984:codex/fix-p2p-test-build

Conversation

@liujuanjuan1984

@liujuanjuan1984 liujuanjuan1984 commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

背景

本 PR 基于 codex/fix-p2p-test-build,聚焦依赖升级、默认构建/测试恢复、旧测试 API 不匹配收敛,以及审查发现的高置信死代码和依赖 audit 风险清理。

相关 issue:Related #320。该 issue 是 go-libp2p-kad-dht DHT 风险的 audit 备忘,本 PR 仅记录并暴露该残余风险,不宣称关闭或修复该风险。

主要变更

  • 升级 Go 工具链声明与 CI/Docker Go 版本配置。
  • 升级主要依赖线,包括 libp2p、kad-dht、pubsub、go-ethereum、Echo/JWT、OPA、protobuf、quic-go、bbolt、x/crypto、x/net 等。
  • 适配升级后的 API:Echo JWT、libp2p peer ID、p2p/scorers 测试断言与相关测试辅助。
  • 将引用已删除历史 API 的旧测试隔离到显式 build tags,恢复默认构建与全量回归。
  • 增加跨包集成测试锁,避免固定端口测试并发互相干扰。
  • 恢复 make serve-doc 所需的 Swagger 文档服务依赖,并用 docs build tag 避免 docs.go 干扰默认主程序构建。
  • 恢复 P2P 真实连接回归覆盖:TestNodeConnecting 不再无条件跳过,改为创建真实 libp2p 节点并验证 bootstrap 与 peer 连接路径。
  • 升级 GoReleaser 到支持当前 dockers_v2.ids 配置的精确版本,并验证配置解析。
  • 继续收敛依赖 audit 风险:将 retracted 的 github.com/klauspost/reedsolomon 升级到 v1.14.1,将 github.com/swaggo/echo-swagger 升级到 v1.5.2,并把项目源码中剩余的旧 github.com/golang/protobuf/proto 调用迁移到 google.golang.org/protobuf/proto
  • 修正 CLI 清理范围:恢复 blocks 模式,并按当前 uint64 block id、CurrtTopBlockRexSyncerStatus 与新版 pb.Block 字段适配;继续移除已无服务端 API 支撑的 pubqueue 页面和 auto-ack 兼容层。
  • 清理本分支引入或全仓高置信死代码,包括不可用 pubqueue auto-ack 兼容层、空 cache sync 方法、未使用的 safeClose helper、未使用的 PsConnChanel 枚举,并修正 PeerStatus 重新走内部状态查询 helper。

风险与说明

  • govulncheck 仍报告 GO-2024-3218,来源是 github.com/libp2p/go-libp2p-kad-dht@v0.40.0,且公开漏洞库当前没有 fixed version。该风险已在 依赖风险审计备忘:go-libp2p-kad-dht DHT 发现机制的 Sybil/审查风险 #320 作为依赖 audit 备忘记录。
  • 本 PR 未移除 DHT,也未改造 peer discovery 架构;因此不能使用 Closes #320
  • go list -m -u -json all 复查后,retracted 依赖已清零;剩余 deprecated 项为传递依赖或模块图残留:github.com/golang/protobuf 仍由 badger/go-ethereum/prometheus 等传递依赖引入,cloud.google.com/go/pubsubgithub.com/cncf/udpa/gogithub.com/deepmap/oapi-codegen 均不是当前主模块直接需要。继续清理这些项需要升级核心存储或 go-ethereum/grpc/cloud 依赖链,已刻意不混入本 PR。
  • Badger 存储依赖升级涉及 fork 差异和磁盘数据兼容性,已单独在 Audit Badger storage dependency upgrade path #323 跟进,当前 PR 不改动 Badger。
  • pubqueue CLI 页面依赖的 /pubqueue/trx/ack 服务端路径已经不存在,因此继续移除;对应的无效 --autoack flag 和 AutoAck 配置字段也已清理。
  • GoReleaser 当前使用 v2.17.0-d9421c5f-nightly,因为可查询到的稳定 v2.16.0 尚不支持本配置使用的 dockers_v2.ids 字段。

验证

  • goreleaser check 通过。
  • go test ./cmd/cli/... 通过。
  • go test ./internal/pkg/conn/p2p -run TestNodeConnecting -count=1 -v 通过。
  • go test -tags docs -run '^$' ./docs.go 通过。
  • timeout 30s make serve-doc 成功生成 docs 并启动 http server started on [::]:1323;退出码 124 为 timeout 主动截停。
  • go test -run '^$' ./... 通过。
  • go test ./pkg/consensus ./internal/pkg/storage/chain -count=1 通过。
  • go test -count=1 -timeout=520s ./... 无缓存完整回归通过。
  • git diff --check 通过。
  • govulncheck ./... 已运行,结果只剩 GO-2024-3218,无其它漏洞发现。

@liujuanjuan1984
liujuanjuan1984 force-pushed the codex/fix-p2p-test-build branch from fbb66a3 to 38f8133 Compare June 22, 2026 11:13
@liujuanjuan1984 liujuanjuan1984 changed the title chore: upgrade dependencies and restore regression tests chore: upgrade dependencies and restore build/test coverage Jun 22, 2026
@liujuanjuan1984
liujuanjuan1984 force-pushed the codex/fix-p2p-test-build branch 3 times, most recently from 3a5835c to 1e161c4 Compare June 22, 2026 15:19
Upgrade the Go dependency stack and release tooling, restore docs serving, keep P2P connection coverage active, clean obsolete pubqueue/autoack paths, and preserve CLI blocks mode against the current block API.
@liujuanjuan1984
liujuanjuan1984 force-pushed the codex/fix-p2p-test-build branch from 1e161c4 to ddaa1c6 Compare June 22, 2026 15:23
@huo-ju
huo-ju marked this pull request as ready for review June 22, 2026 18:03
@huo-ju
huo-ju merged commit ebe2831 into rumsystem:main Jun 22, 2026
2 checks passed
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