diff --git a/errors.go b/errors.go new file mode 100644 index 0000000..fb84c79 --- /dev/null +++ b/errors.go @@ -0,0 +1,133 @@ +package da + +import ( + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + pbda "github.com/rollkit/go-da/types/pb/da" +) + +// Code defines error codes for JSON-RPC. +// +// They are reused for gRPC +type Code int + +// gRPC checks for GRPCStatus method on errors to enable advanced error handling. + +// Codes are used by JSON-RPC client and server +const ( + CodeBlobNotFound Code = 32001 + CodeBlobSizeOverLimit Code = 32002 + CodeTxTimedOut Code = 32003 + CodeTxAlreadyInMempool Code = 32004 + CodeTxIncorrectAccountSequence Code = 32005 + CodeTxTooLarge Code = 32006 + CodeContextDeadline Code = 32007 + CodeFutureHeight Code = 32008 +) + +// ErrBlobNotFound is used to indicate that the blob was not found. +type ErrBlobNotFound struct{} + +func (e *ErrBlobNotFound) Error() string { + return "blob: not found" +} + +// GRPCStatus returns the gRPC status with details for an ErrBlobNotFound error. +func (e *ErrBlobNotFound) GRPCStatus() *status.Status { + return getGRPCStatus(e, codes.NotFound, pbda.ErrorCode_ERROR_CODE_BLOB_NOT_FOUND) +} + +// ErrBlobSizeOverLimit is used to indicate that the blob size is over limit. +type ErrBlobSizeOverLimit struct{} + +func (e *ErrBlobSizeOverLimit) Error() string { + return "blob: over size limit" +} + +// GRPCStatus returns the gRPC status with details for an ErrBlobSizeOverLimit error. +func (e *ErrBlobSizeOverLimit) GRPCStatus() *status.Status { + return getGRPCStatus(e, codes.ResourceExhausted, pbda.ErrorCode_ERROR_CODE_BLOB_SIZE_OVER_LIMIT) +} + +// ErrTxTimedOut is the error message returned by the DA when mempool is congested. +type ErrTxTimedOut struct{} + +func (e *ErrTxTimedOut) Error() string { + return "timed out waiting for tx to be included in a block" +} + +// GRPCStatus returns the gRPC status with details for an ErrTxTimedOut error. +func (e *ErrTxTimedOut) GRPCStatus() *status.Status { + return getGRPCStatus(e, codes.DeadlineExceeded, pbda.ErrorCode_ERROR_CODE_TX_TIMED_OUT) +} + +// ErrTxAlreadyInMempool is the error message returned by the DA when tx is already in mempool. +type ErrTxAlreadyInMempool struct{} + +func (e *ErrTxAlreadyInMempool) Error() string { + return "tx already in mempool" +} + +// GRPCStatus returns the gRPC status with details for an ErrTxAlreadyInMempool error. +func (e *ErrTxAlreadyInMempool) GRPCStatus() *status.Status { + return getGRPCStatus(e, codes.AlreadyExists, pbda.ErrorCode_ERROR_CODE_TX_ALREADY_IN_MEMPOOL) +} + +// ErrTxIncorrectAccountSequence is the error message returned by the DA when tx has incorrect sequence. +type ErrTxIncorrectAccountSequence struct{} + +func (e *ErrTxIncorrectAccountSequence) Error() string { + return "incorrect account sequence" +} + +// GRPCStatus returns the gRPC status with details for an ErrTxIncorrectAccountSequence error. +func (e *ErrTxIncorrectAccountSequence) GRPCStatus() *status.Status { + return getGRPCStatus(e, codes.InvalidArgument, pbda.ErrorCode_ERROR_CODE_TX_INCORRECT_ACCOUNT_SEQUENCE) +} + +// ErrTxTooLarge is the err message returned by the DA when tx size is too large. +type ErrTxTooLarge struct{} + +func (e *ErrTxTooLarge) Error() string { + return "tx too large" +} + +// GRPCStatus returns the gRPC status with details for an ErrTxTooLarge error. +func (e *ErrTxTooLarge) GRPCStatus() *status.Status { + return getGRPCStatus(e, codes.ResourceExhausted, pbda.ErrorCode_ERROR_CODE_TX_TOO_LARGE) +} + +// ErrContextDeadline is the error message returned by the DA when context deadline exceeds. +type ErrContextDeadline struct{} + +func (e *ErrContextDeadline) Error() string { + return "context deadline" +} + +// GRPCStatus returns the gRPC status with details for an ErrContextDeadline error. +func (e *ErrContextDeadline) GRPCStatus() *status.Status { + return getGRPCStatus(e, codes.DeadlineExceeded, pbda.ErrorCode_ERROR_CODE_CONTEXT_DEADLINE) +} + +// ErrFutureHeight is returned when requested height is from the future +type ErrFutureHeight struct{} + +func (e *ErrFutureHeight) Error() string { + return "given height is from the future" +} + +// GRPCStatus returns the gRPC status with details for an ErrFutureHeight error. +func (e *ErrFutureHeight) GRPCStatus() *status.Status { + return getGRPCStatus(e, codes.OutOfRange, pbda.ErrorCode_ERROR_CODE_FUTURE_HEIGHT) +} + +// getGRPCStatus constructs a gRPC status with error details based on the provided error, gRPC code, and DA error code. +func getGRPCStatus(err error, grpcCode codes.Code, daCode pbda.ErrorCode) *status.Status { + base := status.New(grpcCode, err.Error()) + detailed, err := base.WithDetails(&pbda.ErrorDetails{Code: daCode}) + if err != nil { + return base + } + return detailed +} diff --git a/proto/da/da.proto b/proto/da/da.proto index de3ab40..1b2fff7 100644 --- a/proto/da/da.proto +++ b/proto/da/da.proto @@ -130,3 +130,19 @@ message ValidateRequest { message ValidateResponse { repeated bool results = 1; } + +enum ErrorCode { + ERROR_CODE_UNSPECIFIED = 0; + ERROR_CODE_BLOB_NOT_FOUND = 32001; + ERROR_CODE_BLOB_SIZE_OVER_LIMIT = 32002; + ERROR_CODE_TX_TIMED_OUT = 32003; + ERROR_CODE_TX_ALREADY_IN_MEMPOOL = 32004; + ERROR_CODE_TX_INCORRECT_ACCOUNT_SEQUENCE = 32005; + ERROR_CODE_TX_TOO_LARGE = 32006; + ERROR_CODE_CONTEXT_DEADLINE = 32007; + ERROR_CODE_FUTURE_HEIGHT = 32008; +} + +message ErrorDetails { + ErrorCode code = 1; +} \ No newline at end of file diff --git a/proxy/grpc/client.go b/proxy/grpc/client.go index 3babea8..39dc0cc 100644 --- a/proxy/grpc/client.go +++ b/proxy/grpc/client.go @@ -43,7 +43,7 @@ func (c *Client) MaxBlobSize(ctx context.Context) (uint64, error) { req := &pbda.MaxBlobSizeRequest{} resp, err := c.client.MaxBlobSize(ctx, req) if err != nil { - return 0, err + return 0, tryToMapError(err) } return resp.MaxBlobSize, nil } @@ -59,7 +59,7 @@ func (c *Client) Get(ctx context.Context, ids []da.ID, namespace da.Namespace) ( } resp, err := c.client.Get(ctx, req) if err != nil { - return nil, err + return nil, tryToMapError(err) } return blobsPB2DA(resp.Blobs), nil @@ -70,7 +70,7 @@ func (c *Client) GetIDs(ctx context.Context, height uint64, namespace da.Namespa req := &pbda.GetIdsRequest{Height: height, Namespace: &pbda.Namespace{Value: namespace}} resp, err := c.client.GetIds(ctx, req) if err != nil { - return nil, err + return nil, tryToMapError(err) } timestamp, err := types.TimestampFromProto(resp.Timestamp) @@ -103,7 +103,7 @@ func (c *Client) Commit(ctx context.Context, blobs []da.Blob, namespace da.Names resp, err := c.client.Commit(ctx, req) if err != nil { - return nil, err + return nil, tryToMapError(err) } return commitsPB2DA(resp.Commitments), nil @@ -119,7 +119,7 @@ func (c *Client) Submit(ctx context.Context, blobs []da.Blob, gasPrice float64, resp, err := c.client.Submit(ctx, req) if err != nil { - return nil, err + return nil, tryToMapError(err) } ids := make([]da.ID, len(resp.Ids)) @@ -141,7 +141,7 @@ func (c *Client) SubmitWithOptions(ctx context.Context, blobs []da.Blob, gasPric resp, err := c.client.Submit(ctx, req) if err != nil { - return nil, err + return nil, tryToMapError(err) } ids := make([]da.ID, len(resp.Ids)) @@ -160,5 +160,5 @@ func (c *Client) Validate(ctx context.Context, ids []da.ID, proofs []da.Proof, n Namespace: &pbda.Namespace{Value: namespace}, } resp, err := c.client.Validate(ctx, req) - return resp.Results, err + return resp.Results, tryToMapError(err) } diff --git a/proxy/grpc/errors.go b/proxy/grpc/errors.go new file mode 100644 index 0000000..81fea40 --- /dev/null +++ b/proxy/grpc/errors.go @@ -0,0 +1,53 @@ +package grpc + +import ( + "errors" + + "google.golang.org/grpc/status" + + "github.com/rollkit/go-da" + pbda "github.com/rollkit/go-da/types/pb/da" +) + +func tryToMapError(err error) error { + if err == nil { + return nil + } + + s, ok := status.FromError(err) + if ok { + details := s.Proto().Details + if len(details) == 1 { + var errorDetail pbda.ErrorDetails + unmarshalError := errorDetail.Unmarshal(details[0].Value) + if unmarshalError != nil { + return err + } + return errorForCode(errorDetail.Code) + } + } + return err +} + +func errorForCode(code pbda.ErrorCode) error { + switch code { + case pbda.ErrorCode_ERROR_CODE_BLOB_NOT_FOUND: + return &da.ErrBlobNotFound{} + case pbda.ErrorCode_ERROR_CODE_BLOB_SIZE_OVER_LIMIT: + return &da.ErrBlobSizeOverLimit{} + case pbda.ErrorCode_ERROR_CODE_TX_TIMED_OUT: + return &da.ErrTxTimedOut{} + case pbda.ErrorCode_ERROR_CODE_TX_ALREADY_IN_MEMPOOL: + return &da.ErrTxAlreadyInMempool{} + case pbda.ErrorCode_ERROR_CODE_TX_INCORRECT_ACCOUNT_SEQUENCE: + return &da.ErrTxIncorrectAccountSequence{} + case pbda.ErrorCode_ERROR_CODE_TX_TOO_LARGE: + return &da.ErrTxTooLarge{} + case pbda.ErrorCode_ERROR_CODE_CONTEXT_DEADLINE: + return &da.ErrContextDeadline{} + case pbda.ErrorCode_ERROR_CODE_FUTURE_HEIGHT: + return &da.ErrFutureHeight{} + default: + return errors.New("unknown error code") + } +} diff --git a/proxy/jsonrpc/client.go b/proxy/jsonrpc/client.go index 4e7b192..144dd44 100644 --- a/proxy/jsonrpc/client.go +++ b/proxy/jsonrpc/client.go @@ -109,8 +109,9 @@ func NewClient(ctx context.Context, addr string, token string) (*Client, error) func newClient(ctx context.Context, addr string, authHeader http.Header) (*Client, error) { var multiCloser multiClientCloser var client Client + errs := getKnownErrorsMapping() for name, module := range moduleMap(&client) { - closer, err := jsonrpc.NewClient(ctx, addr, name, module, authHeader) + closer, err := jsonrpc.NewMergeClient(ctx, addr, name, []interface{}{module}, authHeader, jsonrpc.WithErrors(errs)) if err != nil { return nil, err } diff --git a/proxy/jsonrpc/errors.go b/proxy/jsonrpc/errors.go new file mode 100644 index 0000000..2ff4489 --- /dev/null +++ b/proxy/jsonrpc/errors.go @@ -0,0 +1,21 @@ +package jsonrpc + +import ( + "github.com/filecoin-project/go-jsonrpc" + + "github.com/rollkit/go-da" +) + +// getKnownErrorsMapping returns a mapping of known error codes to their corresponding error types. +func getKnownErrorsMapping() jsonrpc.Errors { + errs := jsonrpc.NewErrors() + errs.Register(jsonrpc.ErrorCode(da.CodeBlobNotFound), new(*da.ErrBlobNotFound)) + errs.Register(jsonrpc.ErrorCode(da.CodeBlobSizeOverLimit), new(*da.ErrBlobSizeOverLimit)) + errs.Register(jsonrpc.ErrorCode(da.CodeTxTimedOut), new(*da.ErrTxTimedOut)) + errs.Register(jsonrpc.ErrorCode(da.CodeTxAlreadyInMempool), new(*da.ErrTxAlreadyInMempool)) + errs.Register(jsonrpc.ErrorCode(da.CodeTxIncorrectAccountSequence), new(*da.ErrTxIncorrectAccountSequence)) + errs.Register(jsonrpc.ErrorCode(da.CodeTxTooLarge), new(*da.ErrTxTooLarge)) + errs.Register(jsonrpc.ErrorCode(da.CodeContextDeadline), new(*da.ErrContextDeadline)) + errs.Register(jsonrpc.ErrorCode(da.CodeFutureHeight), new(*da.ErrFutureHeight)) + return errs +} diff --git a/proxy/jsonrpc/server.go b/proxy/jsonrpc/server.go index 92b9864..3afb060 100644 --- a/proxy/jsonrpc/server.go +++ b/proxy/jsonrpc/server.go @@ -32,7 +32,7 @@ func (s *Server) RegisterService(namespace string, service interface{}, out inte // NewServer accepts the host address port and the DA implementation to serve as a jsonrpc service func NewServer(address, port string, DA da.DA) *Server { - rpc := jsonrpc.NewServer() + rpc := jsonrpc.NewServer(jsonrpc.WithServerErrors(getKnownErrorsMapping())) srv := &Server{ rpc: rpc, srv: &http.Server{ diff --git a/test/dummy.go b/test/dummy.go index 8600307..9d678a1 100644 --- a/test/dummy.go +++ b/test/dummy.go @@ -17,9 +17,6 @@ import ( // DefaultMaxBlobSize is the default max blob size const DefaultMaxBlobSize = 64 * 64 * 482 -// ErrTooHigh is returned when requested height is to high -var ErrTooHigh = errors.New("given height is from the future") - // DummyDA is a simple implementation of in-memory DA. Not production ready! Intended only for testing! // // Data is stored in a map, where key is a serialized sequence number. This key is returned as ID. @@ -78,7 +75,7 @@ func (d *DummyDA) Get(ctx context.Context, ids []da.ID, _ da.Namespace) ([]da.Bl } } if !found { - return nil, errors.New("no blob for given ID") + return nil, &da.ErrBlobNotFound{} } } return blobs, nil @@ -90,7 +87,7 @@ func (d *DummyDA) GetIDs(ctx context.Context, height uint64, _ da.Namespace) (*d defer d.mu.Unlock() if height > d.height { - return nil, ErrTooHigh + return nil, &da.ErrFutureHeight{} } kvps, ok := d.data[height] diff --git a/test/test_suite.go b/test/test_suite.go index 9c0cef2..c742751 100644 --- a/test/test_suite.go +++ b/test/test_suite.go @@ -81,8 +81,9 @@ func BasicDATest(t *testing.T, d da.DA) { // CheckErrors ensures that errors are handled properly by DA. func CheckErrors(t *testing.T, d da.DA) { ctx := context.TODO() - blob, err := d.Get(ctx, []da.ID{[]byte("invalid")}, testNamespace) + blob, err := d.Get(ctx, []da.ID{[]byte("invalid blob id")}, testNamespace) assert.Error(t, err) + assert.ErrorIs(t, err, &da.ErrBlobNotFound{}) assert.Empty(t, blob) } @@ -140,7 +141,7 @@ func ConcurrentReadWriteTest(t *testing.T, d da.DA) { for i := uint64(1); i <= 100; i++ { _, err := d.GetIDs(ctx, i, []byte{}) if err != nil { - assert.Equal(t, err.Error(), ErrTooHigh.Error()) + assert.ErrorIs(t, err, &da.ErrFutureHeight{}) } } }() @@ -161,5 +162,6 @@ func HeightFromFutureTest(t *testing.T, d da.DA) { ctx := context.TODO() ret, err := d.GetIDs(ctx, 999999999, []byte{}) assert.Error(t, err) + assert.ErrorIs(t, err, &da.ErrFutureHeight{}) assert.Nil(t, ret) } diff --git a/types/pb/da/da.pb.go b/types/pb/da/da.pb.go index ec3bdfb..0df0c6f 100644 --- a/types/pb/da/da.pb.go +++ b/types/pb/da/da.pb.go @@ -29,6 +29,52 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +type ErrorCode int32 + +const ( + ErrorCode_ERROR_CODE_UNSPECIFIED ErrorCode = 0 + ErrorCode_ERROR_CODE_BLOB_NOT_FOUND ErrorCode = 32001 + ErrorCode_ERROR_CODE_BLOB_SIZE_OVER_LIMIT ErrorCode = 32002 + ErrorCode_ERROR_CODE_TX_TIMED_OUT ErrorCode = 32003 + ErrorCode_ERROR_CODE_TX_ALREADY_IN_MEMPOOL ErrorCode = 32004 + ErrorCode_ERROR_CODE_TX_INCORRECT_ACCOUNT_SEQUENCE ErrorCode = 32005 + ErrorCode_ERROR_CODE_TX_TOO_LARGE ErrorCode = 32006 + ErrorCode_ERROR_CODE_CONTEXT_DEADLINE ErrorCode = 32007 + ErrorCode_ERROR_CODE_FUTURE_HEIGHT ErrorCode = 32008 +) + +var ErrorCode_name = map[int32]string{ + 0: "ERROR_CODE_UNSPECIFIED", + 32001: "ERROR_CODE_BLOB_NOT_FOUND", + 32002: "ERROR_CODE_BLOB_SIZE_OVER_LIMIT", + 32003: "ERROR_CODE_TX_TIMED_OUT", + 32004: "ERROR_CODE_TX_ALREADY_IN_MEMPOOL", + 32005: "ERROR_CODE_TX_INCORRECT_ACCOUNT_SEQUENCE", + 32006: "ERROR_CODE_TX_TOO_LARGE", + 32007: "ERROR_CODE_CONTEXT_DEADLINE", + 32008: "ERROR_CODE_FUTURE_HEIGHT", +} + +var ErrorCode_value = map[string]int32{ + "ERROR_CODE_UNSPECIFIED": 0, + "ERROR_CODE_BLOB_NOT_FOUND": 32001, + "ERROR_CODE_BLOB_SIZE_OVER_LIMIT": 32002, + "ERROR_CODE_TX_TIMED_OUT": 32003, + "ERROR_CODE_TX_ALREADY_IN_MEMPOOL": 32004, + "ERROR_CODE_TX_INCORRECT_ACCOUNT_SEQUENCE": 32005, + "ERROR_CODE_TX_TOO_LARGE": 32006, + "ERROR_CODE_CONTEXT_DEADLINE": 32007, + "ERROR_CODE_FUTURE_HEIGHT": 32008, +} + +func (x ErrorCode) String() string { + return proto.EnumName(ErrorCode_name, int32(x)) +} + +func (ErrorCode) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_feb508392bc12c0f, []int{0} +} + // Namespace is the location for the blob to be submitted to, if supported by the DA layer. type Namespace struct { Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` @@ -956,7 +1002,52 @@ func (m *ValidateResponse) GetResults() []bool { return nil } +type ErrorDetails struct { + Code ErrorCode `protobuf:"varint,1,opt,name=code,proto3,enum=da.ErrorCode" json:"code,omitempty"` +} + +func (m *ErrorDetails) Reset() { *m = ErrorDetails{} } +func (m *ErrorDetails) String() string { return proto.CompactTextString(m) } +func (*ErrorDetails) ProtoMessage() {} +func (*ErrorDetails) Descriptor() ([]byte, []int) { + return fileDescriptor_feb508392bc12c0f, []int{19} +} +func (m *ErrorDetails) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ErrorDetails) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ErrorDetails.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ErrorDetails) XXX_Merge(src proto.Message) { + xxx_messageInfo_ErrorDetails.Merge(m, src) +} +func (m *ErrorDetails) XXX_Size() int { + return m.Size() +} +func (m *ErrorDetails) XXX_DiscardUnknown() { + xxx_messageInfo_ErrorDetails.DiscardUnknown(m) +} + +var xxx_messageInfo_ErrorDetails proto.InternalMessageInfo + +func (m *ErrorDetails) GetCode() ErrorCode { + if m != nil { + return m.Code + } + return ErrorCode_ERROR_CODE_UNSPECIFIED +} + func init() { + proto.RegisterEnum("da.ErrorCode", ErrorCode_name, ErrorCode_value) proto.RegisterType((*Namespace)(nil), "da.Namespace") proto.RegisterType((*Blob)(nil), "da.Blob") proto.RegisterType((*ID)(nil), "da.ID") @@ -976,53 +1067,69 @@ func init() { proto.RegisterType((*SubmitResponse)(nil), "da.SubmitResponse") proto.RegisterType((*ValidateRequest)(nil), "da.ValidateRequest") proto.RegisterType((*ValidateResponse)(nil), "da.ValidateResponse") + proto.RegisterType((*ErrorDetails)(nil), "da.ErrorDetails") } func init() { proto.RegisterFile("da/da.proto", fileDescriptor_feb508392bc12c0f) } var fileDescriptor_feb508392bc12c0f = []byte{ - // 641 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xcd, 0x4f, 0x13, 0x41, - 0x14, 0xef, 0xb6, 0x50, 0xba, 0x6f, 0x6d, 0x81, 0xa1, 0xe2, 0x66, 0xd5, 0x15, 0xe6, 0xd4, 0xf8, - 0x51, 0x14, 0x13, 0xbf, 0x4e, 0x8a, 0x24, 0x0d, 0x07, 0x0d, 0xd9, 0x12, 0x13, 0x13, 0x13, 0x32, - 0x65, 0x87, 0xb2, 0x49, 0xb7, 0xb3, 0x76, 0xa6, 0x84, 0xe0, 0xd9, 0xbb, 0x89, 0xff, 0x94, 0x47, - 0x8e, 0x1e, 0x0d, 0xfc, 0x23, 0x66, 0x76, 0x66, 0x76, 0xbb, 0x90, 0xda, 0x34, 0xf1, 0xf8, 0xbe, - 0x7e, 0xef, 0x37, 0xef, 0xfd, 0xde, 0x80, 0x13, 0x92, 0xad, 0x90, 0xb4, 0x93, 0x11, 0x13, 0x0c, - 0x95, 0x43, 0xe2, 0x3d, 0xe8, 0x33, 0xd6, 0x1f, 0xd0, 0xad, 0xd4, 0xd3, 0x1b, 0x1f, 0x6f, 0x89, - 0x28, 0xa6, 0x5c, 0x90, 0x38, 0x51, 0x49, 0x78, 0x13, 0xec, 0x8f, 0x24, 0xa6, 0x3c, 0x21, 0x47, - 0x14, 0x35, 0x61, 0xf1, 0x94, 0x0c, 0xc6, 0xd4, 0xb5, 0x36, 0xac, 0xd6, 0xad, 0x40, 0x19, 0xf8, - 0x1e, 0x2c, 0xec, 0x0c, 0x58, 0x6f, 0x4a, 0xd4, 0x83, 0xf2, 0xde, 0xee, 0x94, 0x18, 0x06, 0x78, - 0xcf, 0xe2, 0x38, 0x12, 0x31, 0x1d, 0x8a, 0x29, 0x39, 0xf7, 0x61, 0x71, 0x7f, 0xc4, 0xd8, 0xf1, - 0x94, 0x70, 0x13, 0xd0, 0x07, 0x72, 0x26, 0xfb, 0x77, 0xa3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 0xa7, 0x14, 0xae, 0xcb, 0xbb, 0x7d, 0xcd, 0x3b, 0xd9, 0x4e, - 0x09, 0x4e, 0xb5, 0x2b, 0xdc, 0x80, 0x6a, 0x57, 0x14, 0xae, 0x2a, 0x51, 0x2b, 0x57, 0x25, 0x05, - 0x4d, 0xaa, 0x92, 0xa2, 0x22, 0x70, 0x09, 0xbd, 0x84, 0x9a, 0x19, 0x3e, 0x5a, 0x93, 0x19, 0xd7, - 0x74, 0xe0, 0x35, 0x8b, 0x4e, 0x53, 0xb8, 0xe3, 0xfe, 0xba, 0xf4, 0xad, 0x8b, 0x4b, 0xdf, 0xfa, - 0x73, 0xe9, 0x5b, 0x3f, 0xae, 0xfc, 0xd2, 0xc5, 0x95, 0x5f, 0xfa, 0x7d, 0xe5, 0x97, 0x7a, 0xd5, - 0xf4, 0x8b, 0x79, 0xfe, 0x37, 0x00, 0x00, 0xff, 0xff, 0xf0, 0x5c, 0x10, 0x6e, 0xaf, 0x06, 0x00, - 0x00, + // 888 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0x4d, 0x6f, 0xdb, 0x46, + 0x10, 0x15, 0x25, 0x5b, 0xb1, 0x46, 0x91, 0xc2, 0x6c, 0x5c, 0x47, 0x55, 0x1a, 0xd9, 0x5e, 0xa0, + 0x85, 0x90, 0xb6, 0x72, 0xe3, 0x02, 0xfd, 0x3a, 0x55, 0x22, 0xd7, 0x0a, 0x01, 0x89, 0x74, 0x57, + 0x54, 0x90, 0x14, 0x05, 0x16, 0x94, 0xb9, 0x51, 0x08, 0x48, 0xa6, 0x2a, 0x52, 0x41, 0x90, 0x9e, + 0xfa, 0x91, 0xb6, 0xc7, 0x02, 0xfd, 0x53, 0x39, 0xe6, 0xd8, 0x63, 0x61, 0xff, 0x0b, 0x9d, 0x0a, + 0x72, 0x49, 0x8a, 0xb4, 0xab, 0x1a, 0x06, 0x7a, 0xd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0x71, 0x04, 0x91, 0x92, 0xdd, 0x47, 0x9c, 0x43, 0x9f, 0xc3, 0x56, 0x3c, 0xfa, + 0xe8, 0x4e, 0xc0, 0xb8, 0xb0, 0x85, 0xf5, 0xed, 0x6c, 0x30, 0x4e, 0xec, 0xd4, 0xde, 0x9c, 0x35, + 0xa4, 0xb7, 0x67, 0x0d, 0xe9, 0xef, 0xb3, 0x86, 0xf4, 0xc7, 0x79, 0x23, 0xf7, 0xf6, 0xbc, 0x91, + 0xfb, 0xeb, 0xbc, 0x91, 0x1b, 0x15, 0x43, 0x83, 0xff, 0xf4, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, + 0x07, 0xc0, 0x94, 0xa0, 0x2d, 0x08, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -2082,6 +2189,34 @@ func (m *ValidateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *ErrorDetails) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ErrorDetails) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ErrorDetails) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Code != 0 { + i = encodeVarintDa(dAtA, i, uint64(m.Code)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func encodeVarintDa(dAtA []byte, offset int, v uint64) int { offset -= sovDa(v) base := offset @@ -2394,6 +2529,18 @@ func (m *ValidateResponse) Size() (n int) { return n } +func (m *ErrorDetails) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Code != 0 { + n += 1 + sovDa(uint64(m.Code)) + } + return n +} + func sovDa(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -4299,6 +4446,75 @@ func (m *ValidateResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *ErrorDetails) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ErrorDetails: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ErrorDetails: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Code", wireType) + } + m.Code = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Code |= ErrorCode(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipDa(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthDa + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipDa(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0