diff --git a/.github/workflows/buildtest.yaml b/.github/workflows/buildtest.yaml index 9fc07bd22..5caff3fce 100644 --- a/.github/workflows/buildtest.yaml +++ b/.github/workflows/buildtest.yaml @@ -80,7 +80,6 @@ jobs: - name: Upload coverage reports to Codecov with GitHub Action uses: codecov/codecov-action@v3 with: - token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos files: ./coverage_nogen.txt flags: unittests fail_ci_if_error: true diff --git a/app/app.go b/app/app.go index e3d5e3ec1..b5a7dc572 100644 --- a/app/app.go +++ b/app/app.go @@ -209,15 +209,16 @@ var ( authtypes.FeeCollectorName: nil, distrtypes.ModuleName: nil, // TODO: Remove Burner from mint - for dev/test only; - minttypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, - stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, - govtypes.ModuleName: {authtypes.Burner}, - ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - icatypes.ModuleName: nil, - claimsmanagertypes.ModuleName: nil, - interchainstakingtypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - interchainquerytypes.ModuleName: nil, + minttypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, + stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, + govtypes.ModuleName: {authtypes.Burner}, + ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + icatypes.ModuleName: nil, + claimsmanagertypes.ModuleName: nil, + interchainstakingtypes.ModuleName: {authtypes.Minter}, + interchainstakingtypes.EscrowModuleAccount: {authtypes.Burner}, + interchainquerytypes.ModuleName: nil, // TODO: Remove Burner from participationrewards - for dev/test only; participationrewardstypes.ModuleName: {authtypes.Burner}, airdroptypes.ModuleName: nil, diff --git a/x/interchainstaking/keeper/ibc_packet_handlers.go b/x/interchainstaking/keeper/ibc_packet_handlers.go index 632e199c0..d6e6ae074 100644 --- a/x/interchainstaking/keeper/ibc_packet_handlers.go +++ b/x/interchainstaking/keeper/ibc_packet_handlers.go @@ -338,7 +338,7 @@ func (k *Keeper) HandleWithdrawForUser(ctx sdk.Context, zone *types.Zone, msg *b if len(withdrawalRecord.Amount) == 1 && len(msg.Amount) == 1 && msg.Amount[0].Denom == withdrawalRecord.Amount[0].Denom && withdrawalRecord.Amount.IsEqual(msg.Amount) { k.Logger(ctx).Info("found matching withdrawal; marking as completed") k.UpdateWithdrawalRecordStatus(ctx, &withdrawalRecord, WithdrawStatusCompleted) - if err = k.BankKeeper.BurnCoins(ctx, types.ModuleName, sdk.NewCoins(withdrawalRecord.BurnAmount)); err != nil { + if err = k.BankKeeper.BurnCoins(ctx, types.EscrowModuleAccount, sdk.NewCoins(withdrawalRecord.BurnAmount)); err != nil { // if we can't burn the coins, fail. return err } @@ -357,7 +357,7 @@ func (k *Keeper) HandleWithdrawForUser(ctx sdk.Context, zone *types.Zone, msg *b // we just removed the last element k.Logger(ctx).Info("found matching withdrawal; marking as completed") k.UpdateWithdrawalRecordStatus(ctx, &withdrawalRecord, WithdrawStatusCompleted) - if err = k.BankKeeper.BurnCoins(ctx, types.ModuleName, sdk.NewCoins(withdrawalRecord.BurnAmount)); err != nil { + if err = k.BankKeeper.BurnCoins(ctx, types.EscrowModuleAccount, sdk.NewCoins(withdrawalRecord.BurnAmount)); err != nil { // if we can't burn the coins, fail. return err } diff --git a/x/interchainstaking/keeper/ibc_packet_handlers_test.go b/x/interchainstaking/keeper/ibc_packet_handlers_test.go index 870e43e66..c5f6348de 100644 --- a/x/interchainstaking/keeper/ibc_packet_handlers_test.go +++ b/x/interchainstaking/keeper/ibc_packet_handlers_test.go @@ -561,7 +561,10 @@ func (s *KeeperTestSuite) TestHandleWithdrawForUser() { // set up zones for _, record := range records { app.InterchainstakingKeeper.SetWithdrawalRecord(ctx, record) - app.BankKeeper.MintCoins(ctx, icstypes.ModuleName, sdk.NewCoins(record.BurnAmount)) + err := app.BankKeeper.MintCoins(ctx, icstypes.ModuleName, sdk.NewCoins(record.BurnAmount)) + s.Require().NoError(err) + err = app.BankKeeper.SendCoinsFromModuleToModule(ctx, icstypes.ModuleName, icstypes.EscrowModuleAccount, sdk.NewCoins(record.BurnAmount)) + s.Require().NoError(err) } // trigger handler @@ -672,7 +675,10 @@ func (s *KeeperTestSuite) TestHandleWithdrawForUserLSM() { // set up zones for _, record := range records { app.InterchainstakingKeeper.SetWithdrawalRecord(ctx, record) - app.BankKeeper.MintCoins(ctx, icstypes.ModuleName, sdk.NewCoins(record.BurnAmount)) + err := app.BankKeeper.MintCoins(ctx, icstypes.ModuleName, sdk.NewCoins(record.BurnAmount)) + s.Require().NoError(err) + err = app.BankKeeper.SendCoinsFromModuleToModule(ctx, icstypes.ModuleName, icstypes.EscrowModuleAccount, sdk.NewCoins(record.BurnAmount)) + s.Require().NoError(err) } // trigger handler diff --git a/x/interchainstaking/keeper/keeper.go b/x/interchainstaking/keeper/keeper.go index 3182fe147..3f1eb42dc 100644 --- a/x/interchainstaking/keeper/keeper.go +++ b/x/interchainstaking/keeper/keeper.go @@ -57,6 +57,10 @@ func NewKeeper(cdc codec.Codec, storeKey storetypes.StoreKey, accountKeeper auth panic(fmt.Sprintf("%s module account has not been set", types.ModuleName)) } + if addr := accountKeeper.GetModuleAddress(types.EscrowModuleAccount); addr == nil { + panic(fmt.Sprintf("%s module account has not been set", types.ModuleName)) + } + if !ps.HasKeyTable() { ps = ps.WithKeyTable(types.ParamKeyTable()) } diff --git a/x/interchainstaking/keeper/msg_server.go b/x/interchainstaking/keeper/msg_server.go index 19287b7b6..80834800a 100644 --- a/x/interchainstaking/keeper/msg_server.go +++ b/x/interchainstaking/keeper/msg_server.go @@ -101,7 +101,7 @@ func (k msgServer) RequestRedemption(goCtx context.Context, msg *types.MsgReques hash := sha256.Sum256(append(msg.GetSignBytes(), heightBytes...)) hashString := hex.EncodeToString(hash[:]) - if err := k.BankKeeper.SendCoinsFromAccountToModule(ctx, sender, types.ModuleName, sdk.NewCoins(msg.Value)); err != nil { + if err := k.BankKeeper.SendCoinsFromAccountToModule(ctx, sender, types.EscrowModuleAccount, sdk.NewCoins(msg.Value)); err != nil { return nil, err } diff --git a/x/interchainstaking/types/keys.go b/x/interchainstaking/types/keys.go index e6b831cf2..f263a59fd 100644 --- a/x/interchainstaking/types/keys.go +++ b/x/interchainstaking/types/keys.go @@ -37,7 +37,8 @@ const ( ICASuffixWithdrawal = "withdrawal" ICASuffixPerformance = "performance" - BankStoreKey = "store/bank/key" + BankStoreKey = "store/bank/key" + EscrowModuleAccount = "ics-escrow-account" ) var (