Browse Source

Merge pull request #3712 from tendermint/release/v0.31.7

Release/v0.31.7
pull/3697/head v0.31.7
Ethan Buchman 6 years ago
committed by GitHub
parent
commit
8fb2c2a0e8
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 61 additions and 19 deletions
  1. +15
    -0
      CHANGELOG.md
  2. +1
    -1
      CHANGELOG_PENDING.md
  3. +13
    -14
      mempool/clist_mempool.go
  4. +5
    -2
      mempool/clist_mempool_test.go
  5. +26
    -1
      scripts/release_management/bump-semver.py
  6. +1
    -1
      version/version.go

+ 15
- 0
CHANGELOG.md View File

@ -1,5 +1,20 @@
# Changelog # Changelog
## v0.31.7
*June 3, 2019*
This releases fixes a regression in the mempool introduced in v0.31.6.
The regression caused the invalid committed txs to be proposed in blocks over and
over again.
### BUG FIXES:
- [mempool] \#3699 Remove all committed txs from the mempool.
This reverts the change from v0.31.6 where we only remove valid txs from the mempool.
Note this means malicious proposals can cause txs to be dropped from the
mempools of other nodes by including them in blocks before they are valid.
See \#3322.
## v0.31.6 ## v0.31.6
*May 31st, 2019* *May 31st, 2019*


+ 1
- 1
CHANGELOG_PENDING.md View File

@ -1,4 +1,4 @@
## v0.31.7
## v0.31.8
** **


+ 13
- 14
mempool/clist_mempool.go View File

@ -538,24 +538,23 @@ func (mem *CListMempool) Update(
if deliverTxResponses[i].Code == abci.CodeTypeOK { if deliverTxResponses[i].Code == abci.CodeTypeOK {
// Add valid committed tx to the cache (if missing). // Add valid committed tx to the cache (if missing).
_ = mem.cache.Push(tx) _ = mem.cache.Push(tx)
// Remove valid committed tx from the mempool.
if e, ok := mem.txsMap.Load(txKey(tx)); ok {
mem.removeTx(tx, e.(*clist.CElement), false)
}
} else { } else {
// Allow invalid transactions to be resubmitted. // Allow invalid transactions to be resubmitted.
mem.cache.Remove(tx) mem.cache.Remove(tx)
}
// Don't remove invalid tx from the mempool.
// Otherwise evil proposer can drop valid txs.
// Example:
// 100 -> 101 -> 102
// Block, proposed by evil proposer:
// 101 -> 102
// Mempool (if you remove txs):
// 100
// https://github.com/tendermint/tendermint/issues/3322.
// Remove committed tx from the mempool.
//
// Note an evil proposer can drop valid txs!
// Mempool before:
// 100 -> 101 -> 102
// Block, proposed by an evil proposer:
// 101 -> 102
// Mempool after:
// 100
// https://github.com/tendermint/tendermint/issues/3322.
if e, ok := mem.txsMap.Load(txKey(tx)); ok {
mem.removeTx(tx, e.(*clist.CElement), false)
} }
} }


+ 5
- 2
mempool/clist_mempool_test.go View File

@ -200,12 +200,15 @@ func TestMempoolUpdate(t *testing.T) {
assert.Zero(t, mempool.Size()) assert.Zero(t, mempool.Size())
} }
// 3. Removes invalid transactions from the cache, but leaves them in the mempool (if present)
// 3. Removes invalid transactions from the cache and the mempool (if present)
{ {
err := mempool.CheckTx([]byte{0x03}, nil) err := mempool.CheckTx([]byte{0x03}, nil)
require.NoError(t, err) require.NoError(t, err)
mempool.Update(1, []types.Tx{[]byte{0x03}}, abciResponses(1, 1), nil, nil) mempool.Update(1, []types.Tx{[]byte{0x03}}, abciResponses(1, 1), nil, nil)
assert.Equal(t, 1, mempool.Size())
assert.Zero(t, mempool.Size())
err = mempool.CheckTx([]byte{0x03}, nil)
assert.NoError(t, err)
} }
} }


+ 26
- 1
scripts/release_management/bump-semver.py View File

@ -8,6 +8,7 @@
import re import re
import argparse import argparse
import sys
def semver(ver): def semver(ver):
@ -17,6 +18,18 @@ def semver(ver):
return ver return ver
def get_tendermint_version():
"""Extracts the current Tendermint version from version/version.go"""
pattern = re.compile(r"TMCoreSemVer = \"(?P<version>([0-9.]+)+)\"")
with open("version/version.go", "rt") as version_file:
for line in version_file:
m = pattern.search(line)
if m:
return m.group('version')
return None
if __name__ == "__main__": if __name__ == "__main__":
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument("--version", help="Version number to bump, e.g.: v1.0.0", required=True, type=semver) parser.add_argument("--version", help="Version number to bump, e.g.: v1.0.0", required=True, type=semver)
@ -34,4 +47,16 @@ if __name__ == "__main__":
else: else:
patch = int(patch) + 1 patch = int(patch) + 1
print("{0}.{1}".format(majorminorprefix, patch))
expected_version = "{0}.{1}".format(majorminorprefix, patch)
# if we're doing a release
if expected_version != "v0.0.0":
cur_version = get_tendermint_version()
if not cur_version:
print("Failed to obtain Tendermint version from version/version.go")
sys.exit(1)
expected_version_noprefix = expected_version.lstrip("v")
if expected_version_noprefix != "0.0.0" and expected_version_noprefix != cur_version:
print("Expected version/version.go#TMCoreSemVer to be {0}, but was {1}".format(expected_version_noprefix, cur_version))
sys.exit(1)
print(expected_version)

+ 1
- 1
version/version.go View File

@ -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.31.5"
TMCoreSemVer = "0.31.7"
// ABCISemVer is the semantic version of the ABCI library // ABCISemVer is the semantic version of the ABCI library
ABCISemVer = "0.16.0" ABCISemVer = "0.16.0"


Loading…
Cancel
Save