feat: Add non atomic multimsg (#19350)
This commit is contained in:
@@ -9,11 +9,49 @@ import (
|
||||
reflect "reflect"
|
||||
|
||||
address "cosmossdk.io/core/address"
|
||||
appmodule "cosmossdk.io/core/appmodule"
|
||||
types "cosmossdk.io/x/auth/types"
|
||||
types0 "github.com/cosmos/cosmos-sdk/types"
|
||||
gomock "github.com/golang/mock/gomock"
|
||||
)
|
||||
|
||||
// MockHasEnvironment is a mock of HasEnvironment interface.
|
||||
type MockHasEnvironment struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockHasEnvironmentMockRecorder
|
||||
}
|
||||
|
||||
// MockHasEnvironmentMockRecorder is the mock recorder for MockHasEnvironment.
|
||||
type MockHasEnvironmentMockRecorder struct {
|
||||
mock *MockHasEnvironment
|
||||
}
|
||||
|
||||
// NewMockHasEnvironment creates a new mock instance.
|
||||
func NewMockHasEnvironment(ctrl *gomock.Controller) *MockHasEnvironment {
|
||||
mock := &MockHasEnvironment{ctrl: ctrl}
|
||||
mock.recorder = &MockHasEnvironmentMockRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockHasEnvironment) EXPECT() *MockHasEnvironmentMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// Environment mocks base method.
|
||||
func (m *MockHasEnvironment) Environment() appmodule.Environment {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Environment")
|
||||
ret0, _ := ret[0].(appmodule.Environment)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// Environment indicates an expected call of Environment.
|
||||
func (mr *MockHasEnvironmentMockRecorder) Environment() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Environment", reflect.TypeOf((*MockHasEnvironment)(nil).Environment))
|
||||
}
|
||||
|
||||
// MockAccountKeeper is a mock of AccountKeeper interface.
|
||||
type MockAccountKeeper struct {
|
||||
ctrl *gomock.Controller
|
||||
@@ -51,6 +89,20 @@ func (mr *MockAccountKeeperMockRecorder) AddressCodec() *gomock.Call {
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddressCodec", reflect.TypeOf((*MockAccountKeeper)(nil).AddressCodec))
|
||||
}
|
||||
|
||||
// Environment mocks base method.
|
||||
func (m *MockAccountKeeper) Environment() appmodule.Environment {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Environment")
|
||||
ret0, _ := ret[0].(appmodule.Environment)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// Environment indicates an expected call of Environment.
|
||||
func (mr *MockAccountKeeperMockRecorder) Environment() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Environment", reflect.TypeOf((*MockAccountKeeper)(nil).Environment))
|
||||
}
|
||||
|
||||
// GetAccount mocks base method.
|
||||
func (m *MockAccountKeeper) GetAccount(ctx context.Context, addr types0.AccAddress) types0.AccountI {
|
||||
m.ctrl.T.Helper()
|
||||
|
||||
@@ -51,6 +51,7 @@ type AnteTestSuite struct {
|
||||
txBuilder client.TxBuilder
|
||||
accountKeeper keeper.AccountKeeper
|
||||
bankKeeper *authtestutil.MockBankKeeper
|
||||
acctsModKeeper *authtestutil.MockAccountsModKeeper
|
||||
txBankKeeper *txtestutil.MockBankKeeper
|
||||
feeGrantKeeper *antetestutil.MockFeegrantKeeper
|
||||
encCfg moduletestutil.TestEncodingConfig
|
||||
@@ -60,10 +61,12 @@ type AnteTestSuite struct {
|
||||
func SetupTestSuite(t *testing.T, isCheckTx bool) *AnteTestSuite {
|
||||
t.Helper()
|
||||
suite := &AnteTestSuite{}
|
||||
// gomock initializations
|
||||
ctrl := gomock.NewController(t)
|
||||
suite.bankKeeper = authtestutil.NewMockBankKeeper(ctrl)
|
||||
suite.txBankKeeper = txtestutil.NewMockBankKeeper(ctrl)
|
||||
suite.feeGrantKeeper = antetestutil.NewMockFeegrantKeeper(ctrl)
|
||||
suite.acctsModKeeper = authtestutil.NewMockAccountsModKeeper(ctrl)
|
||||
|
||||
key := storetypes.NewKVStoreKey(types.StoreKey)
|
||||
testCtx := testutil.DefaultContextWithDB(t, key, storetypes.NewTransientStoreKey("transient_test"))
|
||||
@@ -80,8 +83,8 @@ func SetupTestSuite(t *testing.T, isCheckTx bool) *AnteTestSuite {
|
||||
}
|
||||
|
||||
suite.accountKeeper = keeper.NewAccountKeeper(
|
||||
runtime.NewEnvironment(runtime.NewKVStoreService(key), log.NewNopLogger()), suite.encCfg.Codec, types.ProtoBaseAccount, maccPerms, authcodec.NewBech32Codec("cosmos"),
|
||||
sdk.Bech32MainPrefix, types.NewModuleAddress("gov").String(), nil,
|
||||
runtime.NewEnvironment(runtime.NewKVStoreService(key), log.NewNopLogger()), suite.encCfg.Codec, types.ProtoBaseAccount, suite.acctsModKeeper, maccPerms, authcodec.NewBech32Codec("cosmos"),
|
||||
sdk.Bech32MainPrefix, types.NewModuleAddress("gov").String(),
|
||||
)
|
||||
suite.accountKeeper.GetModuleAccount(suite.ctx, types.FeeCollectorName)
|
||||
err := suite.accountKeeper.Params.Set(suite.ctx, types.DefaultParams())
|
||||
|
||||
+6
-6
@@ -27,11 +27,11 @@ func init() {
|
||||
|
||||
type ModuleInputs struct {
|
||||
depinject.In
|
||||
AccountsModKeeper types.AccountsModKeeper
|
||||
|
||||
Config *modulev1.Module
|
||||
Environment appmodule.Environment
|
||||
Cdc codec.Codec
|
||||
Config *modulev1.Module
|
||||
Environment appmodule.Environment
|
||||
Cdc codec.Codec
|
||||
AccountsModKeeper types.AccountsModKeeper
|
||||
|
||||
AddressCodec address.Codec
|
||||
RandomGenesisAccountsFn types.RandomGenesisAccountsFn `optional:"true"`
|
||||
@@ -70,8 +70,8 @@ func ProvideModule(in ModuleInputs) ModuleOutputs {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
k := keeper.NewAccountKeeper(in.Environment, in.Cdc, in.AccountI, maccPerms, in.AddressCodec, in.Config.Bech32Prefix, auth, in.AccountsModKeeper)
|
||||
m := NewAppModule(in.Cdc, k, in.RandomGenesisAccountsFn)
|
||||
k := keeper.NewAccountKeeper(in.Environment, in.Cdc, in.AccountI, in.AccountsModKeeper, maccPerms, in.AddressCodec, in.Config.Bech32Prefix, auth)
|
||||
m := NewAppModule(in.Cdc, k, in.AccountsModKeeper, in.RandomGenesisAccountsFn)
|
||||
|
||||
return ModuleOutputs{AccountKeeper: k, Module: m}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"sync/atomic"
|
||||
"testing"
|
||||
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/stretchr/testify/suite"
|
||||
"pgregory.net/rapid"
|
||||
|
||||
@@ -16,6 +17,7 @@ import (
|
||||
"cosmossdk.io/x/auth"
|
||||
authcodec "cosmossdk.io/x/auth/codec"
|
||||
"cosmossdk.io/x/auth/keeper"
|
||||
authtestutil "cosmossdk.io/x/auth/testutil"
|
||||
"cosmossdk.io/x/auth/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/baseapp"
|
||||
@@ -33,13 +35,14 @@ type DeterministicTestSuite struct {
|
||||
|
||||
accountNumberLanes uint64
|
||||
|
||||
key *storetypes.KVStoreKey
|
||||
environment appmodule.Environment
|
||||
ctx sdk.Context
|
||||
queryClient types.QueryClient
|
||||
accountKeeper keeper.AccountKeeper
|
||||
encCfg moduletestutil.TestEncodingConfig
|
||||
maccPerms map[string][]string
|
||||
key *storetypes.KVStoreKey
|
||||
environment appmodule.Environment
|
||||
ctx sdk.Context
|
||||
queryClient types.QueryClient
|
||||
accountKeeper keeper.AccountKeeper
|
||||
acctsModKeeper *authtestutil.MockAccountsModKeeper
|
||||
encCfg moduletestutil.TestEncodingConfig
|
||||
maccPerms map[string][]string
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -62,6 +65,11 @@ func (suite *DeterministicTestSuite) SetupTest() {
|
||||
testCtx := testutil.DefaultContextWithDB(suite.T(), key, storetypes.NewTransientStoreKey("transient_test"))
|
||||
suite.ctx = testCtx.Ctx.WithHeaderInfo(header.Info{})
|
||||
|
||||
// gomock initializations
|
||||
ctrl := gomock.NewController(suite.T())
|
||||
acctsModKeeper := authtestutil.NewMockAccountsModKeeper(ctrl)
|
||||
suite.acctsModKeeper = acctsModKeeper
|
||||
|
||||
maccPerms := map[string][]string{
|
||||
"fee_collector": nil,
|
||||
"mint": {"minter"},
|
||||
@@ -75,11 +83,11 @@ func (suite *DeterministicTestSuite) SetupTest() {
|
||||
env,
|
||||
suite.encCfg.Codec,
|
||||
types.ProtoBaseAccount,
|
||||
suite.acctsModKeeper,
|
||||
maccPerms,
|
||||
authcodec.NewBech32Codec("cosmos"),
|
||||
"cosmos",
|
||||
types.NewModuleAddress("gov").String(),
|
||||
nil,
|
||||
)
|
||||
|
||||
queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, suite.encCfg.InterfaceRegistry)
|
||||
@@ -296,11 +304,11 @@ func (suite *DeterministicTestSuite) TestGRPCQueryModuleAccounts() {
|
||||
suite.environment,
|
||||
suite.encCfg.Codec,
|
||||
types.ProtoBaseAccount,
|
||||
suite.acctsModKeeper,
|
||||
maccPerms,
|
||||
authcodec.NewBech32Codec("cosmos"),
|
||||
"cosmos",
|
||||
types.NewModuleAddress("gov").String(),
|
||||
nil,
|
||||
)
|
||||
suite.setModuleAccounts(suite.ctx, ak, maccs)
|
||||
|
||||
@@ -344,11 +352,11 @@ func (suite *DeterministicTestSuite) TestGRPCQueryModuleAccountByName() {
|
||||
suite.environment,
|
||||
suite.encCfg.Codec,
|
||||
types.ProtoBaseAccount,
|
||||
suite.acctsModKeeper,
|
||||
maccPerms,
|
||||
authcodec.NewBech32Codec("cosmos"),
|
||||
"cosmos",
|
||||
types.NewModuleAddress("gov").String(),
|
||||
nil,
|
||||
)
|
||||
suite.setModuleAccounts(suite.ctx, ak, []string{mName})
|
||||
|
||||
|
||||
+41
-3
@@ -14,6 +14,7 @@ import (
|
||||
"cosmossdk.io/x/auth/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
@@ -115,8 +116,8 @@ var _ AccountKeeperI = &AccountKeeper{}
|
||||
// and don't have to fit into any predefined structure. This auth module does not use account permissions internally, though other modules
|
||||
// may use auth.Keeper to access the accounts permissions map.
|
||||
func NewAccountKeeper(
|
||||
env appmodule.Environment, cdc codec.BinaryCodec, proto func() sdk.AccountI,
|
||||
maccPerms map[string][]string, ac address.Codec, bech32Prefix, authority string, accountsModKeeper types.AccountsModKeeper,
|
||||
env appmodule.Environment, cdc codec.BinaryCodec, proto func() sdk.AccountI, accountsModKeeper types.AccountsModKeeper,
|
||||
maccPerms map[string][]string, ac address.Codec, bech32Prefix, authority string,
|
||||
) AccountKeeper {
|
||||
permAddrs := make(map[string]types.PermissionsForAddress)
|
||||
for name, perms := range maccPerms {
|
||||
@@ -131,12 +132,12 @@ func NewAccountKeeper(
|
||||
environment: env,
|
||||
proto: proto,
|
||||
cdc: cdc,
|
||||
AccountsModKeeper: accountsModKeeper,
|
||||
permAddrs: permAddrs,
|
||||
authority: authority,
|
||||
Params: collections.NewItem(sb, types.ParamsKey, "params", codec.CollValue[types.Params](cdc)),
|
||||
AccountNumber: collections.NewSequence(sb, types.GlobalAccountNumberKey, "account_number"),
|
||||
Accounts: collections.NewIndexedMap(sb, types.AddressStoreKeyPrefix, "accounts", sdk.AccAddressKey, codec.CollInterfaceValue[sdk.AccountI](cdc), NewAccountIndexes(sb)),
|
||||
AccountsModKeeper: accountsModKeeper,
|
||||
}
|
||||
schema, err := sb.Build()
|
||||
if err != nil {
|
||||
@@ -281,6 +282,43 @@ func (ak AccountKeeper) GetParams(ctx context.Context) (params types.Params) {
|
||||
return params
|
||||
}
|
||||
|
||||
func (ak AccountKeeper) NonAtomicMsgsExec(ctx context.Context, signer sdk.AccAddress, msgs []sdk.Msg) ([]*types.NonAtomicExecResult, error) {
|
||||
msgResponses := make([]*types.NonAtomicExecResult, 0, len(msgs))
|
||||
|
||||
for _, msg := range msgs {
|
||||
if m, ok := msg.(sdk.HasValidateBasic); ok {
|
||||
if err := m.ValidateBasic(); err != nil {
|
||||
value := &types.NonAtomicExecResult{Error: err.Error()}
|
||||
msgResponses = append(msgResponses, value)
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
if err := ak.environment.BranchService.Execute(ctx, func(ctx context.Context) error {
|
||||
result, err := ak.AccountsModKeeper.SendModuleMessageUntyped(ctx, signer, msg)
|
||||
if err != nil {
|
||||
// If an error occurs during message execution, append error response
|
||||
response := &types.NonAtomicExecResult{Resp: nil, Error: err.Error()}
|
||||
msgResponses = append(msgResponses, response)
|
||||
} else {
|
||||
resp, err := codectypes.NewAnyWithValue(result)
|
||||
if err != nil {
|
||||
response := &types.NonAtomicExecResult{Resp: nil, Error: err.Error()}
|
||||
msgResponses = append(msgResponses, response)
|
||||
}
|
||||
response := &types.NonAtomicExecResult{Resp: resp, Error: ""}
|
||||
msgResponses = append(msgResponses, response)
|
||||
}
|
||||
|
||||
return nil
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return msgResponses, nil
|
||||
}
|
||||
|
||||
// Environment returns the module's environment.
|
||||
func (ak AccountKeeper) Environment() appmodule.Environment {
|
||||
return ak.environment
|
||||
|
||||
@@ -3,6 +3,7 @@ package keeper_test
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
@@ -12,6 +13,7 @@ import (
|
||||
"cosmossdk.io/x/auth"
|
||||
authcodec "cosmossdk.io/x/auth/codec"
|
||||
"cosmossdk.io/x/auth/keeper"
|
||||
authtestutil "cosmossdk.io/x/auth/testutil"
|
||||
"cosmossdk.io/x/auth/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/baseapp"
|
||||
@@ -40,10 +42,11 @@ type KeeperTestSuite struct {
|
||||
|
||||
ctx sdk.Context
|
||||
|
||||
queryClient types.QueryClient
|
||||
accountKeeper keeper.AccountKeeper
|
||||
msgServer types.MsgServer
|
||||
encCfg moduletestutil.TestEncodingConfig
|
||||
queryClient types.QueryClient
|
||||
accountKeeper keeper.AccountKeeper
|
||||
acctsModKeeper *authtestutil.MockAccountsModKeeper
|
||||
msgServer types.MsgServer
|
||||
encCfg moduletestutil.TestEncodingConfig
|
||||
}
|
||||
|
||||
func (suite *KeeperTestSuite) SetupTest() {
|
||||
@@ -55,6 +58,11 @@ func (suite *KeeperTestSuite) SetupTest() {
|
||||
testCtx := testutil.DefaultContextWithDB(suite.T(), key, storetypes.NewTransientStoreKey("transient_test"))
|
||||
suite.ctx = testCtx.Ctx.WithHeaderInfo(header.Info{})
|
||||
|
||||
// gomock initializations
|
||||
ctrl := gomock.NewController(suite.T())
|
||||
acctsModKeeper := authtestutil.NewMockAccountsModKeeper(ctrl)
|
||||
suite.acctsModKeeper = acctsModKeeper
|
||||
|
||||
maccPerms := map[string][]string{
|
||||
"fee_collector": nil,
|
||||
"mint": {"minter"},
|
||||
@@ -68,11 +76,11 @@ func (suite *KeeperTestSuite) SetupTest() {
|
||||
env,
|
||||
suite.encCfg.Codec,
|
||||
types.ProtoBaseAccount,
|
||||
acctsModKeeper,
|
||||
maccPerms,
|
||||
authcodec.NewBech32Codec("cosmos"),
|
||||
"cosmos",
|
||||
types.NewModuleAddress("gov").String(),
|
||||
nil,
|
||||
)
|
||||
suite.msgServer = keeper.NewMsgServerImpl(suite.accountKeeper)
|
||||
queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, suite.encCfg.InterfaceRegistry)
|
||||
|
||||
@@ -2,9 +2,12 @@ package keeper
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"cosmossdk.io/x/auth/types"
|
||||
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
)
|
||||
|
||||
var _ types.MsgServer = msgServer{}
|
||||
@@ -20,6 +23,35 @@ func NewMsgServerImpl(ak AccountKeeper) types.MsgServer {
|
||||
}
|
||||
}
|
||||
|
||||
func (ms msgServer) NonAtomicExec(goCtx context.Context, msg *types.MsgNonAtomicExec) (*types.MsgNonAtomicExecResponse, error) {
|
||||
if msg.Signer == "" {
|
||||
return nil, errors.New("empty signer address string is not allowed")
|
||||
}
|
||||
|
||||
signer, err := ms.ak.AddressCodec().StringToBytes(msg.Signer)
|
||||
if err != nil {
|
||||
return nil, sdkerrors.ErrInvalidAddress.Wrapf("invalid signer address: %s", err)
|
||||
}
|
||||
|
||||
if len(msg.Msgs) == 0 {
|
||||
return nil, sdkerrors.ErrInvalidRequest.Wrapf("messages cannot be empty")
|
||||
}
|
||||
|
||||
msgs, err := msg.GetMessages()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
results, err := ms.ak.NonAtomicMsgsExec(goCtx, signer, msgs)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &types.MsgNonAtomicExecResponse{
|
||||
Results: results,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (ms msgServer) UpdateParams(ctx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) {
|
||||
if ms.ak.authority != msg.Authority {
|
||||
return nil, fmt.Errorf(
|
||||
|
||||
+3
-1
@@ -40,6 +40,7 @@ var (
|
||||
type AppModule struct {
|
||||
accountKeeper keeper.AccountKeeper
|
||||
randGenAccountsFn types.RandomGenesisAccountsFn
|
||||
accountsModKeeper types.AccountsModKeeper
|
||||
cdc codec.Codec
|
||||
}
|
||||
|
||||
@@ -47,10 +48,11 @@ type AppModule struct {
|
||||
func (am AppModule) IsAppModule() {}
|
||||
|
||||
// NewAppModule creates a new AppModule object
|
||||
func NewAppModule(cdc codec.Codec, accountKeeper keeper.AccountKeeper, randGenAccountsFn types.RandomGenesisAccountsFn) AppModule {
|
||||
func NewAppModule(cdc codec.Codec, accountKeeper keeper.AccountKeeper, ak types.AccountsModKeeper, randGenAccountsFn types.RandomGenesisAccountsFn) AppModule {
|
||||
return AppModule{
|
||||
accountKeeper: accountKeeper,
|
||||
randGenAccountsFn: randGenAccountsFn,
|
||||
accountsModKeeper: ak,
|
||||
cdc: cdc,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ syntax = "proto3";
|
||||
package cosmos.auth.v1beta1;
|
||||
|
||||
import "gogoproto/gogo.proto";
|
||||
import "google/protobuf/any.proto";
|
||||
import "cosmos_proto/cosmos.proto";
|
||||
import "cosmos/msg/v1/msg.proto";
|
||||
import "amino/amino.proto";
|
||||
@@ -18,6 +19,9 @@ service Msg {
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
|
||||
|
||||
// NonAtomicExec allows users to submit multiple messages for non-atomic execution.
|
||||
rpc NonAtomicExec(MsgNonAtomicExec) returns (MsgNonAtomicExecResponse);
|
||||
}
|
||||
|
||||
// MsgUpdateParams is the Msg/UpdateParams request type.
|
||||
@@ -41,3 +45,23 @@ message MsgUpdateParams {
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
message MsgUpdateParamsResponse {}
|
||||
|
||||
// MsgNonAtomicExec defines the Msg/NonAtomicExec request type.
|
||||
message MsgNonAtomicExec {
|
||||
option (cosmos.msg.v1.signer) = "signer";
|
||||
|
||||
string signer = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
repeated google.protobuf.Any msgs = 2 [(cosmos_proto.accepts_interface) = "cosmos.base.v1beta1.Msg"];
|
||||
}
|
||||
|
||||
// NonAtomicExecResult defines the response structure for executing a
|
||||
// MsgNonAtomicExec.
|
||||
message NonAtomicExecResult {
|
||||
string error = 1;
|
||||
google.protobuf.Any resp = 2;
|
||||
}
|
||||
|
||||
// MsgNonAtomicExecResponse defines the response of MsgNonAtomicExec.
|
||||
message MsgNonAtomicExecResponse {
|
||||
repeated NonAtomicExecResult results = 1;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package testutil
|
||||
import (
|
||||
_ "cosmossdk.io/x/accounts" // import as blank for app wiring
|
||||
_ "cosmossdk.io/x/auth" // import as blank for app wiring
|
||||
_ "cosmossdk.io/x/auth/tx/config" // import as blank for app wiring
|
||||
_ "cosmossdk.io/x/auth/tx/config" // import as blank for app wiring``
|
||||
_ "cosmossdk.io/x/auth/vesting" // import as blank for app wiring
|
||||
_ "cosmossdk.io/x/bank" // import as blank for app wiring
|
||||
_ "cosmossdk.io/x/staking" // import as blank for app wiring
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
|
||||
types "github.com/cosmos/cosmos-sdk/types"
|
||||
gomock "github.com/golang/mock/gomock"
|
||||
protoiface "google.golang.org/protobuf/runtime/protoiface"
|
||||
)
|
||||
|
||||
// MockBankKeeper is a mock of BankKeeper interface.
|
||||
@@ -82,7 +83,6 @@ func (mr *MockBankKeeperMockRecorder) SendCoinsFromAccountToModule(ctx, senderAd
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromAccountToModule", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromAccountToModule), ctx, senderAddr, recipientModule, amt)
|
||||
}
|
||||
|
||||
|
||||
// MockAccountsModKeeper is a mock of AccountsModKeeper interface.
|
||||
type MockAccountsModKeeper struct {
|
||||
ctrl *gomock.Controller
|
||||
@@ -107,17 +107,30 @@ func (m *MockAccountsModKeeper) EXPECT() *MockAccountsModKeeperMockRecorder {
|
||||
}
|
||||
|
||||
// IsAccountsModuleAccount mocks base method.
|
||||
func (m *MockAccountsModKeeper) IsAccountsModuleAccount(ctx context.Context, addr []byte) bool {
|
||||
func (m *MockAccountsModKeeper) IsAccountsModuleAccount(ctx context.Context, accountAddr []byte) bool {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "IsAccountsModuleAccount", ctx, addr)
|
||||
ret := m.ctrl.Call(m, "IsAccountsModuleAccount", ctx, accountAddr)
|
||||
ret0, _ := ret[0].(bool)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// IsAccountsModuleAccount indicates an expected call of IsAccountsModuleAccount.
|
||||
func (mr *MockAccountsModKeeperMockRecorder) IsAccountsModuleAccount(ctx, addr interface{}) *gomock.Call {
|
||||
func (mr *MockAccountsModKeeperMockRecorder) IsAccountsModuleAccount(ctx, accountAddr interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsAccountsModuleAccount", reflect.TypeOf((*MockAccountsModKeeper)(nil).IsAccountsModuleAccount), ctx, addr)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsAccountsModuleAccount", reflect.TypeOf((*MockAccountsModKeeper)(nil).IsAccountsModuleAccount), ctx, accountAddr)
|
||||
}
|
||||
|
||||
// SendModuleMessageUntyped mocks base method.
|
||||
func (m *MockAccountsModKeeper) SendModuleMessageUntyped(ctx context.Context, sender []byte, msg protoiface.MessageV1) (protoiface.MessageV1, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "SendModuleMessageUntyped", ctx, sender, msg)
|
||||
ret0, _ := ret[0].(protoiface.MessageV1)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// SendModuleMessageUntyped indicates an expected call of SendModuleMessageUntyped.
|
||||
func (mr *MockAccountsModKeeperMockRecorder) SendModuleMessageUntyped(ctx, sender, msg interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendModuleMessageUntyped", reflect.TypeOf((*MockAccountsModKeeper)(nil).SendModuleMessageUntyped), ctx, sender, msg)
|
||||
}
|
||||
|
||||
@@ -58,5 +58,6 @@ func RegisterInterfaces(registrar registry.InterfaceRegistrar) {
|
||||
|
||||
registrar.RegisterImplementations((*sdk.Msg)(nil),
|
||||
&MsgUpdateParams{},
|
||||
&MsgNonAtomicExec{},
|
||||
)
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ package types
|
||||
import (
|
||||
"context"
|
||||
|
||||
"google.golang.org/protobuf/runtime/protoiface"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
@@ -15,5 +17,6 @@ type BankKeeper interface {
|
||||
|
||||
// AccountsModKeeper defines the contract for x/accounts APIs
|
||||
type AccountsModKeeper interface {
|
||||
SendModuleMessageUntyped(ctx context.Context, sender []byte, msg protoiface.MessageV1) (protoiface.MessageV1, error)
|
||||
IsAccountsModuleAccount(ctx context.Context, accountAddr []byte) bool
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
)
|
||||
|
||||
// GetMessages returns the cache values from the MsgNonAtomicExec.Msgs if present.
|
||||
func (msg MsgNonAtomicExec) GetMessages() ([]sdk.Msg, error) {
|
||||
msgs := make([]sdk.Msg, len(msg.Msgs))
|
||||
for i, msgAny := range msg.Msgs {
|
||||
msg, ok := msgAny.GetCachedValue().(sdk.Msg)
|
||||
if !ok {
|
||||
return nil, sdkerrors.ErrInvalidRequest.Wrapf("messages contains %T which is not a sdk.Msg", msgAny)
|
||||
}
|
||||
msgs[i] = msg
|
||||
}
|
||||
|
||||
return msgs, nil
|
||||
}
|
||||
+720
-22
@@ -7,6 +7,7 @@ import (
|
||||
context "context"
|
||||
fmt "fmt"
|
||||
_ "github.com/cosmos/cosmos-proto"
|
||||
types "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
_ "github.com/cosmos/cosmos-sdk/types/msgservice"
|
||||
_ "github.com/cosmos/cosmos-sdk/types/tx/amino"
|
||||
_ "github.com/cosmos/gogoproto/gogoproto"
|
||||
@@ -130,36 +131,203 @@ func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() {
|
||||
|
||||
var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo
|
||||
|
||||
// MsgNonAtomicExec defines the Msg/NonAtomicExec request type.
|
||||
type MsgNonAtomicExec struct {
|
||||
Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"`
|
||||
Msgs []*types.Any `protobuf:"bytes,2,rep,name=msgs,proto3" json:"msgs,omitempty"`
|
||||
}
|
||||
|
||||
func (m *MsgNonAtomicExec) Reset() { *m = MsgNonAtomicExec{} }
|
||||
func (m *MsgNonAtomicExec) String() string { return proto.CompactTextString(m) }
|
||||
func (*MsgNonAtomicExec) ProtoMessage() {}
|
||||
func (*MsgNonAtomicExec) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_c2d62bd9c4c212e5, []int{2}
|
||||
}
|
||||
func (m *MsgNonAtomicExec) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *MsgNonAtomicExec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_MsgNonAtomicExec.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 *MsgNonAtomicExec) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_MsgNonAtomicExec.Merge(m, src)
|
||||
}
|
||||
func (m *MsgNonAtomicExec) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *MsgNonAtomicExec) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_MsgNonAtomicExec.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_MsgNonAtomicExec proto.InternalMessageInfo
|
||||
|
||||
func (m *MsgNonAtomicExec) GetSigner() string {
|
||||
if m != nil {
|
||||
return m.Signer
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *MsgNonAtomicExec) GetMsgs() []*types.Any {
|
||||
if m != nil {
|
||||
return m.Msgs
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// NonAtomicExecResult defines the response structure for executing a
|
||||
// MsgNonAtomicExec.
|
||||
type NonAtomicExecResult struct {
|
||||
Error string `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"`
|
||||
Resp *types.Any `protobuf:"bytes,2,opt,name=resp,proto3" json:"resp,omitempty"`
|
||||
}
|
||||
|
||||
func (m *NonAtomicExecResult) Reset() { *m = NonAtomicExecResult{} }
|
||||
func (m *NonAtomicExecResult) String() string { return proto.CompactTextString(m) }
|
||||
func (*NonAtomicExecResult) ProtoMessage() {}
|
||||
func (*NonAtomicExecResult) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_c2d62bd9c4c212e5, []int{3}
|
||||
}
|
||||
func (m *NonAtomicExecResult) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *NonAtomicExecResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_NonAtomicExecResult.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 *NonAtomicExecResult) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_NonAtomicExecResult.Merge(m, src)
|
||||
}
|
||||
func (m *NonAtomicExecResult) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *NonAtomicExecResult) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_NonAtomicExecResult.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_NonAtomicExecResult proto.InternalMessageInfo
|
||||
|
||||
func (m *NonAtomicExecResult) GetError() string {
|
||||
if m != nil {
|
||||
return m.Error
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *NonAtomicExecResult) GetResp() *types.Any {
|
||||
if m != nil {
|
||||
return m.Resp
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// MsgNonAtomicExecResponse defines the response of MsgNonAtomicExec.
|
||||
type MsgNonAtomicExecResponse struct {
|
||||
Results []*NonAtomicExecResult `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"`
|
||||
}
|
||||
|
||||
func (m *MsgNonAtomicExecResponse) Reset() { *m = MsgNonAtomicExecResponse{} }
|
||||
func (m *MsgNonAtomicExecResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*MsgNonAtomicExecResponse) ProtoMessage() {}
|
||||
func (*MsgNonAtomicExecResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_c2d62bd9c4c212e5, []int{4}
|
||||
}
|
||||
func (m *MsgNonAtomicExecResponse) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *MsgNonAtomicExecResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_MsgNonAtomicExecResponse.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 *MsgNonAtomicExecResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_MsgNonAtomicExecResponse.Merge(m, src)
|
||||
}
|
||||
func (m *MsgNonAtomicExecResponse) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *MsgNonAtomicExecResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_MsgNonAtomicExecResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_MsgNonAtomicExecResponse proto.InternalMessageInfo
|
||||
|
||||
func (m *MsgNonAtomicExecResponse) GetResults() []*NonAtomicExecResult {
|
||||
if m != nil {
|
||||
return m.Results
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*MsgUpdateParams)(nil), "cosmos.auth.v1beta1.MsgUpdateParams")
|
||||
proto.RegisterType((*MsgUpdateParamsResponse)(nil), "cosmos.auth.v1beta1.MsgUpdateParamsResponse")
|
||||
proto.RegisterType((*MsgNonAtomicExec)(nil), "cosmos.auth.v1beta1.MsgNonAtomicExec")
|
||||
proto.RegisterType((*NonAtomicExecResult)(nil), "cosmos.auth.v1beta1.NonAtomicExecResult")
|
||||
proto.RegisterType((*MsgNonAtomicExecResponse)(nil), "cosmos.auth.v1beta1.MsgNonAtomicExecResponse")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("cosmos/auth/v1beta1/tx.proto", fileDescriptor_c2d62bd9c4c212e5) }
|
||||
|
||||
var fileDescriptor_c2d62bd9c4c212e5 = []byte{
|
||||
// 336 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x49, 0xce, 0x2f, 0xce,
|
||||
0xcd, 0x2f, 0xd6, 0x4f, 0x2c, 0x2d, 0xc9, 0xd0, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4,
|
||||
0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x86, 0xc8, 0xea, 0x81, 0x64, 0xf5,
|
||||
0xa0, 0xb2, 0x52, 0x22, 0xe9, 0xf9, 0xe9, 0xf9, 0x60, 0x79, 0x7d, 0x10, 0x0b, 0xa2, 0x54, 0x4a,
|
||||
0x12, 0xa2, 0x34, 0x1e, 0x22, 0x01, 0xd5, 0x07, 0x91, 0x12, 0x87, 0xda, 0x91, 0x5b, 0x9c, 0xae,
|
||||
0x5f, 0x66, 0x08, 0xa2, 0xa0, 0x12, 0x82, 0x89, 0xb9, 0x99, 0x79, 0xf9, 0xfa, 0x60, 0x12, 0x2a,
|
||||
0x24, 0x87, 0xcd, 0x3d, 0x60, 0xeb, 0xc1, 0xf2, 0x4a, 0xfb, 0x19, 0xb9, 0xf8, 0x7d, 0x8b, 0xd3,
|
||||
0x43, 0x0b, 0x52, 0x12, 0x4b, 0x52, 0x03, 0x12, 0x8b, 0x12, 0x73, 0x8b, 0x85, 0xcc, 0xb8, 0x38,
|
||||
0x41, 0x2a, 0xf2, 0x8b, 0x32, 0x4b, 0x2a, 0x25, 0x18, 0x15, 0x18, 0x35, 0x38, 0x9d, 0x24, 0x2e,
|
||||
0x6d, 0xd1, 0x15, 0x81, 0x3a, 0xc2, 0x31, 0x25, 0xa5, 0x28, 0xb5, 0xb8, 0x38, 0xb8, 0xa4, 0x28,
|
||||
0x33, 0x2f, 0x3d, 0x08, 0xa1, 0x54, 0xc8, 0x8e, 0x8b, 0xad, 0x00, 0x6c, 0x82, 0x04, 0x93, 0x02,
|
||||
0xa3, 0x06, 0xb7, 0x91, 0xb4, 0x1e, 0x16, 0xef, 0xea, 0x41, 0x2c, 0x71, 0xe2, 0x3c, 0x71, 0x4f,
|
||||
0x9e, 0x61, 0xc5, 0xf3, 0x0d, 0x5a, 0x8c, 0x41, 0x50, 0x5d, 0x56, 0x26, 0x4d, 0xcf, 0x37, 0x68,
|
||||
0x21, 0xcc, 0xeb, 0x7a, 0xbe, 0x41, 0x4b, 0x11, 0x62, 0x82, 0x6e, 0x71, 0x4a, 0xb6, 0x7e, 0x05,
|
||||
0xc4, 0x13, 0x68, 0xae, 0x55, 0x92, 0xe4, 0x12, 0x47, 0x13, 0x0a, 0x4a, 0x2d, 0x2e, 0xc8, 0xcf,
|
||||
0x2b, 0x4e, 0x35, 0x2a, 0xe0, 0x62, 0xf6, 0x2d, 0x4e, 0x17, 0x4a, 0xe2, 0xe2, 0x41, 0xf1, 0x9f,
|
||||
0x0a, 0x56, 0x77, 0xa1, 0x19, 0x22, 0xa5, 0x43, 0x8c, 0x2a, 0x98, 0x55, 0x52, 0xac, 0x0d, 0x20,
|
||||
0xaf, 0x38, 0x19, 0x9f, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c,
|
||||
0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x14, 0x34, 0x3e,
|
||||
0x8b, 0x53, 0xb2, 0xf5, 0x32, 0xf3, 0x61, 0x7e, 0x29, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03,
|
||||
0x47, 0x85, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0xf0, 0x09, 0xbc, 0x34, 0x3c, 0x02, 0x00, 0x00,
|
||||
// 520 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x31, 0x6f, 0xd3, 0x40,
|
||||
0x18, 0xcd, 0xd1, 0x36, 0x28, 0x17, 0x10, 0xe0, 0x46, 0x6a, 0x9a, 0x22, 0x53, 0x22, 0x90, 0xa2,
|
||||
0x88, 0x9c, 0x49, 0x8a, 0x18, 0x3a, 0x20, 0xc5, 0x52, 0xc7, 0x20, 0x64, 0xd4, 0x85, 0x01, 0x64,
|
||||
0xc7, 0xc7, 0x61, 0xb5, 0xf6, 0x59, 0xf7, 0x5d, 0xaa, 0x64, 0x43, 0x8c, 0x4c, 0x8c, 0xfc, 0x04,
|
||||
0xc6, 0x0c, 0xdd, 0x59, 0x2b, 0xa6, 0x8a, 0x05, 0x26, 0x84, 0x92, 0x21, 0x7f, 0x03, 0xf9, 0xee,
|
||||
0xdc, 0x2a, 0x91, 0x51, 0xbb, 0xd8, 0xbe, 0x7b, 0xef, 0xfb, 0xbe, 0xf7, 0xee, 0x9d, 0xf1, 0xfd,
|
||||
0x21, 0x87, 0x98, 0x83, 0xe3, 0x8f, 0xe4, 0x07, 0xe7, 0xa4, 0x1b, 0x50, 0xe9, 0x77, 0x1d, 0x39,
|
||||
0x26, 0xa9, 0xe0, 0x92, 0x5b, 0x9b, 0x1a, 0x25, 0x19, 0x4a, 0x0c, 0xda, 0xa8, 0x31, 0xce, 0xb8,
|
||||
0xc2, 0x9d, 0xec, 0x4b, 0x53, 0x1b, 0xdb, 0x8c, 0x73, 0x76, 0x4c, 0x1d, 0xb5, 0x0a, 0x46, 0xef,
|
||||
0x1d, 0x3f, 0x99, 0xe4, 0x90, 0xee, 0xf2, 0x4e, 0xd7, 0x98, 0x96, 0x1a, 0xda, 0x32, 0xe3, 0x63,
|
||||
0x60, 0xce, 0x49, 0x37, 0x7b, 0x19, 0xe0, 0x9e, 0x1f, 0x47, 0x09, 0x77, 0xd4, 0xd3, 0x6c, 0xd9,
|
||||
0x45, 0x52, 0x95, 0x32, 0x85, 0x37, 0xbf, 0x23, 0x7c, 0x67, 0x00, 0xec, 0x30, 0x0d, 0x7d, 0x49,
|
||||
0x5f, 0xf9, 0xc2, 0x8f, 0xc1, 0x7a, 0x8e, 0x2b, 0x19, 0x83, 0x8b, 0x48, 0x4e, 0xea, 0x68, 0x17,
|
||||
0xb5, 0x2a, 0x6e, 0xfd, 0xe7, 0x69, 0xa7, 0x66, 0x44, 0xf4, 0xc3, 0x50, 0x50, 0x80, 0xd7, 0x52,
|
||||
0x44, 0x09, 0xf3, 0x2e, 0xa9, 0xd6, 0x0b, 0x5c, 0x4e, 0x55, 0x87, 0xfa, 0x8d, 0x5d, 0xd4, 0xaa,
|
||||
0xf6, 0x76, 0x48, 0xc1, 0x49, 0x10, 0x3d, 0xc4, 0xad, 0x9c, 0xfd, 0x79, 0x50, 0xfa, 0xb6, 0x98,
|
||||
0xb6, 0x91, 0x67, 0xaa, 0xf6, 0x9f, 0x7d, 0x5a, 0x4c, 0xdb, 0x97, 0xfd, 0x3e, 0x2f, 0xa6, 0xed,
|
||||
0x87, 0xba, 0x43, 0x07, 0xc2, 0x23, 0x67, 0xac, 0x4d, 0xac, 0xa8, 0x6d, 0x6e, 0xe3, 0xad, 0x95,
|
||||
0x2d, 0x8f, 0x42, 0xca, 0x13, 0xa0, 0xcd, 0xaf, 0x08, 0xdf, 0x1d, 0x00, 0x7b, 0xc9, 0x93, 0xbe,
|
||||
0xe4, 0x71, 0x34, 0x3c, 0x18, 0xd3, 0xa1, 0xf5, 0x14, 0x97, 0x21, 0x62, 0x09, 0x15, 0x57, 0x5a,
|
||||
0x33, 0x3c, 0xeb, 0x00, 0xaf, 0xc7, 0xc0, 0x32, 0x57, 0x6b, 0xad, 0x6a, 0xaf, 0x46, 0x74, 0x68,
|
||||
0x24, 0x0f, 0x8d, 0xf4, 0x93, 0x89, 0xbb, 0xf3, 0xe3, 0xb4, 0x63, 0x72, 0x21, 0x81, 0x0f, 0xf4,
|
||||
0xc2, 0xee, 0x00, 0x98, 0xa7, 0xca, 0xf7, 0xab, 0x99, 0x3d, 0xd3, 0xb3, 0x79, 0x88, 0x37, 0x97,
|
||||
0x64, 0x79, 0x14, 0x46, 0xc7, 0xd2, 0xaa, 0xe1, 0x0d, 0x2a, 0x04, 0x37, 0xda, 0x3c, 0xbd, 0xb0,
|
||||
0x5a, 0x78, 0x5d, 0x50, 0x48, 0xcd, 0xb1, 0x16, 0x0a, 0xf0, 0x14, 0xa3, 0xf9, 0x16, 0xd7, 0x57,
|
||||
0x0d, 0xe7, 0xa7, 0x61, 0xb9, 0xf8, 0xa6, 0x50, 0x53, 0xa0, 0x8e, 0x94, 0x93, 0x56, 0x61, 0x3e,
|
||||
0x05, 0xb2, 0xbc, 0xbc, 0xb0, 0xf7, 0x0b, 0xe1, 0xb5, 0x01, 0x30, 0x2b, 0xc0, 0xb7, 0x96, 0xae,
|
||||
0xcc, 0xa3, 0xc2, 0x56, 0x2b, 0xb9, 0x34, 0x9e, 0x5c, 0x87, 0x75, 0xa1, 0x97, 0xe2, 0xdb, 0xcb,
|
||||
0xc9, 0x3d, 0xfe, 0x5f, 0xf9, 0x12, 0xad, 0xd1, 0xb9, 0x16, 0x2d, 0x1f, 0xd3, 0xd8, 0xf8, 0x98,
|
||||
0x5d, 0x42, 0x77, 0xef, 0x6c, 0x66, 0xa3, 0xf3, 0x99, 0x8d, 0xfe, 0xce, 0x6c, 0xf4, 0x65, 0x6e,
|
||||
0x97, 0xce, 0xe7, 0x76, 0xe9, 0xf7, 0xdc, 0x2e, 0xbd, 0x31, 0x7f, 0x22, 0x84, 0x47, 0x24, 0xe2,
|
||||
0xf9, 0x2d, 0x94, 0x93, 0x94, 0x42, 0x50, 0x56, 0x11, 0xec, 0xfd, 0x0b, 0x00, 0x00, 0xff, 0xff,
|
||||
0xa1, 0x5a, 0xf2, 0x18, 0x11, 0x04, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
@@ -179,6 +347,8 @@ type MsgClient interface {
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error)
|
||||
// NonAtomicExec allows users to submit multiple messages for non-atomic execution.
|
||||
NonAtomicExec(ctx context.Context, in *MsgNonAtomicExec, opts ...grpc.CallOption) (*MsgNonAtomicExecResponse, error)
|
||||
}
|
||||
|
||||
type msgClient struct {
|
||||
@@ -198,6 +368,15 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *msgClient) NonAtomicExec(ctx context.Context, in *MsgNonAtomicExec, opts ...grpc.CallOption) (*MsgNonAtomicExecResponse, error) {
|
||||
out := new(MsgNonAtomicExecResponse)
|
||||
err := c.cc.Invoke(ctx, "/cosmos.auth.v1beta1.Msg/NonAtomicExec", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// MsgServer is the server API for Msg service.
|
||||
type MsgServer interface {
|
||||
// UpdateParams defines a (governance) operation for updating the x/auth module
|
||||
@@ -205,6 +384,8 @@ type MsgServer interface {
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
|
||||
// NonAtomicExec allows users to submit multiple messages for non-atomic execution.
|
||||
NonAtomicExec(context.Context, *MsgNonAtomicExec) (*MsgNonAtomicExecResponse, error)
|
||||
}
|
||||
|
||||
// UnimplementedMsgServer can be embedded to have forward compatible implementations.
|
||||
@@ -214,6 +395,9 @@ type UnimplementedMsgServer struct {
|
||||
func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
|
||||
}
|
||||
func (*UnimplementedMsgServer) NonAtomicExec(ctx context.Context, req *MsgNonAtomicExec) (*MsgNonAtomicExecResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method NonAtomicExec not implemented")
|
||||
}
|
||||
|
||||
func RegisterMsgServer(s grpc1.Server, srv MsgServer) {
|
||||
s.RegisterService(&_Msg_serviceDesc, srv)
|
||||
@@ -237,6 +421,24 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Msg_NonAtomicExec_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(MsgNonAtomicExec)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MsgServer).NonAtomicExec(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/cosmos.auth.v1beta1.Msg/NonAtomicExec",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MsgServer).NonAtomicExec(ctx, req.(*MsgNonAtomicExec))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _Msg_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "cosmos.auth.v1beta1.Msg",
|
||||
HandlerType: (*MsgServer)(nil),
|
||||
@@ -245,6 +447,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{
|
||||
MethodName: "UpdateParams",
|
||||
Handler: _Msg_UpdateParams_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "NonAtomicExec",
|
||||
Handler: _Msg_NonAtomicExec_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "cosmos/auth/v1beta1/tx.proto",
|
||||
@@ -313,6 +519,129 @@ func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *MsgNonAtomicExec) 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 *MsgNonAtomicExec) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *MsgNonAtomicExec) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Msgs) > 0 {
|
||||
for iNdEx := len(m.Msgs) - 1; iNdEx >= 0; iNdEx-- {
|
||||
{
|
||||
size, err := m.Msgs[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.Signer) > 0 {
|
||||
i -= len(m.Signer)
|
||||
copy(dAtA[i:], m.Signer)
|
||||
i = encodeVarintTx(dAtA, i, uint64(len(m.Signer)))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *NonAtomicExecResult) 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 *NonAtomicExecResult) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *NonAtomicExecResult) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.Resp != nil {
|
||||
{
|
||||
size, err := m.Resp.MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintTx(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
}
|
||||
if len(m.Error) > 0 {
|
||||
i -= len(m.Error)
|
||||
copy(dAtA[i:], m.Error)
|
||||
i = encodeVarintTx(dAtA, i, uint64(len(m.Error)))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *MsgNonAtomicExecResponse) 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 *MsgNonAtomicExecResponse) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *MsgNonAtomicExecResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Results) > 0 {
|
||||
for iNdEx := len(m.Results) - 1; iNdEx >= 0; iNdEx-- {
|
||||
{
|
||||
size, err := m.Results[iNdEx].MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintTx(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func encodeVarintTx(dAtA []byte, offset int, v uint64) int {
|
||||
offset -= sovTx(v)
|
||||
base := offset
|
||||
@@ -348,6 +677,57 @@ func (m *MsgUpdateParamsResponse) Size() (n int) {
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *MsgNonAtomicExec) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
l = len(m.Signer)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
if len(m.Msgs) > 0 {
|
||||
for _, e := range m.Msgs {
|
||||
l = e.Size()
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *NonAtomicExecResult) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
l = len(m.Error)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
if m.Resp != nil {
|
||||
l = m.Resp.Size()
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *MsgNonAtomicExecResponse) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Results) > 0 {
|
||||
for _, e := range m.Results {
|
||||
l = e.Size()
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func sovTx(x uint64) (n int) {
|
||||
return (math_bits.Len64(x|1) + 6) / 7
|
||||
}
|
||||
@@ -519,6 +899,324 @@ func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *MsgNonAtomicExec) 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: MsgNonAtomicExec: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: MsgNonAtomicExec: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Signer", 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.Signer = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Msgs", 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.Msgs = append(m.Msgs, &types.Any{})
|
||||
if err := m.Msgs[len(m.Msgs)-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 *NonAtomicExecResult) 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: NonAtomicExecResult: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: NonAtomicExecResult: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Error", 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.Error = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Resp", 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
|
||||
}
|
||||
if m.Resp == nil {
|
||||
m.Resp = &types.Any{}
|
||||
}
|
||||
if err := m.Resp.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 *MsgNonAtomicExecResponse) 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: MsgNonAtomicExecResponse: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: MsgNonAtomicExecResponse: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Results", 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.Results = append(m.Results, &NonAtomicExecResult{})
|
||||
if err := m.Results[len(m.Results)-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 skipTx(dAtA []byte) (n int, err error) {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
|
||||
types "github.com/cosmos/cosmos-sdk/types"
|
||||
gomock "github.com/golang/mock/gomock"
|
||||
protoiface "google.golang.org/protobuf/runtime/protoiface"
|
||||
)
|
||||
|
||||
// MockBankKeeper is a mock of BankKeeper interface.
|
||||
@@ -81,3 +82,55 @@ func (mr *MockBankKeeperMockRecorder) SendCoins(ctx, fromAddr, toAddr, amt inter
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoins", reflect.TypeOf((*MockBankKeeper)(nil).SendCoins), ctx, fromAddr, toAddr, amt)
|
||||
}
|
||||
|
||||
// MockAccountsModKeeper is a mock of AccountsModKeeper interface.
|
||||
type MockAccountsModKeeper struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockAccountsModKeeperMockRecorder
|
||||
}
|
||||
|
||||
// MockAccountsModKeeperMockRecorder is the mock recorder for MockAccountsModKeeper.
|
||||
type MockAccountsModKeeperMockRecorder struct {
|
||||
mock *MockAccountsModKeeper
|
||||
}
|
||||
|
||||
// NewMockAccountsModKeeper creates a new mock instance.
|
||||
func NewMockAccountsModKeeper(ctrl *gomock.Controller) *MockAccountsModKeeper {
|
||||
mock := &MockAccountsModKeeper{ctrl: ctrl}
|
||||
mock.recorder = &MockAccountsModKeeperMockRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockAccountsModKeeper) EXPECT() *MockAccountsModKeeperMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// IsAccountsModuleAccount mocks base method.
|
||||
func (m *MockAccountsModKeeper) IsAccountsModuleAccount(ctx context.Context, accountAddr []byte) bool {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "IsAccountsModuleAccount", ctx, accountAddr)
|
||||
ret0, _ := ret[0].(bool)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// IsAccountsModuleAccount indicates an expected call of IsAccountsModuleAccount.
|
||||
func (mr *MockAccountsModKeeperMockRecorder) IsAccountsModuleAccount(ctx, accountAddr interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsAccountsModuleAccount", reflect.TypeOf((*MockAccountsModKeeper)(nil).IsAccountsModuleAccount), ctx, accountAddr)
|
||||
}
|
||||
|
||||
// SendModuleMessageUntyped mocks base method.
|
||||
func (m *MockAccountsModKeeper) SendModuleMessageUntyped(ctx context.Context, sender []byte, msg protoiface.MessageV1) (protoiface.MessageV1, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "SendModuleMessageUntyped", ctx, sender, msg)
|
||||
ret0, _ := ret[0].(protoiface.MessageV1)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// SendModuleMessageUntyped indicates an expected call of SendModuleMessageUntyped.
|
||||
func (mr *MockAccountsModKeeperMockRecorder) SendModuleMessageUntyped(ctx, sender, msg interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendModuleMessageUntyped", reflect.TypeOf((*MockAccountsModKeeper)(nil).SendModuleMessageUntyped), ctx, sender, msg)
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ package types
|
||||
import (
|
||||
context "context"
|
||||
|
||||
"cosmossdk.io/x/auth/types"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
@@ -13,3 +15,7 @@ type BankKeeper interface {
|
||||
SendCoins(ctx context.Context, fromAddr, toAddr sdk.AccAddress, amt sdk.Coins) error
|
||||
BlockedAddr(addr sdk.AccAddress) bool
|
||||
}
|
||||
|
||||
type AccountsModKeeper interface {
|
||||
types.AccountsModKeeper
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
@@ -14,6 +15,7 @@ import (
|
||||
"cosmossdk.io/x/auth/keeper"
|
||||
authtypes "cosmossdk.io/x/auth/types"
|
||||
"cosmossdk.io/x/auth/vesting"
|
||||
vestingtestutil "cosmossdk.io/x/auth/vesting/testutil"
|
||||
"cosmossdk.io/x/auth/vesting/types"
|
||||
|
||||
codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil"
|
||||
@@ -46,6 +48,10 @@ func (s *VestingAccountTestSuite) SetupTest() {
|
||||
testCtx := testutil.DefaultContextWithDB(s.T(), key, storetypes.NewTransientStoreKey("transient_test"))
|
||||
s.ctx = testCtx.Ctx.WithHeaderInfo(header.Info{})
|
||||
|
||||
// gomock initializations
|
||||
ctrl := gomock.NewController(&testing.T{})
|
||||
acctsModKeeper := vestingtestutil.NewMockAccountsModKeeper(ctrl)
|
||||
|
||||
maccPerms := map[string][]string{
|
||||
"fee_collector": nil,
|
||||
"mint": {"minter"},
|
||||
@@ -59,10 +65,11 @@ func (s *VestingAccountTestSuite) SetupTest() {
|
||||
env,
|
||||
encCfg.Codec,
|
||||
authtypes.ProtoBaseAccount,
|
||||
acctsModKeeper,
|
||||
maccPerms,
|
||||
authcodec.NewBech32Codec("cosmos"),
|
||||
"cosmos",
|
||||
authtypes.NewModuleAddress("gov").String(), nil,
|
||||
authtypes.NewModuleAddress("gov").String(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user