flow.NewPayload to reject nil elements in Guarantees, Seals etc - #8667
flow.NewPayload to reject nil elements in Guarantees, Seals etc#8667zhangchiqing wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthrough
ChangesPayload validation
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: 🔵 Low · up to The PR correctly rejects nil elements in payload collections, but the new validation should report expected invalid input through ordinary constructor errors rather than an unrecoverable failure path. The change is otherwise localized and mergeable with explicit owner follow-up. Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 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 |
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
…ceipts, and Results slices
22d8939 to
6533e6f
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Problem
flow.NewPayload(model/flow/payload.go) validates onlyProtocolStateIDbut does not check the elements of theGuarantees,Seals,Receipts, andResultsslices fornil. A CBOR-decoded block payload with anullarray element yields anilpointer that passes construction and propagates into a trusted*flow.Payload.Fix
Added nil-element validation for all four slices in
NewPayload, mirroring the existing pattern inNewCollection. SinceNewProposalcallsNewBlock, which callsNewPayload, fixing the constructor covers all ingestion paths.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by CodeRabbit