revert: bank change module to account change (#20427)
This commit is contained in:
parent
1f06f5bec6
commit
c2f6c19aaf
2
store/cache/cache.go
vendored
2
store/cache/cache.go
vendored
@ -43,7 +43,7 @@ type (
|
||||
func NewCommitKVStoreCache(store types.CommitKVStore, size uint) *CommitKVStoreCache {
|
||||
cache, err := lru.NewARC(int(size))
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("failed to create KVStore cache: %s", err))
|
||||
panic(fmt.Errorf("failed to create KVStore cache: %w", err))
|
||||
}
|
||||
|
||||
return &CommitKVStoreCache{
|
||||
|
||||
@ -5,7 +5,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"math"
|
||||
"math"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
@ -834,7 +834,7 @@ func (rs *Store) Snapshot(height uint64, protoWriter protoio.Writer) error {
|
||||
keys := keysFromStoreKeyMap(rs.stores)
|
||||
for _, key := range keys {
|
||||
switch store := rs.GetCommitKVStore(key).(type) {
|
||||
case *iavl.Store:
|
||||
case *iavl.Store:
|
||||
stores = append(stores, namedStore{name: key.Name(), Store: store})
|
||||
case *transient.Store, *mem.Store:
|
||||
// Non-persisted stores shouldn't be snapshotted
|
||||
@ -854,7 +854,7 @@ func (rs *Store) Snapshot(height uint64, protoWriter protoio.Writer) error {
|
||||
// are demarcated by new SnapshotStore items.
|
||||
for _, store := range stores {
|
||||
rs.logger.Debug("starting snapshot", "store", store.name, "height", height)
|
||||
exporter, err := store.Export(int64(height))
|
||||
exporter, err := store.Export(int64(height))
|
||||
if err != nil {
|
||||
rs.logger.Error("snapshot failed; exporter error", "store", store.name, "err", err)
|
||||
return err
|
||||
|
||||
@ -80,5 +80,4 @@ func bechify(t *testing.T, app *simapp.SimApp, addr []byte) string {
|
||||
|
||||
func fundAccount(t *testing.T, app *simapp.SimApp, ctx sdk.Context, addr sdk.AccAddress, amt string) {
|
||||
require.NoError(t, testutil.FundAccount(ctx, app.BankKeeper, addr, coins(t, amt)))
|
||||
|
||||
}
|
||||
|
||||
3
testutil/testdata/grpc_query.go
vendored
3
testutil/testdata/grpc_query.go
vendored
@ -3,9 +3,10 @@ package testdata
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/cosmos/gogoproto/types/any/test"
|
||||
"testing"
|
||||
|
||||
"github.com/cosmos/gogoproto/types/any/test"
|
||||
|
||||
"github.com/cosmos/gogoproto/proto"
|
||||
"google.golang.org/grpc"
|
||||
"gotest.tools/v3/assert"
|
||||
|
||||
@ -49,4 +49,3 @@ Ref: https://keepachangelog.com/en/1.0.0/
|
||||
### Consensus Breaking Changes
|
||||
|
||||
* [#19188](https://github.com/cosmos/cosmos-sdk/pull/19188) Remove creation of `BaseAccount` when sending a message to an account that does not exist
|
||||
* [#20343](https://github.com/cosmos/cosmos-sdk/pull/20343) Add a check in send moduleaccount to account to prevent module accounts from sending disabled tokens to accounts
|
||||
|
||||
@ -269,13 +269,6 @@ func (k BaseKeeper) SendCoinsFromModuleToAccount(
|
||||
return errorsmod.Wrapf(sdkerrors.ErrUnknownAddress, "module account %s does not exist", senderModule)
|
||||
}
|
||||
|
||||
for _, coin := range amt {
|
||||
sendEnabled, found := k.getSendEnabled(ctx, coin.Denom)
|
||||
if found && !sendEnabled {
|
||||
return fmt.Errorf("denom: %s, is prohibited from being sent at this time", coin.Denom)
|
||||
}
|
||||
}
|
||||
|
||||
if k.BlockedAddr(recipientAddr) {
|
||||
return errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "%s is not allowed to receive funds", recipientAddr)
|
||||
}
|
||||
|
||||
@ -389,24 +389,6 @@ func (suite *KeeperTestSuite) TestSendCoinsFromModuleToAccount_Blocklist() {
|
||||
))
|
||||
}
|
||||
|
||||
func (suite *KeeperTestSuite) TestSendCoinsFromModuleToAccount_CoinSendDisabled() {
|
||||
ctx := suite.ctx
|
||||
require := suite.Require()
|
||||
keeper := suite.bankKeeper
|
||||
|
||||
suite.mockMintCoins(mintAcc)
|
||||
require.NoError(keeper.MintCoins(ctx, banktypes.MintModuleName, initCoins))
|
||||
|
||||
keeper.SetSendEnabled(ctx, sdk.DefaultBondDenom, false)
|
||||
|
||||
suite.authKeeper.EXPECT().GetModuleAddress(mintAcc.Name).Return(mintAcc.GetAddress())
|
||||
err := keeper.SendCoinsFromModuleToAccount(
|
||||
ctx, banktypes.MintModuleName, accAddrs[2], initCoins,
|
||||
)
|
||||
require.Contains(err.Error(), "stake, is prohibited from being sent at this time")
|
||||
keeper.SetSendEnabled(ctx, sdk.DefaultBondDenom, true)
|
||||
}
|
||||
|
||||
func (suite *KeeperTestSuite) TestSupply_DelegateUndelegateCoins() {
|
||||
ctx := suite.ctx
|
||||
require := suite.Require()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user