eudico icon indicating copy to clipboard operation
eudico copied to clipboard

Use cbor-gen for subnet checkpoints and signature interoperability

Open adlrocha opened this issue 3 years ago • 1 comments

The initial implementation of checkpoints uses IPLD bindone for its schema, advancing the potential requirement for subnet checkpoints to support IPLD selectors as a way to request specific data inside them,. This translated into a bunch of workaround in the implementation to make it work with the VM (mainly, hiding cids behind bytes so they are not looked up by the VM; use an NoPreviousCheck variable insntead of cid.Undef; and a some other of the like). This introduces some inefficiencies and leads to parts of the code being "less readable".

We don't expect the need of selectors for now, and instead of using IPLD, we could use cbor-gen as we do for actor's state. Unfortunately, this requires to have cids set (even if they are empty), and some other trade-offs and refactors. In this branch I started this work to see how easy was to replace from IPLD bindnode to cbor-gen in checkpoints. It still fails because some Cid is being set, the VM is trying to fetch it and it fails.

We are going to stick with IPLD for now, but this is a decision will have to make once we move the prototype into production: do we want checkpoints to use IPLD or we are OK with cbor-gen? Please, chime in if you have a strong opinion for or against, or additional context in the matter that can help us make a decision.

adlrocha avatar Jan 25 '22 09:01 adlrocha

The Rust implementation of SCA makes use of checkpoints. We definitely need to use CBOR-gen to ensure the serde compatibility between Rust and Go. Also, the data structures have been slightly modified and improved in the new implementation of SCA.

We'll also need to modify the signature protocol used to make it interoperable with Rust. The easiest way is to use a raw signature of the checkpoint with the wallet (check crypto primitives available for FVM).

adlrocha avatar Jul 01 '22 09:07 adlrocha