Skip to content

[Audit B] 代码一致性:version 命名统一 + 命名规范 + 事件 indexed #256

@jhfnetboy

Description

@jhfnetboy

来源:全仓综合审计报告 docs/audit/comprehensive-audit-2026-06-11.md §3 代码一致性 · B-H1 / B-M1 / B-M2 / B-L1~L4

B-H1|version() 三套命名标准

"Registry-5.3.3" / "Staking-4.2.0"(前缀≠合约名)/ "MySBT-3.2.0" / "SuperPaymaster-5.3.3" / "PMV4-Deposit-4.5.0"(完全另一套),版本号 3.2.0~5.3.3 各飞各的,无法从单一版本号推断系统兼容性。建议统一 合约名-X.Y.Z + monorepo release 版本。

B-M1|custom error 与 require-string 混用

集中在 BasePaymasterUpgradeable.sol:24BasePaymasterUpgradeable.sol:90(全仓其余统一 custom error)。建议改 custom error,顺带省字节码。

B-M2|mutable storage 用 SCREAMING_SNAKE_CASE 暗示 immutable

GTOKEN_STAKING / MYSBT / SUPER_PAYMASTER / APNTS_TOKEN / BLS_AGGREGATOR 与真 immutable 撞命名风格,误导。建议 mutable 改 mixedCase。

B-L1~L4

  • B-L1|version() 的 virtual/override 修饰不一致(UUPS 用 virtual,pointer-replacement 不用,有理由但缺注释)。
  • B-L2|事件冗余携带 block.timestamp(MySBT / Registry 多个事件)— 纯浪费 LOG data word,indexer 可直接取。
  • B-L3|indexed 不统一(OperatorConfigured 的 xPNTsToken / treasury、X402PaymentSettled 的 asset 未 indexed)。
  • B-L4|MySBT 单字母命名(_m、参数 u/c/d/g/s/r/a/f)拉低可读性,与全仓不一致。

优先级

Low-Medium

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions