feat: add progressive types#528
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dca3c9673b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Performance Report✔️ no performance regression detected Full benchmark results
|
|
@lodekeeper please review |
lodekeeper
left a comment
There was a problem hiding this comment.
Thanks @wemeetagain. Read through the diff at d3bcb2f. Overall the new types look solid and the spec-test wiring is in good shape. One real blocker before merge, plus a couple of smaller things.
Blocker
CompatibleUnion embedded in StableContainer produces wrong proofs. Detailed in the inline reply to the Codex P1 (#528 (comment)) — TL;DR the PR correctly refactored the base CompositeType.tree_createProofGindexes to a per-prop recursive dispatch, so CompatibleUnion's selector-aware override is reached when the parent is a default-CompositeType (e.g. Container, ProgressiveContainer). But StableContainerType.tree_createProofGindexes (stableContainer.ts:434) still drives off this.getPathInfo(jsonPath), which is node-less and walks through CompatibleUnion.getPropertyType("data") → representativeType. That mis-resolves selector-specific paths (throws on fields not in the representative; silently returns phantom leaves for paths that fall back to tree_getLeafGindices on the representative type).
Suggested minimal fix: align StableContainerType.tree_createProofGindexes with the new recursive-dispatch pattern (keep the inactive-optional skip at the top level, then delegate to childType.tree_createProofGindexes(childNode, [remainingPath]) and concatGindices([childGindex, g])).
Plus a test like the existing valid.test.ts "creates nested selected data proofs using the active selector type" case but with a StableContainer wrapper — would have caught this. Worth covering both:
- a shared/common field path (
["u", "data", "common"]) - a selector-specific field path against the non-representative selector (
["u", "data", "fieldOnlyInB"])
Smaller observations
-
ProgressiveListBasicTreeViewDU.push(progressiveList.ts:634-638) andProgressiveListCompositeTreeViewDU.push(progressiveList.ts:765-769) do a fulltree_toValue→value_toTreeround-trip on every push. That'sO(N)per push andO(N²)forNpushes.ListBasicTreeViewDU/ListCompositeTreeViewDUhave incremental push paths; worth at least a TODO since these are advertised on the public API. Not a correctness issue. -
CompatibleUnionreusesgetLengthFromRootNode/addLengthNodeto stash the selector in the right-leaf "length" slot (compatibleUnion.ts:184, 189, 199, 201, 253, 323, 404, 432). Clever, but the naming will confuse readers a year from now — a one-line comment in the class header explaining "the right leaf encodes the selector via the existing length-node helpers" would help. -
bitList.ts— the newend <= startguard indeserializeUint8ArrayBitListFromBytesis a nice defensive addition. Worth a test that exercises it (e.g.BitListType.deserialize(new Uint8Array(0))) — without it, that input falls through todata[end-1]returningundefinedand produces a confusing error. -
Spec-test versioning bumps to
v1.7.0-alpha.5and the newcompatible_unions/progressive_containerscases ingeneric/types.tslook correct.
Disclosure
🤖 Reviewed with AI assistance (Codex-CLI cross-check).
|
Merging to unblock 7688 progress |
🤖 I have created a release *beep* *boop* --- <details><summary>persistent-merkle-tree: 1.3.0</summary> ## [1.3.0](persistent-merkle-tree-v1.2.5...persistent-merkle-tree-v1.3.0) (2026-05-18) ### Features * add progressive types ([#528](#528)) ([bcbcae3](bcbcae3)) </details> <details><summary>ssz: 1.5.0</summary> ## [1.5.0](ssz-v1.4.0...ssz-v1.5.0) (2026-05-18) ### Features * add progressive types ([#528](#528)) ([bcbcae3](bcbcae3)) ### Miscellaneous * bump CI Node versions to 22 and 24 ([#524](#524)) ([e8c3edb](e8c3edb)) ### Dependencies * The following workspace dependencies were updated * dependencies * @chainsafe/persistent-merkle-tree bumped to 1.3.0 </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Motivation
Description
ProgressiveList,ProgressiveBitlist,ProgressiveContainer,CompatibleUnion