Skip to content

Commit

Permalink
Problem: iavl prune bug not reproduced in integration test
Browse files Browse the repository at this point in the history
Solution: manage to reproduce it
  • Loading branch information
yihuang committed Nov 26, 2024
1 parent 86c5cc4 commit 4e94d24
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 10 deletions.
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,6 @@ replace (
github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0
// v0.38.x
github.com/cometbft/cometbft => github.com/crypto-org-chain/cometbft v0.0.0-20241106091515-ce418f845d9a
// release/v1.2.x
github.com/cosmos/iavl => github.com/crypto-org-chain/iavl v0.0.0-20241126033451-a3e0980a5b06
// dgrijalva/jwt-go is deprecated and doesn't receive security updates.
// TODO: remove it: https://github.com/cosmos/cosmos-sdk/issues/13134
github.com/dgrijalva/jwt-go => github.com/golang-jwt/jwt/v4 v4.4.2
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,8 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ
github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU=
github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro=
github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0=
github.com/cosmos/iavl v1.2.1-0.20240731145221-594b181f427e h1:5bxw1E0peLMrr8ZO9mYT0d9sxy0WgR1ZEWb92yjKnnk=
github.com/cosmos/iavl v1.2.1-0.20240731145221-594b181f427e/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw=
github.com/cosmos/ibc-go/modules/apps/callbacks v0.0.0-20240913130017-6b2554360c0e h1:jMqihcJRBdpRrKGOMS1bDyyoo2JoQxv4QmMCwK3HSvI=
github.com/cosmos/ibc-go/modules/apps/callbacks v0.0.0-20240913130017-6b2554360c0e/go.mod h1:akR14gsU5YD5S1G5I6lOI7z51OjR1vJko06Rs/3/Ym0=
github.com/cosmos/ibc-go/modules/capability v1.0.1 h1:ibwhrpJ3SftEEZRxCRkH0fQZ9svjthrX2+oXdZvzgGI=
Expand Down Expand Up @@ -432,8 +434,6 @@ github.com/crypto-org-chain/go-block-stm v0.0.0-20240919080136-6c49aef68716 h1:O
github.com/crypto-org-chain/go-block-stm v0.0.0-20240919080136-6c49aef68716/go.mod h1:iwQTX9xMX8NV9k3o2BiWXA0SswpsZrDk5q3gA7nWYiE=
github.com/crypto-org-chain/go-ethereum v1.10.20-0.20240926023215-d2275b4afb9a h1:IUPD+dg1YQl8cLocxQ/Mbx/ObTgAgcrZlcBhFjsLO40=
github.com/crypto-org-chain/go-ethereum v1.10.20-0.20240926023215-d2275b4afb9a/go.mod h1:A249HEl6XyiV5zSnKM9j9RF3szMghMNONMyNvYuqQIw=
github.com/crypto-org-chain/iavl v0.0.0-20241126033451-a3e0980a5b06 h1:Q4MWY/ErbKRRcPWXYn/0s2ycNj0EaBlxAbjXsAyJ6gY=
github.com/crypto-org-chain/iavl v0.0.0-20241126033451-a3e0980a5b06/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw=
github.com/danieljoos/wincred v1.2.0 h1:ozqKHaLK0W/ii4KVbbvluM91W2H3Sh0BncbUNPS7jLE=
github.com/danieljoos/wincred v1.2.0/go.mod h1:FzQLLMKBFdvu+osBrnFODiv32YGwCfx0SkRa/eYHgec=
github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down
7 changes: 3 additions & 4 deletions gomod2nix.toml

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions integration_tests/cosmoscli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2020,3 +2020,6 @@ def e2ee_encrypt_to_validators(self, input, **kwargs):
.strip()
.decode()
)

def prune(self, kind="everything"):
return self.raw("prune", kind, home=self.data_dir)
15 changes: 14 additions & 1 deletion integration_tests/test_permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@


def test_permissions_updates(cronos):
"""
- test permissions updates
- reproduce an iavl prune issue: https://github.com/cosmos/iavl/pull/1007
"""
acc = eth_to_bech32(ADDRS["signer1"])
cli = cronos.cosmos_cli()
cli = cronos.cosmos_cli(1) # node1 use normal iavl
rsp = cli.query_permissions(acc)
print("permissions", rsp)
assert rsp["can_change_token_mapping"] is False
Expand All @@ -21,3 +25,12 @@ def test_permissions_updates(cronos):
print("permissions", rsp)
assert rsp["can_change_token_mapping"] is True
assert rsp["can_turn_bridge"] is True

cronos.supervisorctl("stop", "cronos_777-1-node1")
cli.prune()
cronos.supervisorctl("start", "cronos_777-1-node1")

rsp = cli.update_permissions(acc, 3, from_="validator")
assert rsp["code"] == 0, rsp["raw_log"]

wait_for_new_blocks(cli, 5)
3 changes: 2 additions & 1 deletion scripts/.env
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ export COMMUNITY_MNEMONIC="notable error gospel wave pair ugly measure elite tod
export SIGNER1_MNEMONIC="shed crumble dismiss loyal latin million oblige gesture shrug still oxygen custom remove ribbon disorder palace addict again blanket sad flock consider obey popular"
export SIGNER2_MNEMONIC="night renew tonight dinner shaft scheme domain oppose echo summer broccoli agent face guitar surface belt veteran siren poem alcohol menu custom crunch index"
export SIGNER3_MNEMONIC="step endless survey brand topic warrior merry boat metal throw tag recycle pitch animal drill jar hero library arm swift kitten proof acoustic chef"
# same account as VALIDATOR1_MNEMONIC
export CRONOS_ADMIN="crc12luku6uxehhak02py4rcz65zu0swh7wjsrw0pp"
export IBC_CRO_DENOM="ibc/6411AE2ADA1E73DB59DB151A8988F9B7D5E7E233D8414DB6817F8F1A01611F86"
export IBC_CRO_DENOM="ibc/6411AE2ADA1E73DB59DB151A8988F9B7D5E7E233D8414DB6817F8F1A01611F86"

0 comments on commit 4e94d24

Please sign in to comment.