Try to fix circle...

This commit is contained in:
Jae Kwon
2018-06-26 23:42:00 -07:00
parent 37ef5485b4
commit 8524a8da7f
8 changed files with 56 additions and 34 deletions

View File

@ -69,10 +69,6 @@
name = "github.com/stretchr/testify"
version = "~1.2.1"
[[constraint]]
name = "github.com/tendermint/abci"
version = "~0.12.0"
[[constraint]]
name = "github.com/tendermint/go-amino"
version = "~0.10.1"

2
bump Normal file
View File

@ -0,0 +1,2 @@
booop

View File

@ -1021,9 +1021,11 @@ func (cs *ConsensusState) enterPrevoteWait(height int64, round int) {
logger.Debug(cmn.Fmt("enterPrevoteWait(%v/%v): Invalid args. Current step: %v/%v/%v", height, round, cs.Height, cs.Round, cs.Step))
return
}
if !cs.Votes.Prevotes(round).HasTwoThirdsAny() {
cmn.PanicSanity(cmn.Fmt("enterPrevoteWait(%v/%v), but Prevotes does not have any +2/3 votes", height, round))
}
/*
if !cs.Votes.Prevotes(round).HasTwoThirdsAny() {
cmn.PanicSanity(cmn.Fmt("enterPrevoteWait(%v/%v), but Prevotes does not have any +2/3 votes", height, round))
}
*/
logger.Info(cmn.Fmt("enterPrevoteWait(%v/%v). Current: %v/%v/%v", height, round, cs.Height, cs.Round, cs.Step))
defer func() {
@ -1587,7 +1589,7 @@ func (cs *ConsensusState) addVote(vote *types.Vote, peerID p2p.ID) (added bool,
if prevotes.HasTwoThirdsMajority() {
cs.enterPrecommit(height, vote.Round)
} else {
cs.enterPrevote(height, vote.Round) // if the vote is ahead of us
cs.enterPropose(height, vote.Round) // we can't prevote until we wait for the proposal.
cs.enterPrevoteWait(height, vote.Round)
}
} else if cs.Proposal != nil && 0 <= cs.Proposal.POLRound && cs.Proposal.POLRound == vote.Round {
@ -1621,7 +1623,8 @@ 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.enterPrecommit(height, vote.Round)
cs.enterPrevote(height, vote.Round)
cs.enterPrevoteWait(height, vote.Round)
cs.enterPrecommitWait(height, vote.Round)
}
default:

1
foo.sh Normal file
View File

@ -0,0 +1 @@
docker run -ti tester find

View File

@ -56,6 +56,7 @@ for i in `seq 1 $N`; do
# - assert block height is greater than 1
BLOCK_HEIGHT=`curl -s $addr/status | jq .result.sync_info.latest_block_height | jq fromjson`
COUNT=0
echo "$$BLOCK_HEIGHT IS $BLOCK_HEIGHT"
while [ "$BLOCK_HEIGHT" -le 1 ]; do
echo "Waiting for node $i to commit a block ..."
sleep 1

View File

@ -23,7 +23,7 @@ set -e
# get the first peer's height
addr=$(test/p2p/ip.sh 1):26657
h1=$(curl -s "$addr/status" | jq .result.sync_info.latest_block_height)
h1=$(curl -s "$addr/status" | jq .result.sync_info.latest_block_height | sed -e "s/^\"\(.*\)\"$/\1/g")
echo "1st peer is on height $h1"
echo "Waiting until other peers reporting a height higher than the 1st one"
@ -33,7 +33,7 @@ for i in $(seq 2 "$NUM_OF_PEERS"); do
while [[ $hi -le $h1 ]] ; do
addr=$(test/p2p/ip.sh "$i"):26657
hi=$(curl -s "$addr/status" | jq .result.sync_info.latest_block_height)
hi=$(curl -s "$addr/status" | jq .result.sync_info.latest_block_height | sed -e "s/^\"\(.*\)\"$/\1/g")
echo "... peer $i is on height $hi"

View File

@ -14,14 +14,33 @@ echo "starting tendermint peer ID=$ID"
# start tendermint container on the network
# NOTE: $NODE_FLAGS should be unescaped (no quotes). otherwise it will be
# treated as one flag.
docker run -d \
--net="$NETWORK_NAME" \
--ip=$(test/p2p/ip.sh "$ID") \
--name "local_testnet_$ID" \
--entrypoint tendermint \
-e TMHOME="/go/src/github.com/tendermint/tendermint/test/p2p/data/mach$ID/core" \
--log-driver=syslog \
--log-opt syslog-address=udp://127.0.0.1:5514 \
--log-opt syslog-facility=daemon \
--log-opt tag="{{.Name}}" \
"$DOCKER_IMAGE" node $NODE_FLAGS --log_level=debug --proxy_app="$APP_PROXY"
if [[ "$ID" == "1" ]]; then
docker run \
--net="$NETWORK_NAME" \
--ip=$(test/p2p/ip.sh "$ID") \
--name "local_testnet_$ID" \
--entrypoint tendermint \
-e TMHOME="/go/src/github.com/tendermint/tendermint/test/p2p/data/mach$ID/core" \
-e GOMAXPROCS=1 \
--log-driver=syslog \
--log-opt syslog-address=udp://127.0.0.1:5514 \
--log-opt syslog-facility=daemon \
--log-opt tag="{{.Name}}" \
"$DOCKER_IMAGE" node $NODE_FLAGS --log_level=debug --proxy_app="$APP_PROXY" &
else
docker run -d \
--net="$NETWORK_NAME" \
--ip=$(test/p2p/ip.sh "$ID") \
--name "local_testnet_$ID" \
--entrypoint tendermint \
-e TMHOME="/go/src/github.com/tendermint/tendermint/test/p2p/data/mach$ID/core" \
-e GOMAXPROCS=1 \
--log-driver=syslog \
--log-opt syslog-address=udp://127.0.0.1:5514 \
--log-opt syslog-facility=daemon \
--log-opt tag="{{.Name}}" \
"$DOCKER_IMAGE" node $NODE_FLAGS --log_level=debug --proxy_app="$APP_PROXY"
fi

View File

@ -279,11 +279,6 @@ func (vals *ValidatorSet) VerifyCommit(chainID string, blockID BlockID, height i
if precommit.Type != VoteTypePrecommit {
return fmt.Errorf("Invalid commit -- not precommit @ index %v", idx)
}
// NOTE: This will go away when we refactor Commit.
if !blockID.Equals(precommit.BlockID) {
return fmt.Errorf("Invalid commit -- wrong block id @ index %v: want %v got %v",
idx, blockID, precommit.BlockID)
}
_, val := vals.GetByIndex(idx)
// Validate signature.
precommitSignBytes := precommit.SignBytes(chainID)
@ -291,7 +286,12 @@ func (vals *ValidatorSet) VerifyCommit(chainID string, blockID BlockID, height i
return fmt.Errorf("Invalid commit -- invalid signature: %v", precommit)
}
// Good precommit!
talliedVotingPower += val.VotingPower
if blockID.Equals(precommit.BlockID) {
talliedVotingPower += val.VotingPower
} else {
// It's OK that the BlockID doesn't match. We include stray
// precommits to measure validator availability.
}
}
if talliedVotingPower > vals.TotalVotingPower()*2/3 {
@ -358,11 +358,6 @@ func (vals *ValidatorSet) VerifyFutureCommit(newSet *ValidatorSet, chainID strin
if precommit.Type != VoteTypePrecommit {
return cmn.NewError("Invalid commit -- not precommit @ index %v", idx)
}
// NOTE: This will go away when we refactor Commit.
if !blockID.Equals(precommit.BlockID) {
return fmt.Errorf("Invalid commit -- wrong block id @ index %v: want %v got %v",
idx, blockID, precommit.BlockID)
}
// See if this validator is in oldVals.
idx, val := oldVals.GetByAddress(precommit.ValidatorAddress)
if val == nil || seen[idx] {
@ -376,7 +371,12 @@ func (vals *ValidatorSet) VerifyFutureCommit(newSet *ValidatorSet, chainID strin
return cmn.NewError("Invalid commit -- invalid signature: %v", precommit)
}
// Good precommit!
oldVotingPower += val.VotingPower
if blockID.Equals(precommit.BlockID) {
oldVotingPower += val.VotingPower
} else {
// It's OK that the BlockID doesn't match. We include stray
// precommits to measure validator availability.
}
}
if oldVotingPower <= oldVals.TotalVotingPower()*2/3 {