diff --git a/gen/go/rpc/searcherapi/v1/searcherapi.pb.go b/gen/go/rpc/searcherapi/v1/searcherapi.pb.go index 2af28e5d..651c3493 100644 --- a/gen/go/rpc/searcherapi/v1/searcherapi.pb.go +++ b/gen/go/rpc/searcherapi/v1/searcherapi.pb.go @@ -26,7 +26,7 @@ type Bid struct { unknownFields protoimpl.UnknownFields TxnHash string `protobuf:"bytes,1,opt,name=txn_hash,json=txnHash,proto3" json:"txn_hash,omitempty"` - BidAmt int64 `protobuf:"varint,2,opt,name=bid_amt,json=bidAmt,proto3" json:"bid_amt,omitempty"` + Amount int64 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"` BlockNumber int64 `protobuf:"varint,3,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` } @@ -69,9 +69,9 @@ func (x *Bid) GetTxnHash() string { return "" } -func (x *Bid) GetBidAmt() int64 { +func (x *Bid) GetAmount() int64 { if x != nil { - return x.BidAmt + return x.Amount } return 0 } @@ -88,11 +88,11 @@ type PreConfirmation struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Bid *Bid `protobuf:"bytes,1,opt,name=bid,proto3" json:"bid,omitempty"` - BidHash []byte `protobuf:"bytes,4,opt,name=bid_hash,json=bidHash,proto3" json:"bid_hash,omitempty"` - Signature []byte `protobuf:"bytes,5,opt,name=signature,proto3" json:"signature,omitempty"` - PreconfirmationDigest []byte `protobuf:"bytes,6,opt,name=preconfirmation_digest,json=preconfirmationDigest,proto3" json:"preconfirmation_digest,omitempty"` - PreConfirmationSignature []byte `protobuf:"bytes,7,opt,name=preConfirmation_signature,json=preConfirmationSignature,proto3" json:"preConfirmation_signature,omitempty"` + Bid *Bid `protobuf:"bytes,1,opt,name=bid,proto3" json:"bid,omitempty"` + BidHash string `protobuf:"bytes,2,opt,name=bid_hash,json=bidHash,proto3" json:"bid_hash,omitempty"` + BidSignature string `protobuf:"bytes,3,opt,name=bid_signature,json=bidSignature,proto3" json:"bid_signature,omitempty"` + Digest string `protobuf:"bytes,4,opt,name=digest,proto3" json:"digest,omitempty"` + Signature string `protobuf:"bytes,5,opt,name=signature,proto3" json:"signature,omitempty"` } func (x *PreConfirmation) Reset() { @@ -134,32 +134,32 @@ func (x *PreConfirmation) GetBid() *Bid { return nil } -func (x *PreConfirmation) GetBidHash() []byte { +func (x *PreConfirmation) GetBidHash() string { if x != nil { return x.BidHash } - return nil + return "" } -func (x *PreConfirmation) GetSignature() []byte { +func (x *PreConfirmation) GetBidSignature() string { if x != nil { - return x.Signature + return x.BidSignature } - return nil + return "" } -func (x *PreConfirmation) GetPreconfirmationDigest() []byte { +func (x *PreConfirmation) GetDigest() string { if x != nil { - return x.PreconfirmationDigest + return x.Digest } - return nil + return "" } -func (x *PreConfirmation) GetPreConfirmationSignature() []byte { +func (x *PreConfirmation) GetSignature() string { if x != nil { - return x.PreConfirmationSignature + return x.Signature } - return nil + return "" } var File_rpc_searcherapi_v1_searcherapi_proto protoreflect.FileDescriptor @@ -168,35 +168,35 @@ 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, 0x5c, 0x0a, 0x03, 0x42, 0x69, 0x64, + 0x68, 0x65, 0x72, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x22, 0x5b, 0x0a, 0x03, 0x42, 0x69, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x74, 0x78, 0x6e, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x07, 0x74, 0x78, 0x6e, 0x48, 0x61, 0x73, 0x68, 0x12, 0x17, 0x0a, 0x07, 0x62, - 0x69, 0x64, 0x5f, 0x61, 0x6d, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x62, 0x69, - 0x64, 0x41, 0x6d, 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, 0xbf, 0x01, 0x0a, 0x0a, 0x43, 0x6f, 0x6d, 0x6d, - 0x69, 0x74, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x28, 0x0a, 0x03, 0x62, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x73, 0x65, 0x61, 0x63, 0x68, 0x65, - 0x72, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x69, 0x64, 0x52, 0x03, 0x62, 0x69, 0x64, - 0x12, 0x19, 0x0a, 0x08, 0x62, 0x69, 0x64, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x07, 0x62, 0x69, 0x64, 0x48, 0x61, 0x73, 0x68, 0x12, 0x1c, 0x0a, 0x09, 0x73, - 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, - 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x61, 0x74, - 0x61, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x64, 0x61, - 0x74, 0x61, 0x48, 0x61, 0x73, 0x68, 0x12, 0x31, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, - 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x07, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x13, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x6d, 0x65, 0x6e, 0x74, - 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x32, 0x50, 0x0a, 0x08, 0x53, 0x65, 0x61, - 0x72, 0x63, 0x68, 0x65, 0x72, 0x12, 0x44, 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, 0x1d, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x73, - 0x65, 0x61, 0x63, 0x68, 0x65, 0x72, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6d, - 0x6d, 0x69, 0x74, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x00, 0x30, 0x01, 0x42, 0x46, 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, 0x72, 0x61, - 0x70, 0x69, 0x2f, 0x76, 0x31, 0x3b, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x65, 0x72, 0x61, 0x70, - 0x69, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x28, 0x09, 0x52, 0x07, 0x74, 0x78, 0x6e, 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, 0xb1, 0x01, 0x0a, 0x0f, 0x50, 0x72, 0x65, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x28, 0x0a, 0x03, 0x62, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x73, 0x65, + 0x61, 0x63, 0x68, 0x65, 0x72, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x69, 0x64, 0x52, + 0x03, 0x62, 0x69, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x62, 0x69, 0x64, 0x5f, 0x68, 0x61, 0x73, 0x68, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x62, 0x69, 0x64, 0x48, 0x61, 0x73, 0x68, 0x12, + 0x23, 0x0a, 0x0d, 0x62, 0x69, 0x64, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x62, 0x69, 0x64, 0x53, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, + 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x09, 0x73, 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, 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, 0x72, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x3b, 0x73, 0x65, 0x61, 0x72, + 0x63, 0x68, 0x65, 0x72, 0x61, 0x70, 0x69, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( @@ -213,7 +213,7 @@ func file_rpc_searcherapi_v1_searcherapi_proto_rawDescGZIP() []byte { var file_rpc_searcherapi_v1_searcherapi_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_rpc_searcherapi_v1_searcherapi_proto_goTypes = []interface{}{ - (*Bid)(nil), // 0: rpc.seacherapi.v1.Bid + (*Bid)(nil), // 0: rpc.seacherapi.v1.Bid (*PreConfirmation)(nil), // 1: rpc.seacherapi.v1.PreConfirmation } var file_rpc_searcherapi_v1_searcherapi_proto_depIdxs = []int32{ diff --git a/pkg/preconfirmation/preconfirmation_test.go b/pkg/preconfirmation/preconfirmation_test.go index fcd51c55..9c2e9f51 100644 --- a/pkg/preconfirmation/preconfirmation_test.go +++ b/pkg/preconfirmation/preconfirmation_test.go @@ -92,14 +92,14 @@ func TestPreconfBidSubmission(t *testing.T) { TxnHash: "test", BidAmt: big.NewInt(10), BlockNumber: big.NewInt(10), - BidHash: []byte("test"), + Digest: []byte("test"), Signature: []byte("test"), } preConfirmation := &preconfsigner.PreConfirmation{ - Bid: *bid, - PreconfirmationDigest: []byte("test"), - PreConfirmationSignature: []byte("test"), + Bid: *bid, + Digest: []byte("test"), + Signature: []byte("test"), } svc := p2ptest.New( @@ -127,13 +127,13 @@ func TestPreconfBidSubmission(t *testing.T) { t.Fatal(err) } - resp := <-respC + commitment := <-respC - if string(resp.PreconfirmationDigest) != "test" { + if string(commitment.Digest) != "test" { t.Fatalf("data hash is not equal to test") } - if string(resp.PreConfirmationSignature) != "test" { + if string(commitment.Signature) != "test" { t.Fatalf("preConfirmation signature is not equal to test") } }) diff --git a/pkg/rpc/builder/service.go b/pkg/rpc/builder/service.go index bb886741..20685007 100644 --- a/pkg/rpc/builder/service.go +++ b/pkg/rpc/builder/service.go @@ -31,7 +31,7 @@ func (s *Service) ProcessBid( ) (chan builderapiv1.BidResponse_Status, error) { respC := make(chan builderapiv1.BidResponse_Status, 1) s.bidsMu.Lock() - s.bidsInProcess[string(bid.BidHash)] = func(status builderapiv1.BidResponse_Status) { + s.bidsInProcess[string(bid.Digest)] = func(status builderapiv1.BidResponse_Status) { respC <- status close(respC) } @@ -40,7 +40,7 @@ func (s *Service) ProcessBid( select { case <-ctx.Done(): s.bidsMu.Lock() - delete(s.bidsInProcess, string(bid.BidHash)) + delete(s.bidsInProcess, string(bid.Digest)) s.bidsMu.Unlock() s.logger.Error("context cancelled for sending bid", "err", ctx.Err()) @@ -49,7 +49,7 @@ func (s *Service) ProcessBid( TxnHash: bid.TxnHash, BidAmt: bid.BidAmt.Int64(), BlockNumber: bid.BlockNumber.Int64(), - BidHash: bid.BidHash, + BidHash: bid.Digest, }: } s.logger.Info("sent bid to builder node", "bid", bid) diff --git a/pkg/rpc/searcher/service.go b/pkg/rpc/searcher/service.go index 4763a0ce..2229397f 100644 --- a/pkg/rpc/searcher/service.go +++ b/pkg/rpc/searcher/service.go @@ -2,6 +2,7 @@ package searcherapi import ( "context" + "encoding/hex" "log/slog" "math/big" @@ -35,7 +36,7 @@ func (s *Service) SendBid( respC, err := s.sender.SendBid( srv.Context(), bid.TxnHash, - big.NewInt(bid.BidAmt), + big.NewInt(bid.Amount), big.NewInt(bid.BlockNumber), ) if err != nil { @@ -46,14 +47,14 @@ func (s *Service) SendBid( for resp := range respC { err := srv.Send(&searcherapiv1.PreConfirmation{ Bid: &searcherapiv1.Bid{ - TxnHash: resp.TxnHash, - BidAmt: resp.BidAmt.Int64(), - BlockNumber: resp.BlockNumber.Int64(), + TxnHash: resp.Bid.TxnHash, + Amount: resp.Bid.BidAmt.Int64(), + BlockNumber: resp.Bid.BlockNumber.Int64(), }, - BidHash: resp.BidHash, - Signature: resp.Signature, - PreconfirmationDigest: resp.PreconfirmationDigest, - PreConfirmationSignature: resp.PreConfirmationSignature, + BidHash: hex.EncodeToString(resp.Bid.Digest), + BidSignature: hex.EncodeToString(resp.Bid.Signature), + Digest: hex.EncodeToString(resp.Digest), + Signature: hex.EncodeToString(resp.Signature), }) if err != nil { s.logger.Error("error sending preConfirmation", "err", err) @@ -63,3 +64,9 @@ func (s *Service) SendBid( return nil } + +func HexEncode(src []byte) string { + dst := make([]byte, hex.EncodedLen(len(src))) + hex.Encode(dst, src) + return string(dst) +} diff --git a/pkg/signer/preconfsigner/export_test.go b/pkg/signer/preconfsigner/export_test.go index 67dc88d8..51ce7276 100644 --- a/pkg/signer/preconfsigner/export_test.go +++ b/pkg/signer/preconfsigner/export_test.go @@ -13,7 +13,7 @@ func (p *privateKeySigner) BidOriginator(bid *Bid) (*common.Address, *ecdsa.Publ return nil, nil, err } - pubkey, err := crypto.SigToPub(bid.BidHash, bid.Signature) + pubkey, err := crypto.SigToPub(bid.Digest, bid.Signature) if err != nil { return nil, nil, err } @@ -31,7 +31,7 @@ func (p *privateKeySigner) PreConfirmationOriginator( return nil, nil, err } - pubkey, err := crypto.SigToPub(c.PreconfirmationDigest, c.PreConfirmationSignature) + pubkey, err := crypto.SigToPub(c.Digest, c.Signature) if err != nil { return nil, nil, err } diff --git a/pkg/signer/preconfsigner/signer.go b/pkg/signer/preconfsigner/signer.go index ff4011ad..1f841e85 100644 --- a/pkg/signer/preconfsigner/signer.go +++ b/pkg/signer/preconfsigner/signer.go @@ -24,19 +24,19 @@ var ( // Adds blocknumber for pre-conf bid - Will need to manage // how to reciever acts on a bid / TTL is the blocknumber type Bid struct { - TxnHash string `json:"txnHash"` - BidAmt *big.Int `json:"bid"` - BlockNumber *big.Int `json:"blocknumber"` + TxnHash string `json:"txn_hash"` + BidAmt *big.Int `json:"bid_amt"` + BlockNumber *big.Int `json:"block_number"` - BidHash []byte `json:"bidhash"` // TODO(@ckaritk): name better - Signature []byte `json:"signature"` + Digest []byte `json:"bid_digest"` // TODO(@ckaritk): name better + Signature []byte `json:"bid_signature"` } type PreConfirmation struct { - Bid + Bid Bid `json:"bid"` - PreconfirmationDigest []byte `json:"preconfirmation_digest"` // TODO(@ckaritk): name better - PreConfirmationSignature []byte `json:"preConfirmation_signature"` + Digest []byte `json:"digest"` // TODO(@ckaritk): name better + Signature []byte `json:"signature"` } type Signer interface { @@ -83,7 +83,7 @@ func (p *privateKeySigner) ConstructSignedBid( return nil, err } - bid.BidHash = bidHash + bid.Digest = bidHash bid.Signature = sig return bid, nil @@ -103,7 +103,7 @@ func (p *privateKeySigner) ConstructPreConfirmation(bid *Bid) (*PreConfirmation, bid.TxnHash, bid.BidAmt, bid.BlockNumber, - bid.BidHash, + bid.Digest, bid.Signature, ) @@ -117,26 +117,26 @@ func (p *privateKeySigner) ConstructPreConfirmation(bid *Bid) (*PreConfirmation, return nil, err } - preConfirmation.PreconfirmationDigest = preconfirmationDigest - preConfirmation.PreConfirmationSignature = sig + preConfirmation.Digest = preconfirmationDigest + preConfirmation.Signature = sig return preConfirmation, nil } func (p *privateKeySigner) VerifyBid(bid *Bid) (*common.Address, error) { - if bid.BidHash == nil || bid.Signature == nil { + if bid.Digest == nil || bid.Signature == nil { return nil, ErrMissingHashSignature } return eipVerify( constructBidPayload(bid.TxnHash, bid.BidAmt, bid.BlockNumber), - bid.BidHash, + bid.Digest, bid.Signature, ) } func (p *privateKeySigner) VerifyPreConfirmation(c *PreConfirmation) (*common.Address, error) { - if c.PreconfirmationDigest == nil || c.PreConfirmationSignature == nil { + if c.Digest == nil || c.Signature == nil { return nil, ErrMissingHashSignature } @@ -146,14 +146,14 @@ func (p *privateKeySigner) VerifyPreConfirmation(c *PreConfirmation) (*common.Ad } internalPayload := constructPreConfirmationPayload( - c.TxnHash, - c.BidAmt, - c.BlockNumber, - c.BidHash, - c.Signature, + c.Bid.TxnHash, + c.Bid.BidAmt, + c.Bid.BlockNumber, + c.Bid.Digest, + c.Bid.Signature, ) - return eipVerify(internalPayload, c.PreconfirmationDigest, c.PreConfirmationSignature) + return eipVerify(internalPayload, c.Digest, c.Signature) } func eipVerify( diff --git a/rpc/searcherapi/v1/searcherapi.proto b/rpc/searcherapi/v1/searcherapi.proto index 4ede18fe..8a844a4b 100644 --- a/rpc/searcherapi/v1/searcherapi.proto +++ b/rpc/searcherapi/v1/searcherapi.proto @@ -10,14 +10,14 @@ service Searcher { message Bid { string txn_hash = 1; - int64 bid_amt = 2; + int64 amount = 2; int64 block_number = 3; }; message PreConfirmation { Bid bid = 1; - bytes bid_hash = 4; - bytes signature = 5; - bytes preconfirmation_digest = 6; - bytes preConfirmation_signature = 7; + string bid_hash = 2; + string bid_signature = 3; + string digest = 4; + string signature = 5; };