-
Notifications
You must be signed in to change notification settings - Fork 38
feat: cbor encoding of all referenced param & return types #397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #397 +/- ##
==========================================
- Coverage 3.60% 3.59% -0.01%
==========================================
Files 733 734 +1
Lines 199998 201729 +1731
==========================================
+ Hits 7212 7256 +44
- Misses 190519 192199 +1680
- Partials 2267 2274 +7
🚀 New features to boost your workflow:
|
6b614a4
to
f911c55
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds CBOR serialization support for several method parameter and return types across the builtin
actor versions, converts some miner result aliases into transparent structs for encoding, and introduces nullable uint64
helpers with tests.
- Include
cron.ConstructorParams
in CBOR code generation for all referenced versions. - Replace
SectorContentChanged*
slice aliases with transparent structs and generate their CBOR methods. - Add
marshalNullableUint64
/unmarshalNullableUint64
helpers and unit tests inabi/
.
Reviewed Changes
Copilot reviewed 32 out of 32 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
builtin/v{8–17}/gen/gen.go | Added cron.ConstructorParams to the CBOR generation list for each version. |
builtin/v{8–17}/cron/cbor_gen.go | Generated MarshalCBOR /UnmarshalCBOR for cron.ConstructorParams . |
builtin/v{14–17}/miner/miner_types.go | Changed SectorContentChanged* aliases into transparent structs for CBOR. |
builtin/v{14–17}/miner/cbor_gen.go | Generated CBOR methods for the new SectorContentChanged* types. |
abi/cbor_uint_types.go | Introduced nullable uint64 marshal/unmarshal helpers. |
abi/cbor_test.go | Added tests covering nullable uint64 serialization edge cases. |
Comments suppressed due to low confidence (2)
builtin/v17/miner/miner_types.go:472
- Changing
SectorContentChangedParams
from a slice alias to a struct alters the public type and breaks backward compatibility. Consider layering a new struct alias or providing conversion helpers to preserve the original slice-based API.
type SectorContentChangedParams struct {
abi/cbor_uint_types.go:11
- No unit tests cover
marshalNullableUint64
andunmarshalNullableUint64
for both nil and non-nil cases. Add tests to ensure correct encoding ofnull
vs. actual values and error paths.
func marshalNullableUint64(w io.Writer, v *uint64) error {
OK, this fails because the codegen for my simple func (t *PieceReturn) MarshalCBOR(w io.Writer) error {
cw := cbg.NewCborWriter(w)
// t.Accepted (bool) (bool)
if err := cbg.WriteBool(w, t.Accepted); err != nil {
return err
}
return nil
} So that's a cbor-gen fix unfortunately. |
I've added a tmp commit to get it to at least compile and not complain, that'll need to be undone with a proper gen though |
Closes: #396
SectorContentChanged
is a little odd to include here, but it's referenced as in the market methods and uses the miner types for the call, which makes sense, but you don't typically even see it. Maybe if you were decoding internal calls between actors, or were doing some testing of a smart contract that uses it.The *uint64 ones are because we have some methods that use them,
GetSectorSizeExported
andGetDealSectorExported
. We don't really need the nullability, however, but we declare them as pointers in methods.go so we'll just be complete here.