fix: support Forrest parity testing for F3 participation APIs #12615
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: