diff --git a/buf.gen.yaml b/buf.gen.yaml index 70c08eeb..43efaad3 100644 --- a/buf.gen.yaml +++ b/buf.gen.yaml @@ -6,3 +6,15 @@ plugins: - plugin: buf.build/grpc/go out: gen/go opt: paths=source_relative + - plugin: buf.build/grpc-ecosystem/gateway + out: gen/go + opt: + - paths=source_relative + - allow_repeated_fields_in_body=true + - plugin: buf.build/grpc-ecosystem/openapiv2 + out: gen/openapi + opt: + - disable_service_tags=true + - allow_repeated_fields_in_body=true + - output_format=yaml + - omit_enum_default_value=true diff --git a/buf.lock b/buf.lock new file mode 100644 index 00000000..fccbfb89 --- /dev/null +++ b/buf.lock @@ -0,0 +1,13 @@ +# Generated by buf. DO NOT EDIT. +version: v1 +deps: + - remote: buf.build + owner: googleapis + repository: googleapis + commit: 28151c0d0a1641bf938a7672c500e01d + digest: shake256:49215edf8ef57f7863004539deff8834cfb2195113f0b890dd1f67815d9353e28e668019165b9d872395871eeafcbab3ccfdb2b5f11734d3cca95be9e8d139de + - remote: buf.build + owner: grpc-ecosystem + repository: grpc-gateway + commit: 048ae6ff94ca4476b3225904b1078fad + digest: shake256:e5250bf2d999516c02206d757502b902e406f35c099d0e869dc3e4f923f6870fe0805a9974c27df0695462937eae90cd4d9db90bb9a03489412560baa74a87b6 diff --git a/buf.yaml b/buf.yaml new file mode 100644 index 00000000..5590899d --- /dev/null +++ b/buf.yaml @@ -0,0 +1,4 @@ +version: v1 +deps: + - buf.build/googleapis/googleapis + - buf.build/grpc-ecosystem/grpc-gateway diff --git a/gen/go/rpc/builderapi/v1/builderapi.pb.go b/gen/go/rpc/builderapi/v1/builderapi.pb.go index 42f876b0..46ca6f2a 100644 --- a/gen/go/rpc/builderapi/v1/builderapi.pb.go +++ b/gen/go/rpc/builderapi/v1/builderapi.pb.go @@ -7,6 +7,8 @@ package builderapiv1 import ( + _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" + _ "google.golang.org/genproto/googleapis/api/annotations" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -239,39 +241,121 @@ var file_rpc_builderapi_v1_builderapi_proto_rawDesc = []byte{ 0x0a, 0x22, 0x72, 0x70, 0x63, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x11, 0x72, 0x70, 0x63, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, - 0x72, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x22, 0x0e, 0x0a, 0x0c, 0x45, 0x6d, 0x70, 0x74, 0x79, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x7f, 0x0a, 0x03, 0x42, 0x69, 0x64, 0x12, 0x17, - 0x0a, 0x07, 0x74, 0x78, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x06, 0x74, 0x78, 0x48, 0x61, 0x73, 0x68, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x69, 0x64, 0x5f, 0x61, - 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x62, 0x69, 0x64, - 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, - 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x62, 0x6c, - 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x69, 0x64, - 0x5f, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x62, - 0x69, 0x64, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x22, 0xb7, 0x01, 0x0a, 0x0b, 0x42, 0x69, 0x64, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x69, 0x64, 0x5f, - 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x62, 0x69, - 0x64, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x12, 0x3d, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x25, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x62, 0x75, - 0x69, 0x6c, 0x64, 0x65, 0x72, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x69, 0x64, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, - 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x4a, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x12, 0x16, 0x0a, 0x12, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, - 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x53, 0x54, 0x41, 0x54, - 0x55, 0x53, 0x5f, 0x41, 0x43, 0x43, 0x45, 0x50, 0x54, 0x45, 0x44, 0x10, 0x01, 0x12, 0x13, 0x0a, - 0x0f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x52, 0x45, 0x4a, 0x45, 0x43, 0x54, 0x45, 0x44, - 0x10, 0x02, 0x32, 0xaf, 0x01, 0x0a, 0x07, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x12, 0x4a, - 0x0a, 0x0b, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x42, 0x69, 0x64, 0x73, 0x12, 0x1f, 0x2e, - 0x72, 0x70, 0x63, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x31, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x16, - 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x31, 0x2e, 0x42, 0x69, 0x64, 0x22, 0x00, 0x30, 0x01, 0x12, 0x58, 0x0a, 0x11, 0x53, 0x65, - 0x6e, 0x64, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x65, 0x64, 0x42, 0x69, 0x64, 0x73, 0x12, - 0x1e, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x69, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, - 0x1f, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x22, 0x00, 0x28, 0x01, 0x42, 0x45, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x72, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, + 0x67, 0x65, 0x6e, 0x2d, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, 0x6f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x0e, 0x0a, 0x0c, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x4d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0xbd, 0x06, 0x0a, 0x03, 0x42, 0x69, 0x64, 0x12, 0x8f, 0x01, + 0x0a, 0x07, 0x74, 0x78, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x76, 0x92, 0x41, 0x73, 0x32, 0x5f, 0x48, 0x65, 0x78, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, + 0x20, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, + 0x20, 0x68, 0x61, 0x73, 0x68, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, 0x72, 0x61, + 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x74, 0x68, + 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x73, 0x20, 0x74, 0x6f, 0x20, + 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x62, + 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x8a, 0x01, 0x0f, 0x5b, 0x61, 0x2d, 0x66, 0x41, 0x2d, 0x46, 0x30, + 0x2d, 0x39, 0x5d, 0x7b, 0x34, 0x30, 0x7d, 0x52, 0x06, 0x74, 0x78, 0x48, 0x61, 0x73, 0x68, 0x12, + 0x8c, 0x01, 0x0a, 0x0a, 0x62, 0x69, 0x64, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x03, 0x42, 0x6d, 0x92, 0x41, 0x6a, 0x32, 0x68, 0x41, 0x6d, 0x6f, 0x75, 0x6e, + 0x74, 0x20, 0x6f, 0x66, 0x20, 0x45, 0x54, 0x48, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x74, 0x68, + 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x69, 0x73, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x69, 0x6e, + 0x67, 0x20, 0x74, 0x6f, 0x20, 0x70, 0x61, 0x79, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, + 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x69, 0x6e, 0x63, 0x6c, + 0x75, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x62, 0x6c, 0x6f, + 0x63, 0x6b, 0x2e, 0x52, 0x09, 0x62, 0x69, 0x64, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x6b, + 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x03, 0x42, 0x48, 0x92, 0x41, 0x45, 0x32, 0x43, 0x4d, 0x61, 0x78, 0x20, 0x62, + 0x6c, 0x6f, 0x63, 0x6b, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x20, 0x74, 0x68, 0x61, 0x74, + 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x73, 0x20, + 0x74, 0x6f, 0x20, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, + 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x69, 0x6e, 0x2e, 0x52, 0x0b, + 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x51, 0x0a, 0x0a, 0x62, + 0x69, 0x64, 0x5f, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x42, + 0x32, 0x92, 0x41, 0x2f, 0x32, 0x2d, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, + 0x74, 0x68, 0x65, 0x20, 0x62, 0x69, 0x64, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, + 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x73, + 0x65, 0x72, 0x2e, 0x52, 0x09, 0x62, 0x69, 0x64, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x3a, 0xd4, + 0x02, 0x92, 0x41, 0xd0, 0x02, 0x0a, 0x6f, 0x2a, 0x0b, 0x42, 0x69, 0x64, 0x20, 0x6d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x32, 0x2d, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x20, 0x62, 0x69, 0x64, + 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x75, 0x73, + 0x65, 0x72, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x62, 0x75, 0x69, 0x6c, 0x64, + 0x65, 0x72, 0x2e, 0xd2, 0x01, 0x07, 0x74, 0x78, 0x5f, 0x68, 0x61, 0x73, 0x68, 0xd2, 0x01, 0x0a, + 0x62, 0x69, 0x64, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0xd2, 0x01, 0x0c, 0x62, 0x6c, 0x6f, + 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0xd2, 0x01, 0x0a, 0x62, 0x69, 0x64, 0x5f, + 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x32, 0xdc, 0x01, 0x7b, 0x22, 0x74, 0x78, 0x5f, 0x68, 0x61, + 0x73, 0x68, 0x22, 0x3a, 0x20, 0x22, 0x39, 0x31, 0x61, 0x38, 0x39, 0x42, 0x36, 0x33, 0x33, 0x31, + 0x39, 0x34, 0x63, 0x30, 0x44, 0x38, 0x36, 0x43, 0x35, 0x33, 0x39, 0x41, 0x31, 0x41, 0x35, 0x42, + 0x31, 0x34, 0x44, 0x43, 0x43, 0x61, 0x63, 0x66, 0x44, 0x34, 0x37, 0x30, 0x39, 0x34, 0x22, 0x2c, + 0x20, 0x22, 0x62, 0x69, 0x64, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x3a, 0x20, 0x31, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + 0x30, 0x30, 0x2c, 0x20, 0x22, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, + 0x72, 0x22, 0x3a, 0x20, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x2c, 0x20, 0x22, 0x62, 0x69, 0x64, + 0x5f, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x22, 0x3a, 0x20, 0x22, 0x39, 0x64, 0x4a, 0x69, 0x6e, + 0x77, 0x4c, 0x2b, 0x46, 0x5a, 0x36, 0x42, 0x31, 0x78, 0x73, 0x49, 0x51, 0x51, 0x6f, 0x38, 0x74, + 0x38, 0x42, 0x30, 0x5a, 0x58, 0x4a, 0x75, 0x62, 0x4a, 0x77, 0x59, 0x38, 0x36, 0x6c, 0x2f, 0x59, + 0x75, 0x37, 0x79, 0x41, 0x48, 0x31, 0x35, 0x39, 0x51, 0x72, 0x50, 0x48, 0x55, 0x30, 0x71, 0x6a, + 0x32, 0x50, 0x2b, 0x59, 0x46, 0x6a, 0x2b, 0x6c, 0x6c, 0x62, 0x75, 0x49, 0x31, 0x5a, 0x79, 0x67, + 0x64, 0x78, 0x47, 0x73, 0x58, 0x38, 0x2b, 0x50, 0x33, 0x62, 0x79, 0x4d, 0x45, 0x41, 0x35, 0x69, + 0x67, 0x3d, 0x3d, 0x22, 0x7d, 0x22, 0x80, 0x04, 0x0a, 0x0b, 0x42, 0x69, 0x64, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x51, 0x0a, 0x0a, 0x62, 0x69, 0x64, 0x5f, 0x64, 0x69, 0x67, + 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x32, 0x92, 0x41, 0x2f, 0x32, 0x2d, + 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x62, 0x69, + 0x64, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, + 0x20, 0x62, 0x79, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x52, 0x09, 0x62, + 0x69, 0x64, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x12, 0x56, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x25, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x62, + 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x69, 0x64, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x42, + 0x17, 0x92, 0x41, 0x14, 0x32, 0x12, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x20, 0x6f, 0x66, 0x20, + 0x74, 0x68, 0x65, 0x20, 0x62, 0x69, 0x64, 0x2e, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x22, 0x4a, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x54, + 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, + 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x41, 0x43, 0x43, + 0x45, 0x50, 0x54, 0x45, 0x44, 0x10, 0x01, 0x12, 0x13, 0x0a, 0x0f, 0x53, 0x54, 0x41, 0x54, 0x55, + 0x53, 0x5f, 0x52, 0x45, 0x4a, 0x45, 0x43, 0x54, 0x45, 0x44, 0x10, 0x02, 0x3a, 0xf9, 0x01, 0x92, + 0x41, 0xf5, 0x01, 0x0a, 0x69, 0x2a, 0x0c, 0x42, 0x69, 0x64, 0x20, 0x72, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x32, 0x43, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x20, 0x73, 0x65, + 0x6e, 0x74, 0x20, 0x62, 0x79, 0x20, 0x74, 0x68, 0x65, 0x20, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, + 0x72, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x65, 0x63, 0x69, 0x73, + 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x62, 0x69, 0x64, 0x20, 0x72, + 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x2e, 0xd2, 0x01, 0x0a, 0x62, 0x69, 0x64, 0x5f, 0x64, + 0x69, 0x67, 0x65, 0x73, 0x74, 0xd2, 0x01, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x32, 0x87, + 0x01, 0x7b, 0x22, 0x62, 0x69, 0x64, 0x5f, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x22, 0x3a, 0x20, + 0x22, 0x39, 0x64, 0x4a, 0x69, 0x6e, 0x77, 0x4c, 0x2b, 0x46, 0x5a, 0x36, 0x42, 0x31, 0x78, 0x73, + 0x49, 0x51, 0x51, 0x6f, 0x38, 0x74, 0x38, 0x42, 0x30, 0x5a, 0x58, 0x4a, 0x75, 0x62, 0x4a, 0x77, + 0x59, 0x38, 0x36, 0x6c, 0x2f, 0x59, 0x75, 0x37, 0x79, 0x41, 0x48, 0x31, 0x35, 0x39, 0x51, 0x72, + 0x50, 0x48, 0x55, 0x30, 0x71, 0x6a, 0x32, 0x50, 0x2b, 0x59, 0x46, 0x6a, 0x2b, 0x6c, 0x6c, 0x62, + 0x75, 0x49, 0x31, 0x5a, 0x79, 0x67, 0x64, 0x78, 0x47, 0x73, 0x58, 0x38, 0x2b, 0x50, 0x33, 0x62, + 0x79, 0x4d, 0x45, 0x41, 0x35, 0x69, 0x67, 0x3d, 0x3d, 0x22, 0x2c, 0x20, 0x22, 0x73, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x22, 0x3a, 0x20, 0x22, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x41, 0x43, + 0x43, 0x45, 0x50, 0x54, 0x45, 0x44, 0x22, 0x7d, 0x32, 0xfa, 0x01, 0x0a, 0x07, 0x42, 0x75, 0x69, + 0x6c, 0x64, 0x65, 0x72, 0x12, 0x6a, 0x0a, 0x0b, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x42, + 0x69, 0x64, 0x73, 0x12, 0x1f, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, + 0x72, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x1a, 0x16, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, + 0x65, 0x72, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x69, 0x64, 0x22, 0x20, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x1a, 0x12, 0x18, 0x2f, 0x76, 0x31, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, + 0x72, 0x2f, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x5f, 0x62, 0x69, 0x64, 0x73, 0x30, 0x01, + 0x12, 0x82, 0x01, 0x0a, 0x11, 0x53, 0x65, 0x6e, 0x64, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, + 0x65, 0x64, 0x42, 0x69, 0x64, 0x73, 0x12, 0x1e, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x62, 0x75, 0x69, + 0x6c, 0x64, 0x65, 0x72, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x69, 0x64, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x1f, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x62, 0x75, 0x69, + 0x6c, 0x64, 0x65, 0x72, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, + 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x2a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x24, 0x3a, + 0x01, 0x2a, 0x22, 0x1f, 0x2f, 0x76, 0x31, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x2f, + 0x73, 0x65, 0x6e, 0x64, 0x5f, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x65, 0x64, 0x5f, 0x62, + 0x69, 0x64, 0x73, 0x28, 0x01, 0x42, 0xc3, 0x01, 0x92, 0x41, 0x7b, 0x12, 0x79, 0x0a, 0x0b, 0x42, + 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x20, 0x41, 0x50, 0x49, 0x2a, 0x5d, 0x0a, 0x1b, 0x42, 0x75, + 0x73, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x20, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x4c, 0x69, + 0x63, 0x65, 0x6e, 0x73, 0x65, 0x20, 0x31, 0x2e, 0x31, 0x12, 0x3e, 0x68, 0x74, 0x74, 0x70, 0x73, + 0x3a, 0x2f, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, + 0x69, 0x6d, 0x65, 0x76, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x6d, 0x65, 0x76, + 0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x2f, 0x62, 0x6c, 0x6f, 0x62, 0x2f, 0x6d, 0x61, 0x69, + 0x6e, 0x2f, 0x4c, 0x49, 0x43, 0x45, 0x4e, 0x53, 0x45, 0x32, 0x0b, 0x31, 0x2e, 0x30, 0x2e, 0x30, + 0x2d, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x65, 0x76, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x6d, 0x65, 0x76, 0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x3b, 0x62, diff --git a/gen/go/rpc/builderapi/v1/builderapi.pb.gw.go b/gen/go/rpc/builderapi/v1/builderapi.pb.gw.go new file mode 100644 index 00000000..14f8de14 --- /dev/null +++ b/gen/go/rpc/builderapi/v1/builderapi.pb.gw.go @@ -0,0 +1,213 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: rpc/builderapi/v1/builderapi.proto + +/* +Package builderapiv1 is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package builderapiv1 + +import ( + "context" + "io" + "net/http" + + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = metadata.Join + +func request_Builder_ReceiveBids_0(ctx context.Context, marshaler runtime.Marshaler, client BuilderClient, req *http.Request, pathParams map[string]string) (Builder_ReceiveBidsClient, runtime.ServerMetadata, error) { + var protoReq EmptyMessage + var metadata runtime.ServerMetadata + + stream, err := client.ReceiveBids(ctx, &protoReq) + if err != nil { + return nil, metadata, err + } + header, err := stream.Header() + if err != nil { + return nil, metadata, err + } + metadata.HeaderMD = header + return stream, metadata, nil + +} + +func request_Builder_SendProcessedBids_0(ctx context.Context, marshaler runtime.Marshaler, client BuilderClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var metadata runtime.ServerMetadata + stream, err := client.SendProcessedBids(ctx) + if err != nil { + grpclog.Infof("Failed to start streaming: %v", err) + return nil, metadata, err + } + dec := marshaler.NewDecoder(req.Body) + for { + var protoReq BidResponse + err = dec.Decode(&protoReq) + if err == io.EOF { + break + } + if err != nil { + grpclog.Infof("Failed to decode request: %v", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err = stream.Send(&protoReq); err != nil { + if err == io.EOF { + break + } + grpclog.Infof("Failed to send request: %v", err) + return nil, metadata, err + } + } + + if err := stream.CloseSend(); err != nil { + grpclog.Infof("Failed to terminate client stream: %v", err) + return nil, metadata, err + } + header, err := stream.Header() + if err != nil { + grpclog.Infof("Failed to get header from client: %v", err) + return nil, metadata, err + } + metadata.HeaderMD = header + + msg, err := stream.CloseAndRecv() + metadata.TrailerMD = stream.Trailer() + return msg, metadata, err + +} + +// RegisterBuilderHandlerServer registers the http handlers for service Builder to "mux". +// UnaryRPC :call BuilderServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterBuilderHandlerFromEndpoint instead. +func RegisterBuilderHandlerServer(ctx context.Context, mux *runtime.ServeMux, server BuilderServer) error { + + mux.Handle("GET", pattern_Builder_ReceiveBids_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") + _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + }) + + mux.Handle("POST", pattern_Builder_SendProcessedBids_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") + _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + }) + + return nil +} + +// RegisterBuilderHandlerFromEndpoint is same as RegisterBuilderHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterBuilderHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.DialContext(ctx, endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterBuilderHandler(ctx, mux, conn) +} + +// RegisterBuilderHandler registers the http handlers for service Builder to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterBuilderHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterBuilderHandlerClient(ctx, mux, NewBuilderClient(conn)) +} + +// RegisterBuilderHandlerClient registers the http handlers for service Builder +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "BuilderClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "BuilderClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "BuilderClient" to call the correct interceptors. +func RegisterBuilderHandlerClient(ctx context.Context, mux *runtime.ServeMux, client BuilderClient) error { + + mux.Handle("GET", pattern_Builder_ReceiveBids_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/rpc.builderapi.v1.Builder/ReceiveBids", runtime.WithHTTPPathPattern("/v1/builder/receive_bids")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Builder_ReceiveBids_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_Builder_ReceiveBids_0(annotatedContext, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Builder_SendProcessedBids_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/rpc.builderapi.v1.Builder/SendProcessedBids", runtime.WithHTTPPathPattern("/v1/builder/send_processed_bids")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Builder_SendProcessedBids_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_Builder_SendProcessedBids_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Builder_ReceiveBids_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "builder", "receive_bids"}, "")) + + pattern_Builder_SendProcessedBids_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "builder", "send_processed_bids"}, "")) +) + +var ( + forward_Builder_ReceiveBids_0 = runtime.ForwardResponseStream + + forward_Builder_SendProcessedBids_0 = runtime.ForwardResponseMessage +) diff --git a/gen/go/rpc/builderapi/v1/builderapi_grpc.pb.go b/gen/go/rpc/builderapi/v1/builderapi_grpc.pb.go index a46d3f9b..aa90da2c 100644 --- a/gen/go/rpc/builderapi/v1/builderapi_grpc.pb.go +++ b/gen/go/rpc/builderapi/v1/builderapi_grpc.pb.go @@ -27,9 +27,13 @@ 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 BuilderClient interface { + // ReceiveBids + // // ReceiveBids is called by the builder to receive bids from the mev-commit node. - // The mev-commit node will stream bids to the builder. + // The mev-commit node will stream bids to the builder as the response. ReceiveBids(ctx context.Context, in *EmptyMessage, opts ...grpc.CallOption) (Builder_ReceiveBidsClient, error) + // SendProcessedBids + // // SendProcessedBids is called by the builder to send processed bids to the mev-commit node. // The builder will stream processed bids to the mev-commit node. SendProcessedBids(ctx context.Context, opts ...grpc.CallOption) (Builder_SendProcessedBidsClient, error) @@ -113,9 +117,13 @@ func (x *builderSendProcessedBidsClient) CloseAndRecv() (*EmptyMessage, error) { // All implementations must embed UnimplementedBuilderServer // for forward compatibility type BuilderServer interface { + // ReceiveBids + // // ReceiveBids is called by the builder to receive bids from the mev-commit node. - // The mev-commit node will stream bids to the builder. + // The mev-commit node will stream bids to the builder as the response. ReceiveBids(*EmptyMessage, Builder_ReceiveBidsServer) error + // SendProcessedBids + // // SendProcessedBids is called by the builder to send processed bids to the mev-commit node. // The builder will stream processed bids to the mev-commit node. SendProcessedBids(Builder_SendProcessedBidsServer) error diff --git a/gen/go/rpc/searcherapi/v1/searcherapi.pb.go b/gen/go/rpc/searcherapi/v1/searcherapi.pb.go index 5076318a..b63d846f 100644 --- a/gen/go/rpc/searcherapi/v1/searcherapi.pb.go +++ b/gen/go/rpc/searcherapi/v1/searcherapi.pb.go @@ -7,6 +7,8 @@ package searcherapiv1 import ( + _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" + _ "google.golang.org/genproto/googleapis/api/annotations" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -184,36 +186,124 @@ var file_rpc_searcherapi_v1_searcherapi_proto_rawDesc = []byte{ 0x0a, 0x24, 0x72, 0x70, 0x63, 0x2f, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x65, 0x72, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x65, 0x72, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x11, 0x72, 0x70, 0x63, 0x2e, 0x73, 0x65, 0x61, 0x63, - 0x68, 0x65, 0x72, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x22, 0x59, 0x0a, 0x03, 0x42, 0x69, 0x64, - 0x12, 0x17, 0x0a, 0x07, 0x74, 0x78, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x74, 0x78, 0x48, 0x61, 0x73, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, - 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, - 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, - 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, - 0x6d, 0x62, 0x65, 0x72, 0x22, 0x9f, 0x02, 0x0a, 0x0f, 0x50, 0x72, 0x65, 0x43, 0x6f, 0x6e, 0x66, - 0x69, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x17, 0x0a, 0x07, 0x74, 0x78, 0x5f, 0x68, - 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x78, 0x48, 0x61, 0x73, - 0x68, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, - 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1d, 0x0a, 0x0a, - 0x62, 0x69, 0x64, 0x5f, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x09, 0x62, 0x69, 0x64, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x62, - 0x69, 0x64, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0c, 0x62, 0x69, 0x64, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, - 0x12, 0x36, 0x0a, 0x17, 0x70, 0x72, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x15, 0x70, 0x72, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x12, 0x3c, 0x0a, 0x1a, 0x70, 0x72, 0x65, 0x5f, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x69, 0x67, - 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x18, 0x70, 0x72, - 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x69, 0x67, - 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x32, 0x55, 0x0a, 0x08, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, - 0x65, 0x72, 0x12, 0x49, 0x0a, 0x07, 0x53, 0x65, 0x6e, 0x64, 0x42, 0x69, 0x64, 0x12, 0x16, 0x2e, - 0x72, 0x70, 0x63, 0x2e, 0x73, 0x65, 0x61, 0x63, 0x68, 0x65, 0x72, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x31, 0x2e, 0x42, 0x69, 0x64, 0x1a, 0x22, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x73, 0x65, 0x61, 0x63, - 0x68, 0x65, 0x72, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x65, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x00, 0x30, 0x01, 0x42, 0x46, 0x5a, + 0x68, 0x65, 0x72, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, + 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xfa, 0x04, 0x0a, 0x03, 0x42, 0x69, 0x64, 0x12, + 0x8f, 0x01, 0x0a, 0x07, 0x74, 0x78, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x42, 0x76, 0x92, 0x41, 0x73, 0x32, 0x5f, 0x48, 0x65, 0x78, 0x20, 0x73, 0x74, 0x72, 0x69, + 0x6e, 0x67, 0x20, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x6f, 0x66, 0x20, 0x74, + 0x68, 0x65, 0x20, 0x68, 0x61, 0x73, 0x68, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, + 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, + 0x74, 0x68, 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x73, 0x20, 0x74, + 0x6f, 0x20, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, + 0x20, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x8a, 0x01, 0x0f, 0x5b, 0x61, 0x2d, 0x66, 0x41, 0x2d, + 0x46, 0x30, 0x2d, 0x39, 0x5d, 0x7b, 0x34, 0x30, 0x7d, 0x52, 0x06, 0x74, 0x78, 0x48, 0x61, 0x73, + 0x68, 0x12, 0x85, 0x01, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x03, 0x42, 0x6d, 0x92, 0x41, 0x6a, 0x32, 0x68, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x20, + 0x6f, 0x66, 0x20, 0x45, 0x54, 0x48, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, + 0x75, 0x73, 0x65, 0x72, 0x20, 0x69, 0x73, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x69, 0x6e, 0x67, 0x20, + 0x74, 0x6f, 0x20, 0x70, 0x61, 0x79, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x62, 0x75, + 0x69, 0x6c, 0x64, 0x65, 0x72, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, + 0x69, 0x6e, 0x67, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x62, 0x6c, 0x6f, 0x63, 0x6b, + 0x2e, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x6b, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, + 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x42, + 0x48, 0x92, 0x41, 0x45, 0x32, 0x43, 0x4d, 0x61, 0x78, 0x20, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x20, + 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, + 0x75, 0x73, 0x65, 0x72, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x69, 0x6e, + 0x63, 0x6c, 0x75, 0x64, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x69, 0x6e, 0x2e, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, + 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x3a, 0xeb, 0x01, 0x92, 0x41, 0xe7, 0x01, 0x0a, 0x71, 0x2a, + 0x0b, 0x42, 0x69, 0x64, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x32, 0x40, 0x55, 0x6e, + 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x20, 0x62, 0x69, 0x64, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x75, 0x73, 0x65, 0x72, 0x73, 0x20, 0x74, 0x6f, + 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x65, 0x72, 0x20, 0x6d, 0x65, + 0x76, 0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x20, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0xd2, 0x01, + 0x07, 0x74, 0x78, 0x5f, 0x68, 0x61, 0x73, 0x68, 0xd2, 0x01, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, + 0x74, 0xd2, 0x01, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, + 0x32, 0x72, 0x7b, 0x22, 0x74, 0x78, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x22, 0x3a, 0x20, 0x22, 0x39, + 0x31, 0x61, 0x38, 0x39, 0x42, 0x36, 0x33, 0x33, 0x31, 0x39, 0x34, 0x63, 0x30, 0x44, 0x38, 0x36, + 0x43, 0x35, 0x33, 0x39, 0x41, 0x31, 0x41, 0x35, 0x42, 0x31, 0x34, 0x44, 0x43, 0x43, 0x61, 0x63, + 0x66, 0x44, 0x34, 0x37, 0x30, 0x39, 0x34, 0x22, 0x2c, 0x20, 0x22, 0x62, 0x69, 0x64, 0x5f, 0x61, + 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x3a, 0x20, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x2c, 0x20, 0x22, 0x62, 0x6c, + 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x3a, 0x20, 0x31, 0x32, 0x33, + 0x34, 0x35, 0x36, 0x7d, 0x22, 0x94, 0x07, 0x0a, 0x0f, 0x50, 0x72, 0x65, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x8f, 0x01, 0x0a, 0x07, 0x74, 0x78, 0x5f, + 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x76, 0x92, 0x41, 0x73, 0x32, + 0x5f, 0x48, 0x65, 0x78, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x65, 0x6e, 0x63, 0x6f, + 0x64, 0x69, 0x6e, 0x67, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x68, 0x61, 0x73, 0x68, + 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x73, 0x65, + 0x72, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x69, 0x6e, 0x63, 0x6c, 0x75, + 0x64, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, + 0x8a, 0x01, 0x0f, 0x5b, 0x61, 0x2d, 0x66, 0x41, 0x2d, 0x46, 0x30, 0x2d, 0x39, 0x5d, 0x7b, 0x34, + 0x30, 0x7d, 0x52, 0x06, 0x74, 0x78, 0x48, 0x61, 0x73, 0x68, 0x12, 0x85, 0x01, 0x0a, 0x06, 0x61, + 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x6d, 0x92, 0x41, 0x6a, + 0x32, 0x68, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x45, 0x54, 0x48, 0x20, + 0x74, 0x68, 0x61, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x68, 0x61, + 0x73, 0x20, 0x61, 0x67, 0x72, 0x65, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x70, 0x61, 0x79, 0x20, + 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x20, 0x66, + 0x6f, 0x72, 0x20, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x68, 0x65, + 0x20, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x69, 0x6e, 0x20, + 0x74, 0x68, 0x65, 0x20, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, + 0x6e, 0x74, 0x12, 0x6b, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, + 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x42, 0x48, 0x92, 0x41, 0x45, 0x32, 0x43, 0x4d, + 0x61, 0x78, 0x20, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x20, + 0x74, 0x68, 0x61, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x77, 0x61, + 0x6e, 0x74, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x20, 0x74, + 0x68, 0x65, 0x20, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x69, + 0x6e, 0x2e, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, + 0x68, 0x0a, 0x0a, 0x62, 0x69, 0x64, 0x5f, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x49, 0x92, 0x41, 0x46, 0x32, 0x44, 0x48, 0x65, 0x78, 0x20, 0x73, 0x74, + 0x72, 0x69, 0x6e, 0x67, 0x20, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x6f, 0x66, + 0x20, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x62, + 0x69, 0x64, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x73, 0x69, 0x67, 0x6e, 0x65, + 0x64, 0x20, 0x62, 0x79, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x52, 0x09, + 0x62, 0x69, 0x64, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x12, 0x6a, 0x0a, 0x0d, 0x62, 0x69, 0x64, + 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, + 0x42, 0x45, 0x92, 0x41, 0x42, 0x32, 0x40, 0x48, 0x65, 0x78, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, + 0x67, 0x20, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x6f, 0x66, 0x20, 0x73, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, + 0x73, 0x65, 0x72, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x73, 0x65, 0x6e, 0x74, 0x20, 0x74, 0x68, + 0x69, 0x73, 0x20, 0x62, 0x69, 0x64, 0x2e, 0x52, 0x0c, 0x62, 0x69, 0x64, 0x53, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x73, 0x0a, 0x17, 0x70, 0x72, 0x65, 0x5f, 0x63, 0x6f, 0x6e, + 0x66, 0x69, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x42, 0x3b, 0x92, 0x41, 0x38, 0x32, 0x36, 0x48, 0x65, 0x78, + 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, + 0x20, 0x6f, 0x66, 0x20, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, + 0x65, 0x20, 0x70, 0x72, 0x65, 0x2d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x2e, 0x52, 0x15, 0x70, 0x72, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x12, 0xae, 0x01, 0x0a, 0x1a, 0x70, + 0x72, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, + 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x70, 0x92, 0x41, 0x6d, 0x32, 0x6b, 0x48, 0x65, 0x78, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, + 0x20, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x6f, 0x66, 0x20, 0x73, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x72, + 0x65, 0x2d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x73, + 0x69, 0x67, 0x6e, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x74, 0x68, 0x65, 0x20, 0x62, 0x75, 0x69, + 0x6c, 0x64, 0x65, 0x72, 0x20, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x69, 0x6e, 0x67, 0x20, + 0x74, 0x68, 0x69, 0x73, 0x20, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x2e, 0x52, 0x18, 0x70, 0x72, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x32, 0x70, 0x0a, 0x08, 0x53, + 0x65, 0x61, 0x72, 0x63, 0x68, 0x65, 0x72, 0x12, 0x64, 0x0a, 0x07, 0x53, 0x65, 0x6e, 0x64, 0x42, + 0x69, 0x64, 0x12, 0x16, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x73, 0x65, 0x61, 0x63, 0x68, 0x65, 0x72, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x69, 0x64, 0x1a, 0x22, 0x2e, 0x72, 0x70, 0x63, + 0x2e, 0x73, 0x65, 0x61, 0x63, 0x68, 0x65, 0x72, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x50, + 0x72, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x1b, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x3a, 0x01, 0x2a, 0x22, 0x10, 0x2f, 0x76, 0x31, 0x2f, 0x73, + 0x65, 0x61, 0x72, 0x63, 0x68, 0x65, 0x72, 0x2f, 0x62, 0x69, 0x64, 0x30, 0x01, 0x42, 0xc5, 0x01, + 0x92, 0x41, 0x7c, 0x12, 0x7a, 0x0a, 0x0c, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x65, 0x72, 0x20, + 0x41, 0x50, 0x49, 0x2a, 0x5d, 0x0a, 0x1b, 0x42, 0x75, 0x73, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x20, + 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x20, 0x31, + 0x2e, 0x31, 0x12, 0x3e, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x65, 0x76, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x6d, 0x65, 0x76, 0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, + 0x2f, 0x62, 0x6c, 0x6f, 0x62, 0x2f, 0x6d, 0x61, 0x69, 0x6e, 0x2f, 0x4c, 0x49, 0x43, 0x45, 0x4e, + 0x53, 0x45, 0x32, 0x0b, 0x31, 0x2e, 0x30, 0x2e, 0x30, 0x2d, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x5a, 0x44, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x65, 0x76, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x6d, 0x65, 0x76, 0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x73, 0x65, 0x61, 0x63, 0x68, 0x65, diff --git a/gen/go/rpc/searcherapi/v1/searcherapi.pb.gw.go b/gen/go/rpc/searcherapi/v1/searcherapi.pb.gw.go new file mode 100644 index 00000000..4e33eca8 --- /dev/null +++ b/gen/go/rpc/searcherapi/v1/searcherapi.pb.gw.go @@ -0,0 +1,144 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: rpc/searcherapi/v1/searcherapi.proto + +/* +Package searcherapiv1 is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package searcherapiv1 + +import ( + "context" + "io" + "net/http" + + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = metadata.Join + +func request_Searcher_SendBid_0(ctx context.Context, marshaler runtime.Marshaler, client SearcherClient, req *http.Request, pathParams map[string]string) (Searcher_SendBidClient, runtime.ServerMetadata, error) { + var protoReq Bid + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + stream, err := client.SendBid(ctx, &protoReq) + if err != nil { + return nil, metadata, err + } + header, err := stream.Header() + if err != nil { + return nil, metadata, err + } + metadata.HeaderMD = header + return stream, metadata, nil + +} + +// RegisterSearcherHandlerServer registers the http handlers for service Searcher to "mux". +// UnaryRPC :call SearcherServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterSearcherHandlerFromEndpoint instead. +func RegisterSearcherHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SearcherServer) error { + + mux.Handle("POST", pattern_Searcher_SendBid_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") + _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + }) + + return nil +} + +// RegisterSearcherHandlerFromEndpoint is same as RegisterSearcherHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterSearcherHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.DialContext(ctx, endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterSearcherHandler(ctx, mux, conn) +} + +// RegisterSearcherHandler registers the http handlers for service Searcher to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterSearcherHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterSearcherHandlerClient(ctx, mux, NewSearcherClient(conn)) +} + +// RegisterSearcherHandlerClient registers the http handlers for service Searcher +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "SearcherClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "SearcherClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "SearcherClient" to call the correct interceptors. +func RegisterSearcherHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SearcherClient) error { + + mux.Handle("POST", pattern_Searcher_SendBid_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/rpc.seacherapi.v1.Searcher/SendBid", runtime.WithHTTPPathPattern("/v1/searcher/bid")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Searcher_SendBid_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_Searcher_SendBid_0(annotatedContext, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Searcher_SendBid_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "searcher", "bid"}, "")) +) + +var ( + forward_Searcher_SendBid_0 = runtime.ForwardResponseStream +) diff --git a/gen/go/rpc/searcherapi/v1/searcherapi_grpc.pb.go b/gen/go/rpc/searcherapi/v1/searcherapi_grpc.pb.go index 3377fcde..ab8d9ae6 100644 --- a/gen/go/rpc/searcherapi/v1/searcherapi_grpc.pb.go +++ b/gen/go/rpc/searcherapi/v1/searcherapi_grpc.pb.go @@ -26,6 +26,9 @@ 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 SearcherClient interface { + // SendBid + // + // Send a bid to the searcher mev-commit node. SendBid(ctx context.Context, in *Bid, opts ...grpc.CallOption) (Searcher_SendBidClient, error) } @@ -73,6 +76,9 @@ func (x *searcherSendBidClient) Recv() (*PreConfirmation, error) { // All implementations must embed UnimplementedSearcherServer // for forward compatibility type SearcherServer interface { + // SendBid + // + // Send a bid to the searcher mev-commit node. SendBid(*Bid, Searcher_SendBidServer) error mustEmbedUnimplementedSearcherServer() } diff --git a/gen/openapi/rpc/builderapi/v1/builderapi.swagger.yaml b/gen/openapi/rpc/builderapi/v1/builderapi.swagger.yaml new file mode 100644 index 00000000..eed205b6 --- /dev/null +++ b/gen/openapi/rpc/builderapi/v1/builderapi.swagger.yaml @@ -0,0 +1,133 @@ +swagger: "2.0" +info: + title: Builder API + version: 1.0.0-alpha + license: + name: Business Source License 1.1 + url: https://github.com/primevprotocol/mev-commit/blob/main/LICENSE +consumes: + - application/json +produces: + - application/json +paths: + /v1/builder/receive_bids: + get: + summary: ReceiveBids + description: |- + ReceiveBids is called by the builder to receive bids from the mev-commit node. + The mev-commit node will stream bids to the builder as the response. + operationId: Builder_ReceiveBids + responses: + "200": + description: A successful response.(streaming responses) + schema: + type: object + properties: + result: + $ref: '#/definitions/rpcbuilderapiv1Bid' + error: + $ref: '#/definitions/googlerpcStatus' + title: Stream result of rpcbuilderapiv1Bid + default: + description: An unexpected error response. + schema: + $ref: '#/definitions/googlerpcStatus' + /v1/builder/send_processed_bids: + post: + summary: SendProcessedBids + description: |- + SendProcessedBids is called by the builder to send processed bids to the mev-commit node. + The builder will stream processed bids to the mev-commit node. + operationId: Builder_SendProcessedBids + responses: + "200": + description: A successful response. + schema: + $ref: '#/definitions/v1EmptyMessage' + default: + description: An unexpected error response. + schema: + $ref: '#/definitions/googlerpcStatus' + parameters: + - name: body + description: Response sent by the builder with the decision on the bid received. (streaming inputs) + in: body + required: true + schema: + $ref: '#/definitions/v1BidResponse' +definitions: + googlerpcStatus: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + $ref: '#/definitions/protobufAny' + protobufAny: + type: object + properties: + '@type': + type: string + additionalProperties: {} + rpcbuilderapiv1Bid: + type: object + example: + bid_amount: 1e+18 + bid_digest: 9dJinwL+FZ6B1xsIQQo8t8B0ZXJubJwY86l/Yu7yAH159QrPHU0qj2P+YFj+llbuI1ZygdxGsX8+P3byMEA5ig== + block_number: 123456 + tx_hash: 91a89B633194c0D86C539A1A5B14DCCacfD47094 + properties: + txHash: + type: string + description: Hex string encoding of the hash of the transaction that the user wants to include in the block. + pattern: '[a-fA-F0-9]{40}' + bidAmount: + type: string + format: int64 + description: Amount of ETH that the user is willing to pay to the builder for including the transaction in the block. + blockNumber: + type: string + format: int64 + description: Max block number that the user wants to include the transaction in. + bidDigest: + type: string + format: byte + description: Digest of the bid message signed by the user. + description: Signed bid message from users to the builder. + title: Bid message + required: + - txHash + - bidAmount + - blockNumber + - bidDigest + v1BidResponse: + type: object + example: + bid_digest: 9dJinwL+FZ6B1xsIQQo8t8B0ZXJubJwY86l/Yu7yAH159QrPHU0qj2P+YFj+llbuI1ZygdxGsX8+P3byMEA5ig== + status: STATUS_ACCEPTED + properties: + bidDigest: + type: string + format: byte + description: Digest of the bid message signed by the user. + status: + $ref: '#/definitions/v1BidResponseStatus' + description: Status of the bid. + description: Response sent by the builder with the decision on the bid received. + title: Bid response + required: + - bidDigest + - status + v1BidResponseStatus: + type: string + enum: + - STATUS_ACCEPTED + - STATUS_REJECTED + v1EmptyMessage: + type: object diff --git a/gen/openapi/rpc/searcherapi/v1/searcherapi.swagger.yaml b/gen/openapi/rpc/searcherapi/v1/searcherapi.swagger.yaml new file mode 100644 index 00000000..5b1e67d9 --- /dev/null +++ b/gen/openapi/rpc/searcherapi/v1/searcherapi.swagger.yaml @@ -0,0 +1,111 @@ +swagger: "2.0" +info: + title: Searcher API + version: 1.0.0-alpha + license: + name: Business Source License 1.1 + url: https://github.com/primevprotocol/mev-commit/blob/main/LICENSE +consumes: + - application/json +produces: + - application/json +paths: + /v1/searcher/bid: + post: + summary: SendBid + description: Send a bid to the searcher mev-commit node. + operationId: Searcher_SendBid + responses: + "200": + description: A successful response.(streaming responses) + schema: + type: object + properties: + result: + $ref: '#/definitions/v1PreConfirmation' + error: + $ref: '#/definitions/googlerpcStatus' + title: Stream result of v1PreConfirmation + default: + description: An unexpected error response. + schema: + $ref: '#/definitions/googlerpcStatus' + parameters: + - name: body + description: Unsigned bid message from users to the searcher mev-commit node. + in: body + required: true + schema: + $ref: '#/definitions/rpcseacherapiv1Bid' +definitions: + googlerpcStatus: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + $ref: '#/definitions/protobufAny' + protobufAny: + type: object + properties: + '@type': + type: string + additionalProperties: {} + rpcseacherapiv1Bid: + type: object + example: + bid_amount: 1e+18 + block_number: 123456 + tx_hash: 91a89B633194c0D86C539A1A5B14DCCacfD47094 + properties: + txHash: + type: string + description: Hex string encoding of the hash of the transaction that the user wants to include in the block. + pattern: '[a-fA-F0-9]{40}' + amount: + type: string + format: int64 + description: Amount of ETH that the user is willing to pay to the builder for including the transaction in the block. + blockNumber: + type: string + format: int64 + description: Max block number that the user wants to include the transaction in. + description: Unsigned bid message from users to the searcher mev-commit node. + title: Bid message + required: + - txHash + - amount + - blockNumber + v1PreConfirmation: + type: object + properties: + txHash: + type: string + description: Hex string encoding of the hash of the transaction that the user wants to include in the block. + pattern: '[a-fA-F0-9]{40}' + amount: + type: string + format: int64 + description: Amount of ETH that the user has agreed to pay to the builder for including the transaction in the block. + blockNumber: + type: string + format: int64 + description: Max block number that the user wants to include the transaction in. + bidDigest: + type: string + description: Hex string encoding of digest of the bid message signed by the user. + bidSignature: + type: string + description: Hex string encoding of signature of the user that sent this bid. + preConfirmationDigest: + type: string + description: Hex string encoding of digest of the pre-confirmation. + preConfirmationSignature: + type: string + description: Hex string encoding of signature of the pre-confirmation signed by the builder confirming this transaction. diff --git a/go.mod b/go.mod index be4e9a7d..36919f07 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,7 @@ go 1.21.1 require ( github.com/ethereum/go-ethereum v1.13.2 + github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.0 github.com/libp2p/go-libp2p v0.31.0 github.com/libp2p/go-msgio v0.3.0 github.com/multiformats/go-multiaddr v0.11.0 @@ -13,6 +14,7 @@ require ( github.com/vmihailenco/msgpack/v5 v5.4.0 golang.org/x/crypto v0.14.0 golang.org/x/sync v0.4.0 + google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb google.golang.org/grpc v1.58.2 google.golang.org/protobuf v1.31.0 gopkg.in/yaml.v2 v2.4.0 @@ -111,6 +113,7 @@ require ( golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect golang.org/x/tools v0.12.1-0.20230815132531-74c255bcf846 // indirect + google.golang.org/genproto v0.0.0-20230920204549-e6e6cdab5c13 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect lukechampine.com/blake3 v1.2.1 // indirect diff --git a/go.sum b/go.sum index 56eda756..3b35a460 100644 --- a/go.sum +++ b/go.sum @@ -123,6 +123,8 @@ github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXP github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= +github.com/golang/glog v1.1.0/go.mod h1:pfYeQZ3JWZoXTV5sFc986z3HTpwQs9At6P4ImfuP3NQ= github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= @@ -157,6 +159,8 @@ github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWm github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= github.com/grpc-ecosystem/grpc-gateway v1.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.0 h1:RtRsiaGvWxcwd8y3BiRZxsylPT8hLWZ5SPcfI+3IDNk= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.0/go.mod h1:TzP6duP4Py2pHLVPPQp42aoYI92+PCrVotyR5e8Vqlk= github.com/holiman/uint256 v1.2.3 h1:K8UWO1HUJpRMXBxbmaY1Y8IAMZC/RsKB+ArEnnK4l5o= github.com/holiman/uint256 v1.2.3/go.mod h1:SC8Ryt4n+UBbPbIBKaG9zbbDlp4jOru9xFZmPzLUTxw= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= @@ -533,6 +537,10 @@ google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoA google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20181202183823-bd91e49a0898/go.mod h1:7Ep/1NZk928CDR8SjdVbjWNpdIf6nzjE3BTgJDr2Atg= google.golang.org/genproto v0.0.0-20190306203927-b5d61aea6440/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20230920204549-e6e6cdab5c13 h1:vlzZttNJGVqTsRFU9AmdnrcO1Znh8Ew9kCD//yjigk0= +google.golang.org/genproto v0.0.0-20230920204549-e6e6cdab5c13/go.mod h1:CCviP9RmpZ1mxVr8MUjCnSiY09IbAXZxhLE6EhHIdPU= +google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb h1:lK0oleSc7IQsUxO3U5TjL9DWlsxpEBemh+zpB7IqhWI= +google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk= google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 h1:6GQBEOdGkX6MMTLT9V+TjtIRZCw9VPD5Z+yHY9wMgS0= google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97/go.mod h1:v7nGkzlmW8P3n/bKmWBn2WpBjpOEx8Q6gMueudAmKfY= google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= diff --git a/pkg/node/node.go b/pkg/node/node.go index 26ccc64d..d4226fdf 100644 --- a/pkg/node/node.go +++ b/pkg/node/node.go @@ -11,6 +11,7 @@ import ( "net/http" "github.com/ethereum/go-ethereum/common" + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" builderapiv1 "github.com/primevprotocol/mev-commit/gen/go/rpc/builderapi/v1" searcherapiv1 "github.com/primevprotocol/mev-commit/gen/go/rpc/searcherapi/v1" "github.com/primevprotocol/mev-commit/pkg/apiserver" @@ -25,6 +26,8 @@ import ( "github.com/primevprotocol/mev-commit/pkg/signer/preconfsigner" "github.com/primevprotocol/mev-commit/pkg/topology" "google.golang.org/grpc" + "google.golang.org/grpc/connectivity" + "google.golang.org/grpc/credentials/insecure" ) type Options struct { @@ -52,6 +55,10 @@ func NewNode(opts *Options) (*Node, error) { return nil, err } + nd := &Node{ + closers: make([]io.Closer, 0), + } + srv := apiserver.New(opts.Version, opts.Logger.With("component", "apiserver")) closers := make([]io.Closer, 0) @@ -71,11 +78,11 @@ func NewNode(opts *Options) (*Node, error) { if err != nil { return nil, err } - closers = append(closers, p2pSvc) + nd.closers = append(nd.closers, p2pSvc) topo := topology.New(p2pSvc, opts.Logger.With("component", "topology")) disc := discovery.New(topo, p2pSvc, opts.Logger.With("component", "discovery_protocol")) - closers = append(closers, disc) + nd.closers = append(nd.closers, disc) // Set the announcer for the topology service topo.SetAnnouncer(disc) @@ -87,70 +94,124 @@ func NewNode(opts *Options) (*Node, error) { debugapi.RegisterAPI(srv, topo, p2pSvc, opts.Logger.With("component", "debugapi")) - server := &http.Server{ - Addr: fmt.Sprintf(":%d", opts.HTTPPort), - Handler: srv.Router(), - } - - go func() { - if err := server.ListenAndServe(); err != nil && !errors.Is(err, http.ErrServerClosed) { - opts.Logger.Error("failed to start server", "err", err) + if opts.PeerType != p2p.PeerTypeBootnode.String() { + lis, err := net.Listen("tcp", fmt.Sprintf(":%d", opts.RPCPort)) + if err != nil { + _ = nd.Close() + return nil, err + } + grpcServer := grpc.NewServer() + + preconfSigner := preconfsigner.NewSigner(opts.PrivKey) + var bidProcessor preconfirmation.BidProcessor = noOpBidProcessor{} + + switch opts.PeerType { + case p2p.PeerTypeBuilder.String(): + if opts.ExposeBuilderAPI { + builderAPI := builderapi.NewService(opts.Logger.With("component", "builderapi")) + builderapiv1.RegisterBuilderServer(grpcServer, builderAPI) + bidProcessor = builderAPI + } + // TODO(@ckartik): Update noOpBidProcessor to be selected as default in a flag paramater. + preconfProto := preconfirmation.New( + topo, + p2pSvc, + preconfSigner, + noOpUserStore{}, + bidProcessor, + opts.Logger.With("component", "preconfirmation_protocol"), + ) + // Only register handler for builder + p2pSvc.AddProtocol(preconfProto.Protocol()) + + case p2p.PeerTypeSearcher.String(): + preconfProto := preconfirmation.New( + topo, + p2pSvc, + preconfSigner, + noOpUserStore{}, + bidProcessor, + opts.Logger.With("component", "preconfirmation_protocol"), + ) + + searcherAPI := searcherapi.NewService( + preconfProto, + opts.Logger.With("component", "searcherapi"), + ) + searcherapiv1.RegisterSearcherServer(grpcServer, searcherAPI) } - }() - closers = append(closers, server) - lis, err := net.Listen("tcp", fmt.Sprintf(":%d", opts.RPCPort)) - if err != nil { - return nil, err - } - grpcServer := grpc.NewServer() + started := make(chan struct{}) + go func() { + // signal that the server has started + close(started) - preconfSigner := preconfsigner.NewSigner(opts.PrivKey) - var bidProcessor preconfirmation.BidProcessor = noOpBidProcessor{} + err := grpcServer.Serve(lis) + if err != nil { + opts.Logger.Error("failed to start grpc server", "err", err) + } + }() + nd.closers = append(nd.closers, lis) - switch opts.PeerType { - case p2p.PeerTypeBuilder.String(): - if opts.ExposeBuilderAPI { - builderAPI := builderapi.NewService(opts.Logger.With("component", "builderapi")) - builderapiv1.RegisterBuilderServer(grpcServer, builderAPI) - bidProcessor = builderAPI - } - // TODO(@ckartik): Update noOpBidProcessor to be selected as default in a flag paramater. - preconfProto := preconfirmation.New( - topo, - p2pSvc, - preconfSigner, - noOpUserStore{}, - bidProcessor, - opts.Logger.With("component", "preconfirmation_protocol"), - ) - // Only register handler for builder - p2pSvc.AddProtocol(preconfProto.Protocol()) - - case p2p.PeerTypeSearcher.String(): - preconfProto := preconfirmation.New( - topo, - p2pSvc, - preconfSigner, - noOpUserStore{}, - bidProcessor, - opts.Logger.With("component", "preconfirmation_protocol"), + // Wait for the server to start + <-started + + gwMux := runtime.NewServeMux() + bgCtx := context.Background() + + grpcConn, err := grpc.DialContext( + bgCtx, + fmt.Sprintf(":%d", opts.RPCPort), + grpc.WithTransportCredentials(insecure.NewCredentials()), ) + if err != nil { + opts.Logger.Error("failed to dial grpc server", "err", err) + _ = nd.Close() + return nil, err + } + + switch opts.PeerType { + case p2p.PeerTypeBuilder.String(): + err := builderapiv1.RegisterBuilderHandler(bgCtx, gwMux, grpcConn) + if err != nil { + opts.Logger.Error("failed to register builder handler", "err", err) + return nil, err + } + case p2p.PeerTypeSearcher.String(): + err := searcherapiv1.RegisterSearcherHandler(bgCtx, gwMux, grpcConn) + if err != nil { + opts.Logger.Error("failed to register searcher handler", "err", err) + return nil, err + } + } - searcherAPI := searcherapi.NewService( - preconfProto, - opts.Logger.With("component", "searcherapi"), + srv.ChainHandlers("/", gwMux) + srv.ChainHandlers( + "/health", + http.HandlerFunc( + func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "text/plain") + if s := grpcConn.GetState(); s != connectivity.Ready { + http.Error(w, fmt.Sprintf("grpc server is %s", s), http.StatusBadGateway) + return + } + fmt.Fprintln(w, "ok") + }, + ), ) - searcherapiv1.RegisterSearcherServer(grpcServer, searcherAPI) + } + + server := &http.Server{ + Addr: fmt.Sprintf(":%d", opts.HTTPPort), + Handler: srv.Router(), } go func() { - err := grpcServer.Serve(lis) - if err != nil { - opts.Logger.Error("failed to start grpc server", "err", err) + if err := server.ListenAndServe(); err != nil && !errors.Is(err, http.ErrServerClosed) { + opts.Logger.Error("failed to start server", "err", err) } }() - closers = append(closers, lis) + closers = append(closers, server) return &Node{closers: closers}, nil } diff --git a/rpc/builderapi/v1/builderapi.proto b/rpc/builderapi/v1/builderapi.proto index 408416ca..dce4298e 100644 --- a/rpc/builderapi/v1/builderapi.proto +++ b/rpc/builderapi/v1/builderapi.proto @@ -4,31 +4,85 @@ package rpc.builderapi.v1; option go_package = "github.com/primevprotocol/mev-commit/rpc/builderapi/v1;builderapiv1"; +import "protoc-gen-openapiv2/options/annotations.proto"; +import "google/api/annotations.proto"; + +option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { + info: { + title: "Builder API"; + version: "1.0.0-alpha"; + license: { + name: "Business Source License 1.1"; + url: "https://github.com/primevprotocol/mev-commit/blob/main/LICENSE"; + }; + }; +}; + service Builder { + // ReceiveBids + // // ReceiveBids is called by the builder to receive bids from the mev-commit node. - // The mev-commit node will stream bids to the builder. - rpc ReceiveBids(EmptyMessage) returns (stream Bid) {} + // The mev-commit node will stream bids to the builder as the response. + rpc ReceiveBids(EmptyMessage) returns (stream Bid) { + option (google.api.http) = {get: "/v1/builder/receive_bids"}; + } + // SendProcessedBids + // // SendProcessedBids is called by the builder to send processed bids to the mev-commit node. // The builder will stream processed bids to the mev-commit node. - rpc SendProcessedBids(stream BidResponse) returns (EmptyMessage) {} + rpc SendProcessedBids(stream BidResponse) returns (EmptyMessage) { + option (google.api.http) = { + post: "/v1/builder/send_processed_bids" + body: "*" + }; + } } message EmptyMessage {}; message Bid { - string tx_hash = 1; - int64 bid_amount = 2; - int64 block_number = 3; - bytes bid_digest = 4; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema) = { + json_schema: { + title: "Bid message" + description: "Signed bid message from users to the builder." + required: ["tx_hash", "bid_amount", "block_number", "bid_digest"] + } + example: "{\"tx_hash\": \"91a89B633194c0D86C539A1A5B14DCCacfD47094\", \"bid_amount\": 1000000000000000000, \"block_number\": 123456, \"bid_digest\": \"9dJinwL+FZ6B1xsIQQo8t8B0ZXJubJwY86l/Yu7yAH159QrPHU0qj2P+YFj+llbuI1ZygdxGsX8+P3byMEA5ig==\"}" + }; + string tx_hash = 1 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + description: "Hex string encoding of the hash of the transaction that the user wants to include in the block." + pattern: "[a-fA-F0-9]{40}" + }]; + int64 bid_amount = 2 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + description: "Amount of ETH that the user is willing to pay to the builder for including the transaction in the block." + }]; + int64 block_number = 3 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + description: "Max block number that the user wants to include the transaction in." + }]; + bytes bid_digest = 4 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + description: "Digest of the bid message signed by the user." + }]; }; message BidResponse { - bytes bid_digest = 1; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema) = { + json_schema: { + title: "Bid response" + description: "Response sent by the builder with the decision on the bid received." + required: ["bid_digest", "status"] + } + example: "{\"bid_digest\": \"9dJinwL+FZ6B1xsIQQo8t8B0ZXJubJwY86l/Yu7yAH159QrPHU0qj2P+YFj+llbuI1ZygdxGsX8+P3byMEA5ig==\", \"status\": \"STATUS_ACCEPTED\"}" + }; + bytes bid_digest = 1 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + description: "Digest of the bid message signed by the user." + }]; enum Status { STATUS_UNSPECIFIED = 0; STATUS_ACCEPTED = 1; STATUS_REJECTED = 2; } - Status status = 2; + Status status = 2 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + description: "Status of the bid." + }]; }; diff --git a/rpc/searcherapi/v1/searcherapi.proto b/rpc/searcherapi/v1/searcherapi.proto index 685409b2..05aea73d 100644 --- a/rpc/searcherapi/v1/searcherapi.proto +++ b/rpc/searcherapi/v1/searcherapi.proto @@ -4,22 +4,74 @@ package rpc.seacherapi.v1; option go_package = "github.com/primevprotocol/mev-commit/rpc/seacherapi/v1;searcherapiv1"; +import "protoc-gen-openapiv2/options/annotations.proto"; +import "google/api/annotations.proto"; + +option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { + info: { + title: "Searcher API"; + version: "1.0.0-alpha"; + license: { + name: "Business Source License 1.1"; + url: "https://github.com/primevprotocol/mev-commit/blob/main/LICENSE"; + }; + }; +}; + service Searcher { - rpc SendBid(Bid) returns (stream PreConfirmation) {} + // SendBid + // + // Send a bid to the searcher mev-commit node. + rpc SendBid(Bid) returns (stream PreConfirmation) { + option (google.api.http) = { + post: "/v1/searcher/bid" + body: "*" + }; + } } message Bid { - string tx_hash = 1; - int64 amount = 2; - int64 block_number = 3; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema) = { + json_schema: { + title: "Bid message" + description: "Unsigned bid message from users to the searcher mev-commit node." + required: ["tx_hash", "amount", "block_number"] + } + example: "{\"tx_hash\": \"91a89B633194c0D86C539A1A5B14DCCacfD47094\", \"bid_amount\": 1000000000000000000, \"block_number\": 123456}" + }; + string tx_hash = 1 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + description: "Hex string encoding of the hash of the transaction that the user wants to include in the block." + pattern: "[a-fA-F0-9]{40}" + }]; + int64 amount = 2 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + description: "Amount of ETH that the user is willing to pay to the builder for including the transaction in the block." + }]; + int64 block_number = 3 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + description: "Max block number that the user wants to include the transaction in." + }]; }; message PreConfirmation { - string tx_hash = 1; - int64 amount = 2; - int64 block_number = 3; - string bid_digest = 4; - string bid_signature = 5; - string pre_confirmation_digest = 6; - string pre_confirmation_signature = 7; + string tx_hash = 1 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + description: "Hex string encoding of the hash of the transaction that the user wants to include in the block." + pattern: "[a-fA-F0-9]{40}" + }]; + int64 amount = 2 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + description: "Amount of ETH that the user has agreed to pay to the builder for including the transaction in the block." + }]; + int64 block_number = 3 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + description: "Max block number that the user wants to include the transaction in." + }]; + string bid_digest = 4 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + description: "Hex string encoding of digest of the bid message signed by the user." + }]; + string bid_signature = 5 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + description: "Hex string encoding of signature of the user that sent this bid." + }]; + string pre_confirmation_digest = 6 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + description: "Hex string encoding of digest of the pre-confirmation." + }]; + string pre_confirmation_signature = 7 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + description: "Hex string encoding of signature of the pre-confirmation signed by the builder confirming this transaction." + }]; };