From 134fe2896275bb926b49743c1e25493f6b24cc31 Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Tue, 24 Sep 2019 10:07:34 -0700 Subject: [PATCH] remove benchmarks folder (#3999) Afaik, nobody is using it. I've never used it myself. 1) atomic, os.Write, map, codec benchmarks all seem temporary and to be of no use in the future. 2) syncing benchmark may be useful, but we're trying to move away from Bash. Also, the blocks are empty there. --- benchmarks/atomic_test.go | 29 - benchmarks/blockchain/.gitignore | 2 - benchmarks/blockchain/localsync.sh | 80 -- benchmarks/chan_test.go | 19 - benchmarks/codec_test.go | 123 --- benchmarks/empty.go | 1 - benchmarks/map_test.go | 35 - benchmarks/os_test.go | 33 - benchmarks/proto/README | 2 - benchmarks/proto/test.pb.go | 1456 ---------------------------- benchmarks/proto/test.proto | 29 - benchmarks/simu/counter.go | 47 - 12 files changed, 1856 deletions(-) delete mode 100644 benchmarks/atomic_test.go delete mode 100644 benchmarks/blockchain/.gitignore delete mode 100755 benchmarks/blockchain/localsync.sh delete mode 100644 benchmarks/chan_test.go delete mode 100644 benchmarks/codec_test.go delete mode 100644 benchmarks/empty.go delete mode 100644 benchmarks/map_test.go delete mode 100644 benchmarks/os_test.go delete mode 100644 benchmarks/proto/README delete mode 100644 benchmarks/proto/test.pb.go delete mode 100644 benchmarks/proto/test.proto delete mode 100644 benchmarks/simu/counter.go diff --git a/benchmarks/atomic_test.go b/benchmarks/atomic_test.go deleted file mode 100644 index 5fe4832df..000000000 --- a/benchmarks/atomic_test.go +++ /dev/null @@ -1,29 +0,0 @@ -package benchmarks - -import ( - "sync/atomic" - "testing" - "unsafe" -) - -func BenchmarkAtomicUintPtr(b *testing.B) { - b.StopTimer() - pointers := make([]uintptr, 1000) - b.Log(unsafe.Sizeof(pointers[0])) - b.StartTimer() - - for j := 0; j < b.N; j++ { - atomic.StoreUintptr(&pointers[j%1000], uintptr(j)) - } -} - -func BenchmarkAtomicPointer(b *testing.B) { - b.StopTimer() - pointers := make([]unsafe.Pointer, 1000) - b.Log(unsafe.Sizeof(pointers[0])) - b.StartTimer() - - for j := 0; j < b.N; j++ { - atomic.StorePointer(&pointers[j%1000], unsafe.Pointer(uintptr(j))) - } -} diff --git a/benchmarks/blockchain/.gitignore b/benchmarks/blockchain/.gitignore deleted file mode 100644 index 9e67bd47d..000000000 --- a/benchmarks/blockchain/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -data - diff --git a/benchmarks/blockchain/localsync.sh b/benchmarks/blockchain/localsync.sh deleted file mode 100755 index 2dc3e49c0..000000000 --- a/benchmarks/blockchain/localsync.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/bash - -DATA=$GOPATH/src/github.com/tendermint/tendermint/benchmarks/blockchain/data -if [ ! -d $DATA ]; then - echo "no data found, generating a chain... (this only has to happen once)" - - tendermint init --home $DATA - cp $DATA/config.toml $DATA/config2.toml - echo " - [consensus] - timeout_commit = 0 - " >> $DATA/config.toml - - echo "starting node" - tendermint node \ - --home $DATA \ - --proxy_app kvstore \ - --p2p.laddr tcp://127.0.0.1:56656 \ - --rpc.laddr tcp://127.0.0.1:56657 \ - --log_level error & - - echo "making blocks for 60s" - sleep 60 - - mv $DATA/config2.toml $DATA/config.toml - - kill %1 - - echo "done generating chain." -fi - -# validator node -HOME1=$TMPDIR$RANDOM$RANDOM -cp -R $DATA $HOME1 -echo "starting validator node" -tendermint node \ - --home $HOME1 \ - --proxy_app kvstore \ - --p2p.laddr tcp://127.0.0.1:56656 \ - --rpc.laddr tcp://127.0.0.1:56657 \ - --log_level error & -sleep 1 - -# downloader node -HOME2=$TMPDIR$RANDOM$RANDOM -tendermint init --home $HOME2 -cp $HOME1/genesis.json $HOME2 -printf "starting downloader node" -tendermint node \ - --home $HOME2 \ - --proxy_app kvstore \ - --p2p.laddr tcp://127.0.0.1:56666 \ - --rpc.laddr tcp://127.0.0.1:56667 \ - --p2p.persistent_peers 127.0.0.1:56656 \ - --log_level error & - -# wait for node to start up so we only count time where we are actually syncing -sleep 0.5 -while curl localhost:56667/status 2> /dev/null | grep "\"latest_block_height\": 0," > /dev/null -do - printf '.' - sleep 0.2 -done -echo - -echo "syncing blockchain for 10s" -for i in {1..10} -do - sleep 1 - HEIGHT="$(curl localhost:56667/status 2> /dev/null \ - | grep 'latest_block_height' \ - | grep -o ' [0-9]*' \ - | xargs)" - let 'RATE = HEIGHT / i' - echo "height: $HEIGHT, blocks/sec: $RATE" -done - -kill %1 -kill %2 -rm -rf $HOME1 $HOME2 diff --git a/benchmarks/chan_test.go b/benchmarks/chan_test.go deleted file mode 100644 index 78b70c9be..000000000 --- a/benchmarks/chan_test.go +++ /dev/null @@ -1,19 +0,0 @@ -package benchmarks - -import ( - "testing" -) - -func BenchmarkChanMakeClose(b *testing.B) { - b.StopTimer() - b.StartTimer() - - for j := 0; j < b.N; j++ { - foo := make(chan struct{}) - close(foo) - something, ok := <-foo - if ok { - b.Error(something, ok) - } - } -} diff --git a/benchmarks/codec_test.go b/benchmarks/codec_test.go deleted file mode 100644 index 64c0e72cf..000000000 --- a/benchmarks/codec_test.go +++ /dev/null @@ -1,123 +0,0 @@ -package benchmarks - -import ( - "testing" - "time" - - amino "github.com/tendermint/go-amino" - - proto "github.com/tendermint/tendermint/benchmarks/proto" - "github.com/tendermint/tendermint/crypto/ed25519" - "github.com/tendermint/tendermint/p2p" - ctypes "github.com/tendermint/tendermint/rpc/core/types" -) - -func testNodeInfo(id p2p.ID) p2p.DefaultNodeInfo { - return p2p.DefaultNodeInfo{ - ProtocolVersion: p2p.ProtocolVersion{P2P: 1, Block: 2, App: 3}, - ID_: id, - Moniker: "SOMENAME", - Network: "SOMENAME", - ListenAddr: "SOMEADDR", - Version: "SOMEVER", - Other: p2p.DefaultNodeInfoOther{ - TxIndex: "on", - RPCAddress: "0.0.0.0:26657", - }, - } -} - -func BenchmarkEncodeStatusWire(b *testing.B) { - b.StopTimer() - cdc := amino.NewCodec() - ctypes.RegisterAmino(cdc) - nodeKey := p2p.NodeKey{PrivKey: ed25519.GenPrivKey()} - status := &ctypes.ResultStatus{ - NodeInfo: testNodeInfo(nodeKey.ID()), - SyncInfo: ctypes.SyncInfo{ - LatestBlockHash: []byte("SOMEBYTES"), - LatestBlockHeight: 123, - LatestBlockTime: time.Unix(0, 1234), - }, - ValidatorInfo: ctypes.ValidatorInfo{ - PubKey: nodeKey.PubKey(), - }, - } - b.StartTimer() - - counter := 0 - for i := 0; i < b.N; i++ { - jsonBytes, err := cdc.MarshalJSON(status) - if err != nil { - panic(err) - } - counter += len(jsonBytes) - } - -} - -func BenchmarkEncodeNodeInfoWire(b *testing.B) { - b.StopTimer() - cdc := amino.NewCodec() - ctypes.RegisterAmino(cdc) - nodeKey := p2p.NodeKey{PrivKey: ed25519.GenPrivKey()} - nodeInfo := testNodeInfo(nodeKey.ID()) - b.StartTimer() - - counter := 0 - for i := 0; i < b.N; i++ { - jsonBytes, err := cdc.MarshalJSON(nodeInfo) - if err != nil { - panic(err) - } - counter += len(jsonBytes) - } -} - -func BenchmarkEncodeNodeInfoBinary(b *testing.B) { - b.StopTimer() - cdc := amino.NewCodec() - ctypes.RegisterAmino(cdc) - nodeKey := p2p.NodeKey{PrivKey: ed25519.GenPrivKey()} - nodeInfo := testNodeInfo(nodeKey.ID()) - b.StartTimer() - - counter := 0 - for i := 0; i < b.N; i++ { - jsonBytes := cdc.MustMarshalBinaryBare(nodeInfo) - counter += len(jsonBytes) - } - -} - -func BenchmarkEncodeNodeInfoProto(b *testing.B) { - b.StopTimer() - nodeKey := p2p.NodeKey{PrivKey: ed25519.GenPrivKey()} - nodeID := string(nodeKey.ID()) - someName := "SOMENAME" - someAddr := "SOMEADDR" - someVer := "SOMEVER" - someString := "SOMESTRING" - otherString := "OTHERSTRING" - nodeInfo := proto.NodeInfo{ - Id: &proto.ID{Id: &nodeID}, - Moniker: &someName, - Network: &someName, - ListenAddr: &someAddr, - Version: &someVer, - Other: []string{someString, otherString}, - } - b.StartTimer() - - counter := 0 - for i := 0; i < b.N; i++ { - bytes, err := nodeInfo.Marshal() - if err != nil { - b.Fatal(err) - return - } - //jsonBytes := wire.JSONBytes(nodeInfo) - counter += len(bytes) - } - -} diff --git a/benchmarks/empty.go b/benchmarks/empty.go deleted file mode 100644 index 20f08f14b..000000000 --- a/benchmarks/empty.go +++ /dev/null @@ -1 +0,0 @@ -package benchmarks diff --git a/benchmarks/map_test.go b/benchmarks/map_test.go deleted file mode 100644 index d13a19edf..000000000 --- a/benchmarks/map_test.go +++ /dev/null @@ -1,35 +0,0 @@ -package benchmarks - -import ( - "testing" - - cmn "github.com/tendermint/tendermint/libs/common" -) - -func BenchmarkSomething(b *testing.B) { - b.StopTimer() - numItems := 100000 - numChecks := 100000 - keys := make([]string, numItems) - for i := 0; i < numItems; i++ { - keys[i] = cmn.RandStr(100) - } - txs := make([]string, numChecks) - for i := 0; i < numChecks; i++ { - txs[i] = cmn.RandStr(100) - } - b.StartTimer() - - counter := 0 - for j := 0; j < b.N; j++ { - foo := make(map[string]string) - for _, key := range keys { - foo[key] = key - } - for _, tx := range txs { - if _, ok := foo[tx]; ok { - counter++ - } - } - } -} diff --git a/benchmarks/os_test.go b/benchmarks/os_test.go deleted file mode 100644 index 406038b9d..000000000 --- a/benchmarks/os_test.go +++ /dev/null @@ -1,33 +0,0 @@ -package benchmarks - -import ( - "os" - "testing" - - cmn "github.com/tendermint/tendermint/libs/common" -) - -func BenchmarkFileWrite(b *testing.B) { - b.StopTimer() - file, err := os.OpenFile("benchmark_file_write.out", - os.O_RDWR|os.O_CREATE|os.O_APPEND, 0600) - if err != nil { - b.Error(err) - } - testString := cmn.RandStr(200) + "\n" - b.StartTimer() - - for i := 0; i < b.N; i++ { - _, err := file.Write([]byte(testString)) - if err != nil { - b.Error(err) - } - } - - if err := file.Close(); err != nil { - b.Error(err) - } - if err := os.Remove("benchmark_file_write.out"); err != nil { - b.Error(err) - } -} diff --git a/benchmarks/proto/README b/benchmarks/proto/README deleted file mode 100644 index 87ece2576..000000000 --- a/benchmarks/proto/README +++ /dev/null @@ -1,2 +0,0 @@ -Doing some protobuf tests here. -Using gogoprotobuf. diff --git a/benchmarks/proto/test.pb.go b/benchmarks/proto/test.pb.go deleted file mode 100644 index d430eeb08..000000000 --- a/benchmarks/proto/test.pb.go +++ /dev/null @@ -1,1456 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: test.proto - -/* - Package test is a generated protocol buffer package. - - It is generated from these files: - test.proto - - It has these top-level messages: - ResultStatus - NodeInfo - ID - PubKey - PubKeyEd25519 -*/ -package test - -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" - -import io "io" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type ResultStatus struct { - NodeInfo *NodeInfo `protobuf:"bytes,1,opt,name=nodeInfo" json:"nodeInfo,omitempty"` - PubKey *PubKey `protobuf:"bytes,2,req,name=pubKey" json:"pubKey,omitempty"` - LatestBlockHash []byte `protobuf:"bytes,3,req,name=latestBlockHash" json:"latestBlockHash,omitempty"` - LatestBlockHeight *int64 `protobuf:"varint,4,req,name=latestBlockHeight" json:"latestBlockHeight,omitempty"` - LatestBlocktime *int64 `protobuf:"varint,5,req,name=latestBlocktime" json:"latestBlocktime,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *ResultStatus) Reset() { *m = ResultStatus{} } -func (m *ResultStatus) String() string { return proto.CompactTextString(m) } -func (*ResultStatus) ProtoMessage() {} -func (*ResultStatus) Descriptor() ([]byte, []int) { return fileDescriptorTest, []int{0} } - -func (m *ResultStatus) GetNodeInfo() *NodeInfo { - if m != nil { - return m.NodeInfo - } - return nil -} - -func (m *ResultStatus) GetPubKey() *PubKey { - if m != nil { - return m.PubKey - } - return nil -} - -func (m *ResultStatus) GetLatestBlockHash() []byte { - if m != nil { - return m.LatestBlockHash - } - return nil -} - -func (m *ResultStatus) GetLatestBlockHeight() int64 { - if m != nil && m.LatestBlockHeight != nil { - return *m.LatestBlockHeight - } - return 0 -} - -func (m *ResultStatus) GetLatestBlocktime() int64 { - if m != nil && m.LatestBlocktime != nil { - return *m.LatestBlocktime - } - return 0 -} - -type NodeInfo struct { - Id *ID `protobuf:"bytes,1,req,name=id" json:"id,omitempty"` - Moniker *string `protobuf:"bytes,2,req,name=moniker" json:"moniker,omitempty"` - Network *string `protobuf:"bytes,3,req,name=network" json:"network,omitempty"` - RemoteAddr *string `protobuf:"bytes,4,req,name=remoteAddr" json:"remoteAddr,omitempty"` - ListenAddr *string `protobuf:"bytes,5,req,name=listenAddr" json:"listenAddr,omitempty"` - Version *string `protobuf:"bytes,6,req,name=version" json:"version,omitempty"` - Other []string `protobuf:"bytes,7,rep,name=other" json:"other,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *NodeInfo) Reset() { *m = NodeInfo{} } -func (m *NodeInfo) String() string { return proto.CompactTextString(m) } -func (*NodeInfo) ProtoMessage() {} -func (*NodeInfo) Descriptor() ([]byte, []int) { return fileDescriptorTest, []int{1} } - -func (m *NodeInfo) GetId() *ID { - if m != nil { - return m.Id - } - return nil -} - -func (m *NodeInfo) GetMoniker() string { - if m != nil && m.Moniker != nil { - return *m.Moniker - } - return "" -} - -func (m *NodeInfo) GetNetwork() string { - if m != nil && m.Network != nil { - return *m.Network - } - return "" -} - -func (m *NodeInfo) GetRemoteAddr() string { - if m != nil && m.RemoteAddr != nil { - return *m.RemoteAddr - } - return "" -} - -func (m *NodeInfo) GetListenAddr() string { - if m != nil && m.ListenAddr != nil { - return *m.ListenAddr - } - return "" -} - -func (m *NodeInfo) GetVersion() string { - if m != nil && m.Version != nil { - return *m.Version - } - return "" -} - -func (m *NodeInfo) GetOther() []string { - if m != nil { - return m.Other - } - return nil -} - -type ID struct { - Id *string `protobuf:"bytes,1,req,name=id" json:"id,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *ID) Reset() { *m = ID{} } -func (m *ID) String() string { return proto.CompactTextString(m) } -func (*ID) ProtoMessage() {} -func (*ID) Descriptor() ([]byte, []int) { return fileDescriptorTest, []int{2} } - -func (m *ID) GetId() string { - if m != nil && m.Id != nil { - return *m.Id - } - return "" -} - -type PubKey struct { - Ed25519 *PubKeyEd25519 `protobuf:"bytes,1,opt,name=ed25519" json:"ed25519,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *PubKey) Reset() { *m = PubKey{} } -func (m *PubKey) String() string { return proto.CompactTextString(m) } -func (*PubKey) ProtoMessage() {} -func (*PubKey) Descriptor() ([]byte, []int) { return fileDescriptorTest, []int{3} } - -func (m *PubKey) GetEd25519() *PubKeyEd25519 { - if m != nil { - return m.Ed25519 - } - return nil -} - -type PubKeyEd25519 struct { - Bytes []byte `protobuf:"bytes,1,req,name=bytes" json:"bytes,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *PubKeyEd25519) Reset() { *m = PubKeyEd25519{} } -func (m *PubKeyEd25519) String() string { return proto.CompactTextString(m) } -func (*PubKeyEd25519) ProtoMessage() {} -func (*PubKeyEd25519) Descriptor() ([]byte, []int) { return fileDescriptorTest, []int{4} } - -func (m *PubKeyEd25519) GetBytes() []byte { - if m != nil { - return m.Bytes - } - return nil -} - -func init() { - proto.RegisterType((*ResultStatus)(nil), "ResultStatus") - proto.RegisterType((*NodeInfo)(nil), "NodeInfo") - proto.RegisterType((*ID)(nil), "ID") - proto.RegisterType((*PubKey)(nil), "PubKey") - proto.RegisterType((*PubKeyEd25519)(nil), "PubKeyEd25519") -} -func (m *ResultStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ResultStatus) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.NodeInfo != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintTest(dAtA, i, uint64(m.NodeInfo.Size())) - n1, err := m.NodeInfo.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n1 - } - if m.PubKey == nil { - return 0, proto.NewRequiredNotSetError("pubKey") - } else { - dAtA[i] = 0x12 - i++ - i = encodeVarintTest(dAtA, i, uint64(m.PubKey.Size())) - n2, err := m.PubKey.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n2 - } - if m.LatestBlockHash == nil { - return 0, proto.NewRequiredNotSetError("latestBlockHash") - } else { - dAtA[i] = 0x1a - i++ - i = encodeVarintTest(dAtA, i, uint64(len(m.LatestBlockHash))) - i += copy(dAtA[i:], m.LatestBlockHash) - } - if m.LatestBlockHeight == nil { - return 0, proto.NewRequiredNotSetError("latestBlockHeight") - } else { - dAtA[i] = 0x20 - i++ - i = encodeVarintTest(dAtA, i, uint64(*m.LatestBlockHeight)) - } - if m.LatestBlocktime == nil { - return 0, proto.NewRequiredNotSetError("latestBlocktime") - } else { - dAtA[i] = 0x28 - i++ - i = encodeVarintTest(dAtA, i, uint64(*m.LatestBlocktime)) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *NodeInfo) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NodeInfo) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Id == nil { - return 0, proto.NewRequiredNotSetError("id") - } else { - dAtA[i] = 0xa - i++ - i = encodeVarintTest(dAtA, i, uint64(m.Id.Size())) - n3, err := m.Id.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n3 - } - if m.Moniker == nil { - return 0, proto.NewRequiredNotSetError("moniker") - } else { - dAtA[i] = 0x12 - i++ - i = encodeVarintTest(dAtA, i, uint64(len(*m.Moniker))) - i += copy(dAtA[i:], *m.Moniker) - } - if m.Network == nil { - return 0, proto.NewRequiredNotSetError("network") - } else { - dAtA[i] = 0x1a - i++ - i = encodeVarintTest(dAtA, i, uint64(len(*m.Network))) - i += copy(dAtA[i:], *m.Network) - } - if m.RemoteAddr == nil { - return 0, proto.NewRequiredNotSetError("remoteAddr") - } else { - dAtA[i] = 0x22 - i++ - i = encodeVarintTest(dAtA, i, uint64(len(*m.RemoteAddr))) - i += copy(dAtA[i:], *m.RemoteAddr) - } - if m.ListenAddr == nil { - return 0, proto.NewRequiredNotSetError("listenAddr") - } else { - dAtA[i] = 0x2a - i++ - i = encodeVarintTest(dAtA, i, uint64(len(*m.ListenAddr))) - i += copy(dAtA[i:], *m.ListenAddr) - } - if m.Version == nil { - return 0, proto.NewRequiredNotSetError("version") - } else { - dAtA[i] = 0x32 - i++ - i = encodeVarintTest(dAtA, i, uint64(len(*m.Version))) - i += copy(dAtA[i:], *m.Version) - } - if len(m.Other) > 0 { - for _, s := range m.Other { - dAtA[i] = 0x3a - i++ - l = len(s) - for l >= 1<<7 { - dAtA[i] = uint8(uint64(l)&0x7f | 0x80) - l >>= 7 - i++ - } - dAtA[i] = uint8(l) - i++ - i += copy(dAtA[i:], s) - } - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *ID) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ID) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Id == nil { - return 0, proto.NewRequiredNotSetError("id") - } else { - dAtA[i] = 0xa - i++ - i = encodeVarintTest(dAtA, i, uint64(len(*m.Id))) - i += copy(dAtA[i:], *m.Id) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *PubKey) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PubKey) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Ed25519 != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintTest(dAtA, i, uint64(m.Ed25519.Size())) - n4, err := m.Ed25519.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n4 - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *PubKeyEd25519) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PubKeyEd25519) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Bytes == nil { - return 0, proto.NewRequiredNotSetError("bytes") - } else { - dAtA[i] = 0xa - i++ - i = encodeVarintTest(dAtA, i, uint64(len(m.Bytes))) - i += copy(dAtA[i:], m.Bytes) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func encodeVarintTest(dAtA []byte, offset int, v uint64) int { - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return offset + 1 -} -func (m *ResultStatus) Size() (n int) { - var l int - _ = l - if m.NodeInfo != nil { - l = m.NodeInfo.Size() - n += 1 + l + sovTest(uint64(l)) - } - if m.PubKey != nil { - l = m.PubKey.Size() - n += 1 + l + sovTest(uint64(l)) - } - if m.LatestBlockHash != nil { - l = len(m.LatestBlockHash) - n += 1 + l + sovTest(uint64(l)) - } - if m.LatestBlockHeight != nil { - n += 1 + sovTest(uint64(*m.LatestBlockHeight)) - } - if m.LatestBlocktime != nil { - n += 1 + sovTest(uint64(*m.LatestBlocktime)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *NodeInfo) Size() (n int) { - var l int - _ = l - if m.Id != nil { - l = m.Id.Size() - n += 1 + l + sovTest(uint64(l)) - } - if m.Moniker != nil { - l = len(*m.Moniker) - n += 1 + l + sovTest(uint64(l)) - } - if m.Network != nil { - l = len(*m.Network) - n += 1 + l + sovTest(uint64(l)) - } - if m.RemoteAddr != nil { - l = len(*m.RemoteAddr) - n += 1 + l + sovTest(uint64(l)) - } - if m.ListenAddr != nil { - l = len(*m.ListenAddr) - n += 1 + l + sovTest(uint64(l)) - } - if m.Version != nil { - l = len(*m.Version) - n += 1 + l + sovTest(uint64(l)) - } - if len(m.Other) > 0 { - for _, s := range m.Other { - l = len(s) - n += 1 + l + sovTest(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *ID) Size() (n int) { - var l int - _ = l - if m.Id != nil { - l = len(*m.Id) - n += 1 + l + sovTest(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *PubKey) Size() (n int) { - var l int - _ = l - if m.Ed25519 != nil { - l = m.Ed25519.Size() - n += 1 + l + sovTest(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *PubKeyEd25519) Size() (n int) { - var l int - _ = l - if m.Bytes != nil { - l = len(m.Bytes) - n += 1 + l + sovTest(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovTest(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} - -func (m *ResultStatus) Unmarshal(dAtA []byte) error { - var hasFields [1]uint64 - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ResultStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ResultStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NodeInfo", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTest - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.NodeInfo == nil { - m.NodeInfo = &NodeInfo{} - } - if err := m.NodeInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PubKey", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTest - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.PubKey == nil { - m.PubKey = &PubKey{} - } - if err := m.PubKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - hasFields[0] |= uint64(0x00000001) - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LatestBlockHash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTest - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.LatestBlockHash = append(m.LatestBlockHash[:0], dAtA[iNdEx:postIndex]...) - if m.LatestBlockHash == nil { - m.LatestBlockHash = []byte{} - } - iNdEx = postIndex - hasFields[0] |= uint64(0x00000002) - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field LatestBlockHeight", wireType) - } - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.LatestBlockHeight = &v - hasFields[0] |= uint64(0x00000004) - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field LatestBlocktime", wireType) - } - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.LatestBlocktime = &v - hasFields[0] |= uint64(0x00000008) - default: - iNdEx = preIndex - skippy, err := skipTest(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTest - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if hasFields[0]&uint64(0x00000001) == 0 { - return proto.NewRequiredNotSetError("pubKey") - } - if hasFields[0]&uint64(0x00000002) == 0 { - return proto.NewRequiredNotSetError("latestBlockHash") - } - if hasFields[0]&uint64(0x00000004) == 0 { - return proto.NewRequiredNotSetError("latestBlockHeight") - } - if hasFields[0]&uint64(0x00000008) == 0 { - return proto.NewRequiredNotSetError("latestBlocktime") - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NodeInfo) Unmarshal(dAtA []byte) error { - var hasFields [1]uint64 - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NodeInfo: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NodeInfo: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTest - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Id == nil { - m.Id = &ID{} - } - if err := m.Id.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - hasFields[0] |= uint64(0x00000001) - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Moniker", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTest - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Moniker = &s - iNdEx = postIndex - hasFields[0] |= uint64(0x00000002) - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Network", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTest - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Network = &s - iNdEx = postIndex - hasFields[0] |= uint64(0x00000004) - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RemoteAddr", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTest - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.RemoteAddr = &s - iNdEx = postIndex - hasFields[0] |= uint64(0x00000008) - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListenAddr", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTest - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.ListenAddr = &s - iNdEx = postIndex - hasFields[0] |= uint64(0x00000010) - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTest - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Version = &s - iNdEx = postIndex - hasFields[0] |= uint64(0x00000020) - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Other", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTest - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Other = append(m.Other, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTest(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTest - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if hasFields[0]&uint64(0x00000001) == 0 { - return proto.NewRequiredNotSetError("id") - } - if hasFields[0]&uint64(0x00000002) == 0 { - return proto.NewRequiredNotSetError("moniker") - } - if hasFields[0]&uint64(0x00000004) == 0 { - return proto.NewRequiredNotSetError("network") - } - if hasFields[0]&uint64(0x00000008) == 0 { - return proto.NewRequiredNotSetError("remoteAddr") - } - if hasFields[0]&uint64(0x00000010) == 0 { - return proto.NewRequiredNotSetError("listenAddr") - } - if hasFields[0]&uint64(0x00000020) == 0 { - return proto.NewRequiredNotSetError("version") - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ID) Unmarshal(dAtA []byte) error { - var hasFields [1]uint64 - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ID: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ID: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTest - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Id = &s - iNdEx = postIndex - hasFields[0] |= uint64(0x00000001) - default: - iNdEx = preIndex - skippy, err := skipTest(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTest - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if hasFields[0]&uint64(0x00000001) == 0 { - return proto.NewRequiredNotSetError("id") - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PubKey) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PubKey: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PubKey: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Ed25519", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTest - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Ed25519 == nil { - m.Ed25519 = &PubKeyEd25519{} - } - if err := m.Ed25519.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTest(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTest - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PubKeyEd25519) Unmarshal(dAtA []byte) error { - var hasFields [1]uint64 - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PubKeyEd25519: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PubKeyEd25519: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Bytes", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTest - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Bytes = append(m.Bytes[:0], dAtA[iNdEx:postIndex]...) - if m.Bytes == nil { - m.Bytes = []byte{} - } - iNdEx = postIndex - hasFields[0] |= uint64(0x00000001) - default: - iNdEx = preIndex - skippy, err := skipTest(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTest - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if hasFields[0]&uint64(0x00000001) == 0 { - return proto.NewRequiredNotSetError("bytes") - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipTest(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTest - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTest - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTest - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - iNdEx += length - if length < 0 { - return 0, ErrInvalidLengthTest - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTest - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipTest(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} - -var ( - ErrInvalidLengthTest = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTest = fmt.Errorf("proto: integer overflow") -) - -func init() { proto.RegisterFile("test.proto", fileDescriptorTest) } - -var fileDescriptorTest = []byte{ - // 342 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x91, 0x41, 0x4b, 0xf3, 0x30, - 0x1c, 0xc6, 0x49, 0xfb, 0x6e, 0x5d, 0xff, 0xeb, 0x3b, 0x31, 0xee, 0x90, 0x53, 0x2d, 0x85, 0x41, - 0x0f, 0x52, 0xb0, 0xb0, 0x83, 0x47, 0xc7, 0x04, 0x87, 0x20, 0x23, 0x7e, 0x82, 0xcd, 0xfe, 0x75, - 0x65, 0x5d, 0x33, 0x92, 0x4c, 0xd9, 0xe7, 0xf3, 0xe2, 0xd1, 0xa3, 0x47, 0xd9, 0x27, 0x91, 0xa6, - 0xed, 0x9c, 0xf3, 0xf8, 0xfc, 0x7e, 0xe5, 0xc9, 0xd3, 0x04, 0x40, 0xa3, 0xd2, 0xf1, 0x5a, 0x0a, - 0x2d, 0xc2, 0x4f, 0x02, 0x1e, 0x47, 0xb5, 0xc9, 0xf5, 0x83, 0x9e, 0xe9, 0x8d, 0xa2, 0x03, 0xe8, - 0x14, 0x22, 0xc5, 0x49, 0xf1, 0x24, 0x18, 0x09, 0x48, 0xd4, 0x4d, 0xdc, 0xf8, 0xbe, 0x06, 0x7c, - 0xaf, 0xe8, 0x39, 0xb4, 0xd7, 0x9b, 0xf9, 0x1d, 0x6e, 0x99, 0x15, 0x58, 0x51, 0x37, 0x71, 0xe2, - 0xa9, 0x89, 0xbc, 0xc6, 0x34, 0x82, 0x93, 0x7c, 0x56, 0x1e, 0x34, 0xca, 0xc5, 0xe3, 0xf2, 0x76, - 0xa6, 0x16, 0xcc, 0x0e, 0xac, 0xc8, 0xe3, 0xc7, 0x98, 0x5e, 0xc0, 0xe9, 0x21, 0xc2, 0xec, 0x79, - 0xa1, 0xd9, 0xbf, 0xc0, 0x8a, 0x6c, 0xfe, 0x57, 0x1c, 0xf5, 0xea, 0x6c, 0x85, 0xac, 0x65, 0xbe, - 0x3d, 0xc6, 0xe1, 0x1b, 0x81, 0x4e, 0xb3, 0x9c, 0x9e, 0x81, 0x95, 0xa5, 0x8c, 0x98, 0xad, 0x76, - 0x3c, 0x19, 0x73, 0x2b, 0x4b, 0x29, 0x03, 0x67, 0x25, 0x8a, 0x6c, 0x89, 0xd2, 0xfc, 0x85, 0xcb, - 0x9b, 0x58, 0x9a, 0x02, 0xf5, 0xab, 0x90, 0x4b, 0xb3, 0xda, 0xe5, 0x4d, 0xa4, 0x3e, 0x80, 0xc4, - 0x95, 0xd0, 0x78, 0x9d, 0xa6, 0xd2, 0xcc, 0x74, 0xf9, 0x01, 0x29, 0x7d, 0x9e, 0x29, 0x8d, 0x85, - 0xf1, 0xad, 0xca, 0xff, 0x90, 0xb2, 0xf9, 0x05, 0xa5, 0xca, 0x44, 0xc1, 0xda, 0x55, 0x73, 0x1d, - 0x69, 0x1f, 0x5a, 0x42, 0x2f, 0x50, 0x32, 0x27, 0xb0, 0x23, 0x97, 0x57, 0x21, 0xec, 0x83, 0x35, - 0x19, 0xd3, 0xde, 0x7e, 0xbe, 0x5b, 0x2e, 0x0f, 0x13, 0x68, 0x4f, 0x9b, 0x7b, 0x76, 0x30, 0x4d, - 0x86, 0xc3, 0xcb, 0xab, 0xfa, 0xb9, 0x7a, 0xf5, 0x4b, 0xdc, 0x54, 0x94, 0x37, 0x3a, 0x1c, 0xc0, - 0xff, 0x5f, 0xa6, 0x3c, 0x70, 0xbe, 0xd5, 0xa8, 0x4c, 0xaf, 0xc7, 0xab, 0x30, 0xf2, 0xde, 0x77, - 0x3e, 0xf9, 0xd8, 0xf9, 0xe4, 0x6b, 0xe7, 0x93, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0xb1, 0xee, - 0x6b, 0xdd, 0x2c, 0x02, 0x00, 0x00, -} diff --git a/benchmarks/proto/test.proto b/benchmarks/proto/test.proto deleted file mode 100644 index 6d770d98a..000000000 --- a/benchmarks/proto/test.proto +++ /dev/null @@ -1,29 +0,0 @@ -message ResultStatus { - optional NodeInfo nodeInfo = 1; - required PubKey pubKey = 2; - required bytes latestBlockHash = 3; - required int64 latestBlockHeight = 4; - required int64 latestBlocktime = 5; -} - -message NodeInfo { - required ID id = 1; - required string moniker = 2; - required string network = 3; - required string remoteAddr = 4; - required string listenAddr = 5; - required string version = 6; - repeated string other = 7; -} - -message ID { - required string id = 1; -} - -message PubKey { - optional PubKeyEd25519 ed25519 = 1; -} - -message PubKeyEd25519 { - required bytes bytes = 1; -} diff --git a/benchmarks/simu/counter.go b/benchmarks/simu/counter.go deleted file mode 100644 index c24eddf8a..000000000 --- a/benchmarks/simu/counter.go +++ /dev/null @@ -1,47 +0,0 @@ -package main - -import ( - "context" - "encoding/binary" - "fmt" - "time" - - cmn "github.com/tendermint/tendermint/libs/common" - rpcclient "github.com/tendermint/tendermint/rpc/lib/client" -) - -func main() { - wsc := rpcclient.NewWSClient("127.0.0.1:26657", "/websocket") - err := wsc.Start() - if err != nil { - cmn.Exit(err.Error()) - } - defer wsc.Stop() - - // Read a bunch of responses - go func() { - for { - _, ok := <-wsc.ResponsesCh - if !ok { - break - } - //fmt.Println("Received response", string(wire.JSONBytes(res))) - } - }() - - // Make a bunch of requests - buf := make([]byte, 32) - for i := 0; ; i++ { - binary.BigEndian.PutUint64(buf, uint64(i)) - //txBytes := hex.EncodeToString(buf[:n]) - fmt.Print(".") - err = wsc.Call(context.TODO(), "broadcast_tx", map[string]interface{}{"tx": buf[:8]}) - if err != nil { - cmn.Exit(err.Error()) - } - if i%1000 == 0 { - fmt.Println(i) - } - time.Sleep(time.Microsecond * 1000) - } -}