Revisit the SSZ/JSON decode-probing fallback in the parsigex codec
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 45/100
- Issue 类型
- 重构
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- rust
调研方向
从 crates/core/src/parsigex_codec.rs 中的 deserialize_signed_data 及其 SSZ/JSON 探测分支开始,然后检查 unsigneddata.rs 中的拒绝路径和 rejects_empty_set 覆盖情况。在决定应如何表示候选 codec 之前,跟踪每种 duty type 的解码路径和 serialize_signed_data 路径。完成的标准是:失败的尝试会显示在终端错误和调试日志中,并且测试覆盖 fallback 失败、length/offset 防护以及每种 duty type 的分支。
由索引模型根据 Issue 内容生成。
描述
Summary
Partial-signature payloads carry no encoding tag — the protobuf envelope is duty + opaque bytes — so deserialize_signed_data reconstructs the type by probing: per duty type, up to 2 SSZ shapes then (if the bytes look like JSON) 2 JSON shapes. ssz_codec layers a second probe underneath (20-byte vs 12-byte versioned-attestation headers), so one Attester payload can be tried five ways; first successful parse wins. This is a faithful port of Charon's core/proto.go marshal/unmarshal.
Problems:
- Error swallowing: 13
if let Ok(...)sites discard the per-attempt errors; when everything fails the caller getsParSigExCodecError::UnsupportedDutyType— misleading, since the duty type was supported and the bytes just didn't parse. There is no way to see "SSZ failed because X, JSON failed because Y". - Ambiguity is designed in: nothing guarantees the candidate shapes are mutually exclusive; a phase0 decode can accept bytes meant as versioned and get silently re-wrapped.
- Charon has a per-test kill switch (
DisableSSZMarshallingForT); Pluto has no equivalent, so the JSON decode branch is effectively unreachable in tests for SSZ-capable types.
Constraint
The wire format must interoperate with Charon in mixed clusters. An explicit encoding tag in the envelope deviates from Charon's parsigex protocol and is only viable behind protocol negotiation or as an upstream change — the probing itself cannot simply be removed.
Proposed change
- Short term: stop swallowing errors — accumulate each attempt's failure into the returned error (and a debug log), and rename the terminal variant to reflect "no codec accepted the payload". Land decode-rejection tests with it: today a single rejection branch in
unsigneddata.rsis tested (rejects_empty_set) — the SSZ/JSON fallback failures, the length/offset guards, and the codec's per-duty-type error branches are all unasserted, so the error-accumulation change would ship blind. - Medium term: replace the hand-written probe chains with a per-duty-type table of candidate codecs declared in one place, so encode (
serialize_signed_data's downcast ladder) and decode stay symmetric. This composes with theSignedData-to-enum refactor (#639), which makes the encode side an exhaustive match.
- 主要语言
- Rust
- 星标
- 8
- 派生
- 5
- 平均合并
- 4 天 18 小时
- 30 天内合并 PR
- 4
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
NethermindEth/pluto 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 52/100
NethermindEth/pluto#719 ·
-
rust
难度 5/5 一周以上 新手友好度 45/100
NethermindEth/pluto#638 · 1 条评论 ·
-
enhancement rust
难度 5/5 一周以上 新手友好度 35/100
NethermindEth/pluto#635 ·
-
Improve `alpha test peers`: match Charon's probes; reduce timeouts可能已有人在做 @varex83agent 于 25 天前认领。 未关闭bug track:orchestration-cli
难度 5/5 一周以上 新手友好度 28/100
NethermindEth/pluto#632 ·
-
enhancement rust
难度 5/5 一周以上 新手友好度 35/100
NethermindEth/pluto#631 ·
查看 NethermindEth/pluto 的全部 Issue
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 75/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
manuscript-lang/manuscript#1364 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
equinor/septic-config-generator#504 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 72/100
GiganticMinecraft/seichi-portal-backend#1633 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
fable-compiler/Fable#5157 ·
维护者通常 1 天内回复