-
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.
add multiple voters to index votes test
- Loading branch information
1 parent
22ff3b7
commit bbb7aca
Showing
4 changed files
with
121 additions
and
125 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,106 @@ | ||
#!/bin/bash | ||
|
||
# test account address | ||
address1=regen1l2pwmzk96ftmmt5egpjulyqtneygmmzndf7csk | ||
address2=regen14v5z5yyl5unnyu6q3ele8ze9jev6y0m7tx6gct | ||
|
||
# transaction flags | ||
regen_tx_flags="--keyring-backend test --chain-id regen-local --yes" | ||
|
||
# set group members json | ||
cat > members.json <<EOL | ||
{ | ||
"members": [ | ||
{ | ||
"address": "$address1", | ||
"weight": "1", | ||
"metadata": "" | ||
}, | ||
{ | ||
"address": "$address2", | ||
"weight": "1", | ||
"metadata": "" | ||
} | ||
] | ||
} | ||
EOL | ||
|
||
# create test group | ||
regen tx group create-group "$address1" "" members.json --from "$address1" $regen_tx_flags | ||
|
||
# wait for transaction to be processed | ||
sleep 10 | ||
|
||
# set group policy json | ||
cat > policy.json <<EOL | ||
{ | ||
"@type": "/cosmos.group.v1.ThresholdDecisionPolicy", | ||
"threshold": "2", | ||
"windows": { | ||
"voting_period": "20s", | ||
"min_execution_period": "0s" | ||
} | ||
} | ||
EOL | ||
|
||
# create test group policy | ||
regen tx group create-group-policy "$address1" 1 "" policy.json --from "$address1" $regen_tx_flags | ||
|
||
# wait for transaction to be processed | ||
sleep 10 | ||
|
||
# set group policy address | ||
policy_address=$(regen q group group-policies-by-group 1 --output json | jq -r '.group_policies[-1].address') | ||
|
||
# set group proposal json | ||
cat > proposal.json <<EOL | ||
{ | ||
"group_policy_address": "$policy_address", | ||
"messages": [], | ||
"metadata": "", | ||
"proposers": ["$address1"] | ||
} | ||
EOL | ||
|
||
# create group proposal | ||
regen tx group submit-proposal proposal.json --from "$address1" $regen_tx_flags | ||
|
||
# wait for transaction to be processed | ||
sleep 10 | ||
|
||
# set proposal id | ||
proposal_id=$(regen q group proposals-by-group-policy "$policy_address" --output json | jq -r '.proposals[-1].id') | ||
|
||
# vote "yes" on proposal with user 1 | ||
regen tx group vote "$proposal_id" "$address1" VOTE_OPTION_YES "" --from "$address1" $regen_tx_flags | ||
|
||
# wait for transaction to be processed | ||
sleep 10 | ||
|
||
# TODO: confirm vote NOT indexed in database | ||
psql postgres://postgres:password@localhost:5432/postgres -c "SELECT * from votes;" | ||
# TODO: if vote found, then exit 1 | ||
|
||
# vote "yes" on proposal with user 2 | ||
regen tx group vote "$proposal_id" "$address1" VOTE_OPTION_YES "" --from "$address2" $regen_tx_flags | ||
|
||
# wait for transaction to be processed and voting period to end | ||
sleep 10 | ||
|
||
# TODO: confirm vote NOT indexed in database | ||
psql postgres://postgres:password@localhost:5432/postgres -c "SELECT * from votes;" | ||
# TODO: if vote found, then exit 1 | ||
|
||
# execute proposal | ||
regen tx group exec "$proposal_id" --from "$address1" $regen_tx_flags | ||
|
||
# wait for transaction to be processed | ||
sleep 10 | ||
|
||
# TODO: confirm proposal indexed in database | ||
psql postgres://postgres:password@localhost:5432/postgres -c "SELECT * from proposals;" | ||
# TODO: if proposal NOT found, then exit 1 | ||
|
||
# TODO: confirm vote indexed in database | ||
psql postgres://postgres:password@localhost:5432/postgres -c "SELECT * from votes;" | ||
# TODO: if vote NOT found, then exit 1 |