Skip to content

Commit

Permalink
Merge branch 'master' into event-fastsync-status
Browse files Browse the repository at this point in the history
  • Loading branch information
tac0turtle committed Jun 25, 2021
2 parents 9fafa2c + 917180d commit e1bebc3
Show file tree
Hide file tree
Showing 39 changed files with 271 additions and 224 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG_PENDING.md
Expand Up @@ -32,6 +32,7 @@ Friendly reminder: We have a [bug bounty program](https://hackerone.com/tendermi
- P2P Protocol

- Go API
- [p2p] \#6618 Move `p2p.NodeInfo` into `types` to support use of the SDK. (@tychoish)
- [p2p] \#6583 Make `p2p.NodeID` and `p2p.NetAddress` exported types to support their use in the RPC layer. (@tychoish)
- [node] \#6540 Reduce surface area of the `node` package by making most of the implementation details private. (@tychoish)
- [p2p] \#6547 Move the entire `p2p` package and all reactor implementations into `internal`. (@tychoish)
Expand Down Expand Up @@ -125,6 +126,7 @@ Friendly reminder: We have a [bug bounty program](https://hackerone.com/tendermi
- [p2p/pex] \#6509 Improve addrBook.hash performance (@cuonglm)
- [consensus/metrics] \#6549 Change block_size gauge to a histogram for better observability over time (@marbar3778)
- [statesync] \#6587 Increase chunk priority and re-request chunks that don't arrive (@cmwaters)
- [rpc] \#6615 Add TotalGasUsed to block_results response (@crypto-facs)

### BUG FIXES

Expand All @@ -133,5 +135,5 @@ Friendly reminder: We have a [bug bounty program](https://hackerone.com/tendermi
- [blockchain/v1] \#5711 Fix deadlock (@melekes)
- [evidence] \#6375 Fix bug with inconsistent LightClientAttackEvidence hashing (cmwaters)
- [rpc] \#6507 fix RPC client doesn't handle url's without ports (@JayT106)
- [statesync] \#6463 Adds Reverse Sync feature to fetch historical light blocks after state sync in order to verify any evidence (@cmwaters)
- [statesync] \#6463 Adds Reverse Sync feature to fetch historical light blocks after state sync in order to verify any evidence (@cmwaters)
- [fastsync] \#6590 Update the metrics during fast-sync (@JayT106)
5 changes: 2 additions & 3 deletions internal/blockchain/v0/reactor.go
Expand Up @@ -33,10 +33,9 @@ var (
ID: byte(BlockchainChannel),
Priority: 5,
SendQueueCapacity: 1000,
RecvBufferCapacity: 50 * 4096,
RecvBufferCapacity: 1024,
RecvMessageCapacity: bc.MaxMsgSize,

MaxSendBytes: 100,
MaxSendBytes: 100,
},
},
}
Expand Down
2 changes: 1 addition & 1 deletion internal/blockchain/v2/reactor.go
Expand Up @@ -585,7 +585,7 @@ func (r *BlockchainReactor) GetChannels() []*p2p.ChannelDescriptor {
ID: BlockchainChannel,
Priority: 5,
SendQueueCapacity: 2000,
RecvBufferCapacity: 50 * 4096,
RecvBufferCapacity: 1024,
RecvMessageCapacity: bc.MaxMsgSize,
},
}
Expand Down
4 changes: 2 additions & 2 deletions internal/blockchain/v2/reactor_test.go
Expand Up @@ -45,8 +45,8 @@ func (mp mockPeer) IsOutbound() bool { return true }
func (mp mockPeer) IsPersistent() bool { return true }
func (mp mockPeer) CloseConn() error { return nil }

func (mp mockPeer) NodeInfo() p2p.NodeInfo {
return p2p.NodeInfo{
func (mp mockPeer) NodeInfo() types.NodeInfo {
return types.NodeInfo{
NodeID: "",
ListenAddr: "",
}
Expand Down
35 changes: 16 additions & 19 deletions internal/consensus/reactor.go
Expand Up @@ -33,11 +33,11 @@ var (
MsgType: new(tmcons.Message),
Descriptor: &p2p.ChannelDescriptor{
ID: byte(StateChannel),
Priority: 6,
SendQueueCapacity: 100,
Priority: 8,
SendQueueCapacity: 64,
RecvMessageCapacity: maxMsgSize,

MaxSendBytes: 12000,
RecvBufferCapacity: 128,
MaxSendBytes: 12000,
},
},
DataChannel: {
Expand All @@ -47,36 +47,33 @@ var (
// stuff. Once we gossip the whole block there is nothing left to send
// until next height or round.
ID: byte(DataChannel),
Priority: 10,
SendQueueCapacity: 100,
RecvBufferCapacity: 50 * 4096,
Priority: 12,
SendQueueCapacity: 64,
RecvBufferCapacity: 512,
RecvMessageCapacity: maxMsgSize,

MaxSendBytes: 40000,
MaxSendBytes: 40000,
},
},
VoteChannel: {
MsgType: new(tmcons.Message),
Descriptor: &p2p.ChannelDescriptor{
ID: byte(VoteChannel),
Priority: 7,
SendQueueCapacity: 100,
RecvBufferCapacity: 100 * 100,
Priority: 10,
SendQueueCapacity: 64,
RecvBufferCapacity: 128,
RecvMessageCapacity: maxMsgSize,

MaxSendBytes: 150,
MaxSendBytes: 150,
},
},
VoteSetBitsChannel: {
MsgType: new(tmcons.Message),
Descriptor: &p2p.ChannelDescriptor{
ID: byte(VoteSetBitsChannel),
Priority: 1,
SendQueueCapacity: 2,
RecvBufferCapacity: 1024,
Priority: 5,
SendQueueCapacity: 8,
RecvBufferCapacity: 128,
RecvMessageCapacity: maxMsgSize,

MaxSendBytes: 50,
MaxSendBytes: 50,
},
},
}
Expand Down
4 changes: 2 additions & 2 deletions internal/evidence/reactor.go
Expand Up @@ -31,8 +31,8 @@ var (
ID: byte(EvidenceChannel),
Priority: 6,
RecvMessageCapacity: maxMsgSize,

MaxSendBytes: 400,
RecvBufferCapacity: 32,
MaxSendBytes: 400,
},
},
}
Expand Down
4 changes: 2 additions & 2 deletions internal/mempool/v0/reactor.go
Expand Up @@ -104,8 +104,8 @@ func GetChannelShims(config *cfg.MempoolConfig) map[p2p.ChannelID]*p2p.ChannelDe
ID: byte(mempool.MempoolChannel),
Priority: 5,
RecvMessageCapacity: batchMsg.Size(),

MaxSendBytes: 5000,
RecvBufferCapacity: 128,
MaxSendBytes: 5000,
},
},
}
Expand Down
4 changes: 2 additions & 2 deletions internal/mempool/v1/reactor.go
Expand Up @@ -103,8 +103,8 @@ func GetChannelShims(config *cfg.MempoolConfig) map[p2p.ChannelID]*p2p.ChannelDe
ID: byte(mempool.MempoolChannel),
Priority: 5,
RecvMessageCapacity: batchMsg.Size(),

MaxSendBytes: 5000,
RecvBufferCapacity: 128,
MaxSendBytes: 5000,
},
},
}
Expand Down
4 changes: 2 additions & 2 deletions internal/p2p/mock/peer.go
Expand Up @@ -45,8 +45,8 @@ func NewPeer(ip net.IP) *Peer {
func (mp *Peer) FlushStop() { mp.Stop() } //nolint:errcheck //ignore error
func (mp *Peer) TrySend(chID byte, msgBytes []byte) bool { return true }
func (mp *Peer) Send(chID byte, msgBytes []byte) bool { return true }
func (mp *Peer) NodeInfo() p2p.NodeInfo {
return p2p.NodeInfo{
func (mp *Peer) NodeInfo() types.NodeInfo {
return types.NodeInfo{
NodeID: mp.addr.ID,
ListenAddr: mp.addr.DialString(),
}
Expand Down
14 changes: 8 additions & 6 deletions internal/p2p/mocks/connection.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 9 additions & 10 deletions internal/p2p/mocks/peer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions internal/p2p/p2p_test.go
Expand Up @@ -24,7 +24,7 @@ var (

selfKey crypto.PrivKey = ed25519.GenPrivKeyFromSecret([]byte{0xf9, 0x1b, 0x08, 0xaa, 0x38, 0xee, 0x34, 0xdd})
selfID = types.NodeIDFromPubKey(selfKey.PubKey())
selfInfo = p2p.NodeInfo{
selfInfo = types.NodeInfo{
NodeID: selfID,
ListenAddr: "0.0.0.0:0",
Network: "test",
Expand All @@ -33,7 +33,7 @@ var (

peerKey crypto.PrivKey = ed25519.GenPrivKeyFromSecret([]byte{0x84, 0xd7, 0x01, 0xbf, 0x83, 0x20, 0x1c, 0xfe})
peerID = types.NodeIDFromPubKey(peerKey.PubKey())
peerInfo = p2p.NodeInfo{
peerInfo = types.NodeInfo{
NodeID: peerID,
ListenAddr: "0.0.0.0:0",
Network: "test",
Expand Down
4 changes: 2 additions & 2 deletions internal/p2p/p2ptest/network.go
Expand Up @@ -215,7 +215,7 @@ func (n *Network) Remove(t *testing.T, id types.NodeID) {
// Node is a node in a Network, with a Router and a PeerManager.
type Node struct {
NodeID types.NodeID
NodeInfo p2p.NodeInfo
NodeInfo types.NodeInfo
NodeAddress p2p.NodeAddress
PrivKey crypto.PrivKey
Router *p2p.Router
Expand All @@ -229,7 +229,7 @@ type Node struct {
func (n *Network) MakeNode(t *testing.T, opts NodeOptions) *Node {
privKey := ed25519.GenPrivKey()
nodeID := types.NodeIDFromPubKey(privKey.PubKey())
nodeInfo := p2p.NodeInfo{
nodeInfo := types.NodeInfo{
NodeID: nodeID,
ListenAddr: "0.0.0.0:0", // FIXME: We have to fake this for now.
Moniker: string(nodeID),
Expand Down
8 changes: 4 additions & 4 deletions internal/p2p/peer.go
Expand Up @@ -32,7 +32,7 @@ type Peer interface {

CloseConn() error // close original connection

NodeInfo() NodeInfo // peer's info
NodeInfo() types.NodeInfo // peer's info
Status() tmconn.ConnectionStatus
SocketAddr() *NetAddress // actual address of the socket

Expand Down Expand Up @@ -81,7 +81,7 @@ type peer struct {
// peer's node info and the channel it knows about
// channels = nodeInfo.Channels
// cached to avoid copying nodeInfo in hasChannel
nodeInfo NodeInfo
nodeInfo types.NodeInfo
channels []byte
reactors map[byte]Reactor
onPeerError func(Peer, interface{})
Expand All @@ -96,7 +96,7 @@ type peer struct {
type PeerOption func(*peer)

func newPeer(
nodeInfo NodeInfo,
nodeInfo types.NodeInfo,
pc peerConn,
reactorsByCh map[byte]Reactor,
onPeerError func(Peer, interface{}),
Expand Down Expand Up @@ -218,7 +218,7 @@ func (p *peer) IsPersistent() bool {
}

// NodeInfo returns a copy of the peer's NodeInfo.
func (p *peer) NodeInfo() NodeInfo {
func (p *peer) NodeInfo() types.NodeInfo {
return p.nodeInfo
}

Expand Down
2 changes: 1 addition & 1 deletion internal/p2p/peer_set_test.go
Expand Up @@ -21,7 +21,7 @@ type mockPeer struct {
func (mp *mockPeer) FlushStop() { mp.Stop() } //nolint:errcheck // ignore error
func (mp *mockPeer) TrySend(chID byte, msgBytes []byte) bool { return true }
func (mp *mockPeer) Send(chID byte, msgBytes []byte) bool { return true }
func (mp *mockPeer) NodeInfo() NodeInfo { return NodeInfo{} }
func (mp *mockPeer) NodeInfo() types.NodeInfo { return types.NodeInfo{} }
func (mp *mockPeer) Status() ConnectionStatus { return ConnectionStatus{} }
func (mp *mockPeer) ID() types.NodeID { return mp.id }
func (mp *mockPeer) IsOutbound() bool { return false }
Expand Down
4 changes: 2 additions & 2 deletions internal/p2p/peer_test.go
Expand Up @@ -221,8 +221,8 @@ func (rp *remotePeer) accept() {
}
}

func (rp *remotePeer) nodeInfo() NodeInfo {
return NodeInfo{
func (rp *remotePeer) nodeInfo() types.NodeInfo {
return types.NodeInfo{
ProtocolVersion: defaultProtocolVersion,
NodeID: rp.Addr().ID,
ListenAddr: rp.listener.Addr().String(),
Expand Down
5 changes: 3 additions & 2 deletions internal/p2p/pex/reactor.go
Expand Up @@ -51,8 +51,8 @@ func ChannelDescriptor() conn.ChannelDescriptor {
Priority: 1,
SendQueueCapacity: 10,
RecvMessageCapacity: maxMsgSize,

MaxSendBytes: 200,
RecvBufferCapacity: 32,
MaxSendBytes: 200,
}
}

Expand Down Expand Up @@ -417,6 +417,7 @@ func (r *ReactorV2) sendRequestForPeers() {
// no peers are available
r.Logger.Debug("no available peers to send request to, waiting...")
r.nextRequestTime = time.Now().Add(noAvailablePeersWaitPeriod)

return
}
var peerID types.NodeID
Expand Down

0 comments on commit e1bebc3

Please sign in to comment.