cosmos / relayer-archive

An example of a server side IBC relayer to be used for Game of Zones and beyond
56 stars 31 forks source link

Empty packet data or ack fails signature verification #112

Open michaelfig opened 4 years ago

michaelfig commented 4 years ago

I observed that if I send a packet data or ack consisting of []byte{}, then the relayer cannot relay it. Sorry, but I don't have exact logs here.

This is consistent with an observation I made a while ago. Amino, and Proto3 both can't round-trip an empty slice.

type MyStruct struct {
  Data []byte
}

Marshalling and unmarshalling the following:

ms := MyStruct{
   Data: []byte{},
}

Results in:

MyStruct{
  Data: nil,
}

Special treatment is needed to accommodate these empty values (replacing nil slices with empty slices before signing and after deserialising before verifying).

I don't know if I'll get to this for a while, but I thought I'd at least put it on people's radar.

Thanks, Michael.