Merge pull request #4452 from harmony-one/feature/statesync_client

new functionalities for state sync client
pull/4469/head
Casey Gardiner 1 year ago committed by GitHub
commit ae8348fd55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      api/service/stagedstreamsync/adapter.go
  2. 21
      consensus/engine/consensus_engine.go
  3. 15
      core/blockchain.go
  4. 18
      core/blockchain_impl.go
  5. 12
      core/blockchain_stub.go
  6. 4
      hmy/downloader/adapter_test.go
  7. 4
      internal/chain/engine_test.go
  8. 43
      p2p/stream/protocols/sync/chain.go
  9. 36
      p2p/stream/protocols/sync/chain_test.go
  10. 184
      p2p/stream/protocols/sync/client.go
  11. 139
      p2p/stream/protocols/sync/client_test.go
  12. 8
      p2p/stream/protocols/sync/const.go
  13. 58
      p2p/stream/protocols/sync/message/compose.go
  14. 648
      p2p/stream/protocols/sync/message/msg.pb.go
  15. 21
      p2p/stream/protocols/sync/message/msg.proto
  16. 86
      p2p/stream/protocols/sync/stream.go
  17. 4
      test/chain/chain/chain_makers.go

@ -18,6 +18,8 @@ type syncProtocol interface {
GetRawBlocksByNumber(ctx context.Context, bns []uint64, opts ...syncproto.Option) ([][]byte, [][]byte, sttypes.StreamID, error)
GetBlockHashes(ctx context.Context, bns []uint64, opts ...syncproto.Option) ([]common.Hash, sttypes.StreamID, error)
GetBlocksByHashes(ctx context.Context, hs []common.Hash, opts ...syncproto.Option) ([]*types.Block, sttypes.StreamID, error)
GetReceipts(ctx context.Context, hs []common.Hash, opts ...syncproto.Option) (receipts []types.Receipts, stid sttypes.StreamID, err error)
GetNodeData(ctx context.Context, hs []common.Hash, opts ...syncproto.Option) (data [][]byte, stid sttypes.StreamID, err error)
RemoveStream(stID sttypes.StreamID) // If a stream delivers invalid data, remove the stream
StreamFailed(stID sttypes.StreamID, reason string)

@ -23,6 +23,27 @@ type ChainReader interface {
// Config retrieves the blockchain's chain configuration.
Config() *params.ChainConfig
// TrieNode retrieves a blob of data associated with a trie node
// either from ephemeral in-memory cache, or from persistent storage.
TrieNode(hash common.Hash) ([]byte, error)
// ContractCode retrieves a blob of data associated with a contract
// hash either from ephemeral in-memory cache, or from persistent storage.
//
// If the code doesn't exist in the in-memory cache, check the storage with
// new code scheme.
ContractCode(hash common.Hash) ([]byte, error)
// ValidatorCode retrieves a blob of data associated with a validator
// hash either from ephemeral in-memory cache, or from persistent storage.
//
// If the code doesn't exist in the in-memory cache, check the storage with
// new code scheme.
ValidatorCode(hash common.Hash) ([]byte, error)
// GetReceiptsByHash retrieves the receipts for all transactions in a given block.
GetReceiptsByHash(hash common.Hash) types.Receipts
// CurrentHeader retrieves the current header from the local chain.
CurrentHeader() *block.Header

@ -80,6 +80,21 @@ type BlockChain interface {
GetBlockByNumber(number uint64) *types.Block
// GetReceiptsByHash retrieves the receipts for all transactions in a given block.
GetReceiptsByHash(hash common.Hash) types.Receipts
// TrieNode retrieves a blob of data associated with a trie node
// either from ephemeral in-memory cache, or from persistent storage.
TrieNode(hash common.Hash) ([]byte, error)
// ContractCode retrieves a blob of data associated with a contract
// hash either from ephemeral in-memory cache, or from persistent storage.
//
// If the code doesn't exist in the in-memory cache, check the storage with
// new code scheme.
ContractCode(hash common.Hash) ([]byte, error)
// ValidatorCode retrieves a blob of data associated with a validator
// hash either from ephemeral in-memory cache, or from persistent storage.
//
// If the code doesn't exist in the in-memory cache, check the storage with
// new code scheme.
ValidatorCode(hash common.Hash) ([]byte, error)
// Stop stops the blockchain service. If any imports are currently in progress
// it will abort them using the procInterrupt.
Stop()

@ -1098,6 +1098,24 @@ func (bc *BlockChainImpl) GetBlocksFromHash(hash common.Hash, n int) (blocks []*
return
}
// ContractCode retrieves a blob of data associated with a contract
// hash either from ephemeral in-memory cache, or from persistent storage.
//
// If the code doesn't exist in the in-memory cache, check the storage with
// new code scheme.
func (bc *BlockChainImpl) ContractCode(hash common.Hash) ([]byte, error) {
return bc.stateCache.ContractCode(common.Hash{}, hash)
}
// ValidatorCode retrieves a blob of data associated with a validator
// hash either from ephemeral in-memory cache, or from persistent storage.
//
// If the code doesn't exist in the in-memory cache, check the storage with
// new code scheme.
func (bc *BlockChainImpl) ValidatorCode(hash common.Hash) ([]byte, error) {
return bc.stateCache.ValidatorCode(common.Hash{}, hash)
}
func (bc *BlockChainImpl) GetUnclesInChain(b *types.Block, length int) []*block.Header {
uncles := []*block.Header{}
for i := 0; b != nil && i < length; i++ {

@ -62,6 +62,10 @@ func (a Stub) StateAt(common.Hash) (*state.DB, error) {
return nil, errors.Errorf("method StateAt not implemented for %s", a.Name)
}
func (a Stub) TrieNode(hash common.Hash) ([]byte, error) {
return []byte{}, errors.Errorf("method TrieNode not implemented for %s", a.Name)
}
func (a Stub) HasBlock(hash common.Hash, number uint64) bool {
return false
}
@ -90,6 +94,14 @@ func (a Stub) GetReceiptsByHash(hash common.Hash) types.Receipts {
return nil
}
func (a Stub) ContractCode(hash common.Hash) ([]byte, error) {
return []byte{}, nil
}
func (a Stub) ValidatorCode(hash common.Hash) ([]byte, error) {
return []byte{}, nil
}
func (a Stub) Stop() {
}

@ -88,12 +88,16 @@ func (bc *testBlockChain) changeBlockNumber(val uint64) {
func (bc *testBlockChain) ShardID() uint32 { return 0 }
func (bc *testBlockChain) ReadShardState(epoch *big.Int) (*shard.State, error) { return nil, nil }
func (bc *testBlockChain) TrieNode(hash common.Hash) ([]byte, error) { return []byte{}, nil }
func (bc *testBlockChain) Config() *params.ChainConfig { return nil }
func (bc *testBlockChain) WriteCommitSig(blockNum uint64, lastCommits []byte) error { return nil }
func (bc *testBlockChain) GetHeader(hash common.Hash, number uint64) *block.Header { return nil }
func (bc *testBlockChain) GetHeaderByNumber(number uint64) *block.Header { return nil }
func (bc *testBlockChain) GetHeaderByHash(hash common.Hash) *block.Header { return nil }
func (bc *testBlockChain) GetBlock(hash common.Hash, number uint64) *types.Block { return nil }
func (bc *testBlockChain) GetReceiptsByHash(hash common.Hash) types.Receipts { return nil }
func (bc *testBlockChain) ContractCode(hash common.Hash) ([]byte, error) { return []byte{}, nil }
func (bc *testBlockChain) ValidatorCode(hash common.Hash) ([]byte, error) { return []byte{}, nil }
func (bc *testBlockChain) ReadValidatorList() ([]common.Address, error) { return nil, nil }
func (bc *testBlockChain) ReadCommitSig(blockNum uint64) ([]byte, error) { return nil, nil }
func (bc *testBlockChain) ReadBlockRewardAccumulator(uint64) (*big.Int, error) { return nil, nil }

@ -323,8 +323,12 @@ func (bc *fakeBlockChain) CurrentHeader() *block.Header {
func (bc *fakeBlockChain) GetBlock(hash common.Hash, number uint64) *types.Block { return nil }
func (bc *fakeBlockChain) GetHeader(hash common.Hash, number uint64) *block.Header { return nil }
func (bc *fakeBlockChain) GetHeaderByHash(hash common.Hash) *block.Header { return nil }
func (bc *fakeBlockChain) GetReceiptsByHash(hash common.Hash) types.Receipts { return nil }
func (bc *fakeBlockChain) ContractCode(hash common.Hash) ([]byte, error) { return []byte{}, nil }
func (bc *fakeBlockChain) ValidatorCode(hash common.Hash) ([]byte, error) { return []byte{}, nil }
func (bc *fakeBlockChain) ShardID() uint32 { return 0 }
func (bc *fakeBlockChain) ReadShardState(epoch *big.Int) (*shard.State, error) { return nil, nil }
func (bc *fakeBlockChain) TrieNode(hash common.Hash) ([]byte, error) { return []byte{}, nil }
func (bc *fakeBlockChain) WriteCommitSig(blockNum uint64, lastCommits []byte) error { return nil }
func (bc *fakeBlockChain) GetHeaderByNumber(number uint64) *block.Header { return nil }
func (bc *fakeBlockChain) ReadValidatorList() ([]common.Address, error) { return nil, nil }

@ -16,6 +16,8 @@ type chainHelper interface {
getBlockHashes(bns []uint64) []common.Hash
getBlocksByNumber(bns []uint64) ([]*types.Block, error)
getBlocksByHashes(hs []common.Hash) ([]*types.Block, error)
getNodeData(hs []common.Hash) ([][]byte, error)
getReceipts(hs []common.Hash) ([]types.Receipts, error)
}
type chainHelperImpl struct {
@ -139,3 +141,44 @@ func (ch *chainHelperImpl) getBlockSigFromNextBlock(header *block.Header) []byte
func (ch *chainHelperImpl) getBlockSigFromDB(header *block.Header) ([]byte, error) {
return ch.chain.ReadCommitSig(header.Number().Uint64())
}
// getNodeData assembles the response to a node data query.
func (ch *chainHelperImpl) getNodeData(hs []common.Hash) ([][]byte, error) {
var (
bytes int
nodes [][]byte
)
for _, hash := range hs {
// Retrieve the requested state entry
entry, err := ch.chain.TrieNode(hash)
if len(entry) == 0 || err != nil {
// Read the contract/validator code with prefix only to save unnecessary lookups.
entry, err = ch.chain.ContractCode(hash)
if len(entry) == 0 || err != nil {
entry, err = ch.chain.ValidatorCode(hash)
}
}
if err == nil && len(entry) > 0 {
nodes = append(nodes, entry)
bytes += len(entry)
}
}
return nodes, nil
}
// getReceipts assembles the response to a receipt query.
func (ch *chainHelperImpl) getReceipts(hs []common.Hash) ([]types.Receipts, error) {
var receipts []types.Receipts
for i, hash := range hs {
// Retrieve the requested block's receipts
results := ch.chain.GetReceiptsByHash(hash)
if results == nil {
if header := ch.chain.GetHeaderByHash(hash); header == nil || header.ReceiptHash() != types.EmptyRootHash {
continue
}
}
receipts[i] = append(receipts[i], results...)
}
return receipts, nil
}

@ -46,6 +46,20 @@ func (tch *testChainHelper) getBlocksByHashes(hs []common.Hash) ([]*types.Block,
return bs, nil
}
func (tch *testChainHelper) getNodeData(hs []common.Hash) ([][]byte, error) {
data := makeTestNodeData(len(hs))
return data, nil
}
func (tch *testChainHelper) getReceipts(hs []common.Hash) ([]types.Receipts, error) {
testReceipts := makeTestReceipts(len(hs), 3)
receipts := make([]types.Receipts, len(hs)*3)
for i, _ := range hs {
receipts[i] = testReceipts
}
return receipts, nil
}
func numberToHash(bn uint64) common.Hash {
var h common.Hash
binary.LittleEndian.PutUint64(h[:], bn)
@ -90,6 +104,28 @@ func makeTestBlock(bn uint64) *types.Block {
return types.NewBlockWithHeader(&block.Header{Header: header})
}
// makeTestReceipts creates fake node data
func makeTestNodeData(n int) [][]byte {
testData := make([][]byte, n)
for i := 0; i < n; i++ {
testData[i] = types.EmptyRootHash.Bytes()
}
return testData
}
// makeTestReceipts creates fake receipts
func makeTestReceipts(n int, nPerBlock int) []*types.Receipt {
receipts := make([]*types.Receipt, nPerBlock)
for i := 0; i < nPerBlock; i++ {
receipts[i] = &types.Receipt{
Status: types.ReceiptStatusSuccessful,
CumulativeGasUsed: 0x888888888,
Logs: make([]*types.Log, 5),
}
}
return receipts
}
func decodeBlocksBytes(bbs [][]byte) ([]*types.Block, error) {
blocks := make([]*types.Block, 0, len(bbs))

@ -135,6 +135,52 @@ func (p *Protocol) GetBlocksByHashes(ctx context.Context, hs []common.Hash, opts
return
}
// GetReceipts do getReceiptsRequest through sync stream protocol.
// Return the receipts as result, target stream id, and error
func (p *Protocol) GetReceipts(ctx context.Context, hs []common.Hash, opts ...Option) (receipts []types.Receipts, stid sttypes.StreamID, err error) {
timer := p.doMetricClientRequest("getReceipts")
defer p.doMetricPostClientRequest("getReceipts", err, timer)
if len(hs) == 0 {
err = fmt.Errorf("zero receipt hashes requested")
return
}
if len(hs) > GetReceiptsCap {
err = fmt.Errorf("number of requested hashes exceed limit")
return
}
req := newGetReceiptsRequest(hs)
resp, stid, err := p.rm.DoRequest(ctx, req, opts...)
if err != nil {
return
}
receipts, err = req.getReceiptsFromResponse(resp)
return
}
// GetNodeData do getNodeData through sync stream protocol.
// Return the state node data as result, target stream id, and error
func (p *Protocol) GetNodeData(ctx context.Context, hs []common.Hash, opts ...Option) (data [][]byte, stid sttypes.StreamID, err error) {
timer := p.doMetricClientRequest("getNodeData")
defer p.doMetricPostClientRequest("getNodeData", err, timer)
if len(hs) == 0 {
err = fmt.Errorf("zero node data hashes requested")
return
}
if len(hs) > GetNodeDataCap {
err = fmt.Errorf("number of requested hashes exceed limit")
return
}
req := newGetNodeDataRequest(hs)
resp, stid, err := p.rm.DoRequest(ctx, req, opts...)
if err != nil {
return
}
data, err = req.getNodeDataFromResponse(resp)
return
}
// getBlocksByNumberRequest is the request for get block by numbers which implements
// sttypes.Request interface
type getBlocksByNumberRequest struct {
@ -387,3 +433,141 @@ func (req *getBlocksByHashesRequest) getBlocksFromResponse(resp sttypes.Response
}
return blocks, nil
}
// getNodeDataRequest is the request for get node data which implements
// sttypes.Request interface
type getNodeDataRequest struct {
hashes []common.Hash
pbReq *syncpb.Request
}
func newGetNodeDataRequest(hashes []common.Hash) *getNodeDataRequest {
pbReq := syncpb.MakeGetNodeDataRequest(hashes)
return &getNodeDataRequest{
hashes: hashes,
pbReq: pbReq,
}
}
func (req *getNodeDataRequest) ReqID() uint64 {
return req.pbReq.GetReqId()
}
func (req *getNodeDataRequest) SetReqID(val uint64) {
req.pbReq.ReqId = val
}
func (req *getNodeDataRequest) String() string {
ss := make([]string, 0, len(req.hashes))
for _, h := range req.hashes {
ss = append(ss, h.String())
}
hsStr := strings.Join(ss, ",")
return fmt.Sprintf("REQUEST [GetNodeData: %s]", hsStr)
}
func (req *getNodeDataRequest) IsSupportedByProto(target sttypes.ProtoSpec) bool {
return target.Version.GreaterThanOrEqual(MinVersion)
}
func (req *getNodeDataRequest) Encode() ([]byte, error) {
msg := syncpb.MakeMessageFromRequest(req.pbReq)
return protobuf.Marshal(msg)
}
func (req *getNodeDataRequest) getNodeDataFromResponse(resp sttypes.Response) ([][]byte, error) {
sResp, ok := resp.(*syncResponse)
if !ok || sResp == nil {
return nil, errors.New("not sync response")
}
dataBytes, err := req.parseNodeDataBytes(sResp)
if err != nil {
return nil, err
}
return dataBytes, nil
}
func (req *getNodeDataRequest) parseNodeDataBytes(resp *syncResponse) ([][]byte, error) {
if errResp := resp.pb.GetErrorResponse(); errResp != nil {
return nil, errors.New(errResp.Error)
}
ndResp := resp.pb.GetGetNodeDataResponse()
if ndResp == nil {
return nil, errors.New("response not GetNodeData")
}
return ndResp.DataBytes, nil
}
// getReceiptsRequest is the request for get receipts which implements
// sttypes.Request interface
type getReceiptsRequest struct {
hashes []common.Hash
pbReq *syncpb.Request
}
func newGetReceiptsRequest(hashes []common.Hash) *getReceiptsRequest {
pbReq := syncpb.MakeGetReceiptsRequest(hashes)
return &getReceiptsRequest{
hashes: hashes,
pbReq: pbReq,
}
}
func (req *getReceiptsRequest) ReqID() uint64 {
return req.pbReq.GetReqId()
}
func (req *getReceiptsRequest) SetReqID(val uint64) {
req.pbReq.ReqId = val
}
func (req *getReceiptsRequest) String() string {
ss := make([]string, 0, len(req.hashes))
for _, h := range req.hashes {
ss = append(ss, h.String())
}
hsStr := strings.Join(ss, ",")
return fmt.Sprintf("REQUEST [GetReceipts: %s]", hsStr)
}
func (req *getReceiptsRequest) IsSupportedByProto(target sttypes.ProtoSpec) bool {
return target.Version.GreaterThanOrEqual(MinVersion)
}
func (req *getReceiptsRequest) Encode() ([]byte, error) {
msg := syncpb.MakeMessageFromRequest(req.pbReq)
return protobuf.Marshal(msg)
}
func (req *getReceiptsRequest) getReceiptsFromResponse(resp sttypes.Response) ([]types.Receipts, error) {
sResp, ok := resp.(*syncResponse)
if !ok || sResp == nil {
return nil, errors.New("not sync response")
}
receipts, err := req.parseGetReceiptsBytes(sResp)
if err != nil {
return nil, err
}
return receipts, nil
}
func (req *getReceiptsRequest) parseGetReceiptsBytes(resp *syncResponse) ([]types.Receipts, error) {
if errResp := resp.pb.GetErrorResponse(); errResp != nil {
return nil, errors.New(errResp.Error)
}
grResp := resp.pb.GetGetReceiptsResponse()
if grResp == nil {
return nil, errors.New("response not GetReceipts")
}
receipts := make([]types.Receipts, len(grResp.Receipts))
for i, blockReceipts := range grResp.Receipts {
for _, rcptBytes := range blockReceipts.ReceiptBytes {
var receipt *types.Receipt
if err := rlp.DecodeBytes(rcptBytes, &receipt); err != nil {
return nil, errors.Wrap(err, "[GetReceiptsResponse]")
}
receipts[i] = append(receipts[i], receipt)
}
}
return receipts, nil
}

@ -15,6 +15,7 @@ import (
"github.com/harmony-one/harmony/core/types"
"github.com/harmony-one/harmony/p2p/stream/common/ratelimiter"
"github.com/harmony-one/harmony/p2p/stream/common/streammanager"
"github.com/harmony-one/harmony/p2p/stream/protocols/sync/message"
syncpb "github.com/harmony-one/harmony/p2p/stream/protocols/sync/message"
sttypes "github.com/harmony-one/harmony/p2p/stream/types"
)
@ -22,6 +23,7 @@ import (
var (
_ sttypes.Request = &getBlocksByNumberRequest{}
_ sttypes.Request = &getBlockNumberRequest{}
_ sttypes.Request = &getReceiptsRequest{}
_ sttypes.Response = &syncResponse{&syncpb.Response{}}
)
@ -37,8 +39,17 @@ var (
var (
testHeader = &block.Header{Header: headerV3.NewHeader()}
testBlock = types.NewBlockWithHeader(testHeader)
testReceipt = &types.Receipt{
Status: types.ReceiptStatusSuccessful,
CumulativeGasUsed: 0x888888888,
Logs: []*types.Log{},
}
testNodeData = numberToHash(123456789).Bytes()
testHeaderBytes, _ = rlp.EncodeToBytes(testHeader)
testBlockBytes, _ = rlp.EncodeToBytes(testBlock)
testReceiptBytes, _ = rlp.EncodeToBytes(testReceipt)
testNodeDataBytes, _ = rlp.EncodeToBytes(testNodeData)
testBlockResponse = syncpb.MakeGetBlocksByNumResponse(0, [][]byte{testBlockBytes}, make([][]byte, 1))
testCurBlockNumber uint64 = 100
@ -49,6 +60,13 @@ var (
testBlocksByHashesResponse = syncpb.MakeGetBlocksByHashesResponse(0, [][]byte{testBlockBytes}, make([][]byte, 1))
testReceipsMap = map[uint64]*message.Receipts{
0: {ReceiptBytes: [][]byte{testReceiptBytes}},
}
testReceiptResponse = syncpb.MakeGetReceiptsResponse(0, testReceipsMap)
testNodeDataResponse = syncpb.MakeGetNodeDataResponse(0, [][]byte{testNodeDataBytes})
testErrorResponse = syncpb.MakeErrorResponse(0, errors.New("test error"))
)
@ -289,6 +307,127 @@ func TestProtocol_GetBlocksByHashes(t *testing.T) {
}
}
func TestProtocol_GetReceipts(t *testing.T) {
tests := []struct {
getResponse getResponseFn
expErr error
expStID sttypes.StreamID
}{
{
getResponse: func(request sttypes.Request) (sttypes.Response, sttypes.StreamID) {
return &syncResponse{
pb: testReceiptResponse,
}, makeTestStreamID(0)
},
expErr: nil,
expStID: makeTestStreamID(0),
},
{
getResponse: func(request sttypes.Request) (sttypes.Response, sttypes.StreamID) {
return &syncResponse{
pb: testBlockResponse,
}, makeTestStreamID(0)
},
expErr: errors.New("response not GetReceipts"),
expStID: makeTestStreamID(0),
},
{
getResponse: nil,
expErr: errors.New("get response error"),
expStID: "",
},
{
getResponse: func(request sttypes.Request) (sttypes.Response, sttypes.StreamID) {
return &syncResponse{
pb: testErrorResponse,
}, makeTestStreamID(0)
},
expErr: errors.New("test error"),
expStID: makeTestStreamID(0),
},
}
for i, test := range tests {
protocol := makeTestProtocol(test.getResponse)
receipts, stid, err := protocol.GetReceipts(context.Background(), []common.Hash{numberToHash(100)})
if assErr := assertError(err, test.expErr); assErr != nil {
t.Errorf("Test %v: %v", i, assErr)
continue
}
if stid != test.expStID {
t.Errorf("Test %v: unexpected st id: %v / %v", i, stid, test.expStID)
}
if test.expErr == nil {
if len(receipts) != 1 {
t.Errorf("Test %v: size not 1", i)
}
if len(receipts[0]) != 1 {
t.Errorf("Test %v: block receipts size not 1", i)
}
}
}
}
func TestProtocol_GetNodeData(t *testing.T) {
tests := []struct {
getResponse getResponseFn
expErr error
expStID sttypes.StreamID
}{
{
getResponse: func(request sttypes.Request) (sttypes.Response, sttypes.StreamID) {
return &syncResponse{
pb: testNodeDataResponse,
}, makeTestStreamID(0)
},
expErr: nil,
expStID: makeTestStreamID(0),
},
{
getResponse: func(request sttypes.Request) (sttypes.Response, sttypes.StreamID) {
return &syncResponse{
pb: testBlockResponse,
}, makeTestStreamID(0)
},
expErr: errors.New("response not GetNodeData"),
expStID: makeTestStreamID(0),
},
{
getResponse: nil,
expErr: errors.New("get response error"),
expStID: "",
},
{
getResponse: func(request sttypes.Request) (sttypes.Response, sttypes.StreamID) {
return &syncResponse{
pb: testErrorResponse,
}, makeTestStreamID(0)
},
expErr: errors.New("test error"),
expStID: makeTestStreamID(0),
},
}
for i, test := range tests {
protocol := makeTestProtocol(test.getResponse)
receipts, stid, err := protocol.GetNodeData(context.Background(), []common.Hash{numberToHash(100)})
if assErr := assertError(err, test.expErr); assErr != nil {
t.Errorf("Test %v: %v", i, assErr)
continue
}
if stid != test.expStID {
t.Errorf("Test %v: unexpected st id: %v / %v", i, stid, test.expStID)
}
if test.expErr == nil {
if len(receipts) != 1 {
t.Errorf("Test %v: size not 1", i)
}
}
}
}
type getResponseFn func(request sttypes.Request) (sttypes.Response, sttypes.StreamID)
type testHostRequestManager struct {

@ -17,6 +17,14 @@ const (
// See comments for GetBlocksByNumAmountCap.
GetBlocksByHashesAmountCap = 10
// GetNodeDataCap is the cap of request of single GetNodeData request
// This number has an effect on maxMsgBytes as 20MB defined in github.com/harmony-one/harmony/p2p/stream/types.
GetNodeDataCap = 10
// GetReceiptsCap is the cap of request of single GetReceipts request
// This number has an effect on maxMsgBytes as 20MB defined in github.com/harmony-one/harmony/p2p/stream/types.
GetReceiptsCap = 10
// MaxStreamFailures is the maximum allowed failures before stream gets removed
MaxStreamFailures = 3

@ -46,6 +46,28 @@ func MakeGetBlocksByHashesRequest(hashes []common.Hash) *Request {
}
}
// MakeGetNodeDataRequest makes the GetNodeData request
func MakeGetNodeDataRequest(hashes []common.Hash) *Request {
return &Request{
Request: &Request_GetNodeDataRequest{
GetNodeDataRequest: &GetNodeDataRequest{
NodeHashes: hashesToBytes(hashes),
},
},
}
}
// MakeGetReceiptsRequest makes the GetReceipts request
func MakeGetReceiptsRequest(hashes []common.Hash) *Request {
return &Request{
Request: &Request_GetReceiptsRequest{
GetReceiptsRequest: &GetReceiptsRequest{
BlockHashes: hashesToBytes(hashes),
},
},
}
}
// MakeErrorResponse makes the error response
func MakeErrorResponseMessage(rid uint64, err error) *Message {
resp := MakeErrorResponse(rid, err)
@ -138,6 +160,42 @@ func MakeGetBlocksByHashesResponse(rid uint64, blocksBytes [][]byte, sigs [][]by
}
}
// MakeGetNodeDataResponseMessage makes the GetNodeDataResponse of Message type
func MakeGetNodeDataResponseMessage(rid uint64, nodeData [][]byte) *Message {
resp := MakeGetNodeDataResponse(rid, nodeData)
return makeMessageFromResponse(resp)
}
// MakeGetNodeDataResponse make the GetNodeDataResponse of Response type
func MakeGetNodeDataResponse(rid uint64, nodeData [][]byte) *Response {
return &Response{
ReqId: rid,
Response: &Response_GetNodeDataResponse{
GetNodeDataResponse: &GetNodeDataResponse{
DataBytes: nodeData,
},
},
}
}
// MakeGetReceiptsResponseMessage makes the GetReceiptsResponse of Message type
func MakeGetReceiptsResponseMessage(rid uint64, receipts map[uint64]*Receipts) *Message {
resp := MakeGetReceiptsResponse(rid, receipts)
return makeMessageFromResponse(resp)
}
// MakeGetReceiptsResponse make the GetReceiptsResponse of Response type
func MakeGetReceiptsResponse(rid uint64, receipts map[uint64]*Receipts) *Response {
return &Response{
ReqId: rid,
Response: &Response_GetReceiptsResponse{
GetReceiptsResponse: &GetReceiptsResponse{
Receipts: receipts,
},
},
}
}
// MakeMessageFromRequest makes a message from the request
func MakeMessageFromRequest(req *Request) *Message {
return &Message{

@ -113,6 +113,8 @@ type Request struct {
// *Request_GetBlockHashesRequest
// *Request_GetBlocksByNumRequest
// *Request_GetBlocksByHashesRequest
// *Request_GetNodeDataRequest
// *Request_GetReceiptsRequest
Request isRequest_Request `protobuf_oneof:"request"`
}
@ -190,6 +192,20 @@ func (x *Request) GetGetBlocksByHashesRequest() *GetBlocksByHashesRequest {
return nil
}
func (x *Request) GetGetNodeDataRequest() *GetNodeDataRequest {
if x, ok := x.GetRequest().(*Request_GetNodeDataRequest); ok {
return x.GetNodeDataRequest
}
return nil
}
func (x *Request) GetGetReceiptsRequest() *GetReceiptsRequest {
if x, ok := x.GetRequest().(*Request_GetReceiptsRequest); ok {
return x.GetReceiptsRequest
}
return nil
}
type isRequest_Request interface {
isRequest_Request()
}
@ -210,6 +226,14 @@ type Request_GetBlocksByHashesRequest struct {
GetBlocksByHashesRequest *GetBlocksByHashesRequest `protobuf:"bytes,5,opt,name=get_blocks_by_hashes_request,json=getBlocksByHashesRequest,proto3,oneof"`
}
type Request_GetNodeDataRequest struct {
GetNodeDataRequest *GetNodeDataRequest `protobuf:"bytes,6,opt,name=get_node_data_request,json=getNodeDataRequest,proto3,oneof"`
}
type Request_GetReceiptsRequest struct {
GetReceiptsRequest *GetReceiptsRequest `protobuf:"bytes,7,opt,name=get_receipts_request,json=getReceiptsRequest,proto3,oneof"`
}
func (*Request_GetBlockNumberRequest) isRequest_Request() {}
func (*Request_GetBlockHashesRequest) isRequest_Request() {}
@ -218,6 +242,10 @@ func (*Request_GetBlocksByNumRequest) isRequest_Request() {}
func (*Request_GetBlocksByHashesRequest) isRequest_Request() {}
func (*Request_GetNodeDataRequest) isRequest_Request() {}
func (*Request_GetReceiptsRequest) isRequest_Request() {}
type GetBlockNumberRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -397,6 +425,100 @@ func (x *GetBlocksByHashesRequest) GetBlockHashes() [][]byte {
return nil
}
type GetNodeDataRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
NodeHashes [][]byte `protobuf:"bytes,1,rep,name=node_hashes,json=nodeHashes,proto3" json:"node_hashes,omitempty"`
}
func (x *GetNodeDataRequest) Reset() {
*x = GetNodeDataRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_msg_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetNodeDataRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetNodeDataRequest) ProtoMessage() {}
func (x *GetNodeDataRequest) ProtoReflect() protoreflect.Message {
mi := &file_msg_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetNodeDataRequest.ProtoReflect.Descriptor instead.
func (*GetNodeDataRequest) Descriptor() ([]byte, []int) {
return file_msg_proto_rawDescGZIP(), []int{6}
}
func (x *GetNodeDataRequest) GetNodeHashes() [][]byte {
if x != nil {
return x.NodeHashes
}
return nil
}
type GetReceiptsRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
BlockHashes [][]byte `protobuf:"bytes,1,rep,name=block_hashes,json=blockHashes,proto3" json:"block_hashes,omitempty"`
}
func (x *GetReceiptsRequest) Reset() {
*x = GetReceiptsRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_msg_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetReceiptsRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetReceiptsRequest) ProtoMessage() {}
func (x *GetReceiptsRequest) ProtoReflect() protoreflect.Message {
mi := &file_msg_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetReceiptsRequest.ProtoReflect.Descriptor instead.
func (*GetReceiptsRequest) Descriptor() ([]byte, []int) {
return file_msg_proto_rawDescGZIP(), []int{7}
}
func (x *GetReceiptsRequest) GetBlockHashes() [][]byte {
if x != nil {
return x.BlockHashes
}
return nil
}
type Response struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -410,13 +532,15 @@ type Response struct {
// *Response_GetBlockHashesResponse
// *Response_GetBlocksByNumResponse
// *Response_GetBlocksByHashesResponse
// *Response_GetNodeDataResponse
// *Response_GetReceiptsResponse
Response isResponse_Response `protobuf_oneof:"response"`
}
func (x *Response) Reset() {
*x = Response{}
if protoimpl.UnsafeEnabled {
mi := &file_msg_proto_msgTypes[6]
mi := &file_msg_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -429,7 +553,7 @@ func (x *Response) String() string {
func (*Response) ProtoMessage() {}
func (x *Response) ProtoReflect() protoreflect.Message {
mi := &file_msg_proto_msgTypes[6]
mi := &file_msg_proto_msgTypes[8]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -442,7 +566,7 @@ func (x *Response) ProtoReflect() protoreflect.Message {
// Deprecated: Use Response.ProtoReflect.Descriptor instead.
func (*Response) Descriptor() ([]byte, []int) {
return file_msg_proto_rawDescGZIP(), []int{6}
return file_msg_proto_rawDescGZIP(), []int{8}
}
func (x *Response) GetReqId() uint64 {
@ -494,6 +618,20 @@ func (x *Response) GetGetBlocksByHashesResponse() *GetBlocksByHashesResponse {
return nil
}
func (x *Response) GetGetNodeDataResponse() *GetNodeDataResponse {
if x, ok := x.GetResponse().(*Response_GetNodeDataResponse); ok {
return x.GetNodeDataResponse
}
return nil
}
func (x *Response) GetGetReceiptsResponse() *GetReceiptsResponse {
if x, ok := x.GetResponse().(*Response_GetReceiptsResponse); ok {
return x.GetReceiptsResponse
}
return nil
}
type isResponse_Response interface {
isResponse_Response()
}
@ -518,6 +656,14 @@ type Response_GetBlocksByHashesResponse struct {
GetBlocksByHashesResponse *GetBlocksByHashesResponse `protobuf:"bytes,6,opt,name=get_blocks_by_hashes_response,json=getBlocksByHashesResponse,proto3,oneof"`
}
type Response_GetNodeDataResponse struct {
GetNodeDataResponse *GetNodeDataResponse `protobuf:"bytes,7,opt,name=get_node_data_response,json=getNodeDataResponse,proto3,oneof"`
}
type Response_GetReceiptsResponse struct {
GetReceiptsResponse *GetReceiptsResponse `protobuf:"bytes,8,opt,name=get_receipts_response,json=getReceiptsResponse,proto3,oneof"`
}
func (*Response_ErrorResponse) isResponse_Response() {}
func (*Response_GetBlockNumberResponse) isResponse_Response() {}
@ -528,6 +674,10 @@ func (*Response_GetBlocksByNumResponse) isResponse_Response() {}
func (*Response_GetBlocksByHashesResponse) isResponse_Response() {}
func (*Response_GetNodeDataResponse) isResponse_Response() {}
func (*Response_GetReceiptsResponse) isResponse_Response() {}
type ErrorResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -539,7 +689,7 @@ type ErrorResponse struct {
func (x *ErrorResponse) Reset() {
*x = ErrorResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_msg_proto_msgTypes[7]
mi := &file_msg_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -552,7 +702,7 @@ func (x *ErrorResponse) String() string {
func (*ErrorResponse) ProtoMessage() {}
func (x *ErrorResponse) ProtoReflect() protoreflect.Message {
mi := &file_msg_proto_msgTypes[7]
mi := &file_msg_proto_msgTypes[9]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -565,7 +715,7 @@ func (x *ErrorResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use ErrorResponse.ProtoReflect.Descriptor instead.
func (*ErrorResponse) Descriptor() ([]byte, []int) {
return file_msg_proto_rawDescGZIP(), []int{7}
return file_msg_proto_rawDescGZIP(), []int{9}
}
func (x *ErrorResponse) GetError() string {
@ -586,7 +736,7 @@ type GetBlockNumberResponse struct {
func (x *GetBlockNumberResponse) Reset() {
*x = GetBlockNumberResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_msg_proto_msgTypes[8]
mi := &file_msg_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -599,7 +749,7 @@ func (x *GetBlockNumberResponse) String() string {
func (*GetBlockNumberResponse) ProtoMessage() {}
func (x *GetBlockNumberResponse) ProtoReflect() protoreflect.Message {
mi := &file_msg_proto_msgTypes[8]
mi := &file_msg_proto_msgTypes[10]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -612,7 +762,7 @@ func (x *GetBlockNumberResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetBlockNumberResponse.ProtoReflect.Descriptor instead.
func (*GetBlockNumberResponse) Descriptor() ([]byte, []int) {
return file_msg_proto_rawDescGZIP(), []int{8}
return file_msg_proto_rawDescGZIP(), []int{10}
}
func (x *GetBlockNumberResponse) GetNumber() uint64 {
@ -633,7 +783,7 @@ type GetBlockHashesResponse struct {
func (x *GetBlockHashesResponse) Reset() {
*x = GetBlockHashesResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_msg_proto_msgTypes[9]
mi := &file_msg_proto_msgTypes[11]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -646,7 +796,7 @@ func (x *GetBlockHashesResponse) String() string {
func (*GetBlockHashesResponse) ProtoMessage() {}
func (x *GetBlockHashesResponse) ProtoReflect() protoreflect.Message {
mi := &file_msg_proto_msgTypes[9]
mi := &file_msg_proto_msgTypes[11]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -659,7 +809,7 @@ func (x *GetBlockHashesResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetBlockHashesResponse.ProtoReflect.Descriptor instead.
func (*GetBlockHashesResponse) Descriptor() ([]byte, []int) {
return file_msg_proto_rawDescGZIP(), []int{9}
return file_msg_proto_rawDescGZIP(), []int{11}
}
func (x *GetBlockHashesResponse) GetHashes() [][]byte {
@ -681,7 +831,7 @@ type GetBlocksByNumResponse struct {
func (x *GetBlocksByNumResponse) Reset() {
*x = GetBlocksByNumResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_msg_proto_msgTypes[10]
mi := &file_msg_proto_msgTypes[12]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -694,7 +844,7 @@ func (x *GetBlocksByNumResponse) String() string {
func (*GetBlocksByNumResponse) ProtoMessage() {}
func (x *GetBlocksByNumResponse) ProtoReflect() protoreflect.Message {
mi := &file_msg_proto_msgTypes[10]
mi := &file_msg_proto_msgTypes[12]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -707,7 +857,7 @@ func (x *GetBlocksByNumResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetBlocksByNumResponse.ProtoReflect.Descriptor instead.
func (*GetBlocksByNumResponse) Descriptor() ([]byte, []int) {
return file_msg_proto_rawDescGZIP(), []int{10}
return file_msg_proto_rawDescGZIP(), []int{12}
}
func (x *GetBlocksByNumResponse) GetBlocksBytes() [][]byte {
@ -736,7 +886,7 @@ type GetBlocksByHashesResponse struct {
func (x *GetBlocksByHashesResponse) Reset() {
*x = GetBlocksByHashesResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_msg_proto_msgTypes[11]
mi := &file_msg_proto_msgTypes[13]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -749,7 +899,7 @@ func (x *GetBlocksByHashesResponse) String() string {
func (*GetBlocksByHashesResponse) ProtoMessage() {}
func (x *GetBlocksByHashesResponse) ProtoReflect() protoreflect.Message {
mi := &file_msg_proto_msgTypes[11]
mi := &file_msg_proto_msgTypes[13]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -762,7 +912,7 @@ func (x *GetBlocksByHashesResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetBlocksByHashesResponse.ProtoReflect.Descriptor instead.
func (*GetBlocksByHashesResponse) Descriptor() ([]byte, []int) {
return file_msg_proto_rawDescGZIP(), []int{11}
return file_msg_proto_rawDescGZIP(), []int{13}
}
func (x *GetBlocksByHashesResponse) GetBlocksBytes() [][]byte {
@ -779,6 +929,147 @@ func (x *GetBlocksByHashesResponse) GetCommitSig() [][]byte {
return nil
}
type GetNodeDataResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
DataBytes [][]byte `protobuf:"bytes,1,rep,name=data_bytes,json=dataBytes,proto3" json:"data_bytes,omitempty"`
}
func (x *GetNodeDataResponse) Reset() {
*x = GetNodeDataResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_msg_proto_msgTypes[14]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetNodeDataResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetNodeDataResponse) ProtoMessage() {}
func (x *GetNodeDataResponse) ProtoReflect() protoreflect.Message {
mi := &file_msg_proto_msgTypes[14]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetNodeDataResponse.ProtoReflect.Descriptor instead.
func (*GetNodeDataResponse) Descriptor() ([]byte, []int) {
return file_msg_proto_rawDescGZIP(), []int{14}
}
func (x *GetNodeDataResponse) GetDataBytes() [][]byte {
if x != nil {
return x.DataBytes
}
return nil
}
type Receipts struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ReceiptBytes [][]byte `protobuf:"bytes,1,rep,name=receipt_bytes,json=receiptBytes,proto3" json:"receipt_bytes,omitempty"`
}
func (x *Receipts) Reset() {
*x = Receipts{}
if protoimpl.UnsafeEnabled {
mi := &file_msg_proto_msgTypes[15]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Receipts) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Receipts) ProtoMessage() {}
func (x *Receipts) ProtoReflect() protoreflect.Message {
mi := &file_msg_proto_msgTypes[15]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Receipts.ProtoReflect.Descriptor instead.
func (*Receipts) Descriptor() ([]byte, []int) {
return file_msg_proto_rawDescGZIP(), []int{15}
}
func (x *Receipts) GetReceiptBytes() [][]byte {
if x != nil {
return x.ReceiptBytes
}
return nil
}
type GetReceiptsResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Receipts map[uint64]*Receipts `protobuf:"bytes,1,rep,name=receipts,proto3" json:"receipts,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
}
func (x *GetReceiptsResponse) Reset() {
*x = GetReceiptsResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_msg_proto_msgTypes[16]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetReceiptsResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetReceiptsResponse) ProtoMessage() {}
func (x *GetReceiptsResponse) ProtoReflect() protoreflect.Message {
mi := &file_msg_proto_msgTypes[16]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetReceiptsResponse.ProtoReflect.Descriptor instead.
func (*GetReceiptsResponse) Descriptor() ([]byte, []int) {
return file_msg_proto_rawDescGZIP(), []int{16}
}
func (x *GetReceiptsResponse) GetReceipts() map[uint64]*Receipts {
if x != nil {
return x.Receipts
}
return nil
}
var File_msg_proto protoreflect.FileDescriptor
var file_msg_proto_rawDesc = []byte{
@ -793,7 +1084,7 @@ var file_msg_proto_rawDesc = []byte{
0x61, 0x72, 0x6d, 0x6f, 0x6e, 0x79, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x73, 0x79,
0x6e, 0x63, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x04, 0x72, 0x65, 0x73, 0x70, 0x42, 0x0d, 0x0a, 0x0b, 0x72,
0x65, 0x71, 0x5f, 0x6f, 0x72, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x22, 0xf2, 0x03, 0x0a, 0x07, 0x52,
0x65, 0x71, 0x5f, 0x6f, 0x72, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x22, 0xbd, 0x05, 0x0a, 0x07, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x15, 0x0a, 0x06, 0x72, 0x65, 0x71, 0x5f, 0x69, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x72, 0x65, 0x71, 0x49, 0x64, 0x12, 0x6d, 0x0a,
0x18, 0x67, 0x65, 0x74, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65,
@ -824,78 +1115,131 @@ var file_msg_proto_rawDesc = []byte{
0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x42, 0x79, 0x48, 0x61, 0x73, 0x68, 0x65,
0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x18, 0x67, 0x65, 0x74, 0x42,
0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x42, 0x79, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22,
0x17, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65,
0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x2f, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x42,
0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x12, 0x16, 0x0a, 0x04, 0x6e, 0x75, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x04, 0x42,
0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, 0x75, 0x6d, 0x73, 0x22, 0x2f, 0x0a, 0x15, 0x47, 0x65, 0x74,
0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x42, 0x79, 0x4e, 0x75, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x12, 0x16, 0x0a, 0x04, 0x6e, 0x75, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x04,
0x42, 0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, 0x75, 0x6d, 0x73, 0x22, 0x3d, 0x0a, 0x18, 0x47, 0x65,
0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x42, 0x79, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f,
0x68, 0x61, 0x73, 0x68, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0b, 0x62, 0x6c,
0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x22, 0xd5, 0x04, 0x0a, 0x08, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x15, 0x0a, 0x06, 0x72, 0x65, 0x71, 0x5f, 0x69, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x72, 0x65, 0x71, 0x49, 0x64, 0x12, 0x53, 0x0a,
0x0e, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18,
0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x68, 0x61, 0x72, 0x6d, 0x6f, 0x6e, 0x79, 0x2e,
0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x6d, 0x65, 0x73, 0x73,
0x61, 0x67, 0x65, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x48, 0x00, 0x52, 0x0d, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x12, 0x70, 0x0a, 0x19, 0x67, 0x65, 0x74, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f,
0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18,
0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x68, 0x61, 0x72, 0x6d, 0x6f, 0x6e, 0x79, 0x2e,
0x75, 0x65, 0x73, 0x74, 0x12, 0x64, 0x0a, 0x15, 0x67, 0x65, 0x74, 0x5f, 0x6e, 0x6f, 0x64, 0x65,
0x5f, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x06, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x68, 0x61, 0x72, 0x6d, 0x6f, 0x6e, 0x79, 0x2e, 0x73, 0x74,
0x72, 0x65, 0x61, 0x6d, 0x2e, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67,
0x65, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x12, 0x67, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x44,
0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x63, 0x0a, 0x14, 0x67, 0x65,
0x74, 0x5f, 0x72, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x73, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x68, 0x61, 0x72, 0x6d, 0x6f,
0x6e, 0x79, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x6d,
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x63, 0x65, 0x69, 0x70,
0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x12, 0x67, 0x65, 0x74,
0x52, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42,
0x09, 0x0a, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x17, 0x0a, 0x15, 0x47, 0x65,
0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x22, 0x2f, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48,
0x61, 0x73, 0x68, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x04,
0x6e, 0x75, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x04, 0x42, 0x02, 0x10, 0x01, 0x52, 0x04,
0x6e, 0x75, 0x6d, 0x73, 0x22, 0x2f, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b,
0x73, 0x42, 0x79, 0x4e, 0x75, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a,
0x04, 0x6e, 0x75, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x04, 0x42, 0x02, 0x10, 0x01, 0x52,
0x04, 0x6e, 0x75, 0x6d, 0x73, 0x22, 0x3d, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63,
0x6b, 0x73, 0x42, 0x79, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x65,
0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61,
0x73, 0x68, 0x65, 0x73, 0x22, 0x35, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x44,
0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x6e, 0x6f,
0x64, 0x65, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52,
0x0a, 0x6e, 0x6f, 0x64, 0x65, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x22, 0x37, 0x0a, 0x12, 0x47,
0x65, 0x74, 0x52, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x65,
0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61,
0x73, 0x68, 0x65, 0x73, 0x22, 0xa6, 0x06, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x12, 0x15, 0x0a, 0x06, 0x72, 0x65, 0x71, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x04, 0x52, 0x05, 0x72, 0x65, 0x71, 0x49, 0x64, 0x12, 0x53, 0x0a, 0x0e, 0x65, 0x72, 0x72, 0x6f,
0x72, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x2a, 0x2e, 0x68, 0x61, 0x72, 0x6d, 0x6f, 0x6e, 0x79, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61,
0x6d, 0x2e, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x45,
0x72, 0x72, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x0d,
0x65, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x70, 0x0a,
0x19, 0x67, 0x65, 0x74, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65,
0x72, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x33, 0x2e, 0x68, 0x61, 0x72, 0x6d, 0x6f, 0x6e, 0x79, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61,
0x6d, 0x2e, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x47,
0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x16, 0x67, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63,
0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
0x70, 0x0a, 0x19, 0x67, 0x65, 0x74, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x68, 0x61, 0x73,
0x68, 0x65, 0x73, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x04, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x33, 0x2e, 0x68, 0x61, 0x72, 0x6d, 0x6f, 0x6e, 0x79, 0x2e, 0x73, 0x74, 0x72,
0x65, 0x61, 0x6d, 0x2e, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
0x2e, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x16, 0x67, 0x65, 0x74, 0x42, 0x6c,
0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x12, 0x71, 0x0a, 0x1a, 0x67, 0x65, 0x74, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x5f,
0x62, 0x79, 0x5f, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18,
0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x68, 0x61, 0x72, 0x6d, 0x6f, 0x6e, 0x79, 0x2e,
0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x6d, 0x65, 0x73, 0x73,
0x61, 0x67, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62,
0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x16, 0x67, 0x65,
0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x70, 0x0a, 0x19, 0x67, 0x65, 0x74, 0x5f, 0x62, 0x6c, 0x6f, 0x63,
0x6b, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x65, 0x73, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x68, 0x61, 0x72, 0x6d, 0x6f, 0x6e,
0x79, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x6d, 0x65,
0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61,
0x73, 0x68, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x16,
0x67, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x71, 0x0a, 0x1a, 0x67, 0x65, 0x74, 0x5f, 0x62, 0x6c,
0x6f, 0x63, 0x6b, 0x73, 0x5f, 0x62, 0x79, 0x5f, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x68, 0x61, 0x72,
0x6d, 0x6f, 0x6e, 0x79, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x73, 0x79, 0x6e, 0x63,
0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63,
0x6b, 0x73, 0x42, 0x79, 0x4e, 0x75, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48,
0x00, 0x52, 0x16, 0x67, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x42, 0x79, 0x4e, 0x75,
0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7a, 0x0a, 0x1d, 0x67, 0x65, 0x74,
0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x5f, 0x62, 0x79, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x65,
0x73, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x36, 0x2e, 0x68, 0x61, 0x72, 0x6d, 0x6f, 0x6e, 0x79, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61,
0x61, 0x67, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x42, 0x79, 0x4e,
0x75, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x16, 0x67, 0x65,
0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x42, 0x79, 0x4e, 0x75, 0x6d, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7a, 0x0a, 0x1d, 0x67, 0x65, 0x74, 0x5f, 0x62, 0x6c, 0x6f, 0x63,
0x6b, 0x73, 0x5f, 0x62, 0x79, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x65, 0x73, 0x5f, 0x72, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x36, 0x2e, 0x68, 0x61,
0x72, 0x6d, 0x6f, 0x6e, 0x79, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x73, 0x79, 0x6e,
0x63, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f,
0x63, 0x6b, 0x73, 0x42, 0x79, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x19, 0x67, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73,
0x42, 0x79, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x12, 0x67, 0x0a, 0x16, 0x67, 0x65, 0x74, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x64, 0x61, 0x74,
0x61, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x30, 0x2e, 0x68, 0x61, 0x72, 0x6d, 0x6f, 0x6e, 0x79, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61,
0x6d, 0x2e, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x47,
0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x42, 0x79, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x19, 0x67, 0x65, 0x74, 0x42,
0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x42, 0x79, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x0a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x22, 0x25, 0x0a, 0x0d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x30, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x42,
0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01,
0x28, 0x04, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x30, 0x0a, 0x16, 0x47, 0x65,
0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x61, 0x73, 0x68, 0x65, 0x73, 0x18, 0x01,
0x20, 0x03, 0x28, 0x0c, 0x52, 0x06, 0x68, 0x61, 0x73, 0x68, 0x65, 0x73, 0x22, 0x5a, 0x0a, 0x16,
0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x42, 0x79, 0x4e, 0x75, 0x6d, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73,
0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0b, 0x62, 0x6c,
0x6f, 0x63, 0x6b, 0x73, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6f, 0x6d,
0x6d, 0x69, 0x74, 0x5f, 0x73, 0x69, 0x67, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x09, 0x63,
0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x53, 0x69, 0x67, 0x22, 0x5d, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x42,
0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x42, 0x79, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x5f,
0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0b, 0x62, 0x6c, 0x6f,
0x63, 0x6b, 0x73, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x6d,
0x69, 0x74, 0x5f, 0x73, 0x69, 0x67, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x09, 0x63, 0x6f,
0x6d, 0x6d, 0x69, 0x74, 0x53, 0x69, 0x67, 0x42, 0x0c, 0x5a, 0x0a, 0x2e, 0x2f, 0x3b, 0x6d, 0x65,
0x73, 0x73, 0x61, 0x67, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x48, 0x00, 0x52, 0x13, 0x67, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x44, 0x61, 0x74,
0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x66, 0x0a, 0x15, 0x67, 0x65, 0x74,
0x5f, 0x72, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x73, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x68, 0x61, 0x72, 0x6d, 0x6f,
0x6e, 0x79, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x6d,
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x63, 0x65, 0x69, 0x70,
0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x13, 0x67, 0x65,
0x74, 0x52, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x42, 0x0a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x25, 0x0a,
0x0d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14,
0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65,
0x72, 0x72, 0x6f, 0x72, 0x22, 0x30, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b,
0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16,
0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06,
0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x30, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f,
0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x12, 0x16, 0x0a, 0x06, 0x68, 0x61, 0x73, 0x68, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c,
0x52, 0x06, 0x68, 0x61, 0x73, 0x68, 0x65, 0x73, 0x22, 0x5a, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x42,
0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x42, 0x79, 0x4e, 0x75, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x5f, 0x62, 0x79, 0x74,
0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73,
0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x5f,
0x73, 0x69, 0x67, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x09, 0x63, 0x6f, 0x6d, 0x6d, 0x69,
0x74, 0x53, 0x69, 0x67, 0x22, 0x5d, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b,
0x73, 0x42, 0x79, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x5f, 0x62, 0x79, 0x74, 0x65,
0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x42,
0x79, 0x74, 0x65, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x5f, 0x73,
0x69, 0x67, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x09, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74,
0x53, 0x69, 0x67, 0x22, 0x34, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x44, 0x61,
0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x64, 0x61,
0x74, 0x61, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x09,
0x64, 0x61, 0x74, 0x61, 0x42, 0x79, 0x74, 0x65, 0x73, 0x22, 0x2f, 0x0a, 0x08, 0x52, 0x65, 0x63,
0x65, 0x69, 0x70, 0x74, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74,
0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0c, 0x72, 0x65,
0x63, 0x65, 0x69, 0x70, 0x74, 0x42, 0x79, 0x74, 0x65, 0x73, 0x22, 0xd5, 0x01, 0x0a, 0x13, 0x47,
0x65, 0x74, 0x52, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x12, 0x5a, 0x0a, 0x08, 0x72, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x73, 0x18, 0x01,
0x20, 0x03, 0x28, 0x0b, 0x32, 0x3e, 0x2e, 0x68, 0x61, 0x72, 0x6d, 0x6f, 0x6e, 0x79, 0x2e, 0x73,
0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61,
0x67, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x73, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x52, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x73, 0x45,
0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x72, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x73, 0x1a, 0x62,
0x0a, 0x0d, 0x52, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12,
0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x6b, 0x65,
0x79, 0x12, 0x3b, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x25, 0x2e, 0x68, 0x61, 0x72, 0x6d, 0x6f, 0x6e, 0x79, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61,
0x6d, 0x2e, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x52,
0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x73, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02,
0x38, 0x01, 0x42, 0x0c, 0x5a, 0x0a, 0x2e, 0x2f, 0x3b, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -910,7 +1254,7 @@ func file_msg_proto_rawDescGZIP() []byte {
return file_msg_proto_rawDescData
}
var file_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 12)
var file_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 18)
var file_msg_proto_goTypes = []interface{}{
(*Message)(nil), // 0: harmony.stream.sync.message.Message
(*Request)(nil), // 1: harmony.stream.sync.message.Request
@ -918,30 +1262,42 @@ var file_msg_proto_goTypes = []interface{}{
(*GetBlockHashesRequest)(nil), // 3: harmony.stream.sync.message.GetBlockHashesRequest
(*GetBlocksByNumRequest)(nil), // 4: harmony.stream.sync.message.GetBlocksByNumRequest
(*GetBlocksByHashesRequest)(nil), // 5: harmony.stream.sync.message.GetBlocksByHashesRequest
(*Response)(nil), // 6: harmony.stream.sync.message.Response
(*ErrorResponse)(nil), // 7: harmony.stream.sync.message.ErrorResponse
(*GetBlockNumberResponse)(nil), // 8: harmony.stream.sync.message.GetBlockNumberResponse
(*GetBlockHashesResponse)(nil), // 9: harmony.stream.sync.message.GetBlockHashesResponse
(*GetBlocksByNumResponse)(nil), // 10: harmony.stream.sync.message.GetBlocksByNumResponse
(*GetBlocksByHashesResponse)(nil), // 11: harmony.stream.sync.message.GetBlocksByHashesResponse
(*GetNodeDataRequest)(nil), // 6: harmony.stream.sync.message.GetNodeDataRequest
(*GetReceiptsRequest)(nil), // 7: harmony.stream.sync.message.GetReceiptsRequest
(*Response)(nil), // 8: harmony.stream.sync.message.Response
(*ErrorResponse)(nil), // 9: harmony.stream.sync.message.ErrorResponse
(*GetBlockNumberResponse)(nil), // 10: harmony.stream.sync.message.GetBlockNumberResponse
(*GetBlockHashesResponse)(nil), // 11: harmony.stream.sync.message.GetBlockHashesResponse
(*GetBlocksByNumResponse)(nil), // 12: harmony.stream.sync.message.GetBlocksByNumResponse
(*GetBlocksByHashesResponse)(nil), // 13: harmony.stream.sync.message.GetBlocksByHashesResponse
(*GetNodeDataResponse)(nil), // 14: harmony.stream.sync.message.GetNodeDataResponse
(*Receipts)(nil), // 15: harmony.stream.sync.message.Receipts
(*GetReceiptsResponse)(nil), // 16: harmony.stream.sync.message.GetReceiptsResponse
nil, // 17: harmony.stream.sync.message.GetReceiptsResponse.ReceiptsEntry
}
var file_msg_proto_depIdxs = []int32{
1, // 0: harmony.stream.sync.message.Message.req:type_name -> harmony.stream.sync.message.Request
6, // 1: harmony.stream.sync.message.Message.resp:type_name -> harmony.stream.sync.message.Response
8, // 1: harmony.stream.sync.message.Message.resp:type_name -> harmony.stream.sync.message.Response
2, // 2: harmony.stream.sync.message.Request.get_block_number_request:type_name -> harmony.stream.sync.message.GetBlockNumberRequest
3, // 3: harmony.stream.sync.message.Request.get_block_hashes_request:type_name -> harmony.stream.sync.message.GetBlockHashesRequest
4, // 4: harmony.stream.sync.message.Request.get_blocks_by_num_request:type_name -> harmony.stream.sync.message.GetBlocksByNumRequest
5, // 5: harmony.stream.sync.message.Request.get_blocks_by_hashes_request:type_name -> harmony.stream.sync.message.GetBlocksByHashesRequest
7, // 6: harmony.stream.sync.message.Response.error_response:type_name -> harmony.stream.sync.message.ErrorResponse
8, // 7: harmony.stream.sync.message.Response.get_block_number_response:type_name -> harmony.stream.sync.message.GetBlockNumberResponse
9, // 8: harmony.stream.sync.message.Response.get_block_hashes_response:type_name -> harmony.stream.sync.message.GetBlockHashesResponse
10, // 9: harmony.stream.sync.message.Response.get_blocks_by_num_response:type_name -> harmony.stream.sync.message.GetBlocksByNumResponse
11, // 10: harmony.stream.sync.message.Response.get_blocks_by_hashes_response:type_name -> harmony.stream.sync.message.GetBlocksByHashesResponse
11, // [11:11] is the sub-list for method output_type
11, // [11:11] is the sub-list for method input_type
11, // [11:11] is the sub-list for extension type_name
11, // [11:11] is the sub-list for extension extendee
0, // [0:11] is the sub-list for field type_name
6, // 6: harmony.stream.sync.message.Request.get_node_data_request:type_name -> harmony.stream.sync.message.GetNodeDataRequest
7, // 7: harmony.stream.sync.message.Request.get_receipts_request:type_name -> harmony.stream.sync.message.GetReceiptsRequest
9, // 8: harmony.stream.sync.message.Response.error_response:type_name -> harmony.stream.sync.message.ErrorResponse
10, // 9: harmony.stream.sync.message.Response.get_block_number_response:type_name -> harmony.stream.sync.message.GetBlockNumberResponse
11, // 10: harmony.stream.sync.message.Response.get_block_hashes_response:type_name -> harmony.stream.sync.message.GetBlockHashesResponse
12, // 11: harmony.stream.sync.message.Response.get_blocks_by_num_response:type_name -> harmony.stream.sync.message.GetBlocksByNumResponse
13, // 12: harmony.stream.sync.message.Response.get_blocks_by_hashes_response:type_name -> harmony.stream.sync.message.GetBlocksByHashesResponse
14, // 13: harmony.stream.sync.message.Response.get_node_data_response:type_name -> harmony.stream.sync.message.GetNodeDataResponse
16, // 14: harmony.stream.sync.message.Response.get_receipts_response:type_name -> harmony.stream.sync.message.GetReceiptsResponse
17, // 15: harmony.stream.sync.message.GetReceiptsResponse.receipts:type_name -> harmony.stream.sync.message.GetReceiptsResponse.ReceiptsEntry
15, // 16: harmony.stream.sync.message.GetReceiptsResponse.ReceiptsEntry.value:type_name -> harmony.stream.sync.message.Receipts
17, // [17:17] is the sub-list for method output_type
17, // [17:17] is the sub-list for method input_type
17, // [17:17] is the sub-list for extension type_name
17, // [17:17] is the sub-list for extension extendee
0, // [0:17] is the sub-list for field type_name
}
func init() { file_msg_proto_init() }
@ -1023,7 +1379,7 @@ func file_msg_proto_init() {
}
}
file_msg_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Response); i {
switch v := v.(*GetNodeDataRequest); i {
case 0:
return &v.state
case 1:
@ -1035,7 +1391,7 @@ func file_msg_proto_init() {
}
}
file_msg_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ErrorResponse); i {
switch v := v.(*GetReceiptsRequest); i {
case 0:
return &v.state
case 1:
@ -1047,7 +1403,7 @@ func file_msg_proto_init() {
}
}
file_msg_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetBlockNumberResponse); i {
switch v := v.(*Response); i {
case 0:
return &v.state
case 1:
@ -1059,7 +1415,7 @@ func file_msg_proto_init() {
}
}
file_msg_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetBlockHashesResponse); i {
switch v := v.(*ErrorResponse); i {
case 0:
return &v.state
case 1:
@ -1071,7 +1427,7 @@ func file_msg_proto_init() {
}
}
file_msg_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetBlocksByNumResponse); i {
switch v := v.(*GetBlockNumberResponse); i {
case 0:
return &v.state
case 1:
@ -1083,6 +1439,30 @@ func file_msg_proto_init() {
}
}
file_msg_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetBlockHashesResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_msg_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetBlocksByNumResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_msg_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetBlocksByHashesResponse); i {
case 0:
return &v.state
@ -1094,6 +1474,42 @@ func file_msg_proto_init() {
return nil
}
}
file_msg_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetNodeDataResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_msg_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Receipts); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_msg_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetReceiptsResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
file_msg_proto_msgTypes[0].OneofWrappers = []interface{}{
(*Message_Req)(nil),
@ -1104,13 +1520,17 @@ func file_msg_proto_init() {
(*Request_GetBlockHashesRequest)(nil),
(*Request_GetBlocksByNumRequest)(nil),
(*Request_GetBlocksByHashesRequest)(nil),
(*Request_GetNodeDataRequest)(nil),
(*Request_GetReceiptsRequest)(nil),
}
file_msg_proto_msgTypes[6].OneofWrappers = []interface{}{
file_msg_proto_msgTypes[8].OneofWrappers = []interface{}{
(*Response_ErrorResponse)(nil),
(*Response_GetBlockNumberResponse)(nil),
(*Response_GetBlockHashesResponse)(nil),
(*Response_GetBlocksByNumResponse)(nil),
(*Response_GetBlocksByHashesResponse)(nil),
(*Response_GetNodeDataResponse)(nil),
(*Response_GetReceiptsResponse)(nil),
}
type x struct{}
out := protoimpl.TypeBuilder{
@ -1118,7 +1538,7 @@ func file_msg_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_msg_proto_rawDesc,
NumEnums: 0,
NumMessages: 12,
NumMessages: 18,
NumExtensions: 0,
NumServices: 0,
},

@ -17,6 +17,8 @@ message Request {
GetBlockHashesRequest get_block_hashes_request = 3;
GetBlocksByNumRequest get_blocks_by_num_request = 4;
GetBlocksByHashesRequest get_blocks_by_hashes_request = 5;
GetNodeDataRequest get_node_data_request = 6;
GetReceiptsRequest get_receipts_request = 7;
}
}
@ -34,6 +36,14 @@ message GetBlocksByHashesRequest {
repeated bytes block_hashes = 1;
}
message GetNodeDataRequest {
repeated bytes node_hashes = 1;
}
message GetReceiptsRequest {
repeated bytes block_hashes = 1;
}
message Response {
uint64 req_id = 1;
oneof response {
@ -42,6 +52,8 @@ message Response {
GetBlockHashesResponse get_block_hashes_response = 4;
GetBlocksByNumResponse get_blocks_by_num_response = 5;
GetBlocksByHashesResponse get_blocks_by_hashes_response = 6;
GetNodeDataResponse get_node_data_response = 7;
GetReceiptsResponse get_receipts_response = 8;
}
}
@ -67,5 +79,14 @@ message GetBlocksByHashesResponse {
repeated bytes commit_sig = 2;
}
message GetNodeDataResponse {
repeated bytes data_bytes = 1;
}
message Receipts {
repeated bytes receipt_bytes = 1;
}
message GetReceiptsResponse {
map<uint64, Receipts> receipts = 1;
}

@ -182,6 +182,12 @@ func (st *syncStream) handleReq(req *syncpb.Request) error {
if bhReq := req.GetGetBlocksByHashesRequest(); bhReq != nil {
return st.handleGetBlocksByHashesRequest(req.ReqId, bhReq)
}
if ndReq := req.GetGetNodeDataRequest(); ndReq != nil {
return st.handleGetNodeDataRequest(req.ReqId, ndReq)
}
if rReq := req.GetGetReceiptsRequest(); rReq != nil {
return st.handleGetReceiptsRequest(req.ReqId, rReq)
}
// unsupported request type
return st.handleUnknownRequest(req.ReqId)
}
@ -260,6 +266,48 @@ func (st *syncStream) handleGetBlocksByHashesRequest(rid uint64, req *syncpb.Get
return errors.Wrap(err, "[GetBlocksByHashes]")
}
func (st *syncStream) handleGetNodeDataRequest(rid uint64, req *syncpb.GetNodeDataRequest) error {
serverRequestCounterVec.With(prometheus.Labels{
"topic": string(st.ProtoID()),
"request_type": "getNodeData",
}).Inc()
hashes := bytesToHashes(req.NodeHashes)
resp, err := st.computeGetNodeData(rid, hashes)
if resp == nil && err != nil {
resp = syncpb.MakeErrorResponseMessage(rid, err)
}
if writeErr := st.writeMsg(resp); writeErr != nil {
if err == nil {
err = writeErr
} else {
err = fmt.Errorf("%v; [writeMsg] %v", err.Error(), writeErr)
}
}
return errors.Wrap(err, "[GetNodeData]")
}
func (st *syncStream) handleGetReceiptsRequest(rid uint64, req *syncpb.GetReceiptsRequest) error {
serverRequestCounterVec.With(prometheus.Labels{
"topic": string(st.ProtoID()),
"request_type": "getReceipts",
}).Inc()
hashes := bytesToHashes(req.BlockHashes)
resp, err := st.computeGetReceipts(rid, hashes)
if resp == nil && err != nil {
resp = syncpb.MakeErrorResponseMessage(rid, err)
}
if writeErr := st.writeMsg(resp); writeErr != nil {
if err == nil {
err = writeErr
} else {
err = fmt.Errorf("%v; [writeMsg] %v", err.Error(), writeErr)
}
}
return errors.Wrap(err, "[GetReceipts]")
}
func (st *syncStream) handleUnknownRequest(rid uint64) error {
serverRequestCounterVec.With(prometheus.Labels{
"topic": string(st.ProtoID()),
@ -367,6 +415,44 @@ func (st *syncStream) computeRespFromBlockHashes(rid uint64, hs []common.Hash) (
return syncpb.MakeGetBlocksByHashesResponseMessage(rid, blocksBytes, sigs), nil
}
func (st *syncStream) computeGetNodeData(rid uint64, hs []common.Hash) (*syncpb.Message, error) {
if len(hs) > GetNodeDataCap {
err := fmt.Errorf("GetNodeData amount exceed cap: %v > %v", len(hs), GetNodeDataCap)
return nil, err
}
data, err := st.chain.getNodeData(hs)
if err != nil {
return nil, err
}
return syncpb.MakeGetNodeDataResponseMessage(rid, data), nil
}
func (st *syncStream) computeGetReceipts(rid uint64, hs []common.Hash) (*syncpb.Message, error) {
if len(hs) > GetReceiptsCap {
err := fmt.Errorf("GetReceipts amount exceed cap: %v > %v", len(hs), GetReceiptsCap)
return nil, err
}
receipts, err := st.chain.getReceipts(hs)
if err != nil {
return nil, err
}
var normalizedReceipts = make(map[uint64]*syncpb.Receipts, len(receipts))
for i, blkReceipts := range receipts {
normalizedReceipts[uint64(i)] = &syncpb.Receipts{
ReceiptBytes: make([][]byte, 0),
}
for _, receipt := range blkReceipts {
receiptBytes, err := rlp.EncodeToBytes(receipt)
if err != nil {
return nil, err
}
normalizedReceipts[uint64(i)].ReceiptBytes = append(normalizedReceipts[uint64(i)].ReceiptBytes, receiptBytes)
}
}
return syncpb.MakeGetReceiptsResponseMessage(rid, normalizedReceipts), nil
}
func bytesToHashes(bs [][]byte) []common.Hash {
hs := make([]common.Hash, 0, len(bs))
for _, b := range bs {

@ -248,7 +248,11 @@ func (cr *fakeChainReader) GetHeaderByNumber(number uint64) *block.Header
func (cr *fakeChainReader) GetHeaderByHash(hash common.Hash) *block.Header { return nil }
func (cr *fakeChainReader) GetHeader(hash common.Hash, number uint64) *block.Header { return nil }
func (cr *fakeChainReader) GetBlock(hash common.Hash, number uint64) *types.Block { return nil }
func (cr *fakeChainReader) GetReceiptsByHash(hash common.Hash) types.Receipts { return nil }
func (cr *fakeChainReader) ContractCode(hash common.Hash) ([]byte, error) { return []byte{}, nil }
func (cr *fakeChainReader) ValidatorCode(hash common.Hash) ([]byte, error) { return []byte{}, nil }
func (cr *fakeChainReader) ReadShardState(epoch *big.Int) (*shard.State, error) { return nil, nil }
func (cr *fakeChainReader) TrieNode(hash common.Hash) ([]byte, error) { return []byte{}, nil }
func (cr *fakeChainReader) ReadValidatorList() ([]common.Address, error) { return nil, nil }
func (cr *fakeChainReader) ValidatorCandidates() []common.Address { return nil }
func (cr *fakeChainReader) SuperCommitteeForNextEpoch(

Loading…
Cancel
Save