forked from cosmos/iavl
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request cosmos#20 from tendermint/fix-restart-height
Fix restart height
- Loading branch information
Showing
12 changed files
with
199 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
echo "Cleaning up old test results" | ||
|
||
rm -rf orphan-test-db 2>/dev/null | ||
rm merkleeyes.log 2>/dev/null | ||
rm tendermint.log 2>/dev/null | ||
rm query.txt 2>/dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package main | ||
|
||
import ( | ||
"crypto/rand" | ||
"fmt" | ||
) | ||
|
||
func main() { | ||
buf := make([]byte, 8) | ||
rand.Read(buf) | ||
fmt.Printf("%x\n", buf) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
if [ "$1" = "" ]; then | ||
key=$(go run eightbytekey.go) | ||
else | ||
key=$1 | ||
fi | ||
key_size=0108 | ||
value=33 | ||
value_size=0101 | ||
|
||
echo -n 0x01${key_size}${key}${value_size}${value} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/bin/bash | ||
|
||
echo "Sending a transaction" | ||
|
||
key=$(go run eightbytekey.go) | ||
tx=`./gen_merk_trans.sh ${key}` | ||
|
||
echo -n "Hash=" | ||
curl http://localhost:46657/broadcast_tx_commit\?tx\=${tx} 2>/dev/null |\ | ||
jq 'if .result == 0 then | ||
"No Result" | ||
elif .check_tx.log > 2 then | ||
.result | .check_tx.log | ||
else | ||
.result | .hash | ||
end' | ||
echo "" | ||
|
||
echo "Checking its height" | ||
|
||
curl http://localhost:46657/status 2>/dev/null > status.txt | ||
curl http://localhost:46657/abci_query\?data\=0x${key}\&path\=\"/key\"\&prove=true 2>/dev/null > query.txt | ||
|
||
echo -n "status height=" | ||
cat status.txt | jq '.result.latest_block_height' | ||
|
||
echo -n "query height=" | ||
cat query.txt | jq '.result.response.height' | ||
|
||
echo -n "status apphash=" | ||
cat status.txt | jq '.result.latest_app_hash' | ||
|
||
# get the apphash from the proof | ||
echo -n "query proof=" | ||
cat query.txt | jq '.result.response.proof' | ||
|
||
# A second time | ||
sleep 1 | ||
curl http://localhost:46657/status 2>/dev/null > status.txt | ||
curl http://localhost:46657/abci_query\?data\=0x${key}\&path\=\"/key\"\&prove=true 2>/dev/null > query.txt | ||
|
||
echo -n "status height=" | ||
cat status.txt | jq '.result.latest_block_height' | ||
|
||
echo -n "query height=" | ||
cat query.txt | jq '.result.response.height' | ||
|
||
echo -n "status apphash=" | ||
cat status.txt | jq '.result.latest_app_hash' | ||
|
||
# get the apphash from the proof | ||
echo -n "query proof=" | ||
cat query.txt | jq '.result.response.proof' | ||
|
||
echo "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
./start-tendermerk.sh | ||
./transaction.sh | ||
./height.sh | ||
./transaction.sh | ||
./height.sh | ||
./transaction.sh | ||
./height.sh | ||
./kill-tendermerk.sh | ||
|
||
./restart-tendermerk.sh | ||
./transaction.sh | ||
./height.sh | ||
./transaction.sh | ||
./height.sh | ||
./kill-tendermerk.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
echo "Stopping Merkleeyes and Tendermint" | ||
killall tendermint | ||
killall merkleeyes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
|
||
echo "Restarting Merkleeyes and Tendermint" | ||
|
||
merkleeyes start -d orphan-test-db --address=tcp://127.0.0.1:46658 >> merkleeyes.log & | ||
|
||
tendermint node >> tendermint.log & | ||
|
||
sleep 4 | ||
|
||
TPID=`pidof tendermint` | ||
if [ -z "$TPID" ]; then | ||
tail tendermint.log | ||
exit 20 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
|
||
./cleanup.sh | ||
|
||
echo "Starting Merkleeyes and Tendermint" | ||
|
||
merkleeyes start -d orphan-test-db --address=tcp://127.0.0.1:46658 >> merkleeyes.log & | ||
|
||
rm -rf ~/.tendermint | ||
tendermint init | ||
|
||
tendermint node >> tendermint.log & | ||
|
||
sleep 4 | ||
|
||
TPID=`pidof tendermint` | ||
if [ -z "$TPID" ]; then | ||
tail tendermint.log | ||
exit 20 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
echo "Sending a transaction" | ||
|
||
echo -n "Hash=" | ||
tx=`./gen_merk_trans.sh` | ||
|
||
curl http://localhost:46657/broadcast_tx_commit\?tx\=${tx} 2>/dev/null |\ | ||
jq 'if .result == 0 then | ||
"No Result" | ||
elif .check_tx.log > 2 then | ||
.result | .check_tx.log | ||
else | ||
.result | .hash | ||
end' | ||
|
||
echo "" |