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

Jeancarlo barrios/update app #10824

Draft
wants to merge 3 commits into
base: rs-update-ibc-go
Choose a base branch
from
Draft
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
6 changes: 3 additions & 3 deletions golang/cosmos/ante/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ package ante

import (
sdkioerrors "cosmossdk.io/errors"
"cosmossdk.io/x/auth/ante"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
ibcante "github.com/cosmos/ibc-go/v6/modules/core/ante"
ibckeeper "github.com/cosmos/ibc-go/v6/modules/core/keeper"
ibcante "github.com/cosmos/ibc-go/v8/modules/core/ante"
ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper"
)

// HandlerOptions extend the SDK's AnteHandler options by requiring the IBC
Expand Down
2 changes: 1 addition & 1 deletion golang/cosmos/ante/expected_keepers.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package ante

import (
authtypes "cosmossdk.io/x/auth/types"
swingtypes "github.com/Agoric/agoric-sdk/golang/cosmos/x/swingset/types"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
)

// AccountKeeper defines the contract needed for AccountKeeper related APIs.
Expand Down
139 changes: 83 additions & 56 deletions golang/cosmos/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,47 +13,48 @@ import (
"time"

sdkioerrors "cosmossdk.io/errors"
storetypes "cosmossdk.io/store/types"
"cosmossdk.io/x/auth"
"cosmossdk.io/x/auth/ante"
authkeeper "cosmossdk.io/x/auth/keeper"
authsims "cosmossdk.io/x/auth/simulation"
authtx "cosmossdk.io/x/auth/tx"
authtypes "cosmossdk.io/x/auth/types"
"cosmossdk.io/x/auth/vesting"
vestingtypes "cosmossdk.io/x/auth/vesting/types"
"cosmossdk.io/x/authz"
authzkeeper "cosmossdk.io/x/authz/keeper"
authzmodule "cosmossdk.io/x/authz/module"
"cosmossdk.io/x/evidence"
evidencekeeper "cosmossdk.io/x/evidence/keeper"
evidencetypes "cosmossdk.io/x/evidence/types"
"cosmossdk.io/x/feegrant"
feegrantkeeper "cosmossdk.io/x/feegrant/keeper"
feegrantmodule "cosmossdk.io/x/feegrant/module"
"cosmossdk.io/x/upgrade"
upgradeclient "cosmossdk.io/x/upgrade/client"
upgradekeeper "cosmossdk.io/x/upgrade/keeper"
upgradetypes "cosmossdk.io/x/upgrade/types"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node"
"github.com/cosmos/cosmos-sdk/client/grpc/tmservice"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/runtime"
"github.com/cosmos/cosmos-sdk/server/api"
"github.com/cosmos/cosmos-sdk/server/config"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
"github.com/cosmos/cosmos-sdk/simapp"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/version"
"github.com/cosmos/cosmos-sdk/x/auth"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation"
authtx "github.com/cosmos/cosmos-sdk/x/auth/tx"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/cosmos/cosmos-sdk/x/auth/vesting"
vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
"github.com/cosmos/cosmos-sdk/x/authz"
authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper"
authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module"
"github.com/cosmos/cosmos-sdk/x/bank"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/capability"
capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
distr "github.com/cosmos/cosmos-sdk/x/distribution"
distrclient "github.com/cosmos/cosmos-sdk/x/distribution/client"
distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper"
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
"github.com/cosmos/cosmos-sdk/x/evidence"
evidencekeeper "github.com/cosmos/cosmos-sdk/x/evidence/keeper"
evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types"
"github.com/cosmos/cosmos-sdk/x/feegrant"
feegrantkeeper "github.com/cosmos/cosmos-sdk/x/feegrant/keeper"
feegrantmodule "github.com/cosmos/cosmos-sdk/x/feegrant/module"
"github.com/cosmos/cosmos-sdk/x/genutil"
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
"github.com/cosmos/cosmos-sdk/x/gov"
Expand All @@ -76,30 +77,29 @@ import (
"github.com/cosmos/cosmos-sdk/x/staking"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/cosmos/cosmos-sdk/x/upgrade"
upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
ica "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts"

icahost "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/host"
icahostkeeper "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/host/keeper"
icahosttypes "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/host/types"
icatypes "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/types"
ibctransfer "github.com/cosmos/ibc-go/v6/modules/apps/transfer"
ibctransferkeeper "github.com/cosmos/ibc-go/v6/modules/apps/transfer/keeper"
ibctransfertypes "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types"
ibc "github.com/cosmos/ibc-go/v6/modules/core"
ibcclient "github.com/cosmos/ibc-go/v6/modules/core/02-client"
ibcclientclient "github.com/cosmos/ibc-go/v6/modules/core/02-client/client"
ibcclienttypes "github.com/cosmos/ibc-go/v6/modules/core/02-client/types"
ibcporttypes "github.com/cosmos/ibc-go/v6/modules/core/05-port/types"
ibchost "github.com/cosmos/ibc-go/v6/modules/core/24-host"
ibckeeper "github.com/cosmos/ibc-go/v6/modules/core/keeper"
"github.com/cosmos/ibc-go/modules/capability"
capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper"
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"
ica "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts"

abci "github.com/cometbft/cometbft/abci/types"
icahost "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host"
icahostkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/keeper"
icahosttypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/types"
icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types"
ibctransfer "github.com/cosmos/ibc-go/v8/modules/apps/transfer"
ibctransferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper"
ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"
ibc "github.com/cosmos/ibc-go/v8/modules/core"
ibcclient "github.com/cosmos/ibc-go/v8/modules/core/02-client"
ibcclientclient "github.com/cosmos/ibc-go/v8/modules/core/02-client/client"
ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
ibcporttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types"
ibchost "github.com/cosmos/ibc-go/v8/modules/core/24-host"
ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper"
"github.com/gorilla/mux"
"github.com/rakyll/statik/fs"
"github.com/spf13/cast"
abci "github.com/tendermint/tendermint/abci/types"
tmjson "github.com/tendermint/tendermint/libs/json"
"github.com/tendermint/tendermint/libs/log"
tmos "github.com/tendermint/tendermint/libs/os"
Expand All @@ -124,12 +124,12 @@ import (
"github.com/Agoric/agoric-sdk/golang/cosmos/x/vstorage"
"github.com/Agoric/agoric-sdk/golang/cosmos/x/vtransfer"
vtransferkeeper "github.com/Agoric/agoric-sdk/golang/cosmos/x/vtransfer/keeper"
testtypes "github.com/cosmos/ibc-go/v6/testing/types"
testtypes "github.com/cosmos/ibc-go/v8/testing/types"

// Import the packet forward middleware
packetforward "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v6/packetforward"
packetforwardkeeper "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v6/packetforward/keeper"
packetforwardtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v6/packetforward/types"
packetforward "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward"
packetforwardkeeper "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward/keeper"
packetforwardtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward/types"

// unnamed import of statik for swagger UI support
_ "github.com/cosmos/cosmos-sdk/client/docs/statik"
Expand Down Expand Up @@ -214,7 +214,7 @@ var (
)

var (
_ simapp.App = (*GaiaApp)(nil)
_ runtime.AppI = (*GaiaApp)(nil)
_ servertypes.Application = (*GaiaApp)(nil)
)

Expand Down Expand Up @@ -394,26 +394,30 @@ func NewAgoricApp(
// add keepers
app.AccountKeeper = authkeeper.NewAccountKeeper(
appCodec,
keys[authtypes.StoreKey],
app.GetSubspace(authtypes.ModuleName),
runtime.NewKVStoreService(keys[authtypes.StoreKey]),
authtypes.ProtoBaseAccount,
maccPerms,
appName,
addresscodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()),
AccountAddressPrefix,
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)

app.BankKeeper = bankkeeper.NewBaseKeeper(
appCodec,
keys[banktypes.StoreKey],
runtime.NewKVStoreService(keys[banktypes.StoreKey]),
app.AccountKeeper,
app.GetSubspace(banktypes.ModuleName),
app.BlockedAddrs(),
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
bApp.Logger(),
)

app.AuthzKeeper = authzkeeper.NewKeeper(
keys[authzkeeper.StoreKey],
runtime.NewKVStoreService(keys[authzkeeper.StoreKey]),
appCodec,
app.BaseApp.MsgServiceRouter(),
app.AccountKeeper,
)

app.FeeGrantKeeper = feegrantkeeper.NewKeeper(
appCodec,
keys[feegrant.StoreKey],
Expand Down Expand Up @@ -630,7 +634,6 @@ func NewAgoricApp(
icaModule := ica.NewAppModule(nil, &app.ICAHostKeeper)

ics20TransferModule := ibctransfer.NewAppModule(app.TransferKeeper)

// Create the IBC router, which maps *module names* (not PortIDs) to modules.
ibcRouter := ibcporttypes.NewRouter()

Expand All @@ -647,7 +650,7 @@ func NewAgoricApp(
ics20TransferIBCModule = packetforward.NewIBCMiddleware(
ics20TransferIBCModule,
app.PacketForwardKeeper,
0, // retries on timeout
0, // retries on timeout
packetforwardkeeper.DefaultForwardTransferPacketTimeoutTimestamp, // forward timeout
packetforwardkeeper.DefaultRefundTransferPacketTimeoutTimestamp, // refund timeout
)
Expand Down Expand Up @@ -725,6 +728,12 @@ func NewAgoricApp(
vtransferModule,
)

// According to the upgrading guide (https://github.com/cosmos/cosmos-sdk/blob/main/UPGRADING.md#set-preblocker),
//upgrade types need to be added to the pre-blocker. While this part has been implemented, the guide also states
//that these types should be removed from begin blocker. If we need to actually remove them, we would need to modify
// the SetOrderBeginBlockers logic. However, it's unclear whether this removal is strictly required or optional.
app.mm.SetOrderPreBlockers(upgradetypes.ModuleName)

// During begin block slashing happens after distr.BeginBlocker so that
// there is nothing left over in the validator fee pool, so as to keep the
// CanWithdrawInvariant invariant.
Expand Down Expand Up @@ -980,6 +989,19 @@ type cosmosInitAction struct {
// Name returns the name of the App
func (app *GaiaApp) Name() string { return app.BaseApp.Name() }

// PreBlocker application updates before each begin block.
func (app *GaiaApp) PreBlocker(ctx sdk.Context, _ *abci.RequestFinalizeBlock) (*sdk.ResponsePreBlock, error) {
// Set gas meter to the free gas meter.
// This is because there is currently non-deterministic gas usage in the
// pre-blocker, e.g. due to hydration of in-memory data structures.
//
// Note that we don't need to reset the gas meter after the pre-blocker
// because Go is pass by value.
ctx = ctx.WithGasMeter(storetypes.NewInfiniteGasMeter())
mm := app.ModuleManager()
return mm.PreBlock(ctx)
}

// CheckControllerInited exits if the controller initialization state does not match `expected`.
func (app *GaiaApp) CheckControllerInited(expected bool) {
if app.controllerInited != expected {
Expand Down Expand Up @@ -1182,6 +1204,11 @@ func (app *GaiaApp) InterfaceRegistry() types.InterfaceRegistry {
return app.interfaceRegistry
}

// ModuleManager returns the module manager instance associated with the GaiaApp.
func (app *GaiaApp) ModuleManager() module.Manager {
return *app.mm
}

// GetKey returns the KVStoreKey for the provided store key.
//
// NOTE: This is solely to be used for testing purposes.
Expand Down
2 changes: 1 addition & 1 deletion golang/cosmos/app/genesis_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package gaia
import (
"errors"

authtypes "cosmossdk.io/x/auth/types"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
)

var _ authtypes.GenesisAccount = (*SimGenesisAccount)(nil)
Expand Down
2 changes: 1 addition & 1 deletion golang/cosmos/app/params/proto.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package params

import (
"cosmossdk.io/x/auth/tx"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/x/auth/tx"
)

// MakeEncodingConfig creates an EncodingConfig for an amino based test configuration.
Expand Down
4 changes: 2 additions & 2 deletions golang/cosmos/app/sim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import (
"github.com/tendermint/tendermint/libs/rand"
dbm "github.com/tendermint/tm-db"

"cosmossdk.io/simapp"
"cosmossdk.io/store"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/simapp"
"github.com/cosmos/cosmos-sdk/store"
simulation2 "github.com/cosmos/cosmos-sdk/types/simulation"
"github.com/cosmos/cosmos-sdk/x/simulation"
)
Expand Down
14 changes: 7 additions & 7 deletions golang/cosmos/app/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import (
"strings"
"text/template"

upgradetypes "cosmossdk.io/x/upgrade/types"
"github.com/Agoric/agoric-sdk/golang/cosmos/vm"
swingsetkeeper "github.com/Agoric/agoric-sdk/golang/cosmos/x/swingset/keeper"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
)

var upgradeNamesOfThisVersion = []string{
Expand Down Expand Up @@ -175,12 +175,12 @@ func terminateGovernorCoreProposal(upgradeName string) (vm.CoreProposalStep, err
// targets is a slice of "$boardID:$instanceKitLabel" strings.
var targets []string
switch getVariantFromUpgradeName(upgradeName) {
case "MAINNET":
targets = []string{"board052184:stkATOM-USD_price_feed"}
case "A3P_INTEGRATION":
targets = []string{"board04091:stATOM-USD_price_feed"}
default:
return nil, nil
case "MAINNET":
targets = []string{"board052184:stkATOM-USD_price_feed"}
case "A3P_INTEGRATION":
targets = []string{"board04091:stATOM-USD_price_feed"}
default:
return nil, nil
}

return buildProposalStepWithArgs(
Expand Down
2 changes: 1 addition & 1 deletion golang/cosmos/daemon/cmd/testnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/tendermint/tendermint/types"
tmtime "github.com/tendermint/tendermint/types/time"

authtypes "cosmossdk.io/x/auth/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
Expand All @@ -28,7 +29,6 @@ import (
"github.com/cosmos/cosmos-sdk/testutil"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/genutil"
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
Expand Down
8 changes: 4 additions & 4 deletions golang/cosmos/e2e_test/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ go 1.20

require (
github.com/agoric-labs/interchaintest/v6 v6.0.1-agoriclabs
github.com/cosmos/cosmos-sdk v0.46.13
github.com/cosmos/ibc-go/v6 v6.2.0
github.com/cosmos/cosmos-sdk v0.50.9
github.com/cosmos/ibc-go/v8 v8.5.2
github.com/stretchr/testify v1.9.0
go.uber.org/zap v1.26.0
)
Expand Down Expand Up @@ -219,13 +219,13 @@ replace (
// Agoric-specific replacements:
replace (
// We need a fork of cosmos-sdk until all of the differences are merged.
github.com/cosmos/cosmos-sdk => github.com/agoric-labs/cosmos-sdk v0.46.16-alpha.agoric.2.5
github.com/cosmos/cosmos-sdk => github.com/agoric-labs/cosmos-sdk v0.46.16-alpha.agoric.2.4.0.20241231161927-03ea5e469b71

// Pick up an IAVL race fix.
github.com/cosmos/iavl => github.com/cosmos/iavl v0.19.7

// Use a version of ibc-go that is compatible with the above forks.
github.com/cosmos/ibc-go/v6 => github.com/agoric-labs/ibc-go/v6 v6.3.1-alpha.agoric.2
github.com/cosmos/ibc-go/v8 => github.com/agoric-labs/ibc-go/v8 v8.0.0-20250106120251-131babedfe63

// use cometbft
// Use our fork at least until post-v0.34.14 is released with
Expand Down
2 changes: 1 addition & 1 deletion golang/cosmos/e2e_test/pfm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/agoric-labs/interchaintest/v6/ibc"
"github.com/agoric-labs/interchaintest/v6/testreporter"
sdk "github.com/cosmos/cosmos-sdk/types"
transfertypes "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types"
transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"
"github.com/stretchr/testify/require"
"go.uber.org/zap/zaptest"
)
Expand Down
Loading