From 7883f0797b82ea1517034346f9b7798814b5f97d Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Thu, 16 Nov 2023 10:01:33 -0500 Subject: [PATCH] Pull out my changes in one commit so you can merge to dev branch --- pkg/codec/map_decoder.go | 246 ----- pkg/codec/map_decoder_test.go | 272 ------ pkg/codec/utils.go | 13 - pkg/codec/utils_test.go | 29 - pkg/loop/internal/chain_reader.go | 132 +-- pkg/loop/internal/chain_reader_test.go | 168 +--- pkg/loop/internal/pb/relayer.pb.go | 908 +++++------------- pkg/loop/internal/pb/relayer.proto | 32 - pkg/loop/internal/pb/relayer_grpc.pb.go | 111 --- pkg/types/chain_reader.go | 19 - pkg/types/codec.go | 39 - pkg/types/interfacetests/README.md | 3 - .../chain_reader_interface_tests.go | 162 ++++ .../interfacetests/codec_interface_tests.go | 377 -------- pkg/types/map_decoder.go | 13 - 15 files changed, 415 insertions(+), 2109 deletions(-) delete mode 100644 pkg/codec/map_decoder.go delete mode 100644 pkg/codec/map_decoder_test.go delete mode 100644 pkg/codec/utils.go delete mode 100644 pkg/codec/utils_test.go delete mode 100644 pkg/types/codec.go delete mode 100644 pkg/types/interfacetests/README.md create mode 100644 pkg/types/interfacetests/chain_reader_interface_tests.go delete mode 100644 pkg/types/interfacetests/codec_interface_tests.go delete mode 100644 pkg/types/map_decoder.go diff --git a/pkg/codec/map_decoder.go b/pkg/codec/map_decoder.go deleted file mode 100644 index 19331de76..000000000 --- a/pkg/codec/map_decoder.go +++ /dev/null @@ -1,246 +0,0 @@ -package codec - -import ( - "context" - "errors" - "math/big" - "reflect" - "strconv" - - "github.com/mitchellh/mapstructure" - - "github.com/smartcontractkit/chainlink-relay/pkg/types" -) - -func DecoderFromMapDecoder(decoder types.MapDecoder, extraHooks ...mapstructure.DecodeHookFunc) (types.Decoder, error) { - if decoder == nil { - return nil, errors.New("decoder must not be nil") - } - - numExtraHooks := len(extraHooks) - hooks := make([]mapstructure.DecodeHookFunc, numExtraHooks+2) - copy(hooks, extraHooks) - hooks[numExtraHooks] = SliceToArrayVerifySizeHook - hooks[numExtraHooks+1] = BigIntHook - return &mapDecoder{decoder: decoder, hooks: hooks}, nil -} - -type mapDecoder struct { - decoder types.MapDecoder - hooks []mapstructure.DecodeHookFunc -} - -func (m *mapDecoder) GetMaxDecodingSize(ctx context.Context, n int, itemType string) (int, error) { - return m.decoder.GetMaxDecodingSize(ctx, n, itemType) -} - -func (m *mapDecoder) Decode(ctx context.Context, raw []byte, into any, itemType string) error { - rInto := reflect.ValueOf(into) - if rInto.Kind() != reflect.Pointer { - return types.InvalidTypeError{} - } - - elm := reflect.Indirect(rInto) - switch elm.Kind() { - case reflect.Array: - return m.decodeMultiple(ctx, raw, arrayProvider(elm), itemType) - case reflect.Slice: - return m.decodeMultiple(ctx, raw, sliceProvider(elm), itemType) - default: - rawMap, err := m.decoder.DecodeSingle(ctx, raw, itemType) - if err != nil { - return err - } - return m.mapToItem(rawMap, into) - } -} - -// VerifyFieldMaps is a utility for verifying the keys exactly match the fields -// it is not done in Decode directly as it can often be more efficiently by MapDecoders -// in the case of DecodeMany -func VerifyFieldMaps(fields []string, result map[string]any) error { - for _, field := range fields { - if _, ok := result[field]; !ok { - return types.InvalidEncodingError{} - } - } - - if len(fields) != len(result) { - return types.InvalidEncodingError{} - } - - return nil -} - -func arrayProvider(rInto reflect.Value) func(size int) (reflect.Value, error) { - return func(size int) (reflect.Value, error) { - if rInto.Len() != size { - return reflect.Value{}, types.WrongNumberOfElements{} - } - return rInto, nil - } -} - -func sliceProvider(rInto reflect.Value) func(size int) (reflect.Value, error) { - return func(size int) (reflect.Value, error) { - element := reflect.MakeSlice(rInto.Type(), size, size) - rInto.Set(element) - return rInto, nil - } -} - -func (m *mapDecoder) decodeMultiple(ctx context.Context, raw []byte, init func(size int) (reflect.Value, error), itemType string) error { - decoded, err := m.decoder.DecodeMany(ctx, raw, itemType) - if err != nil { - return err - } - - rInto, err := init(len(decoded)) - if err != nil { - return err - } - - for i, singleDecode := range decoded { - if err = m.mapToItem(singleDecode, rInto.Index(i).Addr().Interface()); err != nil { - return err - } - } - - return nil -} - -func BigIntHook(_, to reflect.Type, data any) (any, error) { - if to == reflect.TypeOf(&big.Int{}) { - bigInt := big.NewInt(0) - - switch v := data.(type) { - case float64: - bigInt.SetInt64(int64(v)) - case float32: - bigInt.SetInt64(int64(v)) - case int: - bigInt.SetInt64(int64(v)) - case int8: - bigInt.SetInt64(int64(v)) - case int16: - bigInt.SetInt64(int64(v)) - case int32: - bigInt.SetInt64(int64(v)) - case int64: - bigInt.SetInt64(v) - case uint: - bigInt.SetUint64(uint64(v)) - case uint8: - bigInt.SetUint64(uint64(v)) - case uint16: - bigInt.SetUint64(uint64(v)) - case uint32: - bigInt.SetUint64(uint64(v)) - case uint64: - bigInt.SetUint64(v) - case string: - _, ok := bigInt.SetString(v, 10) - if !ok { - return nil, types.InvalidTypeError{} - } - default: - return data, nil - } - - return bigInt, nil - } - - if bi, ok := data.(*big.Int); ok { - switch to { - case reflect.TypeOf(0): - if FitsInNBitsSigned(strconv.IntSize, bi) { - return int(bi.Int64()), nil - } - return nil, types.InvalidTypeError{} - case reflect.TypeOf(int8(0)): - if FitsInNBitsSigned(8, bi) { - return int8(bi.Int64()), nil - } - return nil, types.InvalidTypeError{} - case reflect.TypeOf(int16(0)): - if FitsInNBitsSigned(16, bi) { - return int16(bi.Int64()), nil - } - return nil, types.InvalidTypeError{} - case reflect.TypeOf(int32(0)): - if FitsInNBitsSigned(32, bi) { - return int32(bi.Int64()), nil - } - return nil, types.InvalidTypeError{} - case reflect.TypeOf(int64(0)): - if FitsInNBitsSigned(64, bi) { - return bi.Int64(), nil - } - return nil, types.InvalidTypeError{} - case reflect.TypeOf(uint(0)): - if bi.Sign() >= 0 && bi.BitLen() <= strconv.IntSize { - return uint(bi.Uint64()), nil - } - return nil, types.InvalidTypeError{} - case reflect.TypeOf(uint8(0)): - if bi.Sign() >= 0 && bi.BitLen() <= 8 { - return uint8(bi.Uint64()), nil - } - return nil, types.InvalidTypeError{} - case reflect.TypeOf(uint16(0)): - if bi.Sign() >= 0 && bi.BitLen() <= 16 { - return uint16(bi.Uint64()), nil - } - return nil, types.InvalidTypeError{} - case reflect.TypeOf(uint32(0)): - if bi.Sign() >= 0 && bi.BitLen() <= 32 { - return uint32(bi.Uint64()), nil - } - return nil, types.InvalidTypeError{} - case reflect.TypeOf(uint64(0)): - if bi.Sign() >= 0 && bi.BitLen() <= 64 { - return bi.Uint64(), nil - } - return nil, types.InvalidTypeError{} - case reflect.TypeOf(""): - return bi.String(), nil - default: - return data, nil - } - } - - return data, nil -} - -func SliceToArrayVerifySizeHook(from reflect.Type, to reflect.Type, data any) (any, error) { - // By default, if the array is bigger it'll still work. (ie []int{1, 2, 3} => [4]int{} works with 0 at the end - // [2]int{} would not work. This seems to lenient, but can be discussed. - if from.Kind() == reflect.Slice && to.Kind() == reflect.Array { - slice := reflect.ValueOf(data) - if slice.Len() != to.Len() { - return nil, types.WrongNumberOfElements{} - } - } - - return data, nil -} - -func (m *mapDecoder) mapToItem(rawMap map[string]any, into any) error { - md := &mapstructure.Metadata{} - decoder, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{ - // TODO add hook to verify number sizes. mapstructure seems to check -ve values for unsigned, but not other boundaries - DecodeHook: mapstructure.ComposeDecodeHookFunc(m.hooks...), - Metadata: md, - Result: into, - }) - - if err != nil { - return types.InvalidTypeError{} - } - - if err = decoder.Decode(rawMap); err != nil { - return types.InvalidTypeError{} - } - - return nil -} diff --git a/pkg/codec/map_decoder_test.go b/pkg/codec/map_decoder_test.go deleted file mode 100644 index 4a01e3144..000000000 --- a/pkg/codec/map_decoder_test.go +++ /dev/null @@ -1,272 +0,0 @@ -package codec_test - -import ( - "context" - "fmt" - "math" - "math/big" - "reflect" - "strconv" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/smartcontractkit/chainlink-relay/pkg/codec" - "github.com/smartcontractkit/chainlink-relay/pkg/types" -) - -const ( - anyItemTypeForMapDecoder = "anything" - anyNElementsForMapDecoder = 10 - anyDecodingSizeForMapDecoder = 200 -) - -var anyRawBytes = []byte("raw") - -func TestMapDecoder(t *testing.T) { - t.Parallel() - t.Run("Decode works on a single item", func(t *testing.T) { - item := &mapTestType{} - field1 := "Field1" - anyValue1 := "value1" - field2 := "Field2" - anyValue2 := 122 - anySingleResult := map[string]any{field1: anyValue1, field2: anyValue2} - tmd := &testMapDecoder{resultSingle: anySingleResult} - decoder, err := codec.DecoderFromMapDecoder(tmd) - assert.NoError(t, err) - - err = decoder.Decode(context.Background(), anyRawBytes, item, anyItemTypeForMapDecoder) - - assert.NoError(t, err) - assert.Equal(t, anyValue1, item.Field1) - assert.Equal(t, anyValue2, item.Field2) - assertTestMapDecoder(t, tmd) - }) - - t.Run("Decode works on a slice", func(t *testing.T) { runSliceArrayDecodeTest(t, &[]mapTestType{}) }) - - t.Run("Decode works on an array", func(t *testing.T) { runSliceArrayDecodeTest(t, &[2]mapTestType{}) }) - - t.Run("Decode returns an error if the type is not a pointer", func(t *testing.T) { - item := mapTestType{} - field1 := "Field1" - anyValue1 := "value1" - field2 := "Field2" - anyValue2 := 13 - anySingleResult := map[string]any{field1: anyValue1, field2: anyValue2} - tmd := &testMapDecoder{resultSingle: anySingleResult} - decoder, err := codec.DecoderFromMapDecoder(tmd) - assert.NoError(t, err) - - err = decoder.Decode(context.Background(), anyRawBytes, item, anyItemTypeForMapDecoder) - - assert.IsType(t, types.InvalidTypeError{}, err) - }) - - t.Run("Decode returns an error if map is too big for an array", func(t *testing.T) { - testWrongArraySize(t, &[3]mapTestType{}) - }) - - t.Run("Decode returns an error if map is too small for an array", func(t *testing.T) { - testWrongArraySize(t, &[1]mapTestType{}) - }) - - t.Run("Decode returns an error for nil argument", func(t *testing.T) { - _, err := codec.DecoderFromMapDecoder(nil) - assert.Error(t, err) - }) - - t.Run("GetMaxDecodingSize delegates", func(t *testing.T) { - tmd := &testMapDecoder{} - decoder, err := codec.DecoderFromMapDecoder(tmd) - require.NoError(t, err) - - maxSize, err := decoder.GetMaxDecodingSize(context.Background(), anyNElementsForMapDecoder, anyItemTypeForMapDecoder) - assert.NoError(t, err) - assert.Equal(t, anyDecodingSizeForMapDecoder, maxSize) - }) -} - -func TestVerifyFieldMaps(t *testing.T) { - t.Parallel() - anyKey1 := "anything" - anyKey2 := "different" - input := map[string]any{ - anyKey1: 1, - anyKey2: 2, - } - t.Run("returns nil if fields match", func(t *testing.T) { - assert.NoError(t, codec.VerifyFieldMaps([]string{anyKey1, anyKey2}, input)) - }) - - t.Run("returns error if field is missing", func(t *testing.T) { - assert.IsType(t, types.InvalidEncodingError{}, codec.VerifyFieldMaps([]string{anyKey1, anyKey2, "missing"}, input)) - }) - - t.Run("returns error for extra key", func(t *testing.T) { - assert.IsType(t, types.InvalidEncodingError{}, codec.VerifyFieldMaps([]string{anyKey1}, input)) - }) - - t.Run("returns error if keys do not match", func(t *testing.T) { - assert.IsType(t, types.InvalidEncodingError{}, codec.VerifyFieldMaps([]string{anyKey1, "new key"}, input)) - }) -} - -func TestBigIntHook(t *testing.T) { - intTypes := []struct { - Type reflect.Type - Max *big.Int - Min *big.Int - }{ - {Type: reflect.TypeOf(0), Min: big.NewInt(math.MinInt), Max: big.NewInt(math.MaxInt)}, - {Type: reflect.TypeOf(uint(0)), Min: big.NewInt(0), Max: new(big.Int).SetUint64(math.MaxUint)}, - {Type: reflect.TypeOf(int8(0)), Min: big.NewInt(math.MinInt8), Max: big.NewInt(math.MaxInt8)}, - {Type: reflect.TypeOf(uint8(0)), Min: big.NewInt(0), Max: new(big.Int).SetUint64(math.MaxUint8)}, - {Type: reflect.TypeOf(int16(0)), Min: big.NewInt(math.MinInt16), Max: big.NewInt(math.MaxInt16)}, - {Type: reflect.TypeOf(uint16(0)), Min: big.NewInt(0), Max: new(big.Int).SetUint64(math.MaxUint16)}, - {Type: reflect.TypeOf(int32(0)), Min: big.NewInt(math.MinInt32), Max: big.NewInt(math.MaxInt32)}, - {Type: reflect.TypeOf(uint32(0)), Min: big.NewInt(0), Max: new(big.Int).SetUint64(math.MaxUint32)}, - {Type: reflect.TypeOf(int64(0)), Min: big.NewInt(math.MinInt64), Max: big.NewInt(math.MaxInt64)}, - {Type: reflect.TypeOf(uint64(0)), Min: big.NewInt(0), Max: new(big.Int).SetUint64(math.MaxUint64)}, - } - for _, intType := range intTypes { - t.Run(fmt.Sprintf("Fits conversion %v", intType.Type), func(t *testing.T) { - anyValidNumber := big.NewInt(5) - result, err := codec.BigIntHook(reflect.TypeOf((*big.Int)(nil)), intType.Type, anyValidNumber) - require.NoError(t, err) - require.IsType(t, reflect.New(intType.Type).Elem().Interface(), result) - if intType.Min.Cmp(big.NewInt(0)) == 0 { - u64 := reflect.ValueOf(result).Convert(reflect.TypeOf(uint64(0))).Interface().(uint64) - actual := new(big.Int).SetUint64(u64) - require.Equal(t, anyValidNumber, actual) - } else { - i64 := reflect.ValueOf(result).Convert(reflect.TypeOf(int64(0))).Interface().(int64) - actual := big.NewInt(i64) - require.Equal(t, 0, anyValidNumber.Cmp(actual)) - } - }) - - t.Run("Overflow return an error "+intType.Type.String(), func(t *testing.T) { - bigger := new(big.Int).Add(intType.Max, big.NewInt(1)) - _, err := codec.BigIntHook(reflect.TypeOf((*big.Int)(nil)), intType.Type, bigger) - assert.IsType(t, types.InvalidTypeError{}, err) - }) - - t.Run("Underflow return an error "+intType.Type.String(), func(t *testing.T) { - smaller := new(big.Int).Sub(intType.Min, big.NewInt(1)) - _, err := codec.BigIntHook(reflect.TypeOf((*big.Int)(nil)), intType.Type, smaller) - assert.IsType(t, types.InvalidTypeError{}, err) - }) - - t.Run("Converts from "+intType.Type.String(), func(t *testing.T) { - anyValidNumber := int64(5) - asType := reflect.ValueOf(anyValidNumber).Convert(intType.Type).Interface() - result, err := codec.BigIntHook(intType.Type, reflect.TypeOf((*big.Int)(nil)), asType) - require.NoError(t, err) - bi, ok := result.(*big.Int) - require.True(t, ok) - assert.Equal(t, anyValidNumber, bi.Int64()) - }) - } - - t.Run("Converts from string", func(t *testing.T) { - anyNumber := int64(5) - result, err := codec.BigIntHook(reflect.TypeOf(""), reflect.TypeOf((*big.Int)(nil)), strconv.FormatInt(anyNumber, 10)) - require.NoError(t, err) - bi, ok := result.(*big.Int) - require.True(t, ok) - assert.Equal(t, anyNumber, bi.Int64()) - }) - - t.Run("Converts to string", func(t *testing.T) { - anyNumber := int64(5) - result, err := codec.BigIntHook(reflect.TypeOf((*big.Int)(nil)), reflect.TypeOf(""), big.NewInt(anyNumber)) - require.NoError(t, err) - assert.Equal(t, strconv.FormatInt(anyNumber, 10), result) - }) - - t.Run("Errors for invalid string", func(t *testing.T) { - _, err := codec.BigIntHook(reflect.TypeOf(""), reflect.TypeOf((*big.Int)(nil)), "Not a number :(") - require.IsType(t, types.InvalidTypeError{}, err) - }) -} - -func runSliceArrayDecodeTest(t *testing.T, item any) { - field1 := "Field1" - anyValue11 := "value1" - anyValue12 := "value12" - field2 := "Field2" - anyValue21 := 23 - anyValue22 := 33 - anyManyResult := []map[string]any{ - {field1: anyValue11, field2: anyValue21}, - {field1: anyValue12, field2: anyValue22}, - } - // template is being used to provide the types - tmd := &testMapDecoder{resultMany: anyManyResult} - decoder, err := codec.DecoderFromMapDecoder(tmd) - assert.NoError(t, err) - - err = decoder.Decode(context.Background(), anyRawBytes, item, anyItemTypeForMapDecoder) - assert.NoError(t, err) - - rItem := reflect.ValueOf(item).Elem() - assert.Equal(t, 2, rItem.Len()) - assert.Equal(t, mapTestType{Field1: anyValue11, Field2: anyValue21}, rItem.Index(0).Interface()) - assert.Equal(t, mapTestType{Field1: anyValue12, Field2: anyValue22}, rItem.Index(1).Interface()) -} - -func testWrongArraySize(t *testing.T, item any) { - field1 := "Field1" - anyValue1 := "value1" - field2 := "Field2" - anyValue2 := "value2" - anyManyResult := []map[string]any{ - {field1: anyValue1, field2: anyValue2}, - {field1: anyValue2, field2: anyValue1}, - } - tmd := &testMapDecoder{resultMany: anyManyResult} - decoder, err := codec.DecoderFromMapDecoder(tmd) - assert.NoError(t, err) - - err = decoder.Decode(context.Background(), anyRawBytes, item, anyItemTypeForMapDecoder) - assert.IsType(t, types.WrongNumberOfElements{}, err) -} - -func assertTestMapDecoder(t *testing.T, md *testMapDecoder) { - assert.True(t, md.correctRaw) - assert.True(t, md.correctItem) -} - -type testMapDecoder struct { - resultSingle map[string]any - resultMany []map[string]any - correctRaw bool - correctItem bool - correctN bool -} - -func (t *testMapDecoder) DecodeSingle(ctx context.Context, raw []byte, itemType string) (map[string]any, error) { - t.correctRaw = reflect.DeepEqual(raw, anyRawBytes) - t.correctItem = itemType == anyItemTypeForMapDecoder - return t.resultSingle, nil -} - -func (t *testMapDecoder) DecodeMany(ctx context.Context, raw []byte, itemType string) ([]map[string]any, error) { - t.correctRaw = reflect.DeepEqual(raw, anyRawBytes) - t.correctItem = itemType == anyItemTypeForMapDecoder - return t.resultMany, nil -} - -func (t *testMapDecoder) GetMaxDecodingSize(ctx context.Context, n int, itemType string) (int, error) { - t.correctN = anyNElementsForMapDecoder == n - t.correctItem = itemType == anyItemTypeForMapDecoder - return anyDecodingSizeForMapDecoder, nil -} - -type mapTestType struct { - Field1 string - Field2 int -} diff --git a/pkg/codec/utils.go b/pkg/codec/utils.go deleted file mode 100644 index 43d686f67..000000000 --- a/pkg/codec/utils.go +++ /dev/null @@ -1,13 +0,0 @@ -package codec - -import ( - "math/big" -) - -func FitsInNBitsSigned(n int, bi *big.Int) bool { - if bi.Sign() < 0 { - bi = new(big.Int).Neg(bi) - bi.Sub(bi, big.NewInt(1)) - } - return bi.BitLen() <= n-1 -} diff --git a/pkg/codec/utils_test.go b/pkg/codec/utils_test.go deleted file mode 100644 index 946e8990c..000000000 --- a/pkg/codec/utils_test.go +++ /dev/null @@ -1,29 +0,0 @@ -package codec_test - -import ( - "math" - "math/big" - "testing" - - "github.com/stretchr/testify/assert" - - "github.com/smartcontractkit/chainlink-relay/pkg/codec" -) - -func TestFitsInNBitsSigned(t *testing.T) { - t.Parallel() - t.Run("Fits", func(t *testing.T) { - bi := big.NewInt(math.MaxInt16) - assert.True(t, codec.FitsInNBitsSigned(16, bi)) - }) - - t.Run("Too large", func(t *testing.T) { - bi := big.NewInt(math.MaxInt16 + 1) - assert.False(t, codec.FitsInNBitsSigned(16, bi)) - }) - - t.Run("Too small", func(t *testing.T) { - bi := big.NewInt(math.MinInt16 - 1) - assert.False(t, codec.FitsInNBitsSigned(16, bi)) - }) -} diff --git a/pkg/loop/internal/chain_reader.go b/pkg/loop/internal/chain_reader.go index 83e0db569..32ad71c3b 100644 --- a/pkg/loop/internal/chain_reader.go +++ b/pkg/loop/internal/chain_reader.go @@ -4,13 +4,11 @@ import ( "context" jsonv1 "encoding/json" "fmt" - "reflect" "unicode" jsonv2 "github.com/go-json-experiment/json" "github.com/fxamacker/cbor/v2" - libocr "github.com/smartcontractkit/libocr/offchainreporting2plus/types" "google.golang.org/grpc/status" "github.com/smartcontractkit/chainlink-relay/pkg/loop/internal/pb" @@ -132,57 +130,6 @@ func (c *chainReaderClient) GetLatestValue(ctx context.Context, bc types.BoundCo return decodeVersionedBytes(retVal, reply.RetVal) } -func (c *chainReaderClient) Encode(ctx context.Context, item any, itemType string) (libocr.Report, error) { - versionedParams, err := encodeVersionedBytes(item, ParamsCurrentEncodingVersion) - if err != nil { - return nil, err - } - - reply, err := c.grpc.GetEncoding(ctx, &pb.GetEncodingRequest{ - Params: versionedParams, - ItemType: itemType, - }) - - if err != nil { - return nil, unwrapClientError(err) - } - - return reply.RetVal, nil -} - -func (c *chainReaderClient) Decode(ctx context.Context, raw []byte, into any, itemType string) error { - k := reflect.ValueOf(into).Kind() - request := &pb.GetDecodingRequest{ - Encoded: raw, - ItemType: itemType, - ForceSplit: k == reflect.Array || k == reflect.Slice, - } - resp, err := c.grpc.GetDecoding(ctx, request) - if err != nil { - return unwrapClientError(err) - } - - return decodeVersionedBytes(into, resp.RetVal) -} - -func (c *chainReaderClient) GetMaxEncodingSize(ctx context.Context, n int, itemType string) (int, error) { - res, err := c.grpc.GetMaxSize(ctx, &pb.GetMaxSizeRequest{N: int32(n), ItemType: itemType, ForEncoding: true}) - if err != nil { - return 0, unwrapClientError(err) - } - - return int(res.SizeInBytes), nil -} - -func (c *chainReaderClient) GetMaxDecodingSize(ctx context.Context, n int, itemType string) (int, error) { - res, err := c.grpc.GetMaxSize(ctx, &pb.GetMaxSizeRequest{N: int32(n), ItemType: itemType, ForEncoding: false}) - if err != nil { - return 0, unwrapClientError(err) - } - - return int(res.SizeInBytes), nil -} - var _ pb.ChainReaderServer = (*chainReaderServer)(nil) type chainReaderServer struct { @@ -196,20 +143,14 @@ func (c *chainReaderServer) GetLatestValue(ctx context.Context, request *pb.GetL bc.Address = request.Bc.Address[:] bc.Pending = request.Bc.Pending - params, err := c.getEncodedType(request.Method, false, true) - if err != nil { - return nil, err - } + params := &map[string]any{} - if err = decodeVersionedBytes(params, request.Params); err != nil { + if err := decodeVersionedBytes(params, request.Params); err != nil { return nil, err } - retVal, err := c.getEncodedType(request.Method, false, false) - if err != nil { - return nil, err - } - err = c.impl.GetLatestValue(ctx, bc, request.Method, params, retVal) + retVal := &map[string]any{} + err := c.impl.GetLatestValue(ctx, bc, request.Method, params, retVal) if err != nil { return nil, err } @@ -222,76 +163,11 @@ func (c *chainReaderServer) GetLatestValue(ctx context.Context, request *pb.GetL return &pb.GetLatestValueReply{RetVal: encodedRetVal}, nil } -func (c *chainReaderServer) GetEncoding(ctx context.Context, req *pb.GetEncodingRequest) (*pb.GetEncodingResponse, error) { - forceArray, err := isArray(req.Params) - if err != nil { - return nil, err - } - - encodedType, err := c.getEncodedType(req.ItemType, forceArray, true) - if err != nil { - return nil, err - } - - if err = decodeVersionedBytes(encodedType, req.Params); err != nil { - return nil, err - } - - encoded, err := c.impl.Encode(ctx, encodedType, req.ItemType) - return &pb.GetEncodingResponse{RetVal: encoded}, err -} - -func (c *chainReaderServer) GetDecoding(ctx context.Context, req *pb.GetDecodingRequest) (*pb.GetDecodingResponse, error) { - encodedType, err := c.getEncodedType(req.ItemType, req.ForceSplit, false) - if err != nil { - return nil, err - } - - err = c.impl.Decode(ctx, req.Encoded, encodedType, req.ItemType) - if err != nil { - return nil, err - } - - versionBytes, err := encodeVersionedBytes(encodedType, RetvalCurrentEncodingVersion) - return &pb.GetDecodingResponse{RetVal: versionBytes}, err -} - -func (c *chainReaderServer) GetMaxSize(ctx context.Context, req *pb.GetMaxSizeRequest) (*pb.GetMaxSizeResponse, error) { - var sizeFn func(context.Context, int, string) (int, error) - if req.ForEncoding { - sizeFn = c.impl.GetMaxEncodingSize - } else { - sizeFn = c.impl.GetMaxDecodingSize - } - - maxSize, err := sizeFn(ctx, int(req.N), req.ItemType) - if err != nil { - return nil, err - } - return &pb.GetMaxSizeResponse{SizeInBytes: int32(maxSize)}, nil -} - -func (c *chainReaderServer) getEncodedType(itemType string, forceArray bool, forEncoding bool) (any, error) { - if rc, ok := c.impl.(types.RemoteCodec); ok { - return rc.CreateType(itemType, forceArray, forEncoding) - } - - return &map[string]any{}, nil -} - func unwrapClientError(err error) error { if s, ok := status.FromError(err); ok { switch s.Message() { - case types.InvalidEncodingError{}.Error(): - return types.InvalidEncodingError{} - case types.InvalidTypeError{}.Error(): - return types.InvalidTypeError{} case types.FieldNotFoundError{}.Error(): return types.FieldNotFoundError{} - case types.WrongNumberOfElements{}.Error(): - return types.WrongNumberOfElements{} - case types.NotASliceError{}.Error(): - return types.NotASliceError{} } } return err diff --git a/pkg/loop/internal/chain_reader_test.go b/pkg/loop/internal/chain_reader_test.go index d157fa20b..e20f81f88 100644 --- a/pkg/loop/internal/chain_reader_test.go +++ b/pkg/loop/internal/chain_reader_test.go @@ -16,8 +16,6 @@ import ( "github.com/smartcontractkit/chainlink-relay/pkg/loop/internal/pb" "github.com/fxamacker/cbor/v2" - "github.com/mitchellh/mapstructure" - ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2plus/types" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" @@ -62,36 +60,6 @@ func TestVersionedBytesFunctions(t *testing.T) { t.Errorf("expected error: %s, but got: %v", expected, err) } }) - - t.Run("detect json array with leading whitespace", func(t *testing.T) { - // Non-array with leading whitespace - versionedBytes := &pb.VersionedBytes{ - Version: 0, // json - Data: []byte("\n { 'key' : 'value' } "), - } - b, err := isArray(versionedBytes) - assert.NoError(t, err) - assert.False(t, b) - versionedBytesArray := &pb.VersionedBytes{ - Version: 0, // json - Data: []byte("\n [ 1, 2, 3 ] "), - } - - // Array with leading whitespace - b, err = isArray(versionedBytesArray) - assert.NoError(t, err) - assert.True(t, b) - - // All whitespace - versionedBytesAllWhitespace := &pb.VersionedBytes{ - Version: 0, // json - Data: []byte(" \t "), - } - b, err = isArray(versionedBytesAllWhitespace) - assert.NoError(t, err) - assert.False(t, b) - - }) } func TestChainReaderClient(t *testing.T) { @@ -112,56 +80,21 @@ func TestChainReaderClient(t *testing.T) { ctx := context.Background() errorTypes := []error{ - types.InvalidEncodingError{}, types.InvalidTypeError{}, types.FieldNotFoundError{}, - types.WrongNumberOfElements{}, - types.NotASliceError{}, } for _, errorType := range errorTypes { es.err = errorType - t.Run("Encode unwraps errors from server "+errorType.Error(), func(t *testing.T) { - _, err := client.Encode(ctx, "any", "doesnotmatter") - assert.IsType(t, errorType, err) - }) - - t.Run("Decode unwraps errors from server "+errorType.Error(), func(t *testing.T) { - _, err := client.Encode(ctx, "any", "doesnotmatter") - assert.IsType(t, errorType, err) - }) - t.Run("GetLatestValue unwraps errors from server "+errorType.Error(), func(t *testing.T) { err := client.GetLatestValue(ctx, types.BoundContract{}, "method", "anything", "anything") assert.IsType(t, errorType, err) }) - - t.Run("GetMaxEncodingSize unwraps errors from server "+errorType.Error(), func(t *testing.T) { - _, err := client.GetMaxEncodingSize(ctx, 1, "anything") - assert.IsType(t, errorType, err) - }) - - t.Run("GetMaxEncodingSize unwraps errors from server "+errorType.Error(), func(t *testing.T) { - _, err := client.GetMaxDecodingSize(ctx, 1, "anything") - assert.IsType(t, errorType, err) - }) } // make sure that errors come from client directly es.err = nil var invalidTypeErr types.InvalidTypeError - - t.Run("Encode returns error if type cannot be encoded in the wire format", func(t *testing.T) { - _, err := client.Encode(ctx, &cannotEncode{}, "doesnotmatter") - - assert.NotNil(t, errors.As(err, &invalidTypeErr)) - }) - - t.Run("Decode returns error if type cannot be decoded in the wire format", func(t *testing.T) { - _, err := client.Encode(ctx, &cannotEncode{}, "doesnotmatter") - assert.NotNil(t, errors.As(err, &invalidTypeErr)) - }) - t.Run("GetLatestValue returns error if type cannot be encoded in the wire format", func(t *testing.T) { err := client.GetLatestValue(ctx, types.BoundContract{}, "method", &cannotEncode{}, &TestStruct{}) assert.NotNil(t, errors.As(err, &invalidTypeErr)) @@ -175,8 +108,6 @@ type interfaceTester struct { fs *fakeCodecServer } -const methodName = "method" - var encoder = makeEncoder() func makeEncoder() cbor.EncMode { @@ -186,31 +117,23 @@ func makeEncoder() cbor.EncMode { return e } -func (it *interfaceTester) SetLatestValue(_ *testing.T, testStruct *TestStruct) (types.BoundContract, string) { +func (it *interfaceTester) SetLatestValue(ctx context.Context, t *testing.T, testStruct *TestStruct) types.BoundContract { it.fs.SetLatestValue(testStruct) - return types.BoundContract{}, methodName + return types.BoundContract{} } -func (it *interfaceTester) EncodeFields(t *testing.T, request *EncodeRequest) ocrtypes.Report { - if request.TestOn == TestItemType { - bytes, err := encoder.Marshal(request.TestStructs[0]) - require.NoError(t, err) - return bytes - } +func (it *interfaceTester) GetPrimitiveContract(ctx context.Context, t *testing.T) types.BoundContract { + return types.BoundContract{} +} - bytes, err := encoder.Marshal(request.TestStructs) - require.NoError(t, err) - return bytes +func (it *interfaceTester) GetSliceContract(ctx context.Context, t *testing.T) types.BoundContract { + return types.BoundContract{} } func (it *interfaceTester) GetAccountBytes(_ int) []byte { return []byte{1, 2, 3} } -func (it *interfaceTester) IncludeArrayEncodingSizeEnforcement() bool { - return false -} - func (it *interfaceTester) Setup(t *testing.T) { lis := bufconn.Listen(1024 * 1024) it.lis = lis @@ -256,25 +179,25 @@ type fakeCodecServer struct { lock *sync.Mutex } -func (f *fakeCodecServer) GetMaxDecodingSize(ctx context.Context, n int, itemType string) (int, error) { - return f.GetMaxEncodingSize(ctx, n, itemType) -} - -func (f *fakeCodecServer) GetMaxEncodingSize(ctx context.Context, n int, itemType string) (int, error) { - switch itemType { - case TestItemType, TestItemSliceType, TestItemArray2Type, TestItemArray1Type: - return 1, nil - } - return 0, types.InvalidTypeError{} -} - func (f *fakeCodecServer) SetLatestValue(ts *TestStruct) { f.lock.Lock() defer f.lock.Unlock() f.latest = append(f.latest, *ts) } -func (f *fakeCodecServer) GetLatestValue(ctx context.Context, _ types.BoundContract, _ string, params, returnVal any) error { +func (f *fakeCodecServer) GetLatestValue(ctx context.Context, _ types.BoundContract, method string, params, returnVal any) error { + if method == MethodReturningUint64 { + r := returnVal.(*uint64) + *r = AnyValueToReadWithoutAnArgument + return nil + } else if method == MethodReturningUint64Slice { + r := returnVal.(*[]uint64) + *r = AnySliceToReadWithoutAnArgument + return nil + } else if method != MethodTakingLatestParamsReturningTestStruct { + return errors.New("unknown method " + method) + } + f.lock.Lock() defer f.lock.Unlock() lp := params.(*LatestParams) @@ -283,45 +206,6 @@ func (f *fakeCodecServer) GetLatestValue(ctx context.Context, _ types.BoundContr return nil } -func (f *fakeCodecServer) Encode(_ context.Context, item any, itemType string) (ocrtypes.Report, error) { - f.lastItem = item - switch itemType { - case TestItemType, TestItemSliceType, TestItemArray2Type, TestItemArray1Type: - return encoder.Marshal(item) - } - return nil, types.InvalidTypeError{} -} - -func (f *fakeCodecServer) Decode(_ context.Context, raw []byte, into any, itemType string) error { - switch itemType { - case TestItemType, TestItemSliceType, TestItemArray2Type, TestItemArray1Type: - return mapstructure.Decode(f.lastItem, into) - } - return types.InvalidTypeError{} -} - -func (f *fakeCodecServer) CreateType(itemType string, _, isEncode bool) (any, error) { - switch itemType { - case TestItemType: - return &TestStruct{}, nil - case TestItemSliceType: - return &[]TestStruct{}, nil - case TestItemArray2Type: - return &[2]TestStruct{}, nil - case TestItemArray1Type: - return &[1]TestStruct{}, nil - case methodName: - if isEncode { - return &LatestParams{}, nil - } - return &TestStruct{}, nil - } - - return nil, types.InvalidTypeError{} -} - -var _ types.RemoteCodec = &fakeCodecServer{} - type errorServer struct { err error pb.UnimplementedChainReaderServer @@ -331,18 +215,6 @@ func (e *errorServer) GetLatestValue(context.Context, *pb.GetLatestValueRequest) return nil, e.err } -func (e *errorServer) GetEncoding(context.Context, *pb.GetEncodingRequest) (*pb.GetEncodingResponse, error) { - return nil, e.err -} - -func (e *errorServer) GetDecoding(context.Context, *pb.GetDecodingRequest) (*pb.GetDecodingResponse, error) { - return nil, e.err -} - -func (e *errorServer) GetMaxSize(context.Context, *pb.GetMaxSizeRequest) (*pb.GetMaxSizeResponse, error) { - return nil, e.err -} - func connFromLis(t *testing.T, lis *bufconn.Listener) *grpc.ClientConn { conn, err := grpc.Dial("bufnet", grpc.WithContextDialer(func(context.Context, string) (net.Conn, error) { return lis.Dial() }), diff --git a/pkg/loop/internal/pb/relayer.pb.go b/pkg/loop/internal/pb/relayer.pb.go index 934da0d93..1a22b1390 100644 --- a/pkg/loop/internal/pb/relayer.pb.go +++ b/pkg/loop/internal/pb/relayer.pb.go @@ -2313,328 +2313,6 @@ func (x *GetLatestValueReply) GetRetVal() *VersionedBytes { return nil } -type GetEncodingRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Params *VersionedBytes `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` - ItemType string `protobuf:"bytes,2,opt,name=itemType,proto3" json:"itemType,omitempty"` -} - -func (x *GetEncodingRequest) Reset() { - *x = GetEncodingRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_relayer_proto_msgTypes[43] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetEncodingRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetEncodingRequest) ProtoMessage() {} - -func (x *GetEncodingRequest) ProtoReflect() protoreflect.Message { - mi := &file_relayer_proto_msgTypes[43] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetEncodingRequest.ProtoReflect.Descriptor instead. -func (*GetEncodingRequest) Descriptor() ([]byte, []int) { - return file_relayer_proto_rawDescGZIP(), []int{43} -} - -func (x *GetEncodingRequest) GetParams() *VersionedBytes { - if x != nil { - return x.Params - } - return nil -} - -func (x *GetEncodingRequest) GetItemType() string { - if x != nil { - return x.ItemType - } - return "" -} - -type GetEncodingResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - RetVal []byte `protobuf:"bytes,1,opt,name=retVal,proto3" json:"retVal,omitempty"` -} - -func (x *GetEncodingResponse) Reset() { - *x = GetEncodingResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_relayer_proto_msgTypes[44] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetEncodingResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetEncodingResponse) ProtoMessage() {} - -func (x *GetEncodingResponse) ProtoReflect() protoreflect.Message { - mi := &file_relayer_proto_msgTypes[44] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetEncodingResponse.ProtoReflect.Descriptor instead. -func (*GetEncodingResponse) Descriptor() ([]byte, []int) { - return file_relayer_proto_rawDescGZIP(), []int{44} -} - -func (x *GetEncodingResponse) GetRetVal() []byte { - if x != nil { - return x.RetVal - } - return nil -} - -type GetDecodingRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Encoded []byte `protobuf:"bytes,1,opt,name=encoded,proto3" json:"encoded,omitempty"` - ItemType string `protobuf:"bytes,2,opt,name=itemType,proto3" json:"itemType,omitempty"` - ForceSplit bool `protobuf:"varint,3,opt,name=forceSplit,proto3" json:"forceSplit,omitempty"` -} - -func (x *GetDecodingRequest) Reset() { - *x = GetDecodingRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_relayer_proto_msgTypes[45] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetDecodingRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetDecodingRequest) ProtoMessage() {} - -func (x *GetDecodingRequest) ProtoReflect() protoreflect.Message { - mi := &file_relayer_proto_msgTypes[45] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetDecodingRequest.ProtoReflect.Descriptor instead. -func (*GetDecodingRequest) Descriptor() ([]byte, []int) { - return file_relayer_proto_rawDescGZIP(), []int{45} -} - -func (x *GetDecodingRequest) GetEncoded() []byte { - if x != nil { - return x.Encoded - } - return nil -} - -func (x *GetDecodingRequest) GetItemType() string { - if x != nil { - return x.ItemType - } - return "" -} - -func (x *GetDecodingRequest) GetForceSplit() bool { - if x != nil { - return x.ForceSplit - } - return false -} - -type GetDecodingResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - RetVal *VersionedBytes `protobuf:"bytes,1,opt,name=retVal,proto3" json:"retVal,omitempty"` -} - -func (x *GetDecodingResponse) Reset() { - *x = GetDecodingResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_relayer_proto_msgTypes[46] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetDecodingResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetDecodingResponse) ProtoMessage() {} - -func (x *GetDecodingResponse) ProtoReflect() protoreflect.Message { - mi := &file_relayer_proto_msgTypes[46] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetDecodingResponse.ProtoReflect.Descriptor instead. -func (*GetDecodingResponse) Descriptor() ([]byte, []int) { - return file_relayer_proto_rawDescGZIP(), []int{46} -} - -func (x *GetDecodingResponse) GetRetVal() *VersionedBytes { - if x != nil { - return x.RetVal - } - return nil -} - -type GetMaxSizeRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - N int32 `protobuf:"varint,1,opt,name=n,proto3" json:"n,omitempty"` - ItemType string `protobuf:"bytes,2,opt,name=itemType,proto3" json:"itemType,omitempty"` - ForEncoding bool `protobuf:"varint,3,opt,name=forEncoding,proto3" json:"forEncoding,omitempty"` -} - -func (x *GetMaxSizeRequest) Reset() { - *x = GetMaxSizeRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_relayer_proto_msgTypes[47] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetMaxSizeRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetMaxSizeRequest) ProtoMessage() {} - -func (x *GetMaxSizeRequest) ProtoReflect() protoreflect.Message { - mi := &file_relayer_proto_msgTypes[47] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetMaxSizeRequest.ProtoReflect.Descriptor instead. -func (*GetMaxSizeRequest) Descriptor() ([]byte, []int) { - return file_relayer_proto_rawDescGZIP(), []int{47} -} - -func (x *GetMaxSizeRequest) GetN() int32 { - if x != nil { - return x.N - } - return 0 -} - -func (x *GetMaxSizeRequest) GetItemType() string { - if x != nil { - return x.ItemType - } - return "" -} - -func (x *GetMaxSizeRequest) GetForEncoding() bool { - if x != nil { - return x.ForEncoding - } - return false -} - -type GetMaxSizeResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - SizeInBytes int32 `protobuf:"varint,1,opt,name=sizeInBytes,proto3" json:"sizeInBytes,omitempty"` -} - -func (x *GetMaxSizeResponse) Reset() { - *x = GetMaxSizeResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_relayer_proto_msgTypes[48] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetMaxSizeResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetMaxSizeResponse) ProtoMessage() {} - -func (x *GetMaxSizeResponse) ProtoReflect() protoreflect.Message { - mi := &file_relayer_proto_msgTypes[48] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetMaxSizeResponse.ProtoReflect.Descriptor instead. -func (*GetMaxSizeResponse) Descriptor() ([]byte, []int) { - return file_relayer_proto_rawDescGZIP(), []int{48} -} - -func (x *GetMaxSizeResponse) GetSizeInBytes() int32 { - if x != nil { - return x.SizeInBytes - } - return 0 -} - // BoundContract represents a [github.com/smartcontractkit/chainlink-relay/pkg/types.BoundContract]. type BoundContract struct { state protoimpl.MessageState @@ -2649,7 +2327,7 @@ type BoundContract struct { func (x *BoundContract) Reset() { *x = BoundContract{} if protoimpl.UnsafeEnabled { - mi := &file_relayer_proto_msgTypes[49] + mi := &file_relayer_proto_msgTypes[43] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2662,7 +2340,7 @@ func (x *BoundContract) String() string { func (*BoundContract) ProtoMessage() {} func (x *BoundContract) ProtoReflect() protoreflect.Message { - mi := &file_relayer_proto_msgTypes[49] + mi := &file_relayer_proto_msgTypes[43] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2675,7 +2353,7 @@ func (x *BoundContract) ProtoReflect() protoreflect.Message { // Deprecated: Use BoundContract.ProtoReflect.Descriptor instead. func (*BoundContract) Descriptor() ([]byte, []int) { - return file_relayer_proto_rawDescGZIP(), []int{49} + return file_relayer_proto_rawDescGZIP(), []int{43} } func (x *BoundContract) GetAddress() string { @@ -2711,7 +2389,7 @@ type NameReply struct { func (x *NameReply) Reset() { *x = NameReply{} if protoimpl.UnsafeEnabled { - mi := &file_relayer_proto_msgTypes[50] + mi := &file_relayer_proto_msgTypes[44] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2724,7 +2402,7 @@ func (x *NameReply) String() string { func (*NameReply) ProtoMessage() {} func (x *NameReply) ProtoReflect() protoreflect.Message { - mi := &file_relayer_proto_msgTypes[50] + mi := &file_relayer_proto_msgTypes[44] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2737,7 +2415,7 @@ func (x *NameReply) ProtoReflect() protoreflect.Message { // Deprecated: Use NameReply.ProtoReflect.Descriptor instead. func (*NameReply) Descriptor() ([]byte, []int) { - return file_relayer_proto_rawDescGZIP(), []int{50} + return file_relayer_proto_rawDescGZIP(), []int{44} } func (x *NameReply) GetName() string { @@ -2759,7 +2437,7 @@ type HealthReportReply struct { func (x *HealthReportReply) Reset() { *x = HealthReportReply{} if protoimpl.UnsafeEnabled { - mi := &file_relayer_proto_msgTypes[51] + mi := &file_relayer_proto_msgTypes[45] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2772,7 +2450,7 @@ func (x *HealthReportReply) String() string { func (*HealthReportReply) ProtoMessage() {} func (x *HealthReportReply) ProtoReflect() protoreflect.Message { - mi := &file_relayer_proto_msgTypes[51] + mi := &file_relayer_proto_msgTypes[45] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2785,7 +2463,7 @@ func (x *HealthReportReply) ProtoReflect() protoreflect.Message { // Deprecated: Use HealthReportReply.ProtoReflect.Descriptor instead. func (*HealthReportReply) Descriptor() ([]byte, []int) { - return file_relayer_proto_rawDescGZIP(), []int{51} + return file_relayer_proto_rawDescGZIP(), []int{45} } func (x *HealthReportReply) GetHealthReport() map[string]string { @@ -2808,7 +2486,7 @@ type BigInt struct { func (x *BigInt) Reset() { *x = BigInt{} if protoimpl.UnsafeEnabled { - mi := &file_relayer_proto_msgTypes[52] + mi := &file_relayer_proto_msgTypes[46] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2821,7 +2499,7 @@ func (x *BigInt) String() string { func (*BigInt) ProtoMessage() {} func (x *BigInt) ProtoReflect() protoreflect.Message { - mi := &file_relayer_proto_msgTypes[52] + mi := &file_relayer_proto_msgTypes[46] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2834,7 +2512,7 @@ func (x *BigInt) ProtoReflect() protoreflect.Message { // Deprecated: Use BigInt.ProtoReflect.Descriptor instead. func (*BigInt) Descriptor() ([]byte, []int) { - return file_relayer_proto_rawDescGZIP(), []int{52} + return file_relayer_proto_rawDescGZIP(), []int{46} } func (x *BigInt) GetNegative() bool { @@ -2863,7 +2541,7 @@ type StarknetSignature struct { func (x *StarknetSignature) Reset() { *x = StarknetSignature{} if protoimpl.UnsafeEnabled { - mi := &file_relayer_proto_msgTypes[53] + mi := &file_relayer_proto_msgTypes[47] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2876,7 +2554,7 @@ func (x *StarknetSignature) String() string { func (*StarknetSignature) ProtoMessage() {} func (x *StarknetSignature) ProtoReflect() protoreflect.Message { - mi := &file_relayer_proto_msgTypes[53] + mi := &file_relayer_proto_msgTypes[47] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2889,7 +2567,7 @@ func (x *StarknetSignature) ProtoReflect() protoreflect.Message { // Deprecated: Use StarknetSignature.ProtoReflect.Descriptor instead. func (*StarknetSignature) Descriptor() ([]byte, []int) { - return file_relayer_proto_rawDescGZIP(), []int{53} + return file_relayer_proto_rawDescGZIP(), []int{47} } func (x *StarknetSignature) GetX() *BigInt { @@ -2917,7 +2595,7 @@ type StarknetMessageHash struct { func (x *StarknetMessageHash) Reset() { *x = StarknetMessageHash{} if protoimpl.UnsafeEnabled { - mi := &file_relayer_proto_msgTypes[54] + mi := &file_relayer_proto_msgTypes[48] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2930,7 +2608,7 @@ func (x *StarknetMessageHash) String() string { func (*StarknetMessageHash) ProtoMessage() {} func (x *StarknetMessageHash) ProtoReflect() protoreflect.Message { - mi := &file_relayer_proto_msgTypes[54] + mi := &file_relayer_proto_msgTypes[48] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2943,7 +2621,7 @@ func (x *StarknetMessageHash) ProtoReflect() protoreflect.Message { // Deprecated: Use StarknetMessageHash.ProtoReflect.Descriptor instead. func (*StarknetMessageHash) Descriptor() ([]byte, []int) { - return file_relayer_proto_rawDescGZIP(), []int{54} + return file_relayer_proto_rawDescGZIP(), []int{48} } func (x *StarknetMessageHash) GetHash() *BigInt { @@ -3180,192 +2858,150 @@ var file_relayer_proto_rawDesc = []byte{ 0x61, 0x74, 0x65, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x2c, 0x0a, 0x06, 0x72, 0x65, 0x74, 0x56, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x64, - 0x42, 0x79, 0x74, 0x65, 0x73, 0x52, 0x06, 0x72, 0x65, 0x74, 0x56, 0x61, 0x6c, 0x22, 0x5e, 0x0a, - 0x12, 0x47, 0x65, 0x74, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x2c, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x65, 0x64, 0x42, 0x79, 0x74, 0x65, 0x73, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x74, 0x65, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x08, 0x69, 0x74, 0x65, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x22, 0x2d, 0x0a, - 0x13, 0x47, 0x65, 0x74, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x74, 0x56, 0x61, 0x6c, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x72, 0x65, 0x74, 0x56, 0x61, 0x6c, 0x22, 0x6a, 0x0a, 0x12, - 0x47, 0x65, 0x74, 0x44, 0x65, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x07, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x12, 0x1a, 0x0a, 0x08, - 0x69, 0x74, 0x65, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, - 0x69, 0x74, 0x65, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x66, 0x6f, 0x72, 0x63, - 0x65, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x66, 0x6f, - 0x72, 0x63, 0x65, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x22, 0x43, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x44, - 0x65, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x2c, 0x0a, 0x06, 0x72, 0x65, 0x74, 0x56, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x14, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x64, - 0x42, 0x79, 0x74, 0x65, 0x73, 0x52, 0x06, 0x72, 0x65, 0x74, 0x56, 0x61, 0x6c, 0x22, 0x5f, 0x0a, - 0x11, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x78, 0x53, 0x69, 0x7a, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x0c, 0x0a, 0x01, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x6e, - 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x74, 0x65, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x08, 0x69, 0x74, 0x65, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x20, 0x0a, 0x0b, - 0x66, 0x6f, 0x72, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x0b, 0x66, 0x6f, 0x72, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x22, 0x36, - 0x0a, 0x12, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x78, 0x53, 0x69, 0x7a, 0x65, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x69, 0x7a, 0x65, 0x49, 0x6e, 0x42, 0x79, - 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x73, 0x69, 0x7a, 0x65, 0x49, - 0x6e, 0x42, 0x79, 0x74, 0x65, 0x73, 0x22, 0x57, 0x0a, 0x0d, 0x42, 0x6f, 0x75, 0x6e, 0x64, 0x43, - 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x70, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x22, - 0x1f, 0x0a, 0x09, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x12, 0x0a, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x22, 0xa3, 0x01, 0x0a, 0x11, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x52, 0x65, 0x70, 0x6f, 0x72, - 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x4d, 0x0a, 0x0c, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, - 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6c, - 0x6f, 0x6f, 0x70, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, - 0x52, 0x65, 0x70, 0x6c, 0x79, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x52, 0x65, 0x70, 0x6f, - 0x72, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0c, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x52, - 0x65, 0x70, 0x6f, 0x72, 0x74, 0x1a, 0x3f, 0x0a, 0x11, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x52, - 0x65, 0x70, 0x6f, 0x72, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x3a, 0x0a, 0x06, 0x42, 0x69, 0x67, 0x49, 0x6e, 0x74, - 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x08, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x12, 0x14, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x22, 0x4b, 0x0a, 0x11, 0x53, 0x74, 0x61, 0x72, 0x6b, 0x6e, 0x65, 0x74, 0x53, 0x69, - 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x1a, 0x0a, 0x01, 0x78, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x42, 0x69, 0x67, 0x49, 0x6e, 0x74, - 0x52, 0x01, 0x78, 0x12, 0x1a, 0x0a, 0x01, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, - 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x42, 0x69, 0x67, 0x49, 0x6e, 0x74, 0x52, 0x01, 0x79, 0x22, - 0x37, 0x0a, 0x13, 0x53, 0x74, 0x61, 0x72, 0x6b, 0x6e, 0x65, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x12, 0x20, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x42, 0x69, 0x67, 0x49, - 0x6e, 0x74, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x32, 0x4f, 0x0a, 0x0d, 0x50, 0x6c, 0x75, 0x67, - 0x69, 0x6e, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x12, 0x3e, 0x0a, 0x0a, 0x4e, 0x65, 0x77, - 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x12, 0x17, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x4e, - 0x65, 0x77, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x15, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x4e, 0x65, 0x77, 0x52, 0x65, 0x6c, 0x61, 0x79, - 0x65, 0x72, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x32, 0x73, 0x0a, 0x08, 0x4b, 0x65, 0x79, - 0x73, 0x74, 0x6f, 0x72, 0x65, 0x12, 0x39, 0x0a, 0x08, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x13, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, - 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, - 0x12, 0x2c, 0x0a, 0x04, 0x53, 0x69, 0x67, 0x6e, 0x12, 0x11, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, - 0x53, 0x69, 0x67, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x6c, 0x6f, - 0x6f, 0x70, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x32, 0x91, - 0x03, 0x0a, 0x07, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x12, 0x53, 0x0a, 0x11, 0x4e, 0x65, - 0x77, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, - 0x1e, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x4e, 0x65, 0x77, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x1c, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x4e, 0x65, 0x77, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, - 0x53, 0x0a, 0x11, 0x4e, 0x65, 0x77, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x76, - 0x69, 0x64, 0x65, 0x72, 0x12, 0x1e, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x4e, 0x65, 0x77, 0x50, - 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x4e, 0x65, 0x77, 0x50, - 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x52, 0x65, 0x70, - 0x6c, 0x79, 0x22, 0x00, 0x12, 0x4a, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, - 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1b, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x47, 0x65, - 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x68, - 0x61, 0x69, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, - 0x12, 0x50, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x65, 0x73, 0x12, 0x1d, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x4c, 0x69, 0x73, 0x74, - 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4e, - 0x6f, 0x64, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x65, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, - 0x22, 0x00, 0x12, 0x3e, 0x0a, 0x08, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x12, 0x18, - 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x42, 0x79, 0x74, 0x65, 0x73, 0x52, 0x06, 0x72, 0x65, 0x74, 0x56, 0x61, 0x6c, 0x22, 0x57, 0x0a, + 0x0d, 0x42, 0x6f, 0x75, 0x6e, 0x64, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x12, 0x18, + 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, + 0x70, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x70, + 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x22, 0x1f, 0x0a, 0x09, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, + 0x70, 0x6c, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0xa3, 0x01, 0x0a, 0x11, 0x48, 0x65, 0x61, 0x6c, + 0x74, 0x68, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x4d, 0x0a, + 0x0c, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, + 0x68, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x2e, 0x48, 0x65, 0x61, + 0x6c, 0x74, 0x68, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0c, + 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x1a, 0x3f, 0x0a, 0x11, + 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x3a, 0x0a, + 0x06, 0x42, 0x69, 0x67, 0x49, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x65, 0x67, 0x61, 0x74, + 0x69, 0x76, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6e, 0x65, 0x67, 0x61, 0x74, + 0x69, 0x76, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x4b, 0x0a, 0x11, 0x53, 0x74, 0x61, + 0x72, 0x6b, 0x6e, 0x65, 0x74, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x1a, + 0x0a, 0x01, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, + 0x2e, 0x42, 0x69, 0x67, 0x49, 0x6e, 0x74, 0x52, 0x01, 0x78, 0x12, 0x1a, 0x0a, 0x01, 0x79, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x42, 0x69, 0x67, + 0x49, 0x6e, 0x74, 0x52, 0x01, 0x79, 0x22, 0x37, 0x0a, 0x13, 0x53, 0x74, 0x61, 0x72, 0x6b, 0x6e, + 0x65, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x12, 0x20, 0x0a, + 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x6c, 0x6f, + 0x6f, 0x70, 0x2e, 0x42, 0x69, 0x67, 0x49, 0x6e, 0x74, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x32, + 0x4f, 0x0a, 0x0d, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, + 0x12, 0x3e, 0x0a, 0x0a, 0x4e, 0x65, 0x77, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x12, 0x17, + 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x4e, 0x65, 0x77, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x4e, + 0x65, 0x77, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, + 0x32, 0x73, 0x0a, 0x08, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x12, 0x39, 0x0a, 0x08, + 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, - 0x22, 0x00, 0x32, 0x43, 0x0a, 0x0a, 0x44, 0x61, 0x74, 0x61, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x12, 0x35, 0x0a, 0x07, 0x4f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x65, 0x12, 0x14, 0x2e, 0x6c, 0x6f, - 0x6f, 0x70, 0x2e, 0x4f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x12, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x4f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x65, - 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x32, 0xb6, 0x01, 0x0a, 0x16, 0x4f, 0x66, 0x66, 0x63, - 0x68, 0x61, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, - 0x65, 0x72, 0x12, 0x44, 0x0a, 0x0c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x44, 0x69, 0x67, 0x65, - 0x73, 0x74, 0x12, 0x19, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, - 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x44, 0x69, 0x67, 0x65, 0x73, - 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x56, 0x0a, 0x12, 0x43, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x1f, - 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x44, 0x69, 0x67, 0x65, - 0x73, 0x74, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x1d, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x44, 0x69, 0x67, - 0x65, 0x73, 0x74, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, - 0x32, 0x8d, 0x02, 0x0a, 0x15, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x65, 0x72, 0x12, 0x59, 0x0a, 0x13, 0x4c, 0x61, - 0x74, 0x65, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, - 0x73, 0x12, 0x20, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x43, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x4c, 0x61, 0x74, 0x65, 0x73, - 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x52, 0x65, - 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x44, 0x0a, 0x0c, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x43, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x19, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x4c, 0x61, 0x74, - 0x65, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x17, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x53, 0x0a, 0x11, 0x4c, + 0x1a, 0x13, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, + 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x2c, 0x0a, 0x04, 0x53, 0x69, 0x67, 0x6e, 0x12, + 0x11, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x52, 0x65, + 0x70, 0x6c, 0x79, 0x22, 0x00, 0x32, 0x91, 0x03, 0x0a, 0x07, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, + 0x72, 0x12, 0x53, 0x0a, 0x11, 0x4e, 0x65, 0x77, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x50, 0x72, + 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x1e, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x4e, 0x65, + 0x77, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x4e, 0x65, + 0x77, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x52, + 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x53, 0x0a, 0x11, 0x4e, 0x65, 0x77, 0x50, 0x6c, 0x75, + 0x67, 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x1e, 0x2e, 0x6c, 0x6f, + 0x6f, 0x70, 0x2e, 0x4e, 0x65, 0x77, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x76, + 0x69, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6c, 0x6f, + 0x6f, 0x70, 0x2e, 0x4e, 0x65, 0x77, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x76, + 0x69, 0x64, 0x65, 0x72, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x4a, 0x0a, 0x0e, 0x47, + 0x65, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1b, 0x2e, + 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x6c, 0x6f, 0x6f, + 0x70, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x50, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x4e, + 0x6f, 0x64, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x65, 0x73, 0x12, 0x1d, 0x2e, 0x6c, 0x6f, + 0x6f, 0x70, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x6c, 0x6f, 0x6f, + 0x70, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x65, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3e, 0x0a, 0x08, 0x54, 0x72, 0x61, + 0x6e, 0x73, 0x61, 0x63, 0x74, 0x12, 0x18, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x54, 0x72, 0x61, + 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x32, 0x43, 0x0a, 0x0a, 0x44, 0x61, 0x74, + 0x61, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x35, 0x0a, 0x07, 0x4f, 0x62, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x12, 0x14, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x4f, 0x62, 0x73, 0x65, 0x72, 0x76, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, + 0x4f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x32, 0xb6, + 0x01, 0x0a, 0x16, 0x4f, 0x66, 0x66, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x65, 0x72, 0x12, 0x44, 0x0a, 0x0c, 0x43, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x12, 0x19, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, + 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, + 0x56, 0x0a, 0x12, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x50, + 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x1f, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x43, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, + 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x32, 0x8d, 0x02, 0x0a, 0x15, 0x43, 0x6f, 0x6e, 0x74, + 0x72, 0x61, 0x63, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x65, + 0x72, 0x12, 0x59, 0x0a, 0x13, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x12, 0x20, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, + 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x44, 0x65, 0x74, 0x61, + 0x69, 0x6c, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x6c, 0x6f, 0x6f, + 0x70, 0x2e, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x44, 0x65, + 0x74, 0x61, 0x69, 0x6c, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x44, 0x0a, 0x0c, + 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x19, 0x2e, 0x6c, + 0x6f, 0x6f, 0x70, 0x2e, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x4c, + 0x61, 0x74, 0x65, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x70, 0x6c, 0x79, + 0x22, 0x00, 0x12, 0x53, 0x0a, 0x11, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x42, 0x6c, 0x6f, 0x63, + 0x6b, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x1e, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, - 0x12, 0x1e, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x42, 0x6c, - 0x6f, 0x63, 0x6b, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x1c, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x42, 0x6c, - 0x6f, 0x63, 0x6b, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, - 0x32, 0x82, 0x02, 0x0a, 0x13, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x54, 0x72, 0x61, - 0x6e, 0x73, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x72, 0x12, 0x38, 0x0a, 0x08, 0x54, 0x72, 0x61, 0x6e, - 0x73, 0x6d, 0x69, 0x74, 0x12, 0x15, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x54, 0x72, 0x61, 0x6e, - 0x73, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x6c, 0x6f, - 0x6f, 0x70, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, - 0x22, 0x00, 0x12, 0x6e, 0x0a, 0x1a, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x41, 0x6e, 0x64, 0x45, 0x70, 0x6f, 0x63, 0x68, - 0x12, 0x27, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x43, 0x6f, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x4c, + 0x61, 0x74, 0x65, 0x73, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, + 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x32, 0x82, 0x02, 0x0a, 0x13, 0x43, 0x6f, 0x6e, 0x74, + 0x72, 0x61, 0x63, 0x74, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x72, 0x12, + 0x38, 0x0a, 0x08, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x6d, 0x69, 0x74, 0x12, 0x15, 0x2e, 0x6c, 0x6f, + 0x6f, 0x70, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x6d, + 0x69, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x6e, 0x0a, 0x1a, 0x4c, 0x61, 0x74, + 0x65, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x41, + 0x6e, 0x64, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x27, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x4c, + 0x61, 0x74, 0x65, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x44, 0x69, 0x67, 0x65, 0x73, + 0x74, 0x41, 0x6e, 0x64, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x25, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x41, 0x6e, 0x64, 0x45, 0x70, 0x6f, - 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, - 0x2e, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x44, 0x69, 0x67, - 0x65, 0x73, 0x74, 0x41, 0x6e, 0x64, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x52, 0x65, 0x70, 0x6c, 0x79, - 0x22, 0x00, 0x12, 0x41, 0x0a, 0x0b, 0x46, 0x72, 0x6f, 0x6d, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x12, 0x18, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x46, 0x72, 0x6f, 0x6d, 0x41, 0x63, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x6c, 0x6f, - 0x6f, 0x70, 0x2e, 0x46, 0x72, 0x6f, 0x6d, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, - 0x70, 0x6c, 0x79, 0x22, 0x00, 0x32, 0xa2, 0x02, 0x0a, 0x0b, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, - 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x4a, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x4c, 0x61, 0x74, 0x65, - 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1b, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x47, - 0x65, 0x74, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x47, 0x65, 0x74, 0x4c, - 0x61, 0x74, 0x65, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, - 0x00, 0x12, 0x42, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, - 0x12, 0x18, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x6e, 0x63, 0x6f, 0x64, - 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x6c, 0x6f, 0x6f, - 0x70, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x42, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x44, 0x65, 0x63, 0x6f, - 0x64, 0x69, 0x6e, 0x67, 0x12, 0x18, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x47, 0x65, 0x74, 0x44, - 0x65, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, - 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x47, 0x65, 0x74, 0x44, 0x65, 0x63, 0x6f, 0x64, 0x69, 0x6e, - 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x0a, 0x47, 0x65, 0x74, - 0x4d, 0x61, 0x78, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x17, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x47, - 0x65, 0x74, 0x4d, 0x61, 0x78, 0x53, 0x69, 0x7a, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x18, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x78, 0x53, 0x69, - 0x7a, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xf5, 0x01, 0x0a, 0x07, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x31, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x16, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x0f, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x4e, 0x61, - 0x6d, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x39, 0x0a, 0x05, 0x43, 0x6c, 0x6f, - 0x73, 0x65, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, - 0x74, 0x79, 0x22, 0x00, 0x12, 0x39, 0x0a, 0x05, 0x52, 0x65, 0x61, 0x64, 0x79, 0x12, 0x16, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, - 0x41, 0x0a, 0x0c, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x12, + 0x63, 0x68, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x41, 0x0a, 0x0b, 0x46, 0x72, 0x6f, + 0x6d, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x18, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, + 0x46, 0x72, 0x6f, 0x6d, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x46, 0x72, 0x6f, 0x6d, 0x41, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x32, 0x59, 0x0a, 0x0b, + 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x4a, 0x0a, 0x0e, 0x47, + 0x65, 0x74, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1b, 0x2e, + 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x47, 0x65, 0x74, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x56, 0x61, + 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x6c, 0x6f, 0x6f, + 0x70, 0x2e, 0x47, 0x65, 0x74, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x32, 0xf5, 0x01, 0x0a, 0x07, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x12, 0x31, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, + 0x70, 0x74, 0x79, 0x1a, 0x0f, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x52, + 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x39, 0x0a, 0x05, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x17, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x48, - 0x65, 0x61, 0x6c, 0x74, 0x68, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, - 0x22, 0x00, 0x42, 0x42, 0x5a, 0x40, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x73, 0x6d, 0x61, 0x72, 0x74, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x6b, 0x69, - 0x74, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x6b, 0x2d, 0x72, 0x65, 0x6c, 0x61, - 0x79, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x6c, 0x6f, 0x6f, 0x70, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, - 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, + 0x00, 0x12, 0x39, 0x0a, 0x05, 0x52, 0x65, 0x61, 0x64, 0x79, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, + 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x41, 0x0a, 0x0c, + 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x16, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, + 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x17, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x48, 0x65, 0x61, 0x6c, + 0x74, 0x68, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x42, + 0x42, 0x5a, 0x40, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x6d, + 0x61, 0x72, 0x74, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x6b, 0x69, 0x74, 0x2f, 0x63, + 0x68, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x6b, 0x2d, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x2f, 0x70, + 0x6b, 0x67, 0x2f, 0x6c, 0x6f, 0x6f, 0x70, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, + 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3380,7 +3016,7 @@ func file_relayer_proto_rawDescGZIP() []byte { return file_relayer_proto_rawDescData } -var file_relayer_proto_msgTypes = make([]protoimpl.MessageInfo, 56) +var file_relayer_proto_msgTypes = make([]protoimpl.MessageInfo, 50) var file_relayer_proto_goTypes = []interface{}{ (*NewRelayerRequest)(nil), // 0: loop.NewRelayerRequest (*NewRelayerReply)(nil), // 1: loop.NewRelayerReply @@ -3425,20 +3061,14 @@ var file_relayer_proto_goTypes = []interface{}{ (*VersionedBytes)(nil), // 40: loop.VersionedBytes (*GetLatestValueRequest)(nil), // 41: loop.GetLatestValueRequest (*GetLatestValueReply)(nil), // 42: loop.GetLatestValueReply - (*GetEncodingRequest)(nil), // 43: loop.GetEncodingRequest - (*GetEncodingResponse)(nil), // 44: loop.GetEncodingResponse - (*GetDecodingRequest)(nil), // 45: loop.GetDecodingRequest - (*GetDecodingResponse)(nil), // 46: loop.GetDecodingResponse - (*GetMaxSizeRequest)(nil), // 47: loop.GetMaxSizeRequest - (*GetMaxSizeResponse)(nil), // 48: loop.GetMaxSizeResponse - (*BoundContract)(nil), // 49: loop.BoundContract - (*NameReply)(nil), // 50: loop.NameReply - (*HealthReportReply)(nil), // 51: loop.HealthReportReply - (*BigInt)(nil), // 52: loop.BigInt - (*StarknetSignature)(nil), // 53: loop.StarknetSignature - (*StarknetMessageHash)(nil), // 54: loop.StarknetMessageHash - nil, // 55: loop.HealthReportReply.HealthReportEntry - (*emptypb.Empty)(nil), // 56: google.protobuf.Empty + (*BoundContract)(nil), // 43: loop.BoundContract + (*NameReply)(nil), // 44: loop.NameReply + (*HealthReportReply)(nil), // 45: loop.HealthReportReply + (*BigInt)(nil), // 46: loop.BigInt + (*StarknetSignature)(nil), // 47: loop.StarknetSignature + (*StarknetMessageHash)(nil), // 48: loop.StarknetMessageHash + nil, // 49: loop.HealthReportReply.HealthReportEntry + (*emptypb.Empty)(nil), // 50: google.protobuf.Empty } var file_relayer_proto_depIdxs = []int32{ 5, // 0: loop.NewPluginProviderRequest.relayArgs:type_name -> loop.RelayArgs @@ -3446,78 +3076,70 @@ var file_relayer_proto_depIdxs = []int32{ 5, // 2: loop.NewConfigProviderRequest.relayArgs:type_name -> loop.RelayArgs 13, // 3: loop.GetChainStatusReply.chain:type_name -> loop.ChainStatus 16, // 4: loop.ListNodeStatusesReply.nodes:type_name -> loop.NodeStatus - 52, // 5: loop.TransactionRequest.amount:type_name -> loop.BigInt + 46, // 5: loop.TransactionRequest.amount:type_name -> loop.BigInt 31, // 6: loop.ObserveRequest.reportTimestamp:type_name -> loop.ReportTimestamp - 52, // 7: loop.ObserveReply.value:type_name -> loop.BigInt + 46, // 7: loop.ObserveReply.value:type_name -> loop.BigInt 20, // 8: loop.ConfigDigestRequest.contractConfig:type_name -> loop.ContractConfig 20, // 9: loop.LatestConfigReply.contractConfig:type_name -> loop.ContractConfig 31, // 10: loop.ReportContext.reportTimestamp:type_name -> loop.ReportTimestamp 32, // 11: loop.TransmitRequest.reportContext:type_name -> loop.ReportContext 33, // 12: loop.TransmitRequest.attributedOnchainSignatures:type_name -> loop.AttributedOnchainSignature - 49, // 13: loop.GetLatestValueRequest.bc:type_name -> loop.BoundContract + 43, // 13: loop.GetLatestValueRequest.bc:type_name -> loop.BoundContract 40, // 14: loop.GetLatestValueRequest.params:type_name -> loop.VersionedBytes 40, // 15: loop.GetLatestValueReply.retVal:type_name -> loop.VersionedBytes - 40, // 16: loop.GetEncodingRequest.params:type_name -> loop.VersionedBytes - 40, // 17: loop.GetDecodingResponse.retVal:type_name -> loop.VersionedBytes - 55, // 18: loop.HealthReportReply.healthReport:type_name -> loop.HealthReportReply.HealthReportEntry - 52, // 19: loop.StarknetSignature.x:type_name -> loop.BigInt - 52, // 20: loop.StarknetSignature.y:type_name -> loop.BigInt - 52, // 21: loop.StarknetMessageHash.hash:type_name -> loop.BigInt - 0, // 22: loop.PluginRelayer.NewRelayer:input_type -> loop.NewRelayerRequest - 56, // 23: loop.Keystore.Accounts:input_type -> google.protobuf.Empty - 3, // 24: loop.Keystore.Sign:input_type -> loop.SignRequest - 9, // 25: loop.Relayer.NewConfigProvider:input_type -> loop.NewConfigProviderRequest - 7, // 26: loop.Relayer.NewPluginProvider:input_type -> loop.NewPluginProviderRequest - 11, // 27: loop.Relayer.GetChainStatus:input_type -> loop.GetChainStatusRequest - 14, // 28: loop.Relayer.ListNodeStatuses:input_type -> loop.ListNodeStatusesRequest - 17, // 29: loop.Relayer.Transact:input_type -> loop.TransactionRequest - 18, // 30: loop.DataSource.Observe:input_type -> loop.ObserveRequest - 21, // 31: loop.OffchainConfigDigester.ConfigDigest:input_type -> loop.ConfigDigestRequest - 23, // 32: loop.OffchainConfigDigester.ConfigDigestPrefix:input_type -> loop.ConfigDigestPrefixRequest - 25, // 33: loop.ContractConfigTracker.LatestConfigDetails:input_type -> loop.LatestConfigDetailsRequest - 27, // 34: loop.ContractConfigTracker.LatestConfig:input_type -> loop.LatestConfigRequest - 29, // 35: loop.ContractConfigTracker.LatestBlockHeight:input_type -> loop.LatestBlockHeightRequest - 34, // 36: loop.ContractTransmitter.Transmit:input_type -> loop.TransmitRequest - 36, // 37: loop.ContractTransmitter.LatestConfigDigestAndEpoch:input_type -> loop.LatestConfigDigestAndEpochRequest - 38, // 38: loop.ContractTransmitter.FromAccount:input_type -> loop.FromAccountRequest - 41, // 39: loop.ChainReader.GetLatestValue:input_type -> loop.GetLatestValueRequest - 43, // 40: loop.ChainReader.GetEncoding:input_type -> loop.GetEncodingRequest - 45, // 41: loop.ChainReader.GetDecoding:input_type -> loop.GetDecodingRequest - 47, // 42: loop.ChainReader.GetMaxSize:input_type -> loop.GetMaxSizeRequest - 56, // 43: loop.Service.Name:input_type -> google.protobuf.Empty - 56, // 44: loop.Service.Close:input_type -> google.protobuf.Empty - 56, // 45: loop.Service.Ready:input_type -> google.protobuf.Empty - 56, // 46: loop.Service.HealthReport:input_type -> google.protobuf.Empty - 1, // 47: loop.PluginRelayer.NewRelayer:output_type -> loop.NewRelayerReply - 2, // 48: loop.Keystore.Accounts:output_type -> loop.AccountsReply - 4, // 49: loop.Keystore.Sign:output_type -> loop.SignReply - 10, // 50: loop.Relayer.NewConfigProvider:output_type -> loop.NewConfigProviderReply - 8, // 51: loop.Relayer.NewPluginProvider:output_type -> loop.NewPluginProviderReply - 12, // 52: loop.Relayer.GetChainStatus:output_type -> loop.GetChainStatusReply - 15, // 53: loop.Relayer.ListNodeStatuses:output_type -> loop.ListNodeStatusesReply - 56, // 54: loop.Relayer.Transact:output_type -> google.protobuf.Empty - 19, // 55: loop.DataSource.Observe:output_type -> loop.ObserveReply - 22, // 56: loop.OffchainConfigDigester.ConfigDigest:output_type -> loop.ConfigDigestReply - 24, // 57: loop.OffchainConfigDigester.ConfigDigestPrefix:output_type -> loop.ConfigDigestPrefixReply - 26, // 58: loop.ContractConfigTracker.LatestConfigDetails:output_type -> loop.LatestConfigDetailsReply - 28, // 59: loop.ContractConfigTracker.LatestConfig:output_type -> loop.LatestConfigReply - 30, // 60: loop.ContractConfigTracker.LatestBlockHeight:output_type -> loop.LatestBlockHeightReply - 35, // 61: loop.ContractTransmitter.Transmit:output_type -> loop.TransmitReply - 37, // 62: loop.ContractTransmitter.LatestConfigDigestAndEpoch:output_type -> loop.LatestConfigDigestAndEpochReply - 39, // 63: loop.ContractTransmitter.FromAccount:output_type -> loop.FromAccountReply - 42, // 64: loop.ChainReader.GetLatestValue:output_type -> loop.GetLatestValueReply - 44, // 65: loop.ChainReader.GetEncoding:output_type -> loop.GetEncodingResponse - 46, // 66: loop.ChainReader.GetDecoding:output_type -> loop.GetDecodingResponse - 48, // 67: loop.ChainReader.GetMaxSize:output_type -> loop.GetMaxSizeResponse - 50, // 68: loop.Service.Name:output_type -> loop.NameReply - 56, // 69: loop.Service.Close:output_type -> google.protobuf.Empty - 56, // 70: loop.Service.Ready:output_type -> google.protobuf.Empty - 51, // 71: loop.Service.HealthReport:output_type -> loop.HealthReportReply - 47, // [47:72] is the sub-list for method output_type - 22, // [22:47] is the sub-list for method input_type - 22, // [22:22] is the sub-list for extension type_name - 22, // [22:22] is the sub-list for extension extendee - 0, // [0:22] is the sub-list for field type_name + 49, // 16: loop.HealthReportReply.healthReport:type_name -> loop.HealthReportReply.HealthReportEntry + 46, // 17: loop.StarknetSignature.x:type_name -> loop.BigInt + 46, // 18: loop.StarknetSignature.y:type_name -> loop.BigInt + 46, // 19: loop.StarknetMessageHash.hash:type_name -> loop.BigInt + 0, // 20: loop.PluginRelayer.NewRelayer:input_type -> loop.NewRelayerRequest + 50, // 21: loop.Keystore.Accounts:input_type -> google.protobuf.Empty + 3, // 22: loop.Keystore.Sign:input_type -> loop.SignRequest + 9, // 23: loop.Relayer.NewConfigProvider:input_type -> loop.NewConfigProviderRequest + 7, // 24: loop.Relayer.NewPluginProvider:input_type -> loop.NewPluginProviderRequest + 11, // 25: loop.Relayer.GetChainStatus:input_type -> loop.GetChainStatusRequest + 14, // 26: loop.Relayer.ListNodeStatuses:input_type -> loop.ListNodeStatusesRequest + 17, // 27: loop.Relayer.Transact:input_type -> loop.TransactionRequest + 18, // 28: loop.DataSource.Observe:input_type -> loop.ObserveRequest + 21, // 29: loop.OffchainConfigDigester.ConfigDigest:input_type -> loop.ConfigDigestRequest + 23, // 30: loop.OffchainConfigDigester.ConfigDigestPrefix:input_type -> loop.ConfigDigestPrefixRequest + 25, // 31: loop.ContractConfigTracker.LatestConfigDetails:input_type -> loop.LatestConfigDetailsRequest + 27, // 32: loop.ContractConfigTracker.LatestConfig:input_type -> loop.LatestConfigRequest + 29, // 33: loop.ContractConfigTracker.LatestBlockHeight:input_type -> loop.LatestBlockHeightRequest + 34, // 34: loop.ContractTransmitter.Transmit:input_type -> loop.TransmitRequest + 36, // 35: loop.ContractTransmitter.LatestConfigDigestAndEpoch:input_type -> loop.LatestConfigDigestAndEpochRequest + 38, // 36: loop.ContractTransmitter.FromAccount:input_type -> loop.FromAccountRequest + 41, // 37: loop.ChainReader.GetLatestValue:input_type -> loop.GetLatestValueRequest + 50, // 38: loop.Service.Name:input_type -> google.protobuf.Empty + 50, // 39: loop.Service.Close:input_type -> google.protobuf.Empty + 50, // 40: loop.Service.Ready:input_type -> google.protobuf.Empty + 50, // 41: loop.Service.HealthReport:input_type -> google.protobuf.Empty + 1, // 42: loop.PluginRelayer.NewRelayer:output_type -> loop.NewRelayerReply + 2, // 43: loop.Keystore.Accounts:output_type -> loop.AccountsReply + 4, // 44: loop.Keystore.Sign:output_type -> loop.SignReply + 10, // 45: loop.Relayer.NewConfigProvider:output_type -> loop.NewConfigProviderReply + 8, // 46: loop.Relayer.NewPluginProvider:output_type -> loop.NewPluginProviderReply + 12, // 47: loop.Relayer.GetChainStatus:output_type -> loop.GetChainStatusReply + 15, // 48: loop.Relayer.ListNodeStatuses:output_type -> loop.ListNodeStatusesReply + 50, // 49: loop.Relayer.Transact:output_type -> google.protobuf.Empty + 19, // 50: loop.DataSource.Observe:output_type -> loop.ObserveReply + 22, // 51: loop.OffchainConfigDigester.ConfigDigest:output_type -> loop.ConfigDigestReply + 24, // 52: loop.OffchainConfigDigester.ConfigDigestPrefix:output_type -> loop.ConfigDigestPrefixReply + 26, // 53: loop.ContractConfigTracker.LatestConfigDetails:output_type -> loop.LatestConfigDetailsReply + 28, // 54: loop.ContractConfigTracker.LatestConfig:output_type -> loop.LatestConfigReply + 30, // 55: loop.ContractConfigTracker.LatestBlockHeight:output_type -> loop.LatestBlockHeightReply + 35, // 56: loop.ContractTransmitter.Transmit:output_type -> loop.TransmitReply + 37, // 57: loop.ContractTransmitter.LatestConfigDigestAndEpoch:output_type -> loop.LatestConfigDigestAndEpochReply + 39, // 58: loop.ContractTransmitter.FromAccount:output_type -> loop.FromAccountReply + 42, // 59: loop.ChainReader.GetLatestValue:output_type -> loop.GetLatestValueReply + 44, // 60: loop.Service.Name:output_type -> loop.NameReply + 50, // 61: loop.Service.Close:output_type -> google.protobuf.Empty + 50, // 62: loop.Service.Ready:output_type -> google.protobuf.Empty + 45, // 63: loop.Service.HealthReport:output_type -> loop.HealthReportReply + 42, // [42:64] is the sub-list for method output_type + 20, // [20:42] is the sub-list for method input_type + 20, // [20:20] is the sub-list for extension type_name + 20, // [20:20] is the sub-list for extension extendee + 0, // [0:20] is the sub-list for field type_name } func init() { file_relayer_proto_init() } @@ -4043,78 +3665,6 @@ func file_relayer_proto_init() { } } file_relayer_proto_msgTypes[43].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetEncodingRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_relayer_proto_msgTypes[44].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetEncodingResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_relayer_proto_msgTypes[45].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetDecodingRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_relayer_proto_msgTypes[46].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetDecodingResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_relayer_proto_msgTypes[47].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetMaxSizeRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_relayer_proto_msgTypes[48].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetMaxSizeResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_relayer_proto_msgTypes[49].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BoundContract); i { case 0: return &v.state @@ -4126,7 +3676,7 @@ func file_relayer_proto_init() { return nil } } - file_relayer_proto_msgTypes[50].Exporter = func(v interface{}, i int) interface{} { + file_relayer_proto_msgTypes[44].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*NameReply); i { case 0: return &v.state @@ -4138,7 +3688,7 @@ func file_relayer_proto_init() { return nil } } - file_relayer_proto_msgTypes[51].Exporter = func(v interface{}, i int) interface{} { + file_relayer_proto_msgTypes[45].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*HealthReportReply); i { case 0: return &v.state @@ -4150,7 +3700,7 @@ func file_relayer_proto_init() { return nil } } - file_relayer_proto_msgTypes[52].Exporter = func(v interface{}, i int) interface{} { + file_relayer_proto_msgTypes[46].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BigInt); i { case 0: return &v.state @@ -4162,7 +3712,7 @@ func file_relayer_proto_init() { return nil } } - file_relayer_proto_msgTypes[53].Exporter = func(v interface{}, i int) interface{} { + file_relayer_proto_msgTypes[47].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*StarknetSignature); i { case 0: return &v.state @@ -4174,7 +3724,7 @@ func file_relayer_proto_init() { return nil } } - file_relayer_proto_msgTypes[54].Exporter = func(v interface{}, i int) interface{} { + file_relayer_proto_msgTypes[48].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*StarknetMessageHash); i { case 0: return &v.state @@ -4193,7 +3743,7 @@ func file_relayer_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_relayer_proto_rawDesc, NumEnums: 0, - NumMessages: 56, + NumMessages: 50, NumExtensions: 0, NumServices: 9, }, diff --git a/pkg/loop/internal/pb/relayer.proto b/pkg/loop/internal/pb/relayer.proto index adb01b365..3aa5c0672 100644 --- a/pkg/loop/internal/pb/relayer.proto +++ b/pkg/loop/internal/pb/relayer.proto @@ -258,9 +258,6 @@ message FromAccountReply { service ChainReader { rpc GetLatestValue (GetLatestValueRequest) returns (GetLatestValueReply) {} - rpc GetEncoding(GetEncodingRequest) returns (GetEncodingResponse); - rpc GetDecoding(GetDecodingRequest) returns (GetDecodingResponse); - rpc GetMaxSize(GetMaxSizeRequest) returns (GetMaxSizeResponse); } message VersionedBytes { @@ -280,35 +277,6 @@ message GetLatestValueReply { VersionedBytes retVal = 1; } -message GetEncodingRequest { - VersionedBytes params = 1; - string itemType = 2; -} - -message GetEncodingResponse { - bytes retVal = 1; -} - -message GetDecodingRequest { - bytes encoded = 1; - string itemType = 2; - bool forceSplit = 3; -} - -message GetDecodingResponse { - VersionedBytes retVal = 1; -} - -message GetMaxSizeRequest { - int32 n = 1; - string itemType = 2; - bool forEncoding = 3; -} - -message GetMaxSizeResponse { - int32 sizeInBytes = 1; -} - // BoundContract represents a [github.com/smartcontractkit/chainlink-relay/pkg/types.BoundContract]. message BoundContract { string address = 1; diff --git a/pkg/loop/internal/pb/relayer_grpc.pb.go b/pkg/loop/internal/pb/relayer_grpc.pb.go index a0a4ffce1..5c56cf085 100644 --- a/pkg/loop/internal/pb/relayer_grpc.pb.go +++ b/pkg/loop/internal/pb/relayer_grpc.pb.go @@ -1022,9 +1022,6 @@ var ContractTransmitter_ServiceDesc = grpc.ServiceDesc{ const ( ChainReader_GetLatestValue_FullMethodName = "/loop.ChainReader/GetLatestValue" - ChainReader_GetEncoding_FullMethodName = "/loop.ChainReader/GetEncoding" - ChainReader_GetDecoding_FullMethodName = "/loop.ChainReader/GetDecoding" - ChainReader_GetMaxSize_FullMethodName = "/loop.ChainReader/GetMaxSize" ) // ChainReaderClient is the client API for ChainReader service. @@ -1032,9 +1029,6 @@ const ( // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type ChainReaderClient interface { GetLatestValue(ctx context.Context, in *GetLatestValueRequest, opts ...grpc.CallOption) (*GetLatestValueReply, error) - GetEncoding(ctx context.Context, in *GetEncodingRequest, opts ...grpc.CallOption) (*GetEncodingResponse, error) - GetDecoding(ctx context.Context, in *GetDecodingRequest, opts ...grpc.CallOption) (*GetDecodingResponse, error) - GetMaxSize(ctx context.Context, in *GetMaxSizeRequest, opts ...grpc.CallOption) (*GetMaxSizeResponse, error) } type chainReaderClient struct { @@ -1054,41 +1048,11 @@ func (c *chainReaderClient) GetLatestValue(ctx context.Context, in *GetLatestVal return out, nil } -func (c *chainReaderClient) GetEncoding(ctx context.Context, in *GetEncodingRequest, opts ...grpc.CallOption) (*GetEncodingResponse, error) { - out := new(GetEncodingResponse) - err := c.cc.Invoke(ctx, ChainReader_GetEncoding_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *chainReaderClient) GetDecoding(ctx context.Context, in *GetDecodingRequest, opts ...grpc.CallOption) (*GetDecodingResponse, error) { - out := new(GetDecodingResponse) - err := c.cc.Invoke(ctx, ChainReader_GetDecoding_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *chainReaderClient) GetMaxSize(ctx context.Context, in *GetMaxSizeRequest, opts ...grpc.CallOption) (*GetMaxSizeResponse, error) { - out := new(GetMaxSizeResponse) - err := c.cc.Invoke(ctx, ChainReader_GetMaxSize_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - // ChainReaderServer is the server API for ChainReader service. // All implementations must embed UnimplementedChainReaderServer // for forward compatibility type ChainReaderServer interface { GetLatestValue(context.Context, *GetLatestValueRequest) (*GetLatestValueReply, error) - GetEncoding(context.Context, *GetEncodingRequest) (*GetEncodingResponse, error) - GetDecoding(context.Context, *GetDecodingRequest) (*GetDecodingResponse, error) - GetMaxSize(context.Context, *GetMaxSizeRequest) (*GetMaxSizeResponse, error) mustEmbedUnimplementedChainReaderServer() } @@ -1099,15 +1063,6 @@ type UnimplementedChainReaderServer struct { func (UnimplementedChainReaderServer) GetLatestValue(context.Context, *GetLatestValueRequest) (*GetLatestValueReply, error) { return nil, status.Errorf(codes.Unimplemented, "method GetLatestValue not implemented") } -func (UnimplementedChainReaderServer) GetEncoding(context.Context, *GetEncodingRequest) (*GetEncodingResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetEncoding not implemented") -} -func (UnimplementedChainReaderServer) GetDecoding(context.Context, *GetDecodingRequest) (*GetDecodingResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetDecoding not implemented") -} -func (UnimplementedChainReaderServer) GetMaxSize(context.Context, *GetMaxSizeRequest) (*GetMaxSizeResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetMaxSize not implemented") -} func (UnimplementedChainReaderServer) mustEmbedUnimplementedChainReaderServer() {} // UnsafeChainReaderServer may be embedded to opt out of forward compatibility for this service. @@ -1139,60 +1094,6 @@ func _ChainReader_GetLatestValue_Handler(srv interface{}, ctx context.Context, d return interceptor(ctx, in, info, handler) } -func _ChainReader_GetEncoding_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetEncodingRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ChainReaderServer).GetEncoding(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: ChainReader_GetEncoding_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ChainReaderServer).GetEncoding(ctx, req.(*GetEncodingRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _ChainReader_GetDecoding_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetDecodingRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ChainReaderServer).GetDecoding(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: ChainReader_GetDecoding_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ChainReaderServer).GetDecoding(ctx, req.(*GetDecodingRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _ChainReader_GetMaxSize_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetMaxSizeRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ChainReaderServer).GetMaxSize(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: ChainReader_GetMaxSize_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ChainReaderServer).GetMaxSize(ctx, req.(*GetMaxSizeRequest)) - } - return interceptor(ctx, in, info, handler) -} - // ChainReader_ServiceDesc is the grpc.ServiceDesc for ChainReader service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -1204,18 +1105,6 @@ var ChainReader_ServiceDesc = grpc.ServiceDesc{ MethodName: "GetLatestValue", Handler: _ChainReader_GetLatestValue_Handler, }, - { - MethodName: "GetEncoding", - Handler: _ChainReader_GetEncoding_Handler, - }, - { - MethodName: "GetDecoding", - Handler: _ChainReader_GetDecoding_Handler, - }, - { - MethodName: "GetMaxSize", - Handler: _ChainReader_GetMaxSize_Handler, - }, }, Streams: []grpc.StreamDesc{}, Metadata: "relayer.proto", diff --git a/pkg/types/chain_reader.go b/pkg/types/chain_reader.go index 1012be977..750e10283 100644 --- a/pkg/types/chain_reader.go +++ b/pkg/types/chain_reader.go @@ -7,12 +7,6 @@ import ( // Errors exposed to product plugins -type InvalidEncodingError struct{} - -func (InvalidEncodingError) Error() string { - return "cannot decode bytes" -} - type InvalidTypeError struct{} func (InvalidTypeError) Error() string { @@ -25,18 +19,6 @@ func (FieldNotFoundError) Error() string { return "field not found" } -type WrongNumberOfElements struct{} - -func (WrongNumberOfElements) Error() string { - return "wrong number of elements decoded" -} - -type NotASliceError struct{} - -func (NotASliceError) Error() string { - return "input is not a slice or array" -} - // Errors used only by relay plugins type ErrorChainReaderUnsupported struct{} @@ -60,7 +42,6 @@ func (e ErrorChainReaderInvalidConfig) Error() string { type ChainReader interface { // returnVal should satisfy Marshaller interface GetLatestValue(ctx context.Context, bc BoundContract, method string, params, returnVal any) error - Codec } type BoundContract struct { diff --git a/pkg/types/codec.go b/pkg/types/codec.go deleted file mode 100644 index ed81700b6..000000000 --- a/pkg/types/codec.go +++ /dev/null @@ -1,39 +0,0 @@ -package types - -import ( - "context" - - "github.com/smartcontractkit/libocr/offchainreporting2plus/types" -) - -type Encoder interface { - Encode(ctx context.Context, item any, itemType string) (types.Report, error) - // GetMaxEncodingSize returns the max size in bytes if n elements are supplied for all top level dynamically sized elements. - // If no elements are dynamically sized, the returned value will be the same for all n. - // If there are multiple levels of dynamically sized elements, or itemType cannot be found, - // InvalidTypeError will be returned. - GetMaxEncodingSize(ctx context.Context, n int, itemType string) (int, error) -} - -type Decoder interface { - Decode(ctx context.Context, raw []byte, into any, itemType string) error - // GetMaxDecodingSize returns the max size in bytes if n elements are supplied for all top level dynamically sized elements. - // If no elements are dynamically sized, the returned value will be the same for all n. - // If there are multiple levels of dynamically sized elements, or itemType cannot be found, - // InvalidTypeError will be returned. - GetMaxDecodingSize(ctx context.Context, n int, itemType string) (int, error) -} - -type Codec interface { - Encoder - Decoder -} - -type TypeProvider interface { - CreateType(itemType string, forceSlice, forEncoding bool) (any, error) -} - -type RemoteCodec interface { - Codec - TypeProvider -} diff --git a/pkg/types/interfacetests/README.md b/pkg/types/interfacetests/README.md deleted file mode 100644 index 677c8eb8d..000000000 --- a/pkg/types/interfacetests/README.md +++ /dev/null @@ -1,3 +0,0 @@ -This folder contains tests for interfaces that should be run by all implementations. - -Note that this kind of testing is normally called *contract testing*, but that term is overloaded in the smartcontractkit repositories to refer to tests for smart contracts. As such, we will be calling it *interface testing*, although that term sometimes refers to a slightly different kind of test, we feel that it accurately represents what we are testing and will cause less confusion overall. \ No newline at end of file diff --git a/pkg/types/interfacetests/chain_reader_interface_tests.go b/pkg/types/interfacetests/chain_reader_interface_tests.go new file mode 100644 index 000000000..4cb3f09ba --- /dev/null +++ b/pkg/types/interfacetests/chain_reader_interface_tests.go @@ -0,0 +1,162 @@ +package interfacetests + +import ( + "context" + "fmt" + "math/big" + "sort" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "github.com/smartcontractkit/libocr/commontypes" + + "github.com/smartcontractkit/chainlink-relay/pkg/types" +) + +type ChainReaderInterfaceTester interface { + Setup(t *testing.T) + Teardown(t *testing.T) + Name() string + GetAccountBytes(i int) []byte + GetChainReader(t *testing.T) types.ChainReader + + // SetLatestValue is expected to return the same bound contract and method in the same test + // Any setup required for this should be done in Setup. + // The contract should take a LatestParams as the params and return the nth TestStruct set + SetLatestValue(ctx context.Context, t *testing.T, testStruct *TestStruct) types.BoundContract + GetPrimitiveContract(ctx context.Context, t *testing.T) types.BoundContract + GetSliceContract(ctx context.Context, t *testing.T) types.BoundContract +} + +const ( + AnyValueToReadWithoutAnArgument = uint64(3) + MethodTakingLatestParamsReturningTestStruct = "GetLatestValues" + MethodReturningUint64 = "GetPrimitiveValue" + MethodReturningUint64Slice = "GetSliceValue" +) + +var AnySliceToReadWithoutAnArgument = []uint64{3, 4} + +// RunChainReaderInterfaceTests uses TestStruct and TestStructWithSpecialFields +func RunChainReaderInterfaceTests(t *testing.T, tester ChainReaderInterfaceTester) { + ctx := context.Background() + tests := map[string]func(t *testing.T){ + "Gets the latest value": func(t *testing.T) { + firstItem := CreateTestStruct(0, tester.GetAccountBytes) + bc := tester.SetLatestValue(ctx, t, &firstItem) + secondItem := CreateTestStruct(1, tester.GetAccountBytes) + tester.SetLatestValue(ctx, t, &secondItem) + + cr := tester.GetChainReader(t) + actual := &TestStruct{} + params := &LatestParams{I: 1} + + require.NoError(t, cr.GetLatestValue(ctx, bc, MethodTakingLatestParamsReturningTestStruct, params, actual)) + assert.Equal(t, &firstItem, actual) + + params.I = 2 + actual = &TestStruct{} + require.NoError(t, cr.GetLatestValue(ctx, bc, MethodTakingLatestParamsReturningTestStruct, params, actual)) + assert.Equal(t, &secondItem, actual) + }, + "Get latest value without arguments and with primitive return": func(t *testing.T) { + bc := tester.GetPrimitiveContract(ctx, t) + + cr := tester.GetChainReader(t) + + var prim uint64 + require.NoError(t, cr.GetLatestValue(ctx, bc, MethodReturningUint64, nil, &prim)) + + assert.Equal(t, AnyValueToReadWithoutAnArgument, prim) + }, + "Get latest value without arguments and with slice return": func(t *testing.T) { + bc := tester.GetSliceContract(ctx, t) + + cr := tester.GetChainReader(t) + + var slice []uint64 + require.NoError(t, cr.GetLatestValue(ctx, bc, MethodReturningUint64Slice, nil, &slice)) + + assert.Equal(t, AnySliceToReadWithoutAnArgument, slice) + }, + } + + runTests(t, tester, tests) +} + +func runTests(t *testing.T, tester ChainReaderInterfaceTester, tests map[string]func(t *testing.T)) { + // Order the tests for consistency + testNames := make([]string, 0, len(tests)) + for name := range tests { + testNames = append(testNames, name) + } + sort.Strings(testNames) + + for i := 0; i < len(testNames); i++ { + name := testNames[i] + t.Run(name, func(t *testing.T) { + tester.Setup(t) + defer func() { tester.Teardown(t) }() + tests[name](t) + }) + } +} + +type InnerTestStruct struct { + I int + S string +} + +type MidLevelTestStruct struct { + FixedBytes [2]byte + Inner InnerTestStruct +} + +type TestStruct struct { + Field int32 + DifferentField string + OracleId commontypes.OracleID + OracleIds [32]commontypes.OracleID + Account []byte + Accounts [][]byte + BigField *big.Int + NestedStruct MidLevelTestStruct +} + +// compatibleTestStruct has fields in a different order +type compatibleTestStruct struct { + Account []byte + Accounts [][]byte + BigField *big.Int + DifferentField string + Field int32 + NestedStruct MidLevelTestStruct + OracleId commontypes.OracleID + OracleIds [32]commontypes.OracleID +} + +type LatestParams struct { + I int +} + +func CreateTestStruct(i int, accGen func(int) []byte) TestStruct { + s := fmt.Sprintf("field%v", i) + return TestStruct{ + Field: int32(i), + DifferentField: s, + OracleId: commontypes.OracleID(i + 1), + OracleIds: [32]commontypes.OracleID{commontypes.OracleID(i + 2), commontypes.OracleID(i + 3)}, + Account: accGen(i + 3), + Accounts: [][]byte{accGen(i + 4), accGen(i + 5)}, + BigField: big.NewInt(int64((i + 1) * (i + 2))), + NestedStruct: MidLevelTestStruct{ + FixedBytes: [2]byte{uint8(i), uint8(i + 1)}, + Inner: InnerTestStruct{ + I: i, + S: s, + }, + }, + } +} diff --git a/pkg/types/interfacetests/codec_interface_tests.go b/pkg/types/interfacetests/codec_interface_tests.go deleted file mode 100644 index 0d8d52400..000000000 --- a/pkg/types/interfacetests/codec_interface_tests.go +++ /dev/null @@ -1,377 +0,0 @@ -package interfacetests - -import ( - "context" - "fmt" - "math/big" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/smartcontractkit/libocr/commontypes" - ocrTypes "github.com/smartcontractkit/libocr/offchainreporting2/types" - - "github.com/smartcontractkit/chainlink-relay/pkg/types" -) - -type EncodeRequest struct { - TestStructs []TestStruct - ExtraField bool - MissingField bool - TestOn string -} - -type ChainReaderInterfaceTester interface { - Setup(t *testing.T) - Teardown(t *testing.T) - Name() string - EncodeFields(t *testing.T, request *EncodeRequest) ocrTypes.Report - GetAccountBytes(i int) []byte - GetChainReader(t *testing.T) types.ChainReader - - // IncludeArrayEncodingSizeEnforcement is here in case there's no way to have fixed arrays in the encoded values - IncludeArrayEncodingSizeEnforcement() bool - - // SetLatestValue is expected to return the same bound contract and method in the same test - // Any setup required for this should be done in Setup. - // The contract should take a LatestParams as the params and return the nth TestStruct set - SetLatestValue(t *testing.T, testStruct *TestStruct) (types.BoundContract, string) -} - -const ( - TestItemType = "TestItem" - TestItemSliceType = "TestItemSliceType" - TestItemArray1Type = "TestItemArray1Type" - TestItemArray2Type = "TestItemArray2Type" -) - -// RunChainReaderInterfaceTests uses TestStruct and TestStructWithSpecialFields -func RunChainReaderInterfaceTests(t *testing.T, tester ChainReaderInterfaceTester) { - ctx := context.Background() - tests := map[string]func(t *testing.T){ - "Encodes and decodes a single item": func(t *testing.T) { - item := CreateTestStruct(0, tester.GetAccountBytes) - req := &EncodeRequest{TestStructs: []TestStruct{item}, TestOn: TestItemType} - resp := tester.EncodeFields(t, req) - - codec := tester.GetChainReader(t) - actualEncoding, err := codec.Encode(ctx, item, TestItemType) - require.NoError(t, err) - assert.Equal(t, resp, actualEncoding) - - into := TestStruct{} - require.NoError(t, codec.Decode(ctx, actualEncoding, &into, TestItemType)) - assert.Equal(t, item, into) - }, - "Encodes compatible types": func(t *testing.T) { - item := CreateTestStruct(0, tester.GetAccountBytes) - req := &EncodeRequest{TestStructs: []TestStruct{item}, TestOn: TestItemType} - resp := tester.EncodeFields(t, req) - compatibleItem := compatibleTestStruct{ - Account: item.Account, - Accounts: item.Accounts, - BigField: item.BigField, - DifferentField: item.DifferentField, - Field: item.Field, - NestedStruct: item.NestedStruct, - OracleId: item.OracleId, - OracleIds: item.OracleIds, - } - - codec := tester.GetChainReader(t) - actualEncoding, err := codec.Encode(ctx, compatibleItem, TestItemType) - require.NoError(t, err) - assert.Equal(t, resp, actualEncoding) - - into := TestStruct{} - require.NoError(t, codec.Decode(ctx, actualEncoding, &into, TestItemType)) - assert.Equal(t, item, into) - }, - "Encodes compatible maps": func(t *testing.T) { - item := CreateTestStruct(0, tester.GetAccountBytes) - req := &EncodeRequest{TestStructs: []TestStruct{item}, TestOn: TestItemType} - resp := tester.EncodeFields(t, req) - compatibleMap := map[string]any{ - "Account": item.Account, - "Accounts": item.Accounts, - "BigField": item.BigField, - "DifferentField": item.DifferentField, - "Field": item.Field, - "NestedStruct": map[string]any{ - // since we're testing compatibility, also use slice instead of array - "FixedBytes": item.NestedStruct.FixedBytes[:], - "Inner": map[string]any{ - "I": item.NestedStruct.Inner.I, - "S": item.NestedStruct.Inner.S, - }, - }, - "OracleId": item.OracleId, - "OracleIds": item.OracleIds, - } - - codec := tester.GetChainReader(t) - actualEncoding, err := codec.Encode(ctx, compatibleMap, TestItemType) - require.NoError(t, err) - assert.Equal(t, resp, actualEncoding) - - into := TestStruct{} - require.NoError(t, codec.Decode(ctx, actualEncoding, &into, TestItemType)) - assert.Equal(t, item, into) - }, - "Encodes and decodes a slice": func(t *testing.T) { - item1 := CreateTestStruct(0, tester.GetAccountBytes) - item2 := CreateTestStruct(1, tester.GetAccountBytes) - items := []TestStruct{item1, item2} - req := &EncodeRequest{TestStructs: items, TestOn: TestItemSliceType} - resp := tester.EncodeFields(t, req) - - codec := tester.GetChainReader(t) - actualEncoding, err := codec.Encode(ctx, items, TestItemSliceType) - require.NoError(t, err) - assert.Equal(t, resp, actualEncoding) - - var into []TestStruct - require.NoError(t, codec.Decode(ctx, actualEncoding, &into, TestItemSliceType)) - assert.Equal(t, items, into) - }, - "Encodes and decodes a slices with one element": func(t *testing.T) { - item1 := CreateTestStruct(0, tester.GetAccountBytes) - items := []TestStruct{item1} - req := &EncodeRequest{TestStructs: items, TestOn: TestItemSliceType} - resp := tester.EncodeFields(t, req) - - codec := tester.GetChainReader(t) - actualEncoding, err := codec.Encode(ctx, items, TestItemSliceType) - - require.NoError(t, err) - assert.Equal(t, resp, actualEncoding) - - var into []TestStruct - require.NoError(t, codec.Decode(ctx, actualEncoding, &into, TestItemSliceType)) - assert.Equal(t, items, into) - }, - "Encodes and decodes an array": func(t *testing.T) { - item1 := CreateTestStruct(0, tester.GetAccountBytes) - item2 := CreateTestStruct(1, tester.GetAccountBytes) - items := [2]TestStruct{item1, item2} - req := &EncodeRequest{TestStructs: items[:], TestOn: TestItemArray2Type} - resp := tester.EncodeFields(t, req) - - codec := tester.GetChainReader(t) - actualEncoding, err := codec.Encode(ctx, items, TestItemArray2Type) - - require.NoError(t, err) - assert.Equal(t, resp, actualEncoding) - - var into [2]TestStruct - require.NoError(t, codec.Decode(ctx, actualEncoding, &into, TestItemArray2Type)) - assert.Equal(t, items, into) - }, - "Encodes and decodes a arrays with one element": func(t *testing.T) { - item1 := CreateTestStruct(0, tester.GetAccountBytes) - items := [1]TestStruct{item1} - req := &EncodeRequest{TestStructs: items[:], TestOn: TestItemArray1Type} - resp := tester.EncodeFields(t, req) - - codec := tester.GetChainReader(t) - actualEncoding, err := codec.Encode(ctx, items, TestItemArray1Type) - - require.NoError(t, err) - assert.Equal(t, resp, actualEncoding) - - var into [1]TestStruct - require.NoError(t, codec.Decode(ctx, actualEncoding, &into, TestItemArray1Type)) - assert.Equal(t, items, into) - }, - "Returns an error if type is undefined": func(t *testing.T) { - item := CreateTestStruct(0, tester.GetAccountBytes) - codec := tester.GetChainReader(t) - - _, err := codec.Encode(ctx, item, "NOT"+TestItemType) - assert.IsType(t, types.InvalidTypeError{}, err) - - err = codec.Decode(ctx, []byte(""), item, "NOT"+TestItemType) - assert.IsType(t, types.InvalidTypeError{}, err) - }, - "Returns an error encoding if arrays are the too small to encode": func(t *testing.T) { - if !tester.IncludeArrayEncodingSizeEnforcement() { - return - } - - item1 := CreateTestStruct(0, tester.GetAccountBytes) - items := [1]TestStruct{item1} - codec := tester.GetChainReader(t) - - _, err := codec.Encode(ctx, items, TestItemArray2Type) - assert.IsType(t, types.InvalidTypeError{}, err) - }, - "Returns an error encoding if arrays are the too large to encode": func(t *testing.T) { - if !tester.IncludeArrayEncodingSizeEnforcement() { - return - } - - item1 := CreateTestStruct(0, tester.GetAccountBytes) - item2 := CreateTestStruct(1, tester.GetAccountBytes) - items := [2]TestStruct{item1, item2} - codec := tester.GetChainReader(t) - - _, err := codec.Encode(ctx, items, TestItemArray1Type) - assert.IsType(t, types.InvalidTypeError{}, err) - }, - "Gets the latest value": func(t *testing.T) { - firstItem := CreateTestStruct(0, tester.GetAccountBytes) - bc, method := tester.SetLatestValue(t, &firstItem) - secondItem := CreateTestStruct(1, tester.GetAccountBytes) - tester.SetLatestValue(t, &secondItem) - - cr := tester.GetChainReader(t) - actual := &TestStruct{} - params := &LatestParams{I: 1} - - require.NoError(t, cr.GetLatestValue(ctx, bc, method, params, actual)) - assert.Equal(t, &firstItem, actual) - - params.I = 2 - actual = &TestStruct{} - require.NoError(t, cr.GetLatestValue(ctx, bc, method, params, actual)) - assert.Equal(t, &secondItem, actual) - }, - "GetMaxEncodingSize returns errors for unknown types": func(t *testing.T) { - cr := tester.GetChainReader(t) - _, err := cr.GetMaxEncodingSize(ctx, 10, "not"+TestItemType) - assert.IsType(t, types.InvalidTypeError{}, err) - }, - } - - runTests(t, tester, tests) -} - -// RunChainReaderWithStrictArgsInterfaceTest is meant to be used by codecs that don't pad -// They can assure that the right argument size is verified. -// Padding makes that harder/impossible to verify for come codecs. -// However, the extra verification is nice to have when possible. -func RunChainReaderWithStrictArgsInterfaceTest(t *testing.T, tester ChainReaderInterfaceTester) { - ctx := context.Background() - RunChainReaderInterfaceTests(t, tester) - - tests := map[string]func(t *testing.T){ - "Gives an error decoding extra fields on an item": func(t *testing.T) { - item := CreateTestStruct(0, tester.GetAccountBytes) - req := &EncodeRequest{ - TestStructs: []TestStruct{item}, - ExtraField: true, - TestOn: TestItemType, - } - resp := tester.EncodeFields(t, req) - codec := tester.GetChainReader(t) - err := codec.Decode(ctx, resp, &item, TestItemType) - assert.IsType(t, types.InvalidEncodingError{}, err) - }, - "Gives an error decoding missing fields on an item": func(t *testing.T) { - item := CreateTestStruct(0, tester.GetAccountBytes) - req := &EncodeRequest{ - TestStructs: []TestStruct{item}, - MissingField: true, - TestOn: TestItemType, - } - resp := tester.EncodeFields(t, req) - codec := tester.GetChainReader(t) - err := codec.Decode(ctx, resp, &item, TestItemType) - assert.IsType(t, types.InvalidEncodingError{}, err) - }, - "Gives an error decoding extra fields on a slice": func(t *testing.T) { - items := []TestStruct{CreateTestStruct(0, tester.GetAccountBytes)} - req := &EncodeRequest{ - TestStructs: items, - ExtraField: true, - TestOn: TestItemSliceType, - } - resp := tester.EncodeFields(t, req) - codec := tester.GetChainReader(t) - err := codec.Decode(ctx, resp, &items, TestItemSliceType) - assert.IsType(t, types.InvalidEncodingError{}, err) - }, - "Gives an error decoding missing fields on an slice": func(t *testing.T) { - items := []TestStruct{CreateTestStruct(0, tester.GetAccountBytes)} - req := &EncodeRequest{ - TestStructs: items, - MissingField: true, - TestOn: TestItemSliceType, - } - resp := tester.EncodeFields(t, req) - codec := tester.GetChainReader(t) - err := codec.Decode(ctx, resp, &items, TestItemSliceType) - assert.IsType(t, types.InvalidEncodingError{}, err) - }, - } - - runTests(t, tester, tests) -} - -func runTests(t *testing.T, tester ChainReaderInterfaceTester, tests map[string]func(t *testing.T)) { - for name, test := range tests { - t.Run(name, func(t *testing.T) { - tester.Setup(t) - defer func() { tester.Teardown(t) }() - test(t) - }) - } -} - -type InnerTestStruct struct { - I int - S string -} - -type MidLevelTestStruct struct { - FixedBytes [2]byte - Inner InnerTestStruct -} - -type TestStruct struct { - Field int32 - DifferentField string - OracleId commontypes.OracleID - OracleIds [32]commontypes.OracleID - Account []byte - Accounts [][]byte - BigField *big.Int - NestedStruct MidLevelTestStruct -} - -// compatibleTestStruct has fields in a different order -type compatibleTestStruct struct { - Account []byte - Accounts [][]byte - BigField *big.Int - DifferentField string - Field int32 - NestedStruct MidLevelTestStruct - OracleId commontypes.OracleID - OracleIds [32]commontypes.OracleID -} - -type LatestParams struct { - I int -} - -func CreateTestStruct(i int, accGen func(int) []byte) TestStruct { - s := fmt.Sprintf("field%v", i) - return TestStruct{ - Field: int32(i), - DifferentField: s, - OracleId: commontypes.OracleID(i + 1), - OracleIds: [32]commontypes.OracleID{commontypes.OracleID(i + 2), commontypes.OracleID(i + 3)}, - Account: accGen(i + 3), - Accounts: [][]byte{accGen(i + 4), accGen(i + 5)}, - BigField: big.NewInt(int64((i + 1) * (i + 2))), - NestedStruct: MidLevelTestStruct{ - FixedBytes: [2]byte{uint8(i), uint8(i + 1)}, - Inner: InnerTestStruct{ - I: i, - S: s, - }, - }, - } -} diff --git a/pkg/types/map_decoder.go b/pkg/types/map_decoder.go deleted file mode 100644 index f872b200c..000000000 --- a/pkg/types/map_decoder.go +++ /dev/null @@ -1,13 +0,0 @@ -package types - -import "context" - -type MapDecoder interface { - DecodeSingle(ctx context.Context, raw []byte, itemType string) (map[string]any, error) - DecodeMany(ctx context.Context, raw []byte, itemType string) ([]map[string]any, error) - // GetMaxDecodingSize returns the max size in bytes if n elements are supplied for all top level dynamically sized elements. - // If no elements are dynamically sized, the returned value will be the same for all n. - // If there are multiple levels of dynamically sized elements, or itemType cannot be found, - // InvalidTypeError will be returned. - GetMaxDecodingSize(ctx context.Context, n int, itemType string) (int, error) -}