Skip to content

Commit

Permalink
Problem: nixpkgs is too old (crypto-org-chain#1032)
Browse files Browse the repository at this point in the history
Solution:
- update to release-23.11

vendor hash

use nixpkgs 23.05

NIXPKGS_ALLOW_INSECURE=1

optional event_query_tx

fix gov upgrade

update deps
  • Loading branch information
yihuang authored Feb 19, 2024
1 parent 04e8e09 commit c0436a5
Show file tree
Hide file tree
Showing 22 changed files with 227 additions and 224 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
tags:
- "*"

env:
NIXPKGS_ALLOW_INSECURE: 1

jobs:
lint:
runs-on: ubuntu-latest
Expand Down
20 changes: 10 additions & 10 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/release-22.11";
nixpkgs.url = "github:NixOS/nixpkgs/release-23.05";
flake-utils.url = "github:numtide/flake-utils";
nix-bundle-exe = {
url = "github:3noch/nix-bundle-exe";
Expand All @@ -9,7 +9,7 @@
gomod2nix = {
url = "github:nix-community/gomod2nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.utils.follows = "flake-utils";
inputs.flake-utils.follows = "flake-utils";
};
};

Expand Down Expand Up @@ -49,7 +49,7 @@
devShells = {
chain-maind = pkgs.mkShell {
buildInputs = with pkgs; [
go_1_20
go_1_21
rocksdb
];
};
Expand Down
18 changes: 8 additions & 10 deletions integration_tests/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions integration_tests/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pytest-github-actions-annotate-failures = "^0.1.7"
protobuf = "^3.20.2"
pyyaml = "^6.0.1"
python-dateutil = "^2.8.1"
pystarport = { git = "https://github.com/crypto-com/pystarport.git", branch = "main" }
pystarport = { git = "https://github.com/crypto-com/pystarport.git", branch = "main", rev = "d86272f" }
chainlibpy = "^2.2.0"

# manually upgrade to make hatchling build success in poetry2nix
Expand All @@ -28,5 +28,5 @@ pathspec = "^0.10.1"
[tool.poetry.dev-dependencies]

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
41 changes: 30 additions & 11 deletions integration_tests/test_gov.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,27 @@ def approve_proposal(cluster, rsp, vote_option="yes"):
assert proposal["status"] == "PROPOSAL_STATUS_DEPOSIT_PERIOD", proposal

amount = cluster.balance(cluster.address("ecosystem"))
rsp = cluster.gov_deposit("ecosystem", proposal_id, "1cro")
rsp = cluster.gov_deposit("ecosystem", proposal_id, "1cro", event_query_tx=False)
assert rsp["code"] == 0, rsp["raw_log"]
assert cluster.balance(cluster.address("ecosystem")) == amount - 100000000
proposal = cluster.query_proposal(proposal_id)
assert proposal["status"] == "PROPOSAL_STATUS_VOTING_PERIOD", proposal

if vote_option is not None:
rsp = cluster.gov_vote("validator", proposal_id, vote_option)
rsp = cluster.gov_vote(
"validator",
proposal_id,
vote_option,
event_query_tx=False,
)
assert rsp["code"] == 0, rsp["raw_log"]
rsp = cluster.gov_vote("validator", proposal_id, vote_option, i=1)
rsp = cluster.gov_vote(
"validator",
proposal_id,
vote_option,
i=1,
event_query_tx=False,
)
assert rsp["code"] == 0, rsp["raw_log"]
assert (
int(cluster.query_tally(proposal_id, i=1)[vote_option + "_count"])
Expand Down Expand Up @@ -128,7 +139,12 @@ def test_deposit_period_expires(cluster):

amount2 = cluster.balance(cluster.address("ecosystem"))

rsp = cluster.gov_deposit("ecosystem", proposal_id, "5000basecro")
rsp = cluster.gov_deposit(
"ecosystem",
proposal_id,
"5000basecro",
event_query_tx=False,
)
assert rsp["code"] == 0, rsp["raw_log"]
proposal = cluster.query_proposal(proposal_id)
assert proposal["total_deposit"] == [{"denom": "basecro", "amount": "10000"}]
Expand Down Expand Up @@ -182,9 +198,9 @@ def test_community_pool_spend_proposal(cluster):
proposal_id = ev["proposal_id"]

# vote
rsp = cluster.gov_vote("validator", proposal_id, "yes")
rsp = cluster.gov_vote("validator", proposal_id, "yes", event_query_tx=False)
assert rsp["code"] == 0, rsp["raw_log"]
rsp = cluster.gov_vote("validator", proposal_id, "yes", i=1)
rsp = cluster.gov_vote("validator", proposal_id, "yes", i=1, event_query_tx=False)
assert rsp["code"] == 0, rsp["raw_log"]

# wait for voting period end
Expand Down Expand Up @@ -232,7 +248,7 @@ def test_change_vote(cluster):

proposal_id = parse_events(rsp["logs"])["submit_proposal"]["proposal_id"]

rsp = cluster.gov_vote("validator", proposal_id, "yes")
rsp = cluster.gov_vote("validator", proposal_id, "yes", event_query_tx=False)
assert rsp["code"] == 0, rsp["raw_log"]

cluster.query_tally(proposal_id) == {
Expand All @@ -243,7 +259,7 @@ def test_change_vote(cluster):
}

# change vote to no
rsp = cluster.gov_vote("validator", proposal_id, "no")
rsp = cluster.gov_vote("validator", proposal_id, "no", event_query_tx=False)
assert rsp["code"] == 0, rsp["raw_log"]

cluster.query_tally(proposal_id) == {
Expand Down Expand Up @@ -285,10 +301,13 @@ def test_inherit_vote(cluster):
# non-validator voter
voter1 = cluster.address("community")
cluster.delegate_amount(
cluster.address("validator", bech="val"), "10basecro", voter1
cluster.address("validator", bech="val"),
"10basecro",
voter1,
event_query_tx=False,
)

rsp = cluster.gov_vote("validator", proposal_id, "yes")
rsp = cluster.gov_vote("validator", proposal_id, "yes", event_query_tx=False)
assert rsp["code"] == 0, rsp["raw_log"]
assert cluster.query_tally(proposal_id) == {
"yes_count": "1000000010",
Expand All @@ -297,7 +316,7 @@ def test_inherit_vote(cluster):
"no_with_veto_count": "0",
}

rsp = cluster.gov_vote(voter1, proposal_id, "no")
rsp = cluster.gov_vote(voter1, proposal_id, "no", event_query_tx=False)
assert rsp["code"] == 0, rsp["raw_log"]

assert cluster.query_tally(proposal_id) == {
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/test_hardware_wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_ledger_transfer(cluster):
reserve_balance = cluster.balance(reserve_addr)
hw_balance = cluster.balance(hw_addr)

tx = cluster.transfer_from_ledger("hw", reserve_addr, "1cro")
tx = cluster.transfer_from_ledger("hw", reserve_addr, "1cro", event_query_tx=False)
print("transfer tx", tx["txhash"])
assert tx["logs"] == [
{
Expand Down
21 changes: 18 additions & 3 deletions integration_tests/test_ibc.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ def test_ibc(cluster):

# do a transfer from ibc-0 to ibc-1
rsp = cluster["ibc-0"].ibc_transfer(
"relayer", addr_1, "10000basecro", src_channel, 1
"relayer",
addr_1,
"10000basecro",
src_channel,
1,
event_query_tx=False,
)
assert rsp["code"] == 0, rsp["raw_log"]
# sender balance decreased
Expand Down Expand Up @@ -86,7 +91,12 @@ def test_ibc(cluster):

# transfer back
rsp = cluster["ibc-1"].ibc_transfer(
"relayer", addr_0, f"10000ibc/{denom_hash}", dst_channel, 0
"relayer",
addr_0,
f"10000ibc/{denom_hash}",
dst_channel,
0,
event_query_tx=False,
)
print("ibc transfer back")
assert rsp["code"] == 0, rsp["raw_log"]
Expand Down Expand Up @@ -185,7 +195,12 @@ def test_update_chain_id(cluster):
balance_0 = cluster["ibc-0"].balance(cluster["ibc-0"].address("relayer"))
recipient = cluster["ibc-1"].address("relayer")
rsp = cluster["ibc-0"].ibc_transfer(
"relayer", recipient, "10000basecro", channels[0]["channel_id"], 1
"relayer",
recipient,
"10000basecro",
channels[0]["channel_id"],
1,
event_query_tx=False,
)
assert rsp["code"] == 0, rsp["raw_log"]
time.sleep(10)
Expand Down
8 changes: 7 additions & 1 deletion integration_tests/test_ibc_channel_genesis.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,12 @@ def test_ibc_genesis_channel(cluster):

# # do a transfer from ibc-0 to ibc-1
rsp = cluster["ibc-0"].ibc_transfer(
"relayer", addr_1, "%dbasecro" % transfer_amount, "channel-0", 1
"relayer",
addr_1,
"%dbasecro" % transfer_amount,
"channel-0",
1,
event_query_tx=False,
)
assert rsp["code"] == 0, rsp["raw_log"]
# sender balance decreased
Expand Down Expand Up @@ -117,6 +122,7 @@ def test_ibc_genesis_channel(cluster):
"%dibc/%s" % (transfer_amount, denom_hash),
"channel-0",
0,
event_query_tx=False,
)
assert rsp["code"] == 0, rsp["raw_log"]

Expand Down
14 changes: 12 additions & 2 deletions integration_tests/test_ibc_extended.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,12 @@ def test_ibc_extended(cluster):
denom_string = f"transfer/{dst_channel}/basecro"
# send A -> C
rsp = cluster["ibc-0"].ibc_transfer(
"relayer", addr_1, "10000basecro", src_channel, 1
"relayer",
addr_1,
"10000basecro",
src_channel,
1,
event_query_tx=False,
)
time.sleep(10)
res = json.loads(
Expand All @@ -65,7 +70,12 @@ def test_ibc_extended(cluster):
]
# send B <- C
rsp = cluster["ibc-1"].ibc_transfer(
"relayer", addr_0_signer, f"55ibc/{denom_hash}", dst_channel, 0
"relayer",
addr_0_signer,
f"55ibc/{denom_hash}",
dst_channel,
0,
event_query_tx=False,
)
assert rsp["code"] == 0, rsp["raw_log"]
time.sleep(10)
Expand Down
Loading

0 comments on commit c0436a5

Please sign in to comment.