Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem: iavl prune bug not reproduced in integration test #1705

Merged
merged 10 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ require (
github.com/cosmos/cosmos-proto v1.0.0-beta.5 // indirect
github.com/cosmos/go-bip39 v1.0.0 // indirect
github.com/cosmos/gogogateway v1.2.0 // indirect
github.com/cosmos/iavl v1.2.1-0.20240731145221-594b181f427e // indirect
github.com/cosmos/iavl v1.2.2 // indirect
yihuang marked this conversation as resolved.
Show resolved Hide resolved
github.com/cosmos/ics23/go v0.11.0 // indirect
github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect
github.com/cosmos/rosetta-sdk-go v0.10.0 // indirect
Expand Down Expand Up @@ -251,9 +251,9 @@ require (

// release/v0.50.x
replace (
cosmossdk.io/store => github.com/crypto-org-chain/cosmos-sdk/store v0.0.0-20241114020021-3300cc8f3836
cosmossdk.io/x/tx => github.com/crypto-org-chain/cosmos-sdk/x/tx v0.0.0-20241114020021-3300cc8f3836
github.com/cosmos/cosmos-sdk => github.com/crypto-org-chain/cosmos-sdk v0.50.6-0.20241114020021-3300cc8f3836
cosmossdk.io/store => github.com/crypto-org-chain/cosmos-sdk/store v0.0.0-20241129122902-6031e793ee95
cosmossdk.io/x/tx => github.com/crypto-org-chain/cosmos-sdk/x/tx v0.0.0-20241129122902-6031e793ee95
github.com/cosmos/cosmos-sdk => github.com/crypto-org-chain/cosmos-sdk v0.43.0-beta1.0.20241129122902-6031e793ee95
)

replace (
Expand All @@ -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
16 changes: 8 additions & 8 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.2 h1:qHhKW3I70w+04g5KdsdVSHRbFLgt3yY3qTMd4Xa4rC8=
github.com/cosmos/iavl v1.2.2/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 @@ -420,20 +422,18 @@ github.com/crypto-org-chain/btree v0.0.0-20240406140148-2687063b042c h1:MOgfS4+F
github.com/crypto-org-chain/btree v0.0.0-20240406140148-2687063b042c/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY=
github.com/crypto-org-chain/cometbft v0.0.0-20241106091515-ce418f845d9a h1:0EN1TkzHTAxpgpGaZJY3G7L4jf4+sYnI7FOmBFLCg4U=
github.com/crypto-org-chain/cometbft v0.0.0-20241106091515-ce418f845d9a/go.mod h1:khbgmtxbgwJfMqDmnGY4rl2sQpTdzpPb1f9nqnfpy1o=
github.com/crypto-org-chain/cosmos-sdk v0.50.6-0.20241114020021-3300cc8f3836 h1:KY8VONzVYz6Q2GZdxuCBwgzRZxhy4D0znlOyDE6tNEs=
github.com/crypto-org-chain/cosmos-sdk v0.50.6-0.20241114020021-3300cc8f3836/go.mod h1:JwwsMeZldLN20b72mmbWPY0EV9rs+v/12hRu1JFttvY=
github.com/crypto-org-chain/cosmos-sdk/store v0.0.0-20241114020021-3300cc8f3836 h1:U2dfYbl+QIcbEQMs3tutCopmjFZlEip7bwROyf+txo0=
github.com/crypto-org-chain/cosmos-sdk/store v0.0.0-20241114020021-3300cc8f3836/go.mod h1:8DwVTz83/2PSI366FERGbWSH7hL6sB7HbYp8bqksNwM=
github.com/crypto-org-chain/cosmos-sdk/x/tx v0.0.0-20241114020021-3300cc8f3836 h1:i4ubInu2ixIWOxjADpdLcaO08iIAQjIQucwsNutNZmM=
github.com/crypto-org-chain/cosmos-sdk/x/tx v0.0.0-20241114020021-3300cc8f3836/go.mod h1:V6DImnwJMTq5qFjeGWpXNiT/fjgE4HtmclRmTqRVM3w=
github.com/crypto-org-chain/cosmos-sdk v0.43.0-beta1.0.20241129122902-6031e793ee95 h1:z98NuFZmWO/J/KkMSjAYr2OIRBH9e3/mt8V8hsQ7mZU=
github.com/crypto-org-chain/cosmos-sdk v0.43.0-beta1.0.20241129122902-6031e793ee95/go.mod h1:JwwsMeZldLN20b72mmbWPY0EV9rs+v/12hRu1JFttvY=
github.com/crypto-org-chain/cosmos-sdk/store v0.0.0-20241129122902-6031e793ee95 h1:o+MT8Wg2ZFRqEfNHZB7Ungd97heAf+qia4bf+u+14E0=
github.com/crypto-org-chain/cosmos-sdk/store v0.0.0-20241129122902-6031e793ee95/go.mod h1:8DwVTz83/2PSI366FERGbWSH7hL6sB7HbYp8bqksNwM=
github.com/crypto-org-chain/cosmos-sdk/x/tx v0.0.0-20241129122902-6031e793ee95 h1:HmcXnK71J0aF+IGU7daBY9C/M23DbPhLNuu1MFQp4Rs=
github.com/crypto-org-chain/cosmos-sdk/x/tx v0.0.0-20241129122902-6031e793ee95/go.mod h1:V6DImnwJMTq5qFjeGWpXNiT/fjgE4HtmclRmTqRVM3w=
github.com/crypto-org-chain/ethermint v0.6.1-0.20241118003049-cd93407bcf05 h1:4mewSJnWOTwRbBntlAtOj5ZevujX4PGwn57QcO99+Bo=
github.com/crypto-org-chain/ethermint v0.6.1-0.20241118003049-cd93407bcf05/go.mod h1:9FNO9k70szJ7CEge4tnJraWu3baTbwNxjpZhZBqlMok=
github.com/crypto-org-chain/go-block-stm v0.0.0-20240919080136-6c49aef68716 h1:OvD5Rm0B6LHUJk6z858UgwdP72jU2DuUdXeclRyKpDI=
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
17 changes: 8 additions & 9 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).decode()
24 changes: 21 additions & 3 deletions integration_tests/test_permissions.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import os

from .utils import ADDRS, eth_to_bech32, wait_for_new_blocks


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(2) # node2 is iavl
cli.create_account("community", os.environ["COMMUNITY_MNEMONIC"])
cli.create_account("admin", os.environ["VALIDATOR1_MNEMONIC"])
rsp = cli.query_permissions(acc)
print("permissions", rsp)
assert rsp["can_change_token_mapping"] is False
Expand All @@ -13,11 +21,21 @@ def test_permissions_updates(cronos):
rsp = cli.update_permissions(acc, 3, from_="community")
assert rsp["code"] != 0, "should not have the permission"

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

wait_for_new_blocks(cli, 5)

rsp = cli.query_permissions(acc)
print("permissions", rsp)
assert rsp["can_change_token_mapping"] is True
assert rsp["can_turn_bridge"] is True

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

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

wait_for_new_blocks(cli, 5)
mmsqe marked this conversation as resolved.
Show resolved Hide resolved
3 changes: 2 additions & 1 deletion scripts/.env
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,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"
4 changes: 4 additions & 0 deletions store/rootmulti/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,10 @@
func (rs *Store) SetIAVLDisableFastNode(disable bool) {
}

// Implements interface CommitMultiStore
func (rs *Store) SetIAVLSyncPruning(syncPruning bool) {

Check warning on line 449 in store/rootmulti/store.go

View check run for this annotation

Codecov / codecov/patch

store/rootmulti/store.go#L449

Added line #L449 was not covered by tests
}

// Implements interface CommitMultiStore
func (rs *Store) SetLazyLoading(lazyLoading bool) {
}
Expand Down
Loading