-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
fix: support Forrest parity testing for F3 participation APIs #12615
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
For parity testing, Forest nodes need to decode an F3 participation ticket that is issued by Lotus. Lotus so happens to use CBOR to encode tickets, which it then decodes to issue a lease. The lease issuer is of type `peer.ID` which is an alias of type `string` that may contain non UTF-8 characters. If this type is used directly in CBOR encoding then it gets encoded as string, which works fine in Golang but not Rust, which in turn results in decoding issues in Forest. To avoid this use `[]byte` as the type to encode the issuer public key. In Lotus, the value will be the binary marshalling of `peer.ID` that issued the ticket. While at it, also fix two issues that were brought up during discussion: * A miner must not be able to ask for a ticket to participate in zero instances. Validate and return error if instances is set to zero. * Use CBOR tuple encoding for a slightly better efficient wire encoding of ticket. `cborgen.Write*` APIs explicitly create a given file; hence the need to separate the file to which tuple kinds are generated since the existing encoding for types in `api/cbor_gen.go` use maps.
Stebalien
reviewed
Oct 18, 2024
e208e68
to
3939292
Compare
3939292
to
b7bd37e
Compare
Kubuxu
approved these changes
Oct 18, 2024
44 tasks
rjan90
pushed a commit
that referenced
this pull request
Oct 24, 2024
* Support Forrest parity testing for F3 participation APIs For parity testing, Forest nodes need to decode an F3 participation ticket that is issued by Lotus. Lotus so happens to use CBOR to encode tickets, which it then decodes to issue a lease. The lease issuer is of type `peer.ID` which is an alias of type `string` that may contain non UTF-8 characters. If this type is used directly in CBOR encoding then it gets encoded as string, which works fine in Golang but not Rust, which in turn results in decoding issues in Forest. To avoid this use `[]byte` as the type to encode the issuer public key. In Lotus, the value will be the binary marshalling of `peer.ID` that issued the ticket. While at it, also fix two issues that were brought up during discussion: * A miner must not be able to ask for a ticket to participate in zero instances. Validate and return error if instances is set to zero. * Use CBOR tuple encoding for a slightly better efficient wire encoding of ticket. `cborgen.Write*` APIs explicitly create a given file; hence the need to separate the file to which tuple kinds are generated since the existing encoding for types in `api/cbor_gen.go` use maps.
21 tasks
rjan90
pushed a commit
that referenced
this pull request
Oct 28, 2024
* Support Forrest parity testing for F3 participation APIs For parity testing, Forest nodes need to decode an F3 participation ticket that is issued by Lotus. Lotus so happens to use CBOR to encode tickets, which it then decodes to issue a lease. The lease issuer is of type `peer.ID` which is an alias of type `string` that may contain non UTF-8 characters. If this type is used directly in CBOR encoding then it gets encoded as string, which works fine in Golang but not Rust, which in turn results in decoding issues in Forest. To avoid this use `[]byte` as the type to encode the issuer public key. In Lotus, the value will be the binary marshalling of `peer.ID` that issued the ticket. While at it, also fix two issues that were brought up during discussion: * A miner must not be able to ask for a ticket to participate in zero instances. Validate and return error if instances is set to zero. * Use CBOR tuple encoding for a slightly better efficient wire encoding of ticket. `cborgen.Write*` APIs explicitly create a given file; hence the need to separate the file to which tuple kinds are generated since the existing encoding for types in `api/cbor_gen.go` use maps.
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.
Related Issues
Proposed Changes
For parity testing, Forest nodes need to decode an F3 participation ticket that is issued by Lotus. Lotus so happens to use CBOR to encode tickets, which it then decodes to issue a lease.
The lease issuer is of type
peer.ID
which is an alias of typestring
that may contain non UTF-8 characters. If this type is used directly in CBOR encoding then it gets encoded as string, which works fine in Golang but not Rust, which in turn results in decoding issues in Forest.To avoid this use
[]byte
as the type to encode the issuer public key. In Lotus, the value will be the binary marshalling ofpeer.ID
that issued the ticket.While at it, also fix two issues that were brought up during discussion:
A miner must not be able to ask for a ticket to participate in zero instances. Validate and return error if instances is set to zero.
Use CBOR tuple encoding for a slightly better efficient wire encoding of ticket.
cborgen.Write*
APIs explicitly create a given file; hence the need to separate the file to which tuple kinds are generated since the existing encoding for types inapi/cbor_gen.go
use maps.Additional Info
Checklist
Before you mark the PR ready for review, please make sure that: