Skip to content
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
1 change: 1 addition & 0 deletions app/config/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,4 +229,5 @@ const (
Upgrade2_17 = "v2.17"
Upgrade2_18 = "v2.18"
Upgrade2_19 = "v2.19"
Upgrade2_20 = "v2.20"
)
9 changes: 9 additions & 0 deletions app/upgrade_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
v2_18 "github.com/terra-money/core/v2/app/upgrades/v2.18"
v2_19 "github.com/terra-money/core/v2/app/upgrades/v2.19"
v2_2_0 "github.com/terra-money/core/v2/app/upgrades/v2.2.0"
v2_20 "github.com/terra-money/core/v2/app/upgrades/v2.20"
v2_3_0 "github.com/terra-money/core/v2/app/upgrades/v2.3.0"
v2_4 "github.com/terra-money/core/v2/app/upgrades/v2.4"
v2_5 "github.com/terra-money/core/v2/app/upgrades/v2.5"
Expand Down Expand Up @@ -183,6 +184,14 @@ func (app *TerraApp) RegisterUpgradeHandlers() {
app.Keepers,
),
)
app.Keepers.UpgradeKeeper.SetUpgradeHandler(
terraappconfig.Upgrade2_20,
v2_20.CreateUpgradeHandler(
app.GetModuleManager(),
app.GetConfigurator(),
app.Keepers,
),
)
}

func (app *TerraApp) RegisterUpgradeStores() {
Expand Down
20 changes: 20 additions & 0 deletions app/upgrades/v2.20/upgrade.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package v2_20

import (
"context"

upgradetypes "cosmossdk.io/x/upgrade/types"
"github.com/cosmos/cosmos-sdk/types/module"

"github.com/terra-money/core/v2/app/keepers"
)

func CreateUpgradeHandler(
mm *module.Manager,
cfg module.Configurator,
k keepers.TerraAppKeepers,
) upgradetypes.UpgradeHandler {
return func(ctx context.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
return mm.RunMigrations(ctx, cfg, vm)
}
}
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ require (
cosmossdk.io/x/feegrant v0.1.1
cosmossdk.io/x/tx v0.13.8
cosmossdk.io/x/upgrade v0.1.4
github.com/CosmWasm/wasmd v0.54.3
github.com/CosmWasm/wasmvm/v2 v2.2.4
github.com/CosmWasm/wasmd v0.54.9
github.com/CosmWasm/wasmvm/v2 v2.2.8
github.com/cometbft/cometbft v0.38.21
github.com/cometbft/cometbft-db v0.14.1 // indirect
github.com/cosmos/btcutil v1.0.5
Expand All @@ -33,7 +33,7 @@ require (
github.com/cosmos/ibc-apps/modules/async-icq/v8 v8.0.0
github.com/cosmos/ibc-apps/modules/ibc-hooks/v8 v8.0.0-20241122170711-64c5cd5a9fb9
github.com/cosmos/ibc-go/modules/capability v1.0.1
github.com/cosmos/ibc-go/v8 v8.5.2
github.com/cosmos/ibc-go/v8 v8.8.0
github.com/cosmos/ledger-cosmos-go v0.14.0 // indirect
github.com/golang/mock v1.6.0 // indirect
github.com/golang/protobuf v1.5.4
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,10 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/CosmWasm/wasmd v0.54.3 h1:Lnbshr2O4edRpdyBmubDOL13mgtKm+JaTxM7Nfvymxk=
github.com/CosmWasm/wasmd v0.54.3/go.mod h1:2FX9+3mf0FmlRHUoUwF8Vg/kkNdtey9TogE5N6nX4Ng=
github.com/CosmWasm/wasmvm/v2 v2.2.4 h1:V3UwXJMA8TNOuQETppDQkaXAevF7gOWLYpKvrThPv7o=
github.com/CosmWasm/wasmvm/v2 v2.2.4/go.mod h1:Aj/rB2KMRM8nAdbWxkO23rnQYb5KsoPuH9ZizSi0sVg=
github.com/CosmWasm/wasmd v0.54.9 h1:rca0ee3o6rLaoTt07Z4bKq6toYl/5nWHWEdO1tUmSqo=
github.com/CosmWasm/wasmd v0.54.9/go.mod h1:4uTpkoUHtKJtNyjqKCiASR1eslzjpNJqlgIzFuuPdmU=
github.com/CosmWasm/wasmvm/v2 v2.2.8 h1:7RqbEOTntOba8WjaWpQY5zU9xyyCVDKq0i4RSRa+M6M=
github.com/CosmWasm/wasmvm/v2 v2.2.8/go.mod h1:Aj/rB2KMRM8nAdbWxkO23rnQYb5KsoPuH9ZizSi0sVg=
github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q=
Expand Down Expand Up @@ -445,8 +445,8 @@ github.com/cosmos/ibc-apps/modules/ibc-hooks/v8 v8.0.0-20241122170711-64c5cd5a9f
github.com/cosmos/ibc-apps/modules/ibc-hooks/v8 v8.0.0-20241122170711-64c5cd5a9fb9/go.mod h1:9+Z14xz3Y+5uEn5i1CvLcDN1aTthEhYUdI7pphySkY8=
github.com/cosmos/ibc-go/modules/capability v1.0.1 h1:ibwhrpJ3SftEEZRxCRkH0fQZ9svjthrX2+oXdZvzgGI=
github.com/cosmos/ibc-go/modules/capability v1.0.1/go.mod h1:rquyOV262nGJplkumH+/LeYs04P3eV8oB7ZM4Ygqk4E=
github.com/cosmos/ibc-go/v8 v8.5.2 h1:27s9oeD2AxLQF3e9BQsYt9doONyZ7FwZi/qkBv6Sdks=
github.com/cosmos/ibc-go/v8 v8.5.2/go.mod h1:P5hkAvq0Qbg0h18uLxDVA9q1kOJ0l36htMsskiNwXbo=
github.com/cosmos/ibc-go/v8 v8.8.0 h1:Xn4/Xzt7JZihKRRSe8xJ65zG7PwrSnIWYRoQDK9hhME=
github.com/cosmos/ibc-go/v8 v8.8.0/go.mod h1:G2z+Q6ZQSMcyHI2+BVcJdvfOupb09M2h/tgpXOEdY6k=
github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU=
github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0=
github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo=
Expand Down
1 change: 1 addition & 0 deletions integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"test:chain:upgrade:v17": "bash src/setup/chain-upgrade/upgrade-simulation-17.sh",
"test:chain:upgrade:v18": "bash src/setup/chain-upgrade/upgrade-simulation-18.sh",
"test:chain:upgrade:v19": "bash src/setup/chain-upgrade/upgrade-simulation-19.sh",
"test:chain:upgrade:v20": "bash src/setup/chain-upgrade/upgrade-simulation-20.sh",
"test:start": "jest --runInBand --detectOpenHandles",
"start": "npm run test:init && npm run test:relayer && npm run test:start",
"test:clean": "rm -rf src/test-data chain-upgrade-data && pkill terrad && pkill terrad && pkill relayer"
Expand Down
13 changes: 10 additions & 3 deletions integration-tests/src/helpers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,20 @@ export {
}

export const getValueByIndexAndTypeAndKey = (events: any[], index: number, type: string, key: string) => {
const matchedEvents = events.filter((event: any) => event.type === type && event.attributes.find((attr: any) => attr.key === "msg_index").value === index.toString());
const matchedEvents = events.filter((event: any) =>
event.type === type &&
event.attributes.find((attr: any) => attr.key === "msg_index")?.value === index.toString()
);
if (matchedEvents.length === 0) {
throw new Error(`No event found with type ${type} and key ${key}`);
}
return matchedEvents[0].attributes.find((attr: any) => attr.key === key).value;
const matchedAttribute = matchedEvents[0].attributes.find((attr: any) => attr.key === key);
if (matchedAttribute === undefined) {
throw new Error(`No attribute found with type ${type} and key ${key}`);
}
return matchedAttribute.value;
}

export const getEventsByIndex = (events: any[], index: number) => {
return events.filter((event: any) => event.attributes.find((attr: any) => attr.key === "msg_index" && attr.value === index.toString()));
}
}
66 changes: 27 additions & 39 deletions integration-tests/src/modules/ica/icav1.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AccAddress, Coin, MsgTransfer, MsgSend, Coins } from "@terra-money/feather.js";
import { blockInclusion, getEventsByIndex, getLCDClient, getMnemonics } from "../../helpers";
import { blockInclusion, getEventsByIndex, getLCDClient, getMnemonics, getValueByIndexAndTypeAndKey } from "../../helpers";
import { MsgRegisterInterchainAccount, MsgSendTx } from "@terra-money/feather.js/dist/core/ica/controller/v1/msgs";
import { Height } from "@terra-money/feather.js/dist/core/ibc/core/client/Height";
import Long from "long";
Expand All @@ -15,6 +15,22 @@ describe("ICA Module (https://github.com/cosmos/ibc-go/tree/release/v7.3.x/modul
let ibcCoinDenom: string | undefined;
let intechainAccountAddr: AccAddress | undefined;

const waitForInterchainAccount = async () => {
for (let i = 0; i <= 10; i++) {
await blockInclusion();
const res = await LCD.chain1.icaV1.controllerAccountAddress(externalAccAddr, "connection-0")
.catch((e) => {
const expectMsg = "failed to retrieve account address for icacontroller-";
expect(e.response.data.message.startsWith(expectMsg)).toBeTruthy();
});
if (res) {
expect(res.address).toBeDefined();
intechainAccountAddr = res.address;
return;
}
}
}

test('Must contain the expected module params', async () => {
// Query ica host module params
const hostResParams = await LCD.chain2.icaV1.hostParams("test-2");
Expand Down Expand Up @@ -104,44 +120,17 @@ describe("ICA Module (https://github.com/cosmos/ibc-go/tree/release/v7.3.x/modul
let result = await LCD.chain1.tx.broadcastSync(tx, "test-1");
await blockInclusion();
let txResult = await LCD.chain1.tx.txInfo(result.txhash, "test-1") as any;
let events = txResult.logs[0].events;

expect(events[0])
.toStrictEqual({
"type": "message",
"attributes": [{
"key": "action",
"value": "/ibc.applications.interchain_accounts.controller.v1.MsgRegisterInterchainAccount"
}, {
"key": "sender",
"value": "terra1p4kcrttuxj9kyyvv5px5ccgwf0yrw74yp7jqm6"
}]
});
expect(events[2])
.toStrictEqual({
"type": "message",
"attributes": [{
"key": "module",
"value": "ibc_channel"
}]
})

// Check during 5 blocks for the receival
// of the IBC coin on chain-2
for (let i = 0; i <= 5; i++) {
await blockInclusion();
let res = await LCD.chain1.icaV1.controllerAccountAddress(externalAccAddr, "connection-0")
.catch((e) => {
const expectMsg = "failed to retrieve account address for icacontroller-";
expect(e.response.data.message.startsWith(expectMsg)).toBeTruthy();
})
if (res) {
expect(res.address).toBeDefined();
intechainAccountAddr = res.address;
break;
}
}
expect(txResult.code).toBe(0);
expect(getValueByIndexAndTypeAndKey(txResult.events, 0, "message", "action"))
.toBe("/ibc.applications.interchain_accounts.controller.v1.MsgRegisterInterchainAccount");
expect(getValueByIndexAndTypeAndKey(txResult.events, 0, "message", "sender"))
.toBe(externalAccAddr);
expect(getValueByIndexAndTypeAndKey(txResult.events, 0, "message", "module"))
.toBe("ibc_channel");
}

await waitForInterchainAccount();
expect(intechainAccountAddr).toBeDefined();
});

describe('After assuring the interchain account exists', () => {
Expand Down Expand Up @@ -209,7 +198,6 @@ describe("ICA Module (https://github.com/cosmos/ibc-go/tree/release/v7.3.x/modul
await blockInclusion();
let txResult = await LCD.chain1.tx.txInfo(result.txhash, "test-1") as any;
const events = getEventsByIndex(txResult.events, 0);
console.log(JSON.stringify(events, null, 2));
expect(events[0])
.toStrictEqual({
"type": "message",
Expand Down
Loading
Loading