Skip to content

Commit

Permalink
fix gov
Browse files Browse the repository at this point in the history
  • Loading branch information
yihuang committed Apr 12, 2024
1 parent 90e5b7d commit 71ea92c
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions integration_tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,21 +139,22 @@ def wait_for_block_time(cli, t):
time.sleep(0.5)


def approve_proposal(n, rsp, event_query_tx=False):
def approve_proposal(n, rsp):
cli = n.cosmos_cli()

def cb(attrs):
return "proposal_id" in attrs

ev = find_log_event_attrs(rsp["events"], "submit_proposal", cb)
# get proposal_id
ev = find_log_event_attrs(
rsp["events"], "submit_proposal", lambda attrs: "proposal_id" in attrs
)
proposal_id = ev["proposal_id"]
for i in range(len(n.config["validators"])):
rsp = n.cosmos_cli(i).gov_vote("validator", proposal_id, "yes", event_query_tx)
rsp = n.cosmos_cli(i).gov_vote("validator", proposal_id, "yes", gas=100000)
assert rsp["code"] == 0, rsp["raw_log"]
wait_for_new_blocks(cli, 1)
res = cli.query_tally(proposal_id)
res = res.get("tally") or res
assert (
int(cli.query_tally(proposal_id)["yes_count"]) == cli.staking_pool()
int(res["yes_count"]) == cli.staking_pool()
), "all validators should have voted yes"
print("wait for proposal to be activated")
proposal = cli.query_proposal(proposal_id)
Expand Down

0 comments on commit 71ea92c

Please sign in to comment.