go-perun icon indicating copy to clipboard operation
go-perun copied to clipboard

Abstract wallet.Sig

Open ggwpez opened this issue 4 years ago • 2 comments

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..

ggwpez avatar Aug 30 '21 10:08 ggwpez

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.

matthiasgeihs avatar Aug 30 '21 16:08 matthiasgeihs

Do you need this fixed in order to advance or did you find a work-around?
@matthiasgeihs

ggwpez avatar Aug 31 '21 10:08 ggwpez