go-perun
go-perun copied to clipboard
Abstract wallet.Sig
Situation: The Sig type in the [wallet] package is an alias to []byte.
We have DecodeSig(io.Reader) Sig and VerifySig(msg, Sig, addr) functions.
Problem: While implementing the wallet interface for sr25519, the DecodeSig method was of no use, since i had to decode the signature in VerifySig a second time.
The sr25519 library comes with its own signature type, whereas go-perun (wrongly) assumes it to be just a []byte.
Possible solution: Change the Sig type to an abstract type with interface [pkg/io] Serializer.
Maybe also add a Clone() Sig method since we otherwise have to use the Serializer workaround for cloning..
Ran into a similar problem with the cosmwasm backend. While testing I realized that currently signature encoding is simply writing out the byte slice. My custom decoding method, which assumes a length-encoded byte sequence, was therefore not working. Currently, the way our abstraction works, it only allows for fixed length signatures.
Do you need this fixed in order to advance or did you find a work-around?
@matthiasgeihs