Skip to content

feat(ibc)!: ibc-go v10 is not supported #1804

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

Open
wants to merge 43 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
b5b9498
Problem: ibc-go v9 is not used
Jan 14, 2025
09cc3ff
changelog
Jan 15, 2025
47dfc5b
remove unrelated upgrade test
Jan 15, 2025
0e43bcc
fix lint
Jan 15, 2025
ed1e020
add light client module
mmsqe Jan 15, 2025
077289f
fix relayer
mmsqe Jan 16, 2025
b56f8cf
fix test
mmsqe Jan 17, 2025
9c6b8eb
rly grant
mmsqe Jan 17, 2025
47d1398
skip ibc_upgrade_channels
mmsqe Jan 20, 2025
5bb66bf
try v10
mmsqe Feb 12, 2025
90da1e1
bump go
mmsqe Feb 12, 2025
b3c4c87
remove go no vendor check replacement cause fixed nixpkgs
JayT106 May 16, 2025
3de3a92
fix upgrage test failed - bump cronos binary to v1.3.4 for --dry-run …
JayT106 May 17, 2025
6bb7504
bump ibc-go to v10
JayT106 May 24, 2025
274f904
update proto files to support ibc-go-v10
JayT106 May 27, 2025
8399780
Merge branch 'main' into jt/ibc-go-v10
JayT106 Jun 2, 2025
fd37919
update HERMES to v1.13.1
JayT106 May 30, 2025
ceef23c
fix app.ICAHostKeeper setup
JayT106 Jun 2, 2025
5518243
fix icaControllerStack and ICAControllerKeeper settings
JayT106 Jun 4, 2025
9e23fc4
fix test_ica
JayT106 Jun 4, 2025
87c837b
skip ica_incentivized test
JayT106 Jun 4, 2025
5f88f5a
fix ica_precompile test_call
JayT106 Jun 6, 2025
dc8f798
fix ibc_transfer tests
JayT106 Jun 11, 2025
8c36735
skip test_ibc_incentivized_transfer
JayT106 Jun 11, 2025
18e7244
fix ibc_update_clien tests
JayT106 Jun 11, 2025
8911add
remove callback assignment in transferStack
JayT106 Jun 17, 2025
4e58889
fix ibc_rly tests
JayT106 Jun 17, 2025
b39f708
fix test_ica_precompile
JayT106 Jun 18, 2025
f5dbc3c
fix test_ica unordered test
JayT106 Jun 18, 2025
903e431
fix test_ibc_timeout
JayT106 Jun 18, 2025
1dfb1c1
fix test_ibc_rly_gas
JayT106 Jun 18, 2025
b4f6664
remove unused code
JayT106 Jun 19, 2025
a6bb28d
update CHANGELOG
JayT106 Jun 19, 2025
dbf7511
lint
JayT106 Jun 19, 2025
7fa3f3c
merge main branch
JayT106 Jun 19, 2025
0b31277
revert ibc-go relayer setup in nix
JayT106 Jun 19, 2025
5b00177
lint and fix nix setup errors
JayT106 Jun 20, 2025
9fdc9c3
revert flake.lock and update go version
JayT106 Jun 20, 2025
a3574a7
fix hermes building error in ci
JayT106 Jun 24, 2025
cb05761
Merge remote-tracking branch 'origin/main' into jt/ibc-go-v10
JayT106 Jun 24, 2025
7b3bb94
nit
JayT106 Jun 24, 2025
47dbe30
lint
JayT106 Jun 25, 2025
f5ae7d7
fix channel version
JayT106 Jun 25, 2025
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## UNRELEASED

### State Machine Breaking

* [#1731](https://github.com/crypto-org-chain/cronos/pull/1804) Upgrade to ibc-go v10.1.1


### Improvements

* [#1779](https://github.com/crypto-org-chain/cronos/pull/1779) Upgrade rocksdb to `v9.11.2`.
Expand Down
185 changes: 62 additions & 123 deletions app/app.go

Large diffs are not rendered by default.

8 changes: 2 additions & 6 deletions app/sim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,10 @@ import (
simcli "github.com/cosmos/cosmos-sdk/x/simulation/client/cli"
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"

simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
ibcfeetypes "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types"
ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"
ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported"
ibctransfertypes "github.com/cosmos/ibc-go/v10/modules/apps/transfer/types"
ibcexported "github.com/cosmos/ibc-go/v10/modules/core/exported"
cronosmoduletypes "github.com/crypto-org-chain/cronos/v2/x/cronos/types"
)

Expand Down Expand Up @@ -236,12 +234,10 @@ func TestAppImportExport(t *testing.T) {
{app.keys[paramtypes.StoreKey], newApp.keys[paramtypes.StoreKey], [][]byte{}},
{app.keys[govtypes.StoreKey], newApp.keys[govtypes.StoreKey], [][]byte{}},
{app.keys[evidencetypes.StoreKey], newApp.keys[evidencetypes.StoreKey], [][]byte{}},
{app.keys[capabilitytypes.StoreKey], newApp.keys[capabilitytypes.StoreKey], [][]byte{}},
{app.keys[evmtypes.StoreKey], newApp.keys[evmtypes.StoreKey], [][]byte{}},
{app.keys[cronosmoduletypes.StoreKey], newApp.keys[cronosmoduletypes.StoreKey], [][]byte{}},
{app.keys[ibcexported.StoreKey], newApp.keys[ibcexported.StoreKey], [][]byte{}},
{app.keys[ibctransfertypes.StoreKey], newApp.keys[ibctransfertypes.StoreKey], [][]byte{}},
{app.keys[ibcfeetypes.StoreKey], newApp.keys[ibcfeetypes.StoreKey], [][]byte{}},
}

for _, skp := range storeKeysPrefixes {
Expand Down
106 changes: 1 addition & 105 deletions app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,121 +2,17 @@ package app

import (
"context"
"fmt"
"time"

sdkmath "cosmossdk.io/math"
storetypes "cosmossdk.io/store/types"
upgradetypes "cosmossdk.io/x/upgrade/types"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper"
govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
icahosttypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/types"
evmtypes "github.com/evmos/ethermint/x/evm/types"
)

// RegisterUpgradeHandlers returns if store loader is overridden
func (app *App) RegisterUpgradeHandlers(cdc codec.BinaryCodec, maxVersion int64) bool {
planName := "v1.4"
planName := "v1.5" // TBD
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Remove "TBD" and define the upgrade plan name.
Avoid leaving planName := "v1.5" // TBD; replace "v1.5" with the finalized upgrade plan identifier and remove the placeholder comment.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 13-13: app/upgrades.go#L13
Added line #L13 was not covered by tests

🤖 Prompt for AI Agents
In app/upgrades.go at line 13, replace the placeholder plan name "v1.5" with the
finalized upgrade plan identifier and remove the "// TBD" comment to clearly
define the upgrade plan name.

app.UpgradeKeeper.SetUpgradeHandler(planName, func(ctx context.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
m, err := app.ModuleManager.RunMigrations(ctx, app.configurator, fromVM)
if err != nil {
return m, err
}

sdkCtx := sdk.UnwrapSDKContext(ctx)
{
params := app.ICAHostKeeper.GetParams(sdkCtx)
params.HostEnabled = false
app.ICAHostKeeper.SetParams(sdkCtx, params)
evmParams := app.EvmKeeper.GetParams(sdkCtx)
evmParams.HeaderHashNum = evmtypes.DefaultHeaderHashNum
if err := app.EvmKeeper.SetParams(sdkCtx, evmParams); err != nil {
return m, err
}
if err := UpdateExpeditedParams(ctx, app.GovKeeper); err != nil {
return m, err
}
}
return m, nil
})

// a hotfix upgrade plan just for testnet
hotfixPlanName := "v1.4.0-rc5-testnet"
app.UpgradeKeeper.SetUpgradeHandler(hotfixPlanName, func(ctx context.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
return app.ModuleManager.RunMigrations(ctx, app.configurator, fromVM)
})

upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk()
if err != nil {
panic(fmt.Sprintf("failed to read upgrade info from disk %s", err))
}
if !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
if upgradeInfo.Name == planName {
app.SetStoreLoader(MaxVersionUpgradeStoreLoader(maxVersion, upgradeInfo.Height, &storetypes.StoreUpgrades{
Added: []string{
icahosttypes.StoreKey,
},
Deleted: []string{"icaauth"},
}))

return true
}
}

return false
}

func UpdateExpeditedParams(ctx context.Context, gov govkeeper.Keeper) error {
govParams, err := gov.Params.Get(ctx)
if err != nil {
return err
}
if len(govParams.MinDeposit) > 0 {
minDeposit := govParams.MinDeposit[0]
expeditedAmount := minDeposit.Amount.MulRaw(govv1.DefaultMinExpeditedDepositTokensRatio)
govParams.ExpeditedMinDeposit = sdk.NewCoins(sdk.NewCoin(minDeposit.Denom, expeditedAmount))
}
threshold, err := sdkmath.LegacyNewDecFromStr(govParams.Threshold)
if err != nil {
return fmt.Errorf("invalid threshold string: %w", err)
}
expeditedThreshold, err := sdkmath.LegacyNewDecFromStr(govParams.ExpeditedThreshold)
if err != nil {
return fmt.Errorf("invalid expedited threshold string: %w", err)
}
if expeditedThreshold.LTE(threshold) {
expeditedThreshold = threshold.Mul(DefaultThresholdRatio())
}
if expeditedThreshold.GT(sdkmath.LegacyOneDec()) {
expeditedThreshold = sdkmath.LegacyOneDec()
}
govParams.ExpeditedThreshold = expeditedThreshold.String()
if govParams.ExpeditedVotingPeriod != nil && govParams.VotingPeriod != nil && *govParams.ExpeditedVotingPeriod >= *govParams.VotingPeriod {
votingPeriod := DurationToDec(*govParams.VotingPeriod)
period := DecToDuration(DefaultPeriodRatio().Mul(votingPeriod))
govParams.ExpeditedVotingPeriod = &period
}
if err := govParams.ValidateBasic(); err != nil {
return err
}
return gov.Params.Set(ctx, govParams)
}

func DefaultThresholdRatio() sdkmath.LegacyDec {
return govv1.DefaultExpeditedThreshold.Quo(govv1.DefaultThreshold)
}

func DefaultPeriodRatio() sdkmath.LegacyDec {
return DurationToDec(govv1.DefaultExpeditedPeriod).Quo(DurationToDec(govv1.DefaultPeriod))
}

func DurationToDec(d time.Duration) sdkmath.LegacyDec {
return sdkmath.LegacyMustNewDecFromStr(fmt.Sprintf("%f", d.Seconds()))
}

func DecToDuration(d sdkmath.LegacyDec) time.Duration {
return time.Second * time.Duration(d.RoundInt64())
}
120 changes: 0 additions & 120 deletions app/upgrades_test.go

This file was deleted.

4 changes: 0 additions & 4 deletions app/versiondb.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ func (app *App) setupVersionDB(
homePath string,
keys map[string]*storetypes.KVStoreKey,
tkeys map[string]*storetypes.TransientStoreKey,
memKeys map[string]*storetypes.MemoryStoreKey,
okeys map[string]*storetypes.ObjectStoreKey,
) (storetypes.RootMultiStore, error) {
dataDir := filepath.Join(homePath, "data", "versiondb")
Expand Down Expand Up @@ -51,9 +50,6 @@ func (app *App) setupVersionDB(
for _, k := range tkeys {
delegatedStoreKeys[k] = struct{}{}
}
for _, k := range memKeys {
delegatedStoreKeys[k] = struct{}{}
}
for _, k := range okeys {
delegatedStoreKeys[k] = struct{}{}
}
Expand Down
1 change: 0 additions & 1 deletion app/versiondb_placeholder.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ func (app *App) setupVersionDB(
homePath string,
keys map[string]*storetypes.KVStoreKey,
tkeys map[string]*storetypes.TransientStoreKey,
memKeys map[string]*storetypes.MemoryStoreKey,
okeys map[string]*storetypes.ObjectStoreKey,
) (storetypes.RootMultiStore, error) {
return nil, errors.New("versiondb is not supported in this binary")
Expand Down
2 changes: 1 addition & 1 deletion cmd/cronosd/cmd/versiondb.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
)

func ChangeSetCmd() *cobra.Command {
keys, _, _, _ := app.StoreKeys()
keys, _, _ := app.StoreKeys()
storeNames := make([]string, 0, len(keys))
for name := range keys {
storeNames = append(storeNames, name)
Expand Down
2 changes: 1 addition & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
nativeByteOrder ? true, # nativeByteOrder mode will panic on big endian machines
}:
let
version = "v1.4.7";
version = "v1.5.0";
pname = "cronosd";
tags = [
"ledger"
Expand Down
2 changes: 1 addition & 1 deletion flake.lock

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

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
gomod2nix.overlays.default
(import ./testground/benchmark/overlay.nix)
(final: super: {
go = super.go_1_22;
go = super.go_1_23;
test-env = final.callPackage ./nix/testenv.nix { };
cronos-matrix = final.callPackage ./nix/cronos-matrix.nix {
inherit rev;
Expand Down
Loading
Loading