coinbase / mesh-sdk-go

Mesh Client Go SDK
Apache License 2.0
196 stars 135 forks source link

Pallas signer stake delegation #457

Closed ylecornec closed 1 year ago

ylecornec commented 1 year ago

Motivation

The following PR updates the pallas signer used for mina.

This was tested by running the construction tests on the mina rosetta server with both payment and delegation transactions.

Solution

Delegation transactions

The Transaction type could already handle various types of transaction and distinguish between them using the Tag field. {false, false, false} is the first case (payments) and {false,false,true} the second one (stake delegation). However the parsing step in signer_pallas.go could only handle Payment transaction so far so I added the StakeDelelegation case.

The valid_until field

If the valid_until field is not specified in the preprocess step, the rosetta server uses the greatest uint32 as a default value. The pallas signer of rosetta-sdk-go was defaulting to zero when building the signing payload which resulted in an invalid signature error. The greatest uint32 is now used in both cases.

ylecornec commented 1 year ago

The tests should now be fixed (make test succeeds locally) and I added delegation versions of existing payment tests.

ylecornec commented 1 year ago

Closing in favor of #464