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

use mainline packages for ibc and 08-wasm #374

Draft
wants to merge 11 commits into
base: release/v7.0.x
Choose a base branch
from
6 changes: 3 additions & 3 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ import (
"github.com/cometbft/cometbft/libs/log"
tmos "github.com/cometbft/cometbft/libs/os"

wasm08 "github.com/cosmos/ibc-go/modules/light-clients/08-wasm"
wasm08keeper "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/keeper"
wasm08types "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types"
ica "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts"
icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types"
"github.com/cosmos/ibc-go/v7/modules/apps/transfer"
Expand All @@ -104,9 +107,6 @@ import (
ibchost "github.com/cosmos/ibc-go/v7/modules/core/exported"
ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"
tendermint "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint"
wasm08 "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm"
wasm08keeper "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/keeper"
wasm08types "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/types"
ibctestingtypes "github.com/cosmos/ibc-go/v7/testing/types"
)

Expand Down
2 changes: 1 addition & 1 deletion app/ibctesting/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import (
tmtypes "github.com/cometbft/cometbft/types"
tmversion "github.com/cometbft/cometbft/version"

wasm08 "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/keeper"
clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
commitmenttypes "github.com/cosmos/ibc-go/v7/modules/core/23-commitment/types"
Expand All @@ -55,7 +56,6 @@ import (
ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"
"github.com/cosmos/ibc-go/v7/modules/core/types"
ibctmtypes "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint"
wasm08 "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/keeper"
ibctesting "github.com/cosmos/ibc-go/v7/testing"
"github.com/cosmos/ibc-go/v7/testing/mock"
ibctestingtypes "github.com/cosmos/ibc-go/v7/testing/types"
Expand Down
2 changes: 1 addition & 1 deletion app/ibctesting/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func NewTendermintConfig(isWasmClient bool) *TendermintConfig {

func (tmcfg *TendermintConfig) GetClientType() string {
if tmcfg.IsWasmClient {
return exported.Wasm
return exported.ModuleName
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this feels wrong...

}
return exported.Tendermint
}
Expand Down
5 changes: 2 additions & 3 deletions app/ibctesting/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import (

"github.com/stretchr/testify/require"

wasmtypes "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types"
clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
connectiontypes "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types"
channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
commitmenttypes "github.com/cosmos/ibc-go/v7/modules/core/23-commitment/types"
host "github.com/cosmos/ibc-go/v7/modules/core/24-host"
"github.com/cosmos/ibc-go/v7/modules/core/exported"
ibctmtypes "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint"
wasmtypes "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/types"
ibctesting "github.com/cosmos/ibc-go/v7/testing"
)

Expand Down Expand Up @@ -97,8 +97,7 @@ func (endpoint *Endpoint) CreateClient() (err error) {
return err
}
consensusState = &wasmtypes.ConsensusState{
Data: wasmConsensusState,
Timestamp: tmConsensusState.GetTimestamp(),
Data: wasmConsensusState,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

migration hotspot

}
default:
err = fmt.Errorf("client type %s is not supported", endpoint.ClientConfig.GetClientType())
Expand Down
2 changes: 1 addition & 1 deletion app/ibctesting/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func NewPath(chainA, chainB *TestChain) *Path {
func NewDefaultEndpoint(chain *TestChain) *Endpoint {
return &Endpoint{
Chain: chain,
ClientConfig: ibctesting.NewTendermintConfig(chain.UseWasmClient),
ClientConfig: ibctesting.NewTendermintConfig(),
ConnectionConfig: ibctesting.NewConnectionConfig(),
ChannelConfig: ibctesting.NewChannelConfig(),
}
Expand Down
2 changes: 1 addition & 1 deletion app/ibctesting/simapp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ import (
"github.com/cometbft/cometbft/libs/log"
tmos "github.com/cometbft/cometbft/libs/os"

wasm08 "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/keeper"
ica "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts"
icacontroller "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller"
icacontrollerkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/keeper"
Expand All @@ -129,7 +130,6 @@ import (
ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"
solomachine "github.com/cosmos/ibc-go/v7/modules/light-clients/06-solomachine"
ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint"
wasm08 "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/keeper"
ibcmock "github.com/cosmos/ibc-go/v7/testing/mock"
ibctestingtypes "github.com/cosmos/ibc-go/v7/testing/types"
)
Expand Down
6 changes: 3 additions & 3 deletions app/ibctesting/wasm.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import (

tmtypes "github.com/cometbft/cometbft/types"

wasmtypes "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types"
clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
wasmtypes "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/types"
)

// ConstructUpdateWasmClientHeader will construct a valid 08-wasm Header with a zero height
// to update the light client on the source chain.
func (chain *TestChain) ConstructUpdateWasmClientHeader(counterparty *TestChain, clientID string) (*wasmtypes.Header, error) {
func (chain *TestChain) ConstructUpdateWasmClientHeader(counterparty *TestChain, clientID string) (*wasmtypes.UpdateStateMsg, error) {
return chain.ConstructUpdateWasmClientHeaderWithTrustedHeight(counterparty, clientID, clienttypes.ZeroHeight())
}

Expand Down Expand Up @@ -49,7 +49,7 @@ func (chain *TestChain) CreateWasmClientHeader(chainID string, blockHeight int64
require.NoError(chain.t, err)
height, ok := tmHeader.GetHeight().(clienttypes.Height)
require.True(chain.t, ok)
return &wasmtypes.Header{
return &wasmtypes.UpdateStateMsg{
Data: tmWasmHeaderData,
Height: height,
}
Expand Down
6 changes: 3 additions & 3 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ import (
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

wasmclientkeeper "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/keeper"
wasm08types "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types"
icahost "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host"
icahostkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/keeper"
icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types"
Expand All @@ -82,8 +84,6 @@ import (
porttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types"
ibchost "github.com/cosmos/ibc-go/v7/modules/core/exported"
ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"
wasmclientkeeper "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/keeper"
wasm08types "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/types"
)

const (
Expand Down Expand Up @@ -228,7 +228,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers(

govModuleAuthority := authtypes.NewModuleAddress(govtypes.ModuleName).String()

appKeepers.Wasm08Keeper = wasmclientkeeper.NewKeeper(appCodec, appKeepers.keys[wasm08types.StoreKey], govModuleAuthority, homePath, &appKeepers.IBCKeeper.ClientKeeper)
appKeepers.Wasm08Keeper = wasmclientkeeper.NewKeeperWithVM(appCodec, appKeepers.keys[wasm08types.StoreKey], govModuleAuthority, homePath, &appKeepers.IBCKeeper.ClientKeeper)

// ICA Host keeper
appKeepers.ICAHostKeeper = icahostkeeper.NewKeeper(
Expand Down
2 changes: 1 addition & 1 deletion app/keepers/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ import (
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

wasm08types "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types"
icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types"
ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"
ibchost "github.com/cosmos/ibc-go/v7/modules/core/exported"
wasm08types "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/types"
)

// GenerateKeys generates new keys (KV Store, Transient store, and memory store).
Expand Down
2 changes: 1 addition & 1 deletion app/test_access.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import (
govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"

wasm08 "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/keeper"
ibctransferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper"
ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"
wasm08 "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/keeper"
)

type TestSupport struct {
Expand Down
14 changes: 7 additions & 7 deletions app/upgrades/v5_2_0/fork.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ import (
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/notional-labs/composable/v6/app/keepers"

transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"
wasm08types "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types"
clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
"github.com/cosmos/ibc-go/v7/modules/core/exported"
ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"
wasm08types "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/types"
)

const (
Expand Down Expand Up @@ -44,12 +43,13 @@ func UpdateWasmContract(ctx sdk.Context, ibckeeper *ibckeeper.Keeper) {
panic("cannot update client")
}

code, err := transfertypes.ParseHexHash(newWasmCodeID)
if err != nil {
panic(err)
}
// commented out to ensure that this runs correctly with the mainline wasm client.
// code, err := transfertypes.ParseHexHash(newWasmCodeID)
// if err != nil {
// panic(err)
// }

clientState.CodeId = code
// clientState.Code = code

ibckeeper.ClientKeeper.SetClientState(ctx, subjectClientId, clientState)
}
Expand Down
18 changes: 14 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module github.com/notional-labs/composable/v6

go 1.19
go 1.21

toolchain go1.21.5

require (
cosmossdk.io/math v1.2.0
Expand All @@ -13,6 +15,7 @@ require (
github.com/cosmos/gogoproto v1.4.10
github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 v7.0.0
github.com/cosmos/ibc-apps/modules/async-icq/v7 v7.1.1
github.com/cosmos/ibc-go/modules/light-clients/08-wasm v0.0.0-00010101000000-000000000000
github.com/cosmos/ibc-go/v7 v7.3.1
github.com/gogo/protobuf v1.3.2
github.com/golang/protobuf v1.5.3
Expand Down Expand Up @@ -195,11 +198,18 @@ replace (
// Use the keyring specified by the cosmos-sdk
github.com/99designs/keyring => github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76

// use modified packet-forward-middleware
github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 => github.com/notional-labs/ibc-apps/middleware/packet-forward-middleware/v7 v7.0.0-20231027045618-f659894b12d9

// ibc-go with wasm client
github.com/cosmos/ibc-go/v7 => github.com/notional-labs/ibc-go/v7 v7.2.1-0.20231010040541-6cf43006971f
// lock the 08-wasm version
github.com/cosmos/ibc-go/modules/light-clients/08-wasm => github.com/cosmos/ibc-go/modules/light-clients/08-wasm v0.1.1-0.20231213092633-b306e7a706e1

// lock ibc-go
github.com/cosmos/ibc-go/v7 => github.com/cosmos/ibc-go/v7 v7.3.1

// Use bumped ict
// github.com/strangelove-ventures/interchaintest/v7 => github.com/notional-labs/interchaintest/v7 v7.1.3-0.20231227064202-0433ee100177

github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
github.com/terra-money/alliance => github.com/notional-labs/alliance v1.0.1-0.20231106184124-5cc1ff759647
github.com/terra-money/alliance => github.com/notional-labs/alliance v1.0.1-0.20230904015751-fec6135c3daa
)
Loading
Loading