-
Notifications
You must be signed in to change notification settings - Fork 80
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
Serialise bigint as idiomatic Filecoin form #1516
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Without this it naively serialises using the underlying Rust BigInt representation: [sign,[data,data,...]]
rvagg
force-pushed
the
rvagg/verifreg-actor-event-bigint-ser
branch
from
February 8, 2024 11:06
a3df645
to
740507c
Compare
Well, that's really annoying. Ideally we'd:
|
Stebalien
approved these changes
Feb 8, 2024
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.
Code LGTM, but I didn't audit for other cases.
anorth
approved these changes
Feb 8, 2024
rjan90
pushed a commit
that referenced
this pull request
Feb 8, 2024
Without this it naively serialises using the underlying Rust BigInt representation: [sign,[data,data,...]]
rjan90
added a commit
that referenced
this pull request
Feb 8, 2024
* Make Prove{CommitSectors, ReplicaUpdates}3Params aggregate proof type optional (#1511) * Make Prove{CommitSectors, ReplicaUpdates}3Params aggregate proof type optional. * Enforce no agg proof type when not used * Serialise bigint as idiomatic Filecoin form (#1516) Without this it naively serialises using the underlying Rust BigInt representation: [sign,[data,data,...]] --------- Co-authored-by: Alex North <445306+anorth@users.noreply.github.com> Co-authored-by: Rod Vagg <rod@vagg.org>
rvagg
added a commit
to rvagg/FIPs
that referenced
this pull request
Feb 9, 2024
Came up in filecoin-project/builtin-actors#1516 because it's not obvious when doing doing serialisation that we have a bespoke bigint form that fits within the IPLD data model and is based off the Go representation. Letting a "bigint" pass through a system without special casing leads to surprise so I feel the call-out is warranted and hopefully a reminder for future events where we're going to be using these more.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Without this it naively serialises using the underlying Rust BigInt representation:
BigInts are going to be a footgun for these events, any time we encounter a
DataCap
,TokenAmount
or some otherBigInt
wrapper since we need this explicit serde callout. I'll follow up tomorrow with a PR to the FIP-0083 doc to add some clarification around what "bigint" means for serialising this field, then hopefully future FIP authors will take note of that.Example field value from this event without this fix:
8201821a4876e80017
which is[1,[1215752192,23]]
, or specifically:With this fix we get:
4600174876e800
, or:Which decodes with
github.com/filecoin-project/go-state-types/big.Big#UnmarshalCBOR
as what I fed in to it:100000000000
.