Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: support Forrest parity testing for F3 participation APIs (#12615)
* 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.
- Loading branch information