Uh oh!
There was an error while loading. Please reload this page.
feat: DA client, remove interface part 1: copy subset of types needed for the client using blob rpc. - #2905
Conversation
The latest Buf updates on your PR. Results from workflow CI / buf-check (pull_request).
|
Claude finished @randygrok's task —— View job Code Review CompleteTasks
SummaryThis PR introduces a new ✅ Strengths
Issues & Recommendations🔴 Critical Issues1. Missing Test Coverage (pkg/blob/blob.go:140-159) The following functions have zero test coverage (contributing to the 18 missing lines reported by Codecov):
Recommendation: Add comprehensive tests: funcTestSplitID_EdgeCases(t*testing.T) {
tests:= []struct {
namestringid []bytewantHeightuint64wantComCommitment
}{
{"empty", []byte{}, 0, nil},
{"exactly 8 bytes", make([]byte, 8), 0, nil},
{"less than 8 bytes", []byte{1, 2, 3}, 0, nil},
{"valid id", MakeID(100, []byte{0xaa, 0xbb}), 100, []byte{0xaa, 0xbb}},
}
for_, tt:=rangetests {
t.Run(tt.name, func(t*testing.T) {
height, com:=SplitID(tt.id)
require.Equal(t, tt.wantHeight, height)
require.Equal(t, tt.wantCom, com)
})
}
}
funcTestBlob_EqualCommitment(t*testing.T) {
blob, _:=NewBlobV0(libshare.MustNewV0Namespace([]byte("test")), []byte("data"))
require.True(t, blob.EqualCommitment(blob.Commitment))
require.False(t, blob.EqualCommitment([]byte{0x00}))
require.False(t, blob.EqualCommitment(nil))
}2. UnmarshalJSON Error Handling (pkg/blob/blob.go:119-136) The iferr:=json.Unmarshal(data, &jb); err!=nil {
returnerr// ❌ No context
}Recommendation: Add context to all error returns: iferr:=json.Unmarshal(data, &jb); err!=nil {
returnfmt.Errorf("unmarshal blob JSON: %w", err)
}
ns, err:=libshare.NewNamespaceFromBytes(jb.Namespace)
iferr!=nil {
returnfmt.Errorf("parse namespace: %w", err)
}
blob, err:=NewBlob(jb.ShareVersion, ns, jb.Data, jb.Signer)
iferr!=nil {
returnfmt.Errorf("reconstruct blob: %w", err)
}🟡 Medium Priority Issues3. Missing Validation in MakeID (pkg/blob/blob.go:140-145)
Recommendation: Add validation: funcMakeID(heightuint64, commitmentCommitment) []byte {
iflen(commitment) ==0 {
// Return empty ID or panic depending on desired behaviorreturnnil
}
id:=make([]byte, 8+len(commitment))
binary.LittleEndian.PutUint64(id, height)
copy(id[8:], commitment)
returnid
}4. Inconsistent Index Handling (pkg/blob/blob.go:42-43, 71, 82) The Recommendation:
5. Missing Tests for submit_options.go The
Recommendation: Add a test: funcTestSubmitOptions_JSON(t*testing.T) {
opts:=&SubmitOptions{
GasPrice: 0.5,
IsGasPriceSet: true,
TxPriority: TxPriorityHigh,
KeyName: "mykey",
}
data, err:=json.Marshal(opts)
require.NoError(t, err)
vardecodedSubmitOptionsrequire.NoError(t, json.Unmarshal(data, &decoded))
require.Equal(t, opts, &decoded)
}🟢 Minor Improvements6. Code Organization (pkg/blob/blob.go:20-32) Consider grouping related constants and types: const (
// DefaultMaxBlobSize is the default maximum blob size used by celestia-app (32 MiB).DefaultMaxBlobSize=32*1_048_576// bytes// subtreeRootThreshold is copied from celestia-app/v6 appconsts.SubtreeRootThreshold.subtreeRootThreshold=64// UnknownIndex indicates the blob's share index is not yet knownUnknownIndex=-1
)
type (
// Commitment is the Merkle subtree commitment for a blob.Commitment []byte// Proof is a set of NMT proofs used to verify a blob inclusion.Proof []*nmt.Proof
)7. Potential Performance Issue (pkg/blob/blob.go:97-103)
8. Documentation Enhancement (pkg/blob/README.md:14-18) The sync guidance is helpful but could be more actionable: ## Keeping it in sync- When celestia-node changes blob JSON or tx config fields, update this package manually.
-**Recommended**: Set up a CI job that:
1. Clones celestia-node at the tracked version (currently v0.28.4)
2. Runs structural diffs on key types
3. Alerts on schema changes
Example commands:
\`\`\`bash
diff -u pkg/blob/blob.go <(curl -s https://raw.githubusercontent.com/celestiaorg/celestia-node/v0.28.4/blob/blob.go)
\`\`\`9. Missing Package Documentation (pkg/blob/blob.go:1) Add a package-level comment: // Package blob provides a minimal, JSON-compatible subset of celestia-node's// blob types without requiring Cosmos SDK dependencies. This package is// intentionally a trimmed copy to maintain wire compatibility with celestia-node's// blob RPC service. See README.md for sync guidance.package blobSecurity & Resilience✅ No security concerns identified:
✅ Resilience considerations:
Performance & Resource Efficiency✅ Generally efficient:
Testing QualityCurrent coverage: 73.52% (68 lines added, 18 missing coverage) Missing coverage areas:
Recommendation: Achieve >90% coverage by addressing Critical Issue #1 and Medium Issue #5. Architecture & Module Design✅ Excellent alignment with project goals:
✅ Future-proofing:
Action ItemsBefore Merge
Post-Merge (Technical Debt)
ConclusionThis is a solid PR that achieves its goal of providing minimal blob types without heavy dependencies. The main gap is test coverage—addressing the critical testing issues will bring this from good to excellent. The architecture decision to copy types is well-justified and properly documented. Recommendation: ✅ Approve with requested changes (fix test coverage and error wrapping before merge) |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@## main #2905 +/- ##
==========================================
- Coverage 65.60% 65.50% -0.10%
==========================================
Files 85 86 +1 Lines 7838 7906 +68 ==========================================
+ Hits 5142 5179 +37 - Misses 2139 2162 +23 - Partials 557 565 +8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| ## Keeping it in sync | ||
| - When celestia-node changes blob JSON or tx config fields, update this package manually: | ||
| 1. `diff -u pkg/blob/blob.go ../Celestia/celestia-node/blob/blob.go` |
There was a problem hiding this comment.
should we do a monthly check on this in ci? fetch latest release and diff?
There was a problem hiding this comment.
I will add some mechanism on the last PR
tac0turtle
left a comment
There was a problem hiding this comment.
thanks for separating thr prs, its much easier to grok. Should we do some ci magic to verify the diff or you think its fine?
randygrok
commented
Dec 4, 2025
I will do some last checkings on the last PR, some mechanism to keep track if something changes. |
Uh oh!
There was an error while loading. Please reload this page.
* main: refactor(sequencers): persist prepended batch (#2907) feat(evm): add force inclusion command (#2888) feat: DA client, remove interface part 1: copy subset of types needed for the client using blob rpc. (#2905) feat: forced inclusion (#2797) fix: fix and cleanup metrics (sequencers + block) (#2904) build(deps): Bump mdast-util-to-hast from 13.2.0 to 13.2.1 in /docs in the npm_and_yarn group across 1 directory (#2900) refactor(block): centralize timeout in client (#2903) build(deps): Bump the all-go group across 2 directories with 3 updates (#2898) chore: bump default timeout (#2902) fix: revert default db (#2897) refactor: remove obsolete // +build tag (#2899) fix:da visualiser namespace (#2895)
Parent Epic: #2796
Overview