Browse Source

Fix test/p2p/pex circle tests; update consensus

pull/2296/head
Jae Kwon 7 years ago
parent
commit
b51ed132f7
6 changed files with 16 additions and 18 deletions
  1. +1
    -0
      .gitignore
  2. +1
    -1
      consensus/state.go
  3. +1
    -7
      lite/commit.go
  4. +0
    -4
      lite/dbprovider.go
  5. +1
    -3
      test/p2p/peer.sh
  6. +12
    -3
      test/p2p/pex/test_addrbook.sh

+ 1
- 0
.gitignore View File

@ -28,3 +28,4 @@ scripts/cutWALUntil/cutWALUntil
libs/pubsub/query/fuzz_test/output
shunit2
.tendermint-lite
addrbook.json

+ 1
- 1
consensus/state.go View File

@ -1623,7 +1623,7 @@ func (cs *ConsensusState) addVote(vote *types.Vote, peerID p2p.ID) (added bool,
}
} else if cs.Round <= vote.Round && precommits.HasTwoThirdsAny() {
cs.enterNewRound(height, vote.Round)
cs.enterPrevote(height, vote.Round)
cs.enterPropose(height, vote.Round)
cs.enterPrevoteWait(height, vote.Round)
cs.enterPrecommitWait(height, vote.Round)
}


+ 1
- 7
lite/commit.go View File

@ -65,15 +65,9 @@ func (fc FullCommit) ValidateFull(chainID string) error {
}
// Validate the signatures on the commit.
hdr, cmt := fc.SignedHeader.Header, fc.SignedHeader.Commit
err = fc.Validators.VerifyCommit(
return fc.Validators.VerifyCommit(
hdr.ChainID, cmt.BlockID,
hdr.Height, cmt)
if err != nil {
return err
}
// All good!
return nil
}
// Height returns the height of the header.


+ 0
- 4
lite/dbprovider.go View File

@ -241,10 +241,6 @@ func validatorSetKey(chainID string, height int64) []byte {
return []byte(fmt.Sprintf("%s/%010d/vs", chainID, height))
}
func chainKeyPrefix(chainID string, height int64) []byte {
return []byte(fmt.Sprintf("%s/%010d/", chainID, height))
}
var chainKeyPrefixPattern = regexp.MustCompile(`([^/]+)/([0-9]*)/`)
func parseChainKeyPrefix(key []byte) (chainID string, height int64, ok bool) {


+ 1
- 3
test/p2p/peer.sh View File

@ -15,9 +15,7 @@ echo "starting tendermint peer ID=$ID"
# NOTE: $NODE_FLAGS should be unescaped (no quotes). otherwise it will be
# treated as one flag.
if [[ "$ID" == "1" ]]; then
if [[ "$ID" == "x" ]]; then # Set "x" to "1" to print to console.
docker run \
--net="$NETWORK_NAME" \
--ip=$(test/p2p/ip.sh "$ID") \


+ 12
- 3
test/p2p/pex/test_addrbook.sh View File

@ -16,6 +16,7 @@ CLIENT_NAME="pex_addrbook_$ID"
echo "1. restart peer $ID"
docker stop "local_testnet_$ID"
echo "stopped local_testnet_$ID"
# preserve addrbook.json
docker cp "local_testnet_$ID:/go/src/github.com/tendermint/tendermint/test/p2p/data/mach1/core/config/addrbook.json" "/tmp/addrbook.json"
set +e #CIRCLE
@ -24,6 +25,13 @@ set -e
# NOTE that we do not provide persistent_peers
bash test/p2p/peer.sh "$DOCKER_IMAGE" "$NETWORK_NAME" "$ID" "$PROXY_APP" "--p2p.pex --rpc.unsafe"
echo "started local_testnet_$ID"
# if the client runs forever, it means addrbook wasn't saved or was empty
bash test/p2p/client.sh "$DOCKER_IMAGE" "$NETWORK_NAME" "$CLIENT_NAME" "test/p2p/pex/check_peer.sh $ID $N"
# Now we know that the node is up.
docker cp "/tmp/addrbook.json" "local_testnet_$ID:/go/src/github.com/tendermint/tendermint/test/p2p/data/mach1/core/config/addrbook.json"
echo "with the following addrbook:"
cat /tmp/addrbook.json
@ -31,9 +39,6 @@ cat /tmp/addrbook.json
# docker exec "local_testnet_$ID" cat "/go/src/github.com/tendermint/tendermint/test/p2p/data/mach1/core/config/addrbook.json"
echo ""
# if the client runs forever, it means addrbook wasn't saved or was empty
bash test/p2p/client.sh "$DOCKER_IMAGE" "$NETWORK_NAME" "$CLIENT_NAME" "test/p2p/pex/check_peer.sh $ID $N"
echo "----------------------------------------------------------------------"
echo "Testing other peers connect to us if we have neither persistent_peers nor the addrbook"
echo "(assuming peers are started with pex enabled)"
@ -42,16 +47,20 @@ CLIENT_NAME="pex_no_addrbook_$ID"
echo "1. restart peer $ID"
docker stop "local_testnet_$ID"
echo "stopped local_testnet_$ID"
set +e #CIRCLE
docker rm -vf "local_testnet_$ID"
set -e
# NOTE that we do not provide persistent_peers
bash test/p2p/peer.sh "$DOCKER_IMAGE" "$NETWORK_NAME" "$ID" "$PROXY_APP" "--p2p.pex --rpc.unsafe"
echo "started local_testnet_$ID"
# if the client runs forever, it means other peers have removed us from their books (which should not happen)
bash test/p2p/client.sh "$DOCKER_IMAGE" "$NETWORK_NAME" "$CLIENT_NAME" "test/p2p/pex/check_peer.sh $ID $N"
# Now we know that the node is up.
echo ""
echo "PASS"
echo ""

Loading…
Cancel
Save