github.com/hyperledger/burrow@v0.34.5-0.20220512172541-77f09336001d/execution/registry/registry_test.go (about) 1 package registry 2 3 import ( 4 "testing" 5 6 "github.com/gogo/protobuf/proto" 7 "github.com/hyperledger/burrow/binary" 8 "github.com/hyperledger/burrow/crypto" 9 "github.com/stretchr/testify/assert" 10 "github.com/stretchr/testify/require" 11 ) 12 13 func TestEncodeProtobuf(t *testing.T) { 14 entry := &NodeIdentity{ 15 Moniker: "test", 16 TendermintNodeID: crypto.Address{}, 17 ValidatorPublicKey: &crypto.PublicKey{ 18 CurveType: crypto.CurveTypeEd25519, 19 PublicKey: binary.HexBytes{1, 2, 3, 4, 5}, 20 }, 21 NetworkAddress: "localhost", 22 } 23 encoded, err := proto.Marshal(entry) 24 require.NoError(t, err) 25 entryOut := new(NodeIdentity) 26 err = proto.Unmarshal(encoded, entryOut) 27 require.NoError(t, err) 28 assert.Equal(t, entry, entryOut) 29 }