Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Revisit the SSZ/JSON decode-probing fallback in the parsigex codec

未关闭
#640 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 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 内容生成。

描述

enhancement rust

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 gets ParSigExCodecError::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.rs is 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 the SignedData-to-enum refactor (#639), which makes the encode side an exhaustive match.
主要语言
Rust
星标
8
派生
5
平均合并
4 天 18 小时
30 天内合并 PR
4

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

NethermindEth/pluto 的其他 Issue

查看 NethermindEth/pluto 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。