filecoin-project / go-state-types

Primitive and low level types used in chain state and actor method parameters
Other
25 stars 35 forks source link

test: verifreg: add initial cbor encoding forms tests #263

Closed rvagg closed 1 month ago

rvagg commented 2 months ago

Since I was touching type changes in https://github.com/filecoin-project/go-state-types/pull/262 I thought I'd do an initial version of something I've proposed doing a more comprehensive form of: cbor encoding and round-trip testing of publicly exported types, which is particularly important for the types we pass through builtin-actors. So for now I'm just starting with ClaimAllocationsParams, and am following this up with a PR to builtin-actors with identical fixtures.

Ideally we'd expand this, perhaps slowly, to cover the full suite of types that pass through this barrier, and in the process provide fixtures for other implementations to test against as well.

The diagnostic output might be overkill, I can remove that if someone wants to object, I just like being absolutely clear.

rvagg commented 2 months ago

Rust version: https://github.com/filecoin-project/builtin-actors/pull/1538

rvagg commented 2 months ago

removed diagnostic output, the more I look at it the more wasteful it seems when we expand the number of these

rvagg commented 1 month ago

Regarding duplication - my theory here is that as we start to accumulate these, a pattern should emerge that can be extracted to make this simpler.

Perhaps reviving https://github.com/filecoin-project/test-vectors at some point for these would be good and then run the tests from both ends. For IPLD I set up this: https://github.com/ipld/codec-fixtures which runs a set of fixtures across the latest codec implementations of Go, JS and Rust each night and complains if there are problems. I think a similar pattern could work here, but I don't really want to dive in too deep right now.