-
Notifications
You must be signed in to change notification settings - Fork 815
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SeiDB State Store Integration Tests (#1242)
* SeiDB State Store Integration Tests * Update to differences * Update num contracts/denoms + jq * change length * reduce sleeps * Check reverse * logging * Update block height logging * update seid command * Update * remove logging * Update to branch * Update bank tests * Point to latest seidb --------- Co-authored-by: kbhat1 <[email protected]> Co-authored-by: kbhat1 <[email protected]>
- Loading branch information
1 parent
167d699
commit ea5d477
Showing
8 changed files
with
291 additions
and
5 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
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,60 @@ | ||
#!/bin/bash | ||
|
||
seidbin=$(which ~/go/bin/seid | tr -d '"') | ||
keyname=$(printf "12345678\n" | $seidbin keys list --output json | jq ".[0].name" | tr -d '"') | ||
keyaddress=$(printf "12345678\n" | $seidbin keys list --output json | jq ".[0].address" | tr -d '"') | ||
chainid=$($seidbin status | jq ".NodeInfo.network" | tr -d '"') | ||
seihome=$(git rev-parse --show-toplevel | tr -d '"') | ||
|
||
cd $seihome || exit | ||
echo "Deploying first set of tokenfactory denoms..." | ||
|
||
beginning_block_height=$($seidbin status | jq -r '.SyncInfo.latest_block_height') | ||
echo "$beginning_block_height" > $seihome/integration_test/contracts/tfk_beginning_block_height.txt | ||
echo "$keyaddress" > $seihome/integration_test/contracts/tfk_creator_id.txt | ||
|
||
# create first set of tokenfactory denoms | ||
for i in {1..100} | ||
do | ||
echo "Creating first set of tokenfactory denoms #$i..." | ||
create_denom_result=$(printf "12345678\n" | $seidbin tx tokenfactory create-denom "$i" -y --from="$keyname" --chain-id="$chainid" --gas=500000 --fees=100000usei --broadcast-mode=block --output=json) | ||
new_token_denom=$(echo "$create_denom_result" | jq -r '.logs[].events[].attributes[] | select(.key == "new_token_denom").value') | ||
echo "Got token $new_token_denom for iteration $i" | ||
done | ||
|
||
|
||
first_set_block_height=$($seidbin status | jq -r '.SyncInfo.latest_block_height') | ||
echo "$first_set_block_height" > $seihome/integration_test/contracts/tfk_first_set_block_height.txt | ||
|
||
sleep 5 | ||
|
||
# create second set of tokenfactory denoms | ||
for i in {101..200} | ||
do | ||
echo "Creating first set of tokenfactory denoms #$i..." | ||
create_denom_result=$(printf "12345678\n" | $seidbin tx tokenfactory create-denom "$i" -y --from="$keyname" --chain-id="$chainid" --gas=500000 --fees=100000usei --broadcast-mode=block --output=json) | ||
new_token_denom=$(echo "$create_denom_result" | jq -r '.logs[].events[].attributes[] | select(.key == "new_token_denom").value') | ||
echo "Got token $new_token_denom for iteration $i" | ||
done | ||
|
||
second_set_block_height=$($seidbin status | jq -r '.SyncInfo.latest_block_height') | ||
echo "$second_set_block_height" > $seihome/integration_test/contracts/tfk_second_set_block_height.txt | ||
|
||
sleep 5 | ||
|
||
# create third set of tokenfactory denoms | ||
for i in {201..300} | ||
do | ||
echo "Creating first set of tokenfactory denoms #$i..." | ||
create_denom_result=$(printf "12345678\n" | $seidbin tx tokenfactory create-denom "$i" -y --from="$keyname" --chain-id="$chainid" --gas=500000 --fees=100000usei --broadcast-mode=block --output=json) | ||
new_token_denom=$(echo "$create_denom_result" | jq -r '.logs[].events[].attributes[] | select(.key == "new_token_denom").value') | ||
echo "Got token $new_token_denom for iteration $i" | ||
done | ||
|
||
third_set_block_height=$($seidbin status | jq -r '.SyncInfo.latest_block_height') | ||
echo "$third_set_block_height" > $seihome/integration_test/contracts/tfk_third_set_block_height.txt | ||
|
||
num_denoms=$(seid q tokenfactory denoms-from-creator $CREATOR_ID --output json | jq -r ".denoms | length") | ||
echo $num_denoms | ||
|
||
exit 0 |
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,62 @@ | ||
#!/bin/bash | ||
|
||
seidbin=$(which ~/go/bin/seid | tr -d '"') | ||
keyname=$(printf "12345678\n" | $seidbin keys list --output json | jq ".[0].name" | tr -d '"') | ||
keyaddress=$(printf "12345678\n" | $seidbin keys list --output json | jq ".[0].address" | tr -d '"') | ||
chainid=$($seidbin status | jq ".NodeInfo.network" | tr -d '"') | ||
seihome=$(git rev-parse --show-toplevel | tr -d '"') | ||
|
||
cd $seihome || exit | ||
echo "Deploying first set of contracts..." | ||
|
||
beginning_block_height=$($seidbin status | jq -r '.SyncInfo.latest_block_height') | ||
echo "$beginning_block_height" > $seihome/integration_test/contracts/wasm_beginning_block_height.txt | ||
echo "$keyaddress" > $seihome/integration_test/contracts/wasm_creator_id.txt | ||
|
||
# store first set of contracts | ||
for i in {1..100} | ||
do | ||
echo "Storing first set contract #$i..." | ||
store_result=$(printf "12345678\n" | $seidbin tx wasm store integration_test/contracts/mars.wasm -y --from="$keyname" --chain-id="$chainid" --gas=5000000 --fees=1000000usei --broadcast-mode=block --output=json) | ||
contract_id=$(echo "$store_result" | jq -r '.logs[].events[].attributes[] | select(.key == "code_id").value') | ||
printf "12345678\n" | $seidbin tx wasm instantiate "$contract_id" '{}' -y --no-admin --from="$keyname" --chain-id="$chainid" --gas=5000000 --fees=1000000usei --broadcast-mode=block --label=dex --output=json | ||
echo "Got contract id $contract_id for iteration $i" | ||
done | ||
|
||
first_set_block_height=$($seidbin status | jq -r '.SyncInfo.latest_block_height') | ||
echo "$first_set_block_height" > $seihome/integration_test/contracts/wasm_first_set_block_height.txt | ||
|
||
sleep 5 | ||
|
||
# store second set of contracts | ||
for i in {101..200} | ||
do | ||
echo "Storing second set contract #$i..." | ||
store_result=$(printf "12345678\n" | $seidbin tx wasm store integration_test/contracts/saturn.wasm -y --from="$keyname" --chain-id="$chainid" --gas=5000000 --fees=1000000usei --broadcast-mode=block --output=json) | ||
contract_id=$(echo "$store_result" | jq -r '.logs[].events[].attributes[] | select(.key == "code_id").value') | ||
printf "12345678\n" | $seidbin tx wasm instantiate "$contract_id" '{}' -y --no-admin --from="$keyname" --chain-id="$chainid" --gas=5000000 --fees=1000000usei --broadcast-mode=block --label=dex --output=json | ||
echo "Got contract id $contract_id for iteration $i" | ||
done | ||
|
||
second_set_block_height=$($seidbin status | jq -r '.SyncInfo.latest_block_height') | ||
echo "$second_set_block_height" > $seihome/integration_test/contracts/wasm_second_set_block_height.txt | ||
|
||
sleep 5 | ||
|
||
# store third set of contracts | ||
for i in {201..300} | ||
do | ||
echo "Storing third set contract #$i..." | ||
store_result=$(printf "12345678\n" | $seidbin tx wasm store integration_test/contracts/venus.wasm -y --from="$keyname" --chain-id="$chainid" --gas=5000000 --fees=1000000usei --broadcast-mode=block --output=json) | ||
contract_id=$(echo "$store_result" | jq -r '.logs[].events[].attributes[] | select(.key == "code_id").value') | ||
printf "12345678\n" | $seidbin tx wasm instantiate "$contract_id" '{}' -y --no-admin --from="$keyname" --chain-id="$chainid" --gas=5000000 --fees=1000000usei --broadcast-mode=block --label=dex --output=json | ||
echo "Got contract id $contract_id for iteration $i" | ||
done | ||
|
||
third_set_block_height=$($seidbin status | jq -r '.SyncInfo.latest_block_height') | ||
echo "$third_set_block_height" > $seihome/integration_test/contracts/wasm_third_set_block_height.txt | ||
|
||
num_stored=$(seid q wasm list-code --count-total --limit 400 --output json | jq -r ".code_infos | length") | ||
echo $num_stored | ||
|
||
exit 0 |
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,130 @@ | ||
- name: Test state store iteration through wasm list code | ||
inputs: | ||
# Verify 300 stored wasm contracts | ||
- cmd: seid q wasm list-code --count-total --limit 400 --output json | jq -r ".code_infos | length" | ||
env: WASM_LIST_CODE_LENGTH | ||
# Get height from beginning | ||
- cmd: tail -1 integration_test/contracts/wasm_beginning_block_height.txt | ||
env: BEGINNING_BLOCK_HEIGHT | ||
# Verify 0 stored wasm contracts at beginning height | ||
- cmd: seid q wasm list-code --count-total --limit 400 --height $BEGINNING_BLOCK_HEIGHT --output json | jq -r ".code_infos | length" | ||
env: BEGINNING_LIST_CODE_LENGTH | ||
# Get height from first set | ||
- cmd: tail -1 integration_test/contracts/wasm_first_set_block_height.txt | ||
env: FIRST_SET_BLOCK_HEIGHT | ||
# Verify 100 stored wasm contracts at first height | ||
- cmd: seid q wasm list-code --count-total --limit 400 --height $FIRST_SET_BLOCK_HEIGHT --output json | jq -r ".code_infos | length" | ||
env: FIRST_SET_LIST_CODE_LENGTH | ||
# Verify 100 stored wasm contracts at first height reverse | ||
- cmd: seid q wasm list-code --reverse --count-total --limit 400 --height $FIRST_SET_BLOCK_HEIGHT --output json | jq -r ".code_infos | length" | ||
env: FIRST_SET_LIST_CODE_LENGTH_REVERSE | ||
# Get height from second set | ||
- cmd: tail -1 integration_test/contracts/wasm_second_set_block_height.txt | ||
env: SECOND_SET_BLOCK_HEIGHT | ||
# Verify 200 stored wasm contracts at second height | ||
- cmd: seid q wasm list-code --count-total --limit 400 --height $SECOND_SET_BLOCK_HEIGHT --output json | jq -r ".code_infos | length" | ||
env: SECOND_SET_LIST_CODE_LENGTH | ||
# Verify 200 stored wasm contracts at second height reverse | ||
- cmd: seid q wasm list-code --reverse --count-total --limit 400 --height $SECOND_SET_BLOCK_HEIGHT --output json | jq -r ".code_infos | length" | ||
env: SECOND_SET_LIST_CODE_LENGTH_REVERSE | ||
# Get height from third set | ||
- cmd: tail -1 integration_test/contracts/wasm_third_set_block_height.txt | ||
env: THIRD_SET_BLOCK_HEIGHT | ||
# Verify 300 stored wasm contracts at third height | ||
- cmd: seid q wasm list-code --count-total --limit 400 --height $THIRD_SET_BLOCK_HEIGHT --output json | jq -r ".code_infos | length" | ||
env: THIRD_SET_LIST_CODE_LENGTH | ||
# Verify 300 stored wasm contracts at third height reverse | ||
- cmd: seid q wasm list-code --reverse --count-total --limit 400 --height $THIRD_SET_BLOCK_HEIGHT --output json | jq -r ".code_infos | length" | ||
env: THIRD_SET_LIST_CODE_LENGTH_REVERSE | ||
verifiers: | ||
# Verify number of wasm codes at each height | ||
- type: eval | ||
expr: BEGINNING_LIST_CODE_LENGTH == 0 | ||
- type: eval | ||
expr: FIRST_SET_LIST_CODE_LENGTH == 100 | ||
- type: eval | ||
expr: FIRST_SET_LIST_CODE_LENGTH_REVERSE == 100 | ||
- type: eval | ||
expr: SECOND_SET_LIST_CODE_LENGTH == 200 | ||
- type: eval | ||
expr: SECOND_SET_LIST_CODE_LENGTH_REVERSE == 200 | ||
- type: eval | ||
expr: THIRD_SET_LIST_CODE_LENGTH == 300 | ||
- type: eval | ||
expr: THIRD_SET_LIST_CODE_LENGTH_REVERSE == 300 | ||
|
||
- name: Test state store historical data checking specific wasm codes | ||
inputs: | ||
# Get height from first set | ||
- cmd: tail -1 integration_test/contracts/wasm_first_set_block_height.txt | ||
env: FIRST_SET_BLOCK_HEIGHT | ||
# Get code id from first contract returned at first set height in forward order (0) | ||
- cmd: seid q wasm list-code --count-total --limit 400 --height $FIRST_SET_BLOCK_HEIGHT --output json | jq -r ".code_infos[0].code_id" | ||
env: FIRST_ID_FIRST_SET | ||
# Get creator from first contract returned at first set height in forward order | ||
- cmd: seid q wasm list-code --count-total --limit 400 --height $FIRST_SET_BLOCK_HEIGHT --output json | jq -r ".code_infos[0].creator" | ||
env: FIRST_CREATOR_FIRST_SET | ||
# Get height from second set | ||
- cmd: tail -1 integration_test/contracts/wasm_second_set_block_height.txt | ||
env: SECOND_SET_BLOCK_HEIGHT | ||
# Get code id from first contract returned at second set height in reverse order (200) | ||
- cmd: seid q wasm list-code --reverse --count-total --limit 400 --height $SECOND_SET_BLOCK_HEIGHT --output json | jq -r ".code_infos[0].code_id" | ||
env: SECOND_ID_FIRST_SET | ||
# Get creator from second contract returned at second set height in reverse order | ||
- cmd: seid q wasm list-code --reverse --count-total --limit 400 --height $SECOND_SET_BLOCK_HEIGHT --output json | jq -r ".code_infos[0].creator" | ||
env: FIRST_CREATOR_SECOND_SET | ||
# Get creator id | ||
- cmd: tail -1 integration_test/contracts/wasm_creator_id.txt | ||
env: CREATOR_ID | ||
verifiers: | ||
# Verify we have all same creator id | ||
- type: eval | ||
expr: FIRST_CREATOR_FIRST_SET == CREATOR_ID | ||
- type: eval | ||
expr: FIRST_CREATOR_SECOND_SET == CREATOR_ID | ||
# Verify correct code ids | ||
# NOTE: Since chain is continually running / stateful, may have remove | ||
- type: eval | ||
expr: FIRST_ID_FIRST_SET == 1 | ||
- type: eval | ||
expr: SECOND_ID_FIRST_SET == 200 | ||
|
||
- name: Test state store iteration through tokenfactory denoms | ||
inputs: | ||
# Get creator id | ||
- cmd: tail -1 integration_test/contracts/tfk_creator_id.txt | ||
env: CREATOR_ID | ||
# Get height from beginning | ||
- cmd: tail -1 integration_test/contracts/tfk_beginning_block_height.txt | ||
env: BEGINNING_BLOCK_HEIGHT | ||
# Verify 0 tfk denoms created at beginning | ||
- cmd: seid q tokenfactory denoms-from-creator $CREATOR_ID --height $BEGINNING_BLOCK_HEIGHT --output json | jq -r ".denoms | length" | ||
env: BEGINNING_TFK_DENOMS | ||
# Get height from first set | ||
- cmd: tail -1 integration_test/contracts/tfk_first_set_block_height.txt | ||
env: FIRST_SET_BLOCK_HEIGHT | ||
# Verify 100 tfk denoms created at first | ||
- cmd: seid q tokenfactory denoms-from-creator $CREATOR_ID --height $FIRST_SET_BLOCK_HEIGHT --output json | jq -r ".denoms | length" | ||
env: FIRST_SET_TFK_DENOMS | ||
# Get height from second set | ||
- cmd: tail -1 integration_test/contracts/tfk_second_set_block_height.txt | ||
env: SECOND_SET_BLOCK_HEIGHT | ||
# Verify 200 tfk denoms created at second set | ||
- cmd: seid q tokenfactory denoms-from-creator $CREATOR_ID --height $SECOND_SET_BLOCK_HEIGHT --output json | jq -r ".denoms | length" | ||
env: SECOND_SET_TFK_DENOMS | ||
# Get height from third set | ||
- cmd: tail -1 integration_test/contracts/tfk_third_set_block_height.txt | ||
env: THIRD_SET_BLOCK_HEIGHT | ||
# Verify 300 tfk denoms created at third set | ||
- cmd: seid q tokenfactory denoms-from-creator $CREATOR_ID --height $THIRD_SET_BLOCK_HEIGHT --output json | jq -r ".denoms | length" | ||
env: THIRD_SET_TFK_DENOMS | ||
verifiers: | ||
# Verify number of wasm codes at each height | ||
- type: eval | ||
expr: BEGINNING_TFK_DENOMS == 0 | ||
- type: eval | ||
expr: FIRST_SET_TFK_DENOMS == 100 | ||
- type: eval | ||
expr: SECOND_SET_TFK_DENOMS == 200 | ||
- type: eval | ||
expr: THIRD_SET_TFK_DENOMS == 300 |