Uh oh!
There was an error while loading. Please reload this page.
fiber refactor block package for performance and simplified sync - #3324
Conversation
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The latest Buf updates on your PR. Results from workflow CI / buf-check (pull_request).
|
Claude finished @julienrbrt's task in 3m 39s —— View job Code Review: fiber refactor block package for performance and simplified syncTasks:
OverviewThis PR is a breaking, wire-incompatible refactor with clear goals documented in
The simplification is substantial and well-motivated. Below are issues found, from most to least critical. 🔴 Critical1. Signature verification uses re-marshalled bytes instead of raw blob bytes In // processBlobs: after UnmarshalBlockBlob returns *types.SignedHeaderpayload, err:=header.MarshalBinary()
ifvalid, err:=header.Signer.PubKey.Verify(payload, envelopeSig); ...But the signature was produced over The fix is to have funcUnmarshalBlockBlob(bz []byte) (*types.SignedHeader, []byte/*rawHeaderBz*/, *types.Data, []byte, error)2. Batching strategy size estimate excludes data — combined blobs will be larger than expected In totalSize:=uint64(0)
for_, marshalled:=rangemarshalledHeaders {
totalSize+=uint64(len(marshalled))
}
shouldSubmit:=s.batchingStrategy.ShouldSubmit(uint64(len(headers)), totalSize, ...)Blobs now contain header + data + signature. For blocks with large transaction payloads the actual blob can be many times larger than 🟡 Medium3. Double-marshalling of header per block in
// da_submitter.goheaderBz, err:=header.MarshalBinary() // call 1 — for signingenvelopeSig, err:=signer.Sign(ctx, headerBz)
blob, err:=common.MarshalBlockBlob(header, data, envelopeSig) // calls header.MarshalBinary() again inside// blob.go:MarshalBlockBlobheaderBz, err:=header.MarshalBinary() // call 2 — identical bytesPass funcMarshalBlockBlob(headerBz []byte, data*types.Data, envelopeSig []byte) ([]byte, error)This also resolves issue #1 naturally — the submitter already has 4. The dataNs:=cfg.DataNamespace// still used!Namespaces: [][]byte{cfg.Namespace, dataNs},Since all blobs now go to 5. In // lastSubmittedHeight tracks the last successfully submitted height for lazy cache invalidationlastSubmittedHeightatomic.Uint64// never written in new codeDefaultEnvelopeCacheSize=10_000// LRU cache was removedBoth constants/fields should be removed to avoid misleading future maintainers. 6. Tracing:
🟢 Low / Nit7.
8. Silent error in sig, _, sigErr:=readBlobField(bz, off, "signature")
ifsigErr==nil {
envelopeSig=sig
}A parse failure on the signature field is silently swallowed (returns empty sig). This means a blob with a truncated-but-present sig prefix decodes as "no signature" and falls through to "signature absent" handling rather than being rejected. Consider returning the error or logging it at debug level. 9. Old code only used 10. Test coverage reduced significantly The PR deletes Architecture Notes
|
Uh oh!
There was an error while loading. Please reload this page.
Overview