From 11faa47bac5620cda169e603193814312a839fbd Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Tue, 12 Dec 2023 11:16:37 -0800 Subject: [PATCH 01/29] cherry pick: af4b61c --- x/auth/ante/sigverify.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/x/auth/ante/sigverify.go b/x/auth/ante/sigverify.go index 9f7c18d57cb2..d14b5b34f293 100644 --- a/x/auth/ante/sigverify.go +++ b/x/auth/ante/sigverify.go @@ -370,7 +370,13 @@ func (isd IncrementSequenceDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, sim return sdk.Context{}, err } + feeTx, isFeeTx := tx.(sdk.FeeTx) for _, signer := range signers { + // skip sequence increment of fee payer, when multiple signers exist + if isFeeTx && len(signers) > 1 && bytes.Equal(feeTx.FeePayer(), signer) { + continue + } + acc := isd.ak.GetAccount(ctx, signer) if err := acc.SetSequence(acc.GetSequence() + 1); err != nil { panic(err) From b90b56871e78d6c0647d61a0c9df46036cc7ef63 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Tue, 12 Dec 2023 11:43:28 -0800 Subject: [PATCH 02/29] cherry pick: f1ab5db --- baseapp/abci.go | 4 ++++ go.mod | 4 ++-- x/auth/tx/service.go | 29 ++++++++++++++++++++++++++++- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/baseapp/abci.go b/baseapp/abci.go index a78fc700bc14..51c6f23a2d85 100644 --- a/baseapp/abci.go +++ b/baseapp/abci.go @@ -1133,6 +1133,10 @@ func gRPCErrorToSDKError(err error) error { return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, err.Error()) } + if len(status.Details()) > 0 { + err = errorsmod.Wrapf(err, "%v", status.Details()) + } + switch status.Code() { case codes.NotFound: return errorsmod.Wrap(sdkerrors.ErrKeyNotFound, err.Error()) diff --git a/go.mod b/go.mod index 6d117c5f8d12..b17960260d30 100644 --- a/go.mod +++ b/go.mod @@ -46,6 +46,7 @@ require ( github.com/magiconair/properties v1.8.7 github.com/manifoldco/promptui v0.9.0 github.com/mattn/go-isatty v0.0.20 + github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.17.0 github.com/prometheus/common v0.45.0 github.com/rs/zerolog v1.31.0 @@ -59,6 +60,7 @@ require ( golang.org/x/exp v0.0.0-20231006140011-7918f672742d golang.org/x/sync v0.3.0 google.golang.org/genproto/googleapis/api v0.0.0-20231012201019-e917dd12ba7a + google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405 google.golang.org/grpc v1.59.0 google.golang.org/protobuf v1.31.0 gotest.tools/v3 v3.5.1 @@ -134,7 +136,6 @@ require ( github.com/oklog/run v1.1.0 // indirect github.com/pelletier/go-toml/v2 v2.0.8 // indirect github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc // indirect - github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/client_model v0.5.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect @@ -155,7 +156,6 @@ require ( golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect google.golang.org/genproto v0.0.0-20231016165738-49dd2c1f3d0b // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/x/auth/tx/service.go b/x/auth/tx/service.go index 9f4d56a93164..8e3e8631f551 100644 --- a/x/auth/tx/service.go +++ b/x/auth/tx/service.go @@ -5,9 +5,12 @@ import ( "fmt" "strings" + errorsmod "cosmossdk.io/errors" gogogrpc "github.com/cosmos/gogoproto/grpc" "github.com/golang/protobuf/proto" //nolint:staticcheck // keep legacy for now "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/pkg/errors" + "google.golang.org/genproto/googleapis/rpc/errdetails" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -97,7 +100,7 @@ func (s txServer) Simulate(ctx context.Context, req *txtypes.SimulateRequest) (* gasInfo, result, err := s.simulate(txBytes) if err != nil { - return nil, status.Errorf(codes.Unknown, "%v With gas wanted: '%d' and gas used: '%d' ", err, gasInfo.GasWanted, gasInfo.GasUsed) + return nil, GRPCWrap(err, codes.Unknown, fmt.Sprintf("%v With gas wanted: '%d' and gas used: '%d' ", err, gasInfo.GasWanted, gasInfo.GasUsed)) } return &txtypes.SimulateResponse{ @@ -333,3 +336,27 @@ func parseOrderBy(orderBy txtypes.OrderBy) string { return "" // Defaults to CometBFT's default, which is `asc` now. } } + +func GRPCWrap(err error, c codes.Code, msg string) error { + if err == nil { + return nil + } + + st := status.New(c, msg) + var sdkErr *errorsmod.Error + + if errors.As(err, &sdkErr) { + errorInfo := &errdetails.ErrorInfo{ + Reason: sdkErr.Error(), + Metadata: map[string]string{"Codespace": sdkErr.Codespace(), "ABCICode": fmt.Sprintf("%d", sdkErr.ABCICode())}, + } + + var withDetailsErr error + st, withDetailsErr = st.WithDetails(errorInfo) + if withDetailsErr != nil { + return status.Errorf(c, "%v (failed to add error details: %v)", msg, withDetailsErr) + } + } + + return st.Err() +} From 5995da9ce5084dbddb60235f3faa5f6d9010fd46 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Wed, 13 Dec 2023 10:43:02 -0800 Subject: [PATCH 03/29] cherry pick: c33c5e7 --- x/staking/keeper/msg_server.go | 3 +++ x/staking/types/commission.go | 4 ++++ x/staking/types/errors.go | 1 + x/staking/types/params.go | 8 ++++++-- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/x/staking/keeper/msg_server.go b/x/staking/keeper/msg_server.go index 19b7ba7a2593..53ab685ada69 100644 --- a/x/staking/keeper/msg_server.go +++ b/x/staking/keeper/msg_server.go @@ -178,6 +178,9 @@ func (k msgServer) EditValidator(ctx context.Context, msg *types.MsgEditValidato if msg.CommissionRate.GT(math.LegacyOneDec()) || msg.CommissionRate.IsNegative() { return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "commission rate must be between 0 and 1 (inclusive)") } + if msg.CommissionRate.LT(types.MinCommissionRate) { + return nil, errorsmod.Wrapf(types.ErrCommissionTooSmall, "minimum commission rate is %s", types.MinCommissionRate) + } minCommissionRate, err := k.MinCommissionRate(ctx) if err != nil { diff --git a/x/staking/types/commission.go b/x/staking/types/commission.go index 4f5d12de5bf1..3df490e56bc0 100644 --- a/x/staking/types/commission.go +++ b/x/staking/types/commission.go @@ -52,6 +52,10 @@ func (cr CommissionRates) Validate() error { // rate cannot be greater than the max rate return ErrCommissionGTMaxRate + case cr.Rate.LT(MinCommissionRate): + // rate cannot be less than 2% + return ErrCommissionTooSmall + case cr.MaxChangeRate.IsNegative(): // change rate cannot be negative return ErrCommissionChangeRateNegative diff --git a/x/staking/types/errors.go b/x/staking/types/errors.go index 00441564352a..e6b36a7c76b9 100644 --- a/x/staking/types/errors.go +++ b/x/staking/types/errors.go @@ -48,4 +48,5 @@ var ( ErrInvalidSigner = errors.Register(ModuleName, 43, "expected authority account as only signer for proposal message") ErrBadRedelegationSrc = errors.Register(ModuleName, 44, "redelegation source validator not found") ErrNoUnbondingType = errors.Register(ModuleName, 45, "unbonding type not found") + ErrCommissionTooSmall = errors.Register(ModuleName, 46, "commission rate too small") ) diff --git a/x/staking/types/params.go b/x/staking/types/params.go index 9687b206485c..599a7e9df0b3 100644 --- a/x/staking/types/params.go +++ b/x/staking/types/params.go @@ -31,8 +31,12 @@ const ( DefaultHistoricalEntries uint32 = 10000 ) -// DefaultMinCommissionRate is set to 0% -var DefaultMinCommissionRate = math.LegacyZeroDec() +var ( + // DefaultMinCommissionRate is set to 0% + DefaultMinCommissionRate = math.LegacyZeroDec() + + MinCommissionRate = math.LegacyMustNewDecFromStr("0.02") +) // NewParams creates a new Params instance func NewParams(unbondingTime time.Duration, maxValidators, maxEntries, historicalEntries uint32, bondDenom string, minCommissionRate math.LegacyDec) Params { From 99bddcd30e39871ff56de666963edac3e8a1dc71 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Wed, 13 Dec 2023 10:48:46 -0800 Subject: [PATCH 04/29] cherry pick: 42cbd4 --- x/staking/types/commission.go | 2 +- x/staking/types/params.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/x/staking/types/commission.go b/x/staking/types/commission.go index 3df490e56bc0..6182655c82d2 100644 --- a/x/staking/types/commission.go +++ b/x/staking/types/commission.go @@ -53,7 +53,7 @@ func (cr CommissionRates) Validate() error { return ErrCommissionGTMaxRate case cr.Rate.LT(MinCommissionRate): - // rate cannot be less than 2% + // rate cannot be less than 5% return ErrCommissionTooSmall case cr.MaxChangeRate.IsNegative(): diff --git a/x/staking/types/params.go b/x/staking/types/params.go index 599a7e9df0b3..9e29ef7ccda6 100644 --- a/x/staking/types/params.go +++ b/x/staking/types/params.go @@ -35,7 +35,7 @@ var ( // DefaultMinCommissionRate is set to 0% DefaultMinCommissionRate = math.LegacyZeroDec() - MinCommissionRate = math.LegacyMustNewDecFromStr("0.02") + MinCommissionRate = math.LegacyMustNewDecFromStr("0.05") ) // NewParams creates a new Params instance From a53729cf0c7bec9547f550296b0af594c1321b0e Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Wed, 13 Dec 2023 11:13:54 -0800 Subject: [PATCH 05/29] patch some x/staking tests --- x/staking/simulation/operations_test.go | 2 +- x/staking/types/validator_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/x/staking/simulation/operations_test.go b/x/staking/simulation/operations_test.go index f85060319792..291746a1b69e 100644 --- a/x/staking/simulation/operations_test.go +++ b/x/staking/simulation/operations_test.go @@ -370,7 +370,7 @@ func (s *SimTestSuite) TestSimulateMsgBeginRedelegate() { } func (s *SimTestSuite) getTestingValidator0(ctx sdk.Context) types.Validator { - commission0 := types.NewCommission(math.LegacyZeroDec(), math.LegacyOneDec(), math.LegacyOneDec()) + commission0 := types.NewCommission(types.MinCommissionRate, math.LegacyOneDec(), math.LegacyOneDec()) return s.getTestingValidator(ctx, commission0, 1) } diff --git a/x/staking/types/validator_test.go b/x/staking/types/validator_test.go index ea0bc0e9427b..7bad45369ed5 100644 --- a/x/staking/types/validator_test.go +++ b/x/staking/types/validator_test.go @@ -218,7 +218,7 @@ func TestValidatorSetInitialCommission(t *testing.T) { commission types.Commission expectedErr bool }{ - {val, types.NewCommission(math.LegacyZeroDec(), math.LegacyZeroDec(), math.LegacyZeroDec()), false}, + {val, types.NewCommission(math.LegacyZeroDec(), math.LegacyZeroDec(), math.LegacyZeroDec()), true}, {val, types.NewCommission(math.LegacyZeroDec(), math.LegacyNewDecWithPrec(-1, 1), math.LegacyZeroDec()), true}, {val, types.NewCommission(math.LegacyZeroDec(), math.LegacyNewDec(15000000000), math.LegacyZeroDec()), true}, {val, types.NewCommission(math.LegacyNewDecWithPrec(-1, 1), math.LegacyZeroDec(), math.LegacyZeroDec()), true}, From 53295da9662f9db327d11feacb10e299dcf7bf34 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Wed, 13 Dec 2023 11:38:37 -0800 Subject: [PATCH 06/29] cherry pick: 140749 --- x/gov/keeper/deposit.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/x/gov/keeper/deposit.go b/x/gov/keeper/deposit.go index 9693c5168e48..7e70977add0c 100644 --- a/x/gov/keeper/deposit.go +++ b/x/gov/keeper/deposit.go @@ -301,12 +301,29 @@ func (keeper Keeper) validateInitialDeposit(ctx context.Context, params v1.Param minDepositCoins = params.MinDeposit } + for _, coin := range initialDeposit { + if coin.Denom != "inj" { + continue + } + + minDepositAmount, ok := sdkmath.NewIntFromString("50000000000000000000") // 50 INJ + if !ok { + // should never happen, just defensive programming + return errors.Wrapf(sdkerrors.ErrInvalidCoins, "invalid minDepositAmount amount: %s", minDepositAmount.String()) + } + if coin.Amount.LT(minDepositAmount) { + return errors.Wrapf(sdkerrors.ErrInsufficientFunds, "proposals require a minDepositAmount of at least: %s", minDepositAmount.String()) + } + } + for i := range minDepositCoins { minDepositCoins[i].Amount = sdkmath.LegacyNewDecFromInt(minDepositCoins[i].Amount).Mul(minInitialDepositRatio).RoundInt() } + if !initialDeposit.IsAllGTE(minDepositCoins) { return errors.Wrapf(types.ErrMinDepositTooSmall, "was (%s), need (%s)", initialDeposit, minDepositCoins) } + return nil } From 47b09077ec59c11aa98cafdbcdcd554ebb8f8c0a Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Mon, 18 Dec 2023 10:51:06 -0800 Subject: [PATCH 07/29] cherry pick: 3d27fac5 --- math/int.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/math/int.go b/math/int.go index dc945b13d283..3d90d376ac9b 100644 --- a/math/int.go +++ b/math/int.go @@ -153,6 +153,11 @@ func ZeroInt() Int { return Int{big.NewInt(0)} } // OneInt returns Int value with one func OneInt() Int { return Int{big.NewInt(1)} } +// ToDec converts Int to Dec +func (i Int) ToDec() LegacyDec { + return LegacyNewDecFromInt(i) +} + // Int64 converts Int to int64 // Panics if the value is out of range func (i Int) Int64() int64 { From a5c5f11c648241775744baf8ae69dd1453deac89 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Mon, 18 Dec 2023 11:03:09 -0800 Subject: [PATCH 08/29] cherry pick: 2ec442da9 --- baseapp/options.go | 6 ++++++ go.mod | 2 ++ store/iavl/store.go | 32 ++++++++++++++++++++++++++++---- store/rootmulti/store.go | 13 +++++++++++-- store/types/store.go | 6 ++++++ 5 files changed, 53 insertions(+), 6 deletions(-) diff --git a/baseapp/options.go b/baseapp/options.go index c0c9caf05895..3ae4d3c59c49 100644 --- a/baseapp/options.go +++ b/baseapp/options.go @@ -23,6 +23,12 @@ import ( // File for storing in-package BaseApp optional functions, // for options that need access to non-exported fields of the BaseApp +func SetCommitSync(sync bool) func(app *BaseApp) { + return func(bapp *BaseApp) { + bapp.cms.SetCommitSync(sync) + } +} + // SetPruning sets a pruning option on the multistore associated with the app func SetPruning(opts pruningtypes.PruningOptions) func(*BaseApp) { return func(bapp *BaseApp) { bapp.cms.SetPruning(opts) } diff --git a/go.mod b/go.mod index b17960260d30..4c25d1e18b16 100644 --- a/go.mod +++ b/go.mod @@ -180,6 +180,8 @@ replace ( github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.9.1 // replace broken goleveldb github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 + + cosmossdk.io/store => ./store ) retract ( diff --git a/store/iavl/store.go b/store/iavl/store.go index 7734066269c8..487bcb7b8b52 100644 --- a/store/iavl/store.go +++ b/store/iavl/store.go @@ -42,16 +42,40 @@ type Store struct { // LoadStore returns an IAVL Store as a CommitKVStore. Internally, it will load the // store's version (id) from the provided DB. An error is returned if the version // fails to load, or if called with a positive version on an empty tree. -func LoadStore(db dbm.DB, logger log.Logger, key types.StoreKey, id types.CommitID, cacheSize int, disableFastNode bool, metrics metrics.StoreMetrics) (types.CommitKVStore, error) { - return LoadStoreWithInitialVersion(db, logger, key, id, 0, cacheSize, disableFastNode, metrics) +func LoadStore( + db dbm.DB, + logger log.Logger, + key types.StoreKey, + id types.CommitID, + cacheSize int, + disableFastNode, commitSync bool, + metrics metrics.StoreMetrics, +) (types.CommitKVStore, error) { + return LoadStoreWithInitialVersion(db, logger, key, id, 0, cacheSize, disableFastNode, commitSync, metrics) } // LoadStoreWithInitialVersion returns an IAVL Store as a CommitKVStore setting its initialVersion // to the one given. Internally, it will load the store's version (id) from the // provided DB. An error is returned if the version fails to load, or if called with a positive // version on an empty tree. -func LoadStoreWithInitialVersion(db dbm.DB, logger log.Logger, key types.StoreKey, id types.CommitID, initialVersion uint64, cacheSize int, disableFastNode bool, metrics metrics.StoreMetrics) (types.CommitKVStore, error) { - tree := iavl.NewMutableTree(db, cacheSize, disableFastNode, logger, iavl.InitialVersionOption(initialVersion)) +func LoadStoreWithInitialVersion( + db dbm.DB, + logger log.Logger, + key types.StoreKey, + id types.CommitID, + initialVersion uint64, + cacheSize int, + disableFastNode, commitSync bool, + metrics metrics.StoreMetrics, +) (types.CommitKVStore, error) { + tree := iavl.NewMutableTree( + db, + cacheSize, + disableFastNode, + logger, + iavl.InitialVersionOption(initialVersion), + iavl.SyncOption(commitSync), + ) isUpgradeable, err := tree.IsUpgradeable() if err != nil { diff --git a/store/rootmulti/store.go b/store/rootmulti/store.go index 551a53e635c8..a836a39feccd 100644 --- a/store/rootmulti/store.go +++ b/store/rootmulti/store.go @@ -74,6 +74,7 @@ type Store struct { listeners map[types.StoreKey]*types.MemoryListener metrics metrics.StoreMetrics commitHeader cmtproto.Header + commitSync bool } var ( @@ -106,6 +107,14 @@ func (rs *Store) GetPruning() pruningtypes.PruningOptions { return rs.pruningManager.GetOptions() } +func (rs *Store) GetCommitSync() bool { + return rs.commitSync +} + +func (rs *Store) SetCommitSync(sync bool) { + rs.commitSync = sync +} + // SetPruning sets the pruning strategy on the root store and all the sub-stores. // Note, calling SetPruning on the root store prior to LoadVersion or // LoadLatestVersion performs a no-op as the stores aren't mounted yet. @@ -1009,9 +1018,9 @@ func (rs *Store) loadCommitStoreFromParams(key types.StoreKey, id types.CommitID var err error if params.initialVersion == 0 { - store, err = iavl.LoadStore(db, rs.logger, key, id, rs.iavlCacheSize, rs.iavlDisableFastNode, rs.metrics) + store, err = iavl.LoadStore(db, rs.logger, key, id, rs.iavlCacheSize, rs.iavlDisableFastNode, rs.commitSync, rs.metrics) } else { - store, err = iavl.LoadStoreWithInitialVersion(db, rs.logger, key, id, params.initialVersion, rs.iavlCacheSize, rs.iavlDisableFastNode, rs.metrics) + store, err = iavl.LoadStoreWithInitialVersion(db, rs.logger, key, id, params.initialVersion, rs.iavlCacheSize, rs.iavlDisableFastNode, rs.commitSync, rs.metrics) } if err != nil { diff --git a/store/types/store.go b/store/types/store.go index 8980179950e2..108785cc221c 100644 --- a/store/types/store.go +++ b/store/types/store.go @@ -224,6 +224,12 @@ type CommitMultiStore interface { // SetMetrics sets the metrics for the KVStore SetMetrics(metrics metrics.StoreMetrics) + + // SetCommitSync set store commit sync mode + SetCommitSync(sync bool) + + // GetCommitSync get store commit sync mode + GetCommitSync() bool } //---------subsp------------------------------- From 0bd8045317be293e80b3788e498039848b8a4b2c Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Mon, 18 Dec 2023 11:05:39 -0800 Subject: [PATCH 09/29] cherry pick: bd4b4580d --- x/feegrant/keeper/keeper.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/x/feegrant/keeper/keeper.go b/x/feegrant/keeper/keeper.go index 37f46d97a215..c3b3c447ee47 100644 --- a/x/feegrant/keeper/keeper.go +++ b/x/feegrant/keeper/keeper.go @@ -347,3 +347,23 @@ func (k Keeper) RemoveExpiredAllowances(ctx context.Context, limit int32) error } return nil } + +// CheckGrantedFee is the check part of UseGrantedFees. It's used to assert whether a grant covers the fees. +// No state is persisted. +func (k Keeper) CheckGrantedFee(ctx sdk.Context, granter, grantee sdk.AccAddress, fee sdk.Coins, msgs []sdk.Msg) error { + f, err := k.getGrant(ctx, granter, grantee) + if err != nil { + return err + } + + grant, err := f.GetGrant() + if err != nil { + return err + } + + if _, err := grant.Accept(ctx, fee, msgs); err != nil { + return err + } + + return nil +} From 78ce3fc1e1a3fd5f4d363c55f19bfea09c69f1c8 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Mon, 18 Dec 2023 14:09:26 -0800 Subject: [PATCH 10/29] cherry pick: 9cbd6048e --- api/cosmos/bank/v1beta1/events.pulsar.go | 1282 ++++++++++++++++++++++ go.mod | 3 +- go.sum | 2 - proto/cosmos/bank/v1beta1/events.proto | 26 + runtime/store.go | 4 + simapp/app.go | 3 +- x/bank/abci.go | 11 + x/bank/keeper/keeper.go | 5 +- x/bank/keeper/send.go | 3 +- x/bank/keeper/transient_balances.go | 97 ++ x/bank/keeper/view.go | 12 +- x/bank/module.go | 17 +- x/bank/types/events.pb.go | 614 +++++++++++ x/bank/types/keys.go | 3 + 14 files changed, 2066 insertions(+), 16 deletions(-) create mode 100644 api/cosmos/bank/v1beta1/events.pulsar.go create mode 100644 proto/cosmos/bank/v1beta1/events.proto create mode 100644 x/bank/abci.go create mode 100644 x/bank/keeper/transient_balances.go create mode 100644 x/bank/types/events.pb.go diff --git a/api/cosmos/bank/v1beta1/events.pulsar.go b/api/cosmos/bank/v1beta1/events.pulsar.go new file mode 100644 index 000000000000..3a979c717249 --- /dev/null +++ b/api/cosmos/bank/v1beta1/events.pulsar.go @@ -0,0 +1,1282 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package bankv1beta1 + +import ( + _ "cosmossdk.io/api/amino" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var _ protoreflect.List = (*_EventSetBalances_1_list)(nil) + +type _EventSetBalances_1_list struct { + list *[]*BalanceUpdate +} + +func (x *_EventSetBalances_1_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_EventSetBalances_1_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_EventSetBalances_1_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*BalanceUpdate) + (*x.list)[i] = concreteValue +} + +func (x *_EventSetBalances_1_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*BalanceUpdate) + *x.list = append(*x.list, concreteValue) +} + +func (x *_EventSetBalances_1_list) AppendMutable() protoreflect.Value { + v := new(BalanceUpdate) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_EventSetBalances_1_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_EventSetBalances_1_list) NewElement() protoreflect.Value { + v := new(BalanceUpdate) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_EventSetBalances_1_list) IsValid() bool { + return x.list != nil +} + +var ( + md_EventSetBalances protoreflect.MessageDescriptor + fd_EventSetBalances_balance_updates protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_bank_v1beta1_events_proto_init() + md_EventSetBalances = File_cosmos_bank_v1beta1_events_proto.Messages().ByName("EventSetBalances") + fd_EventSetBalances_balance_updates = md_EventSetBalances.Fields().ByName("balance_updates") +} + +var _ protoreflect.Message = (*fastReflection_EventSetBalances)(nil) + +type fastReflection_EventSetBalances EventSetBalances + +func (x *EventSetBalances) ProtoReflect() protoreflect.Message { + return (*fastReflection_EventSetBalances)(x) +} + +func (x *EventSetBalances) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_bank_v1beta1_events_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_EventSetBalances_messageType fastReflection_EventSetBalances_messageType +var _ protoreflect.MessageType = fastReflection_EventSetBalances_messageType{} + +type fastReflection_EventSetBalances_messageType struct{} + +func (x fastReflection_EventSetBalances_messageType) Zero() protoreflect.Message { + return (*fastReflection_EventSetBalances)(nil) +} +func (x fastReflection_EventSetBalances_messageType) New() protoreflect.Message { + return new(fastReflection_EventSetBalances) +} +func (x fastReflection_EventSetBalances_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_EventSetBalances +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_EventSetBalances) Descriptor() protoreflect.MessageDescriptor { + return md_EventSetBalances +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_EventSetBalances) Type() protoreflect.MessageType { + return _fastReflection_EventSetBalances_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_EventSetBalances) New() protoreflect.Message { + return new(fastReflection_EventSetBalances) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_EventSetBalances) Interface() protoreflect.ProtoMessage { + return (*EventSetBalances)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_EventSetBalances) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.BalanceUpdates) != 0 { + value := protoreflect.ValueOfList(&_EventSetBalances_1_list{list: &x.BalanceUpdates}) + if !f(fd_EventSetBalances_balance_updates, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_EventSetBalances) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.bank.v1beta1.EventSetBalances.balance_updates": + return len(x.BalanceUpdates) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bank.v1beta1.EventSetBalances")) + } + panic(fmt.Errorf("message cosmos.bank.v1beta1.EventSetBalances does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EventSetBalances) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.bank.v1beta1.EventSetBalances.balance_updates": + x.BalanceUpdates = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bank.v1beta1.EventSetBalances")) + } + panic(fmt.Errorf("message cosmos.bank.v1beta1.EventSetBalances does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_EventSetBalances) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.bank.v1beta1.EventSetBalances.balance_updates": + if len(x.BalanceUpdates) == 0 { + return protoreflect.ValueOfList(&_EventSetBalances_1_list{}) + } + listValue := &_EventSetBalances_1_list{list: &x.BalanceUpdates} + return protoreflect.ValueOfList(listValue) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bank.v1beta1.EventSetBalances")) + } + panic(fmt.Errorf("message cosmos.bank.v1beta1.EventSetBalances does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EventSetBalances) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.bank.v1beta1.EventSetBalances.balance_updates": + lv := value.List() + clv := lv.(*_EventSetBalances_1_list) + x.BalanceUpdates = *clv.list + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bank.v1beta1.EventSetBalances")) + } + panic(fmt.Errorf("message cosmos.bank.v1beta1.EventSetBalances does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EventSetBalances) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.bank.v1beta1.EventSetBalances.balance_updates": + if x.BalanceUpdates == nil { + x.BalanceUpdates = []*BalanceUpdate{} + } + value := &_EventSetBalances_1_list{list: &x.BalanceUpdates} + return protoreflect.ValueOfList(value) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bank.v1beta1.EventSetBalances")) + } + panic(fmt.Errorf("message cosmos.bank.v1beta1.EventSetBalances does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_EventSetBalances) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.bank.v1beta1.EventSetBalances.balance_updates": + list := []*BalanceUpdate{} + return protoreflect.ValueOfList(&_EventSetBalances_1_list{list: &list}) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bank.v1beta1.EventSetBalances")) + } + panic(fmt.Errorf("message cosmos.bank.v1beta1.EventSetBalances does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_EventSetBalances) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.bank.v1beta1.EventSetBalances", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_EventSetBalances) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EventSetBalances) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_EventSetBalances) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_EventSetBalances) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*EventSetBalances) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if len(x.BalanceUpdates) > 0 { + for _, e := range x.BalanceUpdates { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*EventSetBalances) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.BalanceUpdates) > 0 { + for iNdEx := len(x.BalanceUpdates) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.BalanceUpdates[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*EventSetBalances) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventSetBalances: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventSetBalances: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field BalanceUpdates", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.BalanceUpdates = append(x.BalanceUpdates, &BalanceUpdate{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.BalanceUpdates[len(x.BalanceUpdates)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_BalanceUpdate protoreflect.MessageDescriptor + fd_BalanceUpdate_addr protoreflect.FieldDescriptor + fd_BalanceUpdate_denom protoreflect.FieldDescriptor + fd_BalanceUpdate_amt protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_bank_v1beta1_events_proto_init() + md_BalanceUpdate = File_cosmos_bank_v1beta1_events_proto.Messages().ByName("BalanceUpdate") + fd_BalanceUpdate_addr = md_BalanceUpdate.Fields().ByName("addr") + fd_BalanceUpdate_denom = md_BalanceUpdate.Fields().ByName("denom") + fd_BalanceUpdate_amt = md_BalanceUpdate.Fields().ByName("amt") +} + +var _ protoreflect.Message = (*fastReflection_BalanceUpdate)(nil) + +type fastReflection_BalanceUpdate BalanceUpdate + +func (x *BalanceUpdate) ProtoReflect() protoreflect.Message { + return (*fastReflection_BalanceUpdate)(x) +} + +func (x *BalanceUpdate) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_bank_v1beta1_events_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_BalanceUpdate_messageType fastReflection_BalanceUpdate_messageType +var _ protoreflect.MessageType = fastReflection_BalanceUpdate_messageType{} + +type fastReflection_BalanceUpdate_messageType struct{} + +func (x fastReflection_BalanceUpdate_messageType) Zero() protoreflect.Message { + return (*fastReflection_BalanceUpdate)(nil) +} +func (x fastReflection_BalanceUpdate_messageType) New() protoreflect.Message { + return new(fastReflection_BalanceUpdate) +} +func (x fastReflection_BalanceUpdate_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_BalanceUpdate +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_BalanceUpdate) Descriptor() protoreflect.MessageDescriptor { + return md_BalanceUpdate +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_BalanceUpdate) Type() protoreflect.MessageType { + return _fastReflection_BalanceUpdate_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_BalanceUpdate) New() protoreflect.Message { + return new(fastReflection_BalanceUpdate) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_BalanceUpdate) Interface() protoreflect.ProtoMessage { + return (*BalanceUpdate)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_BalanceUpdate) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.Addr) != 0 { + value := protoreflect.ValueOfBytes(x.Addr) + if !f(fd_BalanceUpdate_addr, value) { + return + } + } + if len(x.Denom) != 0 { + value := protoreflect.ValueOfBytes(x.Denom) + if !f(fd_BalanceUpdate_denom, value) { + return + } + } + if x.Amt != "" { + value := protoreflect.ValueOfString(x.Amt) + if !f(fd_BalanceUpdate_amt, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_BalanceUpdate) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.bank.v1beta1.BalanceUpdate.addr": + return len(x.Addr) != 0 + case "cosmos.bank.v1beta1.BalanceUpdate.denom": + return len(x.Denom) != 0 + case "cosmos.bank.v1beta1.BalanceUpdate.amt": + return x.Amt != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bank.v1beta1.BalanceUpdate")) + } + panic(fmt.Errorf("message cosmos.bank.v1beta1.BalanceUpdate does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_BalanceUpdate) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.bank.v1beta1.BalanceUpdate.addr": + x.Addr = nil + case "cosmos.bank.v1beta1.BalanceUpdate.denom": + x.Denom = nil + case "cosmos.bank.v1beta1.BalanceUpdate.amt": + x.Amt = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bank.v1beta1.BalanceUpdate")) + } + panic(fmt.Errorf("message cosmos.bank.v1beta1.BalanceUpdate does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_BalanceUpdate) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.bank.v1beta1.BalanceUpdate.addr": + value := x.Addr + return protoreflect.ValueOfBytes(value) + case "cosmos.bank.v1beta1.BalanceUpdate.denom": + value := x.Denom + return protoreflect.ValueOfBytes(value) + case "cosmos.bank.v1beta1.BalanceUpdate.amt": + value := x.Amt + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bank.v1beta1.BalanceUpdate")) + } + panic(fmt.Errorf("message cosmos.bank.v1beta1.BalanceUpdate does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_BalanceUpdate) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.bank.v1beta1.BalanceUpdate.addr": + x.Addr = value.Bytes() + case "cosmos.bank.v1beta1.BalanceUpdate.denom": + x.Denom = value.Bytes() + case "cosmos.bank.v1beta1.BalanceUpdate.amt": + x.Amt = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bank.v1beta1.BalanceUpdate")) + } + panic(fmt.Errorf("message cosmos.bank.v1beta1.BalanceUpdate does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_BalanceUpdate) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.bank.v1beta1.BalanceUpdate.addr": + panic(fmt.Errorf("field addr of message cosmos.bank.v1beta1.BalanceUpdate is not mutable")) + case "cosmos.bank.v1beta1.BalanceUpdate.denom": + panic(fmt.Errorf("field denom of message cosmos.bank.v1beta1.BalanceUpdate is not mutable")) + case "cosmos.bank.v1beta1.BalanceUpdate.amt": + panic(fmt.Errorf("field amt of message cosmos.bank.v1beta1.BalanceUpdate is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bank.v1beta1.BalanceUpdate")) + } + panic(fmt.Errorf("message cosmos.bank.v1beta1.BalanceUpdate does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_BalanceUpdate) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.bank.v1beta1.BalanceUpdate.addr": + return protoreflect.ValueOfBytes(nil) + case "cosmos.bank.v1beta1.BalanceUpdate.denom": + return protoreflect.ValueOfBytes(nil) + case "cosmos.bank.v1beta1.BalanceUpdate.amt": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bank.v1beta1.BalanceUpdate")) + } + panic(fmt.Errorf("message cosmos.bank.v1beta1.BalanceUpdate does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_BalanceUpdate) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.bank.v1beta1.BalanceUpdate", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_BalanceUpdate) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_BalanceUpdate) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_BalanceUpdate) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_BalanceUpdate) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*BalanceUpdate) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Addr) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Denom) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Amt) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*BalanceUpdate) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Amt) > 0 { + i -= len(x.Amt) + copy(dAtA[i:], x.Amt) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Amt))) + i-- + dAtA[i] = 0x1a + } + if len(x.Denom) > 0 { + i -= len(x.Denom) + copy(dAtA[i:], x.Denom) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Denom))) + i-- + dAtA[i] = 0x12 + } + if len(x.Addr) > 0 { + i -= len(x.Addr) + copy(dAtA[i:], x.Addr) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Addr))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*BalanceUpdate) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: BalanceUpdate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: BalanceUpdate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Addr", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Addr = append(x.Addr[:0], dAtA[iNdEx:postIndex]...) + if x.Addr == nil { + x.Addr = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Denom = append(x.Denom[:0], dAtA[iNdEx:postIndex]...) + if x.Denom == nil { + x.Denom = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Amt", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Amt = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: cosmos/bank/v1beta1/events.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// EventSetBalance is an event that tracks the latest bank balance. +type EventSetBalances struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + BalanceUpdates []*BalanceUpdate `protobuf:"bytes,1,rep,name=balance_updates,json=balanceUpdates,proto3" json:"balance_updates,omitempty"` +} + +func (x *EventSetBalances) Reset() { + *x = EventSetBalances{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_bank_v1beta1_events_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EventSetBalances) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EventSetBalances) ProtoMessage() {} + +// Deprecated: Use EventSetBalances.ProtoReflect.Descriptor instead. +func (*EventSetBalances) Descriptor() ([]byte, []int) { + return file_cosmos_bank_v1beta1_events_proto_rawDescGZIP(), []int{0} +} + +func (x *EventSetBalances) GetBalanceUpdates() []*BalanceUpdate { + if x != nil { + return x.BalanceUpdates + } + return nil +} + +// BalanceUpdate contains a given address's latest balance +type BalanceUpdate struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Addr []byte `protobuf:"bytes,1,opt,name=addr,proto3" json:"addr,omitempty"` + Denom []byte `protobuf:"bytes,2,opt,name=denom,proto3" json:"denom,omitempty"` + // the latest amount + Amt string `protobuf:"bytes,3,opt,name=amt,proto3" json:"amt,omitempty"` +} + +func (x *BalanceUpdate) Reset() { + *x = BalanceUpdate{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_bank_v1beta1_events_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BalanceUpdate) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BalanceUpdate) ProtoMessage() {} + +// Deprecated: Use BalanceUpdate.ProtoReflect.Descriptor instead. +func (*BalanceUpdate) Descriptor() ([]byte, []int) { + return file_cosmos_bank_v1beta1_events_proto_rawDescGZIP(), []int{1} +} + +func (x *BalanceUpdate) GetAddr() []byte { + if x != nil { + return x.Addr + } + return nil +} + +func (x *BalanceUpdate) GetDenom() []byte { + if x != nil { + return x.Denom + } + return nil +} + +func (x *BalanceUpdate) GetAmt() string { + if x != nil { + return x.Amt + } + return "" +} + +var File_cosmos_bank_v1beta1_events_proto protoreflect.FileDescriptor + +var file_cosmos_bank_v1beta1_events_proto_rawDesc = []byte{ + 0x0a, 0x20, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x6e, 0x6b, 0x2f, 0x76, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x13, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x6e, 0x6b, 0x2e, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, + 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, + 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x5f, 0x0a, 0x10, 0x45, + 0x76, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x74, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x12, + 0x4b, 0x0a, 0x0f, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x62, 0x61, 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x42, + 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x0e, 0x62, 0x61, + 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x22, 0x8e, 0x01, 0x0a, + 0x0d, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x12, + 0x0a, 0x04, 0x61, 0x64, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x61, 0x64, + 0x64, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x05, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x12, 0x53, 0x0a, 0x03, 0x61, 0x6d, 0x74, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x41, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x26, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, + 0x73, 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x49, 0x6e, 0x74, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x03, 0x61, 0x6d, 0x74, 0x42, 0xc6, 0x01, + 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x6e, + 0x6b, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x0b, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2f, 0x62, 0x61, 0x6e, 0x6b, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x62, + 0x61, 0x6e, 0x6b, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x42, 0x58, + 0xaa, 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x42, 0x61, 0x6e, 0x6b, 0x2e, 0x56, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, + 0x42, 0x61, 0x6e, 0x6b, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x1f, 0x43, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x42, 0x61, 0x6e, 0x6b, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, + 0x15, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x42, 0x61, 0x6e, 0x6b, 0x3a, 0x3a, 0x56, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_cosmos_bank_v1beta1_events_proto_rawDescOnce sync.Once + file_cosmos_bank_v1beta1_events_proto_rawDescData = file_cosmos_bank_v1beta1_events_proto_rawDesc +) + +func file_cosmos_bank_v1beta1_events_proto_rawDescGZIP() []byte { + file_cosmos_bank_v1beta1_events_proto_rawDescOnce.Do(func() { + file_cosmos_bank_v1beta1_events_proto_rawDescData = protoimpl.X.CompressGZIP(file_cosmos_bank_v1beta1_events_proto_rawDescData) + }) + return file_cosmos_bank_v1beta1_events_proto_rawDescData +} + +var file_cosmos_bank_v1beta1_events_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_cosmos_bank_v1beta1_events_proto_goTypes = []interface{}{ + (*EventSetBalances)(nil), // 0: cosmos.bank.v1beta1.EventSetBalances + (*BalanceUpdate)(nil), // 1: cosmos.bank.v1beta1.BalanceUpdate +} +var file_cosmos_bank_v1beta1_events_proto_depIdxs = []int32{ + 1, // 0: cosmos.bank.v1beta1.EventSetBalances.balance_updates:type_name -> cosmos.bank.v1beta1.BalanceUpdate + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_cosmos_bank_v1beta1_events_proto_init() } +func file_cosmos_bank_v1beta1_events_proto_init() { + if File_cosmos_bank_v1beta1_events_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_cosmos_bank_v1beta1_events_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EventSetBalances); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_bank_v1beta1_events_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BalanceUpdate); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_cosmos_bank_v1beta1_events_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_cosmos_bank_v1beta1_events_proto_goTypes, + DependencyIndexes: file_cosmos_bank_v1beta1_events_proto_depIdxs, + MessageInfos: file_cosmos_bank_v1beta1_events_proto_msgTypes, + }.Build() + File_cosmos_bank_v1beta1_events_proto = out.File + file_cosmos_bank_v1beta1_events_proto_rawDesc = nil + file_cosmos_bank_v1beta1_events_proto_goTypes = nil + file_cosmos_bank_v1beta1_events_proto_depIdxs = nil +} diff --git a/go.mod b/go.mod index 4c25d1e18b16..6e9d8506ce80 100644 --- a/go.mod +++ b/go.mod @@ -170,6 +170,7 @@ require ( // Below are the long-lived replace of the Cosmos SDK replace ( + cosmossdk.io/store => ./store // use cosmos fork of keyring github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 // dgrijalva/jwt-go is deprecated and doesn't receive security updates. @@ -180,8 +181,6 @@ replace ( github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.9.1 // replace broken goleveldb github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 - - cosmossdk.io/store => ./store ) retract ( diff --git a/go.sum b/go.sum index 4f0786766803..473b6df8f24c 100644 --- a/go.sum +++ b/go.sum @@ -49,8 +49,6 @@ cosmossdk.io/log v1.2.1 h1:Xc1GgTCicniwmMiKwDxUjO4eLhPxoVdI9vtMW8Ti/uk= cosmossdk.io/log v1.2.1/go.mod h1:GNSCc/6+DhFIj1aLn/j7Id7PaO8DzNylUZoOYBL9+I4= cosmossdk.io/math v1.2.0 h1:8gudhTkkD3NxOP2YyyJIYYmt6dQ55ZfJkDOaxXpy7Ig= cosmossdk.io/math v1.2.0/go.mod h1:l2Gnda87F0su8a/7FEKJfFdJrM0JZRXQaohlgJeyQh0= -cosmossdk.io/store v1.0.1 h1:XBDhCqlL+2MUgE8CHWwndKVJ4beX+TyaPIjB5SV62dM= -cosmossdk.io/store v1.0.1/go.mod h1:EFtENTqVTuWwitGW1VwaBct+yDagk7oG/axBMPH+FXs= cosmossdk.io/x/tx v0.12.0 h1:Ry2btjQdrfrje9qZ3iZeZSmDArjgxUJMMcLMrX4wj5U= cosmossdk.io/x/tx v0.12.0/go.mod h1:qTth2coAGkwCwOCjqQ8EAQg+9udXNRzcnSbMgGKGEI0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= diff --git a/proto/cosmos/bank/v1beta1/events.proto b/proto/cosmos/bank/v1beta1/events.proto new file mode 100644 index 000000000000..980c5d42127a --- /dev/null +++ b/proto/cosmos/bank/v1beta1/events.proto @@ -0,0 +1,26 @@ +syntax = "proto3"; +package cosmos.bank.v1beta1; + +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; +import "amino/amino.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/bank/types"; + +// EventSetBalance is an event that tracks the latest bank balance. +message EventSetBalances { + repeated BalanceUpdate balance_updates = 1; +} + +// BalanceUpdate contains a given address's latest balance +message BalanceUpdate { + bytes addr = 1; + bytes denom = 2; + // the latest amount + string amt = 3 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; +} diff --git a/runtime/store.go b/runtime/store.go index 230f53c38c5d..a6871fd8ab78 100644 --- a/runtime/store.go +++ b/runtime/store.go @@ -36,6 +36,10 @@ type transientStoreService struct { key *storetypes.TransientStoreKey } +func NewTransientKVStoreService(tKey *storetypes.TransientStoreKey) store.TransientStoreService { + return &transientStoreService{key: tKey} +} + func (t transientStoreService) OpenTransientStore(ctx context.Context) store.KVStore { return newKVStore(sdk.UnwrapSDKContext(ctx).KVStore(t.key)) } diff --git a/simapp/app.go b/simapp/app.go index 68654666b046..3e5d06af41b7 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -265,7 +265,7 @@ func NewSimApp( panic(err) } - tkeys := storetypes.NewTransientStoreKeys(paramstypes.TStoreKey) + tkeys := storetypes.NewTransientStoreKeys(paramstypes.TStoreKey, banktypes.TStoreKey) app := &SimApp{ BaseApp: bApp, legacyAmino: legacyAmino, @@ -288,6 +288,7 @@ func NewSimApp( app.BankKeeper = bankkeeper.NewBaseKeeper( appCodec, runtime.NewKVStoreService(keys[banktypes.StoreKey]), + runtime.NewTransientKVStoreService(tkeys[banktypes.TStoreKey]), app.AccountKeeper, BlockedAddresses(), authtypes.NewModuleAddress(govtypes.ModuleName).String(), diff --git a/x/bank/abci.go b/x/bank/abci.go new file mode 100644 index 000000000000..1e58f3cc0a2a --- /dev/null +++ b/x/bank/abci.go @@ -0,0 +1,11 @@ +package bank + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/bank/keeper" +) + +// EndBlocker is called every block, emits balance event +func EndBlocker(ctx sdk.Context, k keeper.Keeper) { + k.EmitAllTransientBalances(ctx) +} diff --git a/x/bank/keeper/keeper.go b/x/bank/keeper/keeper.go index bfa45d23f64e..eb980c5b4d76 100644 --- a/x/bank/keeper/keeper.go +++ b/x/bank/keeper/keeper.go @@ -49,6 +49,8 @@ type Keeper interface { DelegateCoins(ctx context.Context, delegatorAddr, moduleAccAddr sdk.AccAddress, amt sdk.Coins) error UndelegateCoins(ctx context.Context, moduleAccAddr, delegatorAddr sdk.AccAddress, amt sdk.Coins) error + EmitAllTransientBalances(ctx sdk.Context) + types.QueryServer } @@ -84,6 +86,7 @@ func (k BaseKeeper) GetPaginatedTotalSupply(ctx context.Context, pagination *que func NewBaseKeeper( cdc codec.BinaryCodec, storeService store.KVStoreService, + tStoreService store.TransientStoreService, ak types.AccountKeeper, blockedAddrs map[string]bool, authority string, @@ -97,7 +100,7 @@ func NewBaseKeeper( logger = logger.With(log.ModuleKey, "x/"+types.ModuleName) return BaseKeeper{ - BaseSendKeeper: NewBaseSendKeeper(cdc, storeService, ak, blockedAddrs, authority, logger), + BaseSendKeeper: NewBaseSendKeeper(cdc, storeService, tStoreService, ak, blockedAddrs, authority, logger), ak: ak, cdc: cdc, storeService: storeService, diff --git a/x/bank/keeper/send.go b/x/bank/keeper/send.go index 3bcc6d315c33..764d090b8d04 100644 --- a/x/bank/keeper/send.go +++ b/x/bank/keeper/send.go @@ -74,6 +74,7 @@ type BaseSendKeeper struct { func NewBaseSendKeeper( cdc codec.BinaryCodec, storeService store.KVStoreService, + tStoreService store.TransientStoreService, ak types.AccountKeeper, blockedAddrs map[string]bool, authority string, @@ -84,7 +85,7 @@ func NewBaseSendKeeper( } return BaseSendKeeper{ - BaseViewKeeper: NewBaseViewKeeper(cdc, storeService, ak, logger), + BaseViewKeeper: NewBaseViewKeeper(cdc, storeService, tStoreService, ak, logger), cdc: cdc, ak: ak, storeService: storeService, diff --git a/x/bank/keeper/transient_balances.go b/x/bank/keeper/transient_balances.go new file mode 100644 index 000000000000..4bf78d9fedf6 --- /dev/null +++ b/x/bank/keeper/transient_balances.go @@ -0,0 +1,97 @@ +package keeper + +import ( + "cosmossdk.io/store/prefix" + + "github.com/cosmos/cosmos-sdk/runtime" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" + "github.com/cosmos/cosmos-sdk/types/kv" + "github.com/cosmos/cosmos-sdk/x/bank/types" +) + +// getTransientAccountStore gets the transient account store of the given address. +func (k BaseViewKeeper) getTransientAccountStore(ctx sdk.Context, addr sdk.AccAddress) prefix.Store { + store := k.tStoreService.OpenTransientStore(ctx) + return prefix.NewStore(runtime.KVStoreAdapter(store), createAccountBalancesPrefix(addr)) +} + +// setTransientBalance sets the transient coin balance for an account by address. +func (k BaseSendKeeper) setTransientBalance(ctx sdk.Context, addr sdk.AccAddress, balance sdk.Coin) { + accountStore := k.getTransientAccountStore(ctx, addr) + + bz := k.cdc.MustMarshal(&balance) + accountStore.Set([]byte(balance.Denom), bz) +} + +func (k BaseKeeper) EmitAllTransientBalances(ctx sdk.Context) { + balanceUpdates := k.GetAllTransientAccountBalanceUpdates(ctx) + if len(balanceUpdates) > 0 { + ctx.EventManager().EmitTypedEvent(&types.EventSetBalances{ + BalanceUpdates: balanceUpdates, + }) + } +} + +// GetAllTransientAccountBalanceUpdates returns all the transient accounts balances from the transient store. +func (k BaseViewKeeper) GetAllTransientAccountBalanceUpdates(ctx sdk.Context) []*types.BalanceUpdate { + balanceUpdates := make([]*types.BalanceUpdate, 0) + + k.IterateAllTransientBalances(ctx, func(addr sdk.AccAddress, balance sdk.Coin) bool { + balanceUpdate := &types.BalanceUpdate{ + Addr: addr.Bytes(), + Denom: []byte(balance.Denom), + Amt: balance.Amount, + } + balanceUpdates = append(balanceUpdates, balanceUpdate) + return false + }) + + return balanceUpdates +} + +// IterateAllTransientBalances iterates over all transient balances of all accounts and +// denominations that are provided to a callback. If true is returned from the +// callback, iteration is halted. +func (k BaseViewKeeper) IterateAllTransientBalances(ctx sdk.Context, cb func(sdk.AccAddress, sdk.Coin) bool) { + store := k.tStoreService.OpenTransientStore(ctx) + balancesStore := prefix.NewStore(runtime.KVStoreAdapter(store), types.BalancesPrefix) + + iterator := balancesStore.Iterator(nil, nil) + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + address, _, err := addressAndDenomFromBalancesStore(iterator.Key()) + if err != nil { + k.Logger().With("key", iterator.Key(), "err", err).Error("failed to get address from balances store") + continue + } + + var balance sdk.Coin + k.cdc.MustUnmarshal(iterator.Value(), &balance) + + if cb(address, balance) { + break + } + } +} + +func createAccountBalancesPrefix(addr []byte) []byte { + return append(types.BalancesPrefix.Bytes(), address.MustLengthPrefix(addr)...) +} + +func addressAndDenomFromBalancesStore(key []byte) (sdk.AccAddress, string, error) { + if len(key) == 0 { + return nil, "", types.ErrInvalidKey + } + + kv.AssertKeyAtLeastLength(key, 1) + + addrBound := int(key[0]) + + if len(key)-1 < addrBound { + return nil, "", types.ErrInvalidKey + } + + return key[1 : addrBound+1], string(key[addrBound+1:]), nil +} diff --git a/x/bank/keeper/view.go b/x/bank/keeper/view.go index d4e2544bc796..7aeca0009681 100644 --- a/x/bank/keeper/view.go +++ b/x/bank/keeper/view.go @@ -56,10 +56,11 @@ func (b BalancesIndexes) IndexesList() []collections.Index[collections.Pair[sdk. // BaseViewKeeper implements a read only keeper implementation of ViewKeeper. type BaseViewKeeper struct { - cdc codec.BinaryCodec - storeService store.KVStoreService - ak types.AccountKeeper - logger log.Logger + cdc codec.BinaryCodec + storeService store.KVStoreService + tStoreService store.TransientStoreService + ak types.AccountKeeper + logger log.Logger Schema collections.Schema Supply collections.Map[string, math.Int] @@ -70,11 +71,12 @@ type BaseViewKeeper struct { } // NewBaseViewKeeper returns a new BaseViewKeeper. -func NewBaseViewKeeper(cdc codec.BinaryCodec, storeService store.KVStoreService, ak types.AccountKeeper, logger log.Logger) BaseViewKeeper { +func NewBaseViewKeeper(cdc codec.BinaryCodec, storeService store.KVStoreService, tStoreService store.TransientStoreService, ak types.AccountKeeper, logger log.Logger) BaseViewKeeper { sb := collections.NewSchemaBuilder(storeService) k := BaseViewKeeper{ cdc: cdc, storeService: storeService, + tStoreService: tStoreService, ak: ak, logger: logger, Supply: collections.NewMap(sb, types.SupplyKey, "supply", collections.StringKey, sdk.IntValue), diff --git a/x/bank/module.go b/x/bank/module.go index 315a6ecfc744..335bda66f09f 100644 --- a/x/bank/module.go +++ b/x/bank/module.go @@ -171,6 +171,13 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw // ConsensusVersion implements AppModule/ConsensusVersion. func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion } +// EndBlock returns the end blocker for the bank module. It returns no validator +// updates. +func (am AppModule) EndBlock(ctx context.Context) error { + EndBlocker(sdk.UnwrapSDKContext(ctx), am.keeper) + return nil +} + // AppModuleSimulation functions // GenerateGenesisState creates a randomized GenState of the bank module. @@ -206,10 +213,11 @@ func init() { type ModuleInputs struct { depinject.In - Config *modulev1.Module - Cdc codec.Codec - StoreService corestore.KVStoreService - Logger log.Logger + Config *modulev1.Module + Cdc codec.Codec + StoreService corestore.KVStoreService + TransientStoreService corestore.TransientStoreService + Logger log.Logger AccountKeeper types.AccountKeeper @@ -249,6 +257,7 @@ func ProvideModule(in ModuleInputs) ModuleOutputs { bankKeeper := keeper.NewBaseKeeper( in.Cdc, in.StoreService, + in.TransientStoreService, in.AccountKeeper, blockedAddresses, authority.String(), diff --git a/x/bank/types/events.pb.go b/x/bank/types/events.pb.go new file mode 100644 index 000000000000..b7dc8810b9d4 --- /dev/null +++ b/x/bank/types/events.pb.go @@ -0,0 +1,614 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: cosmos/bank/v1beta1/events.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// EventSetBalance is an event that tracks the latest bank balance. +type EventSetBalances struct { + BalanceUpdates []*BalanceUpdate `protobuf:"bytes,1,rep,name=balance_updates,json=balanceUpdates,proto3" json:"balance_updates,omitempty"` +} + +func (m *EventSetBalances) Reset() { *m = EventSetBalances{} } +func (m *EventSetBalances) String() string { return proto.CompactTextString(m) } +func (*EventSetBalances) ProtoMessage() {} +func (*EventSetBalances) Descriptor() ([]byte, []int) { + return fileDescriptor_ad7d0e6fd39d7db3, []int{0} +} +func (m *EventSetBalances) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventSetBalances) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventSetBalances.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 *EventSetBalances) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventSetBalances.Merge(m, src) +} +func (m *EventSetBalances) XXX_Size() int { + return m.Size() +} +func (m *EventSetBalances) XXX_DiscardUnknown() { + xxx_messageInfo_EventSetBalances.DiscardUnknown(m) +} + +var xxx_messageInfo_EventSetBalances proto.InternalMessageInfo + +func (m *EventSetBalances) GetBalanceUpdates() []*BalanceUpdate { + if m != nil { + return m.BalanceUpdates + } + return nil +} + +// BalanceUpdate contains a given address's latest balance +type BalanceUpdate struct { + Addr []byte `protobuf:"bytes,1,opt,name=addr,proto3" json:"addr,omitempty"` + Denom []byte `protobuf:"bytes,2,opt,name=denom,proto3" json:"denom,omitempty"` + // the latest amount + Amt github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=amt,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amt"` +} + +func (m *BalanceUpdate) Reset() { *m = BalanceUpdate{} } +func (m *BalanceUpdate) String() string { return proto.CompactTextString(m) } +func (*BalanceUpdate) ProtoMessage() {} +func (*BalanceUpdate) Descriptor() ([]byte, []int) { + return fileDescriptor_ad7d0e6fd39d7db3, []int{1} +} +func (m *BalanceUpdate) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BalanceUpdate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BalanceUpdate.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 *BalanceUpdate) XXX_Merge(src proto.Message) { + xxx_messageInfo_BalanceUpdate.Merge(m, src) +} +func (m *BalanceUpdate) XXX_Size() int { + return m.Size() +} +func (m *BalanceUpdate) XXX_DiscardUnknown() { + xxx_messageInfo_BalanceUpdate.DiscardUnknown(m) +} + +var xxx_messageInfo_BalanceUpdate proto.InternalMessageInfo + +func (m *BalanceUpdate) GetAddr() []byte { + if m != nil { + return m.Addr + } + return nil +} + +func (m *BalanceUpdate) GetDenom() []byte { + if m != nil { + return m.Denom + } + return nil +} + +func init() { + proto.RegisterType((*EventSetBalances)(nil), "cosmos.bank.v1beta1.EventSetBalances") + proto.RegisterType((*BalanceUpdate)(nil), "cosmos.bank.v1beta1.BalanceUpdate") +} + +func init() { proto.RegisterFile("cosmos/bank/v1beta1/events.proto", fileDescriptor_ad7d0e6fd39d7db3) } + +var fileDescriptor_ad7d0e6fd39d7db3 = []byte{ + // 309 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x48, 0xce, 0x2f, 0xce, + 0xcd, 0x2f, 0xd6, 0x4f, 0x4a, 0xcc, 0xcb, 0xd6, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, + 0x4f, 0x2d, 0x4b, 0xcd, 0x2b, 0x29, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x86, 0xa8, + 0xd0, 0x03, 0xa9, 0xd0, 0x83, 0xaa, 0x90, 0x92, 0x84, 0x08, 0xc6, 0x83, 0x95, 0xe8, 0x43, 0x55, + 0x80, 0x39, 0x52, 0x22, 0xe9, 0xf9, 0xe9, 0xf9, 0x10, 0x71, 0x10, 0x0b, 0x2a, 0x2a, 0x98, 0x98, + 0x9b, 0x99, 0x97, 0xaf, 0x0f, 0x26, 0x21, 0x42, 0x4a, 0xf1, 0x5c, 0x02, 0xae, 0x20, 0x8b, 0x82, + 0x53, 0x4b, 0x9c, 0x12, 0x73, 0x12, 0xf3, 0x92, 0x53, 0x8b, 0x85, 0xbc, 0xb9, 0xf8, 0x93, 0x20, + 0xec, 0xf8, 0xd2, 0x82, 0x94, 0xc4, 0x92, 0xd4, 0x62, 0x09, 0x46, 0x05, 0x66, 0x0d, 0x6e, 0x23, + 0x25, 0x3d, 0x2c, 0xce, 0xd0, 0x83, 0xea, 0x0b, 0x05, 0x2b, 0x0d, 0xe2, 0x4b, 0x42, 0xe6, 0x16, + 0x2b, 0xf5, 0x31, 0x72, 0xf1, 0xa2, 0xa8, 0x10, 0x12, 0xe2, 0x62, 0x49, 0x4c, 0x49, 0x29, 0x92, + 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x09, 0x02, 0xb3, 0x85, 0x44, 0xb8, 0x58, 0x53, 0x52, 0xf3, 0xf2, + 0x73, 0x25, 0x98, 0xc0, 0x82, 0x10, 0x8e, 0x50, 0x30, 0x17, 0x73, 0x62, 0x6e, 0x89, 0x04, 0xb3, + 0x02, 0xa3, 0x06, 0xa7, 0x93, 0xe3, 0x89, 0x7b, 0xf2, 0x0c, 0xb7, 0xee, 0xc9, 0xab, 0xa5, 0x67, + 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0x42, 0xfd, 0x0c, 0xa5, 0x74, 0x8b, 0x53, 0xb2, + 0xf5, 0x4b, 0x2a, 0x0b, 0x52, 0x8b, 0xf5, 0x3c, 0xf3, 0x4a, 0x2e, 0x6d, 0xd1, 0xe5, 0x82, 0xba, + 0xd6, 0x33, 0xaf, 0x64, 0xc5, 0xf3, 0x0d, 0x5a, 0x8c, 0x41, 0x20, 0xd3, 0x9c, 0x9c, 0x4f, 0x3c, + 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, + 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0x4a, 0x13, 0xaf, 0xc9, 0x15, 0x90, 0xe8, 0x01, + 0x5b, 0x90, 0xc4, 0x06, 0x0e, 0x3d, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x36, 0xf9, 0xd8, + 0x0f, 0xba, 0x01, 0x00, 0x00, +} + +func (m *EventSetBalances) 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 *EventSetBalances) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventSetBalances) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.BalanceUpdates) > 0 { + for iNdEx := len(m.BalanceUpdates) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.BalanceUpdates[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *BalanceUpdate) 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 *BalanceUpdate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BalanceUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Amt.Size() + i -= size + if _, err := m.Amt.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0x12 + } + if len(m.Addr) > 0 { + i -= len(m.Addr) + copy(dAtA[i:], m.Addr) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Addr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintEvents(dAtA []byte, offset int, v uint64) int { + offset -= sovEvents(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *EventSetBalances) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.BalanceUpdates) > 0 { + for _, e := range m.BalanceUpdates { + l = e.Size() + n += 1 + l + sovEvents(uint64(l)) + } + } + return n +} + +func (m *BalanceUpdate) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Addr) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = m.Amt.Size() + n += 1 + l + sovEvents(uint64(l)) + return n +} + +func sovEvents(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozEvents(x uint64) (n int) { + return sovEvents(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *EventSetBalances) 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 ErrIntOverflowEvents + } + 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: EventSetBalances: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventSetBalances: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BalanceUpdates", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BalanceUpdates = append(m.BalanceUpdates, &BalanceUpdate{}) + if err := m.BalanceUpdates[len(m.BalanceUpdates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BalanceUpdate) 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 ErrIntOverflowEvents + } + 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: BalanceUpdate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BalanceUpdate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Addr", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Addr = append(m.Addr[:0], dAtA[iNdEx:postIndex]...) + if m.Addr == nil { + m.Addr = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = append(m.Denom[:0], dAtA[iNdEx:postIndex]...) + if m.Denom == nil { + m.Denom = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amt", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + 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 ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Amt.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipEvents(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthEvents + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupEvents + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthEvents + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthEvents = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowEvents = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupEvents = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/bank/types/keys.go b/x/bank/types/keys.go index b4ea683d4b69..f8c7db4775f9 100644 --- a/x/bank/types/keys.go +++ b/x/bank/types/keys.go @@ -17,6 +17,9 @@ const ( // RouterKey defines the module's message routing key RouterKey = ModuleName + + // TStoreKey defines the primary module transient store key + TStoreKey = "transient_bank" ) // KVStore keys From 099592c47ef6320dc524bea9a56a02abde418532 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Mon, 18 Dec 2023 14:14:14 -0800 Subject: [PATCH 11/29] cherry pick: f3a4246e45 --- x/bank/keeper/send.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/x/bank/keeper/send.go b/x/bank/keeper/send.go index 764d090b8d04..1c5a967df696 100644 --- a/x/bank/keeper/send.go +++ b/x/bank/keeper/send.go @@ -338,6 +338,10 @@ func (k BaseSendKeeper) setBalance(ctx context.Context, addr sdk.AccAddress, bal } return nil } + + // set transient balance which will be emitted in EndBlock + k.setTransientBalance(sdk.UnwrapSDKContext(ctx), addr, balance) + return k.Balances.Set(ctx, collections.Join(addr, balance.Denom), balance.Amount) } From 8b4be440f5b5d98dddad6ab31d920356ec8639de Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Mon, 18 Dec 2023 14:20:09 -0800 Subject: [PATCH 12/29] cherry pick: 1fdb0f55bf --- baseapp/baseapp.go | 6 ++++++ baseapp/chain_stream.go | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 baseapp/chain_stream.go diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index 8de14c5f058b..a3198f8482f3 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -184,6 +184,9 @@ type BaseApp struct { // including the goroutine handling.This is experimental and must be enabled // by developers. optimisticExec *oe.OptimisticExecution + + // StreamEvents + StreamEvents chan StreamEvents } // NewBaseApp returns a reference to an initialized BaseApp. It accepts a @@ -203,6 +206,7 @@ func NewBaseApp( txDecoder: txDecoder, fauxMerkleMode: false, queryGasLimit: math.MaxUint64, + StreamEvents: make(chan StreamEvents), } for _, option := range options { @@ -719,6 +723,7 @@ func (app *BaseApp) beginBlock(req *abci.RequestFinalizeBlock) (sdk.BeginBlock, ) } + app.AddStreamEvents(app.finalizeBlockState.ctx.BlockHeight(), resp.Events, true) resp.Events = sdk.MarkEventsToIndex(resp.Events, app.indexEvents) } @@ -781,6 +786,7 @@ func (app *BaseApp) endBlock(ctx context.Context) (sdk.EndBlock, error) { ) } + app.AddStreamEvents(app.finalizeBlockState.ctx.BlockHeight(), eb.Events, true) eb.Events = sdk.MarkEventsToIndex(eb.Events, app.indexEvents) endblock = eb } diff --git a/baseapp/chain_stream.go b/baseapp/chain_stream.go new file mode 100644 index 000000000000..aae030b8d7ea --- /dev/null +++ b/baseapp/chain_stream.go @@ -0,0 +1,19 @@ +package baseapp + +import "github.com/cometbft/cometbft/abci/types" + +type StreamEvents struct { + Events []types.Event + Height uint64 + Flush bool +} + +func (app *BaseApp) AddStreamEvents(height int64, events []types.Event, flush bool) { + go func() { + app.StreamEvents <- StreamEvents{ + Events: events, + Height: uint64(height), + Flush: flush, + } + }() +} From 85b55192b537d03c0c1f1cc6e6e95b06fcc4f1ac Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Mon, 18 Dec 2023 14:21:09 -0800 Subject: [PATCH 13/29] cherry pick: 2a6009162 --- baseapp/baseapp.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index a3198f8482f3..ef1aa8d7c155 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -756,6 +756,8 @@ func (app *BaseApp) deliverTx(tx []byte) *abci.ExecTxResult { return resp } + app.AddStreamEvents(app.checkState.Context().BlockHeight(), result.Events, false) + resp = &abci.ExecTxResult{ GasWanted: int64(gInfo.GasWanted), GasUsed: int64(gInfo.GasUsed), From 68f66ced4321b183b376d7b188a384765a2a2c24 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Mon, 18 Dec 2023 14:22:11 -0800 Subject: [PATCH 14/29] cherry pick: cfbd896eb --- baseapp/chain_stream.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/baseapp/chain_stream.go b/baseapp/chain_stream.go index aae030b8d7ea..bc343619264b 100644 --- a/baseapp/chain_stream.go +++ b/baseapp/chain_stream.go @@ -1,14 +1,16 @@ package baseapp -import "github.com/cometbft/cometbft/abci/types" +import ( + abci "github.com/cometbft/cometbft/abci/types" +) type StreamEvents struct { - Events []types.Event + Events []abci.Event Height uint64 Flush bool } -func (app *BaseApp) AddStreamEvents(height int64, events []types.Event, flush bool) { +func (app *BaseApp) AddStreamEvents(height int64, events []abci.Event, flush bool) { go func() { app.StreamEvents <- StreamEvents{ Events: events, From 743451e1b17256a3c20fb3c37a1cd3e34cf53d64 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Mon, 18 Dec 2023 14:25:35 -0800 Subject: [PATCH 15/29] cherry pick: 88ca41d7bdf --- api/cosmos/authz/v1beta1/tx.pulsar.go | 682 ++++++++++++++++++++++++-- proto/cosmos/authz/v1beta1/tx.proto | 10 + x/authz/tx.pb.go | 286 +++++++++-- 3 files changed, 906 insertions(+), 72 deletions(-) diff --git a/api/cosmos/authz/v1beta1/tx.pulsar.go b/api/cosmos/authz/v1beta1/tx.pulsar.go index 9b2af65e42cc..84f00e4f1ce2 100644 --- a/api/cosmos/authz/v1beta1/tx.pulsar.go +++ b/api/cosmos/authz/v1beta1/tx.pulsar.go @@ -2878,6 +2878,550 @@ func (x *fastReflection_MsgRevokeResponse) ProtoMethods() *protoiface.Methods { } } +var _ protoreflect.List = (*_MsgExecCompat_2_list)(nil) + +type _MsgExecCompat_2_list struct { + list *[]string +} + +func (x *_MsgExecCompat_2_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_MsgExecCompat_2_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfString((*x.list)[i]) +} + +func (x *_MsgExecCompat_2_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.String() + concreteValue := valueUnwrapped + (*x.list)[i] = concreteValue +} + +func (x *_MsgExecCompat_2_list) Append(value protoreflect.Value) { + valueUnwrapped := value.String() + concreteValue := valueUnwrapped + *x.list = append(*x.list, concreteValue) +} + +func (x *_MsgExecCompat_2_list) AppendMutable() protoreflect.Value { + panic(fmt.Errorf("AppendMutable can not be called on message MsgExecCompat at list field Msgs as it is not of Message kind")) +} + +func (x *_MsgExecCompat_2_list) Truncate(n int) { + *x.list = (*x.list)[:n] +} + +func (x *_MsgExecCompat_2_list) NewElement() protoreflect.Value { + v := "" + return protoreflect.ValueOfString(v) +} + +func (x *_MsgExecCompat_2_list) IsValid() bool { + return x.list != nil +} + +var ( + md_MsgExecCompat protoreflect.MessageDescriptor + fd_MsgExecCompat_grantee protoreflect.FieldDescriptor + fd_MsgExecCompat_msgs protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_authz_v1beta1_tx_proto_init() + md_MsgExecCompat = File_cosmos_authz_v1beta1_tx_proto.Messages().ByName("MsgExecCompat") + fd_MsgExecCompat_grantee = md_MsgExecCompat.Fields().ByName("grantee") + fd_MsgExecCompat_msgs = md_MsgExecCompat.Fields().ByName("msgs") +} + +var _ protoreflect.Message = (*fastReflection_MsgExecCompat)(nil) + +type fastReflection_MsgExecCompat MsgExecCompat + +func (x *MsgExecCompat) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgExecCompat)(x) +} + +func (x *MsgExecCompat) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_authz_v1beta1_tx_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgExecCompat_messageType fastReflection_MsgExecCompat_messageType +var _ protoreflect.MessageType = fastReflection_MsgExecCompat_messageType{} + +type fastReflection_MsgExecCompat_messageType struct{} + +func (x fastReflection_MsgExecCompat_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgExecCompat)(nil) +} +func (x fastReflection_MsgExecCompat_messageType) New() protoreflect.Message { + return new(fastReflection_MsgExecCompat) +} +func (x fastReflection_MsgExecCompat_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgExecCompat +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgExecCompat) Descriptor() protoreflect.MessageDescriptor { + return md_MsgExecCompat +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgExecCompat) Type() protoreflect.MessageType { + return _fastReflection_MsgExecCompat_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgExecCompat) New() protoreflect.Message { + return new(fastReflection_MsgExecCompat) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgExecCompat) Interface() protoreflect.ProtoMessage { + return (*MsgExecCompat)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgExecCompat) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Grantee != "" { + value := protoreflect.ValueOfString(x.Grantee) + if !f(fd_MsgExecCompat_grantee, value) { + return + } + } + if len(x.Msgs) != 0 { + value := protoreflect.ValueOfList(&_MsgExecCompat_2_list{list: &x.Msgs}) + if !f(fd_MsgExecCompat_msgs, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgExecCompat) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.authz.v1beta1.MsgExecCompat.grantee": + return x.Grantee != "" + case "cosmos.authz.v1beta1.MsgExecCompat.msgs": + return len(x.Msgs) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.MsgExecCompat")) + } + panic(fmt.Errorf("message cosmos.authz.v1beta1.MsgExecCompat does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgExecCompat) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.authz.v1beta1.MsgExecCompat.grantee": + x.Grantee = "" + case "cosmos.authz.v1beta1.MsgExecCompat.msgs": + x.Msgs = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.MsgExecCompat")) + } + panic(fmt.Errorf("message cosmos.authz.v1beta1.MsgExecCompat does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgExecCompat) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.authz.v1beta1.MsgExecCompat.grantee": + value := x.Grantee + return protoreflect.ValueOfString(value) + case "cosmos.authz.v1beta1.MsgExecCompat.msgs": + if len(x.Msgs) == 0 { + return protoreflect.ValueOfList(&_MsgExecCompat_2_list{}) + } + listValue := &_MsgExecCompat_2_list{list: &x.Msgs} + return protoreflect.ValueOfList(listValue) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.MsgExecCompat")) + } + panic(fmt.Errorf("message cosmos.authz.v1beta1.MsgExecCompat does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgExecCompat) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.authz.v1beta1.MsgExecCompat.grantee": + x.Grantee = value.Interface().(string) + case "cosmos.authz.v1beta1.MsgExecCompat.msgs": + lv := value.List() + clv := lv.(*_MsgExecCompat_2_list) + x.Msgs = *clv.list + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.MsgExecCompat")) + } + panic(fmt.Errorf("message cosmos.authz.v1beta1.MsgExecCompat does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgExecCompat) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.authz.v1beta1.MsgExecCompat.msgs": + if x.Msgs == nil { + x.Msgs = []string{} + } + value := &_MsgExecCompat_2_list{list: &x.Msgs} + return protoreflect.ValueOfList(value) + case "cosmos.authz.v1beta1.MsgExecCompat.grantee": + panic(fmt.Errorf("field grantee of message cosmos.authz.v1beta1.MsgExecCompat is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.MsgExecCompat")) + } + panic(fmt.Errorf("message cosmos.authz.v1beta1.MsgExecCompat does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgExecCompat) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.authz.v1beta1.MsgExecCompat.grantee": + return protoreflect.ValueOfString("") + case "cosmos.authz.v1beta1.MsgExecCompat.msgs": + list := []string{} + return protoreflect.ValueOfList(&_MsgExecCompat_2_list{list: &list}) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.MsgExecCompat")) + } + panic(fmt.Errorf("message cosmos.authz.v1beta1.MsgExecCompat does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgExecCompat) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.authz.v1beta1.MsgExecCompat", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgExecCompat) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgExecCompat) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgExecCompat) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgExecCompat) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgExecCompat) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Grantee) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if len(x.Msgs) > 0 { + for _, s := range x.Msgs { + l = len(s) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgExecCompat) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Msgs) > 0 { + for iNdEx := len(x.Msgs) - 1; iNdEx >= 0; iNdEx-- { + i -= len(x.Msgs[iNdEx]) + copy(dAtA[i:], x.Msgs[iNdEx]) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Msgs[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if len(x.Grantee) > 0 { + i -= len(x.Grantee) + copy(dAtA[i:], x.Grantee) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Grantee))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgExecCompat) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgExecCompat: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgExecCompat: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Grantee", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Grantee = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Msgs", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Msgs = append(x.Msgs, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + // Since: cosmos-sdk 0.43 // Code generated by protoc-gen-go. DO NOT EDIT. @@ -3138,6 +3682,51 @@ func (*MsgRevokeResponse) Descriptor() ([]byte, []int) { return file_cosmos_authz_v1beta1_tx_proto_rawDescGZIP(), []int{5} } +// MsgExecCompat supports legacy amino codec for frontend metamask signing +// Functions are same as MsgExec, but input for msgs is array of strings +type MsgExecCompat struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Grantee string `protobuf:"bytes,1,opt,name=grantee,proto3" json:"grantee,omitempty"` + Msgs []string `protobuf:"bytes,2,rep,name=msgs,proto3" json:"msgs,omitempty"` +} + +func (x *MsgExecCompat) Reset() { + *x = MsgExecCompat{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_authz_v1beta1_tx_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgExecCompat) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgExecCompat) ProtoMessage() {} + +// Deprecated: Use MsgExecCompat.ProtoReflect.Descriptor instead. +func (*MsgExecCompat) Descriptor() ([]byte, []int) { + return file_cosmos_authz_v1beta1_tx_proto_rawDescGZIP(), []int{6} +} + +func (x *MsgExecCompat) GetGrantee() string { + if x != nil { + return x.Grantee + } + return "" +} + +func (x *MsgExecCompat) GetMsgs() []string { + if x != nil { + return x.Msgs + } + return nil +} + var File_cosmos_authz_v1beta1_tx_proto protoreflect.FileDescriptor var file_cosmos_authz_v1beta1_tx_proto_rawDesc = []byte{ @@ -3195,37 +3784,45 @@ var file_cosmos_authz_v1beta1_tx_proto_rawDesc = []byte{ 0xe7, 0xb0, 0x2a, 0x07, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x65, 0x72, 0x8a, 0xe7, 0xb0, 0x2a, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x22, 0x13, 0x0a, 0x11, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x76, 0x6f, 0x6b, - 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xff, 0x01, 0x0a, 0x03, 0x4d, 0x73, - 0x67, 0x12, 0x4f, 0x0a, 0x05, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x12, 0x1e, 0x2e, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, - 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x1a, 0x26, 0x2e, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, - 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x4c, 0x0a, 0x04, 0x45, 0x78, 0x65, 0x63, 0x12, 0x1d, 0x2e, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, - 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x1a, 0x25, 0x2e, 0x63, 0x6f, 0x73, 0x6d, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x7c, 0x0a, 0x0d, 0x4d, 0x73, 0x67, + 0x45, 0x78, 0x65, 0x63, 0x43, 0x6f, 0x6d, 0x70, 0x61, 0x74, 0x12, 0x32, 0x0a, 0x07, 0x67, 0x72, + 0x61, 0x6e, 0x74, 0x65, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, + 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, + 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x65, 0x65, 0x12, 0x12, + 0x0a, 0x04, 0x6d, 0x73, 0x67, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x6d, 0x73, + 0x67, 0x73, 0x3a, 0x23, 0x82, 0xe7, 0xb0, 0x2a, 0x07, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x65, 0x65, + 0x8a, 0xe7, 0xb0, 0x2a, 0x12, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, + 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x32, 0xff, 0x01, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, + 0x4f, 0x0a, 0x05, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x12, 0x1e, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, + 0x4d, 0x73, 0x67, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x1a, 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, + 0x4d, 0x73, 0x67, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x4c, 0x0a, 0x04, 0x45, 0x78, 0x65, 0x63, 0x12, 0x1d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, + 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x1a, 0x25, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, + 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x52, + 0x0a, 0x06, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x12, 0x1f, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, + 0x4d, 0x73, 0x67, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x1a, 0x27, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, - 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x52, 0x0a, 0x06, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x12, 0x1f, 0x2e, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, - 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x1a, 0x27, 0x2e, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, - 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xcd, 0x01, 0x0a, 0x18, - 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, - 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x50, 0x01, 0x5a, 0x32, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, - 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x75, 0x74, - 0x68, 0x7a, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x61, 0x75, 0x74, 0x68, 0x7a, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x41, 0x58, 0xaa, 0x02, 0x14, - 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x56, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x14, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x75, - 0x74, 0x68, 0x7a, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x20, 0x43, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x75, 0x74, 0x68, 0x7a, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, - 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, - 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x75, 0x74, 0x68, 0x7a, 0x3a, 0x3a, - 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xc8, 0xe1, 0x1e, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xcd, 0x01, 0x0a, 0x18, 0x63, 0x6f, + 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x76, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, + 0x01, 0x5a, 0x32, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x7a, + 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x76, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x41, 0x58, 0xaa, 0x02, 0x14, 0x43, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0xca, 0x02, 0x14, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x75, 0x74, 0x68, + 0x7a, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x20, 0x43, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x5c, 0x41, 0x75, 0x74, 0x68, 0x7a, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x16, 0x43, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x75, 0x74, 0x68, 0x7a, 0x3a, 0x3a, 0x56, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0xc8, 0xe1, 0x1e, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( @@ -3240,7 +3837,7 @@ func file_cosmos_authz_v1beta1_tx_proto_rawDescGZIP() []byte { return file_cosmos_authz_v1beta1_tx_proto_rawDescData } -var file_cosmos_authz_v1beta1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_cosmos_authz_v1beta1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 7) var file_cosmos_authz_v1beta1_tx_proto_goTypes = []interface{}{ (*MsgGrant)(nil), // 0: cosmos.authz.v1beta1.MsgGrant (*MsgGrantResponse)(nil), // 1: cosmos.authz.v1beta1.MsgGrantResponse @@ -3248,12 +3845,13 @@ var file_cosmos_authz_v1beta1_tx_proto_goTypes = []interface{}{ (*MsgExecResponse)(nil), // 3: cosmos.authz.v1beta1.MsgExecResponse (*MsgRevoke)(nil), // 4: cosmos.authz.v1beta1.MsgRevoke (*MsgRevokeResponse)(nil), // 5: cosmos.authz.v1beta1.MsgRevokeResponse - (*Grant)(nil), // 6: cosmos.authz.v1beta1.Grant - (*anypb.Any)(nil), // 7: google.protobuf.Any + (*MsgExecCompat)(nil), // 6: cosmos.authz.v1beta1.MsgExecCompat + (*Grant)(nil), // 7: cosmos.authz.v1beta1.Grant + (*anypb.Any)(nil), // 8: google.protobuf.Any } var file_cosmos_authz_v1beta1_tx_proto_depIdxs = []int32{ - 6, // 0: cosmos.authz.v1beta1.MsgGrant.grant:type_name -> cosmos.authz.v1beta1.Grant - 7, // 1: cosmos.authz.v1beta1.MsgExec.msgs:type_name -> google.protobuf.Any + 7, // 0: cosmos.authz.v1beta1.MsgGrant.grant:type_name -> cosmos.authz.v1beta1.Grant + 8, // 1: cosmos.authz.v1beta1.MsgExec.msgs:type_name -> google.protobuf.Any 0, // 2: cosmos.authz.v1beta1.Msg.Grant:input_type -> cosmos.authz.v1beta1.MsgGrant 2, // 3: cosmos.authz.v1beta1.Msg.Exec:input_type -> cosmos.authz.v1beta1.MsgExec 4, // 4: cosmos.authz.v1beta1.Msg.Revoke:input_type -> cosmos.authz.v1beta1.MsgRevoke @@ -3346,6 +3944,18 @@ func file_cosmos_authz_v1beta1_tx_proto_init() { return nil } } + file_cosmos_authz_v1beta1_tx_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgExecCompat); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -3353,7 +3963,7 @@ func file_cosmos_authz_v1beta1_tx_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_cosmos_authz_v1beta1_tx_proto_rawDesc, NumEnums: 0, - NumMessages: 6, + NumMessages: 7, NumExtensions: 0, NumServices: 1, }, diff --git a/proto/cosmos/authz/v1beta1/tx.proto b/proto/cosmos/authz/v1beta1/tx.proto index a1abff0d6f00..b5366a07a6fd 100644 --- a/proto/cosmos/authz/v1beta1/tx.proto +++ b/proto/cosmos/authz/v1beta1/tx.proto @@ -79,3 +79,13 @@ message MsgRevoke { // MsgRevokeResponse defines the Msg/MsgRevokeResponse response type. message MsgRevokeResponse {} + +// MsgExecCompat supports legacy amino codec for frontend metamask signing +// Functions are same as MsgExec, but input for msgs is array of strings +message MsgExecCompat { + option (cosmos.msg.v1.signer) = "grantee"; + option (amino.name) = "cosmos-sdk/MsgExec"; + + string grantee = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + repeated string msgs = 2; +} \ No newline at end of file diff --git a/x/authz/tx.pb.go b/x/authz/tx.pb.go index efbb15db7cc7..b6cb94d2e8cd 100644 --- a/x/authz/tx.pb.go +++ b/x/authz/tx.pb.go @@ -270,6 +270,46 @@ func (m *MsgRevokeResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgRevokeResponse proto.InternalMessageInfo +// MsgExecCompat supports legacy amino codec for frontend metamask signing +// Functions are same as MsgExec, but input for msgs is array of strings +type MsgExecCompat struct { + Grantee string `protobuf:"bytes,1,opt,name=grantee,proto3" json:"grantee,omitempty"` + Msgs []string `protobuf:"bytes,2,rep,name=msgs,proto3" json:"msgs,omitempty"` +} + +func (m *MsgExecCompat) Reset() { *m = MsgExecCompat{} } +func (m *MsgExecCompat) String() string { return proto.CompactTextString(m) } +func (*MsgExecCompat) ProtoMessage() {} +func (*MsgExecCompat) Descriptor() ([]byte, []int) { + return fileDescriptor_3ceddab7d8589ad1, []int{6} +} +func (m *MsgExecCompat) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgExecCompat) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgExecCompat.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 *MsgExecCompat) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgExecCompat.Merge(m, src) +} +func (m *MsgExecCompat) XXX_Size() int { + return m.Size() +} +func (m *MsgExecCompat) XXX_DiscardUnknown() { + xxx_messageInfo_MsgExecCompat.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgExecCompat proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgGrant)(nil), "cosmos.authz.v1beta1.MsgGrant") proto.RegisterType((*MsgGrantResponse)(nil), "cosmos.authz.v1beta1.MsgGrantResponse") @@ -277,47 +317,49 @@ func init() { proto.RegisterType((*MsgExecResponse)(nil), "cosmos.authz.v1beta1.MsgExecResponse") proto.RegisterType((*MsgRevoke)(nil), "cosmos.authz.v1beta1.MsgRevoke") proto.RegisterType((*MsgRevokeResponse)(nil), "cosmos.authz.v1beta1.MsgRevokeResponse") + proto.RegisterType((*MsgExecCompat)(nil), "cosmos.authz.v1beta1.MsgExecCompat") } func init() { proto.RegisterFile("cosmos/authz/v1beta1/tx.proto", fileDescriptor_3ceddab7d8589ad1) } var fileDescriptor_3ceddab7d8589ad1 = []byte{ - // 555 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x54, 0xbf, 0x6e, 0x13, 0x4f, - 0x10, 0xf6, 0xc6, 0x71, 0xfc, 0xf3, 0x26, 0xd2, 0x8f, 0x5c, 0x2c, 0x71, 0xb9, 0x28, 0x97, 0xd3, - 0x91, 0x80, 0x65, 0xe4, 0x5d, 0xd9, 0x74, 0x16, 0x4d, 0x2c, 0x45, 0x34, 0x58, 0x48, 0x07, 0x34, - 0x34, 0xd6, 0xd9, 0x5e, 0x36, 0x56, 0x7c, 0xb7, 0xd6, 0xed, 0xd9, 0xb2, 0xa9, 0x10, 0x25, 0x15, - 0x8f, 0x01, 0x9d, 0x8b, 0x94, 0x3c, 0x80, 0x45, 0x15, 0x51, 0x20, 0x2a, 0x04, 0x76, 0xe1, 0xc7, - 0x00, 0xdd, 0xfe, 0x31, 0x0e, 0x72, 0x42, 0x2a, 0x9a, 0xbb, 0x99, 0xf9, 0xbe, 0xd9, 0x9d, 0x6f, - 0x66, 0xb4, 0x70, 0xbf, 0xc5, 0x78, 0xc0, 0x38, 0xf6, 0xfb, 0xf1, 0xe9, 0x2b, 0x3c, 0x28, 0x37, - 0x49, 0xec, 0x97, 0x71, 0x3c, 0x44, 0xbd, 0x88, 0xc5, 0xcc, 0xc8, 0x4b, 0x18, 0x09, 0x18, 0x29, - 0xd8, 0xda, 0x95, 0xd1, 0x86, 0xe0, 0x60, 0x45, 0x11, 0x8e, 0x95, 0xa7, 0x8c, 0x32, 0x19, 0x4f, - 0x2c, 0x15, 0xdd, 0xa5, 0x8c, 0xd1, 0x2e, 0xc1, 0xc2, 0x6b, 0xf6, 0x5f, 0x62, 0x3f, 0x1c, 0x29, - 0xc8, 0x59, 0x59, 0x80, 0xbc, 0x4f, 0x32, 0x6e, 0x2b, 0x46, 0xc0, 0x29, 0x1e, 0x94, 0x93, 0x9f, - 0x02, 0xb6, 0xfd, 0xa0, 0x13, 0x32, 0x2c, 0xbe, 0x32, 0xe4, 0x7e, 0x01, 0xf0, 0xbf, 0x3a, 0xa7, - 0x8f, 0x22, 0x3f, 0x8c, 0x8d, 0x0a, 0xcc, 0xd2, 0xc4, 0x20, 0x91, 0x09, 0x1c, 0x50, 0xc8, 0xd5, - 0xcc, 0xcf, 0xe7, 0x25, 0xad, 0xe8, 0xb8, 0xdd, 0x8e, 0x08, 0xe7, 0x4f, 0xe3, 0xa8, 0x13, 0x52, - 0x4f, 0x13, 0x7f, 0xe7, 0x10, 0x73, 0xed, 0x66, 0x39, 0xc4, 0x78, 0x08, 0x33, 0xc2, 0x34, 0xd3, - 0x0e, 0x28, 0x6c, 0x56, 0xf6, 0xd0, 0xaa, 0xa6, 0x21, 0x51, 0x53, 0x2d, 0x37, 0xf9, 0x76, 0x90, - 0x7a, 0x3f, 0x1f, 0x17, 0x81, 0x27, 0x93, 0xaa, 0x87, 0x6f, 0xe6, 0xe3, 0xa2, 0xbe, 0xff, 0xed, - 0x7c, 0x5c, 0xdc, 0x91, 0xe9, 0x25, 0xde, 0x3e, 0xc3, 0x5a, 0x8b, 0x6b, 0xc0, 0x5b, 0xda, 0xf6, - 0x08, 0xef, 0xb1, 0x90, 0x13, 0xf7, 0x03, 0x80, 0xd9, 0x3a, 0xa7, 0x27, 0x43, 0xd2, 0x5a, 0xae, - 0x1b, 0xdc, 0xb4, 0xee, 0x13, 0xb8, 0x1e, 0x70, 0xca, 0xcd, 0x35, 0x27, 0x5d, 0xd8, 0xac, 0xe4, - 0x91, 0x1c, 0x12, 0xd2, 0x43, 0x42, 0xc7, 0xe1, 0xa8, 0xb6, 0xf7, 0xe9, 0xbc, 0xa4, 0x06, 0x80, - 0x9a, 0x3e, 0x27, 0x0b, 0x39, 0x75, 0x4e, 0x3d, 0x91, 0x5e, 0xbd, 0xb3, 0x24, 0x80, 0x24, 0x02, - 0x8c, 0xcb, 0x02, 0x92, 0xfa, 0xdc, 0xfb, 0xf0, 0x7f, 0x65, 0xea, 0xf2, 0x0d, 0x13, 0x66, 0x23, - 0xc2, 0xfb, 0xdd, 0x98, 0x9b, 0xc0, 0x49, 0x17, 0xb6, 0x3c, 0xed, 0xba, 0x1f, 0x01, 0xcc, 0x25, - 0xe7, 0x93, 0x01, 0x3b, 0x23, 0xff, 0x6c, 0x8c, 0x0e, 0xdc, 0x0a, 0x38, 0x6d, 0xc4, 0xa3, 0x1e, - 0x69, 0xf4, 0xa3, 0xae, 0x98, 0x66, 0xce, 0x83, 0x01, 0xa7, 0xcf, 0x46, 0x3d, 0xf2, 0x3c, 0xea, - 0x56, 0x8f, 0xfe, 0x1c, 0x55, 0xfe, 0xb2, 0x52, 0x59, 0xb0, 0xbb, 0x03, 0xb7, 0x17, 0x8e, 0x56, - 0x5b, 0xf9, 0x09, 0x60, 0xba, 0xce, 0xa9, 0xf1, 0x04, 0x66, 0xe4, 0x76, 0xda, 0xab, 0xd7, 0x44, - 0x4f, 0xd9, 0xba, 0x7b, 0x3d, 0xbe, 0x68, 0xe3, 0x63, 0xb8, 0x2e, 0x36, 0x60, 0xff, 0x4a, 0x7e, - 0x02, 0x5b, 0x47, 0xd7, 0xc2, 0x8b, 0xd3, 0x3c, 0xb8, 0xa1, 0xda, 0x7e, 0x70, 0x65, 0x82, 0x24, - 0x58, 0xf7, 0xfe, 0x42, 0xd0, 0x67, 0x5a, 0x99, 0xd7, 0xc9, 0xbe, 0xd7, 0x6a, 0x93, 0x1f, 0x76, - 0x6a, 0x32, 0xb5, 0xc1, 0xc5, 0xd4, 0x06, 0xdf, 0xa7, 0x36, 0x78, 0x37, 0xb3, 0x53, 0x17, 0x33, - 0x3b, 0xf5, 0x75, 0x66, 0xa7, 0x5e, 0x1c, 0xd2, 0x4e, 0x7c, 0xda, 0x6f, 0xa2, 0x16, 0x0b, 0xd4, - 0x8b, 0x82, 0x97, 0x9a, 0x3b, 0x94, 0x2f, 0x42, 0x73, 0x43, 0x2c, 0xe7, 0x83, 0x5f, 0x01, 0x00, - 0x00, 0xff, 0xff, 0x13, 0x38, 0x6d, 0x34, 0xb7, 0x04, 0x00, 0x00, + // 575 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x54, 0x3f, 0x6f, 0xd3, 0x40, + 0x14, 0xcf, 0x35, 0x6d, 0x43, 0xae, 0x45, 0x50, 0x37, 0x12, 0xae, 0xab, 0xba, 0x96, 0x69, 0x21, + 0x0a, 0x8a, 0xad, 0x84, 0x2d, 0x62, 0x69, 0x50, 0xc5, 0x42, 0x84, 0x64, 0x60, 0x61, 0x89, 0x9c, + 0xe4, 0xb8, 0x46, 0x8d, 0x7d, 0x91, 0xef, 0x12, 0x25, 0x88, 0x01, 0x31, 0x32, 0xf1, 0x31, 0x60, + 0xcb, 0xd0, 0x91, 0x0f, 0x10, 0x31, 0x55, 0x0c, 0x88, 0x09, 0x41, 0x32, 0xe4, 0x63, 0x80, 0x7c, + 0x7f, 0x4c, 0x8a, 0xd2, 0x52, 0x18, 0x58, 0xec, 0xf7, 0xde, 0xef, 0xf7, 0xee, 0xde, 0x7b, 0xbf, + 0xbb, 0x83, 0x3b, 0x4d, 0x42, 0x03, 0x42, 0x5d, 0xbf, 0xc7, 0x8e, 0x5e, 0xb8, 0xfd, 0x52, 0x03, + 0x31, 0xbf, 0xe4, 0xb2, 0x81, 0xd3, 0x8d, 0x08, 0x23, 0x5a, 0x4e, 0xc0, 0x0e, 0x87, 0x1d, 0x09, + 0x1b, 0x5b, 0x22, 0x5a, 0xe7, 0x1c, 0x57, 0x52, 0xb8, 0x63, 0xe4, 0x30, 0xc1, 0x44, 0xc4, 0x63, + 0x4b, 0x46, 0xb7, 0x30, 0x21, 0xb8, 0x83, 0x5c, 0xee, 0x35, 0x7a, 0xcf, 0x5d, 0x3f, 0x1c, 0x4a, + 0xc8, 0x5a, 0x58, 0x80, 0xd8, 0x4f, 0x30, 0x6e, 0x48, 0x46, 0x40, 0xb1, 0xdb, 0x2f, 0xc5, 0x3f, + 0x09, 0x6c, 0xf8, 0x41, 0x3b, 0x24, 0x2e, 0xff, 0x8a, 0x90, 0xfd, 0x19, 0xc0, 0x2b, 0x35, 0x8a, + 0x1f, 0x44, 0x7e, 0xc8, 0xb4, 0x32, 0xcc, 0xe0, 0xd8, 0x40, 0x91, 0x0e, 0x2c, 0x90, 0xcf, 0x56, + 0xf5, 0x4f, 0x27, 0x45, 0xd5, 0xd1, 0x41, 0xab, 0x15, 0x21, 0x4a, 0x1f, 0xb3, 0xa8, 0x1d, 0x62, + 0x4f, 0x11, 0x7f, 0xe5, 0x20, 0x7d, 0xe9, 0x72, 0x39, 0x48, 0xbb, 0x07, 0x57, 0xb8, 0xa9, 0xa7, + 0x2d, 0x90, 0x5f, 0x2b, 0x6f, 0x3b, 0x8b, 0x86, 0xe6, 0xf0, 0x9a, 0xaa, 0xd9, 0xf1, 0xd7, 0xdd, + 0xd4, 0xbb, 0xd9, 0xa8, 0x00, 0x3c, 0x91, 0x54, 0xd9, 0x7b, 0x3d, 0x1b, 0x15, 0xd4, 0xfe, 0x6f, + 0x66, 0xa3, 0xc2, 0xa6, 0x48, 0x2f, 0xd2, 0xd6, 0xb1, 0xab, 0x7a, 0xb1, 0x35, 0x78, 0x5d, 0xd9, + 0x1e, 0xa2, 0x5d, 0x12, 0x52, 0x64, 0xbf, 0x07, 0x30, 0x53, 0xa3, 0xf8, 0x70, 0x80, 0x9a, 0xf3, + 0x75, 0x83, 0xcb, 0xd6, 0x7d, 0x08, 0x97, 0x03, 0x8a, 0xa9, 0xbe, 0x64, 0xa5, 0xf3, 0x6b, 0xe5, + 0x9c, 0x23, 0x44, 0x72, 0x94, 0x48, 0xce, 0x41, 0x38, 0xac, 0x6e, 0x7f, 0x3c, 0x29, 0x4a, 0x01, + 0x9c, 0x86, 0x4f, 0x51, 0xd2, 0x4e, 0x8d, 0x62, 0x8f, 0xa7, 0x57, 0x6e, 0xce, 0x35, 0x80, 0xe2, + 0x06, 0xb4, 0xb3, 0x0d, 0xc4, 0xf5, 0xd9, 0x77, 0xe0, 0x35, 0x69, 0xaa, 0xf2, 0x35, 0x1d, 0x66, + 0x22, 0x44, 0x7b, 0x1d, 0x46, 0x75, 0x60, 0xa5, 0xf3, 0xeb, 0x9e, 0x72, 0xed, 0x0f, 0x00, 0x66, + 0xe3, 0xf5, 0x51, 0x9f, 0x1c, 0xa3, 0xff, 0x26, 0xa3, 0x05, 0xd7, 0x03, 0x8a, 0xeb, 0x6c, 0xd8, + 0x45, 0xf5, 0x5e, 0xd4, 0xe1, 0x6a, 0x66, 0x3d, 0x18, 0x50, 0xfc, 0x64, 0xd8, 0x45, 0x4f, 0xa3, + 0x4e, 0x65, 0xff, 0x77, 0xa9, 0x72, 0x67, 0x3b, 0x15, 0x05, 0xdb, 0x9b, 0x70, 0x23, 0x71, 0x12, + 0xb1, 0x5e, 0xc2, 0xab, 0x72, 0x00, 0xf7, 0x49, 0xd0, 0xf5, 0xd9, 0x3f, 0x29, 0xa6, 0xcd, 0x29, + 0x96, 0xfd, 0x8b, 0xf1, 0x97, 0x7f, 0x00, 0x98, 0xae, 0x51, 0xac, 0x3d, 0x82, 0x2b, 0xe2, 0x6e, + 0x98, 0x8b, 0x0f, 0xa9, 0x3a, 0x63, 0xc6, 0xad, 0x8b, 0xf1, 0x44, 0xc4, 0x87, 0x70, 0x99, 0x9f, + 0xbf, 0x9d, 0x73, 0xf9, 0x31, 0x6c, 0xec, 0x5f, 0x08, 0x27, 0xab, 0x79, 0x70, 0x55, 0x8a, 0xbe, + 0x7b, 0x6e, 0x82, 0x20, 0x18, 0xb7, 0xff, 0x40, 0x50, 0x6b, 0x1a, 0x2b, 0xaf, 0xe2, 0xdb, 0x56, + 0xad, 0x8e, 0xbf, 0x9b, 0xa9, 0xf1, 0xc4, 0x04, 0xa7, 0x13, 0x13, 0x7c, 0x9b, 0x98, 0xe0, 0xed, + 0xd4, 0x4c, 0x9d, 0x4e, 0xcd, 0xd4, 0x97, 0xa9, 0x99, 0x7a, 0xb6, 0x87, 0xdb, 0xec, 0xa8, 0xd7, + 0x70, 0x9a, 0x24, 0x90, 0xef, 0x99, 0x3b, 0x37, 0xc5, 0x81, 0x78, 0x8f, 0x1a, 0xab, 0xfc, 0x6a, + 0xdc, 0xfd, 0x19, 0x00, 0x00, 0xff, 0xff, 0x69, 0x9d, 0x3b, 0x3c, 0x35, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -703,6 +745,45 @@ func (m *MsgRevokeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *MsgExecCompat) 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 *MsgExecCompat) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgExecCompat) 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-- { + i -= len(m.Msgs[iNdEx]) + copy(dAtA[i:], m.Msgs[iNdEx]) + i = encodeVarintTx(dAtA, i, uint64(len(m.Msgs[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if len(m.Grantee) > 0 { + i -= len(m.Grantee) + copy(dAtA[i:], m.Grantee) + i = encodeVarintTx(dAtA, i, uint64(len(m.Grantee))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -806,6 +887,25 @@ func (m *MsgRevokeResponse) Size() (n int) { return n } +func (m *MsgExecCompat) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Grantee) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Msgs) > 0 { + for _, s := range m.Msgs { + l = len(s) + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1403,6 +1503,120 @@ func (m *MsgRevokeResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgExecCompat) 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: MsgExecCompat: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgExecCompat: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Grantee", 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.Grantee = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Msgs", 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.Msgs = append(m.Msgs, string(dAtA[iNdEx:postIndex])) + 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 From bae333c6a57127885b989aea4ead2e020f596d4f Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Mon, 18 Dec 2023 14:28:41 -0800 Subject: [PATCH 16/29] cherry pick: 88ca41d7bdf --- api/cosmos/authz/v1beta1/tx.pulsar.go | 666 ++++++++++++++++++++++--- api/cosmos/authz/v1beta1/tx_grpc.pb.go | 51 +- proto/cosmos/authz/v1beta1/tx.proto | 21 +- x/authz/tx.pb.go | 298 +++++++++-- 4 files changed, 913 insertions(+), 123 deletions(-) diff --git a/api/cosmos/authz/v1beta1/tx.pulsar.go b/api/cosmos/authz/v1beta1/tx.pulsar.go index 84f00e4f1ce2..40dd5f20fc42 100644 --- a/api/cosmos/authz/v1beta1/tx.pulsar.go +++ b/api/cosmos/authz/v1beta1/tx.pulsar.go @@ -2878,6 +2878,486 @@ func (x *fastReflection_MsgRevokeResponse) ProtoMethods() *protoiface.Methods { } } +var _ protoreflect.List = (*_MsgExecCompatResponse_1_list)(nil) + +type _MsgExecCompatResponse_1_list struct { + list *[][]byte +} + +func (x *_MsgExecCompatResponse_1_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_MsgExecCompatResponse_1_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfBytes((*x.list)[i]) +} + +func (x *_MsgExecCompatResponse_1_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Bytes() + concreteValue := valueUnwrapped + (*x.list)[i] = concreteValue +} + +func (x *_MsgExecCompatResponse_1_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Bytes() + concreteValue := valueUnwrapped + *x.list = append(*x.list, concreteValue) +} + +func (x *_MsgExecCompatResponse_1_list) AppendMutable() protoreflect.Value { + panic(fmt.Errorf("AppendMutable can not be called on message MsgExecCompatResponse at list field Results as it is not of Message kind")) +} + +func (x *_MsgExecCompatResponse_1_list) Truncate(n int) { + *x.list = (*x.list)[:n] +} + +func (x *_MsgExecCompatResponse_1_list) NewElement() protoreflect.Value { + var v []byte + return protoreflect.ValueOfBytes(v) +} + +func (x *_MsgExecCompatResponse_1_list) IsValid() bool { + return x.list != nil +} + +var ( + md_MsgExecCompatResponse protoreflect.MessageDescriptor + fd_MsgExecCompatResponse_results protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_authz_v1beta1_tx_proto_init() + md_MsgExecCompatResponse = File_cosmos_authz_v1beta1_tx_proto.Messages().ByName("MsgExecCompatResponse") + fd_MsgExecCompatResponse_results = md_MsgExecCompatResponse.Fields().ByName("results") +} + +var _ protoreflect.Message = (*fastReflection_MsgExecCompatResponse)(nil) + +type fastReflection_MsgExecCompatResponse MsgExecCompatResponse + +func (x *MsgExecCompatResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgExecCompatResponse)(x) +} + +func (x *MsgExecCompatResponse) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_authz_v1beta1_tx_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgExecCompatResponse_messageType fastReflection_MsgExecCompatResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgExecCompatResponse_messageType{} + +type fastReflection_MsgExecCompatResponse_messageType struct{} + +func (x fastReflection_MsgExecCompatResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgExecCompatResponse)(nil) +} +func (x fastReflection_MsgExecCompatResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgExecCompatResponse) +} +func (x fastReflection_MsgExecCompatResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgExecCompatResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgExecCompatResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgExecCompatResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgExecCompatResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgExecCompatResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgExecCompatResponse) New() protoreflect.Message { + return new(fastReflection_MsgExecCompatResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgExecCompatResponse) Interface() protoreflect.ProtoMessage { + return (*MsgExecCompatResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgExecCompatResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.Results) != 0 { + value := protoreflect.ValueOfList(&_MsgExecCompatResponse_1_list{list: &x.Results}) + if !f(fd_MsgExecCompatResponse_results, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgExecCompatResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.authz.v1beta1.MsgExecCompatResponse.results": + return len(x.Results) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.MsgExecCompatResponse")) + } + panic(fmt.Errorf("message cosmos.authz.v1beta1.MsgExecCompatResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgExecCompatResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.authz.v1beta1.MsgExecCompatResponse.results": + x.Results = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.MsgExecCompatResponse")) + } + panic(fmt.Errorf("message cosmos.authz.v1beta1.MsgExecCompatResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgExecCompatResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.authz.v1beta1.MsgExecCompatResponse.results": + if len(x.Results) == 0 { + return protoreflect.ValueOfList(&_MsgExecCompatResponse_1_list{}) + } + listValue := &_MsgExecCompatResponse_1_list{list: &x.Results} + return protoreflect.ValueOfList(listValue) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.MsgExecCompatResponse")) + } + panic(fmt.Errorf("message cosmos.authz.v1beta1.MsgExecCompatResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgExecCompatResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.authz.v1beta1.MsgExecCompatResponse.results": + lv := value.List() + clv := lv.(*_MsgExecCompatResponse_1_list) + x.Results = *clv.list + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.MsgExecCompatResponse")) + } + panic(fmt.Errorf("message cosmos.authz.v1beta1.MsgExecCompatResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgExecCompatResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.authz.v1beta1.MsgExecCompatResponse.results": + if x.Results == nil { + x.Results = [][]byte{} + } + value := &_MsgExecCompatResponse_1_list{list: &x.Results} + return protoreflect.ValueOfList(value) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.MsgExecCompatResponse")) + } + panic(fmt.Errorf("message cosmos.authz.v1beta1.MsgExecCompatResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgExecCompatResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.authz.v1beta1.MsgExecCompatResponse.results": + list := [][]byte{} + return protoreflect.ValueOfList(&_MsgExecCompatResponse_1_list{list: &list}) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.authz.v1beta1.MsgExecCompatResponse")) + } + panic(fmt.Errorf("message cosmos.authz.v1beta1.MsgExecCompatResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgExecCompatResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.authz.v1beta1.MsgExecCompatResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgExecCompatResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgExecCompatResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgExecCompatResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgExecCompatResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgExecCompatResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if len(x.Results) > 0 { + for _, b := range x.Results { + l = len(b) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgExecCompatResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Results) > 0 { + for iNdEx := len(x.Results) - 1; iNdEx >= 0; iNdEx-- { + i -= len(x.Results[iNdEx]) + copy(dAtA[i:], x.Results[iNdEx]) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Results[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgExecCompatResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgExecCompatResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgExecCompatResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Results", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Results = append(x.Results, make([]byte, postIndex-iNdEx)) + copy(x.Results[len(x.Results)-1], dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + var _ protoreflect.List = (*_MsgExecCompat_2_list)(nil) type _MsgExecCompat_2_list struct { @@ -2946,7 +3426,7 @@ func (x *MsgExecCompat) ProtoReflect() protoreflect.Message { } func (x *MsgExecCompat) slowProtoReflect() protoreflect.Message { - mi := &file_cosmos_authz_v1beta1_tx_proto_msgTypes[6] + mi := &file_cosmos_authz_v1beta1_tx_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3437,8 +3917,8 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// MsgGrant is a request type for Grant method. It declares authorization to the grantee -// on behalf of the granter with the provided expiration time. +// MsgGrant is a request type for Grant method. It declares authorization to the +// grantee on behalf of the granter with the provided expiration time. type MsgGrant struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -3527,8 +4007,8 @@ type MsgExec struct { Grantee string `protobuf:"bytes,1,opt,name=grantee,proto3" json:"grantee,omitempty"` // Execute Msg. - // The x/authz will try to find a grant matching (msg.signers[0], grantee, MsgTypeURL(msg)) - // triple and validate it. + // The x/authz will try to find a grant matching (msg.signers[0], grantee, + // MsgTypeURL(msg)) triple and validate it. Msgs []*anypb.Any `protobuf:"bytes,2,rep,name=msgs,proto3" json:"msgs,omitempty"` } @@ -3682,6 +4162,42 @@ func (*MsgRevokeResponse) Descriptor() ([]byte, []int) { return file_cosmos_authz_v1beta1_tx_proto_rawDescGZIP(), []int{5} } +// MsgExecCompatResponse defines the Msg/MsgExecCompatResponse response type. +type MsgExecCompatResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Results [][]byte `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"` +} + +func (x *MsgExecCompatResponse) Reset() { + *x = MsgExecCompatResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_authz_v1beta1_tx_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgExecCompatResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgExecCompatResponse) ProtoMessage() {} + +// Deprecated: Use MsgExecCompatResponse.ProtoReflect.Descriptor instead. +func (*MsgExecCompatResponse) Descriptor() ([]byte, []int) { + return file_cosmos_authz_v1beta1_tx_proto_rawDescGZIP(), []int{6} +} + +func (x *MsgExecCompatResponse) GetResults() [][]byte { + if x != nil { + return x.Results + } + return nil +} + // MsgExecCompat supports legacy amino codec for frontend metamask signing // Functions are same as MsgExec, but input for msgs is array of strings type MsgExecCompat struct { @@ -3696,7 +4212,7 @@ type MsgExecCompat struct { func (x *MsgExecCompat) Reset() { *x = MsgExecCompat{} if protoimpl.UnsafeEnabled { - mi := &file_cosmos_authz_v1beta1_tx_proto_msgTypes[6] + mi := &file_cosmos_authz_v1beta1_tx_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3710,7 +4226,7 @@ func (*MsgExecCompat) ProtoMessage() {} // Deprecated: Use MsgExecCompat.ProtoReflect.Descriptor instead. func (*MsgExecCompat) Descriptor() ([]byte, []int) { - return file_cosmos_authz_v1beta1_tx_proto_rawDescGZIP(), []int{6} + return file_cosmos_authz_v1beta1_tx_proto_rawDescGZIP(), []int{7} } func (x *MsgExecCompat) GetGrantee() string { @@ -3784,45 +4300,54 @@ var file_cosmos_authz_v1beta1_tx_proto_rawDesc = []byte{ 0xe7, 0xb0, 0x2a, 0x07, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x65, 0x72, 0x8a, 0xe7, 0xb0, 0x2a, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x22, 0x13, 0x0a, 0x11, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x76, 0x6f, 0x6b, - 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x7c, 0x0a, 0x0d, 0x4d, 0x73, 0x67, - 0x45, 0x78, 0x65, 0x63, 0x43, 0x6f, 0x6d, 0x70, 0x61, 0x74, 0x12, 0x32, 0x0a, 0x07, 0x67, 0x72, - 0x61, 0x6e, 0x74, 0x65, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, - 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, - 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x65, 0x65, 0x12, 0x12, - 0x0a, 0x04, 0x6d, 0x73, 0x67, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x6d, 0x73, - 0x67, 0x73, 0x3a, 0x23, 0x82, 0xe7, 0xb0, 0x2a, 0x07, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x65, 0x65, - 0x8a, 0xe7, 0xb0, 0x2a, 0x12, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, - 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x32, 0xff, 0x01, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, - 0x4f, 0x0a, 0x05, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x12, 0x1e, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x31, 0x0a, 0x15, 0x4d, 0x73, 0x67, + 0x45, 0x78, 0x65, 0x63, 0x43, 0x6f, 0x6d, 0x70, 0x61, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0c, 0x52, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x22, 0x7c, 0x0a, 0x0d, + 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x43, 0x6f, 0x6d, 0x70, 0x61, 0x74, 0x12, 0x32, 0x0a, + 0x07, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x65, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, + 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x65, + 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6d, 0x73, 0x67, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x04, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x23, 0x82, 0xe7, 0xb0, 0x2a, 0x07, 0x67, 0x72, 0x61, 0x6e, + 0x74, 0x65, 0x65, 0x8a, 0xe7, 0xb0, 0x2a, 0x12, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, + 0x64, 0x6b, 0x2f, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x32, 0xdf, 0x02, 0x0a, 0x03, 0x4d, + 0x73, 0x67, 0x12, 0x4f, 0x0a, 0x05, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x12, 0x1e, 0x2e, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x1a, 0x26, 0x2e, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x4c, 0x0a, 0x04, 0x45, 0x78, 0x65, 0x63, 0x12, 0x1d, 0x2e, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x1a, 0x25, 0x2e, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x52, 0x0a, 0x06, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x12, 0x1f, 0x2e, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x1a, 0x27, 0x2e, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5e, 0x0a, 0x0a, 0x45, 0x78, 0x65, 0x63, 0x43, 0x6f, 0x6d, + 0x70, 0x61, 0x74, 0x12, 0x23, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, 0x74, + 0x68, 0x7a, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x78, + 0x65, 0x63, 0x43, 0x6f, 0x6d, 0x70, 0x61, 0x74, 0x1a, 0x2b, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, - 0x4d, 0x73, 0x67, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x1a, 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, - 0x4d, 0x73, 0x67, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x4c, 0x0a, 0x04, 0x45, 0x78, 0x65, 0x63, 0x12, 0x1d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, - 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x1a, 0x25, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, - 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x52, - 0x0a, 0x06, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x12, 0x1f, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, - 0x4d, 0x73, 0x67, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x1a, 0x27, 0x2e, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, - 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xcd, 0x01, 0x0a, 0x18, 0x63, 0x6f, - 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x76, - 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, - 0x01, 0x5a, 0x32, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, - 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x7a, - 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x76, 0x31, - 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x41, 0x58, 0xaa, 0x02, 0x14, 0x43, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, - 0x61, 0x31, 0xca, 0x02, 0x14, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x75, 0x74, 0x68, - 0x7a, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x20, 0x43, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x5c, 0x41, 0x75, 0x74, 0x68, 0x7a, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, - 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x16, 0x43, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x75, 0x74, 0x68, 0x7a, 0x3a, 0x3a, 0x56, 0x31, - 0x62, 0x65, 0x74, 0x61, 0x31, 0xc8, 0xe1, 0x1e, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x43, 0x6f, 0x6d, 0x70, 0x61, 0x74, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xcd, 0x01, 0x0a, + 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, + 0x7a, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x32, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, + 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x75, + 0x74, 0x68, 0x7a, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x61, 0x75, 0x74, 0x68, + 0x7a, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x41, 0x58, 0xaa, 0x02, + 0x14, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x56, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x14, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, + 0x75, 0x74, 0x68, 0x7a, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x20, 0x43, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x75, 0x74, 0x68, 0x7a, 0x5c, 0x56, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, + 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x75, 0x74, 0x68, 0x7a, 0x3a, + 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xc8, 0xe1, 0x1e, 0x00, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3837,29 +4362,32 @@ func file_cosmos_authz_v1beta1_tx_proto_rawDescGZIP() []byte { return file_cosmos_authz_v1beta1_tx_proto_rawDescData } -var file_cosmos_authz_v1beta1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_cosmos_authz_v1beta1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_cosmos_authz_v1beta1_tx_proto_goTypes = []interface{}{ - (*MsgGrant)(nil), // 0: cosmos.authz.v1beta1.MsgGrant - (*MsgGrantResponse)(nil), // 1: cosmos.authz.v1beta1.MsgGrantResponse - (*MsgExec)(nil), // 2: cosmos.authz.v1beta1.MsgExec - (*MsgExecResponse)(nil), // 3: cosmos.authz.v1beta1.MsgExecResponse - (*MsgRevoke)(nil), // 4: cosmos.authz.v1beta1.MsgRevoke - (*MsgRevokeResponse)(nil), // 5: cosmos.authz.v1beta1.MsgRevokeResponse - (*MsgExecCompat)(nil), // 6: cosmos.authz.v1beta1.MsgExecCompat - (*Grant)(nil), // 7: cosmos.authz.v1beta1.Grant - (*anypb.Any)(nil), // 8: google.protobuf.Any + (*MsgGrant)(nil), // 0: cosmos.authz.v1beta1.MsgGrant + (*MsgGrantResponse)(nil), // 1: cosmos.authz.v1beta1.MsgGrantResponse + (*MsgExec)(nil), // 2: cosmos.authz.v1beta1.MsgExec + (*MsgExecResponse)(nil), // 3: cosmos.authz.v1beta1.MsgExecResponse + (*MsgRevoke)(nil), // 4: cosmos.authz.v1beta1.MsgRevoke + (*MsgRevokeResponse)(nil), // 5: cosmos.authz.v1beta1.MsgRevokeResponse + (*MsgExecCompatResponse)(nil), // 6: cosmos.authz.v1beta1.MsgExecCompatResponse + (*MsgExecCompat)(nil), // 7: cosmos.authz.v1beta1.MsgExecCompat + (*Grant)(nil), // 8: cosmos.authz.v1beta1.Grant + (*anypb.Any)(nil), // 9: google.protobuf.Any } var file_cosmos_authz_v1beta1_tx_proto_depIdxs = []int32{ - 7, // 0: cosmos.authz.v1beta1.MsgGrant.grant:type_name -> cosmos.authz.v1beta1.Grant - 8, // 1: cosmos.authz.v1beta1.MsgExec.msgs:type_name -> google.protobuf.Any + 8, // 0: cosmos.authz.v1beta1.MsgGrant.grant:type_name -> cosmos.authz.v1beta1.Grant + 9, // 1: cosmos.authz.v1beta1.MsgExec.msgs:type_name -> google.protobuf.Any 0, // 2: cosmos.authz.v1beta1.Msg.Grant:input_type -> cosmos.authz.v1beta1.MsgGrant 2, // 3: cosmos.authz.v1beta1.Msg.Exec:input_type -> cosmos.authz.v1beta1.MsgExec 4, // 4: cosmos.authz.v1beta1.Msg.Revoke:input_type -> cosmos.authz.v1beta1.MsgRevoke - 1, // 5: cosmos.authz.v1beta1.Msg.Grant:output_type -> cosmos.authz.v1beta1.MsgGrantResponse - 3, // 6: cosmos.authz.v1beta1.Msg.Exec:output_type -> cosmos.authz.v1beta1.MsgExecResponse - 5, // 7: cosmos.authz.v1beta1.Msg.Revoke:output_type -> cosmos.authz.v1beta1.MsgRevokeResponse - 5, // [5:8] is the sub-list for method output_type - 2, // [2:5] is the sub-list for method input_type + 7, // 5: cosmos.authz.v1beta1.Msg.ExecCompat:input_type -> cosmos.authz.v1beta1.MsgExecCompat + 1, // 6: cosmos.authz.v1beta1.Msg.Grant:output_type -> cosmos.authz.v1beta1.MsgGrantResponse + 3, // 7: cosmos.authz.v1beta1.Msg.Exec:output_type -> cosmos.authz.v1beta1.MsgExecResponse + 5, // 8: cosmos.authz.v1beta1.Msg.Revoke:output_type -> cosmos.authz.v1beta1.MsgRevokeResponse + 6, // 9: cosmos.authz.v1beta1.Msg.ExecCompat:output_type -> cosmos.authz.v1beta1.MsgExecCompatResponse + 6, // [6:10] is the sub-list for method output_type + 2, // [2:6] is the sub-list for method input_type 2, // [2:2] is the sub-list for extension type_name 2, // [2:2] is the sub-list for extension extendee 0, // [0:2] is the sub-list for field type_name @@ -3945,6 +4473,18 @@ func file_cosmos_authz_v1beta1_tx_proto_init() { } } file_cosmos_authz_v1beta1_tx_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgExecCompatResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_authz_v1beta1_tx_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MsgExecCompat); i { case 0: return &v.state @@ -3963,7 +4503,7 @@ func file_cosmos_authz_v1beta1_tx_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_cosmos_authz_v1beta1_tx_proto_rawDesc, NumEnums: 0, - NumMessages: 7, + NumMessages: 8, NumExtensions: 0, NumServices: 1, }, diff --git a/api/cosmos/authz/v1beta1/tx_grpc.pb.go b/api/cosmos/authz/v1beta1/tx_grpc.pb.go index 2dcbc3ed90f6..260d71fcda68 100644 --- a/api/cosmos/authz/v1beta1/tx_grpc.pb.go +++ b/api/cosmos/authz/v1beta1/tx_grpc.pb.go @@ -21,9 +21,10 @@ import ( const _ = grpc.SupportPackageIsVersion7 const ( - Msg_Grant_FullMethodName = "/cosmos.authz.v1beta1.Msg/Grant" - Msg_Exec_FullMethodName = "/cosmos.authz.v1beta1.Msg/Exec" - Msg_Revoke_FullMethodName = "/cosmos.authz.v1beta1.Msg/Revoke" + Msg_Grant_FullMethodName = "/cosmos.authz.v1beta1.Msg/Grant" + Msg_Exec_FullMethodName = "/cosmos.authz.v1beta1.Msg/Exec" + Msg_Revoke_FullMethodName = "/cosmos.authz.v1beta1.Msg/Revoke" + Msg_ExecCompat_FullMethodName = "/cosmos.authz.v1beta1.Msg/ExecCompat" ) // MsgClient is the client API for Msg service. @@ -39,9 +40,10 @@ type MsgClient interface { // authorizations granted to the grantee. Each message should have only // one signer corresponding to the granter of the authorization. Exec(ctx context.Context, in *MsgExec, opts ...grpc.CallOption) (*MsgExecResponse, error) - // Revoke revokes any authorization corresponding to the provided method name on the - // granter's account that has been granted to the grantee. + // Revoke revokes any authorization corresponding to the provided method name + // on the granter's account that has been granted to the grantee. Revoke(ctx context.Context, in *MsgRevoke, opts ...grpc.CallOption) (*MsgRevokeResponse, error) + ExecCompat(ctx context.Context, in *MsgExecCompat, opts ...grpc.CallOption) (*MsgExecCompatResponse, error) } type msgClient struct { @@ -79,6 +81,15 @@ func (c *msgClient) Revoke(ctx context.Context, in *MsgRevoke, opts ...grpc.Call return out, nil } +func (c *msgClient) ExecCompat(ctx context.Context, in *MsgExecCompat, opts ...grpc.CallOption) (*MsgExecCompatResponse, error) { + out := new(MsgExecCompatResponse) + err := c.cc.Invoke(ctx, Msg_ExecCompat_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. // All implementations must embed UnimplementedMsgServer // for forward compatibility @@ -92,9 +103,10 @@ type MsgServer interface { // authorizations granted to the grantee. Each message should have only // one signer corresponding to the granter of the authorization. Exec(context.Context, *MsgExec) (*MsgExecResponse, error) - // Revoke revokes any authorization corresponding to the provided method name on the - // granter's account that has been granted to the grantee. + // Revoke revokes any authorization corresponding to the provided method name + // on the granter's account that has been granted to the grantee. Revoke(context.Context, *MsgRevoke) (*MsgRevokeResponse, error) + ExecCompat(context.Context, *MsgExecCompat) (*MsgExecCompatResponse, error) mustEmbedUnimplementedMsgServer() } @@ -111,6 +123,9 @@ func (UnimplementedMsgServer) Exec(context.Context, *MsgExec) (*MsgExecResponse, func (UnimplementedMsgServer) Revoke(context.Context, *MsgRevoke) (*MsgRevokeResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Revoke not implemented") } +func (UnimplementedMsgServer) ExecCompat(context.Context, *MsgExecCompat) (*MsgExecCompatResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ExecCompat not implemented") +} func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {} // UnsafeMsgServer may be embedded to opt out of forward compatibility for this service. @@ -178,6 +193,24 @@ func _Msg_Revoke_Handler(srv interface{}, ctx context.Context, dec func(interfac return interceptor(ctx, in, info, handler) } +func _Msg_ExecCompat_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgExecCompat) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).ExecCompat(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Msg_ExecCompat_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).ExecCompat(ctx, req.(*MsgExecCompat)) + } + return interceptor(ctx, in, info, handler) +} + // Msg_ServiceDesc is the grpc.ServiceDesc for Msg service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -197,6 +230,10 @@ var Msg_ServiceDesc = grpc.ServiceDesc{ MethodName: "Revoke", Handler: _Msg_Revoke_Handler, }, + { + MethodName: "ExecCompat", + Handler: _Msg_ExecCompat_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "cosmos/authz/v1beta1/tx.proto", diff --git a/proto/cosmos/authz/v1beta1/tx.proto b/proto/cosmos/authz/v1beta1/tx.proto index b5366a07a6fd..a141fd3b658e 100644 --- a/proto/cosmos/authz/v1beta1/tx.proto +++ b/proto/cosmos/authz/v1beta1/tx.proto @@ -27,13 +27,15 @@ service Msg { // one signer corresponding to the granter of the authorization. rpc Exec(MsgExec) returns (MsgExecResponse); - // Revoke revokes any authorization corresponding to the provided method name on the - // granter's account that has been granted to the grantee. + // Revoke revokes any authorization corresponding to the provided method name + // on the granter's account that has been granted to the grantee. rpc Revoke(MsgRevoke) returns (MsgRevokeResponse); + + rpc ExecCompat(MsgExecCompat) returns (MsgExecCompatResponse); } -// MsgGrant is a request type for Grant method. It declares authorization to the grantee -// on behalf of the granter with the provided expiration time. +// MsgGrant is a request type for Grant method. It declares authorization to the +// grantee on behalf of the granter with the provided expiration time. message MsgGrant { option (cosmos.msg.v1.signer) = "granter"; option (amino.name) = "cosmos-sdk/MsgGrant"; @@ -56,8 +58,8 @@ message MsgExec { string grantee = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // Execute Msg. - // The x/authz will try to find a grant matching (msg.signers[0], grantee, MsgTypeURL(msg)) - // triple and validate it. + // The x/authz will try to find a grant matching (msg.signers[0], grantee, + // MsgTypeURL(msg)) triple and validate it. repeated google.protobuf.Any msgs = 2 [(cosmos_proto.accepts_interface) = "cosmos.base.v1beta1.Msg"]; } @@ -80,6 +82,11 @@ message MsgRevoke { // MsgRevokeResponse defines the Msg/MsgRevokeResponse response type. message MsgRevokeResponse {} +// MsgExecCompatResponse defines the Msg/MsgExecCompatResponse response type. +message MsgExecCompatResponse { + repeated bytes results = 1; +} + // MsgExecCompat supports legacy amino codec for frontend metamask signing // Functions are same as MsgExec, but input for msgs is array of strings message MsgExecCompat { @@ -88,4 +95,4 @@ message MsgExecCompat { string grantee = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; repeated string msgs = 2; -} \ No newline at end of file +} diff --git a/x/authz/tx.pb.go b/x/authz/tx.pb.go index b6cb94d2e8cd..f44f2ad50329 100644 --- a/x/authz/tx.pb.go +++ b/x/authz/tx.pb.go @@ -32,8 +32,8 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// MsgGrant is a request type for Grant method. It declares authorization to the grantee -// on behalf of the granter with the provided expiration time. +// MsgGrant is a request type for Grant method. It declares authorization to the +// grantee on behalf of the granter with the provided expiration time. type MsgGrant struct { Granter string `protobuf:"bytes,1,opt,name=granter,proto3" json:"granter,omitempty"` Grantee string `protobuf:"bytes,2,opt,name=grantee,proto3" json:"grantee,omitempty"` @@ -116,8 +116,8 @@ var xxx_messageInfo_MsgGrantResponse proto.InternalMessageInfo type MsgExec struct { Grantee string `protobuf:"bytes,1,opt,name=grantee,proto3" json:"grantee,omitempty"` // Execute Msg. - // The x/authz will try to find a grant matching (msg.signers[0], grantee, MsgTypeURL(msg)) - // triple and validate it. + // The x/authz will try to find a grant matching (msg.signers[0], grantee, + // MsgTypeURL(msg)) triple and validate it. Msgs []*types.Any `protobuf:"bytes,2,rep,name=msgs,proto3" json:"msgs,omitempty"` } @@ -270,6 +270,44 @@ func (m *MsgRevokeResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgRevokeResponse proto.InternalMessageInfo +// MsgExecCompatResponse defines the Msg/MsgExecCompatResponse response type. +type MsgExecCompatResponse struct { + Results [][]byte `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"` +} + +func (m *MsgExecCompatResponse) Reset() { *m = MsgExecCompatResponse{} } +func (m *MsgExecCompatResponse) String() string { return proto.CompactTextString(m) } +func (*MsgExecCompatResponse) ProtoMessage() {} +func (*MsgExecCompatResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_3ceddab7d8589ad1, []int{6} +} +func (m *MsgExecCompatResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgExecCompatResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgExecCompatResponse.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 *MsgExecCompatResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgExecCompatResponse.Merge(m, src) +} +func (m *MsgExecCompatResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgExecCompatResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgExecCompatResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgExecCompatResponse proto.InternalMessageInfo + // MsgExecCompat supports legacy amino codec for frontend metamask signing // Functions are same as MsgExec, but input for msgs is array of strings type MsgExecCompat struct { @@ -281,7 +319,7 @@ func (m *MsgExecCompat) Reset() { *m = MsgExecCompat{} } func (m *MsgExecCompat) String() string { return proto.CompactTextString(m) } func (*MsgExecCompat) ProtoMessage() {} func (*MsgExecCompat) Descriptor() ([]byte, []int) { - return fileDescriptor_3ceddab7d8589ad1, []int{6} + return fileDescriptor_3ceddab7d8589ad1, []int{7} } func (m *MsgExecCompat) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -317,49 +355,52 @@ func init() { proto.RegisterType((*MsgExecResponse)(nil), "cosmos.authz.v1beta1.MsgExecResponse") proto.RegisterType((*MsgRevoke)(nil), "cosmos.authz.v1beta1.MsgRevoke") proto.RegisterType((*MsgRevokeResponse)(nil), "cosmos.authz.v1beta1.MsgRevokeResponse") + proto.RegisterType((*MsgExecCompatResponse)(nil), "cosmos.authz.v1beta1.MsgExecCompatResponse") proto.RegisterType((*MsgExecCompat)(nil), "cosmos.authz.v1beta1.MsgExecCompat") } func init() { proto.RegisterFile("cosmos/authz/v1beta1/tx.proto", fileDescriptor_3ceddab7d8589ad1) } var fileDescriptor_3ceddab7d8589ad1 = []byte{ - // 575 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x54, 0x3f, 0x6f, 0xd3, 0x40, - 0x14, 0xcf, 0x35, 0x6d, 0x43, 0xae, 0x45, 0x50, 0x37, 0x12, 0xae, 0xab, 0xba, 0x96, 0x69, 0x21, - 0x0a, 0x8a, 0xad, 0x84, 0x2d, 0x62, 0x69, 0x50, 0xc5, 0x42, 0x84, 0x64, 0x60, 0x61, 0x89, 0x9c, - 0xe4, 0xb8, 0x46, 0x8d, 0x7d, 0x91, 0xef, 0x12, 0x25, 0x88, 0x01, 0x31, 0x32, 0xf1, 0x31, 0x60, - 0xcb, 0xd0, 0x91, 0x0f, 0x10, 0x31, 0x55, 0x0c, 0x88, 0x09, 0x41, 0x32, 0xe4, 0x63, 0x80, 0x7c, - 0x7f, 0x4c, 0x8a, 0xd2, 0x52, 0x18, 0x58, 0xec, 0xf7, 0xde, 0xef, 0xf7, 0xee, 0xde, 0x7b, 0xbf, - 0xbb, 0x83, 0x3b, 0x4d, 0x42, 0x03, 0x42, 0x5d, 0xbf, 0xc7, 0x8e, 0x5e, 0xb8, 0xfd, 0x52, 0x03, - 0x31, 0xbf, 0xe4, 0xb2, 0x81, 0xd3, 0x8d, 0x08, 0x23, 0x5a, 0x4e, 0xc0, 0x0e, 0x87, 0x1d, 0x09, - 0x1b, 0x5b, 0x22, 0x5a, 0xe7, 0x1c, 0x57, 0x52, 0xb8, 0x63, 0xe4, 0x30, 0xc1, 0x44, 0xc4, 0x63, - 0x4b, 0x46, 0xb7, 0x30, 0x21, 0xb8, 0x83, 0x5c, 0xee, 0x35, 0x7a, 0xcf, 0x5d, 0x3f, 0x1c, 0x4a, - 0xc8, 0x5a, 0x58, 0x80, 0xd8, 0x4f, 0x30, 0x6e, 0x48, 0x46, 0x40, 0xb1, 0xdb, 0x2f, 0xc5, 0x3f, - 0x09, 0x6c, 0xf8, 0x41, 0x3b, 0x24, 0x2e, 0xff, 0x8a, 0x90, 0xfd, 0x19, 0xc0, 0x2b, 0x35, 0x8a, - 0x1f, 0x44, 0x7e, 0xc8, 0xb4, 0x32, 0xcc, 0xe0, 0xd8, 0x40, 0x91, 0x0e, 0x2c, 0x90, 0xcf, 0x56, - 0xf5, 0x4f, 0x27, 0x45, 0xd5, 0xd1, 0x41, 0xab, 0x15, 0x21, 0x4a, 0x1f, 0xb3, 0xa8, 0x1d, 0x62, - 0x4f, 0x11, 0x7f, 0xe5, 0x20, 0x7d, 0xe9, 0x72, 0x39, 0x48, 0xbb, 0x07, 0x57, 0xb8, 0xa9, 0xa7, - 0x2d, 0x90, 0x5f, 0x2b, 0x6f, 0x3b, 0x8b, 0x86, 0xe6, 0xf0, 0x9a, 0xaa, 0xd9, 0xf1, 0xd7, 0xdd, - 0xd4, 0xbb, 0xd9, 0xa8, 0x00, 0x3c, 0x91, 0x54, 0xd9, 0x7b, 0x3d, 0x1b, 0x15, 0xd4, 0xfe, 0x6f, - 0x66, 0xa3, 0xc2, 0xa6, 0x48, 0x2f, 0xd2, 0xd6, 0xb1, 0xab, 0x7a, 0xb1, 0x35, 0x78, 0x5d, 0xd9, - 0x1e, 0xa2, 0x5d, 0x12, 0x52, 0x64, 0xbf, 0x07, 0x30, 0x53, 0xa3, 0xf8, 0x70, 0x80, 0x9a, 0xf3, - 0x75, 0x83, 0xcb, 0xd6, 0x7d, 0x08, 0x97, 0x03, 0x8a, 0xa9, 0xbe, 0x64, 0xa5, 0xf3, 0x6b, 0xe5, - 0x9c, 0x23, 0x44, 0x72, 0x94, 0x48, 0xce, 0x41, 0x38, 0xac, 0x6e, 0x7f, 0x3c, 0x29, 0x4a, 0x01, - 0x9c, 0x86, 0x4f, 0x51, 0xd2, 0x4e, 0x8d, 0x62, 0x8f, 0xa7, 0x57, 0x6e, 0xce, 0x35, 0x80, 0xe2, - 0x06, 0xb4, 0xb3, 0x0d, 0xc4, 0xf5, 0xd9, 0x77, 0xe0, 0x35, 0x69, 0xaa, 0xf2, 0x35, 0x1d, 0x66, - 0x22, 0x44, 0x7b, 0x1d, 0x46, 0x75, 0x60, 0xa5, 0xf3, 0xeb, 0x9e, 0x72, 0xed, 0x0f, 0x00, 0x66, - 0xe3, 0xf5, 0x51, 0x9f, 0x1c, 0xa3, 0xff, 0x26, 0xa3, 0x05, 0xd7, 0x03, 0x8a, 0xeb, 0x6c, 0xd8, - 0x45, 0xf5, 0x5e, 0xd4, 0xe1, 0x6a, 0x66, 0x3d, 0x18, 0x50, 0xfc, 0x64, 0xd8, 0x45, 0x4f, 0xa3, - 0x4e, 0x65, 0xff, 0x77, 0xa9, 0x72, 0x67, 0x3b, 0x15, 0x05, 0xdb, 0x9b, 0x70, 0x23, 0x71, 0x12, - 0xb1, 0x5e, 0xc2, 0xab, 0x72, 0x00, 0xf7, 0x49, 0xd0, 0xf5, 0xd9, 0x3f, 0x29, 0xa6, 0xcd, 0x29, - 0x96, 0xfd, 0x8b, 0xf1, 0x97, 0x7f, 0x00, 0x98, 0xae, 0x51, 0xac, 0x3d, 0x82, 0x2b, 0xe2, 0x6e, - 0x98, 0x8b, 0x0f, 0xa9, 0x3a, 0x63, 0xc6, 0xad, 0x8b, 0xf1, 0x44, 0xc4, 0x87, 0x70, 0x99, 0x9f, - 0xbf, 0x9d, 0x73, 0xf9, 0x31, 0x6c, 0xec, 0x5f, 0x08, 0x27, 0xab, 0x79, 0x70, 0x55, 0x8a, 0xbe, - 0x7b, 0x6e, 0x82, 0x20, 0x18, 0xb7, 0xff, 0x40, 0x50, 0x6b, 0x1a, 0x2b, 0xaf, 0xe2, 0xdb, 0x56, - 0xad, 0x8e, 0xbf, 0x9b, 0xa9, 0xf1, 0xc4, 0x04, 0xa7, 0x13, 0x13, 0x7c, 0x9b, 0x98, 0xe0, 0xed, - 0xd4, 0x4c, 0x9d, 0x4e, 0xcd, 0xd4, 0x97, 0xa9, 0x99, 0x7a, 0xb6, 0x87, 0xdb, 0xec, 0xa8, 0xd7, - 0x70, 0x9a, 0x24, 0x90, 0xef, 0x99, 0x3b, 0x37, 0xc5, 0x81, 0x78, 0x8f, 0x1a, 0xab, 0xfc, 0x6a, - 0xdc, 0xfd, 0x19, 0x00, 0x00, 0xff, 0xff, 0x69, 0x9d, 0x3b, 0x3c, 0x35, 0x05, 0x00, 0x00, + // 599 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x54, 0x4f, 0x6f, 0x12, 0x41, + 0x1c, 0x65, 0x4a, 0x29, 0x32, 0xad, 0xd1, 0x6e, 0x31, 0x6e, 0xb7, 0xe9, 0x76, 0xb3, 0x6d, 0x95, + 0xd0, 0xb0, 0x1b, 0xf0, 0x46, 0xbc, 0x14, 0xd3, 0x78, 0x91, 0x98, 0xac, 0x7a, 0xf1, 0x20, 0x59, + 0x60, 0x9c, 0x92, 0xb2, 0x3b, 0x64, 0x67, 0x21, 0x60, 0x3c, 0x18, 0x8f, 0x9e, 0xfc, 0x18, 0x7a, + 0xe3, 0xd0, 0xa3, 0x1f, 0x80, 0x78, 0x6a, 0x3c, 0x18, 0x4f, 0xfe, 0x81, 0x03, 0x5f, 0xc3, 0xec, + 0xcc, 0xec, 0xba, 0x18, 0x8a, 0xe8, 0xc1, 0x0b, 0xfc, 0x66, 0xde, 0xfb, 0xcd, 0xbe, 0x37, 0x6f, + 0x66, 0xe0, 0x6e, 0x83, 0x50, 0x87, 0x50, 0xd3, 0xee, 0xfa, 0xa7, 0x2f, 0xcc, 0x5e, 0xb1, 0x8e, + 0x7c, 0xbb, 0x68, 0xfa, 0x7d, 0xa3, 0xe3, 0x11, 0x9f, 0x48, 0x59, 0x0e, 0x1b, 0x0c, 0x36, 0x04, + 0xac, 0x6c, 0xf3, 0xd9, 0x1a, 0xe3, 0x98, 0x82, 0xc2, 0x06, 0x4a, 0x16, 0x13, 0x4c, 0xf8, 0x7c, + 0x50, 0x89, 0xd9, 0x6d, 0x4c, 0x08, 0x6e, 0x23, 0x93, 0x8d, 0xea, 0xdd, 0xe7, 0xa6, 0xed, 0x0e, + 0x04, 0xa4, 0xcd, 0x15, 0xc0, 0xbf, 0xc7, 0x19, 0x37, 0x05, 0xc3, 0xa1, 0xd8, 0xec, 0x15, 0x83, + 0x3f, 0x01, 0x6c, 0xda, 0x4e, 0xcb, 0x25, 0x26, 0xfb, 0xe5, 0x53, 0xfa, 0x67, 0x00, 0xaf, 0x54, + 0x29, 0xbe, 0xef, 0xd9, 0xae, 0x2f, 0x95, 0x60, 0x1a, 0x07, 0x05, 0xf2, 0x64, 0xa0, 0x81, 0x5c, + 0xa6, 0x22, 0x7f, 0x3a, 0x2f, 0x84, 0x8e, 0x8e, 0x9b, 0x4d, 0x0f, 0x51, 0xfa, 0xc8, 0xf7, 0x5a, + 0x2e, 0xb6, 0x42, 0xe2, 0xaf, 0x1e, 0x24, 0xaf, 0x2c, 0xd7, 0x83, 0xa4, 0xbb, 0x30, 0xc5, 0x4a, + 0x39, 0xa9, 0x81, 0xdc, 0x7a, 0x69, 0xc7, 0x98, 0xb7, 0x69, 0x06, 0xd3, 0x54, 0xc9, 0x8c, 0xbe, + 0xee, 0x25, 0xde, 0x4d, 0x87, 0x79, 0x60, 0xf1, 0xa6, 0xf2, 0xc1, 0xeb, 0xe9, 0x30, 0x1f, 0x7e, + 0xff, 0xcd, 0x74, 0x98, 0xdf, 0xe2, 0xed, 0x05, 0xda, 0x3c, 0x33, 0x43, 0x2f, 0xba, 0x04, 0xaf, + 0x87, 0xb5, 0x85, 0x68, 0x87, 0xb8, 0x14, 0xe9, 0xef, 0x01, 0x4c, 0x57, 0x29, 0x3e, 0xe9, 0xa3, + 0x46, 0x5c, 0x37, 0x58, 0x56, 0xf7, 0x09, 0x5c, 0x75, 0x28, 0xa6, 0xf2, 0x8a, 0x96, 0xcc, 0xad, + 0x97, 0xb2, 0x06, 0x0f, 0xc9, 0x08, 0x43, 0x32, 0x8e, 0xdd, 0x41, 0x65, 0xe7, 0xe3, 0x79, 0x41, + 0x04, 0x60, 0xd4, 0x6d, 0x8a, 0x22, 0x3b, 0x55, 0x8a, 0x2d, 0xd6, 0x5e, 0xde, 0x8f, 0x19, 0x40, + 0x81, 0x01, 0x69, 0xd6, 0x40, 0xa0, 0x4f, 0x3f, 0x82, 0xd7, 0x44, 0x19, 0xca, 0x97, 0x64, 0x98, + 0xf6, 0x10, 0xed, 0xb6, 0x7d, 0x2a, 0x03, 0x2d, 0x99, 0xdb, 0xb0, 0xc2, 0xa1, 0xfe, 0x01, 0xc0, + 0x4c, 0xb0, 0x3e, 0xea, 0x91, 0x33, 0xf4, 0xdf, 0x62, 0xd4, 0xe0, 0x86, 0x43, 0x71, 0xcd, 0x1f, + 0x74, 0x50, 0xad, 0xeb, 0xb5, 0x59, 0x9a, 0x19, 0x0b, 0x3a, 0x14, 0x3f, 0x1e, 0x74, 0xd0, 0x13, + 0xaf, 0x5d, 0x3e, 0xfc, 0x3d, 0xaa, 0xec, 0xac, 0x53, 0x2e, 0x58, 0xdf, 0x82, 0x9b, 0xd1, 0x20, + 0x0a, 0xab, 0x08, 0x6f, 0x88, 0x0d, 0xb8, 0x47, 0x9c, 0x8e, 0xed, 0x2f, 0xb1, 0x0d, 0x2f, 0xe1, + 0xd5, 0x99, 0x96, 0x7f, 0x0a, 0x59, 0x8a, 0x85, 0x9c, 0xf9, 0x8b, 0xc4, 0x4a, 0xdf, 0x56, 0x60, + 0xb2, 0x4a, 0xb1, 0xf4, 0x10, 0xa6, 0xf8, 0x75, 0x52, 0xe7, 0x9f, 0xeb, 0xf0, 0x58, 0x2a, 0xb7, + 0x16, 0xe3, 0x91, 0xe1, 0x07, 0x70, 0x95, 0x1d, 0xd9, 0xdd, 0x4b, 0xf9, 0x01, 0xac, 0x1c, 0x2e, + 0x84, 0xa3, 0xd5, 0x2c, 0xb8, 0x26, 0xce, 0xc9, 0xde, 0xa5, 0x0d, 0x9c, 0xa0, 0xdc, 0xfe, 0x03, + 0x21, 0x5a, 0xf3, 0x19, 0x84, 0xb1, 0x5d, 0xdf, 0x5f, 0x28, 0x84, 0x93, 0x94, 0xa3, 0x25, 0x48, + 0xe1, 0xfa, 0x4a, 0xea, 0x55, 0xf0, 0x00, 0x54, 0x2a, 0xa3, 0x1f, 0x6a, 0x62, 0x34, 0x56, 0xc1, + 0xc5, 0x58, 0x05, 0xdf, 0xc7, 0x2a, 0x78, 0x3b, 0x51, 0x13, 0x17, 0x13, 0x35, 0xf1, 0x65, 0xa2, + 0x26, 0x9e, 0x1e, 0xe0, 0x96, 0x7f, 0xda, 0xad, 0x1b, 0x0d, 0xe2, 0x88, 0x27, 0xd6, 0x8c, 0xa5, + 0xd4, 0xe7, 0x4f, 0x64, 0x7d, 0x8d, 0xdd, 0xd6, 0x3b, 0x3f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x7d, + 0xa4, 0x35, 0xa6, 0xc8, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -383,9 +424,10 @@ type MsgClient interface { // authorizations granted to the grantee. Each message should have only // one signer corresponding to the granter of the authorization. Exec(ctx context.Context, in *MsgExec, opts ...grpc.CallOption) (*MsgExecResponse, error) - // Revoke revokes any authorization corresponding to the provided method name on the - // granter's account that has been granted to the grantee. + // Revoke revokes any authorization corresponding to the provided method name + // on the granter's account that has been granted to the grantee. Revoke(ctx context.Context, in *MsgRevoke, opts ...grpc.CallOption) (*MsgRevokeResponse, error) + ExecCompat(ctx context.Context, in *MsgExecCompat, opts ...grpc.CallOption) (*MsgExecCompatResponse, error) } type msgClient struct { @@ -423,6 +465,15 @@ func (c *msgClient) Revoke(ctx context.Context, in *MsgRevoke, opts ...grpc.Call return out, nil } +func (c *msgClient) ExecCompat(ctx context.Context, in *MsgExecCompat, opts ...grpc.CallOption) (*MsgExecCompatResponse, error) { + out := new(MsgExecCompatResponse) + err := c.cc.Invoke(ctx, "/cosmos.authz.v1beta1.Msg/ExecCompat", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // Grant grants the provided authorization to the grantee on the granter's @@ -434,9 +485,10 @@ type MsgServer interface { // authorizations granted to the grantee. Each message should have only // one signer corresponding to the granter of the authorization. Exec(context.Context, *MsgExec) (*MsgExecResponse, error) - // Revoke revokes any authorization corresponding to the provided method name on the - // granter's account that has been granted to the grantee. + // Revoke revokes any authorization corresponding to the provided method name + // on the granter's account that has been granted to the grantee. Revoke(context.Context, *MsgRevoke) (*MsgRevokeResponse, error) + ExecCompat(context.Context, *MsgExecCompat) (*MsgExecCompatResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -452,6 +504,9 @@ func (*UnimplementedMsgServer) Exec(ctx context.Context, req *MsgExec) (*MsgExec func (*UnimplementedMsgServer) Revoke(ctx context.Context, req *MsgRevoke) (*MsgRevokeResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Revoke not implemented") } +func (*UnimplementedMsgServer) ExecCompat(ctx context.Context, req *MsgExecCompat) (*MsgExecCompatResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ExecCompat not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -511,6 +566,24 @@ func _Msg_Revoke_Handler(srv interface{}, ctx context.Context, dec func(interfac return interceptor(ctx, in, info, handler) } +func _Msg_ExecCompat_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgExecCompat) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).ExecCompat(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.authz.v1beta1.Msg/ExecCompat", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).ExecCompat(ctx, req.(*MsgExecCompat)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "cosmos.authz.v1beta1.Msg", HandlerType: (*MsgServer)(nil), @@ -527,6 +600,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "Revoke", Handler: _Msg_Revoke_Handler, }, + { + MethodName: "ExecCompat", + Handler: _Msg_ExecCompat_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "cosmos/authz/v1beta1/tx.proto", @@ -745,6 +822,38 @@ func (m *MsgRevokeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *MsgExecCompatResponse) 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 *MsgExecCompatResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgExecCompatResponse) 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-- { + i -= len(m.Results[iNdEx]) + copy(dAtA[i:], m.Results[iNdEx]) + i = encodeVarintTx(dAtA, i, uint64(len(m.Results[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func (m *MsgExecCompat) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -887,6 +996,21 @@ func (m *MsgRevokeResponse) Size() (n int) { return n } +func (m *MsgExecCompatResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Results) > 0 { + for _, b := range m.Results { + l = len(b) + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + func (m *MsgExecCompat) Size() (n int) { if m == nil { return 0 @@ -1503,6 +1627,88 @@ func (m *MsgRevokeResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgExecCompatResponse) 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: MsgExecCompatResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgExecCompatResponse: 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 byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Results = append(m.Results, make([]byte, postIndex-iNdEx)) + copy(m.Results[len(m.Results)-1], dAtA[iNdEx:postIndex]) + 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 *MsgExecCompat) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 From ea049d7e9e40e8e5babc349bff7c1b31d537c16a Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Mon, 18 Dec 2023 14:32:22 -0800 Subject: [PATCH 17/29] cherry pick: 726fea9e0b9 --- x/authz/codec.go | 2 ++ x/authz/msgs.go | 1 + 2 files changed, 3 insertions(+) diff --git a/x/authz/codec.go b/x/authz/codec.go index d2e43b88316c..ecabef38cd0d 100644 --- a/x/authz/codec.go +++ b/x/authz/codec.go @@ -14,6 +14,7 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { legacy.RegisterAminoMsg(cdc, &MsgGrant{}, "cosmos-sdk/MsgGrant") legacy.RegisterAminoMsg(cdc, &MsgRevoke{}, "cosmos-sdk/MsgRevoke") legacy.RegisterAminoMsg(cdc, &MsgExec{}, "cosmos-sdk/MsgExec") + legacy.RegisterAminoMsg(cdc, &MsgExecCompat{}, "cosmos-sdk/MsgExecCompat") cdc.RegisterInterface((*Authorization)(nil), nil) cdc.RegisterConcrete(&GenericAuthorization{}, "cosmos-sdk/GenericAuthorization", nil) @@ -25,6 +26,7 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { &MsgGrant{}, &MsgRevoke{}, &MsgExec{}, + &MsgExecCompat{}, ) registry.RegisterInterface( diff --git a/x/authz/msgs.go b/x/authz/msgs.go index 1721c6c5347c..2d34ac444bc8 100644 --- a/x/authz/msgs.go +++ b/x/authz/msgs.go @@ -14,6 +14,7 @@ var ( _ sdk.Msg = &MsgGrant{} _ sdk.Msg = &MsgRevoke{} _ sdk.Msg = &MsgExec{} + _ sdk.Msg = &MsgExecCompat{} _ cdctypes.UnpackInterfacesMessage = &MsgGrant{} _ cdctypes.UnpackInterfacesMessage = &MsgExec{} From a2c42056cae1755686a28ea62961513300c3c433 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Mon, 18 Dec 2023 14:36:55 -0800 Subject: [PATCH 18/29] cherry pick: c6e918bbee1 --- x/authz/keeper/msg_server.go | 39 +++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/x/authz/keeper/msg_server.go b/x/authz/keeper/msg_server.go index b6755a9f8436..a6c1a13dc44b 100644 --- a/x/authz/keeper/msg_server.go +++ b/x/authz/keeper/msg_server.go @@ -3,16 +3,22 @@ package keeper import ( "context" "errors" + "fmt" "strings" errorsmod "cosmossdk.io/errors" + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/authz" ) -var _ authz.MsgServer = Keeper{} +var ( + _ authz.MsgServer = Keeper{} + GlobalCdc *codec.ProtoCodec +) // Grant implements the MsgServer.Grant method to create a new grant. func (k Keeper) Grant(goCtx context.Context, msg *authz.MsgGrant) (*authz.MsgGrantResponse, error) { @@ -121,6 +127,37 @@ func (k Keeper) Exec(goCtx context.Context, msg *authz.MsgExec) (*authz.MsgExecR return &authz.MsgExecResponse{Results: results}, nil } +// Exec implements the MsgServer.ExecCompat method. +func (k Keeper) ExecCompat(goCtx context.Context, msg *authz.MsgExecCompat) (*authz.MsgExecCompatResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + grantee, err := sdk.AccAddressFromBech32(msg.Grantee) + if err != nil { + return nil, err + } + + if len(msg.Msgs) == 0 { + return nil, sdkerrors.ErrInvalidRequest.Wrapf("messages cannot be empty") + } + + subMsgs := make([]sdk.Msg, len(msg.Msgs)) + for idx, m := range msg.Msgs { + var iMsg sdk.Msg + err := GlobalCdc.UnmarshalInterfaceJSON([]byte(m), &iMsg) + if err != nil { + return nil, err + } + + subMsgs[idx] = iMsg + } + + results, err := k.DispatchActions(ctx, grantee, subMsgs) + if err != nil { + return nil, fmt.Errorf("dispatch err: %w", err) + } + + return &authz.MsgExecCompatResponse{Results: results}, nil +} + func validateMsgs(msgs []sdk.Msg) error { for i, msg := range msgs { m, ok := msg.(sdk.HasValidateBasic) From 23bcf145cb1e1625a259761aa8c075352b6742d8 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Mon, 18 Dec 2023 14:41:14 -0800 Subject: [PATCH 19/29] cherry pick: d6115f387ac0 --- x/authz/keeper/msg_server.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/x/authz/keeper/msg_server.go b/x/authz/keeper/msg_server.go index a6c1a13dc44b..a3e1adaa0722 100644 --- a/x/authz/keeper/msg_server.go +++ b/x/authz/keeper/msg_server.go @@ -150,6 +150,10 @@ func (k Keeper) ExecCompat(goCtx context.Context, msg *authz.MsgExecCompat) (*au subMsgs[idx] = iMsg } + if err := validateMsgs(subMsgs); err != nil { + return nil, err + } + results, err := k.DispatchActions(ctx, grantee, subMsgs) if err != nil { return nil, fmt.Errorf("dispatch err: %w", err) @@ -166,7 +170,7 @@ func validateMsgs(msgs []sdk.Msg) error { } if err := m.ValidateBasic(); err != nil { - return errorsmod.Wrapf(err, "msg %d", i) + return errorsmod.Wrapf(err, "validate message at index %d error", i) } } From 9a889302f9dd8ae30cd28e93b4178f8137d1f512 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Mon, 18 Dec 2023 14:42:56 -0800 Subject: [PATCH 20/29] cherry pick: fbb4d525bd433 --- x/authz/keeper/msg_server.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x/authz/keeper/msg_server.go b/x/authz/keeper/msg_server.go index a3e1adaa0722..336d7ea11ae7 100644 --- a/x/authz/keeper/msg_server.go +++ b/x/authz/keeper/msg_server.go @@ -9,6 +9,7 @@ import ( errorsmod "cosmossdk.io/errors" "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -17,7 +18,7 @@ import ( var ( _ authz.MsgServer = Keeper{} - GlobalCdc *codec.ProtoCodec + GlobalCdc = codec.NewProtoCodec(codectypes.NewInterfaceRegistry()) ) // Grant implements the MsgServer.Grant method to create a new grant. From b72692847ceafbdbfb35c7789d19edf4c62c2b4f Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Mon, 18 Dec 2023 14:44:52 -0800 Subject: [PATCH 21/29] cherry pick: 6b233a7877c --- x/authz/codec.go | 3 +++ x/authz/keeper/msg_server.go | 10 ++-------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/x/authz/codec.go b/x/authz/codec.go index ecabef38cd0d..43afc764c1ef 100644 --- a/x/authz/codec.go +++ b/x/authz/codec.go @@ -3,11 +3,14 @@ package authz import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/legacy" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" types "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" ) +var GlobalCdc = codec.NewProtoCodec(codectypes.NewInterfaceRegistry()) + // RegisterLegacyAminoCodec registers the necessary x/authz interfaces and concrete types // on the provided LegacyAmino codec. These types are used for Amino JSON serialization. func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { diff --git a/x/authz/keeper/msg_server.go b/x/authz/keeper/msg_server.go index 336d7ea11ae7..70f1e463264e 100644 --- a/x/authz/keeper/msg_server.go +++ b/x/authz/keeper/msg_server.go @@ -8,18 +8,12 @@ import ( errorsmod "cosmossdk.io/errors" - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/authz" ) -var ( - _ authz.MsgServer = Keeper{} - GlobalCdc = codec.NewProtoCodec(codectypes.NewInterfaceRegistry()) -) +var _ authz.MsgServer = Keeper{} // Grant implements the MsgServer.Grant method to create a new grant. func (k Keeper) Grant(goCtx context.Context, msg *authz.MsgGrant) (*authz.MsgGrantResponse, error) { @@ -143,7 +137,7 @@ func (k Keeper) ExecCompat(goCtx context.Context, msg *authz.MsgExecCompat) (*au subMsgs := make([]sdk.Msg, len(msg.Msgs)) for idx, m := range msg.Msgs { var iMsg sdk.Msg - err := GlobalCdc.UnmarshalInterfaceJSON([]byte(m), &iMsg) + err := authz.GlobalCdc.UnmarshalInterfaceJSON([]byte(m), &iMsg) if err != nil { return nil, err } From dddb8b4d778d86ba6d50f025ba909d6c14c5a38f Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Mon, 18 Dec 2023 16:43:33 -0800 Subject: [PATCH 22/29] cherry pick: 003a8c9c0 --- baseapp/baseapp.go | 3 ++- baseapp/chain_stream.go | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index ef1aa8d7c155..d86a816e5a00 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -186,7 +186,8 @@ type BaseApp struct { optimisticExec *oe.OptimisticExecution // StreamEvents - StreamEvents chan StreamEvents + EnableStreamer bool + StreamEvents chan StreamEvents } // NewBaseApp returns a reference to an initialized BaseApp. It accepts a diff --git a/baseapp/chain_stream.go b/baseapp/chain_stream.go index bc343619264b..49f08fc96b31 100644 --- a/baseapp/chain_stream.go +++ b/baseapp/chain_stream.go @@ -12,10 +12,12 @@ type StreamEvents struct { func (app *BaseApp) AddStreamEvents(height int64, events []abci.Event, flush bool) { go func() { - app.StreamEvents <- StreamEvents{ - Events: events, - Height: uint64(height), - Flush: flush, + if app.EnableStreamer { + app.StreamEvents <- StreamEvents{ + Events: events, + Height: uint64(height), + Flush: flush, + } } }() } From 3ef76dad3cf7d0033c84e6473adf003f668e402b Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Mon, 18 Dec 2023 16:46:27 -0800 Subject: [PATCH 23/29] cherry pick: 5c9627ded --- baseapp/chain_stream.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/baseapp/chain_stream.go b/baseapp/chain_stream.go index 49f08fc96b31..59b9678e0053 100644 --- a/baseapp/chain_stream.go +++ b/baseapp/chain_stream.go @@ -11,13 +11,11 @@ type StreamEvents struct { } func (app *BaseApp) AddStreamEvents(height int64, events []abci.Event, flush bool) { - go func() { - if app.EnableStreamer { - app.StreamEvents <- StreamEvents{ - Events: events, - Height: uint64(height), - Flush: flush, - } + if app.EnableStreamer { + app.StreamEvents <- StreamEvents{ + Events: events, + Height: uint64(height), + Flush: flush, } - }() + } } From ebf5a40537d69598feaec9cebf904007d8fa4387 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Mon, 18 Dec 2023 16:54:39 -0800 Subject: [PATCH 24/29] cherry pick: 0427b6f53 --- api/cosmos/authz/v1beta1/tx_grpc.pb.go | 4 + .../tx/signing/v1beta1/signing.pulsar.go | 53 +++++++----- proto/cosmos/authz/v1beta1/tx.proto | 2 + proto/cosmos/tx/signing/v1beta1/signing.proto | 12 ++- types/tx/signing/signing.pb.go | 86 ++++++++++--------- x/authz/tx.pb.go | 4 + 6 files changed, 97 insertions(+), 64 deletions(-) diff --git a/api/cosmos/authz/v1beta1/tx_grpc.pb.go b/api/cosmos/authz/v1beta1/tx_grpc.pb.go index 260d71fcda68..78c53d4b3273 100644 --- a/api/cosmos/authz/v1beta1/tx_grpc.pb.go +++ b/api/cosmos/authz/v1beta1/tx_grpc.pb.go @@ -43,6 +43,8 @@ type MsgClient interface { // Revoke revokes any authorization corresponding to the provided method name // on the granter's account that has been granted to the grantee. Revoke(ctx context.Context, in *MsgRevoke, opts ...grpc.CallOption) (*MsgRevokeResponse, error) + // ExecCompat has same functionality as Exec but accepts array of json-encoded + // message string instead of []*Any ExecCompat(ctx context.Context, in *MsgExecCompat, opts ...grpc.CallOption) (*MsgExecCompatResponse, error) } @@ -106,6 +108,8 @@ type MsgServer interface { // Revoke revokes any authorization corresponding to the provided method name // on the granter's account that has been granted to the grantee. Revoke(context.Context, *MsgRevoke) (*MsgRevokeResponse, error) + // ExecCompat has same functionality as Exec but accepts array of json-encoded + // message string instead of []*Any ExecCompat(context.Context, *MsgExecCompat) (*MsgExecCompatResponse, error) mustEmbedUnimplementedMsgServer() } diff --git a/api/cosmos/tx/signing/v1beta1/signing.pulsar.go b/api/cosmos/tx/signing/v1beta1/signing.pulsar.go index 831e47585df9..9fa6e41bcc96 100644 --- a/api/cosmos/tx/signing/v1beta1/signing.pulsar.go +++ b/api/cosmos/tx/signing/v1beta1/signing.pulsar.go @@ -2736,6 +2736,10 @@ const ( // SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses // Amino JSON and will be removed in the future. SignMode_SIGN_MODE_LEGACY_AMINO_JSON SignMode = 127 + // Injective EIP712 support for any cosmos messages which uses proto-json + // encoded string for messages + // Signature verification is implemented in injective core + SignMode_SIGN_MODE_EIP712_V2 SignMode = 128 // SIGN_MODE_EIP_191 specifies the sign mode for EIP 191 signing on the Cosmos // SDK. Ref: https://eips.ethereum.org/EIPS/eip-191 // @@ -2757,6 +2761,7 @@ var ( 2: "SIGN_MODE_TEXTUAL", 3: "SIGN_MODE_DIRECT_AUX", 127: "SIGN_MODE_LEGACY_AMINO_JSON", + 128: "SIGN_MODE_EIP712_V2", 191: "SIGN_MODE_EIP_191", } SignMode_value = map[string]int32{ @@ -2765,6 +2770,7 @@ var ( "SIGN_MODE_TEXTUAL": 2, "SIGN_MODE_DIRECT_AUX": 3, "SIGN_MODE_LEGACY_AMINO_JSON": 127, + "SIGN_MODE_EIP712_V2": 128, "SIGN_MODE_EIP_191": 191, } ) @@ -2846,8 +2852,8 @@ type SignatureDescriptor struct { PublicKey *anypb.Any `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` Data *SignatureDescriptor_Data `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` // sequence is the sequence of the account, which describes the - // number of committed transactions signed by a given address. It is used to prevent - // replay attacks. + // number of committed transactions signed by a given address. It is used to + // prevent replay attacks. Sequence uint64 `protobuf:"varint,3,opt,name=sequence,proto3" json:"sequence,omitempty"` } @@ -2898,7 +2904,8 @@ type SignatureDescriptor_Data struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // sum is the oneof that specifies whether this represents single or multi-signature data + // sum is the oneof that specifies whether this represents single or + // multi-signature data // // Types that are assignable to Sum: // @@ -3115,7 +3122,7 @@ var file_cosmos_tx_signing_v1beta1_signing_proto_rawDesc = []byte{ 0x74, 0x78, 0x2e, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x52, 0x0a, 0x73, 0x69, 0x67, - 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x42, 0x05, 0x0a, 0x03, 0x73, 0x75, 0x6d, 0x2a, 0xa5, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x42, 0x05, 0x0a, 0x03, 0x73, 0x75, 0x6d, 0x2a, 0xbf, 0x01, 0x0a, 0x08, 0x53, 0x69, 0x67, 0x6e, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x19, 0x0a, 0x15, 0x53, 0x49, 0x47, 0x4e, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x49, 0x47, 0x4e, 0x5f, 0x4d, @@ -3124,24 +3131,26 @@ var file_cosmos_tx_signing_v1beta1_signing_proto_rawDesc = []byte{ 0x4c, 0x10, 0x02, 0x12, 0x18, 0x0a, 0x14, 0x53, 0x49, 0x47, 0x4e, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x44, 0x49, 0x52, 0x45, 0x43, 0x54, 0x5f, 0x41, 0x55, 0x58, 0x10, 0x03, 0x12, 0x1f, 0x0a, 0x1b, 0x53, 0x49, 0x47, 0x4e, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x4c, 0x45, 0x47, 0x41, 0x43, - 0x59, 0x5f, 0x41, 0x4d, 0x49, 0x4e, 0x4f, 0x5f, 0x4a, 0x53, 0x4f, 0x4e, 0x10, 0x7f, 0x12, 0x16, - 0x0a, 0x11, 0x53, 0x49, 0x47, 0x4e, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x45, 0x49, 0x50, 0x5f, - 0x31, 0x39, 0x31, 0x10, 0xbf, 0x01, 0x42, 0xef, 0x01, 0x0a, 0x1d, 0x63, 0x6f, 0x6d, 0x2e, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, - 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x0c, 0x53, 0x69, 0x67, 0x6e, 0x69, 0x6e, - 0x67, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x39, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2f, 0x74, 0x78, 0x2f, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x3b, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x54, 0x53, 0xaa, 0x02, 0x19, 0x43, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2e, 0x54, 0x78, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x56, 0x31, - 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x19, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x54, - 0x78, 0x5c, 0x53, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, - 0x31, 0xe2, 0x02, 0x25, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x54, 0x78, 0x5c, 0x53, 0x69, - 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, - 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x1c, 0x43, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x3a, 0x3a, 0x54, 0x78, 0x3a, 0x3a, 0x53, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x3a, - 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x59, 0x5f, 0x41, 0x4d, 0x49, 0x4e, 0x4f, 0x5f, 0x4a, 0x53, 0x4f, 0x4e, 0x10, 0x7f, 0x12, 0x18, + 0x0a, 0x13, 0x53, 0x49, 0x47, 0x4e, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x45, 0x49, 0x50, 0x37, + 0x31, 0x32, 0x5f, 0x56, 0x32, 0x10, 0x80, 0x01, 0x12, 0x16, 0x0a, 0x11, 0x53, 0x49, 0x47, 0x4e, + 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x45, 0x49, 0x50, 0x5f, 0x31, 0x39, 0x31, 0x10, 0xbf, 0x01, + 0x42, 0xef, 0x01, 0x0a, 0x1d, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x74, 0x78, 0x2e, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x42, 0x0c, 0x53, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x50, 0x01, 0x5a, 0x39, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x74, 0x78, 0x2f, 0x73, + 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x73, + 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, + 0x43, 0x54, 0x53, 0xaa, 0x02, 0x19, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x54, 0x78, 0x2e, + 0x53, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, + 0x02, 0x19, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x54, 0x78, 0x5c, 0x53, 0x69, 0x67, 0x6e, + 0x69, 0x6e, 0x67, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x25, 0x43, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x54, 0x78, 0x5c, 0x53, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x5c, + 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0xea, 0x02, 0x1c, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x54, 0x78, + 0x3a, 0x3a, 0x53, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/proto/cosmos/authz/v1beta1/tx.proto b/proto/cosmos/authz/v1beta1/tx.proto index a141fd3b658e..8d77c2cabb2b 100644 --- a/proto/cosmos/authz/v1beta1/tx.proto +++ b/proto/cosmos/authz/v1beta1/tx.proto @@ -31,6 +31,8 @@ service Msg { // on the granter's account that has been granted to the grantee. rpc Revoke(MsgRevoke) returns (MsgRevokeResponse); + // ExecCompat has same functionality as Exec but accepts array of json-encoded + // message string instead of []*Any rpc ExecCompat(MsgExecCompat) returns (MsgExecCompatResponse); } diff --git a/proto/cosmos/tx/signing/v1beta1/signing.proto b/proto/cosmos/tx/signing/v1beta1/signing.proto index 584eff4e41fd..9e747bc3101f 100644 --- a/proto/cosmos/tx/signing/v1beta1/signing.proto +++ b/proto/cosmos/tx/signing/v1beta1/signing.proto @@ -41,6 +41,11 @@ enum SignMode { // Amino JSON and will be removed in the future. SIGN_MODE_LEGACY_AMINO_JSON = 127; + // Injective EIP712 support for any cosmos messages which uses proto-json + // encoded string for messages + // Signature verification is implemented in injective core + SIGN_MODE_EIP712_V2 = 128; + // SIGN_MODE_EIP_191 specifies the sign mode for EIP 191 signing on the Cosmos // SDK. Ref: https://eips.ethereum.org/EIPS/eip-191 // @@ -71,13 +76,14 @@ message SignatureDescriptor { Data data = 2; // sequence is the sequence of the account, which describes the - // number of committed transactions signed by a given address. It is used to prevent - // replay attacks. + // number of committed transactions signed by a given address. It is used to + // prevent replay attacks. uint64 sequence = 3; // Data represents signature data message Data { - // sum is the oneof that specifies whether this represents single or multi-signature data + // sum is the oneof that specifies whether this represents single or + // multi-signature data oneof sum { // single represents a single signer Single single = 1; diff --git a/types/tx/signing/signing.pb.go b/types/tx/signing/signing.pb.go index 6266b113ec9c..f8f7635cb2b0 100644 --- a/types/tx/signing/signing.pb.go +++ b/types/tx/signing/signing.pb.go @@ -56,6 +56,10 @@ const ( // SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses // Amino JSON and will be removed in the future. SignMode_SIGN_MODE_LEGACY_AMINO_JSON SignMode = 127 + // Injective EIP712 support for any cosmos messages which uses proto-json + // encoded string for messages + // Signature verification is implemented in injective core + SignMode_SIGN_MODE_EIP712_V2 SignMode = 128 // SIGN_MODE_EIP_191 specifies the sign mode for EIP 191 signing on the Cosmos // SDK. Ref: https://eips.ethereum.org/EIPS/eip-191 // @@ -75,6 +79,7 @@ var SignMode_name = map[int32]string{ 2: "SIGN_MODE_TEXTUAL", 3: "SIGN_MODE_DIRECT_AUX", 127: "SIGN_MODE_LEGACY_AMINO_JSON", + 128: "SIGN_MODE_EIP712_V2", 191: "SIGN_MODE_EIP_191", } @@ -84,6 +89,7 @@ var SignMode_value = map[string]int32{ "SIGN_MODE_TEXTUAL": 2, "SIGN_MODE_DIRECT_AUX": 3, "SIGN_MODE_LEGACY_AMINO_JSON": 127, + "SIGN_MODE_EIP712_V2": 128, "SIGN_MODE_EIP_191": 191, } @@ -150,8 +156,8 @@ type SignatureDescriptor struct { PublicKey *types.Any `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` Data *SignatureDescriptor_Data `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` // sequence is the sequence of the account, which describes the - // number of committed transactions signed by a given address. It is used to prevent - // replay attacks. + // number of committed transactions signed by a given address. It is used to + // prevent replay attacks. Sequence uint64 `protobuf:"varint,3,opt,name=sequence,proto3" json:"sequence,omitempty"` } @@ -211,7 +217,8 @@ func (m *SignatureDescriptor) GetSequence() uint64 { // Data represents signature data type SignatureDescriptor_Data struct { - // sum is the oneof that specifies whether this represents single or multi-signature data + // sum is the oneof that specifies whether this represents single or + // multi-signature data // // Types that are valid to be assigned to Sum: // @@ -422,43 +429,44 @@ func init() { } var fileDescriptor_9a54958ff3d0b1b9 = []byte{ - // 573 bytes of a gzipped FileDescriptorProto + // 588 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0xc1, 0x6e, 0xd3, 0x4c, - 0x10, 0xc7, 0xed, 0x26, 0xad, 0xda, 0xe9, 0xa7, 0x4f, 0x66, 0x49, 0x51, 0x6a, 0x90, 0xa9, 0xca, - 0x81, 0x0a, 0xa9, 0x6b, 0xa5, 0x3d, 0xa0, 0x72, 0x73, 0x13, 0x93, 0x9a, 0x36, 0x69, 0xb1, 0x53, - 0xa9, 0x70, 0xb1, 0x6c, 0x67, 0x6b, 0xac, 0xc6, 0x5e, 0xe3, 0x5d, 0xa3, 0xfa, 0xc4, 0x2b, 0xf0, - 0x12, 0x1c, 0x78, 0x0a, 0x0e, 0x5c, 0x38, 0xf6, 0xc8, 0x11, 0x25, 0xcf, 0xc0, 0x1d, 0xc5, 0x8e, - 0x93, 0x80, 0x8a, 0x10, 0x39, 0x59, 0x33, 0xf3, 0xdf, 0xdf, 0xfc, 0x57, 0x33, 0x6b, 0x78, 0xec, - 0x51, 0x16, 0x52, 0xa6, 0xf2, 0x6b, 0x95, 0x05, 0x7e, 0x14, 0x44, 0xbe, 0xfa, 0xae, 0xe1, 0x12, - 0xee, 0x34, 0xca, 0x18, 0xc7, 0x09, 0xe5, 0x14, 0x6d, 0x16, 0x42, 0xcc, 0xaf, 0x71, 0x59, 0x98, - 0x08, 0xe5, 0xdd, 0x09, 0xc3, 0x4b, 0xb2, 0x98, 0x53, 0x35, 0x4c, 0x07, 0x3c, 0x60, 0xc1, 0x0c, - 0x54, 0x26, 0x0a, 0x92, 0xbc, 0xe9, 0x53, 0xea, 0x0f, 0x88, 0x9a, 0x47, 0x6e, 0x7a, 0xa9, 0x3a, - 0x51, 0x56, 0x94, 0xb6, 0x2f, 0xa1, 0x66, 0x05, 0x7e, 0xe4, 0xf0, 0x34, 0x21, 0x2d, 0xc2, 0xbc, - 0x24, 0x88, 0x39, 0x4d, 0x18, 0xea, 0x02, 0xb0, 0x32, 0xcf, 0xea, 0xe2, 0x56, 0x65, 0x67, 0x7d, - 0x0f, 0xe3, 0x3f, 0x3a, 0xc2, 0xb7, 0x40, 0xcc, 0x39, 0xc2, 0xf6, 0x8f, 0x2a, 0xdc, 0xbd, 0x45, - 0x83, 0xf6, 0x01, 0xe2, 0xd4, 0x1d, 0x04, 0x9e, 0x7d, 0x45, 0xb2, 0xba, 0xb8, 0x25, 0xee, 0xac, - 0xef, 0xd5, 0x70, 0xe1, 0x17, 0x97, 0x7e, 0xb1, 0x16, 0x65, 0xe6, 0x5a, 0xa1, 0x3b, 0x26, 0x19, - 0x6a, 0x43, 0xb5, 0xef, 0x70, 0xa7, 0xbe, 0x94, 0xcb, 0xf7, 0xff, 0xcd, 0x16, 0x6e, 0x39, 0xdc, - 0x31, 0x73, 0x00, 0x92, 0x61, 0x95, 0x91, 0xb7, 0x29, 0x89, 0x3c, 0x52, 0xaf, 0x6c, 0x89, 0x3b, - 0x55, 0x73, 0x1a, 0xcb, 0x5f, 0x2a, 0x50, 0x1d, 0x4b, 0x51, 0x0f, 0x56, 0x58, 0x10, 0xf9, 0x03, - 0x32, 0xb1, 0xf7, 0x6c, 0x81, 0x7e, 0xd8, 0xca, 0x09, 0x47, 0x82, 0x39, 0x61, 0xa1, 0x97, 0xb0, - 0x9c, 0x4f, 0x69, 0x72, 0x89, 0x83, 0x45, 0xa0, 0x9d, 0x31, 0xe0, 0x48, 0x30, 0x0b, 0x92, 0x6c, - 0xc3, 0x4a, 0xd1, 0x06, 0x3d, 0x85, 0x6a, 0x48, 0xfb, 0x85, 0xe1, 0xff, 0xf7, 0x1e, 0xfd, 0x85, - 0xdd, 0xa1, 0x7d, 0x62, 0xe6, 0x07, 0xd0, 0x03, 0x58, 0x9b, 0x0e, 0x2d, 0x77, 0xf6, 0x9f, 0x39, - 0x4b, 0xc8, 0x9f, 0x44, 0x58, 0xce, 0x7b, 0xa2, 0x63, 0x58, 0x75, 0x03, 0xee, 0x24, 0x89, 0x53, - 0x0e, 0x4d, 0x2d, 0x9b, 0x14, 0x3b, 0x89, 0xa7, 0x2b, 0x58, 0x76, 0x6a, 0xd2, 0x30, 0x76, 0x3c, - 0x7e, 0x18, 0x70, 0x6d, 0x7c, 0xcc, 0x9c, 0x02, 0x90, 0xf5, 0xcb, 0xae, 0x2d, 0xe5, 0xbb, 0xb6, - 0xd0, 0x50, 0xe7, 0x30, 0x87, 0xcb, 0x50, 0x61, 0x69, 0xf8, 0xe4, 0xa3, 0x08, 0xab, 0xe5, 0x1d, - 0xd1, 0x26, 0x6c, 0x58, 0x46, 0xbb, 0x6b, 0x77, 0x4e, 0x5b, 0xba, 0x7d, 0xde, 0xb5, 0xce, 0xf4, - 0xa6, 0xf1, 0xdc, 0xd0, 0x5b, 0x92, 0x80, 0x6a, 0x20, 0xcd, 0x4a, 0x2d, 0xc3, 0xd4, 0x9b, 0x3d, - 0x49, 0x44, 0x1b, 0x70, 0x67, 0x96, 0xed, 0xe9, 0x17, 0xbd, 0x73, 0xed, 0x44, 0x5a, 0x42, 0x75, - 0xa8, 0xfd, 0x2e, 0xb6, 0xb5, 0xf3, 0x0b, 0xa9, 0x82, 0x1e, 0xc2, 0xfd, 0x59, 0xe5, 0x44, 0x6f, - 0x6b, 0xcd, 0x57, 0xb6, 0xd6, 0x31, 0xba, 0xa7, 0xf6, 0x0b, 0xeb, 0xb4, 0x2b, 0xbd, 0x47, 0xf7, - 0xe6, 0x89, 0xba, 0x71, 0x66, 0x37, 0x0e, 0x1a, 0xd2, 0x67, 0xf1, 0xb0, 0xfd, 0x75, 0xa8, 0x88, - 0x37, 0x43, 0x45, 0xfc, 0x3e, 0x54, 0xc4, 0x0f, 0x23, 0x45, 0xb8, 0x19, 0x29, 0xc2, 0xb7, 0x91, - 0x22, 0xbc, 0xde, 0xf5, 0x03, 0xfe, 0x26, 0x75, 0xb1, 0x47, 0x43, 0xb5, 0x7c, 0xf6, 0xf9, 0x67, - 0x97, 0xf5, 0xaf, 0x54, 0x9e, 0xc5, 0x64, 0xfe, 0x5f, 0xe2, 0xae, 0xe4, 0x8f, 0x66, 0xff, 0x67, - 0x00, 0x00, 0x00, 0xff, 0xff, 0x02, 0x3d, 0xad, 0x03, 0x67, 0x04, 0x00, 0x00, + 0x10, 0xc7, 0xb3, 0x4d, 0x5a, 0xb5, 0xd3, 0x4f, 0x9f, 0xcc, 0x36, 0x45, 0x69, 0x40, 0xa1, 0x2a, + 0x07, 0x2a, 0xa4, 0xae, 0x95, 0xf4, 0x50, 0x95, 0x9b, 0x9b, 0x98, 0xd4, 0xb4, 0x49, 0x8b, 0x9d, + 0xa2, 0xc2, 0xc5, 0xb2, 0x9d, 0xad, 0xb1, 0x1a, 0x7b, 0x8d, 0x77, 0x8d, 0xea, 0x13, 0x3c, 0x02, + 0xaf, 0xc1, 0x53, 0xf4, 0xc0, 0x85, 0x63, 0x8f, 0x1c, 0x51, 0xfb, 0x0c, 0xdc, 0x51, 0xed, 0x38, + 0x0e, 0xa8, 0x08, 0x91, 0x93, 0x35, 0x33, 0xff, 0xfd, 0xcd, 0x7f, 0x35, 0xe3, 0x85, 0x27, 0x0e, + 0xe3, 0x3e, 0xe3, 0xb2, 0xb8, 0x90, 0xb9, 0xe7, 0x06, 0x5e, 0xe0, 0xca, 0xef, 0x9b, 0x36, 0x15, + 0x56, 0x33, 0x8f, 0x49, 0x18, 0x31, 0xc1, 0xf0, 0x5a, 0x26, 0x24, 0xe2, 0x82, 0xe4, 0x85, 0xb1, + 0xb0, 0xbe, 0x35, 0x66, 0x38, 0x51, 0x12, 0x0a, 0x26, 0xfb, 0xf1, 0x48, 0x78, 0xdc, 0x2b, 0x40, + 0x79, 0x22, 0x23, 0xd5, 0xd7, 0x5c, 0xc6, 0xdc, 0x11, 0x95, 0xd3, 0xc8, 0x8e, 0xcf, 0x64, 0x2b, + 0x48, 0xb2, 0xd2, 0xc6, 0x19, 0x54, 0x0d, 0xcf, 0x0d, 0x2c, 0x11, 0x47, 0xb4, 0x43, 0xb9, 0x13, + 0x79, 0xa1, 0x60, 0x11, 0xc7, 0x7d, 0x00, 0x9e, 0xe7, 0x79, 0x0d, 0xad, 0x97, 0x37, 0x97, 0x5b, + 0x84, 0xfc, 0xd1, 0x11, 0xb9, 0x03, 0xa2, 0x4f, 0x11, 0x36, 0x7e, 0x54, 0x60, 0xe5, 0x0e, 0x0d, + 0xde, 0x06, 0x08, 0x63, 0x7b, 0xe4, 0x39, 0xe6, 0x39, 0x4d, 0x6a, 0x68, 0x1d, 0x6d, 0x2e, 0xb7, + 0xaa, 0x24, 0xf3, 0x4b, 0x72, 0xbf, 0x44, 0x09, 0x12, 0x7d, 0x29, 0xd3, 0x1d, 0xd0, 0x04, 0x77, + 0xa1, 0x32, 0xb4, 0x84, 0x55, 0x9b, 0x4b, 0xe5, 0xdb, 0xff, 0x66, 0x8b, 0x74, 0x2c, 0x61, 0xe9, + 0x29, 0x00, 0xd7, 0x61, 0x91, 0xd3, 0x77, 0x31, 0x0d, 0x1c, 0x5a, 0x2b, 0xaf, 0xa3, 0xcd, 0x8a, + 0x3e, 0x89, 0xeb, 0x5f, 0xca, 0x50, 0xb9, 0x95, 0xe2, 0x01, 0x2c, 0x70, 0x2f, 0x70, 0x47, 0x74, + 0x6c, 0xef, 0xd9, 0x0c, 0xfd, 0x88, 0x91, 0x12, 0xf6, 0x4b, 0xfa, 0x98, 0x85, 0x5f, 0xc2, 0x7c, + 0x3a, 0xa5, 0xf1, 0x25, 0x76, 0x67, 0x81, 0xf6, 0x6e, 0x01, 0xfb, 0x25, 0x3d, 0x23, 0xd5, 0x4d, + 0x58, 0xc8, 0xda, 0xe0, 0x1d, 0xa8, 0xf8, 0x6c, 0x98, 0x19, 0xfe, 0xbf, 0xf5, 0xf8, 0x2f, 0xec, + 0x1e, 0x1b, 0x52, 0x3d, 0x3d, 0x80, 0x1f, 0xc2, 0xd2, 0x64, 0x68, 0xa9, 0xb3, 0xff, 0xf4, 0x22, + 0x51, 0xff, 0x8c, 0x60, 0x3e, 0xed, 0x89, 0x0f, 0x60, 0xd1, 0xf6, 0x84, 0x15, 0x45, 0x56, 0x3e, + 0x34, 0x39, 0x6f, 0x92, 0xed, 0x24, 0x99, 0xac, 0x60, 0xde, 0xa9, 0xcd, 0xfc, 0xd0, 0x72, 0xc4, + 0x9e, 0x27, 0x94, 0xdb, 0x63, 0xfa, 0x04, 0x80, 0x8d, 0x5f, 0x76, 0x6d, 0x2e, 0xdd, 0xb5, 0x99, + 0x86, 0x3a, 0x85, 0xd9, 0x9b, 0x87, 0x32, 0x8f, 0xfd, 0xa7, 0x97, 0x08, 0x16, 0xf3, 0x3b, 0xe2, + 0x35, 0x58, 0x35, 0xb4, 0x6e, 0xdf, 0xec, 0x1d, 0x75, 0x54, 0xf3, 0xa4, 0x6f, 0x1c, 0xab, 0x6d, + 0xed, 0xb9, 0xa6, 0x76, 0xa4, 0x12, 0xae, 0x82, 0x54, 0x94, 0x3a, 0x9a, 0xae, 0xb6, 0x07, 0x12, + 0xc2, 0xab, 0x70, 0xaf, 0xc8, 0x0e, 0xd4, 0xd3, 0xc1, 0x89, 0x72, 0x28, 0xcd, 0xe1, 0x1a, 0x54, + 0x7f, 0x17, 0x9b, 0xca, 0xc9, 0xa9, 0x54, 0xc6, 0x8f, 0xe0, 0x41, 0x51, 0x39, 0x54, 0xbb, 0x4a, + 0xfb, 0xb5, 0xa9, 0xf4, 0xb4, 0xfe, 0x91, 0xf9, 0xc2, 0x38, 0xea, 0x4b, 0x1f, 0x70, 0x0d, 0x56, + 0x0a, 0x81, 0xaa, 0x1d, 0xef, 0x34, 0x5b, 0xe6, 0xab, 0x96, 0xf4, 0x11, 0xe1, 0xfb, 0xd3, 0xbd, + 0x54, 0xed, 0xd8, 0x6c, 0xee, 0x36, 0xa5, 0x4b, 0xb4, 0xd7, 0xfd, 0x7a, 0xdd, 0x40, 0x57, 0xd7, + 0x0d, 0xf4, 0xfd, 0xba, 0x81, 0x3e, 0xdd, 0x34, 0x4a, 0x57, 0x37, 0x8d, 0xd2, 0xb7, 0x9b, 0x46, + 0xe9, 0xcd, 0x96, 0xeb, 0x89, 0xb7, 0xb1, 0x4d, 0x1c, 0xe6, 0xcb, 0xf9, 0x83, 0x90, 0x7e, 0xb6, + 0xf8, 0xf0, 0x5c, 0x16, 0x49, 0x48, 0xa7, 0x5f, 0x19, 0x7b, 0x21, 0xfd, 0x9d, 0xb6, 0x7f, 0x06, + 0x00, 0x00, 0xff, 0xff, 0x8a, 0x41, 0x0e, 0x24, 0x81, 0x04, 0x00, 0x00, } func (m *SignatureDescriptors) Marshal() (dAtA []byte, err error) { diff --git a/x/authz/tx.pb.go b/x/authz/tx.pb.go index f44f2ad50329..f4aec54d3bc2 100644 --- a/x/authz/tx.pb.go +++ b/x/authz/tx.pb.go @@ -427,6 +427,8 @@ type MsgClient interface { // Revoke revokes any authorization corresponding to the provided method name // on the granter's account that has been granted to the grantee. Revoke(ctx context.Context, in *MsgRevoke, opts ...grpc.CallOption) (*MsgRevokeResponse, error) + // ExecCompat has same functionality as Exec but accepts array of json-encoded + // message string instead of []*Any ExecCompat(ctx context.Context, in *MsgExecCompat, opts ...grpc.CallOption) (*MsgExecCompatResponse, error) } @@ -488,6 +490,8 @@ type MsgServer interface { // Revoke revokes any authorization corresponding to the provided method name // on the granter's account that has been granted to the grantee. Revoke(context.Context, *MsgRevoke) (*MsgRevokeResponse, error) + // ExecCompat has same functionality as Exec but accepts array of json-encoded + // message string instead of []*Any ExecCompat(context.Context, *MsgExecCompat) (*MsgExecCompatResponse, error) } From 562218df282679e098be628b2c4cfc5ce6fdc918 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Mon, 18 Dec 2023 17:03:07 -0800 Subject: [PATCH 25/29] cherry pick: d5f931fe0b --- baseapp/baseapp.go | 11 ++++++++--- baseapp/chain_stream.go | 18 +++++++++++------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index d86a816e5a00..0d45f03efd42 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -724,7 +724,9 @@ func (app *BaseApp) beginBlock(req *abci.RequestFinalizeBlock) (sdk.BeginBlock, ) } - app.AddStreamEvents(app.finalizeBlockState.ctx.BlockHeight(), resp.Events, true) + ctx := app.finalizeBlockState.ctx + app.AddStreamEvents(ctx.BlockHeight(), ctx.BlockTime(), resp.Events, true) + resp.Events = sdk.MarkEventsToIndex(resp.Events, app.indexEvents) } @@ -757,7 +759,8 @@ func (app *BaseApp) deliverTx(tx []byte) *abci.ExecTxResult { return resp } - app.AddStreamEvents(app.checkState.Context().BlockHeight(), result.Events, false) + ctx := app.checkState.Context() + app.AddStreamEvents(ctx.BlockHeight(), ctx.BlockTime(), result.Events, false) resp = &abci.ExecTxResult{ GasWanted: int64(gInfo.GasWanted), @@ -789,7 +792,9 @@ func (app *BaseApp) endBlock(ctx context.Context) (sdk.EndBlock, error) { ) } - app.AddStreamEvents(app.finalizeBlockState.ctx.BlockHeight(), eb.Events, true) + ctx := app.finalizeBlockState.ctx + app.AddStreamEvents(ctx.BlockHeight(), ctx.BlockTime(), eb.Events, true) + eb.Events = sdk.MarkEventsToIndex(eb.Events, app.indexEvents) endblock = eb } diff --git a/baseapp/chain_stream.go b/baseapp/chain_stream.go index 59b9678e0053..91d31d0e7771 100644 --- a/baseapp/chain_stream.go +++ b/baseapp/chain_stream.go @@ -1,21 +1,25 @@ package baseapp import ( + "time" + abci "github.com/cometbft/cometbft/abci/types" ) type StreamEvents struct { - Events []abci.Event - Height uint64 - Flush bool + Events []abci.Event + Height uint64 + BlockTime time.Time + Flush bool } -func (app *BaseApp) AddStreamEvents(height int64, events []abci.Event, flush bool) { +func (app *BaseApp) AddStreamEvents(height int64, blockTime time.Time, events []abci.Event, flush bool) { if app.EnableStreamer { app.StreamEvents <- StreamEvents{ - Events: events, - Height: uint64(height), - Flush: flush, + Events: events, + Height: uint64(height), + BlockTime: blockTime, + Flush: flush, } } } From 4bb2d50be2a9ca44010c80fe739d609cab44a269 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Mon, 18 Dec 2023 17:05:12 -0800 Subject: [PATCH 26/29] cherry pick: 3a97c08f884 --- x/bank/keeper/send.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/x/bank/keeper/send.go b/x/bank/keeper/send.go index 1c5a967df696..c6db3c458dd4 100644 --- a/x/bank/keeper/send.go +++ b/x/bank/keeper/send.go @@ -207,13 +207,12 @@ func (k BaseSendKeeper) InputOutputCoins(ctx context.Context, input types.Input, // SendCoins transfers amt coins from a sending account to a receiving account. // An error is returned upon failure. func (k BaseSendKeeper) SendCoins(ctx context.Context, fromAddr, toAddr sdk.AccAddress, amt sdk.Coins) error { - var err error - err = k.subUnlockedCoins(ctx, fromAddr, amt) + toAddr, err := k.sendRestriction.apply(ctx, fromAddr, toAddr, amt) if err != nil { return err } - toAddr, err = k.sendRestriction.apply(ctx, fromAddr, toAddr, amt) + err = k.subUnlockedCoins(ctx, fromAddr, amt) if err != nil { return err } From dc1791121e91f11d26b3c05c5a1edfe12c502432 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Mon, 18 Dec 2023 17:11:49 -0800 Subject: [PATCH 27/29] fix Proto and tests --- api/cosmos/bank/v1beta1/events.pulsar.go | 45 ++++++++++++----------- proto/cosmos/bank/v1beta1/events.proto | 5 ++- server/mock/store.go | 8 +++++ x/bank/keeper/collections_test.go | 3 ++ x/bank/keeper/keeper_test.go | 6 ++++ x/bank/types/events.pb.go | 46 ++++++++++++------------ 6 files changed, 64 insertions(+), 49 deletions(-) diff --git a/api/cosmos/bank/v1beta1/events.pulsar.go b/api/cosmos/bank/v1beta1/events.pulsar.go index 3a979c717249..19355eb04f28 100644 --- a/api/cosmos/bank/v1beta1/events.pulsar.go +++ b/api/cosmos/bank/v1beta1/events.pulsar.go @@ -1179,29 +1179,28 @@ var file_cosmos_bank_v1beta1_events_proto_rawDesc = []byte{ 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x0e, 0x62, 0x61, - 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x22, 0x8e, 0x01, 0x0a, - 0x0d, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x12, - 0x0a, 0x04, 0x61, 0x64, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x61, 0x64, - 0x64, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x05, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x12, 0x53, 0x0a, 0x03, 0x61, 0x6d, 0x74, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x41, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x26, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, - 0x73, 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, - 0x49, 0x6e, 0x74, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x03, 0x61, 0x6d, 0x74, 0x42, 0xc6, 0x01, - 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x6e, - 0x6b, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x0b, 0x45, 0x76, 0x65, 0x6e, 0x74, - 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2f, 0x62, 0x61, 0x6e, 0x6b, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x62, - 0x61, 0x6e, 0x6b, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x42, 0x58, - 0xaa, 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x42, 0x61, 0x6e, 0x6b, 0x2e, 0x56, - 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, - 0x42, 0x61, 0x6e, 0x6b, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x1f, 0x43, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x42, 0x61, 0x6e, 0x6b, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, - 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, - 0x15, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x42, 0x61, 0x6e, 0x6b, 0x3a, 0x3a, 0x56, - 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x22, 0x78, 0x0a, 0x0d, + 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x12, 0x0a, + 0x04, 0x61, 0x64, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x61, 0x64, 0x64, + 0x72, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x05, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x12, 0x3d, 0x0a, 0x03, 0x61, 0x6d, 0x74, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, + 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, + 0x74, 0x52, 0x03, 0x61, 0x6d, 0x74, 0x42, 0xc6, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x42, 0x0b, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, + 0x01, 0x5a, 0x30, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x6e, 0x6b, 0x2f, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x62, 0x61, 0x6e, 0x6b, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x42, 0x58, 0xaa, 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x42, 0x61, 0x6e, 0x6b, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, + 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x42, 0x61, 0x6e, 0x6b, 0x5c, 0x56, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x1f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x42, + 0x61, 0x6e, 0x6b, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x15, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x3a, 0x3a, 0x42, 0x61, 0x6e, 0x6b, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/proto/cosmos/bank/v1beta1/events.proto b/proto/cosmos/bank/v1beta1/events.proto index 980c5d42127a..f6d7d84524a0 100644 --- a/proto/cosmos/bank/v1beta1/events.proto +++ b/proto/cosmos/bank/v1beta1/events.proto @@ -19,8 +19,7 @@ message BalanceUpdate { // the latest amount string amt = 3 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false ]; } diff --git a/server/mock/store.go b/server/mock/store.go index 6e8a30364614..6135ef57225e 100644 --- a/server/mock/store.go +++ b/server/mock/store.go @@ -168,6 +168,14 @@ func (ms multiStore) WorkingHash() []byte { panic("not implemented") } +func (ms multiStore) SetCommitSync(_ bool) { + panic("not implemented") +} + +func (ms multiStore) GetCommitSync() bool { + panic("not implemented") +} + var _ storetypes.KVStore = kvStore{} type kvStore struct { diff --git a/x/bank/keeper/collections_test.go b/x/bank/keeper/collections_test.go index e1af343cce56..ab1d50bf36d1 100644 --- a/x/bank/keeper/collections_test.go +++ b/x/bank/keeper/collections_test.go @@ -26,11 +26,13 @@ import ( func TestBankStateCompatibility(t *testing.T) { key := storetypes.NewKVStoreKey(banktypes.StoreKey) + tKey := storetypes.NewTransientStoreKey("transient_key") testCtx := testutil.DefaultContextWithDB(t, key, storetypes.NewTransientStoreKey("transient_test")) ctx := testCtx.Ctx.WithBlockHeader(cmtproto.Header{Time: cmttime.Now()}) encCfg := moduletestutil.MakeTestEncodingConfig() storeService := runtime.NewKVStoreService(key) + tStoreService := runtime.NewTransientKVStoreService(tKey) // gomock initializations ctrl := gomock.NewController(t) @@ -40,6 +42,7 @@ func TestBankStateCompatibility(t *testing.T) { k := keeper.NewBaseKeeper( encCfg.Codec, storeService, + tStoreService, authKeeper, map[string]bool{accAddrs[4].String(): true}, authtypes.NewModuleAddress("gov").String(), diff --git a/x/bank/keeper/keeper_test.go b/x/bank/keeper/keeper_test.go index 4bb11862eb62..8cdaac5a6fa1 100644 --- a/x/bank/keeper/keeper_test.go +++ b/x/bank/keeper/keeper_test.go @@ -130,11 +130,13 @@ func TestKeeperTestSuite(t *testing.T) { func (suite *KeeperTestSuite) SetupTest() { key := storetypes.NewKVStoreKey(banktypes.StoreKey) + tKey := storetypes.NewTransientStoreKey("transient_key") testCtx := testutil.DefaultContextWithDB(suite.T(), key, storetypes.NewTransientStoreKey("transient_test")) ctx := testCtx.Ctx.WithBlockHeader(cmtproto.Header{Time: cmttime.Now()}) encCfg := moduletestutil.MakeTestEncodingConfig() storeService := runtime.NewKVStoreService(key) + tStoreService := runtime.NewTransientKVStoreService(tKey) // gomock initializations ctrl := gomock.NewController(suite.T()) @@ -145,6 +147,7 @@ func (suite *KeeperTestSuite) SetupTest() { suite.bankKeeper = keeper.NewBaseKeeper( encCfg.Codec, storeService, + tStoreService, suite.authKeeper, map[string]bool{accAddrs[4].String(): true}, authtypes.NewModuleAddress(govtypes.ModuleName).String(), @@ -312,10 +315,13 @@ func (suite *KeeperTestSuite) TestPrependSendRestriction() { func (suite *KeeperTestSuite) TestGetAuthority() { storeService := runtime.NewKVStoreService(storetypes.NewKVStoreKey(banktypes.StoreKey)) + tStoreService := runtime.NewTransientKVStoreService(storetypes.NewTransientStoreKey("transient_key")) + NewKeeperWithAuthority := func(authority string) keeper.BaseKeeper { return keeper.NewBaseKeeper( moduletestutil.MakeTestEncodingConfig().Codec, storeService, + tStoreService, suite.authKeeper, nil, authority, diff --git a/x/bank/types/events.pb.go b/x/bank/types/events.pb.go index b7dc8810b9d4..8088d415f536 100644 --- a/x/bank/types/events.pb.go +++ b/x/bank/types/events.pb.go @@ -4,9 +4,9 @@ package types import ( + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" @@ -76,7 +76,7 @@ type BalanceUpdate struct { Addr []byte `protobuf:"bytes,1,opt,name=addr,proto3" json:"addr,omitempty"` Denom []byte `protobuf:"bytes,2,opt,name=denom,proto3" json:"denom,omitempty"` // the latest amount - Amt github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=amt,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amt"` + Amt cosmossdk_io_math.Int `protobuf:"bytes,3,opt,name=amt,proto3,customtype=cosmossdk.io/math.Int" json:"amt"` } func (m *BalanceUpdate) Reset() { *m = BalanceUpdate{} } @@ -134,27 +134,27 @@ func init() { func init() { proto.RegisterFile("cosmos/bank/v1beta1/events.proto", fileDescriptor_ad7d0e6fd39d7db3) } var fileDescriptor_ad7d0e6fd39d7db3 = []byte{ - // 309 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x48, 0xce, 0x2f, 0xce, - 0xcd, 0x2f, 0xd6, 0x4f, 0x4a, 0xcc, 0xcb, 0xd6, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, - 0x4f, 0x2d, 0x4b, 0xcd, 0x2b, 0x29, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x86, 0xa8, - 0xd0, 0x03, 0xa9, 0xd0, 0x83, 0xaa, 0x90, 0x92, 0x84, 0x08, 0xc6, 0x83, 0x95, 0xe8, 0x43, 0x55, - 0x80, 0x39, 0x52, 0x22, 0xe9, 0xf9, 0xe9, 0xf9, 0x10, 0x71, 0x10, 0x0b, 0x2a, 0x2a, 0x98, 0x98, - 0x9b, 0x99, 0x97, 0xaf, 0x0f, 0x26, 0x21, 0x42, 0x4a, 0xf1, 0x5c, 0x02, 0xae, 0x20, 0x8b, 0x82, - 0x53, 0x4b, 0x9c, 0x12, 0x73, 0x12, 0xf3, 0x92, 0x53, 0x8b, 0x85, 0xbc, 0xb9, 0xf8, 0x93, 0x20, - 0xec, 0xf8, 0xd2, 0x82, 0x94, 0xc4, 0x92, 0xd4, 0x62, 0x09, 0x46, 0x05, 0x66, 0x0d, 0x6e, 0x23, - 0x25, 0x3d, 0x2c, 0xce, 0xd0, 0x83, 0xea, 0x0b, 0x05, 0x2b, 0x0d, 0xe2, 0x4b, 0x42, 0xe6, 0x16, - 0x2b, 0xf5, 0x31, 0x72, 0xf1, 0xa2, 0xa8, 0x10, 0x12, 0xe2, 0x62, 0x49, 0x4c, 0x49, 0x29, 0x92, - 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x09, 0x02, 0xb3, 0x85, 0x44, 0xb8, 0x58, 0x53, 0x52, 0xf3, 0xf2, - 0x73, 0x25, 0x98, 0xc0, 0x82, 0x10, 0x8e, 0x50, 0x30, 0x17, 0x73, 0x62, 0x6e, 0x89, 0x04, 0xb3, - 0x02, 0xa3, 0x06, 0xa7, 0x93, 0xe3, 0x89, 0x7b, 0xf2, 0x0c, 0xb7, 0xee, 0xc9, 0xab, 0xa5, 0x67, - 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0x42, 0xfd, 0x0c, 0xa5, 0x74, 0x8b, 0x53, 0xb2, - 0xf5, 0x4b, 0x2a, 0x0b, 0x52, 0x8b, 0xf5, 0x3c, 0xf3, 0x4a, 0x2e, 0x6d, 0xd1, 0xe5, 0x82, 0xba, - 0xd6, 0x33, 0xaf, 0x64, 0xc5, 0xf3, 0x0d, 0x5a, 0x8c, 0x41, 0x20, 0xd3, 0x9c, 0x9c, 0x4f, 0x3c, - 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, - 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0x4a, 0x13, 0xaf, 0xc9, 0x15, 0x90, 0xe8, 0x01, - 0x5b, 0x90, 0xc4, 0x06, 0x0e, 0x3d, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x36, 0xf9, 0xd8, - 0x0f, 0xba, 0x01, 0x00, 0x00, + // 307 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x91, 0xbf, 0x4a, 0x43, 0x31, + 0x18, 0xc5, 0x6f, 0xac, 0x0a, 0xc6, 0xff, 0xb1, 0xc2, 0xb5, 0x43, 0x7a, 0xe9, 0x54, 0x91, 0x26, + 0x54, 0x67, 0x97, 0x8a, 0x43, 0x71, 0xab, 0xb8, 0xb8, 0x94, 0xa4, 0x09, 0x6d, 0xa9, 0x49, 0x4a, + 0x93, 0x96, 0xfa, 0x16, 0x3e, 0x8c, 0x0f, 0xd1, 0xb1, 0x38, 0x89, 0x43, 0x91, 0x7b, 0x5f, 0x44, + 0x6e, 0x92, 0x41, 0xc1, 0x25, 0x39, 0xe7, 0xf0, 0xfb, 0xc8, 0xe1, 0x0b, 0xcc, 0x06, 0xc6, 0x2a, + 0x63, 0x29, 0x67, 0x7a, 0x42, 0x17, 0x6d, 0x2e, 0x1d, 0x6b, 0x53, 0xb9, 0x90, 0xda, 0x59, 0x32, + 0x9d, 0x19, 0x67, 0xd0, 0x59, 0x20, 0x48, 0x49, 0x90, 0x48, 0xd4, 0x2e, 0x42, 0xd8, 0xf7, 0x08, + 0x8d, 0x84, 0x37, 0xb5, 0xea, 0xd0, 0x0c, 0x4d, 0xc8, 0x4b, 0x15, 0xd3, 0x53, 0xa6, 0xc6, 0xda, + 0x50, 0x7f, 0x86, 0xa8, 0xd1, 0x87, 0x27, 0xf7, 0xe5, 0x43, 0x8f, 0xd2, 0x75, 0xd8, 0x0b, 0xd3, + 0x03, 0x69, 0xd1, 0x03, 0x3c, 0xe6, 0x41, 0xf7, 0xe7, 0x53, 0xc1, 0x9c, 0xb4, 0x29, 0xc8, 0x2a, + 0xcd, 0xfd, 0xeb, 0x06, 0xf9, 0xa7, 0x06, 0x89, 0x73, 0x4f, 0x1e, 0xed, 0x1d, 0xf1, 0xdf, 0xd6, + 0x36, 0x96, 0xf0, 0xf0, 0x0f, 0x80, 0x10, 0xdc, 0x66, 0x42, 0xcc, 0x52, 0x90, 0x81, 0xe6, 0x41, + 0xcf, 0x6b, 0x54, 0x85, 0x3b, 0x42, 0x6a, 0xa3, 0xd2, 0x2d, 0x1f, 0x06, 0x83, 0x6e, 0x61, 0x85, + 0x29, 0x97, 0x56, 0x32, 0xd0, 0xdc, 0xeb, 0x5c, 0xad, 0x36, 0xf5, 0xe4, 0x6b, 0x53, 0x3f, 0x0f, + 0x15, 0xac, 0x98, 0x90, 0xb1, 0xa1, 0x8a, 0xb9, 0x11, 0xe9, 0x6a, 0xf7, 0xf1, 0xde, 0x82, 0xb1, + 0x5b, 0x57, 0xbb, 0x5e, 0x39, 0xd7, 0xb9, 0x5b, 0xe5, 0x18, 0xac, 0x73, 0x0c, 0xbe, 0x73, 0x0c, + 0xde, 0x0a, 0x9c, 0xac, 0x0b, 0x9c, 0x7c, 0x16, 0x38, 0x79, 0xbe, 0x1c, 0x8e, 0xdd, 0x68, 0xce, + 0xc9, 0xc0, 0xa8, 0xb8, 0xb6, 0x78, 0xb5, 0xac, 0x98, 0xd0, 0x65, 0xf8, 0x07, 0xf7, 0x3a, 0x95, + 0x96, 0xef, 0xfa, 0x35, 0xdd, 0xfc, 0x04, 0x00, 0x00, 0xff, 0xff, 0xcd, 0x19, 0x34, 0x1d, 0xa3, + 0x01, 0x00, 0x00, } func (m *EventSetBalances) Marshal() (dAtA []byte, err error) { From c34e1d875445496017cd46102ed0ced585832aa5 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Tue, 19 Dec 2023 15:05:39 -0800 Subject: [PATCH 28/29] updates --- go.mod | 8 +------- go.sum | 2 ++ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index 6e9d8506ce80..54470d619d26 100644 --- a/go.mod +++ b/go.mod @@ -162,15 +162,9 @@ require ( nhooyr.io/websocket v1.8.6 // indirect ) -// Here are the short-lived replace from the Cosmos SDK -// Replace here are pending PRs, or version to be tagged -// replace ( -// -// ) - // Below are the long-lived replace of the Cosmos SDK replace ( - cosmossdk.io/store => ./store + cosmossdk.io/store => github.com/InjectiveLabs/cosmos-sdk/store v0.1.0-alpha.1.0.20231219011149-dc1791121e91 // use cosmos fork of keyring github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 // dgrijalva/jwt-go is deprecated and doesn't receive security updates. diff --git a/go.sum b/go.sum index 473b6df8f24c..7eec85168e81 100644 --- a/go.sum +++ b/go.sum @@ -64,6 +64,8 @@ github.com/DataDog/datadog-go v3.2.0+incompatible h1:qSG2N4FghB1He/r2mFrWKCaL7dX github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= +github.com/InjectiveLabs/cosmos-sdk/store v0.1.0-alpha.1.0.20231219011149-dc1791121e91 h1:36/aX+rNrcxeVjHqbRDWRB+9Kt4d525HuFnYs7BNqug= +github.com/InjectiveLabs/cosmos-sdk/store v0.1.0-alpha.1.0.20231219011149-dc1791121e91/go.mod h1:EFtENTqVTuWwitGW1VwaBct+yDagk7oG/axBMPH+FXs= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/Microsoft/go-winio v0.6.0 h1:slsWYD/zyx7lCXoZVlvQrj0hPTM1HI4+v1sIda2yDvg= github.com/Microsoft/go-winio v0.6.0/go.mod h1:cTAf44im0RAYeL23bpB+fzCyDH2MJiz2BO69KH/soAE= From e42311adef9df52b3f8c15ea3aa101de80f9151f Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Tue, 19 Dec 2023 15:09:33 -0800 Subject: [PATCH 29/29] updates --- simapp/go.mod | 7 +------ simapp/go.sum | 4 ++-- tests/go.mod | 1 + tests/go.sum | 4 ++-- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/simapp/go.mod b/simapp/go.mod index 0da938997b48..86004fb68065 100644 --- a/simapp/go.mod +++ b/simapp/go.mod @@ -191,14 +191,9 @@ require ( sigs.k8s.io/yaml v1.3.0 // indirect ) -// Here are the short-lived replace from the SimApp -// Replace here are pending PRs, or version to be tagged -// replace ( -// -// ) - // Below are the long-lived replace of the SimApp replace ( + cosmossdk.io/store => github.com/InjectiveLabs/cosmos-sdk/store v0.1.0-alpha.1.0.20231219011149-dc1791121e91 // use cosmos fork of keyring github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 // Simapp always use the latest version of the cosmos-sdk diff --git a/simapp/go.sum b/simapp/go.sum index b9d02933896a..e2fde130e9b6 100644 --- a/simapp/go.sum +++ b/simapp/go.sum @@ -203,8 +203,6 @@ cosmossdk.io/log v1.2.1 h1:Xc1GgTCicniwmMiKwDxUjO4eLhPxoVdI9vtMW8Ti/uk= cosmossdk.io/log v1.2.1/go.mod h1:GNSCc/6+DhFIj1aLn/j7Id7PaO8DzNylUZoOYBL9+I4= cosmossdk.io/math v1.2.0 h1:8gudhTkkD3NxOP2YyyJIYYmt6dQ55ZfJkDOaxXpy7Ig= cosmossdk.io/math v1.2.0/go.mod h1:l2Gnda87F0su8a/7FEKJfFdJrM0JZRXQaohlgJeyQh0= -cosmossdk.io/store v1.0.1 h1:XBDhCqlL+2MUgE8CHWwndKVJ4beX+TyaPIjB5SV62dM= -cosmossdk.io/store v1.0.1/go.mod h1:EFtENTqVTuWwitGW1VwaBct+yDagk7oG/axBMPH+FXs= cosmossdk.io/tools/confix v0.1.1 h1:aexyRv9+y15veH3Qw16lxQwo+ki7r2I+g0yNTEFEQM8= cosmossdk.io/tools/confix v0.1.1/go.mod h1:nQVvP1tHsGXS83PonPVWJtSbddIqyjEw99L4M3rPJyQ= cosmossdk.io/x/circuit v0.1.0 h1:IAej8aRYeuOMritczqTlljbUVHq1E85CpBqaCTwYgXs= @@ -232,6 +230,8 @@ github.com/DataDog/datadog-go v3.2.0+incompatible h1:qSG2N4FghB1He/r2mFrWKCaL7dX github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= +github.com/InjectiveLabs/cosmos-sdk/store v0.1.0-alpha.1.0.20231219011149-dc1791121e91 h1:36/aX+rNrcxeVjHqbRDWRB+9Kt4d525HuFnYs7BNqug= +github.com/InjectiveLabs/cosmos-sdk/store v0.1.0-alpha.1.0.20231219011149-dc1791121e91/go.mod h1:EFtENTqVTuWwitGW1VwaBct+yDagk7oG/axBMPH+FXs= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/Microsoft/go-winio v0.6.0 h1:slsWYD/zyx7lCXoZVlvQrj0hPTM1HI4+v1sIda2yDvg= github.com/Microsoft/go-winio v0.6.0/go.mod h1:cTAf44im0RAYeL23bpB+fzCyDH2MJiz2BO69KH/soAE= diff --git a/tests/go.mod b/tests/go.mod index 7977961d6ffb..b5bbd7c6ddb6 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -199,6 +199,7 @@ require ( replace ( // We always want to test against the latest version of the simapp. cosmossdk.io/simapp => ../simapp + cosmossdk.io/store => github.com/InjectiveLabs/cosmos-sdk/store v0.1.0-alpha.1.0.20231219011149-dc1791121e91 github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 // We always want to test against the latest version of the SDK. github.com/cosmos/cosmos-sdk => ../. diff --git a/tests/go.sum b/tests/go.sum index f2aa801fc492..a9b7cb74ab51 100644 --- a/tests/go.sum +++ b/tests/go.sum @@ -203,8 +203,6 @@ cosmossdk.io/log v1.2.1 h1:Xc1GgTCicniwmMiKwDxUjO4eLhPxoVdI9vtMW8Ti/uk= cosmossdk.io/log v1.2.1/go.mod h1:GNSCc/6+DhFIj1aLn/j7Id7PaO8DzNylUZoOYBL9+I4= cosmossdk.io/math v1.2.0 h1:8gudhTkkD3NxOP2YyyJIYYmt6dQ55ZfJkDOaxXpy7Ig= cosmossdk.io/math v1.2.0/go.mod h1:l2Gnda87F0su8a/7FEKJfFdJrM0JZRXQaohlgJeyQh0= -cosmossdk.io/store v1.0.1 h1:XBDhCqlL+2MUgE8CHWwndKVJ4beX+TyaPIjB5SV62dM= -cosmossdk.io/store v1.0.1/go.mod h1:EFtENTqVTuWwitGW1VwaBct+yDagk7oG/axBMPH+FXs= cosmossdk.io/x/circuit v0.1.0 h1:IAej8aRYeuOMritczqTlljbUVHq1E85CpBqaCTwYgXs= cosmossdk.io/x/circuit v0.1.0/go.mod h1:YDzblVE8+E+urPYQq5kq5foRY/IzhXovSYXb4nwd39w= cosmossdk.io/x/evidence v0.1.0 h1:J6OEyDl1rbykksdGynzPKG5R/zm6TacwW2fbLTW4nCk= @@ -230,6 +228,8 @@ github.com/DataDog/datadog-go v3.2.0+incompatible h1:qSG2N4FghB1He/r2mFrWKCaL7dX github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= +github.com/InjectiveLabs/cosmos-sdk/store v0.1.0-alpha.1.0.20231219011149-dc1791121e91 h1:36/aX+rNrcxeVjHqbRDWRB+9Kt4d525HuFnYs7BNqug= +github.com/InjectiveLabs/cosmos-sdk/store v0.1.0-alpha.1.0.20231219011149-dc1791121e91/go.mod h1:EFtENTqVTuWwitGW1VwaBct+yDagk7oG/axBMPH+FXs= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/Microsoft/go-winio v0.6.0 h1:slsWYD/zyx7lCXoZVlvQrj0hPTM1HI4+v1sIda2yDvg= github.com/Microsoft/go-winio v0.6.0/go.mod h1:cTAf44im0RAYeL23bpB+fzCyDH2MJiz2BO69KH/soAE=