mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-24 22:32:15 +00:00
Merge pull request #3570 from tendermint/ismail/backport-release/v0.30.4
Release/v0.30.4
This commit is contained in:
commit
bf23f74736
13
CHANGELOG.md
13
CHANGELOG.md
@ -1,5 +1,18 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## v0.30.4
|
||||||
|
|
||||||
|
*April 16th, 2019*
|
||||||
|
|
||||||
|
This release fixes a regression from v0.30.3 which used the peer's SocketAddr to add the peer to the address book.
|
||||||
|
This swallowed the peer's self-reported port which is important in case of reconnect.
|
||||||
|
It brings back NetAddress() to NodeInfo and uses it instead of SocketAddr for adding peers.
|
||||||
|
|
||||||
|
### BUG FIXES:
|
||||||
|
|
||||||
|
- [p2p] [\#3545](https://github.com/tendermint/tendermint/issues/3545) Add back `NetAddress()` to `NodeInfo` and use it
|
||||||
|
instead of peer's `SocketAddr()` when adding a peer to the `PEXReactor` (potential fix for [\#3532](https://github.com/tendermint/tendermint/issues/3532))
|
||||||
|
|
||||||
## v0.30.3
|
## v0.30.3
|
||||||
|
|
||||||
*April 1st, 2019*
|
*April 1st, 2019*
|
||||||
|
@ -20,6 +20,4 @@ Special thanks to external contributors on this release:
|
|||||||
|
|
||||||
### IMPROVEMENTS:
|
### IMPROVEMENTS:
|
||||||
|
|
||||||
- [CircleCI] \#3497 Move release management to CircleCI
|
|
||||||
|
|
||||||
### BUG FIXES:
|
### BUG FIXES:
|
||||||
|
@ -24,9 +24,14 @@ func MaxNodeInfoSize() int {
|
|||||||
// and determines if we're compatible.
|
// and determines if we're compatible.
|
||||||
type NodeInfo interface {
|
type NodeInfo interface {
|
||||||
ID() ID
|
ID() ID
|
||||||
|
nodeInfoAddress
|
||||||
nodeInfoTransport
|
nodeInfoTransport
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type nodeInfoAddress interface {
|
||||||
|
NetAddress() (*NetAddress, error)
|
||||||
|
}
|
||||||
|
|
||||||
// nodeInfoTransport validates a nodeInfo and checks
|
// nodeInfoTransport validates a nodeInfo and checks
|
||||||
// our compatibility with it. It's for use in the handshake.
|
// our compatibility with it. It's for use in the handshake.
|
||||||
type nodeInfoTransport interface {
|
type nodeInfoTransport interface {
|
||||||
@ -209,20 +214,9 @@ OUTER_LOOP:
|
|||||||
// it includes the authenticated peer ID and the self-reported
|
// it includes the authenticated peer ID and the self-reported
|
||||||
// ListenAddr. Note that the ListenAddr is not authenticated and
|
// ListenAddr. Note that the ListenAddr is not authenticated and
|
||||||
// may not match that address actually dialed if its an outbound peer.
|
// may not match that address actually dialed if its an outbound peer.
|
||||||
func (info DefaultNodeInfo) NetAddress() *NetAddress {
|
func (info DefaultNodeInfo) NetAddress() (*NetAddress, error) {
|
||||||
idAddr := IDAddressString(info.ID(), info.ListenAddr)
|
idAddr := IDAddressString(info.ID(), info.ListenAddr)
|
||||||
netAddr, err := NewNetAddressString(idAddr)
|
return NewNetAddressString(idAddr)
|
||||||
if err != nil {
|
|
||||||
switch err.(type) {
|
|
||||||
case ErrNetAddressLookup:
|
|
||||||
// XXX If the peer provided a host name and the lookup fails here
|
|
||||||
// we're out of luck.
|
|
||||||
// TODO: use a NetAddress in DefaultNodeInfo
|
|
||||||
default:
|
|
||||||
panic(err) // everything should be well formed by now
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return netAddr
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------
|
//-----------------------------------------------------------
|
||||||
|
@ -54,7 +54,7 @@ type AddrBook interface {
|
|||||||
PickAddress(biasTowardsNewAddrs int) *p2p.NetAddress
|
PickAddress(biasTowardsNewAddrs int) *p2p.NetAddress
|
||||||
|
|
||||||
// Mark address
|
// Mark address
|
||||||
MarkGood(*p2p.NetAddress)
|
MarkGood(p2p.ID)
|
||||||
MarkAttempt(*p2p.NetAddress)
|
MarkAttempt(*p2p.NetAddress)
|
||||||
MarkBad(*p2p.NetAddress)
|
MarkBad(*p2p.NetAddress)
|
||||||
|
|
||||||
@ -296,11 +296,11 @@ func (a *addrBook) PickAddress(biasTowardsNewAddrs int) *p2p.NetAddress {
|
|||||||
|
|
||||||
// MarkGood implements AddrBook - it marks the peer as good and
|
// MarkGood implements AddrBook - it marks the peer as good and
|
||||||
// moves it into an "old" bucket.
|
// moves it into an "old" bucket.
|
||||||
func (a *addrBook) MarkGood(addr *p2p.NetAddress) {
|
func (a *addrBook) MarkGood(id p2p.ID) {
|
||||||
a.mtx.Lock()
|
a.mtx.Lock()
|
||||||
defer a.mtx.Unlock()
|
defer a.mtx.Unlock()
|
||||||
|
|
||||||
ka := a.addrLookup[addr.ID]
|
ka := a.addrLookup[id]
|
||||||
if ka == nil {
|
if ka == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ func TestAddrBookPickAddress(t *testing.T) {
|
|||||||
assert.NotNil(t, addr, "expected an address")
|
assert.NotNil(t, addr, "expected an address")
|
||||||
|
|
||||||
// pick an address when we only have old address
|
// pick an address when we only have old address
|
||||||
book.MarkGood(addrSrc.addr)
|
book.MarkGood(addrSrc.addr.ID)
|
||||||
addr = book.PickAddress(0)
|
addr = book.PickAddress(0)
|
||||||
assert.NotNil(t, addr, "expected an address")
|
assert.NotNil(t, addr, "expected an address")
|
||||||
addr = book.PickAddress(50)
|
addr = book.PickAddress(50)
|
||||||
@ -126,7 +126,7 @@ func TestAddrBookPromoteToOld(t *testing.T) {
|
|||||||
// Promote half of them
|
// Promote half of them
|
||||||
for i, addrSrc := range randAddrs {
|
for i, addrSrc := range randAddrs {
|
||||||
if i%2 == 0 {
|
if i%2 == 0 {
|
||||||
book.MarkGood(addrSrc.addr)
|
book.MarkGood(addrSrc.addr.ID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -330,7 +330,7 @@ func TestAddrBookGetSelectionWithBias(t *testing.T) {
|
|||||||
randAddrsLen := len(randAddrs)
|
randAddrsLen := len(randAddrs)
|
||||||
for i, addrSrc := range randAddrs {
|
for i, addrSrc := range randAddrs {
|
||||||
if int((float64(i)/float64(randAddrsLen))*100) >= 20 {
|
if int((float64(i)/float64(randAddrsLen))*100) >= 20 {
|
||||||
book.MarkGood(addrSrc.addr)
|
book.MarkGood(addrSrc.addr.ID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -574,7 +574,7 @@ func createAddrBookWithMOldAndNNewAddrs(t *testing.T, nOld, nNew int) (book *add
|
|||||||
randAddrs := randNetAddressPairs(t, nOld)
|
randAddrs := randNetAddressPairs(t, nOld)
|
||||||
for _, addr := range randAddrs {
|
for _, addr := range randAddrs {
|
||||||
book.AddAddress(addr.addr, addr.src)
|
book.AddAddress(addr.addr, addr.src)
|
||||||
book.MarkGood(addr.addr)
|
book.MarkGood(addr.addr.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
randAddrs = randNetAddressPairs(t, nNew)
|
randAddrs = randNetAddressPairs(t, nNew)
|
||||||
|
@ -167,12 +167,18 @@ func (r *PEXReactor) AddPeer(p Peer) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// inbound peer is its own source
|
// inbound peer is its own source
|
||||||
addr := p.SocketAddr()
|
addr, err := p.NodeInfo().NetAddress()
|
||||||
|
if err != nil {
|
||||||
|
r.Logger.Error("Failed to get peer NetAddress", "err", err, "peer", p)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make it explicit that addr and src are the same for an inbound peer.
|
||||||
src := addr
|
src := addr
|
||||||
|
|
||||||
// add to book. dont RequestAddrs right away because
|
// add to book. dont RequestAddrs right away because
|
||||||
// we don't trust inbound as much - let ensurePeersRoutine handle it.
|
// we don't trust inbound as much - let ensurePeersRoutine handle it.
|
||||||
err := r.book.AddAddress(addr, src)
|
err = r.book.AddAddress(addr, src)
|
||||||
r.logErrAddrBook(err)
|
r.logErrAddrBook(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -309,7 +315,10 @@ func (r *PEXReactor) ReceiveAddrs(addrs []*p2p.NetAddress, src Peer) error {
|
|||||||
}
|
}
|
||||||
r.requestsSent.Delete(id)
|
r.requestsSent.Delete(id)
|
||||||
|
|
||||||
srcAddr := src.SocketAddr()
|
srcAddr, err := src.NodeInfo().NetAddress()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
for _, netAddr := range addrs {
|
for _, netAddr := range addrs {
|
||||||
// Validate netAddr. Disconnect from a peer if it sends us invalid data.
|
// Validate netAddr. Disconnect from a peer if it sends us invalid data.
|
||||||
if netAddr == nil {
|
if netAddr == nil {
|
||||||
|
@ -531,7 +531,7 @@ func testCreateSeed(dir string, id int, knownAddrs, srcAddrs []*p2p.NetAddress)
|
|||||||
book.SetLogger(log.TestingLogger())
|
book.SetLogger(log.TestingLogger())
|
||||||
for j := 0; j < len(knownAddrs); j++ {
|
for j := 0; j < len(knownAddrs); j++ {
|
||||||
book.AddAddress(knownAddrs[j], srcAddrs[j])
|
book.AddAddress(knownAddrs[j], srcAddrs[j])
|
||||||
book.MarkGood(knownAddrs[j])
|
book.MarkGood(knownAddrs[j].ID)
|
||||||
}
|
}
|
||||||
sw.SetAddrBook(book)
|
sw.SetAddrBook(book)
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ type AddrBook interface {
|
|||||||
AddAddress(addr *NetAddress, src *NetAddress) error
|
AddAddress(addr *NetAddress, src *NetAddress) error
|
||||||
AddOurAddress(*NetAddress)
|
AddOurAddress(*NetAddress)
|
||||||
OurAddress(*NetAddress) bool
|
OurAddress(*NetAddress) bool
|
||||||
MarkGood(*NetAddress)
|
MarkGood(ID)
|
||||||
RemoveAddress(*NetAddress)
|
RemoveAddress(*NetAddress)
|
||||||
HasAddress(*NetAddress) bool
|
HasAddress(*NetAddress) bool
|
||||||
Save()
|
Save()
|
||||||
@ -378,7 +378,7 @@ func (sw *Switch) SetAddrBook(addrBook AddrBook) {
|
|||||||
// like contributed to consensus.
|
// like contributed to consensus.
|
||||||
func (sw *Switch) MarkPeerAsGood(peer Peer) {
|
func (sw *Switch) MarkPeerAsGood(peer Peer) {
|
||||||
if sw.addrBook != nil {
|
if sw.addrBook != nil {
|
||||||
sw.addrBook.MarkGood(peer.SocketAddr())
|
sw.addrBook.MarkGood(peer.ID())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -581,7 +581,7 @@ func (book *addrBookMock) OurAddress(addr *NetAddress) bool {
|
|||||||
_, ok := book.ourAddrs[addr.String()]
|
_, ok := book.ourAddrs[addr.String()]
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
func (book *addrBookMock) MarkGood(*NetAddress) {}
|
func (book *addrBookMock) MarkGood(ID) {}
|
||||||
func (book *addrBookMock) HasAddress(addr *NetAddress) bool {
|
func (book *addrBookMock) HasAddress(addr *NetAddress) bool {
|
||||||
_, ok := book.addrs[addr.String()]
|
_, ok := book.addrs[addr.String()]
|
||||||
return ok
|
return ok
|
||||||
|
@ -23,7 +23,7 @@ type mockNodeInfo struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ni mockNodeInfo) ID() ID { return ni.addr.ID }
|
func (ni mockNodeInfo) ID() ID { return ni.addr.ID }
|
||||||
func (ni mockNodeInfo) NetAddress() *NetAddress { return ni.addr }
|
func (ni mockNodeInfo) NetAddress() (*NetAddress, error) { return ni.addr, nil }
|
||||||
func (ni mockNodeInfo) Validate() error { return nil }
|
func (ni mockNodeInfo) Validate() error { return nil }
|
||||||
func (ni mockNodeInfo) CompatibleWith(other NodeInfo) error { return nil }
|
func (ni mockNodeInfo) CompatibleWith(other NodeInfo) error { return nil }
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ const (
|
|||||||
// Must be a string because scripts like dist.sh read this file.
|
// Must be a string because scripts like dist.sh read this file.
|
||||||
// XXX: Don't change the name of this variable or you will break
|
// XXX: Don't change the name of this variable or you will break
|
||||||
// automation :)
|
// automation :)
|
||||||
TMCoreSemVer = "0.30.3"
|
TMCoreSemVer = "0.30.4"
|
||||||
|
|
||||||
// ABCISemVer is the semantic version of the ABCI library
|
// ABCISemVer is the semantic version of the ABCI library
|
||||||
ABCISemVer = "0.15.0"
|
ABCISemVer = "0.15.0"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user