mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-26 15:22:15 +00:00
Fix test/p2p/pex circle tests; update consensus
This commit is contained in:
parent
8524a8da7f
commit
b51ed132f7
1
.gitignore
vendored
1
.gitignore
vendored
@ -28,3 +28,4 @@ scripts/cutWALUntil/cutWALUntil
|
|||||||
libs/pubsub/query/fuzz_test/output
|
libs/pubsub/query/fuzz_test/output
|
||||||
shunit2
|
shunit2
|
||||||
.tendermint-lite
|
.tendermint-lite
|
||||||
|
addrbook.json
|
||||||
|
@ -1623,7 +1623,7 @@ func (cs *ConsensusState) addVote(vote *types.Vote, peerID p2p.ID) (added bool,
|
|||||||
}
|
}
|
||||||
} else if cs.Round <= vote.Round && precommits.HasTwoThirdsAny() {
|
} else if cs.Round <= vote.Round && precommits.HasTwoThirdsAny() {
|
||||||
cs.enterNewRound(height, vote.Round)
|
cs.enterNewRound(height, vote.Round)
|
||||||
cs.enterPrevote(height, vote.Round)
|
cs.enterPropose(height, vote.Round)
|
||||||
cs.enterPrevoteWait(height, vote.Round)
|
cs.enterPrevoteWait(height, vote.Round)
|
||||||
cs.enterPrecommitWait(height, vote.Round)
|
cs.enterPrecommitWait(height, vote.Round)
|
||||||
}
|
}
|
||||||
|
@ -65,15 +65,9 @@ func (fc FullCommit) ValidateFull(chainID string) error {
|
|||||||
}
|
}
|
||||||
// Validate the signatures on the commit.
|
// Validate the signatures on the commit.
|
||||||
hdr, cmt := fc.SignedHeader.Header, fc.SignedHeader.Commit
|
hdr, cmt := fc.SignedHeader.Header, fc.SignedHeader.Commit
|
||||||
err = fc.Validators.VerifyCommit(
|
return fc.Validators.VerifyCommit(
|
||||||
hdr.ChainID, cmt.BlockID,
|
hdr.ChainID, cmt.BlockID,
|
||||||
hdr.Height, cmt)
|
hdr.Height, cmt)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// All good!
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Height returns the height of the header.
|
// Height returns the height of the header.
|
||||||
|
@ -241,10 +241,6 @@ func validatorSetKey(chainID string, height int64) []byte {
|
|||||||
return []byte(fmt.Sprintf("%s/%010d/vs", chainID, height))
|
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]*)/`)
|
var chainKeyPrefixPattern = regexp.MustCompile(`([^/]+)/([0-9]*)/`)
|
||||||
|
|
||||||
func parseChainKeyPrefix(key []byte) (chainID string, height int64, ok bool) {
|
func parseChainKeyPrefix(key []byte) (chainID string, height int64, ok bool) {
|
||||||
|
@ -15,9 +15,7 @@ echo "starting tendermint peer ID=$ID"
|
|||||||
# NOTE: $NODE_FLAGS should be unescaped (no quotes). otherwise it will be
|
# NOTE: $NODE_FLAGS should be unescaped (no quotes). otherwise it will be
|
||||||
# treated as one flag.
|
# treated as one flag.
|
||||||
|
|
||||||
|
if [[ "$ID" == "x" ]]; then # Set "x" to "1" to print to console.
|
||||||
|
|
||||||
if [[ "$ID" == "1" ]]; then
|
|
||||||
docker run \
|
docker run \
|
||||||
--net="$NETWORK_NAME" \
|
--net="$NETWORK_NAME" \
|
||||||
--ip=$(test/p2p/ip.sh "$ID") \
|
--ip=$(test/p2p/ip.sh "$ID") \
|
||||||
|
@ -16,6 +16,7 @@ CLIENT_NAME="pex_addrbook_$ID"
|
|||||||
|
|
||||||
echo "1. restart peer $ID"
|
echo "1. restart peer $ID"
|
||||||
docker stop "local_testnet_$ID"
|
docker stop "local_testnet_$ID"
|
||||||
|
echo "stopped local_testnet_$ID"
|
||||||
# preserve addrbook.json
|
# 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"
|
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
|
set +e #CIRCLE
|
||||||
@ -24,6 +25,13 @@ set -e
|
|||||||
|
|
||||||
# NOTE that we do not provide persistent_peers
|
# NOTE that we do not provide persistent_peers
|
||||||
bash test/p2p/peer.sh "$DOCKER_IMAGE" "$NETWORK_NAME" "$ID" "$PROXY_APP" "--p2p.pex --rpc.unsafe"
|
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"
|
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:"
|
echo "with the following addrbook:"
|
||||||
cat /tmp/addrbook.json
|
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"
|
# docker exec "local_testnet_$ID" cat "/go/src/github.com/tendermint/tendermint/test/p2p/data/mach1/core/config/addrbook.json"
|
||||||
echo ""
|
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 "----------------------------------------------------------------------"
|
||||||
echo "Testing other peers connect to us if we have neither persistent_peers nor the addrbook"
|
echo "Testing other peers connect to us if we have neither persistent_peers nor the addrbook"
|
||||||
echo "(assuming peers are started with pex enabled)"
|
echo "(assuming peers are started with pex enabled)"
|
||||||
@ -42,16 +47,20 @@ CLIENT_NAME="pex_no_addrbook_$ID"
|
|||||||
|
|
||||||
echo "1. restart peer $ID"
|
echo "1. restart peer $ID"
|
||||||
docker stop "local_testnet_$ID"
|
docker stop "local_testnet_$ID"
|
||||||
|
echo "stopped local_testnet_$ID"
|
||||||
set +e #CIRCLE
|
set +e #CIRCLE
|
||||||
docker rm -vf "local_testnet_$ID"
|
docker rm -vf "local_testnet_$ID"
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# NOTE that we do not provide persistent_peers
|
# NOTE that we do not provide persistent_peers
|
||||||
bash test/p2p/peer.sh "$DOCKER_IMAGE" "$NETWORK_NAME" "$ID" "$PROXY_APP" "--p2p.pex --rpc.unsafe"
|
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)
|
# 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"
|
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 ""
|
||||||
echo "PASS"
|
echo "PASS"
|
||||||
echo ""
|
echo ""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user