diff --git a/app/app.go b/app/app.go index 00d967985..f0b31d476 100644 --- a/app/app.go +++ b/app/app.go @@ -228,6 +228,7 @@ var ( allowedReceivingModAcc = map[string]bool{ distrtypes.ModuleName: true, interchainstakingtypes.ModuleName: true, + airdroptypes.ModuleName: true, } ) diff --git a/go.mod b/go.mod index 31e3a6eb3..50140254e 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/CosmWasm/wasmd v0.29.2 github.com/cosmos/cosmos-proto v1.0.0-alpha8 github.com/cosmos/cosmos-sdk v0.46.7 - github.com/cosmos/ibc-go/v5 v5.1.0 + github.com/cosmos/ibc-go/v5 v5.2.0 github.com/gogo/protobuf v1.3.3 github.com/golang/protobuf v1.5.2 github.com/gorilla/mux v1.8.0 @@ -46,7 +46,7 @@ require ( github.com/DataDog/zstd v1.5.0 // indirect github.com/HdrHistogram/hdrhistogram-go v1.1.2 // indirect github.com/Workiva/go-datastructures v1.0.53 // indirect - github.com/armon/go-metrics v0.4.0 // indirect + github.com/armon/go-metrics v0.4.1 // indirect github.com/aws/aws-sdk-go v1.40.45 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect diff --git a/go.sum b/go.sum index 0a8648f48..bf5376e65 100644 --- a/go.sum +++ b/go.sum @@ -119,8 +119,8 @@ github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-metrics v0.4.0 h1:yCQqn7dwca4ITXb+CbubHmedzaQYHhNhrEXLYUeEe8Q= -github.com/armon/go-metrics v0.4.0/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4= +github.com/armon/go-metrics v0.4.1 h1:hR91U9KYmb6bLBYLQjyM+3j+rcd/UhE+G78SFnF8gJA= +github.com/armon/go-metrics v0.4.1/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= @@ -250,8 +250,8 @@ github.com/cosmos/gorocksdb v1.2.0 h1:d0l3jJG8M4hBouIZq0mDUHZ+zjOx044J3nGRskwTb4 github.com/cosmos/gorocksdb v1.2.0/go.mod h1:aaKvKItm514hKfNJpUJXnnOWeBnk2GL4+Qw9NHizILw= github.com/cosmos/iavl v0.19.4 h1:t82sN+Y0WeqxDLJRSpNd8YFX5URIrT+p8n6oJbJ2Dok= github.com/cosmos/iavl v0.19.4/go.mod h1:X9PKD3J0iFxdmgNLa7b2LYWdsGd90ToV5cAONApkEPw= -github.com/cosmos/ibc-go/v5 v5.1.0 h1:m1NHXFkwwvNeJegZqtyox1WLinh+PMy4ivU/Cs9KjeA= -github.com/cosmos/ibc-go/v5 v5.1.0/go.mod h1:H6sV0/CkNRDtvSrhbsIgiog1WnSwhguGfg8x34MOVEk= +github.com/cosmos/ibc-go/v5 v5.2.0 h1:LxwttRQqdUJpQ3/Gc3XPg5lkRo3pcbzx65dxFIY6ONE= +github.com/cosmos/ibc-go/v5 v5.2.0/go.mod h1:MhDUMDVSboK5JW2pEWHNcw0wJHaHqKV/vwwP7awGhzI= github.com/cosmos/interchain-accounts v0.3.2 h1:7S5rSndahpjkzUvG00kKZrTZsEuVHuVC9a7p0qDVcF8= github.com/cosmos/ledger-cosmos-go v0.12.1 h1:sMBxza5p/rNK/06nBSNmsI/WDqI0pVJFVNihy1Y984w= github.com/cosmos/ledger-cosmos-go v0.12.1/go.mod h1:dhO6kj+Y+AHIOgAe4L9HL/6NDdyyth4q238I9yFpD2g= diff --git a/x/interchainstaking/keeper/abci.go b/x/interchainstaking/keeper/abci.go index 8a4668458..a743fa85c 100644 --- a/x/interchainstaking/keeper/abci.go +++ b/x/interchainstaking/keeper/abci.go @@ -17,11 +17,6 @@ type zoneItrFn func(index int64, zoneInfo types.Zone) (stop bool) func (k Keeper) BeginBlocker(ctx sdk.Context) { defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyBeginBlocker) - if ctx.ChainID() == "quicksilver-1" && ctx.BlockHeight() == 115001 { - // trigger one time function in lieu of upgrade handler that will trigger on chain resumption. - V010100UpgradeHandler(ctx, &k) - } - if ctx.BlockHeight()%30 == 0 { if err := k.GCCompletedRedelegations(ctx); err != nil { k.Logger(ctx).Error("error in GCCompletedRedelegations", "error", err) diff --git a/x/interchainstaking/keeper/hooks.go b/x/interchainstaking/keeper/hooks.go index ede98bebe..50a9a3033 100644 --- a/x/interchainstaking/keeper/hooks.go +++ b/x/interchainstaking/keeper/hooks.go @@ -9,21 +9,12 @@ import ( "github.com/ingenuity-build/quicksilver/x/interchainstaking/types" ) -// we do not wish to process epoch boundaries that occurred during the chain halt. -func skipProductionEpoch(ctx sdk.Context, epochNumber int64) bool { - if ctx.ChainID() != "quicksilver-1" { - return false - } - - return epochNumber < 7 // epoch 7 will start on 4th Jan 2023. -} - func (k Keeper) BeforeEpochStart(ctx sdk.Context, epochIdentifier string, epochNumber int64) { } func (k Keeper) AfterEpochEnd(ctx sdk.Context, epochIdentifier string, epochNumber int64) { // every epoch - if epochIdentifier == "epoch" && !skipProductionEpoch(ctx, epochNumber) { + if epochIdentifier == "epoch" { k.Logger(ctx).Info("handling epoch end") k.IterateZones(ctx, func(index int64, zoneInfo types.Zone) (stop bool) { diff --git a/x/interchainstaking/keeper/ibc_packet_handlers.go b/x/interchainstaking/keeper/ibc_packet_handlers.go index 759f0e554..d46d2696b 100644 --- a/x/interchainstaking/keeper/ibc_packet_handlers.go +++ b/x/interchainstaking/keeper/ibc_packet_handlers.go @@ -95,7 +95,7 @@ func (k *Keeper) HandleAcknowledgement(ctx sdk.Context, packet channeltypes.Pack k.Logger(ctx).Error("unable to unmarshal MsgRedeemTokensforShares response", "error", err) return err } - k.Logger(ctx).Debug("Tokens redeemed for shares", "response", response) + k.Logger(ctx).Info("Tokens redeemed for shares", "response", response) // we should update delegation records here. if err := k.HandleRedeemTokens(ctx, src, response.Amount); err != nil { return err @@ -133,7 +133,7 @@ func (k *Keeper) HandleAcknowledgement(ctx sdk.Context, packet channeltypes.Pack k.Logger(ctx).Error("unable to unmarshal MsgBeginRedelegate response", "error", err) return err } - k.Logger(ctx).Error("Redelegation initiated", "response", response) + k.Logger(ctx).Info("Redelegation initiated", "response", response) if err := k.HandleBeginRedelegate(ctx, src, response.CompletionTime, packetData.Memo); err != nil { return err } @@ -157,7 +157,7 @@ func (k *Keeper) HandleAcknowledgement(ctx sdk.Context, packet channeltypes.Pack k.Logger(ctx).Error("unable to unmarshal MsgSend response", "error", err) return err } - k.Logger(ctx).Debug("Funds Transferred", "response", response) + k.Logger(ctx).Info("Funds Transferred", "response", response) // check tokenTransfers - if end user unescrow and burn txs if err := k.HandleCompleteSend(ctx, src, packetData.Memo); err != nil { return err @@ -170,7 +170,7 @@ func (k *Keeper) HandleAcknowledgement(ctx sdk.Context, packet channeltypes.Pack k.Logger(ctx).Error("unable to unmarshal MsgMultiSend response", "error", err) return err } - k.Logger(ctx).Debug("Funds Transferred (Multi)", "response", response) + k.Logger(ctx).Info("Funds Transferred (Multi)", "response", response) if err := k.HandleCompleteMultiSend(ctx, src, packetData.Memo); err != nil { return err } @@ -182,7 +182,7 @@ func (k *Keeper) HandleAcknowledgement(ctx sdk.Context, packet channeltypes.Pack k.Logger(ctx).Error("unable to unmarshal MsgMultiSend response", "error", err) return err } - k.Logger(ctx).Debug("Withdraw Address Updated", "response", response) + k.Logger(ctx).Info("Withdraw Address Updated", "response", response) if err := k.HandleUpdatedWithdrawAddress(ctx, src); err != nil { return err } @@ -194,7 +194,7 @@ func (k *Keeper) HandleAcknowledgement(ctx sdk.Context, packet channeltypes.Pack k.Logger(ctx).Error("unable to unmarshal MsgTransfer response", "error", err) return err } - k.Logger(ctx).Debug("MsgTranfer acknowledgement received") + k.Logger(ctx).Info("MsgTranfer acknowledgement received") if err := k.HandleMsgTransfer(ctx, src); err != nil { return err } @@ -321,7 +321,7 @@ func (k *Keeper) handleSendToDelegate(ctx sdk.Context, zone *types.Zone, msg *ba } } - k.Logger(ctx).Error("messages to send", "messages", msgs) + k.Logger(ctx).Info("messages to send", "messages", msgs) return k.SubmitTx(ctx, msgs, zone.DelegationAddress, memo) } @@ -449,7 +449,7 @@ func (k *Keeper) HandleQueuedUnbondings(ctx sdk.Context, zone *types.Zone, epoch err = fmt.Errorf("unable to find a validator we expected to exist [%s]", dist.Valoper) return true } - if val.DelegatorShares.Equal(sdk.NewDecFromInt(val.VotingPower)) && dist.Amount > 0 { + if !val.DelegatorShares.Equal(sdk.NewDecFromInt(val.VotingPower)) && dist.Amount > 0 { dist.Amount-- } } @@ -491,7 +491,7 @@ func (k *Keeper) HandleQueuedUnbondings(ctx sdk.Context, zone *types.Zone, epoch } } - k.Logger(ctx).Error("unbonding messages", "msg", msgs) + k.Logger(ctx).Info("unbonding messages to send", "msg", msgs) return k.SubmitTx(ctx, msgs, zone.DelegationAddress, fmt.Sprintf("withdrawal/%d", epoch)) } @@ -610,7 +610,7 @@ func (k *Keeper) HandleBeginRedelegate(ctx sdk.Context, msg sdk.Msg, completion k.Logger(ctx).Error("unable to find redelegation record", "chain", zone.ChainId, "source", redelegateMsg.ValidatorSrcAddress, "dst", redelegateMsg.ValidatorDstAddress, "epoch", epochNumber) return fmt.Errorf("unable to find redelegation record for chain %s, src: %s, dst: %s, at epoch %d", zone.ChainId, redelegateMsg.ValidatorSrcAddress, redelegateMsg.ValidatorDstAddress, epochNumber) } - k.Logger(ctx).Error("updating redelegation record with completion time") + k.Logger(ctx).Info("updating redelegation record with completion time", "completion", completion) record.CompletionTime = completion k.SetRedelegationRecord(ctx, record) return nil @@ -650,7 +650,7 @@ func (k *Keeper) HandleUndelegate(ctx sdk.Context, msg sdk.Msg, completion time. if completion.After(record.CompletionTime) { record.CompletionTime = completion } - k.Logger(ctx).Error("withdrawal record to save", "rcd", record) + k.Logger(ctx).Info("withdrawal record to save", "rcd", record) k.UpdateWithdrawalRecordStatus(ctx, &record, WithdrawStatusUnbond) } delegationQuery := stakingtypes.QueryDelegatorDelegationsRequest{DelegatorAddr: undelegateMsg.DelegatorAddress} @@ -760,7 +760,7 @@ func (k *Keeper) UpdateDelegationRecordsForAddress(ctx sdk.Context, zone types.Z if err != nil { return err } - k.Logger(ctx).Error("ERROR 1", "response", response) + k.Logger(ctx).Info("Delegation query response", "response", response) _, delAddr, err := bech32.DecodeAndConvert(delegatorAddress) if err != nil { return err @@ -845,7 +845,7 @@ func (k *Keeper) UpdateDelegationRecordForAddress(ctx sdk.Context, delegatorAddr } else { delegation.Amount = amount } - k.Logger(ctx).Error("Updating delegation tuple amount", "delegator", delegatorAddress, "validator", validatorAddress, "old_amount", oldAmount, "inbound_amount", amount.Amount, "new_amount", delegation.Amount, "abs", absolute) + k.Logger(ctx).Info("Updating delegation tuple amount", "delegator", delegatorAddress, "validator", validatorAddress, "old_amount", oldAmount, "inbound_amount", amount.Amount, "new_amount", delegation.Amount, "abs", absolute) } k.SetDelegation(ctx, zone, delegation) if err := k.EmitValsetRequery(ctx, zone.ConnectionId, zone.ChainId); err != nil { @@ -875,7 +875,7 @@ func (k *Keeper) HandleWithdrawRewards(ctx sdk.Context, msg sdk.Msg) error { // performance only. if withdrawalMsg.DelegatorAddress != zone.PerformanceAddress.Address { zone.WithdrawalWaitgroup-- - k.Logger(ctx).Error("WAITGROUP DECREMENTED", "wg", zone.WithdrawalWaitgroup) + k.Logger(ctx).Info("Decremented waitgroup", "wg", zone.WithdrawalWaitgroup) k.SetZone(ctx, zone) } k.Logger(ctx).Info("Received MsgWithdrawDelegatorReward acknowledgement", "wg", zone.WithdrawalWaitgroup, "delegator", withdrawalMsg.DelegatorAddress) @@ -887,7 +887,7 @@ func (k *Keeper) HandleWithdrawRewards(ctx sdk.Context, msg sdk.Msg) error { if err != nil { return err } - k.Logger(ctx).Error("TRIGGER DISTRIBUTE REWARDS") + k.Logger(ctx).Info("Distributing rewards") // total rewards balance withdrawn k.ICQKeeper.MakeRequest( ctx, @@ -959,7 +959,7 @@ func DistributeRewardsFromWithdrawAccount(k Keeper, ctx sdk.Context, args []byte Token: coin, Sender: zone.WithdrawalAddress.Address, Receiver: k.AccountKeeper.GetModuleAddress(types.ModuleName).String(), - TimeoutTimestamp: uint64(ctx.BlockTime().UnixNano() + 5*time.Minute.Nanoseconds()), + TimeoutTimestamp: uint64(ctx.BlockTime().UnixNano() + 6*time.Hour.Nanoseconds()), TimeoutHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 0}, }, ) diff --git a/x/interchainstaking/keeper/receipt.go b/x/interchainstaking/keeper/receipt.go index 0298e4dbd..a93f13eaf 100644 --- a/x/interchainstaking/keeper/receipt.go +++ b/x/interchainstaking/keeper/receipt.go @@ -22,7 +22,7 @@ import ( const ( Unset = "unset" - ICAMsgChunkSize = 10 + ICAMsgChunkSize = 5 ) func (k Keeper) HandleReceiptTransaction(ctx sdk.Context, txr *sdk.TxResponse, txn *tx.Tx, zone types.Zone) error { @@ -48,7 +48,7 @@ func (k Keeper) HandleReceiptTransaction(ctx sdk.Context, txr *sdk.TxResponse, t return fmt.Errorf("sender mismatch: expected %q, got %q", senderAddress, sender) } - k.Logger(ctx).Error("Deposit receipt", "deposit_address", zone.DepositAddress.GetAddress(), "sender", sender, "amount", amount) + k.Logger(ctx).Info("Deposit receipt", "deposit_address", zone.DepositAddress.GetAddress(), "sender", sender, "amount", amount) thisCoins, err := sdk.ParseCoinsNormalized(amount) if err != nil { k.Logger(ctx).Error("unable to parse coin", "string", amount) diff --git a/x/interchainstaking/keeper/v1_1_upgrade_handler.go b/x/interchainstaking/keeper/v1_1_upgrade_handler.go deleted file mode 100644 index d141900d3..000000000 --- a/x/interchainstaking/keeper/v1_1_upgrade_handler.go +++ /dev/null @@ -1,83 +0,0 @@ -package keeper - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - - ibcchanneltypes "github.com/cosmos/ibc-go/v5/modules/core/04-channel/types" - "github.com/ingenuity-build/quicksilver/utils" - icstypes "github.com/ingenuity-build/quicksilver/x/interchainstaking/types" -) - -func closeChannel(ctx sdk.Context, k *Keeper, connectionID string, portID string) { //nolint:unparam - channelID, found := k.ICAControllerKeeper.GetActiveChannelID(ctx, connectionID, portID) - if !found { - panic("unable to fetch channelID for closing") - } - channel, found := k.IBCKeeper.ChannelKeeper.GetChannel(ctx, portID, channelID) - if !found { - panic("unable to fetch channel for closing") - } - channel.State = ibcchanneltypes.CLOSED - k.IBCKeeper.ChannelKeeper.SetChannel(ctx, portID, channelID, channel) -} - -// this is not a conventional upgrade handler, as it needs to be run by the begin blocker of the ICS module immediately on restart. -// it needs to be exported/public so can be called from the appropriate begin blocker. -func V010100UpgradeHandler(ctx sdk.Context, k *Keeper) { - // do NOT remove receipts, as reregistering the chain with the same connection will re-open the same deposit account, and existing txs would be re-processed. - // no delegation records, withdrawal, unbonding or rebalancing records exist, because the delegations never happened. - - // and delete the zone. - k.DeleteZone(ctx, "cosmoshub-4") - - // close channels 3,4,5 and 6 on connection-4. - closeChannel(ctx, k, "connection-4", "icacontroller-cosmoshub-4.deposit") - closeChannel(ctx, k, "connection-4", "icacontroller-cosmoshub-4.withdrawal") - closeChannel(ctx, k, "connection-4", "icacontroller-cosmoshub-4.performance") - closeChannel(ctx, k, "connection-4", "icacontroller-cosmoshub-4.delegate") - - // move all qAssets into interchainstakingtypes.EscrowModuleAccount, and burn. Original funds are returned to foundation address by the following - // Gaia migration: https://github.com/cosmos/gaia/pull/1976 - balances := map[string]int64{ - // depositor accounts; already refunded. - "quick1dpr6x7ggn32u2fgewtv08yvdrlh76mqwz4vva3": 4000000, - "quick1t9t4ch0gvt2wtyejnzd03gtdawlhhut56ymqzh": 3000000, - "quick133df0rz42d49jl3hzh6gtv6gf42x8vqas37vn3": 20000, - "quick1afj8d8e6tfdnj4hwczjugl5hu0frfamxsjh030": 750000, - "quick1kx3xxcpfaegq8nw0e46la339lgfmqahcph4nql": 2540000, - "quick1cu89smpf8cmlctxz5y5eud6qhpsp308ckgs0fu": 250000000, - "quick1nnhlu7j6r4e2efuaydyvdmqs5plp963es0ukex": 1000000, - "quick1rdhss0e720yjqu28xxen30t7u55selqfzwdnf5": 17100000, - "quick14hew5e5ua5pzhr6swnr0t2md6up7qmgpy8fe06": 10000000, - "quick1k00n9wvapdkwcmucct8f5wwnrmytqqrwkjkrmk": 10000000, - "quick1qgme8vlq4ly8tcye6xdgxnz4khzq9es03n2yzy": 10000000, - "quick1n4c56vddeqg67ktukprkteqdmpph2ck0xtm8sw": 2000000, - "quick1k8g0vlfmctyqtwahrxhudksz7rgrm6nsye3kpp": 66988, - "quick1gjgjsh74w5trmfaaauq4qt2mwvh8p7gsp4rc5v": 760000, - "quick1eslm0n3ypkd6f67n6ymf08m2t6kt9cypsf2w7d": 20000000, - // quicksilver accounts; to refund after gaia returns funds. - "quick1780znw95jjcdk4wtac44t5cjtrmxqfe9q49pej": 295000000, - "quick1954q9apawr6kg8ez4ukx8jyuaxakz7ye4jvyk4": 800000, - "quick16x03wcp37kx5e8ehckjxvwcgk9j0cqnhcccnty": 2833000000, - } - - for _, addressStr := range utils.Keys[int64](balances) { - addressBytes, err := utils.AccAddressFromBech32(addressStr, "quick") - if err != nil { - panic(err) - } - k.Logger(ctx).Info(fmt.Sprintf("Moving %d uqatom from %s to module account", balances[addressStr], addressStr)) - if err := k.BankKeeper.SendCoinsFromAccountToModule(ctx, addressBytes, icstypes.EscrowModuleAccount, sdk.NewCoins(sdk.NewInt64Coin("uqatom", balances[addressStr]))); err != nil { - panic(err) - } - } - - k.Logger(ctx).Info(fmt.Sprintf("Burning %d uqatom in module account", 3460036988)) - if err := k.BankKeeper.BurnCoins(ctx, icstypes.EscrowModuleAccount, sdk.NewCoins(sdk.NewInt64Coin("uqatom", 3460036988))); err != nil { - panic(err) - } - - k.Logger(ctx).Info(fmt.Sprintf("%d uqatom burned and removed from supply; current supply (should be zero!): %v", 3460036988, k.BankKeeper.GetSupply(ctx, "uqatom"))) -} diff --git a/x/interchainstaking/keeper/v1_1_upgrade_handler_test.go b/x/interchainstaking/keeper/v1_1_upgrade_handler_test.go deleted file mode 100644 index 19bf5f6d0..000000000 --- a/x/interchainstaking/keeper/v1_1_upgrade_handler_test.go +++ /dev/null @@ -1,99 +0,0 @@ -package keeper_test - -import ( - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" - clienttypes "github.com/cosmos/ibc-go/v5/modules/core/02-client/types" - connectiontypes "github.com/cosmos/ibc-go/v5/modules/core/03-connection/types" - ibcchanneltypes "github.com/cosmos/ibc-go/v5/modules/core/04-channel/types" - tmclienttypes "github.com/cosmos/ibc-go/v5/modules/light-clients/07-tendermint/types" - "github.com/ingenuity-build/quicksilver/app" - "github.com/ingenuity-build/quicksilver/utils" - "github.com/ingenuity-build/quicksilver/x/interchainstaking/keeper" - icskeeper "github.com/ingenuity-build/quicksilver/x/interchainstaking/keeper" - icstypes "github.com/ingenuity-build/quicksilver/x/interchainstaking/types" -) - -func (suite *KeeperTestSuite) Test_v11UpgradeHandler() { - qApp := suite.GetQuicksilverApp(suite.chainA) - ctx := suite.chainA.GetContext() - qApp.IBCKeeper.ClientKeeper.SetClientState(ctx, "07-tendermint-0", &tmclienttypes.ClientState{ChainId: "cosmoshub-4", TrustingPeriod: time.Hour, LatestHeight: clienttypes.Height{RevisionNumber: 1, RevisionHeight: 100}}) - qApp.IBCKeeper.ClientKeeper.SetClientConsensusState(ctx, "07-tendermint-0", clienttypes.Height{RevisionNumber: 1, RevisionHeight: 100}, &tmclienttypes.ConsensusState{Timestamp: ctx.BlockTime()}) - qApp.IBCKeeper.ConnectionKeeper.SetConnection(ctx, "connection-4", connectiontypes.ConnectionEnd{ClientId: "07-tendermint-0", Versions: []*connectiontypes.Version{{Identifier: "1", Features: []string{"ORDER_ORDERED", "ORDER_UNORDERED"}}}}) - - proposal := &icstypes.RegisterZoneProposal{ - Title: "register zone A", - Description: "register zone A", - ConnectionId: "connection-4", - LocalDenom: "uqatom", - BaseDenom: "uatom", - AccountPrefix: "cosmos", - MultiSend: true, - LiquidityModule: true, - } - - err := icskeeper.HandleRegisterZoneProposal(ctx, qApp.InterchainstakingKeeper, proposal) - suite.Require().NoError(err) - - zone, found := qApp.InterchainstakingKeeper.GetZone(suite.chainA.GetContext(), "cosmoshub-4") - suite.Require().True(found) - - suite.Require().NoError(suite.setupChannelForICA(ctx, "cosmoshub-4", "connection-4", "deposit", zone.AccountPrefix)) - suite.Require().NoError(suite.setupChannelForICA(ctx, "cosmoshub-4", "connection-4", "withdrawal", zone.AccountPrefix)) - suite.Require().NoError(suite.setupChannelForICA(ctx, "cosmoshub-4", "connection-4", "performance", zone.AccountPrefix)) - suite.Require().NoError(suite.setupChannelForICA(ctx, "cosmoshub-4", "connection-4", "delegate", zone.AccountPrefix)) - - for _, val := range suite.GetQuicksilverApp(suite.chainB).StakingKeeper.GetBondedValidatorsByPower(suite.chainB.GetContext()) { - // refetch the zone for each validator, else we end up with an empty valset each time! - zone, found := qApp.InterchainstakingKeeper.GetZone(suite.chainA.GetContext(), "cosmoshub-4") - suite.Require().True(found) - suite.Require().NoError(icskeeper.SetValidatorForZone(&qApp.InterchainstakingKeeper, suite.chainA.GetContext(), zone, app.DefaultConfig().Codec.MustMarshal(&val))) - } - - qApp.MintKeeper.MintCoins(ctx, sdk.NewCoins(sdk.NewInt64Coin("uqatom", 3460036988))) - for addr, amount := range map[string]int64{ - // depositor accounts; already refunded. - "quick1dpr6x7ggn32u2fgewtv08yvdrlh76mqwz4vva3": 4000000, - "quick1t9t4ch0gvt2wtyejnzd03gtdawlhhut56ymqzh": 3000000, - "quick133df0rz42d49jl3hzh6gtv6gf42x8vqas37vn3": 20000, - "quick1afj8d8e6tfdnj4hwczjugl5hu0frfamxsjh030": 750000, - "quick1kx3xxcpfaegq8nw0e46la339lgfmqahcph4nql": 2540000, - "quick1cu89smpf8cmlctxz5y5eud6qhpsp308ckgs0fu": 250000000, - "quick1nnhlu7j6r4e2efuaydyvdmqs5plp963es0ukex": 1000000, - "quick1rdhss0e720yjqu28xxen30t7u55selqfzwdnf5": 17100000, - "quick14hew5e5ua5pzhr6swnr0t2md6up7qmgpy8fe06": 10000000, - "quick1k00n9wvapdkwcmucct8f5wwnrmytqqrwkjkrmk": 10000000, - "quick1qgme8vlq4ly8tcye6xdgxnz4khzq9es03n2yzy": 10000000, - "quick1n4c56vddeqg67ktukprkteqdmpph2ck0xtm8sw": 2000000, - "quick1k8g0vlfmctyqtwahrxhudksz7rgrm6nsye3kpp": 66988, - "quick1gjgjsh74w5trmfaaauq4qt2mwvh8p7gsp4rc5v": 760000, - "quick1eslm0n3ypkd6f67n6ymf08m2t6kt9cypsf2w7d": 20000000, - // quicksilver accounts; to refund after gaia returns funds. - "quick1780znw95jjcdk4wtac44t5cjtrmxqfe9q49pej": 295000000, - "quick1954q9apawr6kg8ez4ukx8jyuaxakz7ye4jvyk4": 800000, - "quick16x03wcp37kx5e8ehckjxvwcgk9j0cqnhcccnty": 2833000000, - } { - - addrBytes, _ := utils.AccAddressFromBech32(addr, "quick") - if err := qApp.BankKeeper.SendCoinsFromModuleToAccount(ctx, "mint", addrBytes, sdk.NewCoins(sdk.NewInt64Coin("uqatom", amount))); err != nil { - panic(err) - } - } - suite.coordinator.CommitNBlocks(suite.chainA, 2) - suite.coordinator.CommitNBlocks(suite.chainB, 2) - - keeper.V010100UpgradeHandler(ctx, &qApp.InterchainstakingKeeper) - - for _, ica := range qApp.ICAControllerKeeper.GetAllInterchainAccounts(ctx) { - channelId, found := qApp.ICAControllerKeeper.GetActiveChannelID(ctx, ica.ConnectionId, ica.PortId) - suite.Require().True(found) - channel, found := qApp.IBCKeeper.ChannelKeeper.GetChannel(ctx, ica.PortId, channelId) - suite.Require().True(found) - suite.Require().Equal(ibcchanneltypes.CLOSED, channel.State) - } - - suite.Require().Equal(sdk.Coin{Denom: "uqatom", Amount: sdk.ZeroInt()}, qApp.BankKeeper.GetSupply(ctx, "uqatom")) - _, found = qApp.InterchainstakingKeeper.GetZone(ctx, "cosmoshub-4") - suite.Require().False(found) -}