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: ibc 8.3.x is not used #1068

Merged
merged 9 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from 7 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- [#1044](https://github.com/crypto-org-chain/chain-main/pull/1044) Revert the protobuf package name changes introduced in #1023.
- [#1060](https://github.com/crypto-org-chain/chain-main/pull/1060) Upgrade rocksdb to `v9.2.1` and bump versiondb.
- [#1061](https://github.com/crypto-org-chain/chain-main/pull/1061) Integrate sdk 0.50.
- [#1068](https://github.com/crypto-org-chain/chain-main/pull/1068) Upgrade ibc-go to `v8.3.2`.

*Dec 6, 2023*

Expand Down
24 changes: 2 additions & 22 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,6 @@ import (
"github.com/crypto-org-chain/chain-main/v4/x/chainmain"
chainmainkeeper "github.com/crypto-org-chain/chain-main/v4/x/chainmain/keeper"
chainmaintypes "github.com/crypto-org-chain/chain-main/v4/x/chainmain/types"
icaauthmodule "github.com/crypto-org-chain/chain-main/v4/x/icaauth"
icaauthmodulekeeper "github.com/crypto-org-chain/chain-main/v4/x/icaauth/keeper"
icaauthmoduletypes "github.com/crypto-org-chain/chain-main/v4/x/icaauth/types"
"github.com/crypto-org-chain/chain-main/v4/x/nft"
nfttransfer "github.com/crypto-org-chain/chain-main/v4/x/nft-transfer"
nfttransferkeeper "github.com/crypto-org-chain/chain-main/v4/x/nft-transfer/keeper"
Expand Down Expand Up @@ -234,7 +231,6 @@ type ChainApp struct {
IBCFeeKeeper ibcfeekeeper.Keeper
ICAControllerKeeper icacontrollerkeeper.Keeper
ICAHostKeeper icahostkeeper.Keeper
ICAAuthKeeper icaauthmodulekeeper.Keeper
AuthzKeeper authzkeeper.Keeper
EvidenceKeeper evidencekeeper.Keeper
FeeGrantKeeper feegrantkeeper.Keeper
Expand All @@ -253,7 +249,6 @@ type ChainApp struct {
ScopedIBCFeeKeeper capabilitykeeper.ScopedKeeper
ScopedICAControllerKeeper capabilitykeeper.ScopedKeeper
ScopedICAHostKeeper capabilitykeeper.ScopedKeeper
ScopedICAAuthKeeper capabilitykeeper.ScopedKeeper

// the module manager
ModuleManager *module.Manager
Expand Down Expand Up @@ -345,7 +340,6 @@ func New(
scopedNFTTransferKeeper := app.CapabilityKeeper.ScopeToModule(nfttransfertypes.ModuleName)
scopedICAControllerKeeper := app.CapabilityKeeper.ScopeToModule(icacontrollertypes.SubModuleName)
scopedICAHostKeeper := app.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName)
scopedICAAuthKeeper := app.CapabilityKeeper.ScopeToModule(icaauthmoduletypes.ModuleName)
app.CapabilityKeeper.Seal()

// add keepers
Expand Down Expand Up @@ -519,17 +513,11 @@ func New(
app.AccountKeeper, scopedICAHostKeeper, app.MsgServiceRouter(),
authAddr,
)
app.ICAHostKeeper.WithQueryRouter(app.GRPCQueryRouter())
icaModule := ica.NewAppModule(&app.ICAControllerKeeper, &app.ICAHostKeeper)

app.ICAAuthKeeper = *icaauthmodulekeeper.NewKeeper(appCodec, keys[icaauthmoduletypes.StoreKey],
keys[icaauthmoduletypes.MemStoreKey], app.GetSubspace(icaauthmoduletypes.ModuleName), app.ICAControllerKeeper,
scopedICAAuthKeeper)

icaAuthModule := icaauthmodule.NewAppModule(appCodec, app.ICAAuthKeeper)

var icaControllerStack porttypes.IBCModule
icaControllerStack = icaauthmodule.NewIBCModule(app.ICAAuthKeeper)
icaControllerStack = icacontroller.NewIBCMiddleware(icaControllerStack, app.ICAControllerKeeper)
icaControllerStack = icacontroller.NewIBCMiddleware(nil, app.ICAControllerKeeper)
icaControllerStack = ibcfee.NewIBCMiddleware(icaControllerStack, app.IBCFeeKeeper)

var icaHostStack porttypes.IBCModule
Expand All @@ -542,7 +530,6 @@ func New(
ibcRouter.AddRoute(icahosttypes.SubModuleName, icaHostStack)
ibcRouter.AddRoute(ibctransfertypes.ModuleName, transferStack)
ibcRouter.AddRoute(nfttransfertypes.ModuleName, nftTransferStack)
ibcRouter.AddRoute(icaauthmoduletypes.ModuleName, icaControllerStack)
app.IBCKeeper.SetRouter(ibcRouter)

// create evidence keeper with router
Expand Down Expand Up @@ -593,7 +580,6 @@ func New(
nfttransfer.NewAppModule(app.NFTTransferKeeper),
feeModule,
icaModule,
icaAuthModule,
chainmain.NewAppModule(app.chainmainKeeper),
supply.NewAppModule(app.SupplyKeeper),
nft.NewAppModule(appCodec, app.NFTKeeper, app.AccountKeeper, app.BankKeeper),
Expand Down Expand Up @@ -640,7 +626,6 @@ func New(
paramstypes.ModuleName,
vestingtypes.ModuleName,
icatypes.ModuleName,
icaauthmoduletypes.ModuleName,
ibcfeetypes.ModuleName,
chainmaintypes.ModuleName,
nfttypes.ModuleName,
Expand Down Expand Up @@ -668,7 +653,6 @@ func New(
upgradetypes.ModuleName,
vestingtypes.ModuleName,
icatypes.ModuleName,
icaauthmoduletypes.ModuleName,
ibcfeetypes.ModuleName,
chainmaintypes.ModuleName,
nfttypes.ModuleName,
Expand Down Expand Up @@ -699,7 +683,6 @@ func New(
group.ModuleName,
ibctransfertypes.ModuleName,
icatypes.ModuleName,
icaauthmoduletypes.ModuleName,
ibcfeetypes.ModuleName,
chainmaintypes.ModuleName,
supplytypes.ModuleName,
Expand Down Expand Up @@ -808,7 +791,6 @@ func New(
app.ScopedTransferKeeper = scopedTransferKeeper
app.ScopedICAControllerKeeper = scopedICAControllerKeeper
app.ScopedICAHostKeeper = scopedICAHostKeeper
app.ScopedICAAuthKeeper = scopedICAAuthKeeper

return app
}
Expand Down Expand Up @@ -1044,7 +1026,6 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(ibctransfertypes.ModuleName).WithKeyTable(ibctransfertypes.ParamKeyTable())
paramsKeeper.Subspace(icacontrollertypes.SubModuleName).WithKeyTable(icacontrollertypes.ParamKeyTable())
paramsKeeper.Subspace(icahosttypes.SubModuleName).WithKeyTable(icahosttypes.ParamKeyTable())
paramsKeeper.Subspace(icaauthmoduletypes.ModuleName)

return paramsKeeper
}
Expand Down Expand Up @@ -1076,7 +1057,6 @@ func StoreKeys() (
nfttransfertypes.StoreKey,
group.StoreKey,
ibcfeetypes.StoreKey,
icaauthmoduletypes.StoreKey,
chainmaintypes.StoreKey,
supplytypes.StoreKey,
nfttypes.StoreKey,
Expand Down
5 changes: 4 additions & 1 deletion app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
panic(fmt.Sprintf("failed to read upgrade info from disk %s", err))
}
if upgradeInfo.Name == planName && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
storeUpgrades := storetypes.StoreUpgrades{
Deleted: []string{"icaauth"},

Check warning on line 26 in app/upgrades.go

View check run for this annotation

Codecov / codecov/patch

app/upgrades.go#L25-L26

Added lines #L25 - L26 were not covered by tests
}
// configure store loader that checks if version == upgradeHeight and applies store upgrades
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storetypes.StoreUpgrades{}))
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))

Check warning on line 29 in app/upgrades.go

View check run for this annotation

Codecov / codecov/patch

app/upgrades.go#L29

Added line #L29 was not covered by tests
}
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ require (
github.com/cosmos/cosmos-sdk v0.50.8
github.com/cosmos/gogoproto v1.5.0
github.com/cosmos/ibc-go/modules/capability v1.0.0
github.com/cosmos/ibc-go/v8 v8.2.1
github.com/cosmos/ibc-go/v8 v8.3.2
github.com/cosmos/rosetta v0.50.3-1
github.com/crypto-org-chain/cronos/store v0.0.5-0.20240716081818-7f581a697f6d
github.com/crypto-org-chain/cronos/versiondb v0.0.0-20240716081818-7f581a697f6d
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -429,8 +429,8 @@ github.com/cosmos/iavl v1.1.2 h1:zL9FK7C4L/P4IF1Dm5fIwz0WXCnn7Bp1M2FxH0ayM7Y=
github.com/cosmos/iavl v1.1.2/go.mod h1:jLeUvm6bGT1YutCaL2fIar/8vGUE8cPZvh/gXEWDaDM=
github.com/cosmos/ibc-go/modules/capability v1.0.0 h1:r/l++byFtn7jHYa09zlAdSeevo8ci1mVZNO9+V0xsLE=
github.com/cosmos/ibc-go/modules/capability v1.0.0/go.mod h1:D81ZxzjZAe0ZO5ambnvn1qedsFQ8lOwtqicG6liLBco=
github.com/cosmos/ibc-go/v8 v8.2.1 h1:MTsnZZjxvGD4Fv5pYyx5UkELafSX0rlPt6IfsE2BpTQ=
github.com/cosmos/ibc-go/v8 v8.2.1/go.mod h1:wj3qx75iC/XNnsMqbPDCIGs0G6Y3E/lo3bdqCyoCy+8=
github.com/cosmos/ibc-go/v8 v8.3.2 h1:8X1oHHKt2Bh9hcExWS89rntLaCKZp2EjFTUSxKlPhGI=
github.com/cosmos/ibc-go/v8 v8.3.2/go.mod h1:WVVIsG39jGrF9Cjggjci6LzySyWGloz194sjTxiGNIE=
github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM=
github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0=
github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo=
Expand Down
4 changes: 2 additions & 2 deletions gomod2nix.toml
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ schema = 3
version = "v1.0.0"
hash = "sha256-xOeHJWUj6fTc2EUGiE4dgfY2WkvrqTg/FWewoUvQcvg="
[mod."github.com/cosmos/ibc-go/v8"]
version = "v8.2.1"
hash = "sha256-FYMkZG3dYTXkqoSSyJSSe5NDd9K+3KlMWKfQKahXz3s="
version = "v8.3.2"
hash = "sha256-uqt1GlZ1sQ7k5b3vGiRxawGp53yeAv0RjOotOIY7Z0E="
[mod."github.com/cosmos/ics23/go"]
version = "v0.10.0"
hash = "sha256-KYEv727BO/ht63JO02xiKFGFAddg41Ve9l2vSSZZBq0="
Expand Down
3 changes: 2 additions & 1 deletion integration_tests/cosmoscli.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def gov_propose_legacy(
event_query_tx=True,
**kwargs,
):
mode = kwargs.get("broadcast_mode")
if kind == "software-upgrade":
rsp = json.loads(
self.raw(
Expand All @@ -57,7 +58,7 @@ def gov_propose_legacy(
**kwargs,
)
)
if rsp["code"] == 0 and event_query_tx:
if rsp["code"] == 0 and event_query_tx and mode == "sync":
rsp = self.event_query_tx_for(rsp["txhash"])
return rsp
elif kind == "cancel-software-upgrade":
Expand Down
10 changes: 5 additions & 5 deletions integration_tests/poetry.lock

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

2 changes: 1 addition & 1 deletion integration_tests/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pytest-github-actions-annotate-failures = "^0.2"
protobuf = "^4.25"
pyyaml = "^6.0.2rc1"
python-dateutil = "^2.8"
pystarport = { git = "https://github.com/crypto-com/pystarport.git", branch = "main" }
pystarport = { git = "https://github.com/mmsqe/pystarport.git", branch = "align_ica" }
chainlibpy = "^2.2.0"

[tool.poetry.dev-dependencies]
Expand Down
32 changes: 16 additions & 16 deletions integration_tests/test_ica.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@

# create interchain account
v = json.dumps({"fee_version": "ics29-1", "app_version": ""})
rsp = cli_controller.icaauth_register_account(
rsp = cli_controller.ica_register_account(
controller_connection,
from_=addr_controller,
gas="400000",
Expand All @@ -119,10 +119,10 @@
wait_for_check_channel_ready(cli_controller, controller_connection, channel_id)

# get interchain account address
ica_address = cli_controller.ica_query_account(

Check failure on line 122 in integration_tests/test_ica.py

View workflow job for this annotation

GitHub Actions / test-ibc

test_ica AssertionError: Error: accepts 2 arg(s), received 0 Usage: chain-maind query interchain-accounts controller interchain-account [owner] [connection-id] [flags] Examples: chain-maind query interchain-accounts controller interchain-account cosmos1layxcsmyye0dc0har9sdfzwckaz8sjwlfsj8zs connection-0 Flags: --grpc-addr string the gRPC endpoint to use for this chain --grpc-insecure allow gRPC over insecure channels, if not the server must use TLS --height int Use a specific height to query state at (this can error if the node is pruning state) -h, --help help for interchain-account --node string <host>:<port> to CometBFT RPC interface for this chain (default "tcp://localhost:26657") -o, --output string Output format (text|json) (default "text") Global Flags: --home string directory for config and data (default "/home/runner/.chain-maind") --log_format string The logging format (json|plain) (default "plain") --log_level string The logging level (trace|debug|info|warn|error|fatal|panic|disabled or '*:<level>,<key>:<level>') (default "info") --log_no_color Disable colored logs --trace print out full stack trace on errors (chain-maind q ica controller interchain-account --node tcp://127.0.0.1:26657 --output json)
controller_connection,
addr_controller,
)["interchainAccountAddress"]
)["address"]
# initial balance of interchain account should be zero
assert cli_host.balance(ica_address) == 0

Expand All @@ -132,25 +132,25 @@
# check if the funds are received in interchain account
assert cli_host.balance(ica_address) == 100000000

def generated_tx_txt(amt):
# generate a transaction to send to host chain
generated_tx = tmp_path / "generated_tx.txt"
generated_tx_msg = cli_host.transfer(
ica_address, addr_host, f"{amt}cro", generate_only=True
)
print(json.dumps(generated_tx_msg))
with open(generated_tx, "w") as opened_file:
json.dump(generated_tx_msg, opened_file)
return generated_tx
def gen_send_msg(sender, receiver, denom, amount):
return {
"@type": "/cosmos.bank.v1beta1.MsgSend",
"from_address": sender,
"to_address": receiver,
"amount": [{"denom": denom, "amount": f"{amount}"}],
}

no_timeout = 60
num_txs = len(cli_host.query_all_txs(ica_address)["txs"])

def submit_msgs(amt, timeout_in_s=no_timeout, gas="200000"):
# generate a transaction to send to host chain
data = json.dumps([gen_send_msg(ica_address, addr_host, "basecro", amt)])
packet = cli_controller.ica_generate_packet_data(data)
# submit transaction on host chain on behalf of interchain account
rsp = cli_controller.icaauth_submit_tx(
rsp = cli_controller.ica_submit_tx(
controller_connection,
generated_tx_txt(amt),
json.dumps(packet),
timeout_duration=f"{timeout_in_s}s",
gas=gas,
from_=addr_controller,
Expand All @@ -160,12 +160,12 @@
wait_for_check_tx(cli_host, ica_address, num_txs, timeout)
return rsp["height"]

submit_msgs(0.5)
submit_msgs(50000000)
# check if the transaction is submitted
assert len(cli_host.query_all_txs(ica_address)["txs"]) == num_txs + 1
# check if the funds are reduced in interchain account
assert cli_host.balance(ica_address) == 50000000
height = int(submit_msgs(10000000))
height = int(submit_msgs(1000000000000000))

ev = None
type = "ibccallbackerror-ics27_packet"
Expand Down
25 changes: 20 additions & 5 deletions integration_tests/test_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,14 @@ def test_cosmovisor(cosmovisor_cluster):
wait_for_block(cluster, target_height + 2, 480)


def upgrade(cluster, plan_name, target_height, propose_legacy=True):
print("upgrade height", target_height)
def upgrade(
cluster,
plan_name,
target_height,
propose_legacy=True,
broadcast_mode="block",
):
print("upgrade height", target_height, plan_name)
kind = "software-upgrade"
proposal = {
"name": plan_name,
Expand All @@ -168,13 +174,15 @@ def upgrade(cluster, plan_name, target_height, propose_legacy=True):
"upgrade-height": target_height,
"deposit": "0.1cro",
}
event_query_tx = broadcast_mode == "sync"
if propose_legacy:
rsp = cluster.gov_propose_legacy(
"community",
kind,
proposal,
no_validate=True,
event_query_tx=False,
event_query_tx=event_query_tx,
broadcast_mode=broadcast_mode,
)
else:
rsp = cluster.gov_propose(
Expand All @@ -198,7 +206,8 @@ def upgrade(cluster, plan_name, target_height, propose_legacy=True):
proposal_id,
"yes",
i=i,
event_query_tx=False,
event_query_tx=event_query_tx,
broadcast_mode=broadcast_mode,
)
assert rsp["code"] == 0, rsp["raw_log"]

Expand Down Expand Up @@ -416,7 +425,13 @@ def assert_commission(adr, expected):
# test migrate keystore
for i in range(2):
cluster.migrate_keystore(i=i)
upgrade(cluster, "v4.3.0", target_height, propose_legacy=True)
upgrade(cluster, "v4.3.0", target_height)

target_height = cluster.block_height() + 15
upgrade(cluster, "v5.0", target_height, broadcast_mode="sync")
cli = cluster.cosmos_cli()
with pytest.raises(AssertionError):
cli.query_params("icaauth")


def test_cancel_upgrade(cluster):
Expand Down
6 changes: 0 additions & 6 deletions x/icaauth/client/cli/flags.go

This file was deleted.

26 changes: 0 additions & 26 deletions x/icaauth/client/cli/query.go

This file was deleted.

Loading
Loading