feat(x/bank): introduce msg burn to bank keeper (#17569)

Co-authored-by: likhita-809 <likhita@vitwit.com>
This commit is contained in:
Marko 2023-09-08 17:59:04 +02:00 committed by GitHub
parent 772d6b7b87
commit 81d9ce9af5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 1892 additions and 231 deletions

View File

@ -43,6 +43,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (client/keys) [#17639](https://github.com/cosmos/cosmos-sdk/pull/17639) Allows using and saving public keys encoded as base64
* (client) [#17513](https://github.com/cosmos/cosmos-sdk/pull/17513) Allow overwritting `client.toml`. Use `client.CreateClientConfig` in place of `client.ReadFromClientConfig` and provide a custom template and a custom config.
* (x/bank) [#14224](https://github.com/cosmos/cosmos-sdk/pull/14224) Allow injection of restrictions on transfers using `AppendSendRestriction` or `PrependSendRestriction`.
* (x/bank) [#17569](https://github.com/cosmos/cosmos-sdk/pull/17569) Introduce a new message type, `MsgBurn `, to burn coins.
* (genutil) [#17571](https://github.com/cosmos/cosmos-sdk/pull/17571) Allow creation of `AppGenesis` without a file lookup.
### Improvements
@ -131,6 +132,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (x/gov) [#17496](https://github.com/cosmos/cosmos-sdk/pull/17469) in `x/gov/types/v1beta1/vote.go` `NewVote` was removed, constructing the struct is required for this type
* (types) [#17426](https://github.com/cosmos/cosmos-sdk/pull/17426) `NewContext` does not take a `cmtproto.Header{}` any longer.
* `WithChainID` / `WithBlockHeight` / `WithBlockHeader` must be used to set values on the context
* (x/bank) [#17569](https://github.com/cosmos/cosmos-sdk/pull/17569) `BurnCoins` takes an address instead of a module name
### CLI Breaking Changes

File diff suppressed because it is too large Load Diff

View File

@ -21,6 +21,7 @@ const _ = grpc.SupportPackageIsVersion7
const (
Msg_Send_FullMethodName = "/cosmos.bank.v1beta1.Msg/Send"
Msg_MultiSend_FullMethodName = "/cosmos.bank.v1beta1.Msg/MultiSend"
Msg_Burn_FullMethodName = "/cosmos.bank.v1beta1.Msg/Burn"
Msg_UpdateParams_FullMethodName = "/cosmos.bank.v1beta1.Msg/UpdateParams"
Msg_SetSendEnabled_FullMethodName = "/cosmos.bank.v1beta1.Msg/SetSendEnabled"
)
@ -33,6 +34,10 @@ type MsgClient interface {
Send(ctx context.Context, in *MsgSend, opts ...grpc.CallOption) (*MsgSendResponse, error)
// MultiSend defines a method for sending coins from some accounts to other accounts.
MultiSend(ctx context.Context, in *MsgMultiSend, opts ...grpc.CallOption) (*MsgMultiSendResponse, error)
// Burn defines a method for burning coins by an account.
//
// Since: cosmos-sdk 0.51
Burn(ctx context.Context, in *MsgBurn, opts ...grpc.CallOption) (*MsgBurnResponse, error)
// UpdateParams defines a governance operation for updating the x/bank module parameters.
// The authority is defined in the keeper.
//
@ -73,6 +78,15 @@ func (c *msgClient) MultiSend(ctx context.Context, in *MsgMultiSend, opts ...grp
return out, nil
}
func (c *msgClient) Burn(ctx context.Context, in *MsgBurn, opts ...grpc.CallOption) (*MsgBurnResponse, error) {
out := new(MsgBurnResponse)
err := c.cc.Invoke(ctx, Msg_Burn_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) {
out := new(MsgUpdateParamsResponse)
err := c.cc.Invoke(ctx, Msg_UpdateParams_FullMethodName, in, out, opts...)
@ -99,6 +113,10 @@ type MsgServer interface {
Send(context.Context, *MsgSend) (*MsgSendResponse, error)
// MultiSend defines a method for sending coins from some accounts to other accounts.
MultiSend(context.Context, *MsgMultiSend) (*MsgMultiSendResponse, error)
// Burn defines a method for burning coins by an account.
//
// Since: cosmos-sdk 0.51
Burn(context.Context, *MsgBurn) (*MsgBurnResponse, error)
// UpdateParams defines a governance operation for updating the x/bank module parameters.
// The authority is defined in the keeper.
//
@ -124,6 +142,9 @@ func (UnimplementedMsgServer) Send(context.Context, *MsgSend) (*MsgSendResponse,
func (UnimplementedMsgServer) MultiSend(context.Context, *MsgMultiSend) (*MsgMultiSendResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method MultiSend not implemented")
}
func (UnimplementedMsgServer) Burn(context.Context, *MsgBurn) (*MsgBurnResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Burn not implemented")
}
func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
}
@ -179,6 +200,24 @@ func _Msg_MultiSend_Handler(srv interface{}, ctx context.Context, dec func(inter
return interceptor(ctx, in, info, handler)
}
func _Msg_Burn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgBurn)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).Burn(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_Burn_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).Burn(ctx, req.(*MsgBurn))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgUpdateParams)
if err := dec(in); err != nil {
@ -230,6 +269,10 @@ var Msg_ServiceDesc = grpc.ServiceDesc{
MethodName: "MultiSend",
Handler: _Msg_MultiSend_Handler,
},
{
MethodName: "Burn",
Handler: _Msg_Burn_Handler,
},
{
MethodName: "UpdateParams",
Handler: _Msg_UpdateParams_Handler,

View File

@ -20,6 +20,11 @@ service Msg {
// MultiSend defines a method for sending coins from some accounts to other accounts.
rpc MultiSend(MsgMultiSend) returns (MsgMultiSendResponse);
// Burn defines a method for burning coins by an account.
//
// Since: cosmos-sdk 0.51
rpc Burn(MsgBurn) returns (MsgBurnResponse);
// UpdateParams defines a governance operation for updating the x/bank module parameters.
// The authority is defined in the keeper.
//
@ -122,3 +127,21 @@ message MsgSetSendEnabled {
//
// Since: cosmos-sdk 0.47
message MsgSetSendEnabledResponse {}
// MsgBurn defines a message for burning coins.
//
// Since: cosmos-sdk 0.51
message MsgBurn {
option (cosmos.msg.v1.signer) = "from_address";
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
string from_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
repeated cosmos.base.v1beta1.Coin amount = 2;
}
// MsgBurnResponse defines the Msg/Burn response type.
//
// Since: cosmos-sdk 0.51
message MsgBurnResponse {}

View File

@ -603,3 +603,132 @@ func (mr *MockHasABCIEndblockMockRecorder) RegisterLegacyAminoCodec(arg0 interfa
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterLegacyAminoCodec", reflect.TypeOf((*MockHasABCIEndblock)(nil).RegisterLegacyAminoCodec), arg0)
}
// MockgenesisOnlyModule is a mock of genesisOnlyModule interface.
type MockgenesisOnlyModule struct {
ctrl *gomock.Controller
recorder *MockgenesisOnlyModuleMockRecorder
}
// MockgenesisOnlyModuleMockRecorder is the mock recorder for MockgenesisOnlyModule.
type MockgenesisOnlyModuleMockRecorder struct {
mock *MockgenesisOnlyModule
}
// NewMockgenesisOnlyModule creates a new mock instance.
func NewMockgenesisOnlyModule(ctrl *gomock.Controller) *MockgenesisOnlyModule {
mock := &MockgenesisOnlyModule{ctrl: ctrl}
mock.recorder = &MockgenesisOnlyModuleMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockgenesisOnlyModule) EXPECT() *MockgenesisOnlyModuleMockRecorder {
return m.recorder
}
// DefaultGenesis mocks base method.
func (m *MockgenesisOnlyModule) DefaultGenesis(arg0 codec.JSONCodec) json.RawMessage {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "DefaultGenesis", arg0)
ret0, _ := ret[0].(json.RawMessage)
return ret0
}
// DefaultGenesis indicates an expected call of DefaultGenesis.
func (mr *MockgenesisOnlyModuleMockRecorder) DefaultGenesis(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DefaultGenesis", reflect.TypeOf((*MockgenesisOnlyModule)(nil).DefaultGenesis), arg0)
}
// ExportGenesis mocks base method.
func (m *MockgenesisOnlyModule) ExportGenesis(arg0 types1.Context, arg1 codec.JSONCodec) json.RawMessage {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ExportGenesis", arg0, arg1)
ret0, _ := ret[0].(json.RawMessage)
return ret0
}
// ExportGenesis indicates an expected call of ExportGenesis.
func (mr *MockgenesisOnlyModuleMockRecorder) ExportGenesis(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ExportGenesis", reflect.TypeOf((*MockgenesisOnlyModule)(nil).ExportGenesis), arg0, arg1)
}
// InitGenesis mocks base method.
func (m *MockgenesisOnlyModule) InitGenesis(arg0 types1.Context, arg1 codec.JSONCodec, arg2 json.RawMessage) []types.ValidatorUpdate {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "InitGenesis", arg0, arg1, arg2)
ret0, _ := ret[0].([]types.ValidatorUpdate)
return ret0
}
// InitGenesis indicates an expected call of InitGenesis.
func (mr *MockgenesisOnlyModuleMockRecorder) InitGenesis(arg0, arg1, arg2 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InitGenesis", reflect.TypeOf((*MockgenesisOnlyModule)(nil).InitGenesis), arg0, arg1, arg2)
}
// Name mocks base method.
func (m *MockgenesisOnlyModule) Name() string {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Name")
ret0, _ := ret[0].(string)
return ret0
}
// Name indicates an expected call of Name.
func (mr *MockgenesisOnlyModuleMockRecorder) Name() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Name", reflect.TypeOf((*MockgenesisOnlyModule)(nil).Name))
}
// RegisterGRPCGatewayRoutes mocks base method.
func (m *MockgenesisOnlyModule) RegisterGRPCGatewayRoutes(arg0 client.Context, arg1 *runtime.ServeMux) {
m.ctrl.T.Helper()
m.ctrl.Call(m, "RegisterGRPCGatewayRoutes", arg0, arg1)
}
// RegisterGRPCGatewayRoutes indicates an expected call of RegisterGRPCGatewayRoutes.
func (mr *MockgenesisOnlyModuleMockRecorder) RegisterGRPCGatewayRoutes(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterGRPCGatewayRoutes", reflect.TypeOf((*MockgenesisOnlyModule)(nil).RegisterGRPCGatewayRoutes), arg0, arg1)
}
// RegisterInterfaces mocks base method.
func (m *MockgenesisOnlyModule) RegisterInterfaces(arg0 types0.InterfaceRegistry) {
m.ctrl.T.Helper()
m.ctrl.Call(m, "RegisterInterfaces", arg0)
}
// RegisterInterfaces indicates an expected call of RegisterInterfaces.
func (mr *MockgenesisOnlyModuleMockRecorder) RegisterInterfaces(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterInterfaces", reflect.TypeOf((*MockgenesisOnlyModule)(nil).RegisterInterfaces), arg0)
}
// RegisterLegacyAminoCodec mocks base method.
func (m *MockgenesisOnlyModule) RegisterLegacyAminoCodec(arg0 *codec.LegacyAmino) {
m.ctrl.T.Helper()
m.ctrl.Call(m, "RegisterLegacyAminoCodec", arg0)
}
// RegisterLegacyAminoCodec indicates an expected call of RegisterLegacyAminoCodec.
func (mr *MockgenesisOnlyModuleMockRecorder) RegisterLegacyAminoCodec(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterLegacyAminoCodec", reflect.TypeOf((*MockgenesisOnlyModule)(nil).RegisterLegacyAminoCodec), arg0)
}
// ValidateGenesis mocks base method.
func (m *MockgenesisOnlyModule) ValidateGenesis(arg0 codec.JSONCodec, arg1 client.TxEncodingConfig, arg2 json.RawMessage) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ValidateGenesis", arg0, arg1, arg2)
ret0, _ := ret[0].(error)
return ret0
}
// ValidateGenesis indicates an expected call of ValidateGenesis.
func (mr *MockgenesisOnlyModuleMockRecorder) ValidateGenesis(arg0, arg1, arg2 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidateGenesis", reflect.TypeOf((*MockgenesisOnlyModule)(nil).ValidateGenesis), arg0, arg1, arg2)
}

View File

@ -1,89 +0,0 @@
package tx
import (
"context"
"fmt"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/types/known/anypb"
txv1beta1 "cosmossdk.io/api/cosmos/tx/v1beta1"
txsigning "cosmossdk.io/x/tx/signing"
"cosmossdk.io/x/tx/signing/textual"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
signingtypes "github.com/cosmos/cosmos-sdk/types/tx/signing"
"github.com/cosmos/cosmos-sdk/x/auth/signing"
)
// signModeTextualHandler defines the SIGN_MODE_TEXTUAL SignModeHandler.
// It is currently not enabled by default, but you can enable it manually
// for TESTING purposes. It will be enabled once SIGN_MODE_TEXTUAL is fully
// released, see https://github.com/cosmos/cosmos-sdk/issues/11970.
type signModeTextualHandler struct {
t textual.SignModeHandler
}
var _ signing.SignModeHandler = signModeTextualHandler{}
// DefaultMode implements SignModeHandler.DefaultMode
func (signModeTextualHandler) DefaultMode() signingtypes.SignMode {
return signingtypes.SignMode_SIGN_MODE_TEXTUAL
}
// Modes implements SignModeHandler.Modes
func (signModeTextualHandler) Modes() []signingtypes.SignMode {
return []signingtypes.SignMode{signingtypes.SignMode_SIGN_MODE_TEXTUAL}
}
// GetSignBytes implements SignModeHandler.GetSignBytes
func (h signModeTextualHandler) GetSignBytes(mode signingtypes.SignMode, data signing.SignerData, tx sdk.Tx) ([]byte, error) {
panic("SIGN_MODE_TEXTUAL needs GetSignBytesWithContext")
}
// GetSignBytesWithContext implements SignModeHandler.GetSignBytesWithContext
func (h signModeTextualHandler) GetSignBytesWithContext(ctx context.Context, mode signingtypes.SignMode, data signing.SignerData, tx sdk.Tx) ([]byte, error) {
if mode != signingtypes.SignMode_SIGN_MODE_TEXTUAL {
return nil, fmt.Errorf("expected %s, got %s", signingtypes.SignMode_SIGN_MODE_TEXTUAL, mode)
}
protoTx, ok := tx.(*wrapper)
if !ok {
return nil, fmt.Errorf("can only handle a protobuf Tx, got %T", tx)
}
pbAny, err := codectypes.NewAnyWithValue(data.PubKey)
if err != nil {
return nil, err
}
txBody := &txv1beta1.TxBody{}
txAuthInfo := &txv1beta1.AuthInfo{}
err = proto.Unmarshal(protoTx.getBodyBytes(), txBody)
if err != nil {
return nil, err
}
err = proto.Unmarshal(protoTx.getAuthInfoBytes(), txAuthInfo)
if err != nil {
return nil, err
}
txData := txsigning.TxData{
Body: txBody,
AuthInfo: txAuthInfo,
BodyBytes: protoTx.getBodyBytes(),
AuthInfoBytes: protoTx.getAuthInfoBytes(),
}
return h.t.GetSignBytes(ctx, txsigning.SignerData{
Address: data.Address,
ChainID: data.ChainID,
AccountNumber: data.AccountNumber,
Sequence: data.Sequence,
PubKey: &anypb.Any{
TypeUrl: pbAny.TypeUrl,
Value: pbAny.Value,
},
}, txData)
}

View File

@ -12,6 +12,10 @@ func (k MockBankKeeper) Send(goCtx context.Context, msg *bank.MsgSend) (*bank.Ms
return nil, nil
}
func (k MockBankKeeper) Burn(goCtx context.Context, msg *bank.MsgBurn) (*bank.MsgBurnResponse, error) {
return nil, nil
}
func (k MockBankKeeper) MultiSend(goCtx context.Context, msg *bank.MsgMultiSend) (*bank.MsgMultiSendResponse, error) {
return nil, nil
}

View File

@ -415,11 +415,26 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/bank/v1beta1/
The message will fail under the following conditions:
* The authority is not a bech32 address.
* The authority is not a decodable address.
* The authority is not x/gov module's address.
* There are multiple SendEnabled entries with the same Denom.
* One or more SendEnabled entries has an invalid Denom.
### MsgBurn
Used to burn coins from an account. The coins are removed from the account and the total supply is reduced.
```protobuf reference
https://github.com/cosmos/cosmos-sdk/blob/1af000b3ef6296f9928caf494fe5bb812990f22d/proto/cosmos/bank/v1beta1/tx.proto#L131-L148
```
This message will fail under the following conditions:
* The signer is not present
* The coins are not spendable
* The coins are not positive
* The coins are not valid
## Events
The bank module emits the following events:

View File

@ -44,7 +44,7 @@ type Keeper interface {
DelegateCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error
UndelegateCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error
MintCoins(ctx context.Context, moduleName string, amt sdk.Coins) error
BurnCoins(ctx context.Context, moduleName string, amt sdk.Coins) error
BurnCoins(ctx context.Context, address []byte, amt sdk.Coins) error
DelegateCoins(ctx context.Context, delegatorAddr, moduleAccAddr sdk.AccAddress, amt sdk.Coins) error
UndelegateCoins(ctx context.Context, moduleAccAddr, delegatorAddr sdk.AccAddress, amt sdk.Coins) error
@ -380,14 +380,16 @@ func (k BaseKeeper) MintCoins(ctx context.Context, moduleName string, amounts sd
// BurnCoins burns coins deletes coins from the balance of the module account.
// It will panic if the module account does not exist or is unauthorized.
func (k BaseKeeper) BurnCoins(ctx context.Context, moduleName string, amounts sdk.Coins) error {
acc := k.ak.GetModuleAccount(ctx, moduleName)
func (k BaseKeeper) BurnCoins(ctx context.Context, address []byte, amounts sdk.Coins) error {
acc := k.ak.GetAccount(ctx, address)
if acc == nil {
panic(errorsmod.Wrapf(sdkerrors.ErrUnknownAddress, "module account %s does not exist", moduleName))
return errorsmod.Wrapf(sdkerrors.ErrUnknownAddress, "account %x does not exist", address)
}
if !acc.HasPermission(authtypes.Burner) {
panic(errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "module account %s does not have permissions to burn tokens", moduleName))
if macc, ok := acc.(sdk.ModuleAccountI); ok {
if !macc.HasPermission(authtypes.Burner) {
return errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "account %x does not have permissions to burn tokens", address)
}
}
err := k.subUnlockedCoins(ctx, acc.GetAddress(), amounts)
@ -401,7 +403,7 @@ func (k BaseKeeper) BurnCoins(ctx context.Context, moduleName string, amounts sd
k.setSupply(ctx, supply)
}
k.logger.Debug("burned tokens from module account", "amount", amounts.String(), "from", moduleName)
k.logger.Debug("burned tokens from account", "amount", amounts.String(), "from", address)
// emit burn event
sdkCtx := sdk.UnwrapSDKContext(ctx)

View File

@ -51,6 +51,7 @@ const (
var (
holderAcc = authtypes.NewEmptyModuleAccount(holder)
randomAcc = authtypes.NewEmptyModuleAccount(randomPerm)
burnerAcc = authtypes.NewEmptyModuleAccount(authtypes.Burner, authtypes.Burner, authtypes.Staking)
minterAcc = authtypes.NewEmptyModuleAccount(authtypes.Minter, authtypes.Minter)
mintAcc = authtypes.NewEmptyModuleAccount(banktypes.MintModuleName, authtypes.Minter)
@ -177,8 +178,7 @@ func (suite *KeeperTestSuite) mockSendCoinsFromModuleToAccount(moduleAcc *authty
}
func (suite *KeeperTestSuite) mockBurnCoins(moduleAcc *authtypes.ModuleAccount) {
suite.authKeeper.EXPECT().GetModuleAccount(suite.ctx, moduleAcc.Name).Return(moduleAcc)
suite.authKeeper.EXPECT().GetAccount(suite.ctx, moduleAcc.GetAddress()).Return(moduleAcc)
suite.authKeeper.EXPECT().GetAccount(suite.ctx, moduleAcc.GetAddress()).Return(moduleAcc).AnyTimes()
}
func (suite *KeeperTestSuite) mockSendCoinsFromModuleToModule(sender, receiver *authtypes.ModuleAccount) {
@ -364,7 +364,7 @@ func (suite *KeeperTestSuite) TestSupply() {
// burning all supplied tokens
suite.mockBurnCoins(burnerAcc)
require.NoError(keeper.BurnCoins(ctx, authtypes.Burner, initCoins))
require.NoError(keeper.BurnCoins(ctx, burnerAcc.GetAddress(), initCoins))
total, _, err = keeper.GetPaginatedTotalSupply(ctx, &query.PageRequest{})
require.NoError(err)
@ -553,7 +553,6 @@ func (suite *KeeperTestSuite) TestSupply_BurnCoins() {
// set burnerAcc balance
suite.mockMintCoins(minterAcc)
require.NoError(keeper.MintCoins(ctx, authtypes.Minter, initCoins))
suite.mockSendCoinsFromModuleToAccount(minterAcc, burnerAcc.GetAddress())
require.NoError(keeper.SendCoinsFromModuleToAccount(ctx, authtypes.Minter, burnerAcc.GetAddress(), initCoins))
@ -564,20 +563,20 @@ func (suite *KeeperTestSuite) TestSupply_BurnCoins() {
supplyAfterInflation, _, err := keeper.GetPaginatedTotalSupply(ctx, &query.PageRequest{})
require.NoError(err)
authKeeper.EXPECT().GetModuleAccount(ctx, "").Return(nil)
require.Panics(func() { _ = keeper.BurnCoins(ctx, "", initCoins) }, "no module account")
authKeeper.EXPECT().GetAccount(ctx, sdk.AccAddress{}).Return(nil)
require.Error(keeper.BurnCoins(ctx, sdk.AccAddress{}, initCoins), "no account")
authKeeper.EXPECT().GetModuleAccount(ctx, minterAcc.Name).Return(nil)
require.Panics(func() { _ = keeper.BurnCoins(ctx, authtypes.Minter, initCoins) }, "invalid permission")
authKeeper.EXPECT().GetAccount(ctx, minterAcc.GetAddress()).Return(nil)
require.Error(keeper.BurnCoins(ctx, minterAcc.GetAddress(), initCoins), "invalid permission")
authKeeper.EXPECT().GetModuleAccount(ctx, randomPerm).Return(nil)
require.Panics(func() { _ = keeper.BurnCoins(ctx, randomPerm, supplyAfterInflation) }, "random permission")
authKeeper.EXPECT().GetAccount(ctx, randomAcc.GetAddress()).Return(nil)
require.Error(keeper.BurnCoins(ctx, randomAcc.GetAddress(), supplyAfterInflation), "random permission")
suite.mockBurnCoins(burnerAcc)
require.Error(keeper.BurnCoins(ctx, authtypes.Burner, supplyAfterInflation), "insufficient coins")
require.Error(keeper.BurnCoins(ctx, burnerAcc.GetAddress(), supplyAfterInflation), "insufficient coins")
suite.mockBurnCoins(burnerAcc)
require.NoError(keeper.BurnCoins(ctx, authtypes.Burner, initCoins))
require.NoError(keeper.BurnCoins(ctx, burnerAcc.GetAddress(), initCoins))
supplyAfterBurn, _, err := keeper.GetPaginatedTotalSupply(ctx, &query.PageRequest{})
require.NoError(err)
@ -595,7 +594,7 @@ func (suite *KeeperTestSuite) TestSupply_BurnCoins() {
require.NoError(keeper.SendCoins(ctx, minterAcc.GetAddress(), multiPermAcc.GetAddress(), initCoins))
suite.mockBurnCoins(multiPermAcc)
require.NoError(keeper.BurnCoins(ctx, multiPermAcc.GetName(), initCoins))
require.NoError(keeper.BurnCoins(ctx, multiPermAcc.GetAddress(), initCoins))
supplyAfterBurn, _, err = keeper.GetPaginatedTotalSupply(ctx, &query.PageRequest{})
require.NoError(err)
@ -1838,7 +1837,7 @@ func (suite *KeeperTestSuite) TestBalanceTrackingEvents() {
require.NoError(
suite.bankKeeper.BurnCoins(
suite.ctx,
multiPermAcc.Name,
multiPermAcc.GetAddress(),
sdk.NewCoins(sdk.NewInt64Coin("utxo", 1000)),
),
)

View File

@ -2,6 +2,7 @@ package keeper
import (
"context"
"fmt"
"github.com/hashicorp/go-metrics"
@ -181,3 +182,39 @@ func (k msgServer) SetSendEnabled(goCtx context.Context, msg *types.MsgSetSendEn
return &types.MsgSetSendEnabledResponse{}, nil
}
func (k msgServer) Burn(goCtx context.Context, msg *types.MsgBurn) (*types.MsgBurnResponse, error) {
var (
from []byte
err error
)
var coins sdk.Coins
for _, coin := range msg.Amount {
coins = coins.Add(sdk.NewCoin(coin.Denom, coin.Amount))
}
if base, ok := k.Keeper.(BaseKeeper); ok {
from, err = base.ak.AddressCodec().StringToBytes(msg.FromAddress)
if err != nil {
return nil, sdkerrors.ErrInvalidAddress.Wrapf("invalid from address: %s", err)
}
} else {
return nil, sdkerrors.ErrInvalidRequest.Wrapf("invalid keeper type: %T", k.Keeper)
}
if !coins.IsValid() {
return nil, errorsmod.Wrap(sdkerrors.ErrInvalidCoins, coins.String())
}
fmt.Println("coins", coins)
if !coins.IsAllPositive() {
return nil, errorsmod.Wrap(sdkerrors.ErrInvalidCoins, coins.String())
}
err = k.BurnCoins(goCtx, from, coins)
if err != nil {
return nil, err
}
return &types.MsgBurnResponse{}, nil
}

View File

@ -361,3 +361,62 @@ func (suite *KeeperTestSuite) TestMsgSetSendEnabled() {
})
}
}
func (suite *KeeperTestSuite) TestMsgBurn() {
origCoins := sdk.NewInt64Coin("eth", 100)
atom0 := sdk.NewInt64Coin("atom", 0)
testCases := []struct {
name string
input *banktypes.MsgBurn
expErr bool
expErrMsg string
}{
{
name: "invalid coins",
input: &banktypes.MsgBurn{
FromAddress: multiPermAcc.GetAddress().String(),
Amount: []*sdk.Coin{&atom0},
},
expErr: true,
expErrMsg: "invalid coins",
},
{
name: "invalid from address: empty address string is not allowed: invalid address",
input: &banktypes.MsgBurn{
FromAddress: "",
Amount: []*sdk.Coin{&origCoins},
},
expErr: true,
expErrMsg: "empty address string is not allowed",
},
{
name: "all good",
input: &banktypes.MsgBurn{
FromAddress: multiPermAcc.GetAddress().String(),
Amount: []*sdk.Coin{&origCoins},
},
expErr: false,
},
}
for _, tc := range testCases {
tc := tc
suite.Run(tc.name, func() {
suite.mockMintCoins(multiPermAcc)
err := suite.bankKeeper.MintCoins(suite.ctx, multiPermAcc.Name, sdk.Coins{}.Add(origCoins))
suite.Require().NoError(err)
if !tc.expErr {
suite.mockBurnCoins(multiPermAcc)
}
_, err = suite.msgServer.Burn(suite.ctx, tc.input)
if tc.expErr {
suite.Require().Error(err)
suite.Require().Contains(err.Error(), tc.expErrMsg)
} else {
suite.Require().NoError(err)
}
})
}
}

View File

@ -413,6 +413,86 @@ func (m *MsgSetSendEnabledResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_MsgSetSendEnabledResponse proto.InternalMessageInfo
// MsgBurn defines a message for burning coins.
//
// Since: cosmos-sdk 0.51
type MsgBurn struct {
FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"`
Amount []*types.Coin `protobuf:"bytes,2,rep,name=amount,proto3" json:"amount,omitempty"`
}
func (m *MsgBurn) Reset() { *m = MsgBurn{} }
func (m *MsgBurn) String() string { return proto.CompactTextString(m) }
func (*MsgBurn) ProtoMessage() {}
func (*MsgBurn) Descriptor() ([]byte, []int) {
return fileDescriptor_1d8cb1613481f5b7, []int{8}
}
func (m *MsgBurn) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgBurn) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgBurn.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgBurn) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgBurn.Merge(m, src)
}
func (m *MsgBurn) XXX_Size() int {
return m.Size()
}
func (m *MsgBurn) XXX_DiscardUnknown() {
xxx_messageInfo_MsgBurn.DiscardUnknown(m)
}
var xxx_messageInfo_MsgBurn proto.InternalMessageInfo
// MsgBurnResponse defines the Msg/Burn response type.
//
// Since: cosmos-sdk 0.51
type MsgBurnResponse struct {
}
func (m *MsgBurnResponse) Reset() { *m = MsgBurnResponse{} }
func (m *MsgBurnResponse) String() string { return proto.CompactTextString(m) }
func (*MsgBurnResponse) ProtoMessage() {}
func (*MsgBurnResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_1d8cb1613481f5b7, []int{9}
}
func (m *MsgBurnResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgBurnResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgBurnResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgBurnResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgBurnResponse.Merge(m, src)
}
func (m *MsgBurnResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgBurnResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgBurnResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgBurnResponse proto.InternalMessageInfo
func init() {
proto.RegisterType((*MsgSend)(nil), "cosmos.bank.v1beta1.MsgSend")
proto.RegisterType((*MsgSendResponse)(nil), "cosmos.bank.v1beta1.MsgSendResponse")
@ -422,56 +502,61 @@ func init() {
proto.RegisterType((*MsgUpdateParamsResponse)(nil), "cosmos.bank.v1beta1.MsgUpdateParamsResponse")
proto.RegisterType((*MsgSetSendEnabled)(nil), "cosmos.bank.v1beta1.MsgSetSendEnabled")
proto.RegisterType((*MsgSetSendEnabledResponse)(nil), "cosmos.bank.v1beta1.MsgSetSendEnabledResponse")
proto.RegisterType((*MsgBurn)(nil), "cosmos.bank.v1beta1.MsgBurn")
proto.RegisterType((*MsgBurnResponse)(nil), "cosmos.bank.v1beta1.MsgBurnResponse")
}
func init() { proto.RegisterFile("cosmos/bank/v1beta1/tx.proto", fileDescriptor_1d8cb1613481f5b7) }
var fileDescriptor_1d8cb1613481f5b7 = []byte{
// 700 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xcf, 0x4f, 0xd3, 0x50,
0x1c, 0x5f, 0x99, 0x8e, 0xec, 0x31, 0x25, 0x54, 0x22, 0xac, 0x90, 0x0e, 0x16, 0x43, 0x00, 0xa5,
0x15, 0x34, 0x9a, 0xcc, 0x68, 0x74, 0x28, 0x89, 0x26, 0x8b, 0x66, 0xc4, 0x83, 0x5e, 0x96, 0xd7,
0xf5, 0x51, 0x1a, 0xd6, 0xbe, 0xa6, 0xef, 0x95, 0xb0, 0x9b, 0x7a, 0x32, 0x9e, 0x3c, 0x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0xd9, 0x73, 0x43, 0x69, 0x96, 0x76, 0xed, 0x2c,
0xac, 0xa4, 0xc6, 0x3a, 0xb8, 0xd8, 0x31, 0x17, 0x33, 0xbd, 0x63, 0xa7, 0x79, 0x9a, 0x71, 0x36,
0x5e, 0x5c, 0x49, 0x3b, 0xff, 0x8a, 0x4d, 0x79, 0x75, 0x79, 0x77, 0x5f, 0x57, 0xf6, 0xf6, 0x75,
0xe5, 0xf7, 0xbe, 0xae, 0xbc, 0x3f, 0xd0, 0x33, 0x7b, 0x07, 0x7a, 0xe6, 0xc7, 0x81, 0x9e, 0x79,
0x39, 0x77, 0xea, 0x3d, 0x27, 0xc7, 0x9e, 0x5f, 0x77, 0x56, 0x8e, 0x5f, 0xe7, 0x37, 0xfe, 0x05,
0x00, 0x00, 0xff, 0xff, 0x5b, 0x5b, 0x43, 0xa9, 0xa0, 0x06, 0x00, 0x00,
// 746 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0xcf, 0x4f, 0x13, 0x41,
0x18, 0xed, 0xb6, 0x58, 0xd2, 0xa1, 0x4a, 0x58, 0x89, 0xd0, 0x85, 0xb4, 0xd0, 0x18, 0x02, 0x28,
0xbb, 0x16, 0x8d, 0x26, 0x35, 0x1a, 0x2d, 0x4a, 0x22, 0x49, 0xa3, 0x29, 0xf1, 0xa0, 0x97, 0x66,
0xdb, 0x1d, 0x96, 0x0d, 0xdd, 0x9d, 0x66, 0x67, 0x96, 0xd0, 0x9b, 0xf1, 0x64, 0x3c, 0x79, 0xf0,
0xe4, 0x89, 0xa3, 0x31, 0x1e, 0x38, 0x78, 0x34, 0xf1, 0xca, 0xc5, 0x84, 0x78, 0xf2, 0xa4, 0x06,
0x0e, 0xe8, 0x7f, 0x61, 0xe6, 0xc7, 0x0e, 0x4b, 0xe9, 0x52, 0xa2, 0x17, 0x5a, 0xe6, 0xfb, 0xde,
0xfb, 0xbe,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0xaf, 0x19, 0x95,
0xae, 0x36, 0x40, 0xf6, 0x58, 0x0c, 0x63, 0x51, 0xd1, 0x2e, 0xed, 0xea, 0x59, 0xba, 0xe4, 0x8c,
0x75, 0x70, 0xa1, 0x2b, 0x0d, 0x33, 0xf1, 0x16, 0x46, 0xfb, 0x34, 0xfd, 0x6c, 0x7d, 0xe1, 0x24,
0xed, 0xdc, 0x0b, 0x9a, 0xed, 0xca, 0xd2, 0xee, 0x7e, 0x5e, 0xd9, 0xdb, 0xcf, 0x2b, 0xbf, 0xf6,
0xf3, 0xca, 0x9b, 0x83, 0x7c, 0x62, 0xef, 0x20, 0x9f, 0xf8, 0x7e, 0x90, 0x4f, 0x3c, 0x9f, 0x3b,
0xf5, 0xed, 0x2e, 0xc2, 0xce, 0x5e, 0xf2, 0x8d, 0x34, 0xfb, 0x11, 0xbb, 0xfe, 0x37, 0x00, 0x00,
0xff, 0xff, 0xd5, 0xb2, 0x22, 0x88, 0x96, 0x07, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@ -490,6 +575,10 @@ type MsgClient interface {
Send(ctx context.Context, in *MsgSend, opts ...grpc.CallOption) (*MsgSendResponse, error)
// MultiSend defines a method for sending coins from some accounts to other accounts.
MultiSend(ctx context.Context, in *MsgMultiSend, opts ...grpc.CallOption) (*MsgMultiSendResponse, error)
// Burn defines a method for burning coins by an account.
//
// Since: cosmos-sdk 0.51
Burn(ctx context.Context, in *MsgBurn, opts ...grpc.CallOption) (*MsgBurnResponse, error)
// UpdateParams defines a governance operation for updating the x/bank module parameters.
// The authority is defined in the keeper.
//
@ -530,6 +619,15 @@ func (c *msgClient) MultiSend(ctx context.Context, in *MsgMultiSend, opts ...grp
return out, nil
}
func (c *msgClient) Burn(ctx context.Context, in *MsgBurn, opts ...grpc.CallOption) (*MsgBurnResponse, error) {
out := new(MsgBurnResponse)
err := c.cc.Invoke(ctx, "/cosmos.bank.v1beta1.Msg/Burn", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) {
out := new(MsgUpdateParamsResponse)
err := c.cc.Invoke(ctx, "/cosmos.bank.v1beta1.Msg/UpdateParams", in, out, opts...)
@ -554,6 +652,10 @@ type MsgServer interface {
Send(context.Context, *MsgSend) (*MsgSendResponse, error)
// MultiSend defines a method for sending coins from some accounts to other accounts.
MultiSend(context.Context, *MsgMultiSend) (*MsgMultiSendResponse, error)
// Burn defines a method for burning coins by an account.
//
// Since: cosmos-sdk 0.51
Burn(context.Context, *MsgBurn) (*MsgBurnResponse, error)
// UpdateParams defines a governance operation for updating the x/bank module parameters.
// The authority is defined in the keeper.
//
@ -578,6 +680,9 @@ func (*UnimplementedMsgServer) Send(ctx context.Context, req *MsgSend) (*MsgSend
func (*UnimplementedMsgServer) MultiSend(ctx context.Context, req *MsgMultiSend) (*MsgMultiSendResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method MultiSend not implemented")
}
func (*UnimplementedMsgServer) Burn(ctx context.Context, req *MsgBurn) (*MsgBurnResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Burn not implemented")
}
func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
}
@ -625,6 +730,24 @@ func _Msg_MultiSend_Handler(srv interface{}, ctx context.Context, dec func(inter
return interceptor(ctx, in, info, handler)
}
func _Msg_Burn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgBurn)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).Burn(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cosmos.bank.v1beta1.Msg/Burn",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).Burn(ctx, req.(*MsgBurn))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgUpdateParams)
if err := dec(in); err != nil {
@ -673,6 +796,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{
MethodName: "MultiSend",
Handler: _Msg_MultiSend_Handler,
},
{
MethodName: "Burn",
Handler: _Msg_Burn_Handler,
},
{
MethodName: "UpdateParams",
Handler: _Msg_UpdateParams_Handler,
@ -973,6 +1100,73 @@ func (m *MsgSetSendEnabledResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro
return len(dAtA) - i, nil
}
func (m *MsgBurn) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgBurn) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgBurn) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Amount) > 0 {
for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintTx(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
}
if len(m.FromAddress) > 0 {
i -= len(m.FromAddress)
copy(dAtA[i:], m.FromAddress)
i = encodeVarintTx(dAtA, i, uint64(len(m.FromAddress)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgBurnResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgBurnResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgBurnResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func encodeVarintTx(dAtA []byte, offset int, v uint64) int {
offset -= sovTx(v)
base := offset
@ -1104,6 +1298,34 @@ func (m *MsgSetSendEnabledResponse) Size() (n int) {
return n
}
func (m *MsgBurn) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.FromAddress)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
if len(m.Amount) > 0 {
for _, e := range m.Amount {
l = e.Size()
n += 1 + l + sovTx(uint64(l))
}
}
return n
}
func (m *MsgBurnResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func sovTx(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
@ -1839,6 +2061,172 @@ func (m *MsgSetSendEnabledResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *MsgBurn) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgBurn: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgBurn: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field FromAddress", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.FromAddress = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Amount = append(m.Amount, &types.Coin{})
if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgBurnResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgBurnResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgBurnResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipTx(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0

View File

@ -147,7 +147,7 @@ func trackMockBalances(bankKeeper *govtestutil.MockBankKeeper, distributionKeepe
// We don't track module account balances.
bankKeeper.EXPECT().MintCoins(gomock.Any(), mintModuleName, gomock.Any()).AnyTimes()
bankKeeper.EXPECT().BurnCoins(gomock.Any(), types.ModuleName, gomock.Any()).AnyTimes()
bankKeeper.EXPECT().BurnCoins(gomock.Any(), authtypes.NewEmptyModuleAccount(types.ModuleName).GetAddress(), gomock.Any()).AnyTimes()
bankKeeper.EXPECT().SendCoinsFromModuleToModule(gomock.Any(), mintModuleName, types.ModuleName, gomock.Any()).AnyTimes()
// But we do track normal account balances.

View File

@ -43,7 +43,7 @@ func (keeper Keeper) DeleteAndBurnDeposits(ctx context.Context, proposalID uint6
return err
}
return keeper.bankKeeper.BurnCoins(ctx, types.ModuleName, coinsToBurn)
return keeper.bankKeeper.BurnCoins(ctx, keeper.authKeeper.GetModuleAddress(types.ModuleName), coinsToBurn)
}
// IterateDeposits iterates over all the proposals deposits and performs a callback function
@ -192,7 +192,7 @@ func (keeper Keeper) ChargeDeposit(ctx context.Context, proposalID uint64, destA
switch {
case destAddress == "":
// burn the cancellation charges from deposits
err := keeper.bankKeeper.BurnCoins(ctx, types.ModuleName, cancellationCharges)
err := keeper.bankKeeper.BurnCoins(ctx, keeper.authKeeper.GetModuleAddress(types.ModuleName), cancellationCharges)
if err != nil {
return err
}

View File

@ -201,17 +201,17 @@ func (mr *MockBankKeeperMockRecorder) BlockedAddr(addr interface{}) *gomock.Call
}
// BurnCoins mocks base method.
func (m *MockBankKeeper) BurnCoins(ctx context.Context, moduleName string, amt types.Coins) error {
func (m *MockBankKeeper) BurnCoins(ctx context.Context, address []byte, amt types.Coins) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "BurnCoins", ctx, moduleName, amt)
ret := m.ctrl.Call(m, "BurnCoins", ctx, address, amt)
ret0, _ := ret[0].(error)
return ret0
}
// BurnCoins indicates an expected call of BurnCoins.
func (mr *MockBankKeeperMockRecorder) BurnCoins(ctx, moduleName, amt interface{}) *gomock.Call {
func (mr *MockBankKeeperMockRecorder) BurnCoins(ctx, address, amt interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BurnCoins", reflect.TypeOf((*MockBankKeeper)(nil).BurnCoins), ctx, moduleName, amt)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BurnCoins", reflect.TypeOf((*MockBankKeeper)(nil).BurnCoins), ctx, address, amt)
}
// ClearSendRestriction mocks base method.

View File

@ -58,7 +58,7 @@ type BankKeeper interface {
SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error
SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error
BurnCoins(ctx context.Context, name string, amt sdk.Coins) error
BurnCoins(context.Context, []byte, sdk.Coins) error
}
// Event Hooks

View File

@ -126,6 +126,21 @@ func (m *MockBankKeeper) EXPECT() *MockBankKeeperMockRecorder {
return m.recorder
}
// Burn mocks base method.
func (m *MockBankKeeper) Burn(arg0 context.Context, arg1 *types0.MsgBurn) (*types0.MsgBurnResponse, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Burn", arg0, arg1)
ret0, _ := ret[0].(*types0.MsgBurnResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Burn indicates an expected call of Burn.
func (mr *MockBankKeeperMockRecorder) Burn(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Burn", reflect.TypeOf((*MockBankKeeper)(nil).Burn), arg0, arg1)
}
// GetAllBalances mocks base method.
func (m *MockBankKeeper) GetAllBalances(ctx context.Context, addr types.AccAddress) types.Coins {
m.ctrl.T.Helper()

View File

@ -55,7 +55,7 @@ func (k Keeper) burnBondedTokens(ctx context.Context, amt math.Int) error {
coins := sdk.NewCoins(sdk.NewCoin(bondDenom, amt))
return k.bankKeeper.BurnCoins(ctx, types.BondedPoolName, coins)
return k.bankKeeper.BurnCoins(ctx, k.authKeeper.GetModuleAddress(types.BondedPoolName), coins)
}
// burnNotBondedTokens burns coins from the not bonded pool module account
@ -72,7 +72,7 @@ func (k Keeper) burnNotBondedTokens(ctx context.Context, amt math.Int) error {
coins := sdk.NewCoins(sdk.NewCoin(bondDenom, amt))
return k.bankKeeper.BurnCoins(ctx, types.NotBondedPoolName, coins)
return k.bankKeeper.BurnCoins(ctx, k.authKeeper.GetModuleAddress(types.NotBondedPoolName), coins)
}
// TotalBondedTokens total staking tokens supply which is bonded

View File

@ -144,17 +144,17 @@ func (m *MockBankKeeper) EXPECT() *MockBankKeeperMockRecorder {
}
// BurnCoins mocks base method.
func (m *MockBankKeeper) BurnCoins(ctx context.Context, name string, amt types.Coins) error {
func (m *MockBankKeeper) BurnCoins(arg0 context.Context, arg1 []byte, arg2 types.Coins) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "BurnCoins", ctx, name, amt)
ret := m.ctrl.Call(m, "BurnCoins", arg0, arg1, arg2)
ret0, _ := ret[0].(error)
return ret0
}
// BurnCoins indicates an expected call of BurnCoins.
func (mr *MockBankKeeperMockRecorder) BurnCoins(ctx, name, amt interface{}) *gomock.Call {
func (mr *MockBankKeeperMockRecorder) BurnCoins(arg0, arg1, arg2 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BurnCoins", reflect.TypeOf((*MockBankKeeper)(nil).BurnCoins), ctx, name, amt)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BurnCoins", reflect.TypeOf((*MockBankKeeper)(nil).BurnCoins), arg0, arg1, arg2)
}
// DelegateCoinsFromAccountToModule mocks base method.

View File

@ -39,7 +39,7 @@ type BankKeeper interface {
UndelegateCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error
DelegateCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error
BurnCoins(ctx context.Context, name string, amt sdk.Coins) error
BurnCoins(context.Context, []byte, sdk.Coins) error
}
// ValidatorSet expected properties for the set of all validators (noalias)