From 5fea67d59cd05754cbbff806f877719bece1acf6 Mon Sep 17 00:00:00 2001 From: testinginprod <98415576+testinginprod@users.noreply.github.com> Date: Tue, 8 Oct 2024 15:32:40 +0200 Subject: [PATCH 01/57] docs(x/accounts): init of the x/accounts module docs. (#22099) --- x/accounts/README.md | 394 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 370 insertions(+), 24 deletions(-) diff --git a/x/accounts/README.md b/x/accounts/README.md index 6be5a541eaeb..a7490a9fcc65 100644 --- a/x/accounts/README.md +++ b/x/accounts/README.md @@ -1,8 +1,356 @@ -# x/accounts Module +# x/accounts The x/accounts module enhances the Cosmos SDK by providing tools and infrastructure for creating advanced smart accounts. -# The Authentication Interface +## Basics + +An account can be thought of as a simplified cosmos-sdk module that supports multiple deployments. This means: + +1. A single account implementation can be deployed to multiple addresses, similar to how CosmWasm allows multiple contract instances from one WASM upload. + +2. Each account address is mapped to its corresponding account code. + +3. Accounts maintain their own state partition, similar to modules. + +4. Accounts can define both message and query handlers. + +This design allows for flexible and reusable account structures within the ecosystem. + +### Example account creation + +#### Basic + +Defining an account begins with creating a struct that encapsulates the account's state. If the account has no state, the +struct is empty `type Account struct{}`. + +By default, accounts utilize collections to manage their state. + +##### State Isolation + +It's crucial to understand that an account's state is isolated. This means: + +1. States are not shared between accounts of different types. +2. States are not shared even between accounts of the same type. + +For example, consider two accounts of type Counter: + +- One located at address "cosmos123" +- Another at address "cosmos456" + +These accounts do not share the same collections.Item instance. Instead, each maintains its own separate state. + +```go +type Account struct { + // We will define that the account contains in its state a counter, it's an item. + // It could also be a map or whatever! + Counter collections.Item[uint64] +} +``` + +#### Init + +Creating an account begins with defining its init message. This message is processed when an account is created, similar to: + +- The `instantiate` method in a CosmWasm contract +- The `constructor` in an EVM contract + +For an account to be a valid `x/account` implementer, it must define both: + +1. An `Init` method +2. An init message + +We start by defining the `MsgInit` and its corresponding `MsgInitResponse` as protobuf messages: + +```protobuf +message MsgInit { + uint64 counter = 1; +} + +message MsgInitResponse {} +``` + +Next, we implement the Init method, which sets the initial counter. We also implement a method of the `Account` interface. This method: + +Signals to the x/accounts runtime what the Init entrypoint is +Performs some generic operations to maintain type safety in the system + +Here's the Go implementation: + +```go +package counter + +import ( + "context" + "cosmossdk.io/x/accounts/accountstd" +) + +type Account struct { + Counter collections.Item[uint64] +} + +func (a Account) Init(ctx context.Context, msg *MsgInit) (*MsgInitResponse, error) { + err := a.Counter.Set(ctx, msg.Counter) + if err != nil { + return nil, err + } + + return &MsgInitResponse{}, nil +} + +func (a Account) RegisterInitHandler(builder *accountstd.InitBuilder) { + accountstd.RegisterInitHandler(builder, a.Init) +} +``` + +#### Execute Handlers + +Execute handlers are methods that an account can execute, defined as messages. These executions can be triggered: + +- During block execution (not queries) through transactions +- During begin or end block + +To define an execute handler, we start by creating its proto message: + +```protobuf +message MsgIncreaseCounter { + uint64 amount = 1; +} + +message MsgIncreaseCounterResponse { + uint64 new_value = 1; +} +``` + +Next, we implement the handling code for this message and register it using the `RegisterExecuteHandlers` method: + +```go +package counter + +import ( + "context" + "cosmossdk.io/x/accounts/accountstd" +) + +type Account struct { + Counter collections.Item[uint64] +} + +func (a Account) Init(ctx context.Context, msg *MsgInit) (*MsgInitResponse, error) { + err := a.Counter.Set(ctx, msg.Counter) + if err != nil { + return nil, err + } + return &MsgInitResponse{}, nil +} + +// Handler for MsgIncreaseCounter +func (a Account) IncreaseCounter(ctx context.Context, msg *MsgIncreaseCounter) (*MsgIncreaseCounterResponse, error) { + counter, err := a.Counter.Get(ctx) + if err != nil { + return nil, err + } + + newValue := counter + msg.Amount + err = a.Counter.Set(ctx, newValue) + if err != nil { + return nil, err + } + + return &MsgIncreaseCounterResponse{NewValue: newValue}, nil +} + +// Registration of the handler in the runtime +func (a Account) RegisterExecuteHandlers(builder *accountstd.ExecuteBuilder) { + accountstd.RegisterExecuteHandler(builder, a.IncreaseCounter) +} + +func (a Account) RegisterInitHandler(builder *accountstd.InitBuilder) { + accountstd.RegisterInitHandler(builder, a.Init) +} +``` + +This implementation defines an IncreaseCounter method that handles the MsgIncreaseCounter message, updating the counter +value and returning the new value in the response. + +#### Query Handlers + +Query Handlers are read-only methods implemented by an account to expose information about itself. This information can be accessed by: + +- External clients (e.g., CLI, wallets) +- Other modules and accounts within the system + +Query handlers can be invoked: + +1. By external clients +2. During block execution + +To define a query handler, we follow a similar process to execute handlers: + +1. Define the request and response proto messages: + +```protobuf +message QueryCounter {} + +message QueryCounterResponse { + uint64 value = 1; +} +``` + +2. Implement and register the query handler: + +```go +package counter + +import ( + "context" + "cosmossdk.io/x/accounts/accountstd" +) + +func (a Account) QueryCounter(ctx context.Context, _ *QueryCounterRequest) (*QueryCounterResponse, error) { + counter, err := a.Counter.Get(ctx) + if err != nil { + return nil, err + } + return &QueryCounterResponse{ + Value: counter, + }, nil +} + +func (a Account) RegisterQueryHandlers(builder *accountstd.QueryBuilder) { + accountstd.RegisterQueryHandler(builder, a.QueryCounter) +} +``` + +This implementation defines a `QueryCounter` method that retrieves the current counter value and returns it in the response. +The `RegisterQueryHandlers` method registers this query handler with the system. + +#### The Account Constructor + +After creating our basic counter account, we implement the account constructor function: + +```go +package counter + +import ( + "cosmossdk.io/collections" + "cosmossdk.io/x/accounts/accountstd" +) + +func NewAccount(deps accountstd.Dependencies) (Account, error) { + return Account{ + Counter: collections.NewItem(deps.SchemaBuilder, CounterPrefix, "counter", collections.Uint64Value), + }, nil +} + +type Account struct { + Counter collections.Item[uint64] +} + +// Rest of the Account implementation... +``` + +The `accountstd.Dependencies` type provides an environment with essential components: + +1. `AddressCodec`: For encoding and decoding addresses +2. `SchemaBuilder`: For schema construction (handled by the accounts module) +3. `HeaderService`: For accessing block header information +4. Other useful services and utilities + +These dependencies allow the account to interact with the blockchain system. + +## App Wiring + +Note: This assumes you've already wired the `x/accounts` module in your application. If not, refer to the Simapp example. + +After creating our basic account, we wire it to the `x/accounts` module. + +### Depinject Method + +Define the depinject constructor: + +```go +package counterdepinject + +func ProvideAccount() accountstd.DepinjectAccount { + return accountstd.DIAccount("counter", counter.NewAccount) +} +``` + +Add this to the application: + +```go +package app + +func NewApp() *App { + // ... + appConfig = depinject.Configs( + AppConfig(), + depinject.Supply( + appOpts, + logger, + ), + depinject.Provide( + counterdepinject.ProvideAccount, + ), + ) + // ... +} +``` + +### Manual Method + +Add the account to the x/accounts Keeper: + +```go +accountsKeeper, err := accounts.NewKeeper( + appCodec, + runtime.NewEnvironment(/* ... */), + signingCtx.AddressCodec(), + appCodec.InterfaceRegistry(), + + accountstd.AddAccount("counter", counter.NewAccount), // Add account here + // Add more accounts if needed +) +``` + +Choose the method that best fits your application structure. + +### The accountsstd Package + +The `accountsstd` package provides utility functions for use within account init, execution, or query handlers. Key functions include: + +1. `Whoami()`: Retrieves the address of the current account. +2. `Sender()`: Gets the address of the transaction sender (not available in queries). +3. `Funds()`: Retrieves funds provided by the sender during Init or Execution. +4. `ExecModule()`: Allows the account to execute a module message. + Note: Impersonation is prevented. An account can't send messages on behalf of others. +5. `QueryModule()`: Enables querying a module. + +These functions, along with others, facilitate account operations and interactions within the system. +For a comprehensive list of available utilities, refer to the Go documentation. + +### Interfaces via Messages and Queries + +Accounts can handle various messages and queries, allowing for flexible interface definitions: + +1. Multiple account types can handle the same message or query. +2. Different accounts (even with the same type but different addresses) can process identical messages or queries. + +This flexibility enables defining interfaces as common sets of messages and/or queries that accounts can handle. + +Example: Transaction Authentication + +- We define a `MsgAuthenticate` message. +- Any account capable of handling `MsgAuthenticate` is considered to implement the `Authentication` interface. +- This approach allows for standardized interaction patterns across different account types. + +(Note: More details on the `Authentication` interface will be provided later.) + +### Full Examples + +Some examples can be found in the [defaults](./defaults) package. + +## The Authentication Interface x/accounts introduces the `Authentication` interface, allowing for flexible transaction (TX) authentication beyond traditional public key cryptography. @@ -14,21 +362,21 @@ The key message type for authentication is `MsgAuthenticate`, which is defined i [interfaces/account_abstraction/v1/interface.proto](./proto/cosmos/accounts/interfaces/account_abstraction/v1/interface.proto) -## Authentication Mechanism +### Authentication Mechanism -### AnteHandler in the SDK +#### AnteHandler in the SDK The Cosmos SDK utilizes an `AnteHandler` to verify transaction (TX) integrity. Its primary function is to ensure that the messages within a transaction are correctly signed by the purported sender. -### Authentication Flow for x/accounts Module +#### Authentication Flow for x/accounts Module When the `AnteHandler` identifies that a message sender (and transaction signer) belongs to the x/accounts module, it delegates the authentication process to that module. -#### Authentication Interface Requirement +##### Authentication Interface Requirement For successful authentication, the account must implement the `Authentication` interface. If an account fails to implement this interface, it's considered non-externally owned, resulting in transaction rejection. -##### Sequence Diagram +###### Sequence Diagram ```mermaid graph TD @@ -43,8 +391,7 @@ graph TD H --> I ``` - -## Implementing the Authentication Interface +### Implementing the Authentication Interface To implement the Authentication interface, an account must handle the execution of `MsgAuthenticate`. Here's an example of how to do this: @@ -80,33 +427,32 @@ func (a Account) RegisterExecuteHandlers(builder *accountstd.ExecuteBuilder) { } ``` -### Key Implementation Points +#### Key Implementation Points 1. **Sender Verification**: Always verify that the sender is the x/accounts module. This prevents unauthorized accounts from triggering authentication. 2. **Authentication Safety**: Ensure your authentication mechanism is secure: - Prevent replay attacks by making it impossible to reuse the same action with the same signature. - -#### Implementation example +##### Implementation example Please find an example [here](./defaults/base/account.go). -# Supporting Custom Accounts in the x/auth gRPC Server +## Supporting Custom Accounts in the x/auth gRPC Server -## Overview +### Overview The x/auth module provides a mechanism for custom account types to be exposed via its `Account` and `AccountInfo` gRPC -queries. This feature is particularly useful for ensuring compatibility with existing wallets that have not yet integrated +queries. This feature is particularly useful for ensuring compatibility with existing wallets that have not yet integrated with x/accounts but still need to parse account information post-migration. -## Implementation +### Implementation To support this feature, your custom account type needs to implement the `auth.QueryLegacyAccount` handler. Here are some important points to consider: 1. **Selective Implementation**: This implementation is not required for every account type. It's only necessary for accounts you want to expose through the x/auth gRPC `Account` and `AccountInfo` methods. 2. **Flexible Response**: The `info` field in the `QueryLegacyAccountResponse` is optional. If your custom account cannot be represented as a `BaseAccount`, you can leave this field empty. -## Example Implementation +### Example Implementation A concrete example of implementation can be found in `defaults/base/account.go`. Here's a simplified version: @@ -143,23 +489,23 @@ func (a Account) AuthRetroCompatibility(ctx context.Context, _ *authtypes.QueryL } ``` -## Usage Notes +### Usage Notes -* Implement this handler only for account types you want to expose via x/auth gRPC methods. -* The `info` field in the response can be nil if your account doesn't fit the `BaseAccount` structure. +- Implement this handler only for account types you want to expose via x/auth gRPC methods. +- The `info` field in the response can be nil if your account doesn't fit the `BaseAccount` structure. -# Genesis +## Genesis -## Creating accounts on genesis +### Creating accounts on genesis In order to create accounts at genesis, the `x/accounts` module allows developers to provide a list of genesis `MsgInit` messages that will be executed in the `x/accounts` genesis flow. The init messages are generated offline. You can also use the following CLI command to generate the -json messages: `simd accounts tx init [account type] [msg] --from me --genesis`. This will generate +json messages: `simd accounts tx init [account type] [msg] --from me --genesis`. This will generate a jsonified init message wrapped in an x/accounts `MsgInit`. -This follows the same initialization flow and rules that would happen if the chain is running. +This follows the same initialization flow and rules that would happen if the chain is running. The only concrete difference is that this is happening at the genesis block. For example, given the following `genesis.json` file: From 43c41be1367ee7bae22e899d30455df9eb89bce1 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Tue, 8 Oct 2024 17:14:23 +0200 Subject: [PATCH 02/57] fix(client/v2): *big.Int unmarshal (#21853) --- client/v2/CHANGELOG.md | 4 +++ client/v2/autocli/flag/builder.go | 2 ++ client/v2/autocli/flag/legacy_dec.go | 48 ++++++++++++++++++++++++++++ x/auth/tx/builder.go | 10 +++--- x/tx/decode/decode.go | 6 ++-- 5 files changed, 62 insertions(+), 8 deletions(-) create mode 100644 client/v2/autocli/flag/legacy_dec.go diff --git a/client/v2/CHANGELOG.md b/client/v2/CHANGELOG.md index a3702845c575..8bd7877b448a 100644 --- a/client/v2/CHANGELOG.md +++ b/client/v2/CHANGELOG.md @@ -53,6 +53,10 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [#17709](https://github.com/cosmos/cosmos-sdk/pull/17709) Address codecs have been removed from `autocli.AppOptions` and `flag.Builder`. Instead client/v2 uses the address codecs present in the context (introduced in [#17503](https://github.com/cosmos/cosmos-sdk/pull/17503)). +### Bug Fixes + +* [#21853](https://github.com/cosmos/cosmos-sdk/pull/21853) Fix `*big.Int` unmarshalling in txs. + ## [v2.0.0-beta.5] - 2024-09-18 ### Improvements diff --git a/client/v2/autocli/flag/builder.go b/client/v2/autocli/flag/builder.go index 6ff325c53bdb..bdd42634dd35 100644 --- a/client/v2/autocli/flag/builder.go +++ b/client/v2/autocli/flag/builder.go @@ -26,6 +26,7 @@ const ( ValidatorAddressStringScalarType = "cosmos.ValidatorAddressString" ConsensusAddressStringScalarType = "cosmos.ConsensusAddressString" PubkeyScalarType = "cosmos.Pubkey" + DecScalarType = "cosmos.Dec" ) // Builder manages options for building pflag flags for protobuf messages. @@ -67,6 +68,7 @@ func (b *Builder) init() { b.scalarFlagTypes[ValidatorAddressStringScalarType] = validatorAddressStringType{} b.scalarFlagTypes[ConsensusAddressStringScalarType] = consensusAddressStringType{} b.scalarFlagTypes[PubkeyScalarType] = pubkeyType{} + b.scalarFlagTypes[DecScalarType] = decType{} } } diff --git a/client/v2/autocli/flag/legacy_dec.go b/client/v2/autocli/flag/legacy_dec.go new file mode 100644 index 000000000000..073afa94f1f5 --- /dev/null +++ b/client/v2/autocli/flag/legacy_dec.go @@ -0,0 +1,48 @@ +package flag + +import ( + "context" + + "google.golang.org/protobuf/reflect/protoreflect" + + "cosmossdk.io/math" +) + +type decType struct{} + +func (a decType) NewValue(_ *context.Context, _ *Builder) Value { + return &decValue{} +} + +func (a decType) DefaultValue() string { + return "0" +} + +type decValue struct { + value string +} + +func (a decValue) Get(protoreflect.Value) (protoreflect.Value, error) { + return protoreflect.ValueOf(a.value), nil +} + +func (a decValue) String() string { + return a.value +} + +func (a *decValue) Set(s string) error { + dec, err := math.LegacyNewDecFromStr(s) + if err != nil { + return err + } + + // we need to convert from float representation to non-float representation using default precision + // 0.5 -> 500000000000000000 + a.value = dec.BigInt().String() + + return nil +} + +func (a decValue) Type() string { + return "cosmos.Dec" +} diff --git a/x/auth/tx/builder.go b/x/auth/tx/builder.go index 423bca3a0870..2b1c866e8e0a 100644 --- a/x/auth/tx/builder.go +++ b/x/auth/tx/builder.go @@ -112,7 +112,7 @@ var marshalOption = proto.MarshalOptions{ func (w *builder) getTx() (*gogoTxWrapper, error) { anyMsgs, err := msgsV1toAnyV2(w.msgs) if err != nil { - return nil, err + return nil, fmt.Errorf("unable to convert messages: %w", err) } body := &txv1beta1.TxBody{ Messages: anyMsgs, @@ -136,12 +136,12 @@ func (w *builder) getTx() (*gogoTxWrapper, error) { bodyBytes, err := marshalOption.Marshal(body) if err != nil { - return nil, err + return nil, fmt.Errorf("unable to marshal body: %w", err) } authInfoBytes, err := marshalOption.Marshal(authInfo) if err != nil { - return nil, err + return nil, fmt.Errorf("unable to marshal auth info: %w", err) } txRawBytes, err := marshalOption.Marshal(&txv1beta1.TxRaw{ @@ -150,12 +150,12 @@ func (w *builder) getTx() (*gogoTxWrapper, error) { Signatures: w.signatures, }) if err != nil { - return nil, err + return nil, fmt.Errorf("unable to marshal tx raw: %w", err) } decodedTx, err := w.decoder.Decode(txRawBytes) if err != nil { - return nil, err + return nil, fmt.Errorf("unable to decode tx: %w", err) } return newWrapperFromDecodedTx(w.addressCodec, w.codec, decodedTx) diff --git a/x/tx/decode/decode.go b/x/tx/decode/decode.go index 994d54cf488b..bf4f3a54f31f 100644 --- a/x/tx/decode/decode.go +++ b/x/tx/decode/decode.go @@ -84,7 +84,7 @@ func (d *Decoder) Decode(txBytes []byte) (*DecodedTx, error) { err = proto.Unmarshal(txBytes, &raw) if err != nil { - return nil, err + return nil, errorsmod.Wrap(ErrTxDecode, err.Error()) } var body v1beta1.TxBody @@ -136,7 +136,7 @@ func (d *Decoder) Decode(txBytes []byte) (*DecodedTx, error) { dynamicMsg := dynamicpb.NewMessageType(msgDesc.(protoreflect.MessageDescriptor)).New().Interface() err = anyMsg.UnmarshalTo(dynamicMsg) if err != nil { - return nil, err + return nil, errorsmod.Wrap(ErrTxDecode, fmt.Sprintf("cannot unmarshal Any message: %v", err)) } dynamicMsgs = append(dynamicMsgs, dynamicMsg) @@ -148,7 +148,7 @@ func (d *Decoder) Decode(txBytes []byte) (*DecodedTx, error) { msg := reflect.New(gogoType.Elem()).Interface().(gogoproto.Message) err = d.codec.Unmarshal(anyMsg.Value, msg) if err != nil { - return nil, err + return nil, errorsmod.Wrap(ErrTxDecode, err.Error()) } msgs = append(msgs, msg) From 05fb492bd5c7c531bc3e00c40da68d17ba2b41e7 Mon Sep 17 00:00:00 2001 From: Matt Kocubinski Date: Tue, 8 Oct 2024 12:12:06 -0500 Subject: [PATCH 03/57] refactor(server/v2): clean up storage use and config (#22008) --- runtime/v2/app.go | 20 ----- runtime/v2/builder.go | 27 ++++--- runtime/v2/module.go | 118 +++++++++++------------------- runtime/v2/store.go | 77 ++++++------------- server/v2/cometbft/server.go | 29 ++++++-- server/v2/cometbft/types/store.go | 8 +- server/v2/commands.go | 2 +- server/v2/config_test.go | 7 +- server/v2/server.go | 1 + server/v2/server_test.go | 16 +++- server/v2/store/config.go | 17 ----- server/v2/store/server.go | 55 ++++++++++---- server/v2/store/snapshot.go | 14 ++-- server/v2/types.go | 1 - simapp/v2/app_di.go | 53 +++++++------- simapp/v2/app_test.go | 2 + simapp/v2/simdv2/cmd/commands.go | 9 ++- simapp/v2/simdv2/cmd/root_di.go | 19 ++--- simapp/v2/simdv2/cmd/testnet.go | 15 ++-- store/v2/root/builder.go | 95 ++++++++++++++++++++++++ store/v2/root/config.go | 14 ++++ store/v2/root/factory.go | 2 +- store/v2/store.go | 20 +++-- 23 files changed, 344 insertions(+), 277 deletions(-) delete mode 100644 server/v2/store/config.go create mode 100644 store/v2/root/builder.go create mode 100644 store/v2/root/config.go diff --git a/runtime/v2/app.go b/runtime/v2/app.go index caf55b92ce01..f62795f53f3c 100644 --- a/runtime/v2/app.go +++ b/runtime/v2/app.go @@ -2,8 +2,6 @@ package runtime import ( "encoding/json" - "errors" - "slices" runtimev2 "cosmossdk.io/api/cosmos/app/runtime/v2" appmodulev2 "cosmossdk.io/core/appmodule/v2" @@ -36,8 +34,6 @@ type App[T transaction.Tx] struct { logger log.Logger config *runtimev2.Module - // modules configuration - storeKeys []string interfaceRegistrar registry.InterfaceRegistrar amino registry.AminoRegistrar moduleManager *MM[T] @@ -93,22 +89,6 @@ func (a *App[T]) Close() error { return nil } -// GetStoreKeys returns all the app store keys. -func (a *App[T]) GetStoreKeys() []string { - return a.storeKeys -} - -// UnsafeFindStoreKey fetches a registered StoreKey from the App in linear time. -// NOTE: This should only be used in testing. -func (a *App[T]) UnsafeFindStoreKey(storeKey string) (string, error) { - i := slices.IndexFunc(a.storeKeys, func(s string) bool { return s == storeKey }) - if i == -1 { - return "", errors.New("store key not found") - } - - return a.storeKeys[i], nil -} - // GetStore returns the app store. func (a *App[T]) GetStore() Store { return a.db diff --git a/runtime/v2/builder.go b/runtime/v2/builder.go index b28ddbc741b4..e74d6ff34f22 100644 --- a/runtime/v2/builder.go +++ b/runtime/v2/builder.go @@ -15,13 +15,15 @@ import ( "cosmossdk.io/server/v2/appmanager" "cosmossdk.io/server/v2/stf" "cosmossdk.io/server/v2/stf/branch" + "cosmossdk.io/store/v2/root" ) // AppBuilder is a type that is injected into a container by the runtime/v2 module // (as *AppBuilder) which can be used to create an app which is compatible with // the existing app.go initialization conventions. type AppBuilder[T transaction.Tx] struct { - app *App[T] + app *App[T] + storeBuilder root.Builder // the following fields are used to overwrite the default branch func(state store.ReaderMap) store.WriterMap @@ -62,14 +64,6 @@ func (a *AppBuilder[T]) RegisterModules(modules map[string]appmodulev2.AppModule return nil } -// RegisterStores registers the provided store keys. -// This method should only be used for registering extra stores -// which is necessary for modules that not registered using the app config. -// To be used in combination of RegisterModules. -func (a *AppBuilder[T]) RegisterStores(keys ...string) { - a.app.storeKeys = append(a.app.storeKeys, keys...) -} - // Build builds an *App instance. func (a *AppBuilder[T]) Build(opts ...AppBuilderOption[T]) (*App[T], error) { for _, opt := range opts { @@ -93,8 +87,9 @@ func (a *AppBuilder[T]) Build(opts ...AppBuilderOption[T]) (*App[T], error) { } } + a.app.db = a.storeBuilder.Get() if a.app.db == nil { - return nil, fmt.Errorf("app.db is not set, it is required to build the app") + return nil, fmt.Errorf("storeBuilder did not return a db") } if err := a.app.moduleManager.RegisterServices(a.app); err != nil { @@ -205,7 +200,11 @@ func AppBuilderWithBranch[T transaction.Tx](branch func(state store.ReaderMap) s // AppBuilderWithTxValidator sets the tx validator for the app. // It overrides all default tx validators defined by modules. -func AppBuilderWithTxValidator[T transaction.Tx](txValidators func(ctx context.Context, tx T) error) AppBuilderOption[T] { +func AppBuilderWithTxValidator[T transaction.Tx]( + txValidators func( + ctx context.Context, tx T, + ) error, +) AppBuilderOption[T] { return func(a *AppBuilder[T]) { a.txValidator = txValidators } @@ -213,7 +212,11 @@ func AppBuilderWithTxValidator[T transaction.Tx](txValidators func(ctx context.C // AppBuilderWithPostTxExec sets logic that will be executed after each transaction. // When not provided, a no-op function will be used. -func AppBuilderWithPostTxExec[T transaction.Tx](postTxExec func(ctx context.Context, tx T, success bool) error) AppBuilderOption[T] { +func AppBuilderWithPostTxExec[T transaction.Tx]( + postTxExec func( + ctx context.Context, tx T, success bool, + ) error, +) AppBuilderOption[T] { return func(a *AppBuilder[T]) { a.postTxExec = postTxExec } diff --git a/runtime/v2/module.go b/runtime/v2/module.go index a95e38f96ea5..11cd7037fff3 100644 --- a/runtime/v2/module.go +++ b/runtime/v2/module.go @@ -19,7 +19,6 @@ import ( "cosmossdk.io/core/event" "cosmossdk.io/core/header" "cosmossdk.io/core/registry" - "cosmossdk.io/core/server" "cosmossdk.io/core/store" "cosmossdk.io/core/transaction" "cosmossdk.io/depinject" @@ -27,7 +26,7 @@ import ( "cosmossdk.io/log" "cosmossdk.io/runtime/v2/services" "cosmossdk.io/server/v2/stf" - rootstore "cosmossdk.io/store/v2/root" + "cosmossdk.io/store/v2/root" ) var ( @@ -97,9 +96,9 @@ func init() { appconfig.Register(&runtimev2.Module{}, appconfig.Provide( ProvideAppBuilder[transaction.Tx], - ProvideEnvironment[transaction.Tx], ProvideModuleManager[transaction.Tx], - ProvideStoreBuilder, + ProvideEnvironment, + ProvideKVService, ), appconfig.Invoke(SetupAppBuilder), ) @@ -108,6 +107,7 @@ func init() { func ProvideAppBuilder[T transaction.Tx]( interfaceRegistrar registry.InterfaceRegistrar, amino registry.AminoRegistrar, + storeBuilder root.Builder, ) ( *AppBuilder[T], *stf.MsgRouterBuilder, @@ -127,7 +127,6 @@ func ProvideAppBuilder[T transaction.Tx]( msgRouterBuilder := stf.NewMsgRouterBuilder() app := &App[T]{ - storeKeys: nil, interfaceRegistrar: interfaceRegistrar, amino: amino, msgRouterBuilder: msgRouterBuilder, @@ -135,7 +134,7 @@ func ProvideAppBuilder[T transaction.Tx]( QueryHandlers: map[string]appmodulev2.Handler{}, storeLoader: DefaultStoreLoader, } - appBuilder := &AppBuilder[T]{app: app} + appBuilder := &AppBuilder[T]{app: app, storeBuilder: storeBuilder} return appBuilder, msgRouterBuilder, appModule[T]{app}, protoFiles, protoTypes } @@ -149,12 +148,7 @@ type AppInputs struct { InterfaceRegistrar registry.InterfaceRegistrar LegacyAmino registry.AminoRegistrar Logger log.Logger - // StoreBuilder is a builder for a store/v2 RootStore satisfying the Store interface - StoreBuilder *StoreBuilder - // StoreOptions are required as input for the StoreBuilder. If not provided, the default options are used. - StoreOptions *rootstore.Options `optional:"true"` - // DynamicConfig can be nil in client wiring, but is required in server wiring. - DynamicConfig server.DynamicConfig `optional:"true"` + StoreBuilder root.Builder } func SetupAppBuilder(inputs AppInputs) { @@ -164,24 +158,8 @@ func SetupAppBuilder(inputs AppInputs) { app.moduleManager = inputs.ModuleManager app.moduleManager.RegisterInterfaces(inputs.InterfaceRegistrar) app.moduleManager.RegisterLegacyAminoCodec(inputs.LegacyAmino) - - if inputs.DynamicConfig == nil { - return - } - storeOptions := rootstore.DefaultStoreOptions() - if inputs.StoreOptions != nil { - storeOptions = *inputs.StoreOptions - } - var err error - app.db, err = inputs.StoreBuilder.Build( - inputs.Logger, - app.storeKeys, - inputs.DynamicConfig, - storeOptions, - ) - if err != nil { - panic(err) - } + // STF requires some state to run + inputs.StoreBuilder.RegisterKey("stf") } func ProvideModuleManager[T transaction.Tx]( @@ -192,44 +170,47 @@ func ProvideModuleManager[T transaction.Tx]( return NewModuleManager[T](logger, config, modules) } -// ProvideEnvironment provides the environment for keeper modules, while maintaining backward compatibility and provide services directly as well. -func ProvideEnvironment[T transaction.Tx]( - logger log.Logger, +func ProvideKVService( config *runtimev2.Module, key depinject.ModuleKey, - appBuilder *AppBuilder[T], kvFactory store.KVStoreServiceFactory, - headerService header.Service, - eventService event.Service, -) ( - appmodulev2.Environment, - store.KVStoreService, - store.MemoryStoreService, -) { - var ( - kvService store.KVStoreService = failingStoreService{} - memKvService store.MemoryStoreService = failingStoreService{} - ) - + storeBuilder root.Builder, +) (store.KVStoreService, store.MemoryStoreService) { // skips modules that have no store - if !slices.Contains(config.SkipStoreKeys, key.Name()) { - var kvStoreKey string - storeKeyOverride := storeKeyOverride(config, key.Name()) - if storeKeyOverride != nil { - kvStoreKey = storeKeyOverride.KvStoreKey - } else { - kvStoreKey = key.Name() - } + if slices.Contains(config.SkipStoreKeys, key.Name()) { + return &failingStoreService{}, &failingStoreService{} + } + var kvStoreKey string + override := storeKeyOverride(config, key.Name()) + if override != nil { + kvStoreKey = override.KvStoreKey + } else { + kvStoreKey = key.Name() + } - registerStoreKey(appBuilder, kvStoreKey) - kvService = kvFactory([]byte(kvStoreKey)) + storeBuilder.RegisterKey(kvStoreKey) + return kvFactory([]byte(kvStoreKey)), stf.NewMemoryStoreService([]byte(fmt.Sprintf("memory:%s", kvStoreKey))) +} - memStoreKey := fmt.Sprintf("memory:%s", key.Name()) - registerStoreKey(appBuilder, memStoreKey) - memKvService = stf.NewMemoryStoreService([]byte(memStoreKey)) +func storeKeyOverride(config *runtimev2.Module, moduleName string) *runtimev2.StoreKeyConfig { + for _, cfg := range config.OverrideStoreKeys { + if cfg.ModuleName == moduleName { + return cfg + } } + return nil +} - env := appmodulev2.Environment{ +// ProvideEnvironment provides the environment for keeper modules, while maintaining backward compatibility and provide services directly as well. +func ProvideEnvironment( + logger log.Logger, + key depinject.ModuleKey, + kvService store.KVStoreService, + memKvService store.MemoryStoreService, + headerService header.Service, + eventService event.Service, +) appmodulev2.Environment { + return appmodulev2.Environment{ Logger: logger, BranchService: stf.BranchService{}, EventService: eventService, @@ -241,28 +222,13 @@ func ProvideEnvironment[T transaction.Tx]( KVStoreService: kvService, MemStoreService: memKvService, } - - return env, kvService, memKvService -} - -func registerStoreKey[T transaction.Tx](builder *AppBuilder[T], key string) { - builder.app.storeKeys = append(builder.app.storeKeys, key) -} - -func storeKeyOverride(config *runtimev2.Module, moduleName string) *runtimev2.StoreKeyConfig { - for _, cfg := range config.OverrideStoreKeys { - if cfg.ModuleName == moduleName { - return cfg - } - } - - return nil } // DefaultServiceBindings provides default services for the following service interfaces: // - store.KVStoreServiceFactory // - header.Service // - comet.Service +// - event.Service // // They are all required. For most use cases these default services bindings should be sufficient. // Power users (or tests) may wish to provide their own services bindings, in which case they must diff --git a/runtime/v2/store.go b/runtime/v2/store.go index 6c45dd5e72db..7f7b2135c809 100644 --- a/runtime/v2/store.go +++ b/runtime/v2/store.go @@ -3,18 +3,35 @@ package runtime import ( "errors" "fmt" - "path/filepath" + "sync" - "cosmossdk.io/core/server" "cosmossdk.io/core/store" - "cosmossdk.io/log" "cosmossdk.io/server/v2/stf" storev2 "cosmossdk.io/store/v2" - "cosmossdk.io/store/v2/db" "cosmossdk.io/store/v2/proof" "cosmossdk.io/store/v2/root" ) +var ( + storeBuilderSingleton root.Builder + storeBuilderSingletonOnce sync.Once +) + +// ProvideSingletonScopedStoreBuilder returns a store builder that is a singleton +// in the scope of the process lifetime. +func ProvideSingletonScopedStoreBuilder() root.Builder { + storeBuilderSingletonOnce.Do(func() { + storeBuilderSingleton = root.NewBuilder() + }) + return storeBuilderSingleton +} + +// ResetSingletonScopedStoreBuilder resets the singleton store builder. Applications +// should not ever need to call this, but it may be useful in tests. +func ResetSingletonScopedStoreBuilder() { + storeBuilderSingletonOnce = sync.Once{} +} + // NewKVStoreService creates a new KVStoreService. // This wrapper is kept for backwards compatibility. // When migrating from runtime to runtime/v2, use runtimev2.NewKVStoreService(storeKey.Name()) instead of runtime.NewKVStoreService(storeKey). @@ -64,58 +81,6 @@ type Store interface { LastCommitID() (proof.CommitID, error) } -// StoreBuilder is a builder for a store/v2 RootStore satisfying the Store interface. -type StoreBuilder struct { - store Store -} - -// Build creates a new store/v2 RootStore. -func (sb *StoreBuilder) Build( - logger log.Logger, - storeKeys []string, - config server.DynamicConfig, - options root.Options, -) (Store, error) { - if sb.store != nil { - return sb.store, nil - } - home := config.GetString(flagHome) - scRawDb, err := db.NewDB( - db.DBType(config.GetString("store.app-db-backend")), - "application", - filepath.Join(home, "data"), - nil, - ) - if err != nil { - return nil, fmt.Errorf("failed to create SCRawDB: %w", err) - } - - factoryOptions := &root.FactoryOptions{ - Logger: logger, - RootDir: home, - Options: options, - // STF needs to store a bit of state - StoreKeys: append(storeKeys, "stf"), - SCRawDB: scRawDb, - } - - rs, err := root.CreateRootStore(factoryOptions) - if err != nil { - return nil, fmt.Errorf("failed to create root store: %w", err) - } - sb.store = rs - return sb.store, nil -} - -// Get returns the Store. Build must be called before calling Get or the result will be nil. -func (sb *StoreBuilder) Get() Store { - return sb.store -} - -func ProvideStoreBuilder() *StoreBuilder { - return &StoreBuilder{} -} - // StoreLoader allows for custom loading of the store, this is useful when upgrading the store from a previous version type StoreLoader func(store Store) error diff --git a/server/v2/cometbft/server.go b/server/v2/cometbft/server.go index b15f5695cf94..7fa1a94d8ee6 100644 --- a/server/v2/cometbft/server.go +++ b/server/v2/cometbft/server.go @@ -8,6 +8,9 @@ import ( "os" "path/filepath" + "cosmossdk.io/server/v2/store" + "cosmossdk.io/store/v2/root" + abciserver "github.com/cometbft/cometbft/abci/server" cmtcmd "github.com/cometbft/cometbft/cmd/cometbft/commands" cmtcfg "github.com/cometbft/cometbft/config" @@ -23,7 +26,6 @@ import ( serverv2 "cosmossdk.io/server/v2" cometlog "cosmossdk.io/server/v2/cometbft/log" "cosmossdk.io/server/v2/cometbft/mempool" - "cosmossdk.io/server/v2/cometbft/types" "cosmossdk.io/store/v2/snapshots" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" @@ -43,14 +45,21 @@ type CometBFTServer[T transaction.Tx] struct { initTxCodec transaction.Codec[T] logger log.Logger + storeBuilder root.Builder serverOptions ServerOptions[T] config Config cfgOptions []CfgOption } -func New[T transaction.Tx](txCodec transaction.Codec[T], serverOptions ServerOptions[T], cfgOptions ...CfgOption) *CometBFTServer[T] { +func New[T transaction.Tx]( + txCodec transaction.Codec[T], + storeBuilder root.Builder, + serverOptions ServerOptions[T], + cfgOptions ...CfgOption, +) *CometBFTServer[T] { return &CometBFTServer[T]{ initTxCodec: txCodec, + storeBuilder: storeBuilder, serverOptions: serverOptions, cfgOptions: cfgOptions, } @@ -97,8 +106,16 @@ func (s *CometBFTServer[T]) Init(appI serverv2.AppI[T], cfg map[string]any, logg indexEvents[e] = struct{}{} } + storeCfg, err := store.UnmarshalConfig(cfg) + if err != nil { + return err + } + rs, err := s.storeBuilder.Build(logger, storeCfg) + if err != nil { + return err + } + s.logger = logger.With(log.ModuleKey, s.Name()) - store := appI.GetStore().(types.Store) consensus := NewConsensus( s.logger, appI.Name(), @@ -106,7 +123,7 @@ func (s *CometBFTServer[T]) Init(appI serverv2.AppI[T], cfg map[string]any, logg s.serverOptions.Mempool(cfg), indexEvents, appI.GetQueryHandlers(), - store, + rs, s.config, s.initTxCodec, chainID, @@ -119,8 +136,8 @@ func (s *CometBFTServer[T]) Init(appI serverv2.AppI[T], cfg map[string]any, logg consensus.addrPeerFilter = s.serverOptions.AddrPeerFilter consensus.idPeerFilter = s.serverOptions.IdPeerFilter - ss := store.GetStateStorage().(snapshots.StorageSnapshotter) - sc := store.GetStateCommitment().(snapshots.CommitSnapshotter) + ss := rs.GetStateStorage().(snapshots.StorageSnapshotter) + sc := rs.GetStateCommitment().(snapshots.CommitSnapshotter) snapshotStore, err := GetSnapshotStore(s.config.ConfigTomlConfig.RootDir) if err != nil { diff --git a/server/v2/cometbft/types/store.go b/server/v2/cometbft/types/store.go index ff06163af5ab..3e603ff18ced 100644 --- a/server/v2/cometbft/types/store.go +++ b/server/v2/cometbft/types/store.go @@ -7,6 +7,8 @@ import ( ) type Store interface { + storev2.Backend + // GetLatestVersion returns the latest version that consensus has been made on GetLatestVersion() (uint64, error) // StateLatest returns a readonly view over the latest @@ -30,10 +32,4 @@ type Store interface { // LastCommitID returns a CommitID pertaining to the last commitment. LastCommitID() (proof.CommitID, error) - - // GetStateStorage returns the SS backend. - GetStateStorage() storev2.VersionedDatabase - - // GetStateCommitment returns the SC backend. - GetStateCommitment() storev2.Committer } diff --git a/server/v2/commands.go b/server/v2/commands.go index da8e0ec6e537..0357fe180d93 100644 --- a/server/v2/commands.go +++ b/server/v2/commands.go @@ -33,7 +33,7 @@ func Execute(rootCmd *cobra.Command, envPrefix, defaultHome string) error { } // AddCommands add the server commands to the root command -// It configure the config handling and the logger handling +// It configures the config handling and the logger handling func AddCommands[T transaction.Tx]( rootCmd *cobra.Command, newApp AppCreator[T], diff --git a/server/v2/config_test.go b/server/v2/config_test.go index f69e2ed56769..3ddd7893a001 100644 --- a/server/v2/config_test.go +++ b/server/v2/config_test.go @@ -10,6 +10,7 @@ import ( serverv2 "cosmossdk.io/server/v2" grpc "cosmossdk.io/server/v2/api/grpc" store "cosmossdk.io/server/v2/store" + "cosmossdk.io/store/v2/root" ) func TestReadConfig(t *testing.T) { @@ -21,7 +22,7 @@ func TestReadConfig(t *testing.T) { require.NoError(t, err) require.Equal(t, v.GetString(grpc.FlagAddress), grpc.DefaultConfig().Address) - require.Equal(t, v.GetString(store.FlagAppDBBackend), store.DefaultConfig().AppDBBackend) + require.Equal(t, v.GetString(store.FlagAppDBBackend), root.DefaultConfig().AppDBBackend) } func TestUnmarshalSubConfig(t *testing.T) { @@ -40,8 +41,8 @@ func TestUnmarshalSubConfig(t *testing.T) { require.True(t, grpc.DefaultConfig().Enable) require.False(t, grpcConfig.Enable) - storeConfig := store.Config{} + storeConfig := root.Config{} err = serverv2.UnmarshalSubConfig(cfg, "store", &storeConfig) require.NoError(t, err) - require.Equal(t, *store.DefaultConfig(), storeConfig) + require.Equal(t, *root.DefaultConfig(), storeConfig) } diff --git a/server/v2/server.go b/server/v2/server.go index 7ee91e649982..a628fbdf1000 100644 --- a/server/v2/server.go +++ b/server/v2/server.go @@ -61,6 +61,7 @@ const ( var _ ServerComponent[transaction.Tx] = (*Server[transaction.Tx])(nil) +// Server is the top-level server component which contains all other server components. type Server[T transaction.Tx] struct { logger log.Logger components []ServerComponent[T] diff --git a/server/v2/server_test.go b/server/v2/server_test.go index 97afa40fdaa9..c216824fb652 100644 --- a/server/v2/server_test.go +++ b/server/v2/server_test.go @@ -19,6 +19,8 @@ import ( grpc "cosmossdk.io/server/v2/api/grpc" "cosmossdk.io/server/v2/appmanager" "cosmossdk.io/server/v2/store" + storev2 "cosmossdk.io/store/v2" + "cosmossdk.io/store/v2/root" ) type mockInterfaceRegistry struct{} @@ -48,6 +50,18 @@ func (*mockApp[T]) InterfaceRegistry() coreserver.InterfaceRegistry { return &mockInterfaceRegistry{} } +var _ root.Builder = &mockStoreBuilder{} + +type mockStoreBuilder struct{} + +func (m mockStoreBuilder) Build(logger log.Logger, config *root.Config) (storev2.RootStore, error) { + return nil, nil +} + +func (m mockStoreBuilder) RegisterKey(string) {} + +func (m mockStoreBuilder) Get() storev2.RootStore { return nil } + func TestServer(t *testing.T) { currentDir, err := os.Getwd() require.NoError(t, err) @@ -64,7 +78,7 @@ func TestServer(t *testing.T) { err = grpcServer.Init(&mockApp[transaction.Tx]{}, cfg, logger) require.NoError(t, err) - storeServer := store.New[transaction.Tx](nil /* nil appCreator as not using CLI commands */) + storeServer := store.New[transaction.Tx](&mockStoreBuilder{}) err = storeServer.Init(&mockApp[transaction.Tx]{}, cfg, logger) require.NoError(t, err) diff --git a/server/v2/store/config.go b/server/v2/store/config.go deleted file mode 100644 index 457bfa9383cb..000000000000 --- a/server/v2/store/config.go +++ /dev/null @@ -1,17 +0,0 @@ -package store - -import ( - "cosmossdk.io/store/v2/root" -) - -func DefaultConfig() *Config { - return &Config{ - AppDBBackend: "goleveldb", - Options: root.DefaultStoreOptions(), - } -} - -type Config struct { - AppDBBackend string `mapstructure:"app-db-backend" toml:"app-db-backend" comment:"The type of database for application and snapshots databases."` - Options root.Options `mapstructure:"options" toml:"options"` -} diff --git a/server/v2/store/server.go b/server/v2/store/server.go index c50a53dc6e24..a793a1912dba 100644 --- a/server/v2/store/server.go +++ b/server/v2/store/server.go @@ -9,6 +9,8 @@ import ( "cosmossdk.io/core/transaction" "cosmossdk.io/log" serverv2 "cosmossdk.io/server/v2" + storev2 "cosmossdk.io/store/v2" + "cosmossdk.io/store/v2/root" ) var ( @@ -21,24 +23,26 @@ const ServerName = "store" // Server manages store config and contains prune & snapshot commands type Server[T transaction.Tx] struct { - config *Config - // saving appCreator for only RestoreSnapshotCmd - appCreator serverv2.AppCreator[T] + config *root.Config + builder root.Builder + backend storev2.Backend } -func New[T transaction.Tx](appCreator serverv2.AppCreator[T]) *Server[T] { - return &Server[T]{appCreator: appCreator} +func New[T transaction.Tx](builder root.Builder) *Server[T] { + return &Server[T]{builder: builder} } -func (s *Server[T]) Init(appI serverv2.AppI[T], cfg map[string]any, logger log.Logger) error { - serverCfg := s.Config().(*Config) - if len(cfg) > 0 { - if err := serverv2.UnmarshalSubConfig(cfg, s.Name(), &serverCfg); err != nil { - return fmt.Errorf("failed to unmarshal config: %w", err) - } +func (s *Server[T]) Init(_ serverv2.AppI[T], cfg map[string]any, log log.Logger) error { + var err error + s.config, err = UnmarshalConfig(cfg) + if err != nil { + return fmt.Errorf("failed to unmarshal config: %w", err) + } + s.backend, err = s.builder.Build(log, s.config) + if err != nil { + return fmt.Errorf("failed to create store backend: %w", err) } - s.config = serverCfg return nil } @@ -46,11 +50,11 @@ func (s *Server[T]) Name() string { return ServerName } -func (s *Server[T]) Start(ctx context.Context) error { +func (s *Server[T]) Start(context.Context) error { return nil } -func (s *Server[T]) Stop(ctx context.Context) error { +func (s *Server[T]) Stop(context.Context) error { return nil } @@ -63,15 +67,34 @@ func (s *Server[T]) CLICommands() serverv2.CLIConfig { s.ListSnapshotsCmd(), s.DumpArchiveCmd(), s.LoadArchiveCmd(), - s.RestoreSnapshotCmd(s.appCreator), + s.RestoreSnapshotCmd(s.backend), }, } } func (s *Server[T]) Config() any { if s.config == nil || s.config.AppDBBackend == "" { - return DefaultConfig() + return root.DefaultConfig() } return s.config } + +// UnmarshalConfig unmarshals the store config from the given map. +// If the config is not found in the map, the default config is returned. +// If the home directory is found in the map, it sets the home directory in the config. +// An empty home directory *is* permitted at this stage, but attempting to build +// the store with an empty home directory will fail. +func UnmarshalConfig(cfg map[string]any) (*root.Config, error) { + config := &root.Config{ + Options: root.DefaultStoreOptions(), + } + if err := serverv2.UnmarshalSubConfig(cfg, ServerName, config); err != nil { + return nil, fmt.Errorf("failed to unmarshal config: %w", err) + } + home := cfg[serverv2.FlagHome] + if home != nil { + config.Home = home.(string) + } + return config, nil +} diff --git a/server/v2/store/snapshot.go b/server/v2/store/snapshot.go index b804e34b71c8..e7958068e56a 100644 --- a/server/v2/store/snapshot.go +++ b/server/v2/store/snapshot.go @@ -76,7 +76,7 @@ func (s *Server[T]) ExportSnapshotCmd() *cobra.Command { } // RestoreSnapshotCmd returns a command to restore a snapshot -func (s *Server[T]) RestoreSnapshotCmd(newApp serverv2.AppCreator[T]) *cobra.Command { +func (s *Server[T]) RestoreSnapshotCmd(rootStore storev2.Backend) *cobra.Command { cmd := &cobra.Command{ Use: "restore ", Short: "Restore app state from local snapshot", @@ -95,8 +95,6 @@ func (s *Server[T]) RestoreSnapshotCmd(newApp serverv2.AppCreator[T]) *cobra.Com } logger := log.NewLogger(cmd.OutOrStdout()) - app := newApp(logger, v) - rootStore := app.GetStore().(storev2.RootStore) sm, err := createSnapshotsManager(cmd, v, logger, rootStore) if err != nil { @@ -350,7 +348,9 @@ func (s *Server[T]) LoadArchiveCmd() *cobra.Command { } } -func createSnapshotsManager(cmd *cobra.Command, v *viper.Viper, logger log.Logger, store storev2.RootStore) (*snapshots.Manager, error) { +func createSnapshotsManager( + cmd *cobra.Command, v *viper.Viper, logger log.Logger, store storev2.Backend, +) (*snapshots.Manager, error) { home := v.GetString(serverv2.FlagHome) snapshotStore, err := snapshots.NewStore(filepath.Join(home, "data", "snapshots")) if err != nil { @@ -371,7 +371,11 @@ func createSnapshotsManager(cmd *cobra.Command, v *viper.Viper, logger log.Logge } } - sm := snapshots.NewManager(snapshotStore, snapshots.NewSnapshotOptions(interval, uint32(keepRecent)), store.GetStateCommitment().(snapshots.CommitSnapshotter), store.GetStateStorage().(snapshots.StorageSnapshotter), nil, logger) + sm := snapshots.NewManager( + snapshotStore, snapshots.NewSnapshotOptions(interval, uint32(keepRecent)), + store.GetStateCommitment().(snapshots.CommitSnapshotter), + store.GetStateStorage().(snapshots.StorageSnapshotter), + nil, logger) return sm, nil } diff --git a/server/v2/types.go b/server/v2/types.go index 7cd15fd10307..a28385922178 100644 --- a/server/v2/types.go +++ b/server/v2/types.go @@ -17,5 +17,4 @@ type AppI[T transaction.Tx] interface { InterfaceRegistry() server.InterfaceRegistry GetAppManager() *appmanager.AppManager[T] GetQueryHandlers() map[string]appmodulev2.Handler - GetStore() any } diff --git a/simapp/v2/app_di.go b/simapp/v2/app_di.go index 43ca45f99aed..d66b17ddb8ca 100644 --- a/simapp/v2/app_di.go +++ b/simapp/v2/app_di.go @@ -12,6 +12,7 @@ import ( "cosmossdk.io/depinject" "cosmossdk.io/log" "cosmossdk.io/runtime/v2" + serverstore "cosmossdk.io/server/v2/store" "cosmossdk.io/store/v2/root" basedepinject "cosmossdk.io/x/accounts/defaults/base/depinject" lockupdepinject "cosmossdk.io/x/accounts/defaults/lockup/depinject" @@ -55,6 +56,18 @@ func init() { func AppConfig() depinject.Config { return depinject.Configs( appConfig, // Alternatively use appconfig.LoadYAML(AppConfigYAML) + runtime.DefaultServiceBindings(), + depinject.Provide( + codec.ProvideInterfaceRegistry, + codec.ProvideAddressCodec, + codec.ProvideProtoCodec, + codec.ProvideLegacyAmino, + runtime.ProvideSingletonScopedStoreBuilder, + ), + depinject.Invoke( + std.RegisterInterfaces, + std.RegisterLegacyAminoCodec, + ), ) } @@ -64,14 +77,14 @@ func NewSimApp[T transaction.Tx]( viper *viper.Viper, ) *SimApp[T] { var ( - app = &SimApp[T]{} - appBuilder *runtime.AppBuilder[T] - err error + app = &SimApp[T]{} + appBuilder *runtime.AppBuilder[T] + storeBuilder root.Builder + err error // merge the AppConfig and other configuration in one config appConfig = depinject.Configs( AppConfig(), - runtime.DefaultServiceBindings(), depinject.Supply( logger, viper, @@ -117,10 +130,6 @@ func NewSimApp[T transaction.Tx]( // interface. ), depinject.Provide( - codec.ProvideInterfaceRegistry, - codec.ProvideAddressCodec, - codec.ProvideProtoCodec, - codec.ProvideLegacyAmino, // inject desired account types: multisigdepinject.ProvideAccount, basedepinject.ProvideAccount, @@ -141,27 +150,11 @@ func NewSimApp[T transaction.Tx]( // } // }) ), - depinject.Invoke( - std.RegisterInterfaces, - std.RegisterLegacyAminoCodec, - ), ) ) - // the subsection of config that contains the store options (in app.toml [store.options] header) - // is unmarshaled into a store.Options struct and passed to the store builder. - // future work may move this specification and retrieval into store/v2. - // If these options are not specified then default values will be used. - if sub := viper.Sub("store.options"); sub != nil { - storeOptions := &root.Options{} - err := sub.Unmarshal(storeOptions) - if err != nil { - panic(err) - } - appConfig = depinject.Configs(appConfig, depinject.Supply(storeOptions)) - } - if err := depinject.Inject(appConfig, + &storeBuilder, &appBuilder, &app.appCodec, &app.legacyAmino, @@ -172,6 +165,16 @@ func NewSimApp[T transaction.Tx]( panic(err) } + // store/v2 follows a slightly more eager config life cycle than server components + storeConfig, err := serverstore.UnmarshalConfig(viper.AllSettings()) + if err != nil { + panic(err) + } + _, err = storeBuilder.Build(logger, storeConfig) + if err != nil { + panic(err) + } + app.App, err = appBuilder.Build() if err != nil { panic(err) diff --git a/simapp/v2/app_test.go b/simapp/v2/app_test.go index f634d2d67664..6ee3709ee552 100644 --- a/simapp/v2/app_test.go +++ b/simapp/v2/app_test.go @@ -18,6 +18,7 @@ import ( "cosmossdk.io/core/transaction" "cosmossdk.io/log" sdkmath "cosmossdk.io/math" + "cosmossdk.io/runtime/v2" serverv2 "cosmossdk.io/server/v2" comettypes "cosmossdk.io/server/v2/cometbft/types" serverv2store "cosmossdk.io/server/v2/store" @@ -40,6 +41,7 @@ func NewTestApp(t *testing.T) (*SimApp[transaction.Tx], context.Context) { vp.Set(serverv2store.FlagAppDBBackend, string(db.DBTypeGoLevelDB)) vp.Set(serverv2.FlagHome, t.TempDir()) + runtime.ResetSingletonScopedStoreBuilder() app := NewSimApp[transaction.Tx](logger, vp) genesis := app.ModuleManager().DefaultGenesis() diff --git a/simapp/v2/simdv2/cmd/commands.go b/simapp/v2/simdv2/cmd/commands.go index addc7eeb768b..6cc233cc9b19 100644 --- a/simapp/v2/simdv2/cmd/commands.go +++ b/simapp/v2/simdv2/cmd/commands.go @@ -17,8 +17,9 @@ import ( "cosmossdk.io/server/v2/api/grpc" "cosmossdk.io/server/v2/api/telemetry" "cosmossdk.io/server/v2/cometbft" - "cosmossdk.io/server/v2/store" + serverstore "cosmossdk.io/server/v2/store" "cosmossdk.io/simapp/v2" + "cosmossdk.io/store/v2/root" confixcmd "cosmossdk.io/tools/confix/cmd" "github.com/cosmos/cosmos-sdk/client" @@ -43,6 +44,7 @@ func newApp[T transaction.Tx](logger log.Logger, viper *viper.Viper) serverv2.Ap func initRootCmd[T transaction.Tx]( rootCmd *cobra.Command, txConfig client.TxConfig, + storeBuilder root.Builder, moduleManager *runtimev2.MM[T], ) { cfg := sdk.GetConfig() @@ -52,7 +54,7 @@ func initRootCmd[T transaction.Tx]( genutilcli.InitCmd(moduleManager), debug.Cmd(), confixcmd.ConfigCommand(), - NewTestnetCmd(moduleManager), + NewTestnetCmd(storeBuilder, moduleManager), ) logger, err := serverv2.NewLogger(viper.New(), rootCmd.OutOrStdout()) @@ -77,11 +79,12 @@ func initRootCmd[T transaction.Tx]( initServerConfig(), cometbft.New( &genericTxDecoder[T]{txConfig}, + storeBuilder, initCometOptions[T](), initCometConfig(), ), grpc.New[T](), - store.New[T](newApp), + serverstore.New[T](storeBuilder), telemetry.New[T](), ); err != nil { panic(err) diff --git a/simapp/v2/simdv2/cmd/root_di.go b/simapp/v2/simdv2/cmd/root_di.go index 1ad834b53a5a..30291b4ecdb3 100644 --- a/simapp/v2/simdv2/cmd/root_di.go +++ b/simapp/v2/simdv2/cmd/root_di.go @@ -14,13 +14,13 @@ import ( "cosmossdk.io/log" "cosmossdk.io/runtime/v2" "cosmossdk.io/simapp/v2" + "cosmossdk.io/store/v2/root" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/config" nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/std" "github.com/cosmos/cosmos-sdk/x/auth/tx" authtxconfig "github.com/cosmos/cosmos-sdk/x/auth/tx/config" "github.com/cosmos/cosmos-sdk/x/auth/types" @@ -32,25 +32,16 @@ func NewRootCmd[T transaction.Tx]() *cobra.Command { autoCliOpts autocli.AppOptions moduleManager *runtime.MM[T] clientCtx client.Context + storeBuilder root.Builder ) if err := depinject.Inject( depinject.Configs( simapp.AppConfig(), - runtime.DefaultServiceBindings(), + depinject.Provide(ProvideClientContext), depinject.Supply(log.NewNopLogger()), - depinject.Provide( - codec.ProvideInterfaceRegistry, - codec.ProvideAddressCodec, - codec.ProvideProtoCodec, - codec.ProvideLegacyAmino, - ProvideClientContext, - ), - depinject.Invoke( - std.RegisterInterfaces, - std.RegisterLegacyAminoCodec, - ), ), + &storeBuilder, &autoCliOpts, &moduleManager, &clientCtx, @@ -83,7 +74,7 @@ func NewRootCmd[T transaction.Tx]() *cobra.Command { }, } - initRootCmd(rootCmd, clientCtx.TxConfig, moduleManager) + initRootCmd(rootCmd, clientCtx.TxConfig, storeBuilder, moduleManager) nodeCmds := nodeservice.NewNodeCommands() autoCliOpts.ModuleOptions = make(map[string]*autocliv1.ModuleOptions) diff --git a/simapp/v2/simdv2/cmd/testnet.go b/simapp/v2/simdv2/cmd/testnet.go index ae01310f9151..4e24f7083654 100644 --- a/simapp/v2/simdv2/cmd/testnet.go +++ b/simapp/v2/simdv2/cmd/testnet.go @@ -23,6 +23,7 @@ import ( "cosmossdk.io/server/v2/api/grpc" "cosmossdk.io/server/v2/cometbft" "cosmossdk.io/server/v2/store" + "cosmossdk.io/store/v2/root" banktypes "cosmossdk.io/x/bank/types" bankv2types "cosmossdk.io/x/bank/v2/types" stakingtypes "cosmossdk.io/x/staking/types" @@ -87,7 +88,7 @@ func addTestnetFlagsToCmd(cmd *cobra.Command) { // NewTestnetCmd creates a root testnet command with subcommands to run an in-process testnet or initialize // validator configuration files for running a multi-validator testnet in a separate process -func NewTestnetCmd[T transaction.Tx](mm *runtimev2.MM[T]) *cobra.Command { +func NewTestnetCmd[T transaction.Tx](sb root.Builder, mm *runtimev2.MM[T]) *cobra.Command { testnetCmd := &cobra.Command{ Use: "testnet", Short: "subcommands for starting or configuring local testnets", @@ -96,13 +97,13 @@ func NewTestnetCmd[T transaction.Tx](mm *runtimev2.MM[T]) *cobra.Command { RunE: client.ValidateCmd, } - testnetCmd.AddCommand(testnetInitFilesCmd(mm)) + testnetCmd.AddCommand(testnetInitFilesCmd(sb, mm)) return testnetCmd } // testnetInitFilesCmd returns a cmd to initialize all files for CometBFT testnet and application -func testnetInitFilesCmd[T transaction.Tx](mm *runtimev2.MM[T]) *cobra.Command { +func testnetInitFilesCmd[T transaction.Tx](sb root.Builder, mm *runtimev2.MM[T]) *cobra.Command { cmd := &cobra.Command{ Use: "init-files", Short: "Initialize config directories & files for a multi-validator testnet running locally via separate processes (e.g. Docker Compose or similar)", @@ -143,7 +144,7 @@ Example: return err } - return initTestnetFiles(clientCtx, cmd, config, mm, args) + return initTestnetFiles(clientCtx, sb, cmd, config, mm, args) }, } @@ -165,6 +166,7 @@ const nodeDirPerm = 0o755 // initTestnetFiles initializes testnet files for a testnet to be run in a separate process func initTestnetFiles[T transaction.Tx]( clientCtx client.Context, + sb root.Builder, cmd *cobra.Command, nodeConfig *cmtconfig.Config, mm *runtimev2.MM[T], @@ -339,12 +341,13 @@ func initTestnetFiles[T transaction.Tx]( // Write server config cometServer := cometbft.New[T]( &genericTxDecoder[T]{clientCtx.TxConfig}, + sb, cometbft.ServerOptions[T]{}, cometbft.OverwriteDefaultConfigTomlConfig(nodeConfig), ) - storeServer := store.New[T](newApp) + storeServer := store.New[T](sb) grpcServer := grpc.New[T](grpc.OverwriteDefaultConfig(grpcConfig)) - server := serverv2.NewServer(log.NewNopLogger(), serverCfg, cometServer, grpcServer, storeServer) + server := serverv2.NewServer[T](log.NewNopLogger(), serverCfg, cometServer, grpcServer, storeServer) err = server.WriteConfig(filepath.Join(nodeDir, "config")) if err != nil { return err diff --git a/store/v2/root/builder.go b/store/v2/root/builder.go new file mode 100644 index 000000000000..885c41d24484 --- /dev/null +++ b/store/v2/root/builder.go @@ -0,0 +1,95 @@ +package root + +import ( + "fmt" + "path/filepath" + + "cosmossdk.io/log" + "cosmossdk.io/store/v2" + "cosmossdk.io/store/v2/db" +) + +// Builder is the interface for a store/v2 RootStore builder. +// RootStores built by the Cosmos SDK typically involve a 2 phase initialization: +// 1. Namespace registration +// 2. Configuration and loading +// +// The Builder interface is used to facilitate this pattern. Namespaces (store keys) are registered +// by calling RegisterKey before Build is called. Build is then called with a Config +// object and a RootStore is returned. Calls to Get may return the `RootStore` if Build +// was successful, but that's left up to the implementation. +type Builder interface { + // Build creates a new store/v2 RootStore from the given Config. + Build(log.Logger, *Config) (store.RootStore, error) + // RegisterKey registers a store key (namespace) to be used when building the RootStore. + RegisterKey(string) + // Get returns the Store. Build should be called before calling Get or the result will be nil. + Get() store.RootStore +} + +var _ Builder = (*builder)(nil) + +// builder is the default builder for a store/v2 RootStore satisfying the Store interface. +// Tangibly it combines store key registration and a top-level Config to create a RootStore by calling +// the CreateRootStore factory function. +type builder struct { + // input + storeKeys map[string]struct{} + + // output + store store.RootStore +} + +func NewBuilder() Builder { + return &builder{storeKeys: make(map[string]struct{})} +} + +// Build creates a new store/v2 RootStore. +func (sb *builder) Build( + logger log.Logger, + config *Config, +) (store.RootStore, error) { + if sb.store != nil { + return sb.store, nil + } + if config.Home == "" { + return nil, fmt.Errorf("home directory is required") + } + scRawDb, err := db.NewDB( + db.DBType(config.AppDBBackend), + "application", + filepath.Join(config.Home, "data"), + nil, + ) + if err != nil { + return nil, fmt.Errorf("failed to create SCRawDB: %w", err) + } + + var storeKeys []string + for key := range sb.storeKeys { + storeKeys = append(storeKeys, key) + } + + factoryOptions := &FactoryOptions{ + Logger: logger, + RootDir: config.Home, + Options: config.Options, + StoreKeys: storeKeys, + SCRawDB: scRawDb, + } + + rs, err := CreateRootStore(factoryOptions) + if err != nil { + return nil, fmt.Errorf("failed to create root store: %w", err) + } + sb.store = rs + return sb.store, nil +} + +func (sb *builder) Get() store.RootStore { + return sb.store +} + +func (sb *builder) RegisterKey(key string) { + sb.storeKeys[key] = struct{}{} +} diff --git a/store/v2/root/config.go b/store/v2/root/config.go new file mode 100644 index 000000000000..28f46a3879b7 --- /dev/null +++ b/store/v2/root/config.go @@ -0,0 +1,14 @@ +package root + +func DefaultConfig() *Config { + return &Config{ + AppDBBackend: "goleveldb", + Options: DefaultStoreOptions(), + } +} + +type Config struct { + Home string `toml:"-"` // this field is omitted in the TOML file + AppDBBackend string `mapstructure:"app-db-backend" toml:"app-db-backend" comment:"The type of database for application and snapshots databases."` + Options Options `mapstructure:"options" toml:"options"` +} diff --git a/store/v2/root/factory.go b/store/v2/root/factory.go index e6f86917ab0d..9e1f76a36ceb 100644 --- a/store/v2/root/factory.go +++ b/store/v2/root/factory.go @@ -33,7 +33,7 @@ const ( SCTypeIavlV2 SCType = "iavl-v2" ) -// app.toml config options +// Options are the options for creating a root store. type Options struct { SSType SSType `mapstructure:"ss-type" toml:"ss-type" comment:"SState storage database type. Currently we support: \"sqlite\", \"pebble\" and \"rocksdb\""` SCType SCType `mapstructure:"sc-type" toml:"sc-type" comment:"State commitment database type. Currently we support: \"iavl\" and \"iavl-v2\""` diff --git a/store/v2/store.go b/store/v2/store.go index fee3ad39dbf2..1adf44f0b89b 100644 --- a/store/v2/store.go +++ b/store/v2/store.go @@ -12,6 +12,9 @@ import ( // RootStore defines an abstraction layer containing a State Storage (SS) engine // and one or more State Commitment (SC) engines. type RootStore interface { + Pruner + Backend + // StateLatest returns a read-only version of the RootStore at the latest // height, alongside the associated version. StateLatest() (uint64, corestore.ReaderMap, error) @@ -21,12 +24,6 @@ type RootStore interface { // an error must be returned. StateAt(version uint64) (corestore.ReaderMap, error) - // GetStateStorage returns the SS backend. - GetStateStorage() VersionedDatabase - - // GetStateCommitment returns the SC backend. - GetStateCommitment() Committer - // Query performs a query on the RootStore for a given store key, version (height), // and key tuple. Queries should be routed to the underlying SS engine. Query(storeKey []byte, version uint64, key []byte, prove bool) (QueryResult, error) @@ -67,11 +64,18 @@ type RootStore interface { // SetMetrics sets the telemetry handler on the RootStore. SetMetrics(m metrics.Metrics) - Prune(version uint64) error - io.Closer } +// Backend defines the interface for the RootStore backends. +type Backend interface { + // GetStateStorage returns the SS backend. + GetStateStorage() VersionedDatabase + + // GetStateCommitment returns the SC backend. + GetStateCommitment() Committer +} + // UpgradeableStore defines the interface for upgrading store keys. type UpgradeableStore interface { // LoadVersionAndUpgrade behaves identically to LoadVersion except it also From 325728a9fd6c162b762b402470e8416a54bf0d7f Mon Sep 17 00:00:00 2001 From: tutufen Date: Wed, 9 Oct 2024 01:58:49 +0800 Subject: [PATCH 04/57] docs: update missing wrong cometbft prefixdb links (#22173) --- store/prefix/store_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/store/prefix/store_test.go b/store/prefix/store_test.go index b586c37aaded..71846120a1c3 100644 --- a/store/prefix/store_test.go +++ b/store/prefix/store_test.go @@ -237,7 +237,7 @@ func TestPrefixStoreReverseIteratorEdgeCase(t *testing.T) { iter.Close() } -// Tests below are ported from https://github.com/cometbft/cometbft/blob/master/libs/db/prefix_db_test.go +// Tests below are ported from https://github.com/cometbft/cometbft-db/blob/v1.0.1/prefixdb_test.go func mockStoreWithStuff() types.KVStore { db := coretesting.NewMemDB() From 4aeb0539252b5549f443538d1405f5177e25ed94 Mon Sep 17 00:00:00 2001 From: son trinh Date: Wed, 9 Oct 2024 12:18:05 +0700 Subject: [PATCH 05/57] refactor(genutil): Use sdk types genesis validator (#21678) Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Matt Kocubinski --- crypto/codec/pubkey.go | 53 ++++++ crypto/keys/jsonkey.go | 41 +++++ runtime/v2/app.go | 5 - runtime/v2/builder.go | 2 +- runtime/v2/manager.go | 10 +- runtime/v2/services/genesis.go | 51 +++++- server/types/app.go | 4 +- simapp/export.go | 19 +- simapp/v2/app_di.go | 13 +- simapp/v2/app_test.go | 5 +- simapp/v2/export.go | 35 +++- tests/e2e/genutil/export_test.go | 3 +- types/genesis.go | 10 - types/staking.go | 9 + x/genutil/client/cli/migrate.go | 23 ++- x/genutil/migration/v052/migrate.go | 173 ++++++++++++++++++ x/genutil/migration/v052/migrate_test.go | 51 ++++++ .../v052/testdata/old_app_genesis.json | 1 + x/genutil/types/genesis.go | 59 +++++- x/genutil/types/testdata/app_genesis.json | 2 +- x/genutil/utils.go | 4 +- x/genutil/v2/cli/export.go | 1 + x/genutil/v2/types.go | 4 + x/staking/genesis.go | 25 +-- 24 files changed, 510 insertions(+), 93 deletions(-) create mode 100644 crypto/codec/pubkey.go create mode 100644 crypto/keys/jsonkey.go delete mode 100644 types/genesis.go create mode 100644 x/genutil/migration/v052/migrate.go create mode 100644 x/genutil/migration/v052/migrate_test.go create mode 100644 x/genutil/migration/v052/testdata/old_app_genesis.json diff --git a/crypto/codec/pubkey.go b/crypto/codec/pubkey.go new file mode 100644 index 000000000000..c45f258517b0 --- /dev/null +++ b/crypto/codec/pubkey.go @@ -0,0 +1,53 @@ +package codec + +import ( + "cosmossdk.io/errors" + + cryptokeys "github.com/cosmos/cosmos-sdk/crypto/keys" + bls12_381 "github.com/cosmos/cosmos-sdk/crypto/keys/bls12_381" + "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" + "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +func PubKeyToProto(pk cryptokeys.JSONPubkey) (cryptotypes.PubKey, error) { + switch pk.KeyType { + case ed25519.PubKeyName: + return &ed25519.PubKey{ + Key: pk.Value, + }, nil + case secp256k1.PubKeyName: + return &secp256k1.PubKey{ + Key: pk.Value, + }, nil + case bls12_381.PubKeyName: + return &bls12_381.PubKey{ + Key: pk.Value, + }, nil + default: + return nil, errors.Wrapf(sdkerrors.ErrInvalidType, "cannot convert %v to proto public key", pk) + } +} + +func PubKeyFromProto(pk cryptotypes.PubKey) (cryptokeys.JSONPubkey, error) { + switch pk := pk.(type) { + case *ed25519.PubKey: + return cryptokeys.JSONPubkey{ + KeyType: ed25519.PubKeyName, + Value: pk.Bytes(), + }, nil + case *secp256k1.PubKey: + return cryptokeys.JSONPubkey{ + KeyType: secp256k1.PubKeyName, + Value: pk.Bytes(), + }, nil + case *bls12_381.PubKey: + return cryptokeys.JSONPubkey{ + KeyType: bls12_381.PubKeyName, + Value: pk.Bytes(), + }, nil + default: + return cryptokeys.JSONPubkey{}, errors.Wrapf(sdkerrors.ErrInvalidType, "cannot convert %v from proto public key", pk) + } +} diff --git a/crypto/keys/jsonkey.go b/crypto/keys/jsonkey.go new file mode 100644 index 000000000000..8edbd91e7246 --- /dev/null +++ b/crypto/keys/jsonkey.go @@ -0,0 +1,41 @@ +package keys + +import ( + "github.com/cosmos/cosmos-sdk/crypto/keys/bls12_381" + "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" + "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" + "github.com/cosmos/cosmos-sdk/crypto/types" +) + +// JSONPubKey defines a public key that are parse from JSON file. +// convert PubKey to JSONPubKey needs a in between step +type JSONPubkey struct { + KeyType string `json:"type"` + Value []byte `json:"value"` +} + +func (pk JSONPubkey) Address() types.Address { + switch pk.KeyType { + case ed25519.PubKeyName: + ed25519 := ed25519.PubKey{ + Key: pk.Value, + } + return ed25519.Address() + case secp256k1.PubKeyName: + secp256k1 := secp256k1.PubKey{ + Key: pk.Value, + } + return secp256k1.Address() + case bls12_381.PubKeyName: + bls12_381 := bls12_381.PubKey{ + Key: pk.Value, + } + return bls12_381.Address() + default: + return nil + } +} + +func (pk JSONPubkey) Bytes() []byte { + return pk.Value +} diff --git a/runtime/v2/app.go b/runtime/v2/app.go index f62795f53f3c..d5999f3bd99f 100644 --- a/runtime/v2/app.go +++ b/runtime/v2/app.go @@ -89,11 +89,6 @@ func (a *App[T]) Close() error { return nil } -// GetStore returns the app store. -func (a *App[T]) GetStore() Store { - return a.db -} - func (a *App[T]) GetAppManager() *appmanager.AppManager[T] { return a.AppManager } diff --git a/runtime/v2/builder.go b/runtime/v2/builder.go index e74d6ff34f22..adb177d41eb0 100644 --- a/runtime/v2/builder.go +++ b/runtime/v2/builder.go @@ -144,7 +144,7 @@ func (a *AppBuilder[T]) Build(opts ...AppBuilderOption[T]) (*App[T], error) { return nil, errors.New("cannot init genesis on non-zero state") } genesisCtx := services.NewGenesisContext(a.branch(zeroState)) - genesisState, err := genesisCtx.Run(ctx, func(ctx context.Context) error { + genesisState, err := genesisCtx.Mutate(ctx, func(ctx context.Context) error { err = a.app.moduleManager.InitGenesisJSON(ctx, genesisJSON, txHandler) if err != nil { return fmt.Errorf("failed to init genesis: %w", err) diff --git a/runtime/v2/manager.go b/runtime/v2/manager.go index 01b0c93971ab..2d6515b81225 100644 --- a/runtime/v2/manager.go +++ b/runtime/v2/manager.go @@ -230,15 +230,17 @@ func (m *MM[T]) ExportGenesisForModules( channels[moduleName] = make(chan genesisResult) go func(moduleI ModuleI, ch chan genesisResult) { genesisCtx := services.NewGenesisContext(stateFactory()) - _, _ = genesisCtx.Run(ctx, func(ctx context.Context) error { + err := genesisCtx.Read(ctx, func(ctx context.Context) error { jm, err := moduleI.ExportGenesis(ctx) if err != nil { - ch <- genesisResult{nil, err} return err } ch <- genesisResult{jm, nil} return nil }) + if err != nil { + ch <- genesisResult{nil, err} + } }(moduleI, channels[moduleName]) } @@ -783,7 +785,9 @@ func messagePassingInterceptor(msg transaction.Msg) grpc.UnaryServerInterceptor } // requestFullNameFromMethodDesc returns the fully-qualified name of the request message and response of the provided service's method. -func requestFullNameFromMethodDesc(sd *grpc.ServiceDesc, method grpc.MethodDesc) (protoreflect.FullName, protoreflect.FullName, error) { +func requestFullNameFromMethodDesc(sd *grpc.ServiceDesc, method grpc.MethodDesc) ( + protoreflect.FullName, protoreflect.FullName, error, +) { methodFullName := protoreflect.FullName(fmt.Sprintf("%s.%s", sd.ServiceName, method.MethodName)) desc, err := gogoproto.HybridResolver.FindDescriptorByName(methodFullName) if err != nil { diff --git a/runtime/v2/services/genesis.go b/runtime/v2/services/genesis.go index 79ebd92852f8..5d09e5c78f74 100644 --- a/runtime/v2/services/genesis.go +++ b/runtime/v2/services/genesis.go @@ -11,6 +11,7 @@ import ( var ( _ store.KVStoreService = (*GenesisKVStoreService)(nil) _ header.Service = (*GenesisHeaderService)(nil) + _ store.KVStore = (*readonlyKVStore)(nil) ) type genesisContextKeyType struct{} @@ -21,28 +22,41 @@ var genesisContextKey = genesisContextKeyType{} // it backs the store.KVStoreService and header.Service interface implementations // defined in this file. type genesisContext struct { - state store.WriterMap + state store.ReaderMap } // NewGenesisContext creates a new genesis context. -func NewGenesisContext(state store.WriterMap) genesisContext { +func NewGenesisContext(state store.ReaderMap) genesisContext { return genesisContext{ state: state, } } -// Run runs the provided function within the genesis context and returns an +// Mutate runs the provided function within the genesis context and returns an // updated store.WriterMap containing the state modifications made during InitGenesis. -func (g *genesisContext) Run( +func (g genesisContext) Mutate( ctx context.Context, fn func(ctx context.Context) error, ) (store.WriterMap, error) { + writerMap, ok := g.state.(store.WriterMap) + if !ok { + return nil, fmt.Errorf("mutate requires a store.WriterMap, got a %T", g.state) + } ctx = context.WithValue(ctx, genesisContextKey, g) err := fn(ctx) if err != nil { return nil, err } - return g.state, nil + return writerMap, nil +} + +// Read runs the provided function within the genesis context. +func (g genesisContext) Read( + ctx context.Context, + fn func(ctx context.Context) error, +) error { + ctx = context.WithValue(ctx, genesisContextKey, g) + return fn(ctx) } // GenesisKVStoreService is a store.KVStoreService implementation that is used during @@ -71,15 +85,24 @@ func (g *GenesisKVStoreService) OpenKVStore(ctx context.Context) store.KVStore { if v == nil { return g.executionService.OpenKVStore(ctx) } - genCtx, ok := v.(*genesisContext) + genCtx, ok := v.(genesisContext) if !ok { panic(fmt.Errorf("unexpected genesis context type: %T", v)) } - state, err := genCtx.state.GetWriter(g.actor) + writerMap, ok := genCtx.state.(store.WriterMap) + if ok { + state, err := writerMap.GetWriter(g.actor) + if err != nil { + panic(err) + } + return state + + } + state, err := genCtx.state.GetReader(g.actor) if err != nil { panic(err) } - return state + return readonlyKVStore{state} } // GenesisHeaderService is a header.Service implementation that is used during @@ -105,3 +128,15 @@ func NewGenesisHeaderService(executionService header.Service) *GenesisHeaderServ executionService: executionService, } } + +type readonlyKVStore struct { + store.Reader +} + +func (r readonlyKVStore) Set(key, value []byte) error { + panic("tried to call Set on a readonly store") +} + +func (r readonlyKVStore) Delete(key []byte) error { + panic("tried to call Delete on a readonly store") +} diff --git a/server/types/app.go b/server/types/app.go index ca0a55ca1a0f..c1a67b2ceec3 100644 --- a/server/types/app.go +++ b/server/types/app.go @@ -6,7 +6,6 @@ import ( cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1" cmtcrypto "github.com/cometbft/cometbft/crypto" - cmttypes "github.com/cometbft/cometbft/types" "github.com/cosmos/gogoproto/grpc" "cosmossdk.io/core/server" @@ -18,6 +17,7 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/server/api" "github.com/cosmos/cosmos-sdk/server/config" + sdk "github.com/cosmos/cosmos-sdk/types" ) type ( @@ -76,7 +76,7 @@ type ( // AppState is the application state as JSON. AppState json.RawMessage // Validators is the exported validator set. - Validators []cmttypes.GenesisValidator + Validators []sdk.GenesisValidator // Height is the app's latest block height. Height int64 // ConsensusParams are the exported consensus params for ABCI. diff --git a/simapp/export.go b/simapp/export.go index 05346741b99e..28d15f507a9b 100644 --- a/simapp/export.go +++ b/simapp/export.go @@ -5,7 +5,6 @@ import ( "fmt" cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1" - cmttypes "github.com/cometbft/cometbft/types" "cosmossdk.io/collections" storetypes "cosmossdk.io/store/types" @@ -13,7 +12,6 @@ import ( "cosmossdk.io/x/staking" stakingtypes "cosmossdk.io/x/staking/types" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" servertypes "github.com/cosmos/cosmos-sdk/server/types" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -43,25 +41,10 @@ func (app *SimApp) ExportAppStateAndValidators(forZeroHeight bool, jailAllowedAd } validators, err := staking.WriteValidators(ctx, app.StakingKeeper) - cmtValidators := []cmttypes.GenesisValidator{} - for _, val := range validators { - cmtPk, err := cryptocodec.ToCmtPubKeyInterface(val.PubKey) - if err != nil { - return servertypes.ExportedApp{}, err - } - cmtVal := cmttypes.GenesisValidator{ - Address: val.Address.Bytes(), - PubKey: cmtPk, - Power: val.Power, - Name: val.Name, - } - - cmtValidators = append(cmtValidators, cmtVal) - } return servertypes.ExportedApp{ AppState: appState, - Validators: cmtValidators, + Validators: validators, Height: height, ConsensusParams: app.BaseApp.GetConsensusParams(ctx), }, err diff --git a/simapp/v2/app_di.go b/simapp/v2/app_di.go index d66b17ddb8ca..29f62defcde6 100644 --- a/simapp/v2/app_di.go +++ b/simapp/v2/app_di.go @@ -13,10 +13,12 @@ import ( "cosmossdk.io/log" "cosmossdk.io/runtime/v2" serverstore "cosmossdk.io/server/v2/store" + "cosmossdk.io/store/v2" "cosmossdk.io/store/v2/root" basedepinject "cosmossdk.io/x/accounts/defaults/base/depinject" lockupdepinject "cosmossdk.io/x/accounts/defaults/lockup/depinject" multisigdepinject "cosmossdk.io/x/accounts/defaults/multisig/depinject" + stakingkeeper "cosmossdk.io/x/staking/keeper" upgradekeeper "cosmossdk.io/x/upgrade/keeper" "github.com/cosmos/cosmos-sdk/client" @@ -38,10 +40,12 @@ type SimApp[T transaction.Tx] struct { appCodec codec.Codec txConfig client.TxConfig interfaceRegistry codectypes.InterfaceRegistry + store store.RootStore // required keepers during wiring // others keepers are all in the app UpgradeKeeper *upgradekeeper.Keeper + StakingKeeper *stakingkeeper.Keeper } func init() { @@ -161,6 +165,7 @@ func NewSimApp[T transaction.Tx]( &app.txConfig, &app.interfaceRegistry, &app.UpgradeKeeper, + &app.StakingKeeper, ); err != nil { panic(err) } @@ -170,7 +175,8 @@ func NewSimApp[T transaction.Tx]( if err != nil { panic(err) } - _, err = storeBuilder.Build(logger, storeConfig) + + app.store, err = storeBuilder.Build(logger, storeConfig) if err != nil { panic(err) } @@ -213,7 +219,6 @@ func (app *SimApp[T]) TxConfig() client.TxConfig { return app.txConfig } -// GetStore gets the app store. -func (app *SimApp[T]) GetStore() any { - return app.App.GetStore() +func (app *SimApp[T]) GetStore() store.RootStore { + return app.store } diff --git a/simapp/v2/app_test.go b/simapp/v2/app_test.go index 6ee3709ee552..8c705565956c 100644 --- a/simapp/v2/app_test.go +++ b/simapp/v2/app_test.go @@ -20,7 +20,6 @@ import ( sdkmath "cosmossdk.io/math" "cosmossdk.io/runtime/v2" serverv2 "cosmossdk.io/server/v2" - comettypes "cosmossdk.io/server/v2/cometbft/types" serverv2store "cosmossdk.io/server/v2/store" "cosmossdk.io/store/v2/db" banktypes "cosmossdk.io/x/bank/types" @@ -75,7 +74,7 @@ func NewTestApp(t *testing.T) (*SimApp[transaction.Tx], context.Context) { genesisBytes, err := json.Marshal(genesis) require.NoError(t, err) - st := app.GetStore().(comettypes.Store) + st := app.GetStore() ci, err := st.LastCommitID() require.NoError(t, err) @@ -111,7 +110,7 @@ func MoveNextBlock(t *testing.T, app *SimApp[transaction.Tx], ctx context.Contex bz := sha256.Sum256([]byte{}) - st := app.GetStore().(comettypes.Store) + st := app.GetStore() ci, err := st.LastCommitID() require.NoError(t, err) diff --git a/simapp/v2/export.go b/simapp/v2/export.go index 5a1757b16535..50f4a898bb37 100644 --- a/simapp/v2/export.go +++ b/simapp/v2/export.go @@ -3,27 +3,46 @@ package simapp import ( "context" + "cosmossdk.io/runtime/v2/services" + "cosmossdk.io/x/staking" + v2 "github.com/cosmos/cosmos-sdk/x/genutil/v2" ) // ExportAppStateAndValidators exports the state of the application for a genesis // file. -func (app *SimApp[T]) ExportAppStateAndValidators(jailAllowedAddrs []string) (v2.ExportedApp, error) { - // as if they could withdraw from the start of the next block +// This is a demonstation of how to export a genesis file. Export may need extended at +// the user discretion for cleaning the genesis state at the end provided with jailAllowedAddrs +func (app *SimApp[T]) ExportAppStateAndValidators( + jailAllowedAddrs []string, +) (v2.ExportedApp, error) { ctx := context.Background() + var exportedApp v2.ExportedApp latestHeight, err := app.LoadLatestHeight() if err != nil { - return v2.ExportedApp{}, err + return exportedApp, err } genesis, err := app.ExportGenesis(ctx, latestHeight) if err != nil { - return v2.ExportedApp{}, err + return exportedApp, err + } + + readerMap, err := app.GetStore().StateAt(latestHeight) + if err != nil { + return exportedApp, err + } + genesisCtx := services.NewGenesisContext(readerMap) + err = genesisCtx.Read(ctx, func(ctx context.Context) error { + exportedApp.Validators, err = staking.WriteValidators(ctx, app.StakingKeeper) + return err + }) + if err != nil { + return exportedApp, err } - return v2.ExportedApp{ - AppState: genesis, - Height: int64(latestHeight), - }, nil + exportedApp.AppState = genesis + exportedApp.Height = int64(latestHeight) + return exportedApp, nil } diff --git a/tests/e2e/genutil/export_test.go b/tests/e2e/genutil/export_test.go index 0a98ef6b4e85..798885c0900f 100644 --- a/tests/e2e/genutil/export_test.go +++ b/tests/e2e/genutil/export_test.go @@ -31,6 +31,7 @@ import ( "github.com/cosmos/cosmos-sdk/server/types" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" gentestutil "github.com/cosmos/cosmos-sdk/testutil/x/genutil" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/genutil" genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" @@ -184,7 +185,7 @@ func setupApp(t *testing.T, tempDir string) (*simapp.SimApp, context.Context, ge ChainID: "theChainId", AppState: stateBytes, Consensus: &genutiltypes.ConsensusGenesis{ - Validators: nil, + Validators: []sdk.GenesisValidator{}, }, } diff --git a/types/genesis.go b/types/genesis.go deleted file mode 100644 index f250ac600014..000000000000 --- a/types/genesis.go +++ /dev/null @@ -1,10 +0,0 @@ -package types - -import cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - -type GenesisValidator struct { - Address ConsAddress - PubKey cryptotypes.PubKey - Power int64 - Name string -} diff --git a/types/staking.go b/types/staking.go index f8cdb325038c..b33e32ae9d04 100644 --- a/types/staking.go +++ b/types/staking.go @@ -3,6 +3,7 @@ package types import ( "cosmossdk.io/math" + cryptokeys "github.com/cosmos/cosmos-sdk/crypto/keys" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" ) @@ -98,3 +99,11 @@ type ValidatorI interface { SharesFromTokens(amt math.Int) (math.LegacyDec, error) // shares worth of delegator's bond SharesFromTokensTruncated(amt math.Int) (math.LegacyDec, error) // truncated shares worth of delegator's bond } + +// GenesisValidator is an initial validator. +type GenesisValidator struct { + Address ConsAddress `json:"address"` + PubKey cryptokeys.JSONPubkey `json:"pub_key"` + Power int64 `json:"power"` + Name string `json:"name"` +} diff --git a/x/genutil/client/cli/migrate.go b/x/genutil/client/cli/migrate.go index 2b2a1c856b74..912aae4600f8 100644 --- a/x/genutil/client/cli/migrate.go +++ b/x/genutil/client/cli/migrate.go @@ -13,13 +13,19 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/version" + v052 "github.com/cosmos/cosmos-sdk/x/genutil/migration/v052" "github.com/cosmos/cosmos-sdk/x/genutil/types" ) -const flagGenesisTime = "genesis-time" +const ( + flagGenesisTime = "genesis-time" + v52 = "v0.52" +) // MigrationMap is a map of SDK versions to their respective genesis migration functions. -var MigrationMap = types.MigrationMap{} +var MigrationMap = types.MigrationMap{ + v52: v052.Migrate, +} // MigrateGenesisCmd returns a command to execute genesis state migration. // Applications should pass their own migration map to this function. @@ -56,7 +62,17 @@ func MigrateHandler(cmd *cobra.Command, args []string, migrations types.Migratio } importGenesis := args[1] - appGenesis, err := types.AppGenesisFromFile(importGenesis) + outputDocument, _ := cmd.Flags().GetString(flags.FlagOutputDocument) + + // for v52 we need to migrate the consensus validator address from hex bytes to + // sdk consensus address. + var appGenesis *types.AppGenesis + var err error + if target == v52 { + appGenesis, err = v052.MigrateGenesisFile(importGenesis) + } else { + appGenesis, err = types.AppGenesisFromFile(importGenesis) + } if err != nil { return err } @@ -110,7 +126,6 @@ func MigrateHandler(cmd *cobra.Command, args []string, migrations types.Migratio return fmt.Errorf("failed to marshal app genesis: %w", err) } - outputDocument, _ := cmd.Flags().GetString(flags.FlagOutputDocument) if outputDocument == "" { cmd.Println(string(bz)) return nil diff --git a/x/genutil/migration/v052/migrate.go b/x/genutil/migration/v052/migrate.go new file mode 100644 index 000000000000..350240850cff --- /dev/null +++ b/x/genutil/migration/v052/migrate.go @@ -0,0 +1,173 @@ +package migrate + +import ( + "encoding/json" + "errors" + "fmt" + "io" + "os" + "path/filepath" + "time" + + cmtjson "github.com/cometbft/cometbft/libs/json" + cmttypes "github.com/cometbft/cometbft/types" + + "github.com/cosmos/cosmos-sdk/client" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/version" + "github.com/cosmos/cosmos-sdk/x/genutil/types" +) + +type legacyAppGenesis struct { + AppName string `json:"app_name"` + AppVersion string `json:"app_version"` + GenesisTime time.Time `json:"genesis_time"` + ChainID string `json:"chain_id"` + InitialHeight int64 `json:"initial_height"` + AppHash []byte `json:"app_hash"` + AppState json.RawMessage `json:"app_state,omitempty"` + Consensus *legacyConsensusGenesis `json:"consensus,omitempty"` +} + +type legacyConsensusGenesis struct { + Validators []cmttypes.GenesisValidator `json:"validators,omitempty"` + Params *cmttypes.ConsensusParams `json:"params,omitempty"` +} + +func MigrateGenesisFile(oldGenFile string) (*types.AppGenesis, error) { + file, err := os.Open(filepath.Clean(oldGenFile)) + if err != nil { + return nil, err + } + defer file.Close() + + appGenesis, err := migrateGenesisValidator(file) + if err != nil { + return nil, fmt.Errorf("failed to read genesis from file %s: %w", oldGenFile, err) + } + + return appGenesis, nil +} + +// migrateGenesisValidator migrate current genesis file genesis validator to match of the +// new genesis validator type. +func migrateGenesisValidator(r io.Reader) (*types.AppGenesis, error) { + var newAg types.AppGenesis + var ag legacyAppGenesis + var err error + + if rs, ok := r.(io.ReadSeeker); ok { + err = json.NewDecoder(rs).Decode(&ag) + if err == nil { + vals, err := convertValidators(ag.Consensus.Validators) + if err != nil { + return nil, err + } + newAg = types.AppGenesis{ + AppName: ag.AppName, + AppVersion: ag.AppVersion, + GenesisTime: ag.GenesisTime, + ChainID: ag.ChainID, + InitialHeight: ag.InitialHeight, + AppHash: ag.AppHash, + AppState: ag.AppState, + Consensus: &types.ConsensusGenesis{ + Validators: vals, + Params: ag.Consensus.Params, + }, + } + + return &newAg, nil + } + + err = fmt.Errorf("error unmarshalling legacy AppGenesis: %w", err) + if _, serr := rs.Seek(0, io.SeekStart); serr != nil { + err = errors.Join(err, fmt.Errorf("error seeking back to the front: %w", serr)) + return nil, err + } + } + + jsonBlob, ioerr := io.ReadAll(r) + if ioerr != nil { + err = errors.Join(err, fmt.Errorf("failed to read file completely: %w", ioerr)) + return nil, err + } + + // fallback to comet genesis parsing + var ctmGenesis cmttypes.GenesisDoc + if uerr := cmtjson.Unmarshal(jsonBlob, &ctmGenesis); uerr != nil { + err = errors.Join(err, fmt.Errorf("failed fallback to CometBFT GenDoc: %w", uerr)) + return nil, err + } + + vals, err := convertValidators(ctmGenesis.Validators) + if err != nil { + return nil, err + } + newAg = types.AppGenesis{ + AppName: version.AppName, + GenesisTime: ctmGenesis.GenesisTime, + ChainID: ctmGenesis.ChainID, + InitialHeight: ctmGenesis.InitialHeight, + AppHash: ctmGenesis.AppHash, + AppState: ctmGenesis.AppState, + Consensus: &types.ConsensusGenesis{ + Validators: vals, + Params: ctmGenesis.ConsensusParams, + }, + } + + return &newAg, nil +} + +func convertValidators(cmtVals []cmttypes.GenesisValidator) ([]sdk.GenesisValidator, error) { + vals := make([]sdk.GenesisValidator, len(cmtVals)) + for i, cmtVal := range cmtVals { + pk, err := cryptocodec.FromCmtPubKeyInterface(cmtVal.PubKey) + if err != nil { + return nil, err + } + jsonPk, err := cryptocodec.PubKeyFromProto(pk) + if err != nil { + return nil, err + } + vals[i] = sdk.GenesisValidator{ + Address: cmtVal.Address.Bytes(), + PubKey: jsonPk, + Power: cmtVal.Power, + Name: cmtVal.Name, + } + } + return vals, nil +} + +// CometBFT Genesis Handling for JSON, +// this is necessary for json unmarshaling of legacyConsensusGenesis +func (cs *legacyConsensusGenesis) MarshalJSON() ([]byte, error) { + type Alias legacyConsensusGenesis + return cmtjson.Marshal(&Alias{ + Validators: cs.Validators, + Params: cs.Params, + }) +} + +func (cs *legacyConsensusGenesis) UnmarshalJSON(b []byte) error { + type Alias legacyConsensusGenesis + + result := Alias{} + if err := cmtjson.Unmarshal(b, &result); err != nil { + return err + } + + cs.Params = result.Params + cs.Validators = result.Validators + + return nil +} + +// since we only need migrate the consensus validators content so there is no +// exported state migration. +func Migrate(appState types.AppMap, _ client.Context) (types.AppMap, error) { + return appState, nil +} diff --git a/x/genutil/migration/v052/migrate_test.go b/x/genutil/migration/v052/migrate_test.go new file mode 100644 index 000000000000..5c38bb3401fa --- /dev/null +++ b/x/genutil/migration/v052/migrate_test.go @@ -0,0 +1,51 @@ +package migrate + +import ( + "bytes" + "encoding/json" + "os" + "testing" + + "github.com/stretchr/testify/require" + + "github.com/cosmos/cosmos-sdk/x/genutil/types" +) + +var oldGenFilePath = "./testdata/old_app_genesis.json" + +func TestMigration(t *testing.T) { + tempDir := t.TempDir() + + // clean all content on this directory + err := os.RemoveAll(tempDir) + require.NoError(t, err) + + // should not be able to get app genesis from new genesis file + // since validators address are still in hex string and not cons address + _, err = types.AppGenesisFromFile(oldGenFilePath) + require.ErrorContains(t, err, "error unmarshalling AppGenesis: decoding bech32 failed") + + newAppGenesis, err := MigrateGenesisFile(oldGenFilePath) + require.NoError(t, err) + // save the new app genesis to new temp dir + err = newAppGenesis.SaveAs(tempDir) + require.NoError(t, err) + + // read the old app genesis to compare with the new app genesis + var oldAppGenesis legacyAppGenesis + r, err := os.Open(oldGenFilePath) + require.NoError(t, err) + err = json.NewDecoder(r).Decode(&oldAppGenesis) + require.NoError(t, err) + + // should be able to get app genesis from new genesis file + newAppGenesis, err = types.AppGenesisFromFile(tempDir) + require.NotNil(t, newAppGenesis) + require.NotNil(t, newAppGenesis.Consensus) + require.True(t, bytes.Equal(oldAppGenesis.AppHash, newAppGenesis.AppHash)) + require.True(t, bytes.Equal(oldAppGenesis.Consensus.Validators[0].Address.Bytes(), newAppGenesis.Consensus.Validators[0].Address.Bytes())) + require.True(t, bytes.Equal(oldAppGenesis.Consensus.Validators[0].PubKey.Bytes(), newAppGenesis.Consensus.Validators[0].PubKey.Bytes())) + require.Equal(t, len(oldAppGenesis.Consensus.Validators), len(newAppGenesis.Consensus.Validators), "Number of validators should remain the same after migration") + + require.NoError(t, err) +} diff --git a/x/genutil/migration/v052/testdata/old_app_genesis.json b/x/genutil/migration/v052/testdata/old_app_genesis.json new file mode 100644 index 000000000000..57ca37536b6d --- /dev/null +++ b/x/genutil/migration/v052/testdata/old_app_genesis.json @@ -0,0 +1 @@ +{"app_name":"\u003cappd\u003e","app_version":"","genesis_time":"2023-02-20T11:08:30.588307671Z","chain_id":"demo","initial_height":48,"app_hash":"","app_state":{"auth":{"accounts":[{"@type":"/cosmos.auth.v1beta1.BaseAccount","account_number":"1","address":"cosmos1qmkksxlxqdslq6kkca25m4jn344nx29lytq8f9","pub_key":null,"sequence":"0"},{"@type":"/cosmos.auth.v1beta1.BaseAccount","account_number":"8","address":"cosmos1pnt5523etwtzv6mj7haryfw6w8h5tkcuhd99m8","pub_key":null,"sequence":"0"},{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"4","address":"cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh","pub_key":null,"sequence":"0"},"name":"bonded_tokens_pool","permissions":["burner","staking"]},{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"5","address":"cosmos1tygms3xhhs3yv487phx3dw4a95jn7t7lpm470r","pub_key":null,"sequence":"0"},"name":"not_bonded_tokens_pool","permissions":["burner","staking"]},{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"6","address":"cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn","pub_key":null,"sequence":"0"},"name":"gov","permissions":["burner"]},{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"3","address":"cosmos1jv65s3grqf6v6jl3dp4t6c9t9rk99cd88lyufl","pub_key":null,"sequence":"0"},"name":"distribution","permissions":[]},{"@type":"/cosmos.auth.v1beta1.BaseAccount","account_number":"0","address":"cosmos15jenkldw6348lpgdev3vjzw90zzknxa9a3vg0j","pub_key":{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A3uyZdXedyvYx9VCL6xRjkxtcFpgxjhXFIz9b2mWz+aV"},"sequence":"4"},{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"7","address":"cosmos1m3h30wlvsf8llruxtpukdvsy0km2kum8g38c8q","pub_key":null,"sequence":"0"},"name":"mint","permissions":["minter"]},{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"2","address":"cosmos17xpfvakm2amg962yls6f84z3kell8c5lserqta","pub_key":null,"sequence":"0"},"name":"fee_collector","permissions":[]}],"params":{"max_memo_characters":"256","sig_verify_cost_ed25519":"590","sig_verify_cost_secp256k1":"1000","tx_sig_limit":"7","tx_size_cost_per_byte":"10"}},"authz":{"authorization":[]},"bank":{"balances":[{"address":"cosmos1qmkksxlxqdslq6kkca25m4jn344nx29lytq8f9","coins":[{"amount":"5000000000","denom":"stake"}]},{"address":"cosmos1pnt5523etwtzv6mj7haryfw6w8h5tkcuhd99m8","coins":[{"amount":"1000","denom":"stake"}]},{"address":"cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh","coins":[{"amount":"1000000","denom":"stake"}]},{"address":"cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn","coins":[{"amount":"10010000","denom":"stake"}]},{"address":"cosmos1jv65s3grqf6v6jl3dp4t6c9t9rk99cd88lyufl","coins":[{"amount":"9635","denom":"stake"}]},{"address":"cosmos15jenkldw6348lpgdev3vjzw90zzknxa9a3vg0j","coins":[{"amount":"4988989000","denom":"stake"}]}],"denom_metadata":[],"params":{"default_send_enabled":true,"send_enabled":[]},"send_enabled":[],"supply":[{"amount":"10000009635","denom":"stake"}]},"consensus":null,"crisis":{"constant_fee":{"amount":"1000","denom":"stake"}},"distribution":{"delegator_starting_infos":[{"delegator_address":"cosmos15jenkldw6348lpgdev3vjzw90zzknxa9a3vg0j","starting_info":{"height":"0","previous_period":"1","stake":"1000000.000000000000000000"},"validator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp"}],"delegator_withdraw_infos":[],"fee_pool":{"community_pool":[{"amount":"192.700000000000000000","denom":"stake"}]},"outstanding_rewards":[{"outstanding_rewards":[{"amount":"9442.300000000000000000","denom":"stake"}],"validator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp"}],"params":{"base_proposer_reward":"0.000000000000000000","bonus_proposer_reward":"0.000000000000000000","community_tax":"0.020000000000000000","withdraw_addr_enabled":true},"previous_proposer":"cosmosvalcons16vm0nx49eam4q0xasdnwdzsdl6ymgyjt757sgr","validator_accumulated_commissions":[{"accumulated":{"commission":[{"amount":"944.230000000000000000","denom":"stake"}]},"validator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp"}],"validator_current_rewards":[{"rewards":{"period":"2","rewards":[{"amount":"8498.070000000000000000","denom":"stake"}]},"validator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp"}],"validator_historical_rewards":[{"period":"1","rewards":{"cumulative_reward_ratio":[],"reference_count":2},"validator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp"}],"validator_slash_events":[]},"evidence":{"evidence":[]},"feegrant":{"allowances":[]},"genutil":{"gen_txs":[]},"gov":{"deposit_params":null,"deposits":[{"amount":[{"amount":"10010000","denom":"stake"}],"depositor":"cosmos15jenkldw6348lpgdev3vjzw90zzknxa9a3vg0j","proposal_id":"1"}],"params":{"expedited_min_deposit":[{"amount":"50000000","denom":"stake"}],"expedited_threshold":"0.667000000000000000","expedited_voting_period":"86400s","max_deposit_period":"172800s","min_deposit":[{"amount":"10000000","denom":"stake"}],"min_initial_deposit_ratio":"0.000000000000000000","proposal_cancel_dest":"","proposal_cancel_ratio":"0.500000000000000000","quorum":"0.334000000000000000","threshold":"0.500000000000000000","veto_threshold":"0.334000000000000000","voting_period":"172800s"},"proposals":[{"deposit_end_time":"2023-02-22T11:11:52.776167376Z","expedited":false,"final_tally_result":{"abstain_count":"0","no_count":"0","no_with_veto_count":"0","yes_count":"0"},"id":"1","messages":[{"@type":"/cosmos.distribution.v1beta1.MsgCommunityPoolSpend","amount":[],"authority":"cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn","recipient":"cosmos1pnt5523etwtzv6mj7haryfw6w8h5tkcuhd99m8"}],"metadata":"ipfs://CID","proposer":"cosmos15jenkldw6348lpgdev3vjzw90zzknxa9a3vg0j","status":"PROPOSAL_STATUS_VOTING_PERIOD","submit_time":"2023-02-20T11:11:52.776167376Z","summary":"test proposal","title":"test proposal","total_deposit":[{"amount":"10010000","denom":"stake"}],"voting_end_time":"2023-02-22T11:12:07.801161984Z","voting_start_time":"2023-02-20T11:12:07.801161984Z"}],"starting_proposal_id":"2","tally_params":null,"votes":[],"voting_params":null},"group":{"group_members":[],"group_policies":[],"group_policy_seq":"0","group_seq":"0","groups":[],"proposal_seq":"0","proposals":[],"votes":[]},"mint":{"minter":{"annual_provisions":"1300010905.175073197786747950","inflation":"0.130000967926594565"},"params":{"blocks_per_year":"6311520","goal_bonded":"0.670000000000000000","inflation_max":"0.200000000000000000","inflation_min":"0.070000000000000000","inflation_rate_change":"0.130000000000000000","mint_denom":"stake"}},"nft":{"classes":[],"entries":[]},"params":null,"slashing":{"missed_blocks":[{"address":"cosmosvalcons16vm0nx49eam4q0xasdnwdzsdl6ymgyjt757sgr","missed_blocks":[]}],"params":{"downtime_jail_duration":"600s","min_signed_per_window":"0.500000000000000000","signed_blocks_window":"100","slash_fraction_double_sign":"0.050000000000000000","slash_fraction_downtime":"0.010000000000000000"},"signing_infos":[{"address":"cosmosvalcons16vm0nx49eam4q0xasdnwdzsdl6ymgyjt757sgr","validator_signing_info":{"address":"cosmosvalcons16vm0nx49eam4q0xasdnwdzsdl6ymgyjt757sgr","index_offset":"46","jailed_until":"1970-01-01T00:00:00Z","missed_blocks_counter":"0","start_height":"0","tombstoned":false}}]},"staking":{"delegations":[{"delegator_address":"cosmos15jenkldw6348lpgdev3vjzw90zzknxa9a3vg0j","shares":"1000000.000000000000000000","validator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp"}],"exported":true,"last_total_power":"1","last_validator_powers":[{"address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp","power":"1"}],"params":{"bond_denom":"stake","historical_entries":10000,"max_entries":7,"max_validators":100,"min_commission_rate":"0.000000000000000000","unbonding_time":"1814400s"},"redelegations":[],"unbonding_delegations":[],"validators":[{"commission":{"commission_rates":{"max_change_rate":"0.010000000000000000","max_rate":"0.200000000000000000","rate":"0.100000000000000000"},"update_time":"2023-02-20T11:08:30.588307671Z"},"consensus_pubkey":{"@type":"/cosmos.crypto.ed25519.PubKey","key":"tMZonPQYoooG/xbFVhHg95pTLxx7aO43/qgHFxDagWM="},"delegator_shares":"1000000.000000000000000000","description":{"details":"","identity":"","moniker":"test","security_contact":"","website":""},"jailed":false,"min_self_delegation":"1","operator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp","status":"BOND_STATUS_BONDED","tokens":"1000000","unbonding_height":"0","unbonding_ids":[],"unbonding_on_hold_ref_count":"0","unbonding_time":"1970-01-01T00:00:00Z"}]},"upgrade":{},"vesting":{}},"consensus":{"validators":[{"address":"D336F99AA5CF77503CDD8366E68A0DFE89B4124B","pub_key":{"type":"tendermint/PubKeyEd25519","value":"tMZonPQYoooG/xbFVhHg95pTLxx7aO43/qgHFxDagWM="},"power":"1","name":"test"}],"params":{"block":{"max_bytes":"22020096","max_gas":"-1"},"evidence":{"max_age_num_blocks":"100000","max_age_duration":"172800000000000","max_bytes":"1048576"},"validator":{"pub_key_types":["ed25519"]},"version":{"app":"0"},"synchrony":{"precision":"0","message_delay":"0"},"feature":{"vote_extensions_enable_height":"0","pbts_enable_height":"0"}}}} \ No newline at end of file diff --git a/x/genutil/types/genesis.go b/x/genutil/types/genesis.go index 1566c0affaac..023abfba082c 100644 --- a/x/genutil/types/genesis.go +++ b/x/genutil/types/genesis.go @@ -14,6 +14,8 @@ import ( cmtjson "github.com/cometbft/cometbft/libs/json" cmttypes "github.com/cometbft/cometbft/types" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/version" ) @@ -118,6 +120,26 @@ func AppGenesisFromReader(reader io.Reader) (*AppGenesis, error) { return nil, err } + vals := []sdk.GenesisValidator{} + for _, cmtVal := range ctmGenesis.Validators { + pk, err := cryptocodec.FromCmtPubKeyInterface(cmtVal.PubKey) + if err != nil { + return nil, err + } + jsonPk, err := cryptocodec.PubKeyFromProto(pk) + if err != nil { + return nil, err + } + val := sdk.GenesisValidator{ + Address: cmtVal.Address.Bytes(), + PubKey: jsonPk, + Power: cmtVal.Power, + Name: cmtVal.Name, + } + + vals = append(vals, val) + } + ag = AppGenesis{ AppName: version.AppName, // AppVersion is not filled as we do not know it from a CometBFT genesis @@ -127,7 +149,7 @@ func AppGenesisFromReader(reader io.Reader) (*AppGenesis, error) { AppHash: ctmGenesis.AppHash, AppState: ctmGenesis.AppState, Consensus: &ConsensusGenesis{ - Validators: ctmGenesis.Validators, + Validators: vals, Params: ctmGenesis.ConsensusParams, }, } @@ -160,13 +182,36 @@ func AppGenesisFromFile(genFile string) (*AppGenesis, error) { // ToGenesisDoc converts the AppGenesis to a CometBFT GenesisDoc. func (ag *AppGenesis) ToGenesisDoc() (*cmttypes.GenesisDoc, error) { + cmtValidators := []cmttypes.GenesisValidator{} + for _, val := range ag.Consensus.Validators { + pk, err := cryptocodec.PubKeyToProto(val.PubKey) + if err != nil { + return nil, err + } + cmtPk, err := cryptocodec.ToCmtPubKeyInterface(pk) + if err != nil { + return nil, err + } + cmtVal := cmttypes.GenesisValidator{ + Address: val.Address.Bytes(), + PubKey: cmtPk, + Power: val.Power, + Name: val.Name, + } + + cmtValidators = append(cmtValidators, cmtVal) + } + // assert nil value for empty validators set + if len(cmtValidators) == 0 { + cmtValidators = nil + } return &cmttypes.GenesisDoc{ GenesisTime: ag.GenesisTime, ChainID: ag.ChainID, InitialHeight: ag.InitialHeight, AppHash: ag.AppHash, AppState: ag.AppState, - Validators: ag.Consensus.Validators, + Validators: cmtValidators, ConsensusParams: ag.Consensus.Params, }, nil } @@ -174,13 +219,13 @@ func (ag *AppGenesis) ToGenesisDoc() (*cmttypes.GenesisDoc, error) { // ConsensusGenesis defines the consensus layer's genesis. // TODO(@julienrbrt) eventually abstract from CometBFT types type ConsensusGenesis struct { - Validators []cmttypes.GenesisValidator `json:"validators,omitempty"` - Params *cmttypes.ConsensusParams `json:"params,omitempty"` + Validators []sdk.GenesisValidator `json:"validators,omitempty"` + Params *cmttypes.ConsensusParams `json:"params,omitempty"` } // NewConsensusGenesis returns a ConsensusGenesis with given values. // It takes a proto consensus params so it can called from server export command. -func NewConsensusGenesis(params cmtproto.ConsensusParams, validators []cmttypes.GenesisValidator) *ConsensusGenesis { +func NewConsensusGenesis(params cmtproto.ConsensusParams, validators []sdk.GenesisValidator) *ConsensusGenesis { return &ConsensusGenesis{ Params: &cmttypes.ConsensusParams{ Block: cmttypes.BlockParams{ @@ -211,7 +256,7 @@ func (cs *ConsensusGenesis) MarshalJSON() ([]byte, error) { func (cs *ConsensusGenesis) UnmarshalJSON(b []byte) error { type Alias ConsensusGenesis - result := Alias{} + var result Alias if err := cmtjson.Unmarshal(b, &result); err != nil { return err } @@ -241,7 +286,7 @@ func (cs *ConsensusGenesis) ValidateAndComplete() error { return fmt.Errorf("incorrect address for validator %v in the genesis file, should be %v", v, v.PubKey.Address()) } if len(v.Address) == 0 { - cs.Validators[i].Address = v.PubKey.Address() + cs.Validators[i].Address = v.PubKey.Address().Bytes() } } diff --git a/x/genutil/types/testdata/app_genesis.json b/x/genutil/types/testdata/app_genesis.json index 57ca37536b6d..20bca1589f76 100644 --- a/x/genutil/types/testdata/app_genesis.json +++ b/x/genutil/types/testdata/app_genesis.json @@ -1 +1 @@ -{"app_name":"\u003cappd\u003e","app_version":"","genesis_time":"2023-02-20T11:08:30.588307671Z","chain_id":"demo","initial_height":48,"app_hash":"","app_state":{"auth":{"accounts":[{"@type":"/cosmos.auth.v1beta1.BaseAccount","account_number":"1","address":"cosmos1qmkksxlxqdslq6kkca25m4jn344nx29lytq8f9","pub_key":null,"sequence":"0"},{"@type":"/cosmos.auth.v1beta1.BaseAccount","account_number":"8","address":"cosmos1pnt5523etwtzv6mj7haryfw6w8h5tkcuhd99m8","pub_key":null,"sequence":"0"},{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"4","address":"cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh","pub_key":null,"sequence":"0"},"name":"bonded_tokens_pool","permissions":["burner","staking"]},{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"5","address":"cosmos1tygms3xhhs3yv487phx3dw4a95jn7t7lpm470r","pub_key":null,"sequence":"0"},"name":"not_bonded_tokens_pool","permissions":["burner","staking"]},{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"6","address":"cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn","pub_key":null,"sequence":"0"},"name":"gov","permissions":["burner"]},{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"3","address":"cosmos1jv65s3grqf6v6jl3dp4t6c9t9rk99cd88lyufl","pub_key":null,"sequence":"0"},"name":"distribution","permissions":[]},{"@type":"/cosmos.auth.v1beta1.BaseAccount","account_number":"0","address":"cosmos15jenkldw6348lpgdev3vjzw90zzknxa9a3vg0j","pub_key":{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A3uyZdXedyvYx9VCL6xRjkxtcFpgxjhXFIz9b2mWz+aV"},"sequence":"4"},{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"7","address":"cosmos1m3h30wlvsf8llruxtpukdvsy0km2kum8g38c8q","pub_key":null,"sequence":"0"},"name":"mint","permissions":["minter"]},{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"2","address":"cosmos17xpfvakm2amg962yls6f84z3kell8c5lserqta","pub_key":null,"sequence":"0"},"name":"fee_collector","permissions":[]}],"params":{"max_memo_characters":"256","sig_verify_cost_ed25519":"590","sig_verify_cost_secp256k1":"1000","tx_sig_limit":"7","tx_size_cost_per_byte":"10"}},"authz":{"authorization":[]},"bank":{"balances":[{"address":"cosmos1qmkksxlxqdslq6kkca25m4jn344nx29lytq8f9","coins":[{"amount":"5000000000","denom":"stake"}]},{"address":"cosmos1pnt5523etwtzv6mj7haryfw6w8h5tkcuhd99m8","coins":[{"amount":"1000","denom":"stake"}]},{"address":"cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh","coins":[{"amount":"1000000","denom":"stake"}]},{"address":"cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn","coins":[{"amount":"10010000","denom":"stake"}]},{"address":"cosmos1jv65s3grqf6v6jl3dp4t6c9t9rk99cd88lyufl","coins":[{"amount":"9635","denom":"stake"}]},{"address":"cosmos15jenkldw6348lpgdev3vjzw90zzknxa9a3vg0j","coins":[{"amount":"4988989000","denom":"stake"}]}],"denom_metadata":[],"params":{"default_send_enabled":true,"send_enabled":[]},"send_enabled":[],"supply":[{"amount":"10000009635","denom":"stake"}]},"consensus":null,"crisis":{"constant_fee":{"amount":"1000","denom":"stake"}},"distribution":{"delegator_starting_infos":[{"delegator_address":"cosmos15jenkldw6348lpgdev3vjzw90zzknxa9a3vg0j","starting_info":{"height":"0","previous_period":"1","stake":"1000000.000000000000000000"},"validator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp"}],"delegator_withdraw_infos":[],"fee_pool":{"community_pool":[{"amount":"192.700000000000000000","denom":"stake"}]},"outstanding_rewards":[{"outstanding_rewards":[{"amount":"9442.300000000000000000","denom":"stake"}],"validator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp"}],"params":{"base_proposer_reward":"0.000000000000000000","bonus_proposer_reward":"0.000000000000000000","community_tax":"0.020000000000000000","withdraw_addr_enabled":true},"previous_proposer":"cosmosvalcons16vm0nx49eam4q0xasdnwdzsdl6ymgyjt757sgr","validator_accumulated_commissions":[{"accumulated":{"commission":[{"amount":"944.230000000000000000","denom":"stake"}]},"validator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp"}],"validator_current_rewards":[{"rewards":{"period":"2","rewards":[{"amount":"8498.070000000000000000","denom":"stake"}]},"validator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp"}],"validator_historical_rewards":[{"period":"1","rewards":{"cumulative_reward_ratio":[],"reference_count":2},"validator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp"}],"validator_slash_events":[]},"evidence":{"evidence":[]},"feegrant":{"allowances":[]},"genutil":{"gen_txs":[]},"gov":{"deposit_params":null,"deposits":[{"amount":[{"amount":"10010000","denom":"stake"}],"depositor":"cosmos15jenkldw6348lpgdev3vjzw90zzknxa9a3vg0j","proposal_id":"1"}],"params":{"expedited_min_deposit":[{"amount":"50000000","denom":"stake"}],"expedited_threshold":"0.667000000000000000","expedited_voting_period":"86400s","max_deposit_period":"172800s","min_deposit":[{"amount":"10000000","denom":"stake"}],"min_initial_deposit_ratio":"0.000000000000000000","proposal_cancel_dest":"","proposal_cancel_ratio":"0.500000000000000000","quorum":"0.334000000000000000","threshold":"0.500000000000000000","veto_threshold":"0.334000000000000000","voting_period":"172800s"},"proposals":[{"deposit_end_time":"2023-02-22T11:11:52.776167376Z","expedited":false,"final_tally_result":{"abstain_count":"0","no_count":"0","no_with_veto_count":"0","yes_count":"0"},"id":"1","messages":[{"@type":"/cosmos.distribution.v1beta1.MsgCommunityPoolSpend","amount":[],"authority":"cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn","recipient":"cosmos1pnt5523etwtzv6mj7haryfw6w8h5tkcuhd99m8"}],"metadata":"ipfs://CID","proposer":"cosmos15jenkldw6348lpgdev3vjzw90zzknxa9a3vg0j","status":"PROPOSAL_STATUS_VOTING_PERIOD","submit_time":"2023-02-20T11:11:52.776167376Z","summary":"test proposal","title":"test proposal","total_deposit":[{"amount":"10010000","denom":"stake"}],"voting_end_time":"2023-02-22T11:12:07.801161984Z","voting_start_time":"2023-02-20T11:12:07.801161984Z"}],"starting_proposal_id":"2","tally_params":null,"votes":[],"voting_params":null},"group":{"group_members":[],"group_policies":[],"group_policy_seq":"0","group_seq":"0","groups":[],"proposal_seq":"0","proposals":[],"votes":[]},"mint":{"minter":{"annual_provisions":"1300010905.175073197786747950","inflation":"0.130000967926594565"},"params":{"blocks_per_year":"6311520","goal_bonded":"0.670000000000000000","inflation_max":"0.200000000000000000","inflation_min":"0.070000000000000000","inflation_rate_change":"0.130000000000000000","mint_denom":"stake"}},"nft":{"classes":[],"entries":[]},"params":null,"slashing":{"missed_blocks":[{"address":"cosmosvalcons16vm0nx49eam4q0xasdnwdzsdl6ymgyjt757sgr","missed_blocks":[]}],"params":{"downtime_jail_duration":"600s","min_signed_per_window":"0.500000000000000000","signed_blocks_window":"100","slash_fraction_double_sign":"0.050000000000000000","slash_fraction_downtime":"0.010000000000000000"},"signing_infos":[{"address":"cosmosvalcons16vm0nx49eam4q0xasdnwdzsdl6ymgyjt757sgr","validator_signing_info":{"address":"cosmosvalcons16vm0nx49eam4q0xasdnwdzsdl6ymgyjt757sgr","index_offset":"46","jailed_until":"1970-01-01T00:00:00Z","missed_blocks_counter":"0","start_height":"0","tombstoned":false}}]},"staking":{"delegations":[{"delegator_address":"cosmos15jenkldw6348lpgdev3vjzw90zzknxa9a3vg0j","shares":"1000000.000000000000000000","validator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp"}],"exported":true,"last_total_power":"1","last_validator_powers":[{"address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp","power":"1"}],"params":{"bond_denom":"stake","historical_entries":10000,"max_entries":7,"max_validators":100,"min_commission_rate":"0.000000000000000000","unbonding_time":"1814400s"},"redelegations":[],"unbonding_delegations":[],"validators":[{"commission":{"commission_rates":{"max_change_rate":"0.010000000000000000","max_rate":"0.200000000000000000","rate":"0.100000000000000000"},"update_time":"2023-02-20T11:08:30.588307671Z"},"consensus_pubkey":{"@type":"/cosmos.crypto.ed25519.PubKey","key":"tMZonPQYoooG/xbFVhHg95pTLxx7aO43/qgHFxDagWM="},"delegator_shares":"1000000.000000000000000000","description":{"details":"","identity":"","moniker":"test","security_contact":"","website":""},"jailed":false,"min_self_delegation":"1","operator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp","status":"BOND_STATUS_BONDED","tokens":"1000000","unbonding_height":"0","unbonding_ids":[],"unbonding_on_hold_ref_count":"0","unbonding_time":"1970-01-01T00:00:00Z"}]},"upgrade":{},"vesting":{}},"consensus":{"validators":[{"address":"D336F99AA5CF77503CDD8366E68A0DFE89B4124B","pub_key":{"type":"tendermint/PubKeyEd25519","value":"tMZonPQYoooG/xbFVhHg95pTLxx7aO43/qgHFxDagWM="},"power":"1","name":"test"}],"params":{"block":{"max_bytes":"22020096","max_gas":"-1"},"evidence":{"max_age_num_blocks":"100000","max_age_duration":"172800000000000","max_bytes":"1048576"},"validator":{"pub_key_types":["ed25519"]},"version":{"app":"0"},"synchrony":{"precision":"0","message_delay":"0"},"feature":{"vote_extensions_enable_height":"0","pbts_enable_height":"0"}}}} \ No newline at end of file +{"app_name":"\u003cappd\u003e","app_version":"","genesis_time":"2023-02-20T11:08:30.588307671Z","chain_id":"demo","initial_height":48,"app_hash":"","app_state":{"auth":{"accounts":[{"@type":"/cosmos.auth.v1beta1.BaseAccount","account_number":"1","address":"cosmos1qmkksxlxqdslq6kkca25m4jn344nx29lytq8f9","pub_key":null,"sequence":"0"},{"@type":"/cosmos.auth.v1beta1.BaseAccount","account_number":"8","address":"cosmos1pnt5523etwtzv6mj7haryfw6w8h5tkcuhd99m8","pub_key":null,"sequence":"0"},{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"4","address":"cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh","pub_key":null,"sequence":"0"},"name":"bonded_tokens_pool","permissions":["burner","staking"]},{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"5","address":"cosmos1tygms3xhhs3yv487phx3dw4a95jn7t7lpm470r","pub_key":null,"sequence":"0"},"name":"not_bonded_tokens_pool","permissions":["burner","staking"]},{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"6","address":"cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn","pub_key":null,"sequence":"0"},"name":"gov","permissions":["burner"]},{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"3","address":"cosmos1jv65s3grqf6v6jl3dp4t6c9t9rk99cd88lyufl","pub_key":null,"sequence":"0"},"name":"distribution","permissions":[]},{"@type":"/cosmos.auth.v1beta1.BaseAccount","account_number":"0","address":"cosmos15jenkldw6348lpgdev3vjzw90zzknxa9a3vg0j","pub_key":{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A3uyZdXedyvYx9VCL6xRjkxtcFpgxjhXFIz9b2mWz+aV"},"sequence":"4"},{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"7","address":"cosmos1m3h30wlvsf8llruxtpukdvsy0km2kum8g38c8q","pub_key":null,"sequence":"0"},"name":"mint","permissions":["minter"]},{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"2","address":"cosmos17xpfvakm2amg962yls6f84z3kell8c5lserqta","pub_key":null,"sequence":"0"},"name":"fee_collector","permissions":[]}],"params":{"max_memo_characters":"256","sig_verify_cost_ed25519":"590","sig_verify_cost_secp256k1":"1000","tx_sig_limit":"7","tx_size_cost_per_byte":"10"}},"authz":{"authorization":[]},"bank":{"balances":[{"address":"cosmos1qmkksxlxqdslq6kkca25m4jn344nx29lytq8f9","coins":[{"amount":"5000000000","denom":"stake"}]},{"address":"cosmos1pnt5523etwtzv6mj7haryfw6w8h5tkcuhd99m8","coins":[{"amount":"1000","denom":"stake"}]},{"address":"cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh","coins":[{"amount":"1000000","denom":"stake"}]},{"address":"cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn","coins":[{"amount":"10010000","denom":"stake"}]},{"address":"cosmos1jv65s3grqf6v6jl3dp4t6c9t9rk99cd88lyufl","coins":[{"amount":"9635","denom":"stake"}]},{"address":"cosmos15jenkldw6348lpgdev3vjzw90zzknxa9a3vg0j","coins":[{"amount":"4988989000","denom":"stake"}]}],"denom_metadata":[],"params":{"default_send_enabled":true,"send_enabled":[]},"send_enabled":[],"supply":[{"amount":"10000009635","denom":"stake"}]},"consensus":null,"crisis":{"constant_fee":{"amount":"1000","denom":"stake"}},"distribution":{"delegator_starting_infos":[{"delegator_address":"cosmos15jenkldw6348lpgdev3vjzw90zzknxa9a3vg0j","starting_info":{"height":"0","previous_period":"1","stake":"1000000.000000000000000000"},"validator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp"}],"delegator_withdraw_infos":[],"fee_pool":{"community_pool":[{"amount":"192.700000000000000000","denom":"stake"}]},"outstanding_rewards":[{"outstanding_rewards":[{"amount":"9442.300000000000000000","denom":"stake"}],"validator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp"}],"params":{"base_proposer_reward":"0.000000000000000000","bonus_proposer_reward":"0.000000000000000000","community_tax":"0.020000000000000000","withdraw_addr_enabled":true},"previous_proposer":"cosmosvalcons16vm0nx49eam4q0xasdnwdzsdl6ymgyjt757sgr","validator_accumulated_commissions":[{"accumulated":{"commission":[{"amount":"944.230000000000000000","denom":"stake"}]},"validator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp"}],"validator_current_rewards":[{"rewards":{"period":"2","rewards":[{"amount":"8498.070000000000000000","denom":"stake"}]},"validator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp"}],"validator_historical_rewards":[{"period":"1","rewards":{"cumulative_reward_ratio":[],"reference_count":2},"validator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp"}],"validator_slash_events":[]},"evidence":{"evidence":[]},"feegrant":{"allowances":[]},"genutil":{"gen_txs":[]},"gov":{"deposit_params":null,"deposits":[{"amount":[{"amount":"10010000","denom":"stake"}],"depositor":"cosmos15jenkldw6348lpgdev3vjzw90zzknxa9a3vg0j","proposal_id":"1"}],"params":{"expedited_min_deposit":[{"amount":"50000000","denom":"stake"}],"expedited_threshold":"0.667000000000000000","expedited_voting_period":"86400s","max_deposit_period":"172800s","min_deposit":[{"amount":"10000000","denom":"stake"}],"min_initial_deposit_ratio":"0.000000000000000000","proposal_cancel_dest":"","proposal_cancel_ratio":"0.500000000000000000","quorum":"0.334000000000000000","threshold":"0.500000000000000000","veto_threshold":"0.334000000000000000","voting_period":"172800s"},"proposals":[{"deposit_end_time":"2023-02-22T11:11:52.776167376Z","expedited":false,"final_tally_result":{"abstain_count":"0","no_count":"0","no_with_veto_count":"0","yes_count":"0"},"id":"1","messages":[{"@type":"/cosmos.distribution.v1beta1.MsgCommunityPoolSpend","amount":[],"authority":"cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn","recipient":"cosmos1pnt5523etwtzv6mj7haryfw6w8h5tkcuhd99m8"}],"metadata":"ipfs://CID","proposer":"cosmos15jenkldw6348lpgdev3vjzw90zzknxa9a3vg0j","status":"PROPOSAL_STATUS_VOTING_PERIOD","submit_time":"2023-02-20T11:11:52.776167376Z","summary":"test proposal","title":"test proposal","total_deposit":[{"amount":"10010000","denom":"stake"}],"voting_end_time":"2023-02-22T11:12:07.801161984Z","voting_start_time":"2023-02-20T11:12:07.801161984Z"}],"starting_proposal_id":"2","tally_params":null,"votes":[],"voting_params":null},"group":{"group_members":[],"group_policies":[],"group_policy_seq":"0","group_seq":"0","groups":[],"proposal_seq":"0","proposals":[],"votes":[]},"mint":{"minter":{"annual_provisions":"1300010905.175073197786747950","inflation":"0.130000967926594565"},"params":{"blocks_per_year":"6311520","goal_bonded":"0.670000000000000000","inflation_max":"0.200000000000000000","inflation_min":"0.070000000000000000","inflation_rate_change":"0.130000000000000000","mint_denom":"stake"}},"nft":{"classes":[],"entries":[]},"params":null,"slashing":{"missed_blocks":[{"address":"cosmosvalcons16vm0nx49eam4q0xasdnwdzsdl6ymgyjt757sgr","missed_blocks":[]}],"params":{"downtime_jail_duration":"600s","min_signed_per_window":"0.500000000000000000","signed_blocks_window":"100","slash_fraction_double_sign":"0.050000000000000000","slash_fraction_downtime":"0.010000000000000000"},"signing_infos":[{"address":"cosmosvalcons16vm0nx49eam4q0xasdnwdzsdl6ymgyjt757sgr","validator_signing_info":{"address":"cosmosvalcons16vm0nx49eam4q0xasdnwdzsdl6ymgyjt757sgr","index_offset":"46","jailed_until":"1970-01-01T00:00:00Z","missed_blocks_counter":"0","start_height":"0","tombstoned":false}}]},"staking":{"delegations":[{"delegator_address":"cosmos15jenkldw6348lpgdev3vjzw90zzknxa9a3vg0j","shares":"1000000.000000000000000000","validator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp"}],"exported":true,"last_total_power":"1","last_validator_powers":[{"address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp","power":"1"}],"params":{"bond_denom":"stake","historical_entries":10000,"max_entries":7,"max_validators":100,"min_commission_rate":"0.000000000000000000","unbonding_time":"1814400s"},"redelegations":[],"unbonding_delegations":[],"validators":[{"commission":{"commission_rates":{"max_change_rate":"0.010000000000000000","max_rate":"0.200000000000000000","rate":"0.100000000000000000"},"update_time":"2023-02-20T11:08:30.588307671Z"},"consensus_pubkey":{"@type":"/cosmos.crypto.ed25519.PubKey","key":"tMZonPQYoooG/xbFVhHg95pTLxx7aO43/qgHFxDagWM="},"delegator_shares":"1000000.000000000000000000","description":{"details":"","identity":"","moniker":"test","security_contact":"","website":""},"jailed":false,"min_self_delegation":"1","operator_address":"cosmosvaloper15jenkldw6348lpgdev3vjzw90zzknxa9c9carp","status":"BOND_STATUS_BONDED","tokens":"1000000","unbonding_height":"0","unbonding_ids":[],"unbonding_on_hold_ref_count":"0","unbonding_time":"1970-01-01T00:00:00Z"}]},"upgrade":{},"vesting":{}},"consensus":{"validators":[{"address":"cosmosvalcons16vm0nx49eam4q0xasdnwdzsdl6ymgyjt757sgr","pub_key":{"type":"tendermint/PubKeyEd25519","value":"tMZonPQYoooG/xbFVhHg95pTLxx7aO43/qgHFxDagWM="},"power":"1","name":"test"}],"params":{"block":{"max_bytes":"22020096","max_gas":"-1"},"evidence":{"max_age_num_blocks":"100000","max_age_duration":"172800000000000","max_bytes":"1048576"},"validator":{"pub_key_types":["ed25519"]},"version":{"app":"0"},"synchrony":{"precision":"0","message_delay":"0"},"feature":{"vote_extensions_enable_height":"0","pbts_enable_height":"0"}}}} \ No newline at end of file diff --git a/x/genutil/utils.go b/x/genutil/utils.go index b20b7bfa6ec8..ee7d11e39e80 100644 --- a/x/genutil/utils.go +++ b/x/genutil/utils.go @@ -14,11 +14,11 @@ import ( tmed25519 "github.com/cometbft/cometbft/crypto/ed25519" "github.com/cometbft/cometbft/p2p" "github.com/cometbft/cometbft/privval" - cmttypes "github.com/cometbft/cometbft/types" "github.com/cosmos/go-bip39" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/genutil/types" ) @@ -35,7 +35,7 @@ func ExportGenesisFile(genesis *types.AppGenesis, genFile string) error { // ExportGenesisFileWithTime creates and writes the genesis configuration to disk. // An error is returned if building or writing the configuration to file fails. func ExportGenesisFileWithTime( - genFile, chainID string, validators []cmttypes.GenesisValidator, appState json.RawMessage, genTime time.Time, + genFile, chainID string, validators []sdk.GenesisValidator, appState json.RawMessage, genTime time.Time, ) error { appGenesis := types.NewAppGenesisWithVersion(chainID, appState) appGenesis.GenesisTime = genTime diff --git a/x/genutil/v2/cli/export.go b/x/genutil/v2/cli/export.go index 318ad58d8a47..9b0d992bad0a 100644 --- a/x/genutil/v2/cli/export.go +++ b/x/genutil/v2/cli/export.go @@ -76,6 +76,7 @@ func ExportCmd(appExporter v2.AppExporter) *cobra.Command { appGenesis.AppState = exported.AppState appGenesis.InitialHeight = exported.Height + appGenesis.Consensus.Validators = exported.Validators out, err := json.Marshal(appGenesis) if err != nil { diff --git a/x/genutil/v2/types.go b/x/genutil/v2/types.go index 3199a5a5afb4..fbf288365a57 100644 --- a/x/genutil/v2/types.go +++ b/x/genutil/v2/types.go @@ -3,6 +3,8 @@ package v2 import ( "context" "encoding/json" + + sdk "github.com/cosmos/cosmos-sdk/types" ) // AppExporter is a function that dumps all app state to @@ -20,4 +22,6 @@ type ExportedApp struct { AppState json.RawMessage // Height is the app's latest block height. Height int64 + // Validators is the exported validator set. + Validators []sdk.GenesisValidator } diff --git a/x/staking/genesis.go b/x/staking/genesis.go index d09ada842f44..938dc4666569 100644 --- a/x/staking/genesis.go +++ b/x/staking/genesis.go @@ -9,23 +9,12 @@ import ( "cosmossdk.io/x/staking/keeper" "cosmossdk.io/x/staking/types" - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" ) -// TODO: move this to sdk types and use this instead of comet types GenesisValidator -// then we can do pubkey conversion in ToGenesisDoc -// -// this is a temporary work around to avoid import comet directly in staking -type GenesisValidator struct { - Address sdk.ConsAddress - PubKey cryptotypes.PubKey - Power int64 - Name string -} - // WriteValidators returns a slice of bonded genesis validators. -func WriteValidators(ctx context.Context, keeper *keeper.Keeper) (vals []GenesisValidator, returnErr error) { +func WriteValidators(ctx context.Context, keeper *keeper.Keeper) (vals []sdk.GenesisValidator, returnErr error) { err := keeper.LastValidatorPower.Walk(ctx, nil, func(key []byte, _ gogotypes.Int64Value) (bool, error) { validator, err := keeper.GetValidator(ctx, key) if err != nil { @@ -37,10 +26,14 @@ func WriteValidators(ctx context.Context, keeper *keeper.Keeper) (vals []Genesis returnErr = err return true, err } + jsonPk, err := cryptocodec.PubKeyFromProto(pk) + if err != nil { + return true, err + } - vals = append(vals, GenesisValidator{ - Address: sdk.ConsAddress(pk.Address()), - PubKey: pk, + vals = append(vals, sdk.GenesisValidator{ + Address: pk.Address().Bytes(), + PubKey: jsonPk, Power: validator.GetConsensusPower(keeper.PowerReduction(ctx)), Name: validator.GetMoniker(), }) From f48fac3e50769bfdfbfb1fa64d3fa763e46aa41d Mon Sep 17 00:00:00 2001 From: Wukingbow <389092100@qq.com> Date: Wed, 9 Oct 2024 15:18:53 +0800 Subject: [PATCH 06/57] docs: update protobuf links (#22182) --- codec/unknownproto/unknown_fields.go | 4 ++-- .../adr-019-protobuf-state-encoding.md | 4 ++-- docs/architecture/adr-023-protobuf-naming.md | 2 +- ...27-deterministic-protobuf-serialization.md | 24 +++++++++---------- docs/architecture/adr-031-msg-service.md | 6 ++--- .../adr-044-protobuf-updates-guidelines.md | 2 +- .../adr-054-semver-compatible-modules.md | 4 ++-- .../02-messages-and-queries.md | 2 +- docs/build/building-modules/15-depinject.md | 2 +- docs/learn/advanced/05-encoding.md | 8 +++---- docs/learn/beginner/00-app-anatomy.md | 4 ++-- docs/learn/beginner/02-query-lifecycle.md | 2 +- 12 files changed, 32 insertions(+), 32 deletions(-) diff --git a/codec/unknownproto/unknown_fields.go b/codec/unknownproto/unknown_fields.go index 5fa80001c0fe..07759456e296 100644 --- a/codec/unknownproto/unknown_fields.go +++ b/codec/unknownproto/unknown_fields.go @@ -222,7 +222,7 @@ var checks = [...]map[descriptorpb.FieldDescriptorProto_Type]bool{ descriptorpb.FieldDescriptorProto_TYPE_MESSAGE: true, // The following types can be packed repeated. // ref: "Only repeated fields of primitive numeric types (types which use the varint, 32-bit, or 64-bit wire types) can be declared "packed"." - // ref: https://developers.google.com/protocol-buffers/docs/encoding#packed + // ref: https://protobuf.dev/programming-guides/encoding/#packed descriptorpb.FieldDescriptorProto_TYPE_INT32: true, descriptorpb.FieldDescriptorProto_TYPE_INT64: true, descriptorpb.FieldDescriptorProto_TYPE_UINT32: true, @@ -255,7 +255,7 @@ var checks = [...]map[descriptorpb.FieldDescriptorProto_Type]bool{ } // canEncodeType returns true if the wireType is suitable for encoding the descriptor type. -// See https://developers.google.com/protocol-buffers/docs/encoding#structure. +// See https://protobuf.dev/programming-guides/encoding/#structure. func canEncodeType(wireType protowire.Type, descType descriptorpb.FieldDescriptorProto_Type) bool { if iwt := int(wireType); iwt < 0 || iwt >= len(checks) { return false diff --git a/docs/architecture/adr-019-protobuf-state-encoding.md b/docs/architecture/adr-019-protobuf-state-encoding.md index 5ad1b953e796..267896d9621b 100644 --- a/docs/architecture/adr-019-protobuf-state-encoding.md +++ b/docs/architecture/adr-019-protobuf-state-encoding.md @@ -21,7 +21,7 @@ and JSON object encoding over the wire bringing parity between logical objects a From the Amino docs: > Amino is an object encoding specification. It is a subset of Proto3 with an extension for interface -> support. See the [Proto3 spec](https://developers.google.com/protocol-buffers/docs/proto3) for more +> support. See the [Proto3 spec](https://protobuf.dev/programming-guides/proto3/) for more > information on Proto3, which Amino is largely compatible with (but not with Proto2). > > The goal of the Amino encoding protocol is to bring parity into logic objects and persistence objects. @@ -56,7 +56,7 @@ made to address client-side encoding. ## Decision -We will adopt [Protocol Buffers](https://developers.google.com/protocol-buffers) for serializing +We will adopt [Protocol Buffers](https://protobuf.dev) for serializing persisted structured data in the Cosmos SDK while providing a clean mechanism and developer UX for applications wishing to continue to use Amino. We will provide this mechanism by updating modules to accept a codec interface, `Marshaler`, instead of a concrete Amino codec. Furthermore, the Cosmos SDK diff --git a/docs/architecture/adr-023-protobuf-naming.md b/docs/architecture/adr-023-protobuf-naming.md index a192dfce3264..01bfd8bd94ca 100644 --- a/docs/architecture/adr-023-protobuf-naming.md +++ b/docs/architecture/adr-023-protobuf-naming.md @@ -11,7 +11,7 @@ Accepted ## Context -Protocol Buffers provide a basic [style guide](https://developers.google.com/protocol-buffers/docs/style) +Protocol Buffers provide a basic [style guide](https://protobuf.dev/programming-guides/style/) and [Buf](https://buf.build/docs/style-guide) builds upon that. To the extent possible, we want to follow industry accepted guidelines and wisdom for the effective usage of protobuf, deviating from those only when there is clear diff --git a/docs/architecture/adr-027-deterministic-protobuf-serialization.md b/docs/architecture/adr-027-deterministic-protobuf-serialization.md index 66ce6e2b75e2..41e0d28e33d9 100644 --- a/docs/architecture/adr-027-deterministic-protobuf-serialization.md +++ b/docs/architecture/adr-027-deterministic-protobuf-serialization.md @@ -15,7 +15,7 @@ Fully deterministic structure serialization, which works across many languages a is needed when signing messages. We need to be sure that whenever we serialize a data structure, no matter in which supported language, the raw bytes will stay the same. -[Protobuf](https://developers.google.com/protocol-buffers/docs/proto3) +[Protobuf](https://protobuf.dev/programming-guides/proto3/) serialization is not bijective (i.e. there exist a practically unlimited number of valid binary representations for a given protobuf document)1. @@ -55,7 +55,7 @@ reject documents containing maps as invalid input. ### Background - Protobuf3 Encoding Most numeric types in protobuf3 are encoded as -[varints](https://developers.google.com/protocol-buffers/docs/encoding#varints). +[varints](https://protobuf.dev/programming-guides/encoding/#varints). Varints are at most 10 bytes, and since each varint byte has 7 bits of data, varints are a representation of `uint70` (70-bit unsigned integer). When encoding, numeric values are casted from their base type to `uint70`, and when @@ -74,15 +74,15 @@ encoding malleability. ### Serialization rules The serialization is based on the -[protobuf3 encoding](https://developers.google.com/protocol-buffers/docs/encoding) +[protobuf3 encoding](https://protobuf.dev/programming-guides/encoding/) with the following additions: 1. Fields must be serialized only once in ascending order 2. Extra fields or any extra data must not be added -3. [Default values](https://developers.google.com/protocol-buffers/docs/proto3#default) +3. [Default values](https://protobuf.dev/programming-guides/proto3/#default) must be omitted 4. `repeated` fields of scalar numeric types must use - [packed encoding](https://developers.google.com/protocol-buffers/docs/encoding#packed) + [packed encoding](https://protobuf.dev/programming-guides/encoding/#packed) 5. Varint encoding must not be longer than needed: * No trailing zero bytes (in little endian, i.e. no leading zeroes in big endian). Per rule 3 above, the default value of `0` must be omitted, so @@ -288,27 +288,27 @@ the need of implementing a custom serializer that adheres to this standard (and implementation detail and the details of any particular implementation may change in the future. Therefore, protocol buffer parsers must be able to parse fields in any order._ from - https://developers.google.com/protocol-buffers/docs/encoding#order -* 2 https://developers.google.com/protocol-buffers/docs/encoding#signed_integers + https://protobuf.dev/programming-guides/encoding/#order +* 2 https://protobuf.dev/programming-guides/encoding/#signed_integers * 3 _Note that for scalar message fields, once a message is parsed there's no way of telling whether a field was explicitly set to the default value (for example whether a boolean was set to false) or just not set at all: you should bear this in mind when defining your message types. For example, don't have a boolean that switches on some behavior when set to false if you don't want that behavior to also happen by default._ from - https://developers.google.com/protocol-buffers/docs/proto3#default + https://protobuf.dev/programming-guides/proto3/#default * 4 _When a message is parsed, if the encoded message does not contain a particular singular element, the corresponding field in the parsed object is set to the default value for that field._ from - https://developers.google.com/protocol-buffers/docs/proto3#default + https://protobuf.dev/programming-guides/proto3/#default * 5 _Also note that if a scalar message field is set to its default, the value will not be serialized on the wire._ from - https://developers.google.com/protocol-buffers/docs/proto3#default + https://protobuf.dev/programming-guides/proto3/#default * 6 _For enums, the default value is the first defined enum value, which must be 0._ from - https://developers.google.com/protocol-buffers/docs/proto3#default + https://protobuf.dev/programming-guides/proto3/#default * 7 _For message fields, the field is not set. Its exact value is language-dependent._ from - https://developers.google.com/protocol-buffers/docs/proto3#default + https://protobuf.dev/programming-guides/proto3/#default * Encoding rules and parts of the reasoning taken from [canonical-proto3 Aaron Craelius](https://github.com/regen-network/canonical-proto3) diff --git a/docs/architecture/adr-031-msg-service.md b/docs/architecture/adr-031-msg-service.md index 8aa78c82d25f..8185509bd190 100644 --- a/docs/architecture/adr-031-msg-service.md +++ b/docs/architecture/adr-031-msg-service.md @@ -77,7 +77,7 @@ message MsgSubmitProposalResponse { ``` While this is most commonly used for gRPC, overloading protobuf `service` definitions like this does not violate -the intent of the [protobuf spec](https://developers.google.com/protocol-buffers/docs/proto3#services) which says: +the intent of the [protobuf spec](https://protobuf.dev/programming-guides/proto3/#services) which says: > If you don’t want to use gRPC, it’s also possible to use protocol buffers with your own RPC implementation. With this approach, we would get an auto-generated `MsgServer` interface: @@ -175,7 +175,7 @@ Separate handler definition is no longer needed with this approach. ## Consequences -This design changes how a module functionality is exposed and accessed. It deprecates the existing `Handler` interface and `AppModule.Route` in favor of [Protocol Buffer Services](https://developers.google.com/protocol-buffers/docs/proto3#services) and Service Routing described above. This dramatically simplifies the code. We don't need to create handlers and keepers any more. Use of Protocol Buffer auto-generated clients clearly separates the communication interfaces between the module and a modules user. The control logic (aka handlers and keepers) is not exposed any more. A module interface can be seen as a black box accessible through a client API. It's worth to note that the client interfaces are also generated by Protocol Buffers. +This design changes how a module functionality is exposed and accessed. It deprecates the existing `Handler` interface and `AppModule.Route` in favor of [Protocol Buffer Services](https://protobuf.dev/programming-guides/proto3/#services) and Service Routing described above. This dramatically simplifies the code. We don't need to create handlers and keepers any more. Use of Protocol Buffer auto-generated clients clearly separates the communication interfaces between the module and a modules user. The control logic (aka handlers and keepers) is not exposed any more. A module interface can be seen as a black box accessible through a client API. It's worth to note that the client interfaces are also generated by Protocol Buffers. This also allows us to change how we perform functional tests. Instead of mocking AppModules and Router, we will mock a client (server will stay hidden). More specifically: we will never mock `moduleA.MsgServer` in `moduleB`, but rather `moduleA.MsgClient`. One can think about it as working with external services (eg DBs, or online servers...). We assume that the transmission between clients and servers is correctly handled by generated Protocol Buffers. @@ -196,6 +196,6 @@ Finally, closing a module to client API opens desirable OCAP patterns discussed ## References * [Initial Github Issue \#7122](https://github.com/cosmos/cosmos-sdk/issues/7122) -* [proto 3 Language Guide: Defining Services](https://developers.google.com/protocol-buffers/docs/proto3#services) +* [proto 3 Language Guide: Defining Services](https://protobuf.dev/programming-guides/proto3/#services) * [ADR 020](./adr-020-protobuf-transaction-encoding.md) * [ADR 021](./adr-021-protobuf-query-encoding.md) diff --git a/docs/architecture/adr-044-protobuf-updates-guidelines.md b/docs/architecture/adr-044-protobuf-updates-guidelines.md index c2d41a1a37e0..93e28d2d1731 100644 --- a/docs/architecture/adr-044-protobuf-updates-guidelines.md +++ b/docs/architecture/adr-044-protobuf-updates-guidelines.md @@ -73,7 +73,7 @@ and the following ones are NOT valid: #### 2. Fields MAY be marked as `deprecated`, and nodes MAY implement a protocol-breaking change for handling these fields -Protobuf supports the [`deprecated` field option](https://developers.google.com/protocol-buffers/docs/proto#options), and this option MAY be used on any field, including `Msg` fields. If a node handles a Protobuf message with a non-empty deprecated field, the node MAY change its behavior upon processing it, even in a protocol-breaking way. When possible, the node MUST handle backwards compatibility without breaking the consensus (unless we increment the proto version). +Protobuf supports the [`deprecated` field option](https://protobuf.dev/programming-guides/proto2/), and this option MAY be used on any field, including `Msg` fields. If a node handles a Protobuf message with a non-empty deprecated field, the node MAY change its behavior upon processing it, even in a protocol-breaking way. When possible, the node MUST handle backwards compatibility without breaking the consensus (unless we increment the proto version). As an example, the Cosmos SDK v0.42 to v0.43 update contained two Protobuf-breaking changes, listed below. Instead of bumping the package versions from `v1beta1` to `v1`, the SDK team decided to follow this guideline, by reverting the breaking changes, marking those changes as deprecated, and modifying the node implementation when processing messages with deprecated fields. More specifically: diff --git a/docs/architecture/adr-054-semver-compatible-modules.md b/docs/architecture/adr-054-semver-compatible-modules.md index 5dc0a666f69b..40dd60810633 100644 --- a/docs/architecture/adr-054-semver-compatible-modules.md +++ b/docs/architecture/adr-054-semver-compatible-modules.md @@ -37,7 +37,7 @@ In order to achieve this, we need to solve the following problems: 2. circular dependencies between modules need to be broken to actually release many modules in the SDK independently 3. pernicious minor version incompatibilities introduced through correctly - [evolving protobuf schemas](https://developers.google.com/protocol-buffers/docs/proto3#updating) + [evolving protobuf schemas](https://protobuf.dev/programming-guides/proto3/#updating) without correct [unknown field filtering](./adr-020-protobuf-transaction-encoding.md#unknown-field-filtering) Note that all the following discussion assumes that the proto file versioning and state machine versioning of a module @@ -320,7 +320,7 @@ generate its own version of `MsgDoSomething` as `bar/internal/foo/v1.MsgDoSometh inter-module router which would somehow convert it to the version which foo needs (ex. `foo/internal.MsgDoSomething`). Currently, two generated structs for the same protobuf type cannot exist in the same go binary without special -build flags (see https://developers.google.com/protocol-buffers/docs/reference/go/faq#fix-namespace-conflict). +build flags (see https://protobuf.dev/reference/go/faq/#fix-namespace-conflict). A relatively simple mitigation to this issue would be to set up the protobuf code to not register protobuf types globally if they are generated in an `internal/` package. This will require modules to register their types manually with the app-level level protobuf registry, this is similar to what modules already do with the `InterfaceRegistry` diff --git a/docs/build/building-modules/02-messages-and-queries.md b/docs/build/building-modules/02-messages-and-queries.md index 4dfeae41e4c6..5ec1c7a707e9 100644 --- a/docs/build/building-modules/02-messages-and-queries.md +++ b/docs/build/building-modules/02-messages-and-queries.md @@ -97,7 +97,7 @@ A `query` is a request for information made by end-users of applications through ### gRPC Queries -Queries should be defined using [Protobuf services](https://developers.google.com/protocol-buffers/docs/proto#services). A `Query` service should be created per module in `query.proto`. This service lists endpoints starting with `rpc`. +Queries should be defined using [Protobuf services](https://protobuf.dev/programming-guides/proto2/). A `Query` service should be created per module in `query.proto`. This service lists endpoints starting with `rpc`. Here's an example of such a `Query` service definition: diff --git a/docs/build/building-modules/15-depinject.md b/docs/build/building-modules/15-depinject.md index e9a5f4486eb9..c07c9aa96d20 100644 --- a/docs/build/building-modules/15-depinject.md +++ b/docs/build/building-modules/15-depinject.md @@ -52,7 +52,7 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/api/cosmos/group/modul ``` :::note -Pulsar is optional. The official [`protoc-gen-go`](https://developers.google.com/protocol-buffers/docs/reference/go-generated) can be used as well. +Pulsar is optional. The official [`protoc-gen-go`](https://protobuf.dev/reference/go/go-generated/) can be used as well. ::: ## Dependency Definition diff --git a/docs/learn/advanced/05-encoding.md b/docs/learn/advanced/05-encoding.md index 07fca0e6bb01..13703f892ecb 100644 --- a/docs/learn/advanced/05-encoding.md +++ b/docs/learn/advanced/05-encoding.md @@ -17,9 +17,9 @@ While encoding in the Cosmos SDK used to be mainly handled by `go-amino` codec, ## Encoding The Cosmos SDK supports two wire encoding protocols. Binary encoding is fulfilled by [Protocol -Buffers](https://developers.google.com/protocol-buffers), specifically the +Buffers](https://protobuf.dev/), specifically the [gogoprotobuf](https://github.com/cosmos/gogoproto/) implementation, which is a subset of -[Proto3](https://developers.google.com/protocol-buffers/docs/proto3) with an extension for +[Proto3](https://protobuf.dev/programming-guides/proto3/) with an extension for interface support. Text encoding is fulfilled by [Amino](https://github.com/tendermint/go-amino). Due to Amino having significant performance drawbacks, being reflection-based, and not having @@ -52,7 +52,7 @@ Modules are encouraged to utilize Protobuf encoding for their respective types. ### Guidelines for protobuf message definitions -In addition to [following official Protocol Buffer guidelines](https://developers.google.com/protocol-buffers/docs/proto3#simple), we recommend using these annotations in .proto files when dealing with interfaces: +In addition to [following official Protocol Buffer guidelines](https://protobuf.dev/programming-guides/proto3/#simple), we recommend using these annotations in .proto files when dealing with interfaces: * use `cosmos_proto.accepts_interface` to annotate `Any` fields that accept interfaces * pass the same fully qualified name as `protoName` to `InterfaceRegistry.RegisterInterface` @@ -240,5 +240,5 @@ Protobuf types can be defined to encode: #### Naming and conventions -We encourage developers to follow industry guidelines: [Protocol Buffers style guide](https://developers.google.com/protocol-buffers/docs/style) +We encourage developers to follow industry guidelines: [Protocol Buffers style guide](https://protobuf.dev/programming-guides/style/) and [Buf](https://buf.build/docs/style-guide), see more details in [ADR 023](../../architecture/adr-023-protobuf-naming.md) diff --git a/docs/learn/beginner/00-app-anatomy.md b/docs/learn/beginner/00-app-anatomy.md index 1e94ae52c3de..deae83034982 100644 --- a/docs/learn/beginner/00-app-anatomy.md +++ b/docs/learn/beginner/00-app-anatomy.md @@ -181,7 +181,7 @@ Modules must implement [interfaces](../../build/building-modules/01-module-manag ### `Msg` Services -Each application module defines two [Protobuf services](https://developers.google.com/protocol-buffers/docs/proto#services): one `Msg` service to handle messages, and one gRPC `Query` service to handle queries. If we consider the module as a state-machine, then a `Msg` service is a set of state transition RPC methods. +Each application module defines two [Protobuf services](https://protobuf.dev/programming-guides/proto2/): one `Msg` service to handle messages, and one gRPC `Query` service to handle queries. If we consider the module as a state-machine, then a `Msg` service is a set of state transition RPC methods. Each Protobuf `Msg` service method is 1:1 related to a Protobuf request type, which must implement `sdk.Msg` interface. Note that `sdk.Msg`s are bundled in [transactions](../advanced/01-transactions.md), and each transaction contains one or multiple messages. @@ -208,7 +208,7 @@ Each module should also implement the `RegisterServices` method as part of the [ gRPC `Query` services allow users to query the state using [gRPC](https://grpc.io). They are enabled by default, and can be configured under the `grpc.enable` and `grpc.address` fields inside [`app.toml`](../../user/run-node/01-run-node.md#configuring-the-node-using-apptoml-and-configtoml). -gRPC `Query` services are defined in the module's Protobuf definition files, specifically inside `query.proto`. The `query.proto` definition file exposes a single `Query` [Protobuf service](https://developers.google.com/protocol-buffers/docs/proto#services). Each gRPC query endpoint corresponds to a service method, starting with the `rpc` keyword, inside the `Query` service. +gRPC `Query` services are defined in the module's Protobuf definition files, specifically inside `query.proto`. The `query.proto` definition file exposes a single `Query` [Protobuf service](https://protobuf.dev/programming-guides/proto2/). Each gRPC query endpoint corresponds to a service method, starting with the `rpc` keyword, inside the `Query` service. Protobuf generates a `QueryServer` interface for each module, containing all the service methods. A module's [`keeper`](#keeper) then needs to implement this `QueryServer` interface, by providing the concrete implementation of each service method. This concrete implementation is the handler of the corresponding gRPC query endpoint. diff --git a/docs/learn/beginner/02-query-lifecycle.md b/docs/learn/beginner/02-query-lifecycle.md index 2c3600f7fe30..bdaa51766993 100644 --- a/docs/learn/beginner/02-query-lifecycle.md +++ b/docs/learn/beginner/02-query-lifecycle.md @@ -41,7 +41,7 @@ The CLI understands a specific set of commands, defined in a hierarchical struct ### gRPC -Another interface through which users can make queries is [gRPC](https://grpc.io) requests to a [gRPC server](../advanced/06-grpc_rest.md#grpc-server). The endpoints are defined as [Protocol Buffers](https://developers.google.com/protocol-buffers) service methods inside `.proto` files, written in Protobuf's own language-agnostic interface definition language (IDL). The Protobuf ecosystem developed tools for code-generation from `*.proto` files into various languages. These tools allow to build gRPC clients easily. +Another interface through which users can make queries is [gRPC](https://grpc.io) requests to a [gRPC server](../advanced/06-grpc_rest.md#grpc-server). The endpoints are defined as [Protocol Buffers](https://protobuf.dev/) service methods inside `.proto` files, written in Protobuf's own language-agnostic interface definition language (IDL). The Protobuf ecosystem developed tools for code-generation from `*.proto` files into various languages. These tools allow to build gRPC clients easily. One such tool is [grpcurl](https://github.com/fullstorydev/grpcurl), and a gRPC request for `MyQuery` using this client looks like: From 3220aab2bd659a2334f5cc010e8ae8c863a7387e Mon Sep 17 00:00:00 2001 From: son trinh Date: Wed, 9 Oct 2024 14:29:03 +0700 Subject: [PATCH 07/57] docs(x/accounts/defaults/lockup): Add tutorial document (#22168) Co-authored-by: Marko Co-authored-by: Julien Robert Co-authored-by: beep --- x/accounts/defaults/lockup/TUTORIAL.md | 243 +++++++++++++++++++++++++ 1 file changed, 243 insertions(+) create mode 100644 x/accounts/defaults/lockup/TUTORIAL.md diff --git a/x/accounts/defaults/lockup/TUTORIAL.md b/x/accounts/defaults/lockup/TUTORIAL.md new file mode 100644 index 000000000000..1a308cbcea7c --- /dev/null +++ b/x/accounts/defaults/lockup/TUTORIAL.md @@ -0,0 +1,243 @@ +# Using lockup account on Cosmos sdk + +* [Setup](#setup) +* [Init](#init) +* [Execution](#execution) + * [Delegate](#delegate) + * [Undelegate](#undelegate) + * [Withdraw reward](#withdraw-reward) + * [Withdraw unlocked token](#withdraw-unlocked-token) + * [Send coins](#send-coins) +* [Query](#query) + * [Query account info](#query-account-info) + * [Query periodic lockup account locking periods](#query-periodic-lockup-account-locking-periods) + +To learn more about lockup account, please also check out [readme](./README.md) + +## Setup + +To create a lockup account we need 2 wallets (newly created or use any of the existing wallet that you have) one for the creator and one for the owner of the lockup account. + +```bash +simd keys add creator +simd keys add owner +``` + +## Init + +Normally the creator must have enough token to grant to the lockup account during the lockup account init process. The owner wallet should be associated with the individual that the creator want to grant the fund to. + +Now, the creator can craft the lockup account init messages. This message depend on what type of lockup account the creator want to create. +For continous, delayed, permanent locking account: + +```json +{ + "owner": "cosmos1vaqh39cdex9sgr69ef0tdln5cn0hdyd3s0lx45", + "end_time": 1495793860 + "start_time": 1465793854 +} +``` + +:::info +`start_time` is only needed for continous locking account init process. For the other two, you dont have to set it in. Error will returned if `start_time` is not provided when creating continous locking account* +::: + +For periodic locking account: + +```json + { + "owner": "cosmos1vaqh39cdex9sgr69ef0tdln5cn0hdyd3s0lx45", + "locking_periods": [ + { + "length": 84600 + "amount": { + "denom": "stake", + "amount": 2000 + } + }, + { + "length": 84600 + "amount": { + "denom": "stake", + "amount": 1500 + } + } + ] + "start_time": 1465793854 + } +``` + +Periodic locking account locking duration is the combines of all the period length from `locking_periods`. + +The `owner` field takes a string while `start_time` and `end_time` takes a timestamp as value. `locking_periods` are an array of `period`s which consist of 2 field: `length` for the duration of that period and the `amount` that will be release after such duration. + +To initialize the account, we have to run the accounts init command passing the account type and the json string for the init message. + +```bash +initcontents=$(cat init.json) +simd tx accounts init $initcontents --from creator +``` + +Whereas the available `lockup_type` options are: + +* continuous-locking-account + +* delayed-locking-account + +* periodic-locking-account + +* permanent-locking-account + +If success, we'll check the tx result for the lockup account address. You can send token to it like a normal account. + +## Execution + +To execute a message, we can use the command below: + +```bash +msgcontents=$(cat msg.json) +simd tx accounts execute $msgcontents --from owner +``` + +Whereas `execute-msg-type-url` and `msgcontents` corresponds to lockup account available executions, which are: + +### Delegate + +The execute message type url for this execution is `cosmos.accounts.defaults.lockup.MsgDelegate`. + +Example of json file: + +```json +{ + "sender": "cosmos1vaqh39cdex9sgr69ef0tdln5cn0hdyd3s0lx45", + "validator_address": "cosmosvaloper1vaqh39cdex9sgr69ef0tdln5cn0hdyd3s0lx45", + "amount": { + "amount": 100 + "denom": "stake" + } +} +``` + +:::warning +The `sender` field are the address of the owner of the lockup account. If the sender is not the owner an error will be returned. +::: + +### Undelegate + +The execute message type url for this execution is `cosmos.accounts.defaults.lockup.MsgUndelegate`. + +Example of json file: + +```json +{ + "sender": "cosmos1vaqh39cdex9sgr69ef0tdln5cn0hdyd3s0lx45", + "validator_address": "cosmosvaloper1vaqh39cdex9sgr69ef0tdln5cn0hdyd3s0lx45", + "amount": { + "amount": 100 + "denom": "stake" + } +} +``` + +:::warning +The `sender` field are the address of the owner of the lockup account. If the sender is not the owner an error will be returned. +::: + +### Withdraw reward + +The execute message type url for this execution is `cosmos.accounts.defaults.lockup.MsgWithdrawReward`. + +Example of json file: + +```json +{ + "sender": "cosmos1vaqh39cdex9sgr69ef0tdln5cn0hdyd3s0lx45", + "validator_address": "cosmosvaloper1vaqh39cdex9sgr69ef0tdln5cn0hdyd3s0lx45", +} +``` + +:::warning +The `sender` field are the address of the owner of the lockup account. If the sender is not the owner an error will be returned. +::: + +### Withdraw unlocked token + +The execute message type url for this execution is `cosmos.accounts.defaults.lockup.MsgWithdraw`. + +Example of json file: + +```json +{ + // lockup account owner address + "withdrawer": "cosmos1vaqh39cdex9sgr69ef0tdln5cn0hdyd3s0lx46", + // withdraw to an account of choice + "to_address": "cosmos1vaqh39cdex9sgr69ef0tdln5cn0hdyd3s0lx47", + "denoms": ["stake"] +} +``` + +:::warning +The `withdrawer` field are the address of the owner of the lockup account. If the sender is not the owner an error will be returned. +::: + +### Send coins + +The execute message type url for this execution is `cosmos.accounts.defaults.lockup.MsgSend`. + +Example of json file: + +```json +{ + "sender": "cosmos1vaqh39cdex9sgr69ef0tdln5cn0hdyd3s0lx45", + "to_address": "cosmos1vaqh39cdex9sgr69ef0tdln5cn0hdyd3s0lx46", + "amount": { + "amount": 100 + "denom": "stake" + } +} +``` + +:::warning +The `sender` field are the address of the owner of the lockup account. If the sender is not the owner an error will be returned. +::: + +## Query + +To query a lockup account state, we can use the command below: + +```bash +querycontents=$(cat query.json) +simd tx accounts query $querycontents --from owner +``` + +### Query account info + +The query request type url for this query is `cosmos.accounts.defaults.lockup.QueryLockupAccountInfoRequest`. And query json file can be an empty object since `QueryLockupAccountInfoRequest` does not required an input. + +Account informations including: + +* original locked amount + +* delegated amount that are locked + +* delegated amount that are free + +* start and end time + +* owner address + +* current locked and unlocked amount + +### Query periodic lockup account locking periods + +:::info +Note, can only be queried from a periodic lockup account +::: + +The query request type url for this query is `cosmos.accounts.defaults.lockup.QueryLockingPeriodsRequest`. And query json file can be an empty object since `QueryLockingPeriodsRequest` does not required an input. + +Locking periods including: + +* List of period with its duration and amount + + From 91c0e79f479d92c136ca21b77192358e40a7b74e Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Wed, 9 Oct 2024 17:21:22 +0200 Subject: [PATCH 08/57] ci: push docker image on betas (#22189) --- .github/workflows/docker.yml | 5 +++-- Dockerfile | 1 - contrib/images/simd-env/Dockerfile | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index f6493a9c8d7d..a22b16c54bdf 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -9,8 +9,9 @@ on: branches: - main tags: - - "v[0-9]+.[0-9]+.[0-9]+" # Push events to matching v*, i.e. v1.0, v20.15.10 - - "v[0-9]+.[0-9]+.[0-9]+-rc*" # Push events to matching v*, i.e. v1.0-rc1, v20.15.10-rc5 + - "v[0-9]+.[0-9]+.[0-9]+" # Push events to matching v*, i.e. v1.0.0, v20.15.10 + - "v[0-9]+.[0-9]+.[0-9]+-rc.*" # Push events to matching v*, i.e. v1.0.0-rc.1, v20.15.10-rc.5 + - "v[0-9]+.[0-9]+.[0-9]+-beta.*" # Push events to matching v*, i.e. v1.0.0-beta.1, v20.15.10-beta.5 workflow_dispatch: inputs: tags: diff --git a/Dockerfile b/Dockerfile index 9c563258c48d..9998f34c02b4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -35,7 +35,6 @@ COPY x/gov/go.mod x/gov/go.sum ./x/gov/ COPY x/distribution/go.mod x/distribution/go.sum ./x/distribution/ COPY x/slashing/go.mod x/slashing/go.sum ./x/slashing/ COPY x/staking/go.mod x/staking/go.sum ./x/staking/ -COPY x/auth/go.mod x/auth/go.sum ./x/auth/ COPY x/authz/go.mod x/authz/go.sum ./x/authz/ COPY x/bank/go.mod x/bank/go.sum ./x/bank/ COPY x/mint/go.mod x/mint/go.sum ./x/mint/ diff --git a/contrib/images/simd-env/Dockerfile b/contrib/images/simd-env/Dockerfile index 8ff6675b0379..9839c032e3b2 100644 --- a/contrib/images/simd-env/Dockerfile +++ b/contrib/images/simd-env/Dockerfile @@ -17,7 +17,6 @@ COPY x/gov/go.mod x/gov/go.sum /work/x/gov/ COPY x/distribution/go.mod x/distribution/go.sum /work/x/distribution/ COPY x/slashing/go.mod x/slashing/go.sum /work/x/slashing/ COPY x/staking/go.mod x/staking/go.sum /work/x/staking/ -COPY x/auth/go.mod x/auth/go.sum /work/x/auth/ COPY x/authz/go.mod x/authz/go.sum /work/x/authz/ COPY x/bank/go.mod x/bank/go.sum /work/x/bank/ COPY x/mint/go.mod x/mint/go.sum /work/x/mint/ From 597e0fac1173d0c8142af5fdabf9657a2b2ca811 Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Wed, 9 Oct 2024 22:43:31 +0700 Subject: [PATCH 09/57] test(systemtest): Fix `prune` & `gov` test (#22190) --- tests/systemtests/genesis_io.go | 9 +++++++++ tests/systemtests/gov_test.go | 7 +++++++ tests/systemtests/snapshots_test.go | 2 +- tests/systemtests/system.go | 10 ---------- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/tests/systemtests/genesis_io.go b/tests/systemtests/genesis_io.go index df2081ba0924..f3a61e54a2dd 100644 --- a/tests/systemtests/genesis_io.go +++ b/tests/systemtests/genesis_io.go @@ -33,6 +33,15 @@ func SetGovVotingPeriod(t *testing.T, period time.Duration) GenesisMutator { } } +func SetGovExpeditedVotingPeriod(t *testing.T, period time.Duration) GenesisMutator { + t.Helper() + return func(genesis []byte) []byte { + state, err := sjson.SetRawBytes(genesis, "app_state.gov.params.expedited_voting_period", []byte(fmt.Sprintf("%q", period.String()))) + require.NoError(t, err) + return state + } +} + // GetGenesisBalance return the balance amount for an address from the given genesis json func GetGenesisBalance(rawGenesis []byte, addr string) sdk.Coins { var r []sdk.Coin diff --git a/tests/systemtests/gov_test.go b/tests/systemtests/gov_test.go index 092773dc2053..b3270275b454 100644 --- a/tests/systemtests/gov_test.go +++ b/tests/systemtests/gov_test.go @@ -375,6 +375,13 @@ func TestQueryDeposit(t *testing.T) { sut.ResetChain(t) cli := NewCLIWrapper(t, sut, verbose) + // short voting period + // update expedited voting period to avoid validation error + sut.ModifyGenesisJSON( + t, + SetGovVotingPeriod(t, time.Second*8), + SetGovExpeditedVotingPeriod(t, time.Second*7), + ) // get validator address valAddr := gjson.Get(cli.Keys("keys", "list"), "0.address").String() diff --git a/tests/systemtests/snapshots_test.go b/tests/systemtests/snapshots_test.go index d80eb530f413..c4d6b257fc93 100644 --- a/tests/systemtests/snapshots_test.go +++ b/tests/systemtests/snapshots_test.go @@ -89,7 +89,7 @@ func TestPrune(t *testing.T) { // prune var command []string if isV2() { - command = []string{"store", "prune", "--keep-recent=1"} + command = []string{"store", "prune", "--store.keep-recent=1"} } else { command = []string{"prune", "everything"} } diff --git a/tests/systemtests/system.go b/tests/systemtests/system.go index f42bf96a79cd..adaa6da91d77 100644 --- a/tests/systemtests/system.go +++ b/tests/systemtests/system.go @@ -134,16 +134,6 @@ func (s *SystemUnderTest) SetupChain() { if err != nil { panic(fmt.Sprintf("failed to set block max gas: %s", err)) } - // Short period for gov - genesisBz, err = sjson.SetRawBytes(genesisBz, "app_state.gov.params.voting_period", []byte(fmt.Sprintf(`"%s"`, "8s"))) - if err != nil { - panic(fmt.Sprintf("failed to set regular voting period: %s", err)) - } - // update expedited voting period to avoid validation error - genesisBz, err = sjson.SetRawBytes(genesisBz, "app_state.gov.params.expedited_voting_period", []byte(fmt.Sprintf(`"%s"`, "7s"))) - if err != nil { - panic(fmt.Sprintf("failed to set expedited voting period: %s", err)) - } s.withEachNodeHome(func(i int, home string) { if err := saveGenesis(home, genesisBz); err != nil { panic(err) From fae85e0ec41016a027321715f30525d630479f75 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Wed, 9 Oct 2024 18:56:09 +0200 Subject: [PATCH 10/57] docs: fix pre.sh (#22194) --- docs/post.sh | 1 - docs/pre.sh | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/post.sh b/docs/post.sh index f6e465409af7..9dbcb119ed1f 100755 --- a/docs/post.sh +++ b/docs/post.sh @@ -7,7 +7,6 @@ rm -rf build/tooling/03-hubl.md rm -rf build/packages/01-depinject.md rm -rf build/packages/02-collections.md rm -rf build/packages/03-orm.md -rm -rf learn/advaced-concepts/17-autocli.md rm -rf build/architecture rm -rf build/spec rm -rf build/rfc diff --git a/docs/pre.sh b/docs/pre.sh index 0be94c2bf8ee..622c3cd6d363 100755 --- a/docs/pre.sh +++ b/docs/pre.sh @@ -7,7 +7,7 @@ for D in ../x/*; do # Skip specific directories if [[ "$DIR_NAME" != "counter" ]]; then - MODULE_DIRECTORY=docs/build/modules/$DIR_NAME + MODULE_DIRECTORY=build/modules/$DIR_NAME rm -rf "$MODULE_DIRECTORY" mkdir -p "$MODULE_DIRECTORY" if [ -f "$D"/README.md ]; then From fc9ca8ea2021867480a69db66398638dd0e947c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juli=C3=A1n=20Toledano?= Date: Wed, 9 Oct 2024 21:18:36 +0200 Subject: [PATCH 11/57] docs: update learn/beginner docs (#22191) --- docs/learn/beginner/00-app-anatomy.md | 30 +++++------ docs/learn/beginner/01-tx-lifecycle.md | 14 ++--- docs/learn/beginner/02-query-lifecycle.md | 18 ++++--- docs/learn/beginner/03-accounts.md | 66 +++++++++++------------ docs/learn/beginner/04-gas-fees.md | 12 ++--- 5 files changed, 71 insertions(+), 69 deletions(-) diff --git a/docs/learn/beginner/00-app-anatomy.md b/docs/learn/beginner/00-app-anatomy.md index deae83034982..edd8611c3e46 100644 --- a/docs/learn/beginner/00-app-anatomy.md +++ b/docs/learn/beginner/00-app-anatomy.md @@ -59,17 +59,17 @@ In general, the core of the state-machine is defined in a file called `app.go`. The first thing defined in `app.go` is the `type` of the application. It is generally comprised of the following parts: -* **A reference to [`baseapp`](../advanced/00-baseapp.md).** The custom application defined in `app.go` is an extension of `baseapp`. When a transaction is relayed by CometBFT to the application, `app` uses `baseapp`'s methods to route them to the appropriate module. `baseapp` implements most of the core logic for the application, including all the [ABCI methods](https://docs.cometbft.com/v1.0/spec/abci/) and the [routing logic](../advanced/00-baseapp.md#routing). +* **A reference to [`baseapp`](../advanced/00-baseapp.md).** The custom application defined in `app.go` is an extension of `baseapp`. When a transaction is relayed by CometBFT to the application, `app` uses `baseapp`'s methods to route them to the appropriate module. `baseapp` implements most of the core logic for the application, including all the [ABCI methods](https://docs.cometbft.com/v1.0/spec/abci/) and the [routing logic](../advanced/00-baseapp.md#service-routers). * **A list of store keys**. The [store](../advanced/04-store.md), which contains the entire state, is implemented as a [`multistore`](../advanced/04-store.md#multistore) (i.e. a store of stores) in the Cosmos SDK. Each module uses one or multiple stores in the multistore to persist their part of the state. These stores can be accessed with specific keys that are declared in the `app` type. These keys, along with the `keepers`, are at the heart of the [object-capabilities model](../advanced/10-ocap.md) of the Cosmos SDK. * **A list of module's `keeper`s.** Each module defines an abstraction called [`keeper`](../../build/building-modules/06-keeper.md), which handles reads and writes for this module's store(s). The `keeper`'s methods of one module can be called from other modules (if authorized), which is why they are declared in the application's type and exported as interfaces to other modules so that the latter can only access the authorized functions. * **A reference to an [`appCodec`](../advanced/05-encoding.md).** The application's `appCodec` is used to serialize and deserialize data structures in order to store them, as stores can only persist `[]bytes`. The default codec is [Protocol Buffers](../advanced/05-encoding.md). * **A reference to a [`legacyAmino`](../advanced/05-encoding.md) codec.** Some parts of the Cosmos SDK have not been migrated to use the `appCodec` above, and are still hardcoded to use Amino. Other parts explicitly use Amino for backwards compatibility. For these reasons, the application still holds a reference to the legacy Amino codec. Please note that the Amino codec will be removed from the SDK in the upcoming releases. -* **A reference to a [module manager](../../build/building-modules/01-module-manager.md#manager)**. The module manager is an object that contains a list of the application's modules. It facilitates operations related to these modules, like registering their [`Msg` service](../advanced/00-baseapp.md#msg-services) and [gRPC `Query` service](../advanced/00-baseapp.md#grpc-query-services), or setting the order of execution between modules for various functions like [`InitChainer`](#initchainer), [`PreBlocker`](#preblocker) and [`BeginBlocker` and `EndBlocker`](#beginblocker-and-endblocker). +* **A reference to a [module manager](../../build/building-modules/01-module-manager.md#manager)**. The module manager is an object that contains a list of the application's modules. It facilitates operations related to these modules, like registering their [`Msg` service](../../build/building-modules/03-msg-services.md) and [gRPC `Query` service](#grpc-query-services), or setting the order of execution between modules for various functions like [`InitChainer`](#initchainer), [`PreBlocker`](#preblocker) and [`BeginBlocker` and `EndBlocker`](#beginblocker-and-endblocker). See an example of application type definition from `simapp`, the Cosmos SDK's own app used for demo and testing purposes: ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/simapp/app.go#L173-L212 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.1/simapp/app.go#L145-L186 ``` ### Constructor Function @@ -77,7 +77,7 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/simapp/app.go#L173-L21 Also defined in `app.go` is the constructor function, which constructs a new application of the type defined in the preceding section. The function must fulfill the `AppCreator` signature in order to be used in the [`start` command](../advanced/03-node.md#start-command) of the application's daemon command. ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/server/types/app.go#L66-L68 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.1/server/types/app.go#L66-L68 ``` Here are the main actions performed by this function: @@ -86,7 +86,7 @@ Here are the main actions performed by this function: * Instantiate a new application with a reference to a `baseapp` instance, a codec, and all the appropriate store keys. * Instantiate all the [`keeper`](#keeper) objects defined in the application's `type` using the `NewKeeper` function of each of the application's modules. Note that keepers must be instantiated in the correct order, as the `NewKeeper` of one module might require a reference to another module's `keeper`. * Instantiate the application's [module manager](../../build/building-modules/01-module-manager.md#manager) with the [`AppModule`](#application-module-interface) object of each of the application's modules. -* With the module manager, initialize the application's [`Msg` services](../advanced/00-baseapp.md#msg-services), [gRPC `Query` services](../advanced/00-baseapp.md#grpc-query-services), [legacy `Msg` routes](../advanced/00-baseapp.md#routing), and [legacy query routes](../advanced/00-baseapp.md#query-routing). When a transaction is relayed to the application by CometBFT via the ABCI, it is routed to the appropriate module's [`Msg` service](#msg-services) using the routes defined here. Likewise, when a gRPC query request is received by the application, it is routed to the appropriate module's [`gRPC query service`](#grpc-query-services) using the gRPC routes defined here. The Cosmos SDK still supports legacy `Msg`s and legacy CometBFT queries, which are routed using the legacy `Msg` routes and the legacy query routes, respectively. +* With the module manager, initialize the application's [`Msg` services](../../build/building-modules/03-msg-services.md), [gRPC `Query` services](#grpc-query-services), [legacy `Msg` routes](../advanced/00-baseapp.md#routing), and [legacy query routes](../advanced/00-baseapp.md#query-routing). When a transaction is relayed to the application by CometBFT via the ABCI, it is routed to the appropriate module's [`Msg` service](#msg-services) using the routes defined here. Likewise, when a gRPC query request is received by the application, it is routed to the appropriate module's [`gRPC query service`](#grpc-query-services) using the gRPC routes defined here. The Cosmos SDK still supports legacy `Msg`s and legacy CometBFT queries, which are routed using the legacy `Msg` routes and the legacy query routes, respectively. * With the module manager, set the order of execution between the `InitGenesis`, `PreBlocker`, `BeginBlocker`, and `EndBlocker` functions of each of the [application's modules](#application-module-interface). Note that not all modules implement these functions. * Set the remaining application parameters: * [`InitChainer`](#initchainer): used to initialize the application when it is first started. @@ -101,19 +101,19 @@ Note that the constructor function only creates an instance of the app, while th See an example of application constructor from `simapp`: ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/simapp/app.go#L223-L575 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/simapp/app.go#L199-L643 ``` ### InitChainer -The `InitChainer` is a function that initializes the state of the application from a genesis file (i.e. token balances of genesis accounts). It is called when the application receives the `InitChain` message from the CometBFT engine, which happens when the node is started at `appBlockHeight == 0` (i.e. on genesis). The application must set the `InitChainer` in its [constructor](#constructor-function) via the [`SetInitChainer`](https://pkg.go.dev/github.com/cosmos/cosmos-sdk/baseapp#BaseApp.SetInitChainer) method. +The `InitChainer` is a function that initializes the state of the application from a genesis file (i.e. token balances of genesis accounts). It is called when the application receives the `InitChain` message from the CometBFT engine, which happens when the node is started at `appBlockHeight == 0` (i.e. on genesis). The application must set the `InitChainer` in its [constructor](#constructor-function) via the [`SetInitChainer`](https://pkg.go.dev/github.com/cosmos/cosmos-sdk@v0.52.0-beta.1/baseapp#BaseApp.SetInitChainer) method. In general, the `InitChainer` is mostly composed of the [`InitGenesis`](../../build/building-modules/08-genesis.md#initgenesis) function of each of the application's modules. This is done by calling the `InitGenesis` function of the module manager, which in turn calls the `InitGenesis` function of each of the modules it contains. Note that the order in which the modules' `InitGenesis` functions must be called has to be set in the module manager using the [module manager's](../../build/building-modules/01-module-manager.md) `SetOrderInitGenesis` method. This is done in the [application's constructor](#constructor-function), and the `SetOrderInitGenesis` has to be called before the `SetInitChainer`. See an example of an `InitChainer` from `simapp`: ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/simapp/app.go#L626-L634 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/simapp/app.go#L714-L726 ``` ### PreBlocker @@ -133,7 +133,7 @@ The new ctx must be passed to all the other lifecycle methods. ### BeginBlocker and EndBlocker -The Cosmos SDK offers developers the possibility to implement automatic execution of code as part of their application. This is implemented through two functions called `BeginBlocker` and `EndBlocker`. They are called when the application receives the `FinalizeBlock` messages from the CometBFT consensus engine, which happens respectively at the beginning and at the end of each block. The application must set the `BeginBlocker` and `EndBlocker` in its [constructor](#constructor-function) via the [`SetBeginBlocker`](https://pkg.go.dev/github.com/cosmos/cosmos-sdk/baseapp#BaseApp.SetBeginBlocker) and [`SetEndBlocker`](https://pkg.go.dev/github.com/cosmos/cosmos-sdk/baseapp#BaseApp.SetEndBlocker) methods. +The Cosmos SDK offers developers the possibility to implement automatic execution of code as part of their application. This is implemented through two functions called `BeginBlocker` and `EndBlocker`. They are called when the application receives the `FinalizeBlock` messages from the CometBFT consensus engine, which happens respectively at the beginning and at the end of each block. The application must set the `BeginBlocker` and `EndBlocker` in its [constructor](#constructor-function) via the [`SetBeginBlocker`](https://pkg.go.dev/github.com/cosmos/cosmos-sdk@v0.52.0-beta.1/baseapp#BaseApp.SetBeginBlocker) and [`SetEndBlocker`](https://pkg.go.dev/github.com/cosmos/cosmos-sdk@v0.52.0-beta.1/baseapp#BaseApp.SetEndBlocker) methods. In general, the `BeginBlocker` and `EndBlocker` functions are mostly composed of the [`BeginBlock` and `EndBlock`](../../build/building-modules/06-preblock-beginblock-endblock.md) functions of each of the application's modules. This is done by calling the `BeginBlock` and `EndBlock` functions of the module manager, which in turn calls the `BeginBlock` and `EndBlock` functions of each of the modules it contains. Note that the order in which the modules' `BeginBlock` and `EndBlock` functions must be called has to be set in the module manager using the `SetOrderBeginBlockers` and `SetOrderEndBlockers` methods, respectively. This is done via the [module manager](../../build/building-modules/01-module-manager.md) in the [application's constructor](#constructor-function), and the `SetOrderBeginBlockers` and `SetOrderEndBlockers` methods have to be called before the `SetBeginBlocker` and `SetEndBlocker` functions. @@ -142,15 +142,15 @@ As a sidenote, it is important to remember that application-specific blockchains See an example of `BeginBlocker` and `EndBlocker` functions from `simapp` ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/simapp/app.go#L613-L620 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/simapp/app.go#L700-L708 ``` ### Register Codec -The `EncodingConfig` structure is the last important part of the `app.go` file. The goal of this structure is to define the codecs that will be used throughout the app. +The `EncodingConfig` structure is the last important part of the `app.go` file. This structure's purpose is to define the codecs that will be used throughout the app. ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/simapp/params/encoding.go#L9-L16 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/simapp/params/encoding.go#L9-L16 ``` Here are descriptions of what each of the four fields means: @@ -166,7 +166,7 @@ An application should create its own encoding config. See an example of a `simappparams.EncodingConfig` from `simapp`: ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/simapp/params/encoding.go#L11-L16 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/simapp/params/encoding.go#L9-L16 ``` ## Modules @@ -197,7 +197,7 @@ For more details, see [transaction lifecycle](./01-tx-lifecycle.md). Module developers create custom `Msg` services when they build their own module. The general practice is to define the `Msg` Protobuf service in a `tx.proto` file. For example, the `x/bank` module defines a service with two methods to transfer tokens: ```protobuf reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/proto/cosmos/bank/v1beta1/tx.proto#L13-L36 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/x/bank/proto/cosmos/bank/v1beta1/tx.proto#L13-L41 ``` Service methods use `keeper` in order to update the module state. @@ -237,7 +237,7 @@ Each module defines command-line commands, gRPC services, and REST routes to be Generally, the [commands related to a module](../../build/building-modules/09-module-interfaces.md#cli) are defined in a folder called `client/cli` in the module's folder. The CLI divides commands into two categories, transactions and queries, defined in `client/cli/tx.go` and `client/cli/query.go`, respectively. Both commands are built on top of the [Cobra Library](https://github.com/spf13/cobra): * Transactions commands let users generate new transactions so that they can be included in a block and eventually update the state. One command should be created for each [message type](#msg-services) defined in the module. The command calls the constructor of the message with the parameters provided by the end-user, and wraps it into a transaction. The Cosmos SDK handles signing and the addition of other transaction metadata. -* Queries let users query the subset of the state defined by the module. Query commands forward queries to the [application's query router](../advanced/00-baseapp.md#query-routing), which routes them to the appropriate [querier](#grpc-query-services) the `queryRoute` parameter supplied. +* Queries let users query the subset of the state defined by the module. Query commands forward queries to the [application's query router](../advanced/00-baseapp.md#grpc-query-router), which routes them to the appropriate [querier](#grpc-query-services) the `queryRoute` parameter supplied. #### gRPC diff --git a/docs/learn/beginner/01-tx-lifecycle.md b/docs/learn/beginner/01-tx-lifecycle.md index 4888baa60a61..f329e74f7c79 100644 --- a/docs/learn/beginner/01-tx-lifecycle.md +++ b/docs/learn/beginner/01-tx-lifecycle.md @@ -33,7 +33,7 @@ Additionally, there are several [flags](../advanced/07-cli.md) users can use to * `--gas-adjustment` (optional) can be used to scale `gas` up in order to avoid underestimating. For example, users can specify their gas adjustment as 1.5 to use 1.5 times the estimated gas. * `--gas-prices` specifies how much the user is willing to pay per unit of gas, which can be one or multiple denominations of tokens. For example, `--gas-prices=0.025uatom, 0.025upho` means the user is willing to pay 0.025uatom AND 0.025upho per unit of gas. * `--fees` specifies how much in fees the user is willing to pay in total. -* `--timeout-height` specifies a block timeout height to prevent the tx from being committed past a certain height. +* `--timeout-timestamp` specifies a block timeout timestamp to prevent the tx from being committed past a certain time. The ultimate value of the fees paid is equal to the gas multiplied by the gas prices. In other words, `fees = ceil(gas * gasPrices)`. Thus, since fees can be calculated using gas prices and vice versa, the users specify only one of the two. @@ -49,7 +49,7 @@ appd tx send 1000uatom --from --gas auto --ga ### Other Transaction Creation Methods -The command-line is an easy way to interact with an application, but `Tx` can also be created using a [gRPC or REST interface](../advanced/06-grpc_rest.md) or some other entry point defined by the application developer. From the user's perspective, the interaction depends on the web interface or wallet they are using (e.g. creating `Tx` using [Keplr](https://www.keplr.app/) and signing it with a Ledger Nano S). +The command-line is an easy way to interact with an application, but `Tx` can also be created using a [gRPC or REST interface](../advanced/06-grpc_rest.md) or some other entry point defined by the application developer. From the user's perspective, the interaction depends on the web interface or wallet they are using (e.g. creating `Tx` using [Keplr](https://www.keplr.app/) and signing it with any [Ledger device](https://www.ledger.com/)). ## Transaction Broadcasting @@ -108,7 +108,7 @@ Let's say there is a transaction that involves transferring tokens. The message ### Validation -Preliminary checks are performed. These include signature verification to ensure the transaction hasn't been tampered with and checking if the transaction meets the minimum fee requirements, which is handled by the `AnteHandler`. The `Antehandler` is invoked during the `runTx` method in `BaseApp`. +Preliminary checks are performed. These include signature verification to ensure the transaction hasn't been tampered with and checking if the transaction meets the minimum fee requirements, which is handled by the `AnteHandler`. The `AnteHandler` is invoked during the `runTx` method in `BaseApp`. #### Types of Transaction Checks @@ -133,11 +133,11 @@ Full-nodes use these checks during the validation process to quickly reject inva #### ValidateBasic (deprecated) * Messages ([`sdk.Msg`](../advanced/01-transactions.md#messages)) are extracted from transactions (`Tx`). The `ValidateBasic` method of the `sdk.Msg` interface implemented by the module developer is run for each transaction. -* To discard obviously invalid messages, the `BaseApp` type calls the `ValidateBasic` method very early in the processing of the message in the [`CheckTx`](../advanced/00-baseapp.md#checktx) and [`DeliverTx`](../advanced/00-baseapp.md#delivertx) transactions. +* To discard obviously invalid messages, the `BaseApp` type calls the `ValidateBasic` method very early in the processing of the message in the [`CheckTx`](../advanced/00-baseapp.md#checktx) and `DeliverTx` transactions. `ValidateBasic` can include only **stateless** checks (the checks that do not require access to the state). :::warning -The `ValidateBasic` method on messages has been deprecated in favor of validating messages directly in their respective [`Msg` services](../../build/building-modules/03-msg-services.md#Validation). +The `ValidateBasic` method on messages has been deprecated in favor of validating messages directly in their respective [`Msg` services](../../build/building-modules/03-msg-services.md#validation). Read [RFC 001](https://docs.cosmos.network/main/rfc/rfc-001-tx-validation) for more details. ::: @@ -162,9 +162,9 @@ After the transaction has been appropriately routed to the correct module by the For messages that adhere to older standards or specific formats, a routing function retrieves the route name from the message, identifying the corresponding module. The message is then processed by the designated handler within that module, ensuring accurate and consistent application of the transaction's logic. -4. During the execution, the module's handler will modify the state as required by the business logic. This could involve writing to the module's portion of the state store. +1. During the execution, the module's handler will modify the state as required by the business logic. This could involve writing to the module's portion of the state store. -5. Modules can emit events and log information during execution, which are used for monitoring and querying transaction outcomes. +2. Modules can emit events and log information during execution, which are used for monitoring and querying transaction outcomes. During the module execution phase, each message that has been routed to the appropriate module is processed according to the module-specific business logic. For example, the `handleMsgSend` function in the bank module processes `MsgSend` messages by checking balances, transferring tokens, and emitting events: diff --git a/docs/learn/beginner/02-query-lifecycle.md b/docs/learn/beginner/02-query-lifecycle.md index bdaa51766993..a83bbe112a47 100644 --- a/docs/learn/beginner/02-query-lifecycle.md +++ b/docs/learn/beginner/02-query-lifecycle.md @@ -83,14 +83,14 @@ The first thing that is created in the execution of a CLI command is a `client.C The `client.Context` also contains various functions such as `Query()`, which retrieves the RPC Client and makes an ABCI call to relay a query to a full-node. ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/client/context.go#L25-L68 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/client/context.go#L29-L86 ``` The `client.Context`'s primary role is to store data used during interactions with the end-user and provide methods to interact with this data - it is used before and after the query is processed by the full-node. Specifically, in handling `MyQuery`, the `client.Context` is utilized to encode the query parameters, retrieve the full-node, and write the output. Prior to being relayed to a full-node, the query needs to be encoded into a `[]byte` form, as full-nodes are application-agnostic and do not understand specific types. The full-node (RPC Client) itself is retrieved using the `client.Context`, which knows which node the user CLI is connected to. The query is relayed to this full-node to be processed. Finally, the `client.Context` contains a `Writer` to write output when the response is returned. These steps are further described in later sections. ### Arguments and Route Creation -At this point in the lifecycle, the user has created a CLI command with all of the data they wish to include in their query. A `client.Context` exists to assist in the rest of the `MyQuery`'s journey. Now, the next step is to parse the command or request, extract the arguments, and encode everything. These steps all happen on the user side within the interface they are interacting with. +At this point in the lifecycle, the user has created a CLI command with all of the data they wish to include in their query. A `client.Context` exists to assist in the rest of the `MyQuery`'s journey. Now, the next steps are to parse the command or request, extract the arguments, and encode everything. These steps all happen on the user side within the interface they are interacting with. #### Encoding @@ -99,23 +99,25 @@ In our case (querying an address's delegations), `MyQuery` contains an [address] Here is what the code looks like for the CLI command: ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/x/staking/client/cli/query.go#L315-L318 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/client/grpc_query.go#L64-L68 ``` #### gRPC Query Client Creation -The Cosmos SDK leverages code generated from Protobuf services to make queries. The `staking` module's `MyQuery` service generates a `queryClient`, which the CLI uses to make queries. Here is the relevant code: +The Cosmos SDK uses Protobuf-generated services for queries. The `staking` module's `MyQuery` service generates a `queryClient` used by the CLI. + +With the introduction of AutoCLI, query client creation is now automated and integrated into the module's setup. This approach simplifies the process of exposing module queries through the CLI. ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/x/staking/client/cli/query.go#L308-L343 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/x/staking/autocli.go#L73-L81 ``` -Under the hood, the `client.Context` has a `Query()` function used to retrieve the pre-configured node and relay a query to it; the function takes the query fully-qualified service method name as path (in our case: `/cosmos.staking.v1beta1.Query/Delegations`), and arguments as parameters. It first retrieves the RPC Client (called the [**node**](../advanced/03-node.md)) configured by the user to relay this query to, and creates the `ABCIQueryOptions` (parameters formatted for the ABCI call). The node is then used to make the ABCI call, `ABCIQueryWithOptions()`. +The `client.Context` still contains a `Query()` function to retrieve the pre-configured node and relay queries. It takes the fully-qualified service method name as a path (e.g. `/cosmos.staking.v1beta1.Query/Delegations`) and arguments as parameters. The function retrieves the RPC Client, creates `ABCIQueryOptions`, and makes the ABCI call using `ABCIQueryWithOptions()`. Here is what the code looks like: ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/client/query.go#L79-L113 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/client/query.go#L64-L98 ``` ## RPC @@ -141,7 +143,7 @@ Since `Query()` is an ABCI function, `baseapp` returns the response as an [`abci The application [`codec`](../advanced/05-encoding.md) is used to unmarshal the response to a JSON and the `client.Context` prints the output to the command line, applying any configurations such as the output type (text, JSON or YAML). ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/client/context.go#L341-L349 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/client/context.go#L391-L398 ``` And that's a wrap! The result of the query is outputted to the console by the CLI. diff --git a/docs/learn/beginner/03-accounts.md b/docs/learn/beginner/03-accounts.md index b9f7eefa6016..99c9b30267f8 100644 --- a/docs/learn/beginner/03-accounts.md +++ b/docs/learn/beginner/03-accounts.md @@ -5,7 +5,7 @@ sidebar_position: 1 # Accounts :::note Synopsis -This document describes the in-built account and public key system of the Cosmos SDK. +This document describes the built-in account and public key system of the Cosmos SDK. ::: :::note Pre-requisite Readings @@ -17,7 +17,7 @@ This document describes the in-built account and public key system of the Cosmos ## Account Definition -In the Cosmos SDK, an _account_ designates a pair of _public key_ `PubKey` and _private key_ `PrivKey`. The `PubKey` can be derived to generate various `Addresses`, which are used to identify users (among other parties) in the application. `Addresses` are also associated with [`message`s](../../build/building-modules/02-messages-and-queries.md#messages) to identify the sender of the `message`. The `PrivKey` is used to generate [digital signatures](#keys-accounts-addresses-and-signatures) to prove that an `Address` associated with the `PrivKey` approved of a given `message`. +In the Cosmos SDK, an _account_ designates a pair of _public key_ `PubKey` and _private key_ `PrivKey`. The `PubKey` can be used to derive different types of `Addresses` (such as account addresses, validator addresses, and consensus addresses), with one unique address generated for each type. These `Addresses` are used to identify various actors in the application. `Addresses` are also associated with [`message`s](../../build/building-modules/02-messages-and-queries.md#messages) to identify the sender of the `message`. The `PrivKey` is used to generate [digital signatures](#keys-accounts-addresses-and-signatures) to prove that an `Address` associated with the `PrivKey` approved of a given `message`. For HD key derivation the Cosmos SDK uses a standard called [BIP32](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki). The BIP32 allows users to create an HD wallet (as specified in [BIP44](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki)) - a set of accounts derived from an initial secret seed. A seed is usually created from a 12- or 24-word mnemonic. A single seed can derive any number of `PrivKey`s using a one-way cryptographic function. Then, a `PubKey` can be derived from the `PrivKey`. Naturally, the mnemonic is the most sensitive information, as private keys can always be re-generated if the mnemonic is preserved. @@ -48,9 +48,9 @@ In the node, all data is stored using Protocol Buffers serialization. The Cosmos SDK supports the following digital key schemes for creating digital signatures: -* `secp256k1`, as implemented in the [Cosmos SDK's `crypto/keys/secp256k1` package](https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/crypto/keys/secp256k1/secp256k1.go). -* `secp256r1`, as implemented in the [Cosmos SDK's `crypto/keys/secp256r1` package](https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/crypto/keys/secp256r1/pubkey.go), -* `tm-ed25519`, as implemented in the [Cosmos SDK `crypto/keys/ed25519` package](https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/crypto/keys/ed25519/ed25519.go). This scheme is supported only for the consensus validation. +* `secp256k1`, as implemented in the [Cosmos SDK's `crypto/keys/secp256k1` package](https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/crypto/keys/secp256k1/secp256k1.go). +* `secp256r1`, as implemented in the [Cosmos SDK's `crypto/keys/secp256r1` package](https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/crypto/keys/secp256r1/pubkey.go), +* `tm-ed25519`, as implemented in the [Cosmos SDK `crypto/keys/ed25519` package](https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/crypto/keys/ed25519/ed25519.go). This scheme is supported only for the consensus validation. | | Address length in bytes | Public key length in bytes | Used for transaction authentication | Used for consensus (cometbft) | | :----------: | :---------------------: | :------------------------: | :---------------------------------: | :-----------------------------: | @@ -62,7 +62,7 @@ The Cosmos SDK supports the following digital key schemes for creating digital s `Addresses` and `PubKey`s are both public information that identifies actors in the application. `Account` is used to store authentication information. The basic account implementation is provided by a `BaseAccount` object. -Each account is identified using `Address` which is a sequence of bytes derived from a public key. In the Cosmos SDK, we define 3 types of addresses that specify a context where an account is used: +Each account is identified using an `Address` which is a sequence of bytes derived from a public key. In the Cosmos SDK, we define 3 types of addresses that specify a context where an account is used: * `AccAddress` identifies users (the sender of a `message`). * `ValAddress` identifies validator operators. @@ -71,7 +71,7 @@ Each account is identified using `Address` which is a sequence of bytes derived These types implement the `Address` interface: ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/types/address.go#L126-L134 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/types/address.go#L145-L155 ``` Address construction algorithm is defined in [ADR-28](https://github.com/cosmos/cosmos-sdk/blob/main/docs/architecture/adr-028-public-key-addresses.md). @@ -83,10 +83,10 @@ sdk.AccAddress(pub.Address().Bytes()) Of note, the `Marshal()` and `Bytes()` method both return the same raw `[]byte` form of the address. `Marshal()` is required for Protobuf compatibility. -For user interaction, addresses are formatted using [Bech32](https://en.bitcoin.it/wiki/Bech32) and implemented by the `String` method. The Bech32 method is the only supported format to use when interacting with a blockchain. The Bech32 human-readable part (Bech32 prefix) is used to denote an address type. Example: +For user interaction, addresses are formatted using [Bech32](https://en.bitcoin.it/wiki/Bech32). This formatting is handled by an address codec. The Bech32 format is the only supported format for interacting with a blockchain. The Bech32 human-readable part (Bech32 prefix) is used to denote an address type. The address codec is responsible for encoding and decoding addresses between their binary representation and the Bech32 string format. Here's an example of how the address codec formats addresses: ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/types/address.go#L299-L316 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/codec/address/bech32_codec.go#L95-L111 ``` | | Address Bech32 Prefix | @@ -97,10 +97,10 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/types/address.go#L299- ### Public Keys -Public keys in Cosmos SDK are defined by `cryptotypes.PubKey` interface. Since public keys are saved in a store, `cryptotypes.PubKey` extends the `proto.Message` interface: +Public keys in Cosmos SDK are defined by `cryptotypes.PubKey` interface. Since public keys are saved in a store, the `cryptotypes.PubKey` extends the `proto.Message` interface: ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/crypto/types/types.go#L8-L17 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/crypto/types/types.go#L8-L17 ``` A compressed format is used for `secp256k1` and `secp256r1` serialization. @@ -110,11 +110,11 @@ A compressed format is used for `secp256k1` and `secp256r1` serialization. This prefix is followed by the `x`-coordinate. -Public Keys are not used to reference accounts (or users) and in general are not used when composing transaction messages (with few exceptions: `MsgCreateValidator`, `Validator` and `Multisig` messages). -For user interactions, `PubKey` is formatted using Protobufs JSON ([ProtoMarshalJSON](https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/codec/json.go#L14-L34) function). Example: +Public Keys are not used to reference accounts (or users) and in general are not used when composing transaction messages (with a few exceptions: `MsgCreateValidator`, `Validator` and `Multisig` messages). +For user interactions, `PubKey` is formatted using Protobufs JSON ([ProtoMarshalJSON](https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.1/codec/json.go#L14-L34) function). Example: ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/client/keys/output.go#L23-L39 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/client/keys/output.go#L24-L47 ``` ## Keyring @@ -122,7 +122,7 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/client/keys/output.go# A `Keyring` is an object that stores and manages accounts. In the Cosmos SDK, a `Keyring` implementation follows the `Keyring` interface: ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/crypto/keyring/keyring.go#L57-L105 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/crypto/keyring/keyring.go#L57-L109 ``` The default implementation of `Keyring` comes from the third-party [`99designs/keyring`](https://github.com/99designs/keyring) library. @@ -132,34 +132,34 @@ A few notes on the `Keyring` methods: * `Sign(uid string, msg []byte) ([]byte, types.PubKey, error)` strictly deals with the signature of the `msg` bytes. You must prepare and encode the transaction into a canonical `[]byte` form. Because protobuf is not deterministic, it has been decided in [ADR-020](../../architecture/adr-020-protobuf-transaction-encoding.md) that the canonical `payload` to sign is the `SignDoc` struct, deterministically encoded using [ADR-027](../../architecture/adr-027-deterministic-protobuf-serialization.md). Note that signature verification is not implemented in the Cosmos SDK by default, it is deferred to the [`anteHandler`](../advanced/00-baseapp.md#antehandler). ```protobuf reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/proto/cosmos/tx/v1beta1/tx.proto#L50-L66 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/proto/cosmos/tx/v1beta1/tx.proto#L50-L67 ``` -* `NewAccount(uid, mnemonic, bip39Passphrase, hdPath string, algo SignatureAlgo) (*Record, error)` creates a new account based on the [`bip44 path`](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki) and persists it on disk. The `PrivKey` is **never stored unencrypted**, instead it is [encrypted with a passphrase](https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/crypto/armor.go) before being persisted. In the context of this method, the key type and sequence number refers to the segment of the BIP44 derivation path (for example, `0`, `1`, `2`, ...) that is used to derive a private and a public key from the mnemonic. Using the same mnemonic and derivation path, the same `PrivKey`, `PubKey` and `Address` is generated. The following keys are supported by the keyring: +* `NewAccount(uid, mnemonic, bip39Passphrase, hdPath string, algo SignatureAlgo) (*Record, error)` creates a new account based on the [`bip44 path`](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki) and persists it on selected backend. The `PrivKey` is **never stored unencrypted**, instead it is [encrypted with a passphrase](https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.1/crypto/armor.go) before being persisted. In the context of this method, the key type and sequence number refers to the segment of the BIP44 derivation path (for example, `0`, `1`, `2`, ...) that is used to derive a private and a public key from the mnemonic. Using the same mnemonic and derivation path, the same `PrivKey`, `PubKey` and `Address` is generated. The following keys are supported by the keyring: -* `secp256k1` -* `ed25519` + * `secp256k1` + * `ed25519` * `ExportPrivKeyArmor(uid, encryptPassphrase string) (armor string, err error)` exports a private key in ASCII-armored encrypted format using the given passphrase. You can then either import the private key again into the keyring using the `ImportPrivKey(uid, armor, passphrase string)` function or decrypt it into a raw private key using the `UnarmorDecryptPrivKey(armorStr string, passphrase string)` function. ### Create New Key Type -To create a new key type for using in keyring, `keyring.SignatureAlgo` interface must be fulfilled. +To create a new key type for use in the keyring, the `keyring.SignatureAlgo` interface must be fulfilled. ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/crypto/keyring/signing_algorithms.go#L10-L15 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/crypto/keyring/signing_algorithms.go#L11-L16 ``` The interface consists in three methods where `Name()` returns the name of the algorithm as a `hd.PubKeyType` and `Derive()` and `Generate()` must return the following functions respectively: ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/crypto/hd/algo.go#L28-L31 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/crypto/hd/algo.go#L32-L35 ``` -Once the `keyring.SignatureAlgo` has been implemented it must be added to the [list of supported algos](https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/crypto/keyring/keyring.go#L217) of the keyring. +Once the `keyring.SignatureAlgo` has been implemented it must be added to the [list of supported algos](https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/crypto/keyring/keyring.go#L209) of the keyring. You can add your new algo to the list by using the [`Option` function](https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/crypto/keyring/keyring_other.go#L17). For simplicity the implementation of a new key type should be done inside the `crypto/hd` package. -There is an example of a working `secp256k1` implementation in [algo.go](https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/crypto/hd/algo.go#L38). +There is an example of a working `secp256k1` implementation in [algo.go](https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/crypto/hd/algo.go#L42-L79). #### Implementing secp256r1 algo @@ -238,21 +238,21 @@ func (s secp256r1Algo) Generate() GenerateFn { } ``` -Finally, the algo must be added to the list of [supported algos](https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/crypto/keyring/keyring.go#L217) by the keyring. +Finally, the algo must be added to the list of [supported algos](https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/crypto/keyring/keyring.go#L209) by the keyring. ```go // cosmos-sdk/crypto/keyring/keyring.go -func newKeystore(kr keyring.Keyring, cdc codec.Codec, backend string, opts ...Option) keystore { - // Default options for keybase, these can be overwritten using the - // Option function - options := Options{ - SupportedAlgos: SigningAlgoList{hd.Secp256k1, hd.Secp256r1}, // added here - SupportedAlgosLedger: SigningAlgoList{hd.Secp256k1}, +func setSupportedAlgos(algos SigningAlgoList) Option { + return func(options *Options) { + options.SupportedAlgos = algos } -... +} + +k, err := New("", "", "", userInput, cdc, setSupportedAlgos(SigningAlgoList{hd.Secp256k1, hd.Secp256r1})) + ``` -Hereafter to create new keys using your algo, you must specify it with the flag `--algo` : +Hereafter, to create new keys using your algo, you must specify it with the flag `--algo` : `simd keys add myKey --algo secp256r1` diff --git a/docs/learn/beginner/04-gas-fees.md b/docs/learn/beginner/04-gas-fees.md index 63ac006a839f..ea9af2e492b7 100644 --- a/docs/learn/beginner/04-gas-fees.md +++ b/docs/learn/beginner/04-gas-fees.md @@ -16,10 +16,10 @@ This document describes the default strategies to handle gas and fees within a C ## Introduction to `Gas` and `Fees` -In the Cosmos SDK, `gas` is a special unit that is used to track the consumption of resources during execution. `gas` is typically consumed whenever read and writes are made to the store, but it can also be consumed if expensive computation needs to be done. It serves two main purposes: +In the Cosmos SDK, `gas` is a special unit that is used to track the consumption of resources during execution. `gas` is typically consumed whenever reads and writes are made to the store, but it can also be consumed if expensive computation needs to be done. It serves two main purposes: * Make sure blocks are not consuming too many resources and are finalized. This is implemented by default in the Cosmos SDK via the [block gas meter](#block-gas-meter). -* Prevent spam and abuse from end-user. To this end, `gas` consumed during [`message`](../../build/building-modules/02-messages-and-queries.md#messages) execution is typically priced, resulting in a `fee` (`fees = gas * gas-prices`). `fees` generally have to be paid by the sender of the `message`. Note that the Cosmos SDK does not enforce `gas` pricing by default, as there may be other ways to prevent spam (e.g. bandwidth schemes). Still, most applications implement `fee` mechanisms to prevent spam by using the [`AnteHandler`](#antehandler). +* Prevent spam and abuse from end-users. To this end, `gas` consumed during [`message`](../../build/building-modules/02-messages-and-queries.md#messages) execution is typically priced, resulting in a `fee` (`fees = gas * gas-prices`). `fees` generally have to be paid by the sender of the `message`. Note that the Cosmos SDK does not enforce `gas` pricing by default, as there may be other ways to prevent spam (e.g. bandwidth schemes). Still, most applications implement `fee` mechanisms to prevent spam by using the [`AnteHandler`](#antehandler). ## Gas Meter @@ -84,18 +84,18 @@ The anteHandler is not implemented in the core Cosmos SDK but in a module. That * Verify that the transactions are of the correct type. Transaction types are defined in the module that implements the `anteHandler`, and they follow the transaction interface: ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/types/tx_msg.go#L51-L56 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/types/tx_msg.go#L53-L66 ``` This enables developers to play with various types for the transaction of their application. In the default `auth` module, the default transaction type is `Tx`: ```protobuf reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/proto/cosmos/tx/v1beta1/tx.proto#L14-L27 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/proto/cosmos/tx/v1beta1/tx.proto#L15-L28 ``` * Verify signatures for each [`message`](../../build/building-modules/02-messages-and-queries.md#messages) contained in the transaction. Each `message` should be signed by one or multiple sender(s), and these signatures must be verified in the `anteHandler`. -* During `CheckTx`, verify that the gas prices provided with the transaction is greater than the local `min-gas-prices` (as a reminder, gas-prices can be deduced from the following equation: `fees = gas * gas-prices`). `min-gas-prices` is a parameter local to each full-node and used during `CheckTx` to discard transactions that do not provide a minimum amount of fees. This ensures that the mempool cannot be spammed with garbage transactions. +* During `CheckTx`, verify that the gas prices provided with the transaction are greater than the local `min-gas-prices` (as a reminder, gas-prices can be deduced from the following equation: `fees = gas * gas-prices`). `min-gas-prices` is a parameter local to each full-node and used during `CheckTx` to discard transactions that do not provide a minimum amount of fees. This ensures that the mempool cannot be spammed with garbage transactions. * Verify that the sender of the transaction has enough funds to cover for the `fees`. When the end-user generates a transaction, they must indicate 2 of the 3 following parameters (the third one being implicit): `fees`, `gas` and `gas-prices`. This signals how much they are willing to pay for nodes to execute their transaction. The provided `gas` value is stored in a parameter called `GasWanted` for later use. * Set `newCtx.GasMeter` to 0, with a limit of `GasWanted`. **This step is crucial**, as it not only makes sure the transaction cannot consume infinite gas, but also that `ctx.GasMeter` is reset in-between each transaction (`ctx` is set to `newCtx` after `anteHandler` is run, and the `anteHandler` is run each time a transactions executes). -As explained above, the `anteHandler` returns a maximum limit of `gas` the transaction can consume during execution called `GasWanted`. The actual amount consumed in the end is denominated `GasUsed`, and we must therefore have `GasUsed =< GasWanted`. Both `GasWanted` and `GasUsed` are relayed to the underlying consensus engine when [`FinalizeBlock`](../advanced/00-baseapp.md#finalizeblock) returns. +As explained above, the `anteHandler` returns a maximum limit of `gas` the transaction can consume during execution called `GasWanted`. The actual amount consumed in the end is denominated `GasUsed`, and we must therefore have `GasUsed <= GasWanted`. Both `GasWanted` and `GasUsed` are relayed to the underlying consensus engine when [`FinalizeBlock`](../advanced/00-baseapp.md#finalizeblock) returns. From e475af3c4b400db430015f2532cfba7cb981dad6 Mon Sep 17 00:00:00 2001 From: auricom <27022259+auricom@users.noreply.github.com> Date: Wed, 9 Oct 2024 21:47:03 +0200 Subject: [PATCH 12/57] ci: reduce rocksdb-cache execiton frequence (#22193) --- .github/workflows/cache-rocksdb.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cache-rocksdb.yml b/.github/workflows/cache-rocksdb.yml index d85965181312..5db3dff15d28 100644 --- a/.github/workflows/cache-rocksdb.yml +++ b/.github/workflows/cache-rocksdb.yml @@ -4,7 +4,7 @@ on: paths: - build.mk schedule: - - cron: "*/15 * * * *" # Every 15 minutes + - cron: "15 */2 * * *" # Every two hours at xx:15 minutes workflow_dispatch: permissions: @@ -59,4 +59,4 @@ jobs: path: | /usr/local/lib/librocksdb.* /usr/local/include/rocksdb - key: ${{ runner.os }}-rocksdb-${{ env.ROCKSDB_VERSION }}-amd64 \ No newline at end of file + key: ${{ runner.os }}-rocksdb-${{ env.ROCKSDB_VERSION }}-amd64 From 864e9f16a3f2c85d0ec91561379d41286935f382 Mon Sep 17 00:00:00 2001 From: Facundo Medica <14063057+facundomedica@users.noreply.github.com> Date: Wed, 9 Oct 2024 22:00:09 +0200 Subject: [PATCH 13/57] refactor(x/bank,x/distr,x/feegrant)!: reduce auth keeper dependency (#21651) --- simapp/app.go | 2 +- x/bank/depinject.go | 14 ++- x/bank/keeper/collections_test.go | 5 +- x/bank/keeper/genesis.go | 4 +- x/bank/keeper/genesis_test.go | 2 +- x/bank/keeper/grpc_query.go | 10 +- x/bank/keeper/grpc_query_test.go | 8 +- x/bank/keeper/keeper.go | 12 +- x/bank/keeper/keeper_test.go | 42 +++---- x/bank/keeper/msg_server.go | 8 +- x/bank/keeper/msg_server_test.go | 16 +-- x/bank/keeper/send.go | 14 +-- x/bank/keeper/view.go | 9 +- x/bank/testutil/expected_keepers_mocks.go | 84 -------------- x/bank/types/expected_keepers.go | 7 -- x/distribution/keeper/allocation_test.go | 6 + x/distribution/keeper/delegation.go | 4 +- x/distribution/keeper/delegation_test.go | 70 +++++++----- x/distribution/keeper/genesis.go | 15 +-- x/distribution/keeper/grpc_query.go | 12 +- x/distribution/keeper/invariants.go | 2 +- x/distribution/keeper/keeper.go | 5 +- x/distribution/keeper/keeper_test.go | 2 +- x/distribution/keeper/msg_server.go | 14 +-- .../testutil/expected_keepers_mocks.go | 26 ----- x/distribution/types/expected_keepers.go | 3 - x/feegrant/CHANGELOG.md | 1 + x/feegrant/expected_keepers.go | 14 --- x/feegrant/keeper/genesis_test.go | 24 ++-- x/feegrant/keeper/grpc_query.go | 8 +- x/feegrant/keeper/keeper.go | 31 ++--- x/feegrant/keeper/keeper_test.go | 14 +-- x/feegrant/keeper/msg_server.go | 8 +- x/feegrant/keeper/msg_server_test.go | 16 --- x/feegrant/module/abci_test.go | 12 +- x/feegrant/module/depinject.go | 13 ++- x/feegrant/testutil/expected_keepers_mocks.go | 106 ------------------ 37 files changed, 193 insertions(+), 450 deletions(-) diff --git a/simapp/app.go b/simapp/app.go index 96ae2f04dbae..3a322827185e 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -387,7 +387,7 @@ func NewSimApp( appCodec, legacyAmino, app.StakingKeeper, govModuleAddr, ) - app.FeeGrantKeeper = feegrantkeeper.NewKeeper(runtime.NewEnvironment(runtime.NewKVStoreService(keys[feegrant.StoreKey]), logger.With(log.ModuleKey, "x/feegrant")), appCodec, app.AuthKeeper) + app.FeeGrantKeeper = feegrantkeeper.NewKeeper(runtime.NewEnvironment(runtime.NewKVStoreService(keys[feegrant.StoreKey]), logger.With(log.ModuleKey, "x/feegrant")), appCodec, app.AuthKeeper.AddressCodec()) // register the staking hooks // NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks diff --git a/x/bank/depinject.go b/x/bank/depinject.go index b17a0cbf7557..22ec40422bcc 100644 --- a/x/bank/depinject.go +++ b/x/bank/depinject.go @@ -7,6 +7,7 @@ import ( "sort" modulev1 "cosmossdk.io/api/cosmos/bank/module/v1" + "cosmossdk.io/core/address" "cosmossdk.io/core/appmodule" "cosmossdk.io/depinject" "cosmossdk.io/depinject/appconfig" @@ -33,9 +34,10 @@ func init() { type ModuleInputs struct { depinject.In - Config *modulev1.Module - Cdc codec.Codec - Environment appmodule.Environment + Config *modulev1.Module + Cdc codec.Codec + Environment appmodule.Environment + AddressCodec address.Codec AccountKeeper types.AccountKeeper } @@ -55,7 +57,7 @@ func ProvideModule(in ModuleInputs) ModuleOutputs { blockedAddresses := make(map[string]bool) if len(in.Config.BlockedModuleAccountsOverride) > 0 { for _, moduleName := range in.Config.BlockedModuleAccountsOverride { - addrStr, err := in.AccountKeeper.AddressCodec().BytesToString(authtypes.NewModuleAddress(moduleName)) + addrStr, err := in.AddressCodec.BytesToString(authtypes.NewModuleAddress(moduleName)) if err != nil { panic(err) } @@ -63,7 +65,7 @@ func ProvideModule(in ModuleInputs) ModuleOutputs { } } else { for _, permission := range in.AccountKeeper.GetModulePermissions() { - addrStr, err := in.AccountKeeper.AddressCodec().BytesToString(permission.GetAddress()) + addrStr, err := in.AddressCodec.BytesToString(permission.GetAddress()) if err != nil { panic(err) } @@ -77,7 +79,7 @@ func ProvideModule(in ModuleInputs) ModuleOutputs { authority = authtypes.NewModuleAddressOrBech32Address(in.Config.Authority) } - authStr, err := in.AccountKeeper.AddressCodec().BytesToString(authority) + authStr, err := in.AddressCodec.BytesToString(authority) if err != nil { panic(err) } diff --git a/x/bank/keeper/collections_test.go b/x/bank/keeper/collections_test.go index 3e6d470b380a..f18fe08f434a 100644 --- a/x/bank/keeper/collections_test.go +++ b/x/bank/keeper/collections_test.go @@ -16,7 +16,6 @@ import ( banktestutil "cosmossdk.io/x/bank/testutil" banktypes "cosmossdk.io/x/bank/types" - "github.com/cosmos/cosmos-sdk/codec/address" codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil" "github.com/cosmos/cosmos-sdk/runtime" "github.com/cosmos/cosmos-sdk/testutil" @@ -32,13 +31,13 @@ func TestBankStateCompatibility(t *testing.T) { encCfg := moduletestutil.MakeTestEncodingConfig(codectestutil.CodecOptions{}) env := runtime.NewEnvironment(runtime.NewKVStoreService(key), coretesting.NewNopLogger()) + ac := codectestutil.CodecOptions{}.GetAddressCodec() // gomock initializations ctrl := gomock.NewController(t) authKeeper := banktestutil.NewMockAccountKeeper(ctrl) - authKeeper.EXPECT().AddressCodec().Return(address.NewBech32Codec("cosmos")).AnyTimes() + authKeeper.EXPECT().AddressCodec().Return(ac).AnyTimes() - ac := codectestutil.CodecOptions{}.GetAddressCodec() addr, err := ac.BytesToString(accAddrs[4]) require.NoError(t, err) authority, err := ac.BytesToString(authtypes.NewModuleAddress(banktypes.GovModuleName)) diff --git a/x/bank/keeper/genesis.go b/x/bank/keeper/genesis.go index 8e422e5f420c..2f6facc9ab80 100644 --- a/x/bank/keeper/genesis.go +++ b/x/bank/keeper/genesis.go @@ -23,14 +23,14 @@ func (k BaseKeeper) InitGenesis(ctx context.Context, genState *types.GenesisStat } totalSupplyMap := sdk.NewMapCoins(sdk.Coins{}) - genState.Balances, err = types.SanitizeGenesisBalances(genState.Balances, k.ak.AddressCodec()) + genState.Balances, err = types.SanitizeGenesisBalances(genState.Balances, k.addrCdc) if err != nil { return err } for _, balance := range genState.Balances { addr := balance.GetAddress() - bz, err := k.ak.AddressCodec().StringToBytes(addr) + bz, err := k.addrCdc.StringToBytes(addr) if err != nil { return err } diff --git a/x/bank/keeper/genesis_test.go b/x/bank/keeper/genesis_test.go index 42f6221092cf..c8c7b58c2c81 100644 --- a/x/bank/keeper/genesis_test.go +++ b/x/bank/keeper/genesis_test.go @@ -21,7 +21,7 @@ func (suite *KeeperTestSuite) TestExportGenesis() { for i := range []int{1, 2} { suite.bankKeeper.SetDenomMetaData(ctx, expectedMetadata[i]) - accAddr, err1 := suite.authKeeper.AddressCodec().StringToBytes(expectedBalances[i].Address) + accAddr, err1 := suite.addrCdc.StringToBytes(expectedBalances[i].Address) if err1 != nil { panic(err1) } diff --git a/x/bank/keeper/grpc_query.go b/x/bank/keeper/grpc_query.go index c6d499143d83..909efe3a9d38 100644 --- a/x/bank/keeper/grpc_query.go +++ b/x/bank/keeper/grpc_query.go @@ -37,7 +37,7 @@ func (k BaseKeeper) Balance(ctx context.Context, req *types.QueryBalanceRequest) return nil, status.Error(codes.InvalidArgument, err.Error()) } - address, err := k.ak.AddressCodec().StringToBytes(req.Address) + address, err := k.addrCdc.StringToBytes(req.Address) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid address: %s", err.Error()) } @@ -53,7 +53,7 @@ func (k BaseKeeper) AllBalances(ctx context.Context, req *types.QueryAllBalances return nil, status.Error(codes.InvalidArgument, "empty request") } - addr, err := k.ak.AddressCodec().StringToBytes(req.Address) + addr, err := k.addrCdc.StringToBytes(req.Address) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid address: %s", err.Error()) } @@ -86,7 +86,7 @@ func (k BaseKeeper) SpendableBalances(ctx context.Context, req *types.QuerySpend return nil, status.Error(codes.InvalidArgument, "empty request") } - addr, err := k.ak.AddressCodec().StringToBytes(req.Address) + addr, err := k.addrCdc.StringToBytes(req.Address) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid address: %s", err.Error()) } @@ -120,7 +120,7 @@ func (k BaseKeeper) SpendableBalanceByDenom(ctx context.Context, req *types.Quer return nil, status.Error(codes.InvalidArgument, "empty request") } - addr, err := k.ak.AddressCodec().StringToBytes(req.Address) + addr, err := k.addrCdc.StringToBytes(req.Address) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid address: %s", err.Error()) } @@ -295,7 +295,7 @@ func (k BaseKeeper) DenomOwners( if err != nil { return nil, err } - addr, err := k.ak.AddressCodec().BytesToString(key.K2()) + addr, err := k.addrCdc.BytesToString(key.K2()) if err != nil { return nil, err } diff --git a/x/bank/keeper/grpc_query_test.go b/x/bank/keeper/grpc_query_test.go index 6de9321d404c..4878bf24ce50 100644 --- a/x/bank/keeper/grpc_query_test.go +++ b/x/bank/keeper/grpc_query_test.go @@ -21,7 +21,7 @@ func (suite *KeeperTestSuite) TestQueryBalance() { ctx, queryClient := suite.ctx, suite.queryClient _, _, addr := testdata.KeyTestPubAddr() - addrStr, err := suite.authKeeper.AddressCodec().BytesToString(addr) + addrStr, err := suite.addrCdc.BytesToString(addr) suite.Require().NoError(err) origCoins := sdk.NewCoins(newBarCoin(30)) @@ -105,7 +105,7 @@ func (suite *KeeperTestSuite) TestQueryAllBalances() { _, err := queryClient.AllBalances(gocontext.Background(), &types.QueryAllBalancesRequest{}) suite.Require().Error(err) - addrStr, err := suite.authKeeper.AddressCodec().BytesToString(addr) + addrStr, err := suite.addrCdc.BytesToString(addr) suite.Require().NoError(err) pageReq := &query.PageRequest{ @@ -178,7 +178,7 @@ func (suite *KeeperTestSuite) TestQueryAllBalances() { func (suite *KeeperTestSuite) TestSpendableBalances() { _, _, addr := testdata.KeyTestPubAddr() - addrStr, err := suite.authKeeper.AddressCodec().BytesToString(addr) + addrStr, err := suite.addrCdc.BytesToString(addr) suite.Require().NoError(err) ctx := sdk.UnwrapSDKContext(suite.ctx) @@ -241,7 +241,7 @@ func (suite *KeeperTestSuite) TestSpendableBalanceByDenom() { _, err := queryClient.SpendableBalanceByDenom(ctx, &types.QuerySpendableBalanceByDenomRequest{}) suite.Require().Error(err) - addrStr, err := suite.authKeeper.AddressCodec().BytesToString(addr) + addrStr, err := suite.addrCdc.BytesToString(addr) suite.Require().NoError(err) req := types.NewQuerySpendableBalanceByDenomRequest(addrStr, fooDenom) diff --git a/x/bank/keeper/keeper.go b/x/bank/keeper/keeper.go index 9b1d79c1091b..f8e8aab22974 100644 --- a/x/bank/keeper/keeper.go +++ b/x/bank/keeper/keeper.go @@ -4,6 +4,7 @@ import ( "context" "fmt" + "cosmossdk.io/core/address" "cosmossdk.io/core/appmodule" "cosmossdk.io/core/event" errorsmod "cosmossdk.io/errors" @@ -60,6 +61,7 @@ type BaseKeeper struct { ak types.AccountKeeper cdc codec.BinaryCodec mintCoinsRestrictionFn types.MintingRestrictionFn + addrCdc address.Codec } // GetPaginatedTotalSupply queries for the supply, ignoring 0 coins, with a given pagination @@ -87,7 +89,8 @@ func NewBaseKeeper( blockedAddrs map[string]bool, authority string, ) BaseKeeper { - if _, err := ak.AddressCodec().StringToBytes(authority); err != nil { + addrCdc := ak.AddressCodec() + if _, err := addrCdc.StringToBytes(authority); err != nil { panic(fmt.Errorf("invalid bank authority address: %w", err)) } @@ -97,6 +100,7 @@ func NewBaseKeeper( ak: ak, cdc: cdc, mintCoinsRestrictionFn: types.NoOpMintingRestrictionFn, + addrCdc: addrCdc, } } @@ -146,7 +150,7 @@ func (k BaseKeeper) DelegateCoins(ctx context.Context, delegatorAddr, moduleAccA return errorsmod.Wrap(err, "failed to track delegation") } // emit coin spent event - delAddrStr, err := k.ak.AddressCodec().BytesToString(delegatorAddr) + delAddrStr, err := k.addrCdc.BytesToString(delegatorAddr) if err != nil { return err } @@ -362,7 +366,7 @@ func (k BaseKeeper) MintCoins(ctx context.Context, moduleName string, amounts sd k.Logger.Debug("minted coins from module account", "amount", amounts.String(), "from", moduleName) - addrStr, err := k.ak.AddressCodec().BytesToString(acc.GetAddress()) + addrStr, err := k.addrCdc.BytesToString(acc.GetAddress()) if err != nil { return err } @@ -403,7 +407,7 @@ func (k BaseKeeper) BurnCoins(ctx context.Context, address []byte, amounts sdk.C k.setSupply(ctx, supply) } - addrStr, err := k.ak.AddressCodec().BytesToString(acc.GetAddress()) + addrStr, err := k.addrCdc.BytesToString(acc.GetAddress()) if err != nil { return err } diff --git a/x/bank/keeper/keeper_test.go b/x/bank/keeper/keeper_test.go index 4fe765039638..1e984109008b 100644 --- a/x/bank/keeper/keeper_test.go +++ b/x/bank/keeper/keeper_test.go @@ -13,6 +13,7 @@ import ( "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" + "cosmossdk.io/core/address" coreevent "cosmossdk.io/core/event" "cosmossdk.io/core/header" coretesting "cosmossdk.io/core/testing" @@ -24,7 +25,6 @@ import ( banktypes "cosmossdk.io/x/bank/types" "github.com/cosmos/cosmos-sdk/baseapp" - "github.com/cosmos/cosmos-sdk/codec/address" codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil" "github.com/cosmos/cosmos-sdk/runtime" "github.com/cosmos/cosmos-sdk/testutil" @@ -114,6 +114,7 @@ type KeeperTestSuite struct { ctx context.Context bankKeeper keeper.BaseKeeper + addrCdc address.Codec authKeeper *banktestutil.MockAccountKeeper queryClient banktypes.QueryClient @@ -143,9 +144,10 @@ func (suite *KeeperTestSuite) SetupTest() { // gomock initializations ctrl := gomock.NewController(suite.T()) authKeeper := banktestutil.NewMockAccountKeeper(ctrl) - authKeeper.EXPECT().AddressCodec().Return(address.NewBech32Codec("cosmos")).AnyTimes() + authKeeper.EXPECT().AddressCodec().Return(ac).AnyTimes() suite.ctx = ctx suite.authKeeper = authKeeper + suite.addrCdc = ac suite.bankKeeper = keeper.NewBaseKeeper( env, encCfg.Codec, @@ -320,9 +322,9 @@ func (suite *KeeperTestSuite) TestGetAuthority() { authority, ) } - govAddr, err := suite.authKeeper.AddressCodec().BytesToString(authtypes.NewModuleAddress(banktypes.GovModuleName)) + govAddr, err := suite.addrCdc.BytesToString(authtypes.NewModuleAddress(banktypes.GovModuleName)) suite.Require().NoError(err) - modAddr, err := suite.authKeeper.AddressCodec().BytesToString(authtypes.NewModuleAddress(banktypes.MintModuleName)) + modAddr, err := suite.addrCdc.BytesToString(authtypes.NewModuleAddress(banktypes.MintModuleName)) suite.Require().NoError(err) tests := map[string]string{ @@ -647,9 +649,9 @@ func (suite *KeeperTestSuite) TestInputOutputNewAccount() { require.Empty(suite.bankKeeper.GetAllBalances(ctx, accAddrs[1])) - acc0StrAddr, err := suite.authKeeper.AddressCodec().BytesToString(accAddrs[0]) + acc0StrAddr, err := suite.addrCdc.BytesToString(accAddrs[0]) suite.Require().NoError(err) - acc1StrAddr, err := suite.authKeeper.AddressCodec().BytesToString(accAddrs[1]) + acc1StrAddr, err := suite.addrCdc.BytesToString(accAddrs[1]) suite.Require().NoError(err) suite.mockInputOutputCoins([]sdk.AccountI{authtypes.NewBaseAccountWithAddress(accAddrs[0])}, []sdk.AccAddress{accAddrs[1]}) @@ -674,11 +676,11 @@ func (suite *KeeperTestSuite) TestInputOutputCoins() { acc0 := authtypes.NewBaseAccountWithAddress(accAddrs[0]) - acc0StrAddr, err := suite.authKeeper.AddressCodec().BytesToString(accAddrs[0]) + acc0StrAddr, err := suite.addrCdc.BytesToString(accAddrs[0]) suite.Require().NoError(err) - acc1StrAddr, err := suite.authKeeper.AddressCodec().BytesToString(accAddrs[1]) + acc1StrAddr, err := suite.addrCdc.BytesToString(accAddrs[1]) suite.Require().NoError(err) - acc2StrAddr, err := suite.authKeeper.AddressCodec().BytesToString(accAddrs[2]) + acc2StrAddr, err := suite.addrCdc.BytesToString(accAddrs[2]) suite.Require().NoError(err) input := banktypes.Input{ @@ -786,16 +788,16 @@ func (suite *KeeperTestSuite) TestInputOutputCoinsWithRestrictions() { setupCtx := suite.ctx balances := sdk.NewCoins(newFooCoin(1000), newBarCoin(500)) fromAddr := accAddrs[0] - fromStrAddr, err := suite.authKeeper.AddressCodec().BytesToString(fromAddr) + fromStrAddr, err := suite.addrCdc.BytesToString(fromAddr) suite.Require().NoError(err) fromAcc := authtypes.NewBaseAccountWithAddress(fromAddr) inputAccs := []sdk.AccountI{fromAcc} suite.authKeeper.EXPECT().GetAccount(suite.ctx, inputAccs[0].GetAddress()).Return(inputAccs[0]).AnyTimes() toAddr1 := accAddrs[1] - toAddr1Str, err := suite.authKeeper.AddressCodec().BytesToString(toAddr1) + toAddr1Str, err := suite.addrCdc.BytesToString(toAddr1) suite.Require().NoError(err) toAddr2 := accAddrs[2] - toAddr2Str, err := suite.authKeeper.AddressCodec().BytesToString(toAddr2) + toAddr2Str, err := suite.addrCdc.BytesToString(toAddr2) suite.Require().NoError(err) suite.mockFundAccount(accAddrs[0]) @@ -1365,9 +1367,9 @@ func (suite *KeeperTestSuite) TestMsgSendEvents() { acc0 := authtypes.NewBaseAccountWithAddress(accAddrs[0]) - acc0StrAddr, err := suite.authKeeper.AddressCodec().BytesToString(accAddrs[0]) + acc0StrAddr, err := suite.addrCdc.BytesToString(accAddrs[0]) suite.Require().NoError(err) - acc1StrAddr, err := suite.authKeeper.AddressCodec().BytesToString(accAddrs[1]) + acc1StrAddr, err := suite.addrCdc.BytesToString(accAddrs[1]) suite.Require().NoError(err) newCoins := sdk.NewCoins(sdk.NewInt64Coin(fooDenom, 50)) @@ -1407,11 +1409,11 @@ func (suite *KeeperTestSuite) TestMsgMultiSendEvents() { require.NoError(suite.bankKeeper.SetParams(ctx, banktypes.DefaultParams())) - acc0StrAddr, err := suite.authKeeper.AddressCodec().BytesToString(accAddrs[0]) + acc0StrAddr, err := suite.addrCdc.BytesToString(accAddrs[0]) suite.Require().NoError(err) - acc2StrAddr, err := suite.authKeeper.AddressCodec().BytesToString(accAddrs[2]) + acc2StrAddr, err := suite.addrCdc.BytesToString(accAddrs[2]) suite.Require().NoError(err) - acc3StrAddr, err := suite.authKeeper.AddressCodec().BytesToString(accAddrs[3]) + acc3StrAddr, err := suite.addrCdc.BytesToString(accAddrs[3]) suite.Require().NoError(err) coins := sdk.NewCoins(sdk.NewInt64Coin(fooDenom, 50), sdk.NewInt64Coin(barDenom, 100)) @@ -1932,7 +1934,7 @@ func (suite *KeeperTestSuite) TestBalanceTrackingEvents() { case banktypes.EventTypeCoinSpent: coinsSpent, err := sdk.ParseCoinsNormalized(e.Attributes[1].Value) require.NoError(err) - _, err = suite.authKeeper.AddressCodec().StringToBytes(e.Attributes[0].Value) + _, err = suite.addrCdc.StringToBytes(e.Attributes[0].Value) require.NoError(err) balances[e.Attributes[0].Value] = balances[e.Attributes[0].Value].Sub(coinsSpent...) @@ -1940,7 +1942,7 @@ func (suite *KeeperTestSuite) TestBalanceTrackingEvents() { case banktypes.EventTypeCoinReceived: coinsRecv, err := sdk.ParseCoinsNormalized(e.Attributes[1].Value) require.NoError(err) - _, err = suite.authKeeper.AddressCodec().StringToBytes(e.Attributes[0].Value) + _, err = suite.addrCdc.StringToBytes(e.Attributes[0].Value) require.NoError(err) balances[e.Attributes[0].Value] = balances[e.Attributes[0].Value].Add(coinsRecv...) } @@ -1958,7 +1960,7 @@ func (suite *KeeperTestSuite) TestBalanceTrackingEvents() { return false } - addr, err := suite.authKeeper.AddressCodec().BytesToString(address) + addr, err := suite.addrCdc.BytesToString(address) suite.Require().NoError(err) balance, exists := balances[addr] diff --git a/x/bank/keeper/msg_server.go b/x/bank/keeper/msg_server.go index 81d4d2321476..893191ce4805 100644 --- a/x/bank/keeper/msg_server.go +++ b/x/bank/keeper/msg_server.go @@ -29,11 +29,11 @@ func (k msgServer) Send(ctx context.Context, msg *types.MsgSend) (*types.MsgSend ) if base, ok := k.Keeper.(BaseKeeper); ok { - from, err = base.ak.AddressCodec().StringToBytes(msg.FromAddress) + from, err = base.addrCdc.StringToBytes(msg.FromAddress) if err != nil { return nil, sdkerrors.ErrInvalidAddress.Wrapf("invalid from address: %s", err) } - to, err = base.ak.AddressCodec().StringToBytes(msg.ToAddress) + to, err = base.addrCdc.StringToBytes(msg.ToAddress) if err != nil { return nil, sdkerrors.ErrInvalidAddress.Wrapf("invalid to address: %s", err) } @@ -91,7 +91,7 @@ func (k msgServer) MultiSend(ctx context.Context, msg *types.MsgMultiSend) (*typ for _, out := range msg.Outputs { if base, ok := k.Keeper.(BaseKeeper); ok { - accAddr, err := base.ak.AddressCodec().StringToBytes(out.Address) + accAddr, err := base.addrCdc.StringToBytes(out.Address) if err != nil { return nil, err } @@ -174,7 +174,7 @@ func (k msgServer) Burn(ctx context.Context, msg *types.MsgBurn) (*types.MsgBurn } if base, ok := k.Keeper.(BaseKeeper); ok { - from, err = base.ak.AddressCodec().StringToBytes(msg.FromAddress) + from, err = base.addrCdc.StringToBytes(msg.FromAddress) if err != nil { return nil, sdkerrors.ErrInvalidAddress.Wrapf("invalid from address: %s", err) } diff --git a/x/bank/keeper/msg_server_test.go b/x/bank/keeper/msg_server_test.go index c02f6943b90a..475116389593 100644 --- a/x/bank/keeper/msg_server_test.go +++ b/x/bank/keeper/msg_server_test.go @@ -71,9 +71,9 @@ func (suite *KeeperTestSuite) TestMsgSend() { atom0 := sdk.NewCoins(sdk.NewInt64Coin("atom", 0)) atom123eth0 := sdk.Coins{sdk.NewInt64Coin("atom", 123), sdk.NewInt64Coin("eth", 0)} - acc4Addr, err := suite.authKeeper.AddressCodec().BytesToString(accAddrs[4]) + acc4Addr, err := suite.addrCdc.BytesToString(accAddrs[4]) suite.Require().NoError(err) - minterAccAddr, err := suite.authKeeper.AddressCodec().BytesToString(minterAcc.GetAddress()) + minterAccAddr, err := suite.addrCdc.BytesToString(minterAcc.GetAddress()) suite.Require().NoError(err) testCases := []struct { @@ -168,13 +168,13 @@ func (suite *KeeperTestSuite) TestMsgMultiSend() { sendCoins := sdk.NewCoins(sdk.NewInt64Coin(origDenom, 50)) suite.bankKeeper.SetSendEnabled(suite.ctx, origDenom, true) - acc0Addr, err := suite.authKeeper.AddressCodec().BytesToString(accAddrs[0]) + acc0Addr, err := suite.addrCdc.BytesToString(accAddrs[0]) suite.Require().NoError(err) - acc1Addr, err := suite.authKeeper.AddressCodec().BytesToString(accAddrs[1]) + acc1Addr, err := suite.addrCdc.BytesToString(accAddrs[1]) suite.Require().NoError(err) - acc4Addr, err := suite.authKeeper.AddressCodec().BytesToString(accAddrs[4]) + acc4Addr, err := suite.addrCdc.BytesToString(accAddrs[4]) suite.Require().NoError(err) - minterAccAddr, err := suite.authKeeper.AddressCodec().BytesToString(minterAcc.GetAddress()) + minterAccAddr, err := suite.addrCdc.BytesToString(minterAcc.GetAddress()) suite.Require().NoError(err) testCases := []struct { @@ -269,7 +269,7 @@ func (suite *KeeperTestSuite) TestMsgMultiSend() { } func (suite *KeeperTestSuite) TestMsgSetSendEnabled() { - govAccAddr, err := suite.authKeeper.AddressCodec().BytesToString(govAcc.GetAddress()) + govAccAddr, err := suite.addrCdc.BytesToString(govAcc.GetAddress()) suite.Require().NoError(err) testCases := []struct { name string @@ -380,7 +380,7 @@ func (suite *KeeperTestSuite) TestMsgBurn() { origCoins := sdk.NewInt64Coin("eth", 100) atom0 := sdk.NewInt64Coin("atom", 0) - multiPermAccAddr, err := suite.authKeeper.AddressCodec().BytesToString(multiPermAcc.GetAddress()) + multiPermAccAddr, err := suite.addrCdc.BytesToString(multiPermAcc.GetAddress()) suite.Require().NoError(err) testCases := []struct { diff --git a/x/bank/keeper/send.go b/x/bank/keeper/send.go index 929ff2e50285..6afa29b9f21c 100644 --- a/x/bank/keeper/send.go +++ b/x/bank/keeper/send.go @@ -143,7 +143,7 @@ func (k BaseSendKeeper) InputOutputCoins(ctx context.Context, input types.Input, return err } - inAddress, err := k.ak.AddressCodec().StringToBytes(input.Address) + inAddress, err := k.addrCdc.StringToBytes(input.Address) if err != nil { return err } @@ -156,7 +156,7 @@ func (k BaseSendKeeper) InputOutputCoins(ctx context.Context, input types.Input, } sending := make([]toSend, 0) for _, out := range outputs { - outAddress, err := k.ak.AddressCodec().StringToBytes(out.Address) + outAddress, err := k.addrCdc.StringToBytes(out.Address) if err != nil { return err } @@ -218,11 +218,11 @@ func (k BaseSendKeeper) SendCoins(ctx context.Context, fromAddr, toAddr sdk.AccA return err } - fromAddrString, err := k.ak.AddressCodec().BytesToString(fromAddr) + fromAddrString, err := k.addrCdc.BytesToString(fromAddr) if err != nil { return err } - toAddrString, err := k.ak.AddressCodec().BytesToString(toAddr) + toAddrString, err := k.addrCdc.BytesToString(toAddr) if err != nil { return err } @@ -275,7 +275,7 @@ func (k BaseSendKeeper) subUnlockedCoins(ctx context.Context, addr sdk.AccAddres } } - addrStr, err := k.ak.AddressCodec().BytesToString(addr) + addrStr, err := k.addrCdc.BytesToString(addr) if err != nil { return err } @@ -303,7 +303,7 @@ func (k BaseSendKeeper) addCoins(ctx context.Context, addr sdk.AccAddress, amt s } } - addrStr, err := k.ak.AddressCodec().BytesToString(addr) + addrStr, err := k.addrCdc.BytesToString(addr) if err != nil { return err } @@ -359,7 +359,7 @@ func (k BaseSendKeeper) IsSendEnabledCoin(ctx context.Context, coin sdk.Coin) bo // BlockedAddr checks if a given address is restricted from // receiving funds. func (k BaseSendKeeper) BlockedAddr(addr sdk.AccAddress) bool { - addrStr, err := k.ak.AddressCodec().BytesToString(addr) + addrStr, err := k.addrCdc.BytesToString(addr) if err != nil { panic(err) } diff --git a/x/bank/keeper/view.go b/x/bank/keeper/view.go index 54236a60aa07..496e907de8ca 100644 --- a/x/bank/keeper/view.go +++ b/x/bank/keeper/view.go @@ -6,6 +6,7 @@ import ( "cosmossdk.io/collections" "cosmossdk.io/collections/indexes" + "cosmossdk.io/core/address" "cosmossdk.io/core/appmodule" errorsmod "cosmossdk.io/errors" "cosmossdk.io/math" @@ -57,8 +58,9 @@ func (b BalancesIndexes) IndexesList() []collections.Index[collections.Pair[sdk. type BaseViewKeeper struct { appmodule.Environment - cdc codec.BinaryCodec - ak types.AccountKeeper + cdc codec.BinaryCodec + ak types.AccountKeeper + addrCdc address.Codec Schema collections.Schema Supply collections.Map[string, math.Int] @@ -75,6 +77,7 @@ func NewBaseViewKeeper(env appmodule.Environment, cdc codec.BinaryCodec, ak type Environment: env, cdc: cdc, ak: ak, + addrCdc: ak.AddressCodec(), Supply: collections.NewMap(sb, types.SupplyKey, "supply", collections.StringKey, sdk.IntValue), DenomMetadata: collections.NewMap(sb, types.DenomMetadataPrefix, "denom_metadata", collections.StringKey, codec.CollValue[types.Metadata](cdc)), SendEnabled: collections.NewMap(sb, types.SendEnabledPrefix, "send_enabled", collections.StringKey, codec.BoolValue), // NOTE: we use a bool value which uses protobuf to retain state backwards compat @@ -112,7 +115,7 @@ func (k BaseViewKeeper) GetAccountsBalances(ctx context.Context) []types.Balance mapAddressToBalancesIdx := make(map[string]int) k.IterateAllBalances(ctx, func(addr sdk.AccAddress, balance sdk.Coin) bool { - addrStr, err := k.ak.AddressCodec().BytesToString(addr) + addrStr, err := k.addrCdc.BytesToString(addr) if err != nil { panic(err) } diff --git a/x/bank/testutil/expected_keepers_mocks.go b/x/bank/testutil/expected_keepers_mocks.go index aeddace241f3..4b420c3b5c4b 100644 --- a/x/bank/testutil/expected_keepers_mocks.go +++ b/x/bank/testutil/expected_keepers_mocks.go @@ -79,21 +79,6 @@ func (mr *MockAccountKeeperMockRecorder) GetModuleAccount(ctx, moduleName interf return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetModuleAccount", reflect.TypeOf((*MockAccountKeeper)(nil).GetModuleAccount), ctx, moduleName) } -// GetModuleAccountAndPermissions mocks base method. -func (m *MockAccountKeeper) GetModuleAccountAndPermissions(ctx context.Context, moduleName string) (types.ModuleAccountI, []string) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetModuleAccountAndPermissions", ctx, moduleName) - ret0, _ := ret[0].(types.ModuleAccountI) - ret1, _ := ret[1].([]string) - return ret0, ret1 -} - -// GetModuleAccountAndPermissions indicates an expected call of GetModuleAccountAndPermissions. -func (mr *MockAccountKeeperMockRecorder) GetModuleAccountAndPermissions(ctx, moduleName interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetModuleAccountAndPermissions", reflect.TypeOf((*MockAccountKeeper)(nil).GetModuleAccountAndPermissions), ctx, moduleName) -} - // GetModuleAddress mocks base method. func (m *MockAccountKeeper) GetModuleAddress(moduleName string) types.AccAddress { m.ctrl.T.Helper() @@ -108,21 +93,6 @@ func (mr *MockAccountKeeperMockRecorder) GetModuleAddress(moduleName interface{} return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetModuleAddress", reflect.TypeOf((*MockAccountKeeper)(nil).GetModuleAddress), moduleName) } -// GetModuleAddressAndPermissions mocks base method. -func (m *MockAccountKeeper) GetModuleAddressAndPermissions(moduleName string) (types.AccAddress, []string) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetModuleAddressAndPermissions", moduleName) - ret0, _ := ret[0].(types.AccAddress) - ret1, _ := ret[1].([]string) - return ret0, ret1 -} - -// GetModuleAddressAndPermissions indicates an expected call of GetModuleAddressAndPermissions. -func (mr *MockAccountKeeperMockRecorder) GetModuleAddressAndPermissions(moduleName interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetModuleAddressAndPermissions", reflect.TypeOf((*MockAccountKeeper)(nil).GetModuleAddressAndPermissions), moduleName) -} - // GetModulePermissions mocks base method. func (m *MockAccountKeeper) GetModulePermissions() map[string]types0.PermissionsForAddress { m.ctrl.T.Helper() @@ -151,34 +121,6 @@ func (mr *MockAccountKeeperMockRecorder) HasAccount(ctx, addr interface{}) *gomo return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HasAccount", reflect.TypeOf((*MockAccountKeeper)(nil).HasAccount), ctx, addr) } -// NewAccount mocks base method. -func (m *MockAccountKeeper) NewAccount(arg0 context.Context, arg1 types.AccountI) types.AccountI { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NewAccount", arg0, arg1) - ret0, _ := ret[0].(types.AccountI) - return ret0 -} - -// NewAccount indicates an expected call of NewAccount. -func (mr *MockAccountKeeperMockRecorder) NewAccount(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewAccount", reflect.TypeOf((*MockAccountKeeper)(nil).NewAccount), arg0, arg1) -} - -// NewAccountWithAddress mocks base method. -func (m *MockAccountKeeper) NewAccountWithAddress(ctx context.Context, addr types.AccAddress) types.AccountI { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NewAccountWithAddress", ctx, addr) - ret0, _ := ret[0].(types.AccountI) - return ret0 -} - -// NewAccountWithAddress indicates an expected call of NewAccountWithAddress. -func (mr *MockAccountKeeperMockRecorder) NewAccountWithAddress(ctx, addr interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewAccountWithAddress", reflect.TypeOf((*MockAccountKeeper)(nil).NewAccountWithAddress), ctx, addr) -} - // SetAccount mocks base method. func (m *MockAccountKeeper) SetAccount(ctx context.Context, acc types.AccountI) { m.ctrl.T.Helper() @@ -190,29 +132,3 @@ func (mr *MockAccountKeeperMockRecorder) SetAccount(ctx, acc interface{}) *gomoc mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetAccount", reflect.TypeOf((*MockAccountKeeper)(nil).SetAccount), ctx, acc) } - -// SetModuleAccount mocks base method. -func (m *MockAccountKeeper) SetModuleAccount(ctx context.Context, macc types.ModuleAccountI) { - m.ctrl.T.Helper() - m.ctrl.Call(m, "SetModuleAccount", ctx, macc) -} - -// SetModuleAccount indicates an expected call of SetModuleAccount. -func (mr *MockAccountKeeperMockRecorder) SetModuleAccount(ctx, macc interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetModuleAccount", reflect.TypeOf((*MockAccountKeeper)(nil).SetModuleAccount), ctx, macc) -} - -// ValidatePermissions mocks base method. -func (m *MockAccountKeeper) ValidatePermissions(macc types.ModuleAccountI) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ValidatePermissions", macc) - ret0, _ := ret[0].(error) - return ret0 -} - -// ValidatePermissions indicates an expected call of ValidatePermissions. -func (mr *MockAccountKeeperMockRecorder) ValidatePermissions(macc interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidatePermissions", reflect.TypeOf((*MockAccountKeeper)(nil).ValidatePermissions), macc) -} diff --git a/x/bank/types/expected_keepers.go b/x/bank/types/expected_keepers.go index 013530f8116e..288d64a8f17d 100644 --- a/x/bank/types/expected_keepers.go +++ b/x/bank/types/expected_keepers.go @@ -14,18 +14,11 @@ import ( type AccountKeeper interface { AddressCodec() address.Codec - NewAccount(context.Context, sdk.AccountI) sdk.AccountI - NewAccountWithAddress(ctx context.Context, addr sdk.AccAddress) sdk.AccountI - GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI HasAccount(ctx context.Context, addr sdk.AccAddress) bool SetAccount(ctx context.Context, acc sdk.AccountI) - ValidatePermissions(macc sdk.ModuleAccountI) error GetModuleAddress(moduleName string) sdk.AccAddress - GetModuleAddressAndPermissions(moduleName string) (addr sdk.AccAddress, permissions []string) - GetModuleAccountAndPermissions(ctx context.Context, moduleName string) (sdk.ModuleAccountI, []string) GetModuleAccount(ctx context.Context, moduleName string) sdk.ModuleAccountI - SetModuleAccount(ctx context.Context, macc sdk.ModuleAccountI) GetModulePermissions() map[string]types.PermissionsForAddress } diff --git a/x/distribution/keeper/allocation_test.go b/x/distribution/keeper/allocation_test.go index 703840f15e1b..c0b5d1304009 100644 --- a/x/distribution/keeper/allocation_test.go +++ b/x/distribution/keeper/allocation_test.go @@ -57,6 +57,7 @@ func TestAllocateTokensToValidatorWithCommission(t *testing.T) { valCodec := address.NewBech32Codec("cosmosvaloper") accountKeeper.EXPECT().GetModuleAddress("distribution").Return(distrAcc.GetAddress()) + accountKeeper.EXPECT().AddressCodec().Return(cdcOpts.GetAddressCodec()) stakingKeeper.EXPECT().ValidatorAddressCodec().Return(valCodec).AnyTimes() authorityAddr, err := cdcOpts.GetAddressCodec().BytesToString(authtypes.NewModuleAddress("gov")) @@ -120,6 +121,7 @@ func TestAllocateTokensToManyValidators(t *testing.T) { feeCollectorAcc := authtypes.NewEmptyModuleAccount("fee_collector") accountKeeper.EXPECT().GetModuleAddress("distribution").Return(distrAcc.GetAddress()) accountKeeper.EXPECT().GetModuleAccount(gomock.Any(), "fee_collector").Return(feeCollectorAcc) + accountKeeper.EXPECT().AddressCodec().Return(cdcOpts.GetAddressCodec()) stakingKeeper.EXPECT().ValidatorAddressCodec().Return(address.NewBech32Codec("cosmosvaloper")).AnyTimes() env := runtime.NewEnvironment(runtime.NewKVStoreService(key), coretesting.NewNopLogger()) @@ -258,6 +260,7 @@ func TestAllocateTokensTruncation(t *testing.T) { feeCollectorAcc := authtypes.NewEmptyModuleAccount("fee_collector") accountKeeper.EXPECT().GetModuleAddress("distribution").Return(distrAcc.GetAddress()) accountKeeper.EXPECT().GetModuleAccount(gomock.Any(), "fee_collector").Return(feeCollectorAcc) + accountKeeper.EXPECT().AddressCodec().Return(cdcOpts.GetAddressCodec()) stakingKeeper.EXPECT().ValidatorAddressCodec().Return(address.NewBech32Codec("cosmosvaloper")).AnyTimes() env := runtime.NewEnvironment(runtime.NewKVStoreService(key), coretesting.NewNopLogger()) @@ -391,8 +394,10 @@ func TestAllocateTokensToValidatorWithoutCommission(t *testing.T) { env := runtime.NewEnvironment(runtime.NewKVStoreService(key), coretesting.NewNopLogger()) valCodec := address.NewBech32Codec("cosmosvaloper") + addrCdc := address.NewBech32Codec("cosmos") accountKeeper.EXPECT().GetModuleAddress("distribution").Return(distrAcc.GetAddress()) + accountKeeper.EXPECT().AddressCodec().Return(addrCdc) stakingKeeper.EXPECT().ValidatorAddressCodec().Return(valCodec).AnyTimes() authorityAddr, err := cdcOpts.GetAddressCodec().BytesToString(authtypes.NewModuleAddress("gov")) @@ -460,6 +465,7 @@ func TestAllocateTokensWithZeroTokens(t *testing.T) { valCodec := address.NewBech32Codec("cosmosvaloper") accountKeeper.EXPECT().GetModuleAddress("distribution").Return(distrAcc.GetAddress()) + accountKeeper.EXPECT().AddressCodec().Return(cdcOpts.GetAddressCodec()) stakingKeeper.EXPECT().ValidatorAddressCodec().Return(valCodec).AnyTimes() authorityAddr, err := cdcOpts.GetAddressCodec().BytesToString(authtypes.NewModuleAddress("gov")) diff --git a/x/distribution/keeper/delegation.go b/x/distribution/keeper/delegation.go index 1959d3a109f2..b261c2e64a48 100644 --- a/x/distribution/keeper/delegation.go +++ b/x/distribution/keeper/delegation.go @@ -87,7 +87,7 @@ func (k Keeper) calculateDelegationRewardsBetween(ctx context.Context, val sdk.V // CalculateDelegationRewards calculate the total rewards accrued by a delegation func (k Keeper) CalculateDelegationRewards(ctx context.Context, val sdk.ValidatorI, del sdk.DelegationI, endingPeriod uint64) (rewards sdk.DecCoins, err error) { - addrCodec := k.authKeeper.AddressCodec() + addrCodec := k.addrCdc delAddr, err := addrCodec.StringToBytes(del.GetDelegatorAddr()) if err != nil { return sdk.DecCoins{}, err @@ -202,7 +202,7 @@ func (k Keeper) CalculateDelegationRewards(ctx context.Context, val sdk.Validato // withdrawDelegationRewards withdraws the rewards accrued by a delegation. func (k Keeper) withdrawDelegationRewards(ctx context.Context, val sdk.ValidatorI, del sdk.DelegationI) (sdk.Coins, error) { - addrCodec := k.authKeeper.AddressCodec() + addrCodec := k.addrCdc delAddr, err := addrCodec.StringToBytes(del.GetDelegatorAddr()) if err != nil { return nil, err diff --git a/x/distribution/keeper/delegation_test.go b/x/distribution/keeper/delegation_test.go index 8ee03d5f3f3b..f7f5cff97a3e 100644 --- a/x/distribution/keeper/delegation_test.go +++ b/x/distribution/keeper/delegation_test.go @@ -32,6 +32,7 @@ func TestCalculateRewardsBasic(t *testing.T) { testCtx := testutil.DefaultContextWithDB(t, key, storetypes.NewTransientStoreKey("transient_test")) encCfg := moduletestutil.MakeTestEncodingConfig(codectestutil.CodecOptions{}, distribution.AppModule{}) ctx := testCtx.Ctx.WithHeaderInfo(header.Info{Height: 1}) + addrCdc := address.NewBech32Codec(sdk.Bech32MainPrefix) bankKeeper := distrtestutil.NewMockBankKeeper(ctrl) stakingKeeper := distrtestutil.NewMockStakingKeeper(ctrl) @@ -39,11 +40,11 @@ func TestCalculateRewardsBasic(t *testing.T) { accountKeeper.EXPECT().GetModuleAddress("distribution").Return(distrAcc.GetAddress()) stakingKeeper.EXPECT().ValidatorAddressCodec().Return(address.NewBech32Codec(sdk.Bech32PrefixValAddr)).AnyTimes() - accountKeeper.EXPECT().AddressCodec().Return(address.NewBech32Codec(sdk.Bech32MainPrefix)).AnyTimes() + accountKeeper.EXPECT().AddressCodec().Return(addrCdc) env := runtime.NewEnvironment(runtime.NewKVStoreService(key), coretesting.NewNopLogger()) - authorityAddr, err := accountKeeper.AddressCodec().BytesToString(authtypes.NewModuleAddress("gov")) + authorityAddr, err := addrCdc.BytesToString(authtypes.NewModuleAddress("gov")) require.NoError(t, err) distrKeeper := keeper.NewKeeper( @@ -70,7 +71,7 @@ func TestCalculateRewardsBasic(t *testing.T) { require.NoError(t, err) val.Commission = stakingtypes.NewCommission(math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDec(0)) - addrStr, err := accountKeeper.AddressCodec().BytesToString(addr) + addrStr, err := addrCdc.BytesToString(addr) require.NoError(t, err) valAddrStr, err := stakingKeeper.ValidatorAddressCodec().BytesToString(valAddr) require.NoError(t, err) @@ -144,18 +145,18 @@ func TestCalculateRewardsAfterSlash(t *testing.T) { testCtx := testutil.DefaultContextWithDB(t, key, storetypes.NewTransientStoreKey("transient_test")) encCfg := moduletestutil.MakeTestEncodingConfig(codectestutil.CodecOptions{}, distribution.AppModule{}) ctx := testCtx.Ctx.WithHeaderInfo(header.Info{Height: 1}) + addrCdc := address.NewBech32Codec(sdk.Bech32MainPrefix) bankKeeper := distrtestutil.NewMockBankKeeper(ctrl) stakingKeeper := distrtestutil.NewMockStakingKeeper(ctrl) accountKeeper := distrtestutil.NewMockAccountKeeper(ctrl) accountKeeper.EXPECT().GetModuleAddress("distribution").Return(distrAcc.GetAddress()) + accountKeeper.EXPECT().AddressCodec().Return(addrCdc) stakingKeeper.EXPECT().ValidatorAddressCodec().Return(address.NewBech32Codec(sdk.Bech32PrefixValAddr)).AnyTimes() - accountKeeper.EXPECT().AddressCodec().Return(address.NewBech32Codec(sdk.Bech32MainPrefix)).AnyTimes() - env := runtime.NewEnvironment(runtime.NewKVStoreService(key), coretesting.NewNopLogger()) - authorityAddr, err := accountKeeper.AddressCodec().BytesToString(authtypes.NewModuleAddress("gov")) + authorityAddr, err := addrCdc.BytesToString(authtypes.NewModuleAddress("gov")) require.NoError(t, err) distrKeeper := keeper.NewKeeper( @@ -184,7 +185,7 @@ func TestCalculateRewardsAfterSlash(t *testing.T) { require.NoError(t, err) val.Commission = stakingtypes.NewCommission(math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDec(0)) - addrStr, err := accountKeeper.AddressCodec().BytesToString(addr) + addrStr, err := addrCdc.BytesToString(addr) require.NoError(t, err) valAddrStr, err := stakingKeeper.ValidatorAddressCodec().BytesToString(valAddr) require.NoError(t, err) @@ -259,18 +260,19 @@ func TestCalculateRewardsAfterManySlashes(t *testing.T) { testCtx := testutil.DefaultContextWithDB(t, key, storetypes.NewTransientStoreKey("transient_test")) encCfg := moduletestutil.MakeTestEncodingConfig(codectestutil.CodecOptions{}, distribution.AppModule{}) ctx := testCtx.Ctx.WithHeaderInfo(header.Info{Height: 1}) + addrCdc := address.NewBech32Codec(sdk.Bech32MainPrefix) bankKeeper := distrtestutil.NewMockBankKeeper(ctrl) stakingKeeper := distrtestutil.NewMockStakingKeeper(ctrl) accountKeeper := distrtestutil.NewMockAccountKeeper(ctrl) accountKeeper.EXPECT().GetModuleAddress("distribution").Return(distrAcc.GetAddress()) + accountKeeper.EXPECT().AddressCodec().Return(addrCdc) stakingKeeper.EXPECT().ValidatorAddressCodec().Return(address.NewBech32Codec(sdk.Bech32PrefixValAddr)).AnyTimes() - accountKeeper.EXPECT().AddressCodec().Return(address.NewBech32Codec(sdk.Bech32MainPrefix)).AnyTimes() env := runtime.NewEnvironment(runtime.NewKVStoreService(key), coretesting.NewNopLogger()) - authorityAddr, err := accountKeeper.AddressCodec().BytesToString(authtypes.NewModuleAddress("gov")) + authorityAddr, err := addrCdc.BytesToString(authtypes.NewModuleAddress("gov")) require.NoError(t, err) distrKeeper := keeper.NewKeeper( @@ -299,7 +301,7 @@ func TestCalculateRewardsAfterManySlashes(t *testing.T) { require.NoError(t, err) val.Commission = stakingtypes.NewCommission(math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDec(0)) - addrStr, err := accountKeeper.AddressCodec().BytesToString(addr) + addrStr, err := addrCdc.BytesToString(addr) require.NoError(t, err) valAddrStr, err := stakingKeeper.ValidatorAddressCodec().BytesToString(valAddr) require.NoError(t, err) @@ -395,6 +397,7 @@ func TestCalculateRewardsMultiDelegator(t *testing.T) { testCtx := testutil.DefaultContextWithDB(t, key, storetypes.NewTransientStoreKey("transient_test")) encCfg := moduletestutil.MakeTestEncodingConfig(codectestutil.CodecOptions{}, distribution.AppModule{}) ctx := testCtx.Ctx.WithHeaderInfo(header.Info{Height: 1}) + addrCdc := address.NewBech32Codec(sdk.Bech32MainPrefix) bankKeeper := distrtestutil.NewMockBankKeeper(ctrl) stakingKeeper := distrtestutil.NewMockStakingKeeper(ctrl) @@ -402,11 +405,11 @@ func TestCalculateRewardsMultiDelegator(t *testing.T) { accountKeeper.EXPECT().GetModuleAddress("distribution").Return(distrAcc.GetAddress()) stakingKeeper.EXPECT().ValidatorAddressCodec().Return(address.NewBech32Codec(sdk.Bech32PrefixValAddr)).AnyTimes() - accountKeeper.EXPECT().AddressCodec().Return(address.NewBech32Codec(sdk.Bech32MainPrefix)).AnyTimes() + accountKeeper.EXPECT().AddressCodec().Return(addrCdc) env := runtime.NewEnvironment(runtime.NewKVStoreService(key), coretesting.NewNopLogger()) - authorityAddr, err := accountKeeper.AddressCodec().BytesToString(authtypes.NewModuleAddress("gov")) + authorityAddr, err := addrCdc.BytesToString(authtypes.NewModuleAddress("gov")) require.NoError(t, err) distrKeeper := keeper.NewKeeper( @@ -432,7 +435,7 @@ func TestCalculateRewardsMultiDelegator(t *testing.T) { val, err := distrtestutil.CreateValidator(valConsPk0, operatorAddr, math.NewInt(100)) require.NoError(t, err) - addrStr, err := accountKeeper.AddressCodec().BytesToString(addr0) + addrStr, err := addrCdc.BytesToString(addr0) require.NoError(t, err) valAddrStr, err := stakingKeeper.ValidatorAddressCodec().BytesToString(valAddr) require.NoError(t, err) @@ -459,7 +462,7 @@ func TestCalculateRewardsMultiDelegator(t *testing.T) { // second delegation addr1 := sdk.AccAddress(valConsAddr1) - _, del1, err := distrtestutil.Delegate(ctx, distrKeeper, addr1, &val, math.NewInt(100), nil, stakingKeeper, accountKeeper.AddressCodec()) + _, del1, err := distrtestutil.Delegate(ctx, distrKeeper, addr1, &val, math.NewInt(100), nil, stakingKeeper, addrCdc) require.NoError(t, err) stakingKeeper.EXPECT().Delegation(gomock.Any(), addr1, valAddr).Return(del1, nil) @@ -504,6 +507,7 @@ func TestWithdrawDelegationRewardsBasic(t *testing.T) { testCtx := testutil.DefaultContextWithDB(t, key, storetypes.NewTransientStoreKey("transient_test")) encCfg := moduletestutil.MakeTestEncodingConfig(codectestutil.CodecOptions{}, distribution.AppModule{}) ctx := testCtx.Ctx.WithHeaderInfo(header.Info{Height: 1}) + addrCdc := address.NewBech32Codec(sdk.Bech32MainPrefix) bankKeeper := distrtestutil.NewMockBankKeeper(ctrl) stakingKeeper := distrtestutil.NewMockStakingKeeper(ctrl) @@ -511,11 +515,11 @@ func TestWithdrawDelegationRewardsBasic(t *testing.T) { accountKeeper.EXPECT().GetModuleAddress("distribution").Return(distrAcc.GetAddress()) stakingKeeper.EXPECT().ValidatorAddressCodec().Return(address.NewBech32Codec(sdk.Bech32PrefixValAddr)).AnyTimes() - accountKeeper.EXPECT().AddressCodec().Return(address.NewBech32Codec(sdk.Bech32MainPrefix)).AnyTimes() + accountKeeper.EXPECT().AddressCodec().Return(addrCdc) env := runtime.NewEnvironment(runtime.NewKVStoreService(key), coretesting.NewNopLogger()) - authorityAddr, err := accountKeeper.AddressCodec().BytesToString(authtypes.NewModuleAddress("gov")) + authorityAddr, err := addrCdc.BytesToString(authtypes.NewModuleAddress("gov")) require.NoError(t, err) distrKeeper := keeper.NewKeeper( @@ -543,7 +547,7 @@ func TestWithdrawDelegationRewardsBasic(t *testing.T) { val.Commission = stakingtypes.NewCommission(math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDec(0)) - addrStr, err := accountKeeper.AddressCodec().BytesToString(addr) + addrStr, err := addrCdc.BytesToString(addr) require.NoError(t, err) valAddrStr, err := stakingKeeper.ValidatorAddressCodec().BytesToString(valAddr) require.NoError(t, err) @@ -591,6 +595,7 @@ func TestCalculateRewardsAfterManySlashesInSameBlock(t *testing.T) { testCtx := testutil.DefaultContextWithDB(t, key, storetypes.NewTransientStoreKey("transient_test")) encCfg := moduletestutil.MakeTestEncodingConfig(codectestutil.CodecOptions{}, distribution.AppModule{}) ctx := testCtx.Ctx.WithHeaderInfo(header.Info{Height: 1}) + addrCdc := address.NewBech32Codec(sdk.Bech32MainPrefix) bankKeeper := distrtestutil.NewMockBankKeeper(ctrl) stakingKeeper := distrtestutil.NewMockStakingKeeper(ctrl) @@ -598,11 +603,11 @@ func TestCalculateRewardsAfterManySlashesInSameBlock(t *testing.T) { accountKeeper.EXPECT().GetModuleAddress("distribution").Return(distrAcc.GetAddress()) stakingKeeper.EXPECT().ValidatorAddressCodec().Return(address.NewBech32Codec(sdk.Bech32PrefixValAddr)).AnyTimes() - accountKeeper.EXPECT().AddressCodec().Return(address.NewBech32Codec(sdk.Bech32MainPrefix)).AnyTimes() + accountKeeper.EXPECT().AddressCodec().Return(addrCdc) env := runtime.NewEnvironment(runtime.NewKVStoreService(key), coretesting.NewNopLogger()) - authorityAddr, err := accountKeeper.AddressCodec().BytesToString(authtypes.NewModuleAddress("gov")) + authorityAddr, err := addrCdc.BytesToString(authtypes.NewModuleAddress("gov")) require.NoError(t, err) distrKeeper := keeper.NewKeeper( @@ -630,7 +635,7 @@ func TestCalculateRewardsAfterManySlashesInSameBlock(t *testing.T) { val.Commission = stakingtypes.NewCommission(math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDec(0)) - addrStr, err := accountKeeper.AddressCodec().BytesToString(addr) + addrStr, err := addrCdc.BytesToString(addr) require.NoError(t, err) valAddrStr, err := stakingKeeper.ValidatorAddressCodec().BytesToString(valAddr) require.NoError(t, err) @@ -719,6 +724,7 @@ func TestCalculateRewardsMultiDelegatorMultiSlash(t *testing.T) { testCtx := testutil.DefaultContextWithDB(t, key, storetypes.NewTransientStoreKey("transient_test")) encCfg := moduletestutil.MakeTestEncodingConfig(codectestutil.CodecOptions{}, distribution.AppModule{}) ctx := testCtx.Ctx.WithHeaderInfo(header.Info{Height: 1}) + addrCdc := address.NewBech32Codec(sdk.Bech32MainPrefix) bankKeeper := distrtestutil.NewMockBankKeeper(ctrl) stakingKeeper := distrtestutil.NewMockStakingKeeper(ctrl) @@ -726,11 +732,11 @@ func TestCalculateRewardsMultiDelegatorMultiSlash(t *testing.T) { accountKeeper.EXPECT().GetModuleAddress("distribution").Return(distrAcc.GetAddress()) stakingKeeper.EXPECT().ValidatorAddressCodec().Return(address.NewBech32Codec(sdk.Bech32PrefixValAddr)).AnyTimes() - accountKeeper.EXPECT().AddressCodec().Return(address.NewBech32Codec(sdk.Bech32MainPrefix)).AnyTimes() + accountKeeper.EXPECT().AddressCodec().Return(addrCdc) env := runtime.NewEnvironment(runtime.NewKVStoreService(key), coretesting.NewNopLogger()) - authorityAddr, err := accountKeeper.AddressCodec().BytesToString(authtypes.NewModuleAddress("gov")) + authorityAddr, err := addrCdc.BytesToString(authtypes.NewModuleAddress("gov")) require.NoError(t, err) distrKeeper := keeper.NewKeeper( @@ -759,7 +765,7 @@ func TestCalculateRewardsMultiDelegatorMultiSlash(t *testing.T) { require.NoError(t, err) val.Commission = stakingtypes.NewCommission(math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDec(0)) - addrStr, err := accountKeeper.AddressCodec().BytesToString(addr) + addrStr, err := addrCdc.BytesToString(addr) require.NoError(t, err) valAddrStr, err := stakingKeeper.ValidatorAddressCodec().BytesToString(valAddr) require.NoError(t, err) @@ -809,7 +815,7 @@ func TestCalculateRewardsMultiDelegatorMultiSlash(t *testing.T) { sdk.TokensFromConsensusPower(100, sdk.DefaultPowerReduction), nil, stakingKeeper, - accountKeeper.AddressCodec(), + addrCdc, ) require.NoError(t, err) @@ -875,14 +881,15 @@ func TestCalculateRewardsMultiDelegatorMultWithdraw(t *testing.T) { bankKeeper := distrtestutil.NewMockBankKeeper(ctrl) stakingKeeper := distrtestutil.NewMockStakingKeeper(ctrl) accountKeeper := distrtestutil.NewMockAccountKeeper(ctrl) + addrCdc := address.NewBech32Codec(sdk.Bech32MainPrefix) accountKeeper.EXPECT().GetModuleAddress("distribution").Return(distrAcc.GetAddress()) + accountKeeper.EXPECT().AddressCodec().Return(addrCdc) stakingKeeper.EXPECT().ValidatorAddressCodec().Return(address.NewBech32Codec(sdk.Bech32PrefixValAddr)).AnyTimes() - accountKeeper.EXPECT().AddressCodec().Return(address.NewBech32Codec(sdk.Bech32MainPrefix)).AnyTimes() env := runtime.NewEnvironment(runtime.NewKVStoreService(key), coretesting.NewNopLogger()) - authorityAddr, err := accountKeeper.AddressCodec().BytesToString(authtypes.NewModuleAddress("gov")) + authorityAddr, err := addrCdc.BytesToString(authtypes.NewModuleAddress("gov")) require.NoError(t, err) distrKeeper := keeper.NewKeeper( @@ -909,7 +916,7 @@ func TestCalculateRewardsMultiDelegatorMultWithdraw(t *testing.T) { require.NoError(t, err) val.Commission = stakingtypes.NewCommission(math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDec(0)) - addrStr, err := accountKeeper.AddressCodec().BytesToString(addr) + addrStr, err := addrCdc.BytesToString(addr) require.NoError(t, err) valAddrStr, err := stakingKeeper.ValidatorAddressCodec().BytesToString(valAddr) require.NoError(t, err) @@ -944,7 +951,7 @@ func TestCalculateRewardsMultiDelegatorMultWithdraw(t *testing.T) { math.NewInt(100), nil, stakingKeeper, - accountKeeper.AddressCodec(), + addrCdc, ) require.NoError(t, err) @@ -1083,19 +1090,20 @@ func Test100PercentCommissionReward(t *testing.T) { testCtx := testutil.DefaultContextWithDB(t, key, storetypes.NewTransientStoreKey("transient_test")) encCfg := moduletestutil.MakeTestEncodingConfig(codectestutil.CodecOptions{}, distribution.AppModule{}) ctx := testCtx.Ctx.WithHeaderInfo(header.Info{Height: 1}) + addrCdc := address.NewBech32Codec(sdk.Bech32MainPrefix) bankKeeper := distrtestutil.NewMockBankKeeper(ctrl) stakingKeeper := distrtestutil.NewMockStakingKeeper(ctrl) accountKeeper := distrtestutil.NewMockAccountKeeper(ctrl) accountKeeper.EXPECT().GetModuleAddress("distribution").Return(distrAcc.GetAddress()) + accountKeeper.EXPECT().AddressCodec().Return(addrCdc) stakingKeeper.EXPECT().ValidatorAddressCodec().Return(address.NewBech32Codec(sdk.Bech32PrefixValAddr)).AnyTimes() stakingKeeper.EXPECT().BondDenom(gomock.Any()).Return("stake", nil).AnyTimes() - accountKeeper.EXPECT().AddressCodec().Return(address.NewBech32Codec(sdk.Bech32MainPrefix)).AnyTimes() env := runtime.NewEnvironment(runtime.NewKVStoreService(key), coretesting.NewNopLogger()) - authorityAddr, err := accountKeeper.AddressCodec().BytesToString(authtypes.NewModuleAddress("gov")) + authorityAddr, err := addrCdc.BytesToString(authtypes.NewModuleAddress("gov")) require.NoError(t, err) distrKeeper := keeper.NewKeeper( @@ -1122,7 +1130,7 @@ func Test100PercentCommissionReward(t *testing.T) { require.NoError(t, err) val.Commission = stakingtypes.NewCommission(math.LegacyNewDecWithPrec(10, 1), math.LegacyNewDecWithPrec(10, 1), math.LegacyNewDec(0)) - addrStr, err := accountKeeper.AddressCodec().BytesToString(addr) + addrStr, err := addrCdc.BytesToString(addr) require.NoError(t, err) valAddrStr, err := stakingKeeper.ValidatorAddressCodec().BytesToString(valAddr) require.NoError(t, err) diff --git a/x/distribution/keeper/genesis.go b/x/distribution/keeper/genesis.go index b6fa562268e4..41f8a715c163 100644 --- a/x/distribution/keeper/genesis.go +++ b/x/distribution/keeper/genesis.go @@ -23,11 +23,11 @@ func (k Keeper) InitGenesis(ctx context.Context, data types.GenesisState) error } for _, dwi := range data.DelegatorWithdrawInfos { - delegatorAddress, err := k.authKeeper.AddressCodec().StringToBytes(dwi.DelegatorAddress) + delegatorAddress, err := k.addrCdc.StringToBytes(dwi.DelegatorAddress) if err != nil { return err } - withdrawAddress, err := k.authKeeper.AddressCodec().StringToBytes(dwi.WithdrawAddress) + withdrawAddress, err := k.addrCdc.StringToBytes(dwi.WithdrawAddress) if err != nil { return err } @@ -83,7 +83,7 @@ func (k Keeper) InitGenesis(ctx context.Context, data types.GenesisState) error if err != nil { return err } - delegatorAddress, err := k.authKeeper.AddressCodec().StringToBytes(del.DelegatorAddress) + delegatorAddress, err := k.addrCdc.StringToBytes(del.DelegatorAddress) if err != nil { return err } @@ -123,9 +123,6 @@ func (k Keeper) InitGenesis(ctx context.Context, data types.GenesisState) error } balances := k.bankKeeper.GetAllBalances(ctx, moduleAcc.GetAddress()) - if balances.IsZero() { - k.authKeeper.SetModuleAccount(ctx, moduleAcc) - } if !balances.Equal(moduleHoldingsInt) { return fmt.Errorf("distribution module balance does not match the module holdings: %s <-> %s", balances, moduleHoldingsInt) } @@ -146,11 +143,11 @@ func (k Keeper) ExportGenesis(ctx context.Context) (*types.GenesisState, error) var dwi []types.DelegatorWithdrawInfo err = k.DelegatorsWithdrawAddress.Walk(ctx, nil, func(key, value sdk.AccAddress) (stop bool, err error) { - keyAddr, err := k.authKeeper.AddressCodec().BytesToString(key) + keyAddr, err := k.addrCdc.BytesToString(key) if err != nil { return true, err } - valueAddr, err := k.authKeeper.AddressCodec().BytesToString(value) + valueAddr, err := k.addrCdc.BytesToString(value) if err != nil { return true, err } @@ -241,7 +238,7 @@ func (k Keeper) ExportGenesis(ctx context.Context) (*types.GenesisState, error) dels := make([]types.DelegatorStartingInfoRecord, 0) err = k.DelegatorStartingInfo.Walk(ctx, nil, func(key collections.Pair[sdk.ValAddress, sdk.AccAddress], value types.DelegatorStartingInfo) (stop bool, err error) { - delAddr, err := k.authKeeper.AddressCodec().BytesToString(key.K2()) + delAddr, err := k.addrCdc.BytesToString(key.K2()) if err != nil { return true, err } diff --git a/x/distribution/keeper/grpc_query.go b/x/distribution/keeper/grpc_query.go index 5337ec58c342..3af717a16ca5 100644 --- a/x/distribution/keeper/grpc_query.go +++ b/x/distribution/keeper/grpc_query.go @@ -86,7 +86,7 @@ func (k Querier) ValidatorDistributionInfo(ctx context.Context, req *types.Query return nil, err } - operatorAddr, err := k.authKeeper.AddressCodec().BytesToString(delAdr) + operatorAddr, err := k.addrCdc.BytesToString(delAdr) if err != nil { return nil, err } @@ -225,7 +225,7 @@ func (k Querier) DelegationRewards(ctx context.Context, req *types.QueryDelegati return nil, errors.Wrap(types.ErrNoValidatorExists, req.ValidatorAddress) } - delAdr, err := k.authKeeper.AddressCodec().StringToBytes(req.DelegatorAddress) + delAdr, err := k.addrCdc.StringToBytes(req.DelegatorAddress) if err != nil { return nil, err } @@ -264,7 +264,7 @@ func (k Querier) DelegationTotalRewards(ctx context.Context, req *types.QueryDel total := sdk.DecCoins{} var delRewards []types.DelegationDelegatorReward - delAdr, err := k.authKeeper.AddressCodec().StringToBytes(req.DelegatorAddress) + delAdr, err := k.addrCdc.StringToBytes(req.DelegatorAddress) if err != nil { return nil, err } @@ -322,7 +322,7 @@ func (k Querier) DelegatorValidators(ctx context.Context, req *types.QueryDelega return nil, status.Error(codes.InvalidArgument, "empty delegator address") } - delAdr, err := k.authKeeper.AddressCodec().StringToBytes(req.DelegatorAddress) + delAdr, err := k.addrCdc.StringToBytes(req.DelegatorAddress) if err != nil { return nil, err } @@ -351,7 +351,7 @@ func (k Querier) DelegatorWithdrawAddress(ctx context.Context, req *types.QueryD if req.DelegatorAddress == "" { return nil, status.Error(codes.InvalidArgument, "empty delegator address") } - delAdr, err := k.authKeeper.AddressCodec().StringToBytes(req.DelegatorAddress) + delAdr, err := k.addrCdc.StringToBytes(req.DelegatorAddress) if err != nil { return nil, err } @@ -361,7 +361,7 @@ func (k Querier) DelegatorWithdrawAddress(ctx context.Context, req *types.QueryD return nil, err } - addr, err := k.authKeeper.AddressCodec().BytesToString(withdrawAddr) + addr, err := k.addrCdc.BytesToString(withdrawAddr) if err != nil { return nil, err } diff --git a/x/distribution/keeper/invariants.go b/x/distribution/keeper/invariants.go index 04f3294320a0..bf01b4cf644d 100644 --- a/x/distribution/keeper/invariants.go +++ b/x/distribution/keeper/invariants.go @@ -80,7 +80,7 @@ func CanWithdrawInvariant(k Keeper) sdk.Invariant { } for _, del := range allDelegations { - delAddr, err := k.authKeeper.AddressCodec().StringToBytes(del.GetDelegatorAddr()) + delAddr, err := k.addrCdc.StringToBytes(del.GetDelegatorAddr()) if err != nil { panic(err) } diff --git a/x/distribution/keeper/keeper.go b/x/distribution/keeper/keeper.go index 6ee76320f982..a44285055dd4 100644 --- a/x/distribution/keeper/keeper.go +++ b/x/distribution/keeper/keeper.go @@ -7,6 +7,7 @@ import ( "cosmossdk.io/collections" collcodec "cosmossdk.io/collections/codec" + "cosmossdk.io/core/address" "cosmossdk.io/core/appmodule" "cosmossdk.io/core/comet" "cosmossdk.io/core/event" @@ -25,6 +26,7 @@ type Keeper struct { cometService comet.Service cdc codec.BinaryCodec + addrCdc address.Codec authKeeper types.AccountKeeper bankKeeper types.BankKeeper stakingKeeper types.StakingKeeper @@ -76,6 +78,7 @@ func NewKeeper( Environment: env, cometService: cometService, cdc: cdc, + addrCdc: ak.AddressCodec(), authKeeper: ak, bankKeeper: bk, stakingKeeper: sk, @@ -163,7 +166,7 @@ func (k Keeper) SetWithdrawAddr(ctx context.Context, delegatorAddr, withdrawAddr return types.ErrSetWithdrawAddrDisabled } - addr, err := k.authKeeper.AddressCodec().BytesToString(withdrawAddr) + addr, err := k.addrCdc.BytesToString(withdrawAddr) if err != nil { return err } diff --git a/x/distribution/keeper/keeper_test.go b/x/distribution/keeper/keeper_test.go index 589b738a0b57..0d57217a407f 100644 --- a/x/distribution/keeper/keeper_test.go +++ b/x/distribution/keeper/keeper_test.go @@ -47,8 +47,8 @@ func initFixture(t *testing.T) (sdk.Context, []sdk.AccAddress, keeper.Keeper, de stakingKeeper := distrtestutil.NewMockStakingKeeper(ctrl) accountKeeper := distrtestutil.NewMockAccountKeeper(ctrl) + accountKeeper.EXPECT().AddressCodec().Return(cdcOpts.GetAddressCodec()).AnyTimes() accountKeeper.EXPECT().GetModuleAddress("distribution").Return(distrAcc.GetAddress()) - accountKeeper.EXPECT().AddressCodec().Return(address.NewBech32Codec("cosmos")).AnyTimes() stakingKeeper.EXPECT().ValidatorAddressCodec().Return(address.NewBech32Codec("cosmosvaloper")).AnyTimes() diff --git a/x/distribution/keeper/msg_server.go b/x/distribution/keeper/msg_server.go index 5d1fbdcba553..370529b95be2 100644 --- a/x/distribution/keeper/msg_server.go +++ b/x/distribution/keeper/msg_server.go @@ -24,12 +24,12 @@ func NewMsgServerImpl(keeper Keeper) types.MsgServer { } func (k msgServer) SetWithdrawAddress(ctx context.Context, msg *types.MsgSetWithdrawAddress) (*types.MsgSetWithdrawAddressResponse, error) { - delegatorAddress, err := k.authKeeper.AddressCodec().StringToBytes(msg.DelegatorAddress) + delegatorAddress, err := k.addrCdc.StringToBytes(msg.DelegatorAddress) if err != nil { return nil, sdkerrors.ErrInvalidAddress.Wrapf("invalid delegator address: %s", err) } - withdrawAddress, err := k.authKeeper.AddressCodec().StringToBytes(msg.WithdrawAddress) + withdrawAddress, err := k.addrCdc.StringToBytes(msg.WithdrawAddress) if err != nil { return nil, sdkerrors.ErrInvalidAddress.Wrapf("invalid withdraw address: %s", err) } @@ -48,7 +48,7 @@ func (k msgServer) WithdrawDelegatorReward(ctx context.Context, msg *types.MsgWi return nil, sdkerrors.ErrInvalidAddress.Wrapf("invalid validator address: %s", err) } - delegatorAddress, err := k.authKeeper.AddressCodec().StringToBytes(msg.DelegatorAddress) + delegatorAddress, err := k.addrCdc.StringToBytes(msg.DelegatorAddress) if err != nil { return nil, sdkerrors.ErrInvalidAddress.Wrapf("invalid delegator address: %s", err) } @@ -78,7 +78,7 @@ func (k msgServer) WithdrawValidatorCommission(ctx context.Context, msg *types.M // Deprecated: DO NOT USE // This method uses deprecated message request. Use FundCommunityPool from x/protocolpool module instead. func (k msgServer) FundCommunityPool(ctx context.Context, msg *types.MsgFundCommunityPool) (*types.MsgFundCommunityPoolResponse, error) { - depositor, err := k.authKeeper.AddressCodec().StringToBytes(msg.Depositor) + depositor, err := k.addrCdc.StringToBytes(msg.Depositor) if err != nil { return nil, sdkerrors.ErrInvalidAddress.Wrapf("invalid depositor address: %s", err) } @@ -126,7 +126,7 @@ func (k msgServer) CommunityPoolSpend(ctx context.Context, msg *types.MsgCommuni return nil, err } - recipient, err := k.authKeeper.AddressCodec().StringToBytes(msg.Recipient) + recipient, err := k.addrCdc.StringToBytes(msg.Recipient) if err != nil { return nil, fmt.Errorf("invalid recipient address: %w", err) } @@ -141,7 +141,7 @@ func (k msgServer) CommunityPoolSpend(ctx context.Context, msg *types.MsgCommuni } func (k msgServer) DepositValidatorRewardsPool(ctx context.Context, msg *types.MsgDepositValidatorRewardsPool) (*types.MsgDepositValidatorRewardsPoolResponse, error) { - depositor, err := k.authKeeper.AddressCodec().StringToBytes(msg.Depositor) + depositor, err := k.addrCdc.StringToBytes(msg.Depositor) if err != nil { return nil, fmt.Errorf("invalid depositor address: %w", err) } @@ -183,7 +183,7 @@ func (k msgServer) DepositValidatorRewardsPool(ctx context.Context, msg *types.M } func (k *Keeper) validateAuthority(authority string) error { - if _, err := k.authKeeper.AddressCodec().StringToBytes(authority); err != nil { + if _, err := k.addrCdc.StringToBytes(authority); err != nil { return sdkerrors.ErrInvalidAddress.Wrapf("invalid authority address: %s", err) } diff --git a/x/distribution/testutil/expected_keepers_mocks.go b/x/distribution/testutil/expected_keepers_mocks.go index e30590d865e9..d702ed78a61a 100644 --- a/x/distribution/testutil/expected_keepers_mocks.go +++ b/x/distribution/testutil/expected_keepers_mocks.go @@ -51,20 +51,6 @@ func (mr *MockAccountKeeperMockRecorder) AddressCodec() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddressCodec", reflect.TypeOf((*MockAccountKeeper)(nil).AddressCodec)) } -// GetAccount mocks base method. -func (m *MockAccountKeeper) GetAccount(ctx context.Context, addr types0.AccAddress) types0.AccountI { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetAccount", ctx, addr) - ret0, _ := ret[0].(types0.AccountI) - return ret0 -} - -// GetAccount indicates an expected call of GetAccount. -func (mr *MockAccountKeeperMockRecorder) GetAccount(ctx, addr interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccount", reflect.TypeOf((*MockAccountKeeper)(nil).GetAccount), ctx, addr) -} - // GetModuleAccount mocks base method. func (m *MockAccountKeeper) GetModuleAccount(ctx context.Context, name string) types0.ModuleAccountI { m.ctrl.T.Helper() @@ -93,18 +79,6 @@ func (mr *MockAccountKeeperMockRecorder) GetModuleAddress(name interface{}) *gom return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetModuleAddress", reflect.TypeOf((*MockAccountKeeper)(nil).GetModuleAddress), name) } -// SetModuleAccount mocks base method. -func (m *MockAccountKeeper) SetModuleAccount(arg0 context.Context, arg1 types0.ModuleAccountI) { - m.ctrl.T.Helper() - m.ctrl.Call(m, "SetModuleAccount", arg0, arg1) -} - -// SetModuleAccount indicates an expected call of SetModuleAccount. -func (mr *MockAccountKeeperMockRecorder) SetModuleAccount(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetModuleAccount", reflect.TypeOf((*MockAccountKeeper)(nil).SetModuleAccount), arg0, arg1) -} - // MockBankKeeper is a mock of BankKeeper interface. type MockBankKeeper struct { ctrl *gomock.Controller diff --git a/x/distribution/types/expected_keepers.go b/x/distribution/types/expected_keepers.go index 8288f2206280..e7ec583b9de5 100644 --- a/x/distribution/types/expected_keepers.go +++ b/x/distribution/types/expected_keepers.go @@ -12,11 +12,8 @@ import ( // AccountKeeper defines the expected account keeper used for simulations (noalias) type AccountKeeper interface { AddressCodec() address.Codec - GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI GetModuleAddress(name string) sdk.AccAddress GetModuleAccount(ctx context.Context, name string) sdk.ModuleAccountI - // TODO remove with genesis 2-phases refactor https://github.com/cosmos/cosmos-sdk/issues/2862 - SetModuleAccount(context.Context, sdk.ModuleAccountI) } // BankKeeper defines the expected interface needed to retrieve account balances. diff --git a/x/feegrant/CHANGELOG.md b/x/feegrant/CHANGELOG.md index 9f565f739cb0..a3a9d036f5c3 100644 --- a/x/feegrant/CHANGELOG.md +++ b/x/feegrant/CHANGELOG.md @@ -31,6 +31,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### API Breaking Changes +* [#21651](https://github.com/cosmos/cosmos-sdk/pull/21651) NewKeeper receives an address.Codec instead of an x/auth keeper. * [#21377](https://github.com/cosmos/cosmos-sdk/pull/21377) Simulation API breaking changes: * `SimulateMsgGrantAllowance` and `SimulateMsgRevokeAllowance` no longer require a `ProtoCodec` parameter. * `WeightedOperations` functions no longer require `ProtoCodec`, `JSONCodec`, or `address.Codec` parameters. diff --git a/x/feegrant/expected_keepers.go b/x/feegrant/expected_keepers.go index ce6a2d0a5698..9f0591ad3ffc 100644 --- a/x/feegrant/expected_keepers.go +++ b/x/feegrant/expected_keepers.go @@ -3,23 +3,9 @@ package feegrant import ( "context" - "cosmossdk.io/core/address" - sdk "github.com/cosmos/cosmos-sdk/types" ) -// AccountKeeper defines the expected auth Account Keeper (noalias) -type AccountKeeper interface { - AddressCodec() address.Codec - - GetModuleAddress(moduleName string) sdk.AccAddress - GetModuleAccount(ctx context.Context, moduleName string) sdk.ModuleAccountI - - NewAccountWithAddress(ctx context.Context, addr sdk.AccAddress) sdk.AccountI - GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI - SetAccount(ctx context.Context, acc sdk.AccountI) -} - // BankKeeper defines the expected supply Keeper (noalias) type BankKeeper interface { SpendableCoins(ctx context.Context, addr sdk.AccAddress) sdk.Coins diff --git a/x/feegrant/keeper/genesis_test.go b/x/feegrant/keeper/genesis_test.go index dd2a1eb27bfc..68edd5915808 100644 --- a/x/feegrant/keeper/genesis_test.go +++ b/x/feegrant/keeper/genesis_test.go @@ -4,18 +4,17 @@ import ( "errors" "testing" - "github.com/golang/mock/gomock" "gotest.tools/v3/assert" + address "cosmossdk.io/core/address" coretesting "cosmossdk.io/core/testing" "cosmossdk.io/math" storetypes "cosmossdk.io/store/types" "cosmossdk.io/x/feegrant" "cosmossdk.io/x/feegrant/keeper" "cosmossdk.io/x/feegrant/module" - feegranttestutil "cosmossdk.io/x/feegrant/testutil" - "github.com/cosmos/cosmos-sdk/codec/address" + addresscodec "github.com/cosmos/cosmos-sdk/codec/address" codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil" codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" @@ -24,7 +23,6 @@ import ( "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) var ( @@ -37,7 +35,7 @@ var ( type genesisFixture struct { ctx sdk.Context feegrantKeeper keeper.Keeper - accountKeeper *feegranttestutil.MockAccountKeeper + addrCdc address.Codec } func initFixture(t *testing.T) *genesisFixture { @@ -46,22 +44,18 @@ func initFixture(t *testing.T) *genesisFixture { testCtx := testutil.DefaultContextWithDB(t, key, storetypes.NewTransientStoreKey("transient_test")) encCfg := moduletestutil.MakeTestEncodingConfig(codectestutil.CodecOptions{}, module.AppModule{}) - ctrl := gomock.NewController(t) - accountKeeper := feegranttestutil.NewMockAccountKeeper(ctrl) - accountKeeper.EXPECT().AddressCodec().Return(address.NewBech32Codec("cosmos")).AnyTimes() + addrCdc := addresscodec.NewBech32Codec(sdk.Bech32MainPrefix) return &genesisFixture{ ctx: testCtx.Ctx, - feegrantKeeper: keeper.NewKeeper(runtime.NewEnvironment(runtime.NewKVStoreService(key), coretesting.NewNopLogger()), encCfg.Codec, accountKeeper), - accountKeeper: accountKeeper, + feegrantKeeper: keeper.NewKeeper(runtime.NewEnvironment(runtime.NewKVStoreService(key), coretesting.NewNopLogger()), encCfg.Codec, addrCdc), + addrCdc: addrCdc, } } func TestImportExportGenesis(t *testing.T) { f := initFixture(t) - f.accountKeeper.EXPECT().GetAccount(gomock.Any(), granteeAddr).Return(authtypes.NewBaseAccountWithAddress(granteeAddr)).AnyTimes() - coins := sdk.NewCoins(sdk.NewCoin("foo", math.NewInt(1_000))) now := f.ctx.HeaderInfo().Time oneYear := now.AddDate(1, 0, 0) @@ -74,9 +68,9 @@ func TestImportExportGenesis(t *testing.T) { genesis, err := f.feegrantKeeper.ExportGenesis(f.ctx) assert.NilError(t, err) - granter, err := f.accountKeeper.AddressCodec().BytesToString(granterAddr.Bytes()) + granter, err := f.addrCdc.BytesToString(granterAddr.Bytes()) assert.NilError(t, err) - grantee, err := f.accountKeeper.AddressCodec().BytesToString(granteeAddr.Bytes()) + grantee, err := f.addrCdc.BytesToString(granteeAddr.Bytes()) assert.NilError(t, err) // revoke fee allowance @@ -98,7 +92,7 @@ func TestInitGenesis(t *testing.T) { any, err := codectypes.NewAnyWithValue(&testdata.Dog{}) assert.NilError(t, err) - ac := address.NewBech32Codec("cosmos") + ac := addresscodec.NewBech32Codec("cosmos") granter, err := ac.BytesToString(granterAddr.Bytes()) assert.NilError(t, err) diff --git a/x/feegrant/keeper/grpc_query.go b/x/feegrant/keeper/grpc_query.go index f5ff7df04370..09c21cf88c58 100644 --- a/x/feegrant/keeper/grpc_query.go +++ b/x/feegrant/keeper/grpc_query.go @@ -23,12 +23,12 @@ func (q Keeper) Allowance(ctx context.Context, req *feegrant.QueryAllowanceReque return nil, status.Error(codes.InvalidArgument, "invalid request") } - granterAddr, err := q.authKeeper.AddressCodec().StringToBytes(req.Granter) + granterAddr, err := q.addrCdc.StringToBytes(req.Granter) if err != nil { return nil, err } - granteeAddr, err := q.authKeeper.AddressCodec().StringToBytes(req.Grantee) + granteeAddr, err := q.addrCdc.StringToBytes(req.Grantee) if err != nil { return nil, err } @@ -63,7 +63,7 @@ func (q Keeper) Allowances(c context.Context, req *feegrant.QueryAllowancesReque return nil, status.Error(codes.InvalidArgument, "invalid request") } - granteeAddr, err := q.authKeeper.AddressCodec().StringToBytes(req.Grantee) + granteeAddr, err := q.addrCdc.StringToBytes(req.Grantee) if err != nil { return nil, err } @@ -91,7 +91,7 @@ func (q Keeper) AllowancesByGranter(c context.Context, req *feegrant.QueryAllowa return nil, status.Error(codes.InvalidArgument, "invalid request") } - granterAddr, err := q.authKeeper.AddressCodec().StringToBytes(req.Granter) + granterAddr, err := q.addrCdc.StringToBytes(req.Granter) if err != nil { return nil, err } diff --git a/x/feegrant/keeper/keeper.go b/x/feegrant/keeper/keeper.go index 30e47ae36086..6db74f1022d5 100644 --- a/x/feegrant/keeper/keeper.go +++ b/x/feegrant/keeper/keeper.go @@ -5,6 +5,7 @@ import ( "time" "cosmossdk.io/collections" + "cosmossdk.io/core/address" "cosmossdk.io/core/appmodule" corecontext "cosmossdk.io/core/context" "cosmossdk.io/core/event" @@ -22,9 +23,9 @@ import ( type Keeper struct { appmodule.Environment - cdc codec.BinaryCodec - authKeeper feegrant.AccountKeeper - Schema collections.Schema + cdc codec.BinaryCodec + addrCdc address.Codec + Schema collections.Schema // FeeAllowance key: grantee+granter | value: Grant FeeAllowance collections.Map[collections.Pair[sdk.AccAddress, sdk.AccAddress], feegrant.Grant] // FeeAllowanceQueue key: expiration time+grantee+granter | value: bool @@ -34,13 +35,13 @@ type Keeper struct { var _ ante.FeegrantKeeper = &Keeper{} // NewKeeper creates a feegrant Keeper -func NewKeeper(env appmodule.Environment, cdc codec.BinaryCodec, ak feegrant.AccountKeeper) Keeper { +func NewKeeper(env appmodule.Environment, cdc codec.BinaryCodec, addrCdc address.Codec) Keeper { sb := collections.NewSchemaBuilder(env.KVStoreService) return Keeper{ Environment: env, cdc: cdc, - authKeeper: ak, + addrCdc: addrCdc, FeeAllowance: collections.NewMap( sb, feegrant.FeeAllowanceKeyPrefix, @@ -85,11 +86,11 @@ func (k Keeper) GrantAllowance(ctx context.Context, granter, grantee sdk.AccAddr } } - granterStr, err := k.authKeeper.AddressCodec().BytesToString(granter) + granterStr, err := k.addrCdc.BytesToString(granter) if err != nil { return err } - granteeStr, err := k.authKeeper.AddressCodec().BytesToString(grantee) + granteeStr, err := k.addrCdc.BytesToString(grantee) if err != nil { return err } @@ -126,11 +127,11 @@ func (k Keeper) UpdateAllowance(ctx context.Context, granter, grantee sdk.AccAdd return err } - granterStr, err := k.authKeeper.AddressCodec().BytesToString(granter) + granterStr, err := k.addrCdc.BytesToString(granter) if err != nil { return err } - granteeStr, err := k.authKeeper.AddressCodec().BytesToString(grantee) + granteeStr, err := k.addrCdc.BytesToString(grantee) if err != nil { return err } @@ -173,11 +174,11 @@ func (k Keeper) revokeAllowance(ctx context.Context, granter, grantee sdk.AccAdd } } - granterStr, err := k.authKeeper.AddressCodec().BytesToString(granter) + granterStr, err := k.addrCdc.BytesToString(granter) if err != nil { return err } - granteeStr, err := k.authKeeper.AddressCodec().BytesToString(grantee) + granteeStr, err := k.addrCdc.BytesToString(grantee) if err != nil { return err } @@ -217,11 +218,11 @@ func (k Keeper) UseGrantedFees(ctx context.Context, granter, grantee sdk.AccAddr return err } - granterStr, err := k.authKeeper.AddressCodec().BytesToString(granter) + granterStr, err := k.addrCdc.BytesToString(granter) if err != nil { return err } - granteeStr, err := k.authKeeper.AddressCodec().BytesToString(grantee) + granteeStr, err := k.addrCdc.BytesToString(grantee) if err != nil { return err } @@ -255,11 +256,11 @@ func (k *Keeper) emitUseGrantEvent(ctx context.Context, granter, grantee string) // InitGenesis will initialize the keeper from a *previously validated* GenesisState func (k Keeper) InitGenesis(ctx context.Context, data *feegrant.GenesisState) error { for _, f := range data.Allowances { - granter, err := k.authKeeper.AddressCodec().StringToBytes(f.Granter) + granter, err := k.addrCdc.StringToBytes(f.Granter) if err != nil { return err } - grantee, err := k.authKeeper.AddressCodec().StringToBytes(f.Grantee) + grantee, err := k.addrCdc.StringToBytes(f.Grantee) if err != nil { return err } diff --git a/x/feegrant/keeper/keeper_test.go b/x/feegrant/keeper/keeper_test.go index af5cde5dc663..7b9ed26b5d50 100644 --- a/x/feegrant/keeper/keeper_test.go +++ b/x/feegrant/keeper/keeper_test.go @@ -3,7 +3,6 @@ package keeper_test import ( "testing" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" "cosmossdk.io/core/header" @@ -13,7 +12,6 @@ import ( "cosmossdk.io/x/feegrant" "cosmossdk.io/x/feegrant/keeper" "cosmossdk.io/x/feegrant/module" - feegranttestutil "cosmossdk.io/x/feegrant/testutil" codecaddress "github.com/cosmos/cosmos-sdk/codec/address" codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil" @@ -22,7 +20,6 @@ import ( simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) type KeeperTestSuite struct { @@ -34,7 +31,6 @@ type KeeperTestSuite struct { msgSrvr feegrant.MsgServer atom sdk.Coins feegrantKeeper keeper.Keeper - accountKeeper *feegranttestutil.MockAccountKeeper } func TestKeeperTestSuite(t *testing.T) { @@ -48,21 +44,14 @@ func (suite *KeeperTestSuite) SetupTest() { encCfg := moduletestutil.MakeTestEncodingConfig(codectestutil.CodecOptions{}, module.AppModule{}) // setup gomock and initialize some globally expected executions - ctrl := gomock.NewController(suite.T()) - suite.accountKeeper = feegranttestutil.NewMockAccountKeeper(ctrl) - for i := 0; i < len(suite.addrs); i++ { - suite.accountKeeper.EXPECT().GetAccount(gomock.Any(), suite.addrs[i]).Return(authtypes.NewBaseAccountWithAddress(suite.addrs[i])).AnyTimes() - } - ac := codecaddress.NewBech32Codec("cosmos") - suite.accountKeeper.EXPECT().AddressCodec().Return(ac).AnyTimes() for _, addr := range suite.addrs { str, err := ac.BytesToString(addr) suite.Require().NoError(err) suite.encodedAddrs = append(suite.encodedAddrs, str) } - suite.feegrantKeeper = keeper.NewKeeper(runtime.NewEnvironment(runtime.NewKVStoreService(key), coretesting.NewNopLogger()), encCfg.Codec, suite.accountKeeper) + suite.feegrantKeeper = keeper.NewKeeper(runtime.NewEnvironment(runtime.NewKVStoreService(key), coretesting.NewNopLogger()), encCfg.Codec, ac) suite.ctx = testCtx.Ctx suite.msgSrvr = keeper.NewMsgServerImpl(suite.feegrantKeeper) suite.atom = sdk.NewCoins(sdk.NewCoin("atom", sdkmath.NewInt(555))) @@ -181,7 +170,6 @@ func (suite *KeeperTestSuite) TestKeeperCrud() { address := "cosmos1rxr4mq58w3gtnx5tsc438mwjjafv3mja7k5pnu" accAddr, err := codecaddress.NewBech32Codec("cosmos").StringToBytes(address) suite.Require().NoError(err) - suite.accountKeeper.EXPECT().GetAccount(gomock.Any(), accAddr).Return(authtypes.NewBaseAccountWithAddress(accAddr)).AnyTimes() // let's grant and revoke authorization to non existing account err = suite.feegrantKeeper.GrantAllowance(suite.ctx, suite.addrs[3], accAddr, basic2) diff --git a/x/feegrant/keeper/msg_server.go b/x/feegrant/keeper/msg_server.go index 79e4405ccfb9..e18a1f8f3dce 100644 --- a/x/feegrant/keeper/msg_server.go +++ b/x/feegrant/keeper/msg_server.go @@ -31,12 +31,12 @@ func (k msgServer) GrantAllowance(ctx context.Context, msg *feegrant.MsgGrantAll return nil, errorsmod.Wrap(sdkerrors.ErrInvalidAddress, "cannot self-grant fee authorization") } - grantee, err := k.authKeeper.AddressCodec().StringToBytes(msg.Grantee) + grantee, err := k.addrCdc.StringToBytes(msg.Grantee) if err != nil { return nil, err } - granter, err := k.authKeeper.AddressCodec().StringToBytes(msg.Granter) + granter, err := k.addrCdc.StringToBytes(msg.Granter) if err != nil { return nil, err } @@ -68,12 +68,12 @@ func (k msgServer) RevokeAllowance(ctx context.Context, msg *feegrant.MsgRevokeA return nil, errorsmod.Wrap(sdkerrors.ErrInvalidAddress, "addresses must be different") } - grantee, err := k.authKeeper.AddressCodec().StringToBytes(msg.Grantee) + grantee, err := k.addrCdc.StringToBytes(msg.Grantee) if err != nil { return nil, err } - granter, err := k.authKeeper.AddressCodec().StringToBytes(msg.Granter) + granter, err := k.addrCdc.StringToBytes(msg.Granter) if err != nil { return nil, err } diff --git a/x/feegrant/keeper/msg_server_test.go b/x/feegrant/keeper/msg_server_test.go index 2e4e8f405c80..62fa1aa65079 100644 --- a/x/feegrant/keeper/msg_server_test.go +++ b/x/feegrant/keeper/msg_server_test.go @@ -3,16 +3,12 @@ package keeper_test import ( "time" - "github.com/golang/mock/gomock" - "cosmossdk.io/collections" "cosmossdk.io/core/header" "cosmossdk.io/x/feegrant" - codecaddress "github.com/cosmos/cosmos-sdk/codec/address" codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) func (suite *KeeperTestSuite) TestGrantAllowance() { @@ -20,8 +16,6 @@ func (suite *KeeperTestSuite) TestGrantAllowance() { oneYear := ctx.HeaderInfo().Time.AddDate(1, 0, 0) yesterday := ctx.HeaderInfo().Time.AddDate(0, 0, -1) - addressCodec := codecaddress.NewBech32Codec("cosmos") - testCases := []struct { name string req func() *feegrant.MsgGrantAllowance @@ -62,22 +56,12 @@ func (suite *KeeperTestSuite) TestGrantAllowance() { name: "valid: grantee account doesn't exist", req: func() *feegrant.MsgGrantAllowance { grantee := "cosmos139f7kncmglres2nf3h4hc4tade85ekfr8sulz5" - granteeAccAddr, err := addressCodec.StringToBytes(grantee) - suite.Require().NoError(err) any, err := codectypes.NewAnyWithValue(&feegrant.BasicAllowance{ SpendLimit: suite.atom, Expiration: &oneYear, }) suite.Require().NoError(err) - suite.accountKeeper.EXPECT().GetAccount(gomock.Any(), granteeAccAddr).Return(nil).AnyTimes() - - acc := authtypes.NewBaseAccountWithAddress(granteeAccAddr) - add, err := addressCodec.StringToBytes(grantee) - suite.Require().NoError(err) - - suite.accountKeeper.EXPECT().NewAccountWithAddress(gomock.Any(), add).Return(acc).AnyTimes() - suite.Require().NoError(err) return &feegrant.MsgGrantAllowance{ Granter: suite.encodedAddrs[0], diff --git a/x/feegrant/module/abci_test.go b/x/feegrant/module/abci_test.go index 12f65c24c89f..0faa384493c8 100644 --- a/x/feegrant/module/abci_test.go +++ b/x/feegrant/module/abci_test.go @@ -3,7 +3,6 @@ package module_test import ( "testing" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" "cosmossdk.io/core/header" @@ -13,7 +12,6 @@ import ( "cosmossdk.io/x/feegrant" "cosmossdk.io/x/feegrant/keeper" "cosmossdk.io/x/feegrant/module" - feegranttestutil "cosmossdk.io/x/feegrant/testutil" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec/address" @@ -23,7 +21,6 @@ import ( simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) func TestFeegrantPruning(t *testing.T) { @@ -40,18 +37,11 @@ func TestFeegrantPruning(t *testing.T) { now := testCtx.Ctx.HeaderInfo().Time oneDay := now.AddDate(0, 0, 1) - ctrl := gomock.NewController(t) - accountKeeper := feegranttestutil.NewMockAccountKeeper(ctrl) - accountKeeper.EXPECT().GetAccount(gomock.Any(), grantee).Return(authtypes.NewBaseAccountWithAddress(grantee)).AnyTimes() - accountKeeper.EXPECT().GetAccount(gomock.Any(), granter1).Return(authtypes.NewBaseAccountWithAddress(granter1)).AnyTimes() - accountKeeper.EXPECT().GetAccount(gomock.Any(), granter2).Return(authtypes.NewBaseAccountWithAddress(granter2)).AnyTimes() - accountKeeper.EXPECT().GetAccount(gomock.Any(), granter3).Return(authtypes.NewBaseAccountWithAddress(granter3)).AnyTimes() ac := address.NewBech32Codec("cosmos") - accountKeeper.EXPECT().AddressCodec().Return(ac).AnyTimes() env := runtime.NewEnvironment(runtime.NewKVStoreService(key), coretesting.NewNopLogger()) - feegrantKeeper := keeper.NewKeeper(env, encCfg.Codec, accountKeeper) + feegrantKeeper := keeper.NewKeeper(env, encCfg.Codec, ac) err := feegrantKeeper.GrantAllowance( testCtx.Ctx, diff --git a/x/feegrant/module/depinject.go b/x/feegrant/module/depinject.go index 613d51a14743..85b7508468c5 100644 --- a/x/feegrant/module/depinject.go +++ b/x/feegrant/module/depinject.go @@ -2,6 +2,7 @@ package module import ( modulev1 "cosmossdk.io/api/cosmos/feegrant/module/v1" + "cosmossdk.io/core/address" "cosmossdk.io/core/appmodule" "cosmossdk.io/depinject" "cosmossdk.io/depinject/appconfig" @@ -30,15 +31,15 @@ func init() { type FeegrantInputs struct { depinject.In - Environment appmodule.Environment - Cdc codec.Codec - AccountKeeper feegrant.AccountKeeper - BankKeeper feegrant.BankKeeper - Registry cdctypes.InterfaceRegistry + Environment appmodule.Environment + Cdc codec.Codec + AddressCodec address.Codec + BankKeeper feegrant.BankKeeper + Registry cdctypes.InterfaceRegistry } func ProvideModule(in FeegrantInputs) (keeper.Keeper, appmodule.AppModule) { - k := keeper.NewKeeper(in.Environment, in.Cdc, in.AccountKeeper) + k := keeper.NewKeeper(in.Environment, in.Cdc, in.AddressCodec) m := NewAppModule(in.Cdc, k, in.Registry) return k, m } diff --git a/x/feegrant/testutil/expected_keepers_mocks.go b/x/feegrant/testutil/expected_keepers_mocks.go index d7567b8266d3..d1149afa8503 100644 --- a/x/feegrant/testutil/expected_keepers_mocks.go +++ b/x/feegrant/testutil/expected_keepers_mocks.go @@ -8,116 +8,10 @@ import ( context "context" reflect "reflect" - address "cosmossdk.io/core/address" types "github.com/cosmos/cosmos-sdk/types" gomock "github.com/golang/mock/gomock" ) -// MockAccountKeeper is a mock of AccountKeeper interface. -type MockAccountKeeper struct { - ctrl *gomock.Controller - recorder *MockAccountKeeperMockRecorder -} - -// MockAccountKeeperMockRecorder is the mock recorder for MockAccountKeeper. -type MockAccountKeeperMockRecorder struct { - mock *MockAccountKeeper -} - -// NewMockAccountKeeper creates a new mock instance. -func NewMockAccountKeeper(ctrl *gomock.Controller) *MockAccountKeeper { - mock := &MockAccountKeeper{ctrl: ctrl} - mock.recorder = &MockAccountKeeperMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockAccountKeeper) EXPECT() *MockAccountKeeperMockRecorder { - return m.recorder -} - -// AddressCodec mocks base method. -func (m *MockAccountKeeper) AddressCodec() address.Codec { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddressCodec") - ret0, _ := ret[0].(address.Codec) - return ret0 -} - -// AddressCodec indicates an expected call of AddressCodec. -func (mr *MockAccountKeeperMockRecorder) AddressCodec() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddressCodec", reflect.TypeOf((*MockAccountKeeper)(nil).AddressCodec)) -} - -// GetAccount mocks base method. -func (m *MockAccountKeeper) GetAccount(ctx context.Context, addr types.AccAddress) types.AccountI { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetAccount", ctx, addr) - ret0, _ := ret[0].(types.AccountI) - return ret0 -} - -// GetAccount indicates an expected call of GetAccount. -func (mr *MockAccountKeeperMockRecorder) GetAccount(ctx, addr interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccount", reflect.TypeOf((*MockAccountKeeper)(nil).GetAccount), ctx, addr) -} - -// GetModuleAccount mocks base method. -func (m *MockAccountKeeper) GetModuleAccount(ctx context.Context, moduleName string) types.ModuleAccountI { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetModuleAccount", ctx, moduleName) - ret0, _ := ret[0].(types.ModuleAccountI) - return ret0 -} - -// GetModuleAccount indicates an expected call of GetModuleAccount. -func (mr *MockAccountKeeperMockRecorder) GetModuleAccount(ctx, moduleName interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetModuleAccount", reflect.TypeOf((*MockAccountKeeper)(nil).GetModuleAccount), ctx, moduleName) -} - -// GetModuleAddress mocks base method. -func (m *MockAccountKeeper) GetModuleAddress(moduleName string) types.AccAddress { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetModuleAddress", moduleName) - ret0, _ := ret[0].(types.AccAddress) - return ret0 -} - -// GetModuleAddress indicates an expected call of GetModuleAddress. -func (mr *MockAccountKeeperMockRecorder) GetModuleAddress(moduleName interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetModuleAddress", reflect.TypeOf((*MockAccountKeeper)(nil).GetModuleAddress), moduleName) -} - -// NewAccountWithAddress mocks base method. -func (m *MockAccountKeeper) NewAccountWithAddress(ctx context.Context, addr types.AccAddress) types.AccountI { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NewAccountWithAddress", ctx, addr) - ret0, _ := ret[0].(types.AccountI) - return ret0 -} - -// NewAccountWithAddress indicates an expected call of NewAccountWithAddress. -func (mr *MockAccountKeeperMockRecorder) NewAccountWithAddress(ctx, addr interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewAccountWithAddress", reflect.TypeOf((*MockAccountKeeper)(nil).NewAccountWithAddress), ctx, addr) -} - -// SetAccount mocks base method. -func (m *MockAccountKeeper) SetAccount(ctx context.Context, acc types.AccountI) { - m.ctrl.T.Helper() - m.ctrl.Call(m, "SetAccount", ctx, acc) -} - -// SetAccount indicates an expected call of SetAccount. -func (mr *MockAccountKeeperMockRecorder) SetAccount(ctx, acc interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetAccount", reflect.TypeOf((*MockAccountKeeper)(nil).SetAccount), ctx, acc) -} - // MockBankKeeper is a mock of BankKeeper interface. type MockBankKeeper struct { ctrl *gomock.Controller From c39ec6ff2db8437f4ef75699c3d571f6cf52d6ac Mon Sep 17 00:00:00 2001 From: Matt Kocubinski Date: Wed, 9 Oct 2024 17:18:14 -0500 Subject: [PATCH 14/57] refactor(runtime/v2): genesis event service bindings (#22192) --- runtime/v2/module.go | 6 ++-- runtime/v2/services/genesis.go | 55 +++++++++++++++++++++++++++++----- 2 files changed, 51 insertions(+), 10 deletions(-) diff --git a/runtime/v2/module.go b/runtime/v2/module.go index 11cd7037fff3..9637871c6aba 100644 --- a/runtime/v2/module.go +++ b/runtime/v2/module.go @@ -241,9 +241,9 @@ func DefaultServiceBindings() depinject.Config { stf.NewKVStoreService(actor), ) } - headerService header.Service = services.NewGenesisHeaderService(stf.HeaderService{}) - cometService comet.Service = &services.ContextAwareCometInfoService{} - eventService = stf.NewEventService() + cometService comet.Service = &services.ContextAwareCometInfoService{} + headerService = services.NewGenesisHeaderService(stf.HeaderService{}) + eventService = services.NewGenesisEventService(stf.NewEventService()) ) return depinject.Supply( kvServiceFactory, diff --git a/runtime/v2/services/genesis.go b/runtime/v2/services/genesis.go index 5d09e5c78f74..7e748f562b5c 100644 --- a/runtime/v2/services/genesis.go +++ b/runtime/v2/services/genesis.go @@ -2,10 +2,13 @@ package services import ( "context" + "errors" "fmt" + "cosmossdk.io/core/event" "cosmossdk.io/core/header" "cosmossdk.io/core/store" + "cosmossdk.io/core/transaction" ) var ( @@ -105,6 +108,18 @@ func (g *GenesisKVStoreService) OpenKVStore(ctx context.Context) store.KVStore { return readonlyKVStore{state} } +type readonlyKVStore struct { + store.Reader +} + +func (r readonlyKVStore) Set(key, value []byte) error { + return errors.New("tried to call Set on a readonly store") +} + +func (r readonlyKVStore) Delete(key []byte) error { + return errors.New("tried to call Delete on a readonly store") +} + // GenesisHeaderService is a header.Service implementation that is used during // genesis initialization. It wraps an inner execution context header.Service. type GenesisHeaderService struct { @@ -123,20 +138,46 @@ func (g *GenesisHeaderService) HeaderInfo(ctx context.Context) header.Info { // NewGenesisHeaderService creates a new GenesisHeaderService. // - executionService is the header.Service to use when the genesis context is not active. -func NewGenesisHeaderService(executionService header.Service) *GenesisHeaderService { +func NewGenesisHeaderService(executionService header.Service) header.Service { return &GenesisHeaderService{ executionService: executionService, } } -type readonlyKVStore struct { - store.Reader +// GenesisEventService is an event.Service implementation that is used during +// genesis initialization. It wraps an inner execution context event.Service. +// During genesis initialization, it returns a blackHoleEventManager into which +// events enter and disappear completely. +type GenesisEventService struct { + executionService event.Service } -func (r readonlyKVStore) Set(key, value []byte) error { - panic("tried to call Set on a readonly store") +// NewGenesisEventService creates a new GenesisEventService. +// - executionService is the event.Service to use when the genesis context is not active. +func NewGenesisEventService(executionService event.Service) event.Service { + return &GenesisEventService{ + executionService: executionService, + } } -func (r readonlyKVStore) Delete(key []byte) error { - panic("tried to call Delete on a readonly store") +func (g *GenesisEventService) EventManager(ctx context.Context) event.Manager { + v := ctx.Value(genesisContextKey) + if v == nil { + return g.executionService.EventManager(ctx) + } + return &blackHoleEventManager{} +} + +var _ event.Manager = (*blackHoleEventManager)(nil) + +// blackHoleEventManager is an event.Manager that does nothing. +// It is used during genesis initialization, genesis events are not emitted. +type blackHoleEventManager struct{} + +func (b *blackHoleEventManager) Emit(_ transaction.Msg) error { + return nil +} + +func (b *blackHoleEventManager) EmitKV(_ string, _ ...event.Attribute) error { + return nil } From 742cb0737ae2ac3e78c98b813447185210394bf8 Mon Sep 17 00:00:00 2001 From: Matt Kocubinski Date: Thu, 10 Oct 2024 02:22:18 -0500 Subject: [PATCH 15/57] refactor(server/v2): late bound storeBuilder (#22206) --- server/v2/store/commands.go | 87 ++++--------------------------------- server/v2/store/snapshot.go | 3 +- 2 files changed, 9 insertions(+), 81 deletions(-) diff --git a/server/v2/store/commands.go b/server/v2/store/commands.go index 3b9f175c7b0f..2779ab5de20f 100644 --- a/server/v2/store/commands.go +++ b/server/v2/store/commands.go @@ -2,9 +2,6 @@ package store import ( "fmt" - "os" - "path/filepath" - "strings" "github.com/spf13/cobra" "github.com/spf13/viper" @@ -12,7 +9,6 @@ import ( "cosmossdk.io/log" serverv2 "cosmossdk.io/server/v2" storev2 "cosmossdk.io/store/v2" - "cosmossdk.io/store/v2/db" "cosmossdk.io/store/v2/root" ) @@ -45,7 +41,7 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`, logger := log.NewLogger(cmd.OutOrStdout()) - rootStore, keepRecent, err := createRootStore(cmd, vp, logger) + rootStore, opts, err := createRootStore(vp, logger) if err != nil { return fmt.Errorf("can not create root store %w", err) } @@ -60,7 +56,7 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`, return fmt.Errorf("the database has no valid heights to prune, the latest height: %v", latestHeight) } - diff := latestHeight - keepRecent + diff := latestHeight - opts.SCPruningOption.KeepRecent cmd.Printf("pruning heights up to %v\n", diff) err = rootStore.Prune(latestHeight) @@ -79,81 +75,14 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`, return cmd } -func createRootStore(cmd *cobra.Command, v *viper.Viper, logger log.Logger) (storev2.RootStore, uint64, error) { - tempViper := v - rootDir := v.GetString(serverv2.FlagHome) - // handle FlagAppDBBackend - var dbType db.DBType - if cmd.Flags().Changed(FlagAppDBBackend) { - dbStr, err := cmd.Flags().GetString(FlagAppDBBackend) - if err != nil { - return nil, 0, err - } - dbType = db.DBType(dbStr) - } else { - dbType = db.DBType(v.GetString(FlagAppDBBackend)) - } - scRawDb, err := db.NewDB(dbType, "application", filepath.Join(rootDir, "data"), nil) +func createRootStore(v *viper.Viper, logger log.Logger) (storev2.RootStore, root.Options, error) { + storeConfig, err := UnmarshalConfig(v.AllSettings()) if err != nil { - panic(err) - } - - // handle KeepRecent & Interval flags - if cmd.Flags().Changed(FlagKeepRecent) { - keepRecent, err := cmd.Flags().GetUint64(FlagKeepRecent) - if err != nil { - return nil, 0, err - } - - // viper has an issue that we could not override subitem then Unmarshal key - // so we can not do viper.Set() as comment below - // https://github.com/spf13/viper/issues/1106 - // Do it by a hacky: overwrite app.toml file then read config again. - - // v.Set("store.options.sc-pruning-option.keep-recent", keepRecent) // entry that read from app.toml - // v.Set("store.options.ss-pruning-option.keep-recent", keepRecent) - - err = overrideKeepRecent(filepath.Join(rootDir, "config"), keepRecent) - if err != nil { - return nil, 0, err - } - - tempViper, err = serverv2.ReadConfig(filepath.Join(rootDir, "config")) - if err != nil { - return nil, 0, err - } + return nil, root.Options{}, fmt.Errorf("failed to unmarshal config: %w", err) } - - storeOpts := root.DefaultStoreOptions() - if v != nil && v.Sub("store.options") != nil { - if err := v.Sub("store.options").Unmarshal(&storeOpts); err != nil { - return nil, 0, fmt.Errorf("failed to store options: %w", err) - } - } - - store, err := root.CreateRootStore(&root.FactoryOptions{ - Logger: logger, - RootDir: rootDir, - Options: storeOpts, - SCRawDB: scRawDb, - }) - - return store, tempViper.GetUint64("store.options.sc-pruning-option.keep-recent"), err -} - -func overrideKeepRecent(configPath string, keepRecent uint64) error { - bz, err := os.ReadFile(filepath.Join(configPath, "app.toml")) + store, err := root.NewBuilder().Build(logger, storeConfig) if err != nil { - return err + return nil, root.Options{}, fmt.Errorf("failed to create store backend: %w", err) } - lines := strings.Split(string(bz), "\n") - - for i, line := range lines { - if strings.Contains(line, "keep-recent") { - lines[i] = fmt.Sprintf("keep-recent = %d", keepRecent) - } - } - output := strings.Join(lines, "\n") - - return os.WriteFile(filepath.Join(configPath, "app.toml"), []byte(output), 0o600) + return store, storeConfig.Options, nil } diff --git a/server/v2/store/snapshot.go b/server/v2/store/snapshot.go index e7958068e56a..cbde7cd9a7d9 100644 --- a/server/v2/store/snapshot.go +++ b/server/v2/store/snapshot.go @@ -39,8 +39,7 @@ func (s *Server[T]) ExportSnapshotCmd() *cobra.Command { } logger := log.NewLogger(cmd.OutOrStdout()) - // app := appCreator(logger, db, nil, viper) - rootStore, _, err := createRootStore(cmd, v, logger) + rootStore, _, err := createRootStore(v, logger) if err != nil { return err } From 7e517369e3923f8398fb3bb6840cdfbb4db691f2 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Thu, 10 Oct 2024 09:27:02 +0200 Subject: [PATCH 16/57] docs: bring back user docs in main repo (#22201) --- docs/post.sh | 1 + docs/pre.sh | 3 + docs/user/run-node/00-keyring.md | 134 ++++++++ docs/user/run-node/01-run-node.md | 228 +++++++++++++ docs/user/run-node/02-interact-node.md | 289 ++++++++++++++++ docs/user/run-node/03-txs.md | 387 ++++++++++++++++++++++ docs/user/run-node/04-rosetta.md | 144 ++++++++ docs/user/run-node/05-run-testnet.md | 101 ++++++ docs/user/run-node/06-run-production.md | 269 +++++++++++++++ docs/user/run-node/07-multisig-guide.md | 108 ++++++ docs/user/run-node/08-onchain-multisig.md | 248 ++++++++++++++ docs/user/run-node/_category_.json | 5 + docs/user/user.md | 10 + 13 files changed, 1927 insertions(+) create mode 100644 docs/user/run-node/00-keyring.md create mode 100644 docs/user/run-node/01-run-node.md create mode 100644 docs/user/run-node/02-interact-node.md create mode 100644 docs/user/run-node/03-txs.md create mode 100644 docs/user/run-node/04-rosetta.md create mode 100644 docs/user/run-node/05-run-testnet.md create mode 100644 docs/user/run-node/06-run-production.md create mode 100644 docs/user/run-node/07-multisig-guide.md create mode 100644 docs/user/run-node/08-onchain-multisig.md create mode 100644 docs/user/run-node/_category_.json create mode 100644 docs/user/user.md diff --git a/docs/post.sh b/docs/post.sh index 9dbcb119ed1f..62264248e924 100755 --- a/docs/post.sh +++ b/docs/post.sh @@ -12,3 +12,4 @@ rm -rf build/spec rm -rf build/rfc rm -rf learn/advanced/17-autocli.md rm -rf build/migrations/02-upgrading.md +rm -rf user/run-node/04-rosetta.md \ No newline at end of file diff --git a/docs/pre.sh b/docs/pre.sh index 622c3cd6d363..3c12a9a67d06 100755 --- a/docs/pre.sh +++ b/docs/pre.sh @@ -36,6 +36,9 @@ cp ../depinject/README.md ./build/packages/01-depinject.md cp ../collections/README.md ./build/packages/02-collections.md cp ../orm/README.md ./build/packages/03-orm.md +## Update user docs with rosetta +wget -O "./user/run-node/04-rosetta.md" "https://raw.githubusercontent.com/cosmos/rosetta/main/README.md" + ## Add architecture documentation cp -r ./architecture ./build diff --git a/docs/user/run-node/00-keyring.md b/docs/user/run-node/00-keyring.md new file mode 100644 index 000000000000..b4a2020068fe --- /dev/null +++ b/docs/user/run-node/00-keyring.md @@ -0,0 +1,134 @@ +--- +sidebar_position: 1 +--- + +# Setting up the keyring + +:::note Synopsis +This document describes how to configure and use the keyring and its various backends for an [**application**](../../learn/beginner/00-app-anatomy.md). +::: + +The keyring holds the private/public keypairs used to interact with a node. For instance, a validator key needs to be set up before running the blockchain node, so that blocks can be correctly signed. The private key can be stored in different locations, called "backends", such as a file or the operating system's own key storage. + +## Available backends for the keyring + +Starting with the v0.38.0 release, Cosmos SDK comes with a new keyring implementation +that provides a set of commands to manage cryptographic keys in a secure fashion. The +new keyring supports multiple storage backends, some of which may not be available on +all operating systems. + +### The `os` backend + +The `os` backend relies on operating system-specific defaults to handle key storage +securely. Typically, an operating system's credential sub-system handles password prompts, +private keys storage, and user sessions according to the user's password policies. Here +is a list of the most popular operating systems and their respective passwords manager: + +* macOS: [Keychain](https://support.apple.com/en-gb/guide/keychain-access/welcome/mac) +* Windows: [Credentials Management API](https://docs.microsoft.com/en-us/windows/win32/secauthn/credentials-management) +* GNU/Linux: + * [libsecret](https://gitlab.gnome.org/GNOME/libsecret) + * [kwallet](https://api.kde.org/frameworks/kwallet/html/index.html) + +GNU/Linux distributions that use GNOME as default desktop environment typically come with +[Seahorse](https://wiki.gnome.org/Apps/Seahorse). Users of KDE based distributions are +commonly provided with [KDE Wallet Manager](https://userbase.kde.org/KDE_Wallet_Manager). +Whilst the former is in fact a `libsecret` convenient frontend, the latter is a `kwallet` +client. + +`os` is the default option since operating system's default credentials managers are +designed to meet users' most common needs and provide them with a comfortable +experience without compromising on security. + +The recommended backends for headless environments are `file` and `pass`. + +### The `file` backend + +The `file` backend more closely resembles the keybase implementation used prior to +v0.38.1. It stores the keyring encrypted within the app's configuration directory. This +keyring will request a password each time it is accessed, which may occur multiple +times in a single command resulting in repeated password prompts. If using bash scripts +to execute commands using the `file` option you may want to utilize the following format +for multiple prompts: + +```shell +# assuming that KEYPASSWD is set in the environment +$ gaiacli config keyring-backend file # use file backend +$ (echo $KEYPASSWD; echo $KEYPASSWD) | gaiacli keys add me # multiple prompts +$ echo $KEYPASSWD | gaiacli keys show me # single prompt +``` + +:::tip +The first time you add a key to an empty keyring, you will be prompted to type the password twice. +::: + +### The `pass` backend + +The `pass` backend uses the [pass](https://www.passwordstore.org/) utility to manage on-disk +encryption of keys' sensitive data and metadata. Keys are stored inside `gpg` encrypted files +within app-specific directories. `pass` is available for the most popular UNIX +operating systems as well as GNU/Linux distributions. Please refer to its manual page for +information on how to download and install it. + +:::tip +**pass** uses [GnuPG](https://gnupg.org/) for encryption. `gpg` automatically invokes the `gpg-agent` +daemon upon execution, which handles the caching of GnuPG credentials. Please refer to `gpg-agent` +man page for more information on how to configure cache parameters such as credentials TTL and +passphrase expiration. +::: + +The password store must be set up prior to first use: + +```shell +pass init +``` + +Replace `` with your GPG key ID. You can use your personal GPG key or an alternative +one you may want to use specifically to encrypt the password store. + +### The `kwallet` backend + +The `kwallet` backend uses `KDE Wallet Manager`, which comes installed by default on the +GNU/Linux distributions that ships KDE as default desktop environment. Please refer to +[KWallet Handbook](https://docs.kde.org/stable5/en/kdeutils/kwallet5/index.html) for more +information. + +### The `test` backend + +The `test` backend is a password-less variation of the `file` backend. Keys are stored +unencrypted on disk. + +**Provided for testing purposes only. The `test` backend is not recommended for use in production environments**. + +### The `memory` backend + +The `memory` backend stores keys in memory. The keys are immediately deleted after the program has exited. + +**Provided for testing purposes only. The `memory` backend is not recommended for use in production environments**. + +### Setting backend using the env variable + +You can set the keyring-backend using env variable: `BINNAME_KEYRING_BACKEND`. For example, if your binary name is `gaia-v5` then set: `export GAIA_V5_KEYRING_BACKEND=pass` + +## Adding keys to the keyring + +:::warning +Make sure you can build your own binary, and replace `simd` with the name of your binary in the snippets. +::: + +Applications developed using the Cosmos SDK come with the `keys` subcommand. For the purpose of this tutorial, we're running the `simd` CLI, which is an application built using the Cosmos SDK for testing and educational purposes. For more information, see [`simapp`](https://github.com/cosmos/cosmos-sdk/tree/main/simapp). + +You can use `simd keys` for help about the keys command and `simd keys [command] --help` for more information about a particular subcommand. + +To create a new key in the keyring, run the `add` subcommand with a `` argument. For the purpose of this tutorial, we will solely use the `test` backend, and call our new key `my_validator`. This key will be used in the next section. + +```bash +$ simd keys add my_validator --keyring-backend test + +# Put the generated address in a variable for later use. +MY_VALIDATOR_ADDRESS=$(simd keys show my_validator -a --keyring-backend test) +``` + +This command generates a new 24-word mnemonic phrase, persists it to the relevant backend, and outputs information about the keypair. If this keypair will be used to hold value-bearing tokens, be sure to write down the mnemonic phrase somewhere safe! + +By default, the keyring generates a `secp256k1` keypair. The keyring also supports `ed25519` keys, which may be created by passing the `--algo ed25519` flag. A keyring can of course hold both types of keys simultaneously, and the Cosmos SDK's `x/auth` module supports natively these two public key algorithms. diff --git a/docs/user/run-node/01-run-node.md b/docs/user/run-node/01-run-node.md new file mode 100644 index 000000000000..9b1dfb4ebd59 --- /dev/null +++ b/docs/user/run-node/01-run-node.md @@ -0,0 +1,228 @@ +--- +sidebar_position: 1 +--- + +# Running a Node + +:::note Synopsis +Now that the application is ready and the keyring populated, it's time to see how to run the blockchain node. In this section, the application we are running is called [`simapp`](https://github.com/cosmos/cosmos-sdk/tree/main/simapp), and its corresponding CLI binary `simd`. +::: + +:::note Pre-requisite Readings + +* [Anatomy of a Cosmos SDK Application](../../learn/beginner/00-app-anatomy.md) +* [Setting up the keyring](./00-keyring.md) + +::: + +## Initialize the Chain + +:::warning +Make sure you can build your own binary, and replace `simd` with the name of your binary in the snippets. +::: + +Before actually running the node, we need to initialize the chain, and most importantly its genesis file. This is done with the `init` subcommand: + +```bash +# The argument is the custom username of your node, it should be human-readable. +simd init --chain-id my-test-chain +``` + +The command above creates all the configuration files needed for your node to run, as well as a default genesis file, which defines the initial state of the network. + +:::tip +All these configuration files are in `~/.simapp` by default, but you can overwrite the location of this folder by passing the `--home` flag to each commands, +or set an `$APPD_HOME` environment variable (where `APPD` is the name of the binary). +::: + +The `~/.simapp` folder has the following structure: + +```bash +. # ~/.simapp + |- data # Contains the databases used by the node. + |- config/ + |- app.toml # Application-related configuration file. + |- config.toml # CometBFT-related configuration file. + |- genesis.json # The genesis file. + |- node_key.json # Private key to use for node authentication in the p2p protocol. + |- priv_validator_key.json # Private key to use as a validator in the consensus protocol. +``` + +## Updating Some Default Settings + +If you want to change any field values in configuration files (for ex: genesis.json) you can use `jq` ([installation](https://stedolan.github.io/jq/download/) & [docs](https://stedolan.github.io/jq/manual/#Assignment)) & `sed` commands to do that. Few examples are listed here. + +```bash +# to change the chain-id +jq '.chain_id = "testing"' genesis.json > temp.json && mv temp.json genesis.json + +# to enable the api server +sed -i '/\[api\]/,+3 s/enable = false/enable = true/' app.toml + +# to change the voting_period +jq '.app_state.gov.voting_params.voting_period = "600s"' genesis.json > temp.json && mv temp.json genesis.json + +# to change the inflation +jq '.app_state.mint.minter.inflation = "0.300000000000000000"' genesis.json > temp.json && mv temp.json genesis.json +``` + +### Client Interaction + +When instantiating a node, GRPC and REST are defaulted to localhost to avoid unknown exposure of your node to the public. It is recommended to not expose these endpoints without a proxy that can handle load balancing or authentication is setup between your node and the public. + +:::tip +A commonly used tool for this is [nginx](https://nginx.org). +::: + + +## Adding Genesis Accounts + +Before starting the chain, you need to populate the state with at least one account. To do so, first [create a new account in the keyring](./00-keyring.md#adding-keys-to-the-keyring) named `my_validator` under the `test` keyring backend (feel free to choose another name and another backend). + +Now that you have created a local account, go ahead and grant it some `stake` tokens in your chain's genesis file. Doing so will also make sure your chain is aware of this account's existence: + +```bash +simd genesis add-genesis-account $MY_VALIDATOR_ADDRESS 100000000000stake +``` + +Recall that `$MY_VALIDATOR_ADDRESS` is a variable that holds the address of the `my_validator` key in the [keyring](./00-keyring.md#adding-keys-to-the-keyring). Also note that the tokens in the Cosmos SDK have the `{amount}{denom}` format: `amount` is an 18-digit-precision decimal number, and `denom` is the unique token identifier with its denomination key (e.g. `atom` or `uatom`). Here, we are granting `stake` tokens, as `stake` is the token identifier used for staking in [`simapp`](https://github.com/cosmos/cosmos-sdk/tree/main/simapp). For your own chain with its own staking denom, that token identifier should be used instead. + +Now that your account has some tokens, you need to add a validator to your chain. Validators are special full-nodes that participate in the consensus process (implemented in the [underlying consensus engine](../../learn/intro/02-sdk-app-architecture.md#cometbft)) in order to add new blocks to the chain. Any account can declare its intention to become a validator operator, but only those with sufficient delegation get to enter the active set (for example, only the top 125 validator candidates with the most delegation get to be validators in the Cosmos Hub). For this guide, you will add your local node (created via the `init` command above) as a validator of your chain. Validators can be declared before a chain is first started via a special transaction included in the genesis file called a `gentx`: + +```bash +# Create a gentx. +simd genesis gentx my_validator 100000000stake --chain-id my-test-chain --keyring-backend test + +# Add the gentx to the genesis file. +simd genesis collect-gentxs +``` + +A `gentx` does three things: + +1. Registers the `validator` account you created as a validator operator account (i.e. the account that controls the validator). +2. Self-delegates the provided `amount` of staking tokens. +3. Link the operator account with a CometBFT node pubkey that will be used for signing blocks. If no `--pubkey` flag is provided, it defaults to the local node pubkey created via the `simd init` command above. + +For more information on `gentx`, use the following command: + +```bash +simd genesis gentx --help +``` + +## Configuring the Node Using `app.toml` and `config.toml` + +The Cosmos SDK automatically generates two configuration files inside `~/.simapp/config`: + +* `config.toml`: used to configure the CometBFT, learn more on [CometBFT's documentation](https://docs.cometbft.com/v0.37/core/configuration), +* `app.toml`: generated by the Cosmos SDK, and used to configure your app, such as state pruning strategies, telemetry, gRPC and REST servers configuration, state sync... + +Both files are heavily commented, please refer to them directly to tweak your node. + +One example config to tweak is the `minimum-gas-prices` field inside `app.toml`, which defines the minimum gas prices the validator node is willing to accept for processing a transaction. Depending on the chain, it might be an empty string or not. If it's empty, make sure to edit the field with some value, for example `10token`, or else the node will halt on startup. For the purpose of this tutorial, let's set the minimum gas price to 0: + +```toml + # The minimum gas prices a validator is willing to accept for processing a + # transaction. A transaction's fees must meet the minimum of any denomination + # specified in this config (e.g. 0.25token1;0.0001token2). + minimum-gas-prices = "0stake" +``` + +:::tip +When running a node (not a validator!) and not wanting to run the application mempool, set the `max-txs` field to `-1`. + +```toml +[mempool] +# Setting max-txs to 0 will allow for a unbounded amount of transactions in the mempool. +# Setting max_txs to negative 1 (-1) will disable transactions from being inserted into the mempool. +# Setting max_txs to a positive number (> 0) will limit the number of transactions in the mempool, by the specified amount. +# +# Note, this configuration only applies to SDK built-in app-side mempool +# implementations. +max-txs = "-1" +``` + +::: + +## Run a Localnet + +Now that everything is set up, you can finally start your node: + +```bash +simd start +``` + +You should see blocks come in. + +The previous command allow you to run a single node. This is enough for the next section on interacting with this node, but you may wish to run multiple nodes at the same time, and see how consensus happens between them. + +The naive way would be to run the same commands again in separate terminal windows. This is possible, however in the Cosmos SDK, we leverage the power of [Docker Compose](https://docs.docker.com/compose/) to run a localnet. If you need inspiration on how to set up your own localnet with Docker Compose, you can have a look at the Cosmos SDK's [`docker-compose.yml`](https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/docker-compose.yml). + +### Standalone App/CometBFT + +By default, the Cosmos SDK runs CometBFT in-process with the application +If you want to run the application and CometBFT in separate processes, +start the application with the `--with-comet=false` flag +and set `rpc.laddr` in `config.toml` to the CometBFT node's RPC address. + +## Logging + +Logging provides a way to see what is going on with a node. By default the `info` level is set. This is a global level and all info logs will be outputted to the terminal. + +If you would like to filter specific logs to the terminal instead of all, then setting `:` is how this can work. +Example: + +In `config.toml`: + +```toml +log_level: "state:info,p2p:info,consensus:info,x/staking:info,x/ibc:info,*:error" +``` + +Or directly in the command line: + +```bash + start --log_level "state:info,p2p:info,consensus:info,x/staking:info,x/ibc:info,*:error" +``` + +The above will show info logs for the state, p2p, consensus, staking, and ibc modules, and error logs for all other modules. +When no log filtering is required, simply use one of the supported global log levels: `trace`, `debug`, `info`, `warn`, `error`, `fatal`, `panic` or `disabled`. + +## State Sync + +State sync is the act in which a node syncs the latest or close to the latest state of a blockchain. This is useful for users who don't want to sync all the blocks in history. Read more in [CometBFT documentation](https://docs.cometbft.com/v0.37/core/state-sync). + +State sync works thanks to snapshots. Read how the SDK handles snapshots [here](https://github.com/cosmos/cosmos-sdk/blob/825245d/store/snapshots/README.md). + +### Local State Sync + +Local state sync work similar to normal state sync except that it works off a local snapshot of state instead of one provided via the p2p network. The steps to start local state sync are similar to normal state sync with a few different designs. + +1. As mentioned in https://docs.cometbft.com/v0.37/core/state-sync, one must set a height and hash in the config.toml along with a few rpc servers (the afromentioned link has instructions on how to do this). +2. Run ` ` to restore a local snapshot (note: first load it from a file with the *load* command). +3. Bootsrapping Comet state in order to start the node after the snapshot has been ingested. This can be done with the bootstrap command ` comet bootstrap-state` + +### Snapshots Commands + +The Cosmos SDK provides commands for managing snapshots. +These commands can be added in an app with the following snippet in `cmd//root.go`: + +```go +import ( + "github.com/cosmos/cosmos-sdk/client/snapshot" +) + +func initRootCmd(/* ... */) { + // ... + rootCmd.AddCommand( + snapshot.Cmd(appCreator), + ) +} +``` + +Then following commands are available at ` snapshots [command]`: + +* **list**: list local snapshots +* **load**: Load a snapshot archive file into snapshot store +* **restore**: Restore app state from local snapshot +* **export**: Export app state to snapshot store +* **dump**: Dump the snapshot as portable archive format +* **delete**: Delete a local snapshot diff --git a/docs/user/run-node/02-interact-node.md b/docs/user/run-node/02-interact-node.md new file mode 100644 index 000000000000..a511aec41836 --- /dev/null +++ b/docs/user/run-node/02-interact-node.md @@ -0,0 +1,289 @@ +--- +sidebar_position: 1 +--- + +# Interacting with the Node + +:::note Synopsis +There are multiple ways to interact with a node: using the CLI, using gRPC or using the REST endpoints. +::: + +:::note Pre-requisite Readings + +* [gRPC, REST and CometBFT Endpoints](../../learn/advanced/06-grpc_rest.md) +* [Running a Node](./01-run-node.md) + +::: + +## Using the CLI + +Now that your chain is running, it is time to try sending tokens from the first account you created to a second account. In a new terminal window, start by running the following query command: + +```bash +simd query bank balances $MY_VALIDATOR_ADDRESS +``` + +You should see the current balance of the account you created, equal to the original balance of `stake` you granted it minus the amount you delegated via the `gentx`. Now, create a second account: + +```bash +simd keys add recipient --keyring-backend test + +# Put the generated address in a variable for later use. +RECIPIENT=$(simd keys show recipient -a --keyring-backend test) +``` + +The command above creates a local key-pair that is not yet registered on the chain. An account is created the first time it receives tokens from another account. Now, run the following command to send tokens to the `recipient` account: + +```bash +simd tx bank send $MY_VALIDATOR_ADDRESS $RECIPIENT 1000000stake --chain-id my-test-chain --keyring-backend test + +# Check that the recipient account did receive the tokens. +simd query bank balances $RECIPIENT +``` + +Finally, delegate some of the stake tokens sent to the `recipient` account to the validator: + +```bash +simd tx staking delegate $(simd keys show my_validator --bech val -a --keyring-backend test) 500stake --from recipient --chain-id my-test-chain --keyring-backend test + +# Query the total delegations to `validator`. +simd query staking delegations-to $(simd keys show my_validator --bech val -a --keyring-backend test) +``` + +You should see two delegations, the first one made from the `gentx`, and the second one you just performed from the `recipient` account. + +## Using gRPC + +The Protobuf ecosystem developed tools for different use cases, including code-generation from `*.proto` files into various languages. These tools allow the building of clients easily. Often, the client connection (i.e. the transport) can be plugged and replaced very easily. Let's explore one of the most popular transport: [gRPC](../../learn/advanced/06-grpc_rest.md). + +Since the code generation library largely depends on your own tech stack, we will only present three alternatives: + +* `grpcurl` for generic debugging and testing, +* programmatically via Go, +* CosmJS for JavaScript/TypeScript developers. + +### grpcurl + +[grpcurl](https://github.com/fullstorydev/grpcurl) is like `curl` but for gRPC. It is also available as a Go library, but we will use it only as a CLI command for debugging and testing purposes. Follow the instructions in the previous link to install it. + +Assuming you have a local node running (either a localnet, or connected a live network), you should be able to run the following command to list the Protobuf services available (you can replace `localhost:9000` by the gRPC server endpoint of another node, which is configured under the `grpc.address` field inside [`app.toml`](../run-node/01-run-node.md#configuring-the-node-using-apptoml-and-configtoml)): + +```bash +grpcurl -plaintext localhost:9090 list +``` + +You should see a list of gRPC services, like `cosmos.bank.v1beta1.Query`. This is called reflection, which is a Protobuf endpoint returning a description of all available endpoints. Each of these represents a different Protobuf service, and each service exposes multiple RPC methods you can query against. + +In order to get a description of the service you can run the following command: + +```bash +grpcurl -plaintext \ + localhost:9090 \ + describe cosmos.bank.v1beta1.Query # Service we want to inspect +``` + +It's also possible to execute an RPC call to query the node for information: + +```bash +grpcurl \ + -plaintext \ + -d "{\"address\":\"$MY_VALIDATOR_ADDRESS\"}" \ + localhost:9090 \ + cosmos.bank.v1beta1.Query/AllBalances +``` + +The list of all available gRPC query endpoints is [coming soon](https://github.com/cosmos/cosmos-sdk/issues/7786). + +#### Query for historical state using grpcurl + +You may also query for historical data by passing some [gRPC metadata](https://github.com/grpc/grpc-go/blob/master/Documentation/grpc-metadata.md) to the query: the `x-cosmos-block-height` metadata should contain the block to query. Using grpcurl as above, the command looks like: + +```bash +grpcurl \ + -plaintext \ + -H "x-cosmos-block-height: 123" \ + -d "{\"address\":\"$MY_VALIDATOR_ADDRESS\"}" \ + localhost:9090 \ + cosmos.bank.v1beta1.Query/AllBalances +``` + +Assuming the state at that block has not yet been pruned by the node, this query should return a non-empty response. + +### Programmatically via Go + +The following snippet shows how to query the state using gRPC inside a Go program. The idea is to create a gRPC connection, and use the Protobuf-generated client code to query the gRPC server. + +#### Install Cosmos SDK + + +```bash +go get github.com/cosmos/cosmos-sdk@main +``` + +```go +package main + +import ( + "context" + "fmt" + + "google.golang.org/grpc" + + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" +) + +func queryState() error { + myAddress, err := sdk.AccAddressFromBech32("cosmos1...") // the my_validator or recipient address. + if err != nil { + return err + } + + // Create a connection to the gRPC server. + grpcConn, err := grpc.Dial( + "127.0.0.1:9090", // your gRPC server address. + grpc.WithInsecure(), // The Cosmos SDK doesn't support any transport security mechanism. + // This instantiates a general gRPC codec which handles proto bytes. We pass in a nil interface registry + // if the request/response types contain interface instead of 'nil' you should pass the application specific codec. + grpc.WithDefaultCallOptions(grpc.ForceCodec(codec.NewProtoCodec(nil).GRPCCodec())), + ) + if err != nil { + return err + } + defer grpcConn.Close() + + // This creates a gRPC client to query the x/bank service. + bankClient := banktypes.NewQueryClient(grpcConn) + bankRes, err := bankClient.Balance( + context.Background(), + &banktypes.QueryBalanceRequest{Address: myAddress.String(), Denom: "stake"}, + ) + if err != nil { + return err + } + + fmt.Println(bankRes.GetBalance()) // Prints the account balance + + return nil +} + +func main() { + if err := queryState(); err != nil { + panic(err) + } +} +``` + +You can replace the query client (here we are using `x/bank`'s) with one generated from any other Protobuf service. The list of all available gRPC query endpoints is [coming soon](https://github.com/cosmos/cosmos-sdk/issues/7786). + +#### Query for historical state using Go + +Querying for historical blocks is done by adding the block height metadata in the gRPC request. + +```go +package main + +import ( + "context" + "fmt" + + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + grpctypes "github.com/cosmos/cosmos-sdk/types/grpc" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" +) + +func queryState() error { + myAddress, err := sdk.AccAddressFromBech32("cosmos1yerherx4d43gj5wa3zl5vflj9d4pln42n7kuzu") // the my_validator or recipient address. + if err != nil { + return err + } + + // Create a connection to the gRPC server. + grpcConn, err := grpc.Dial( + "127.0.0.1:9090", // your gRPC server address. + grpc.WithInsecure(), // The Cosmos SDK doesn't support any transport security mechanism. + // This instantiates a general gRPC codec which handles proto bytes. We pass in a nil interface registry + // if the request/response types contain interface instead of 'nil' you should pass the application specific codec. + grpc.WithDefaultCallOptions(grpc.ForceCodec(codec.NewProtoCodec(nil).GRPCCodec())), + ) + if err != nil { + return err + } + defer grpcConn.Close() + + // This creates a gRPC client to query the x/bank service. + bankClient := banktypes.NewQueryClient(grpcConn) + + var header metadata.MD + _, err = bankClient.Balance( + metadata.AppendToOutgoingContext(context.Background(), grpctypes.GRPCBlockHeightHeader, "12"), // Add metadata to request + &banktypes.QueryBalanceRequest{Address: myAddress.String(), Denom: "stake"}, + grpc.Header(&header), // Retrieve header from response + ) + if err != nil { + return err + } + blockHeight := header.Get(grpctypes.GRPCBlockHeightHeader) + + fmt.Println(blockHeight) // Prints the block height (12) + + return nil +} + +func main() { + if err := queryState(); err != nil { + panic(err) + } +} +``` + +### CosmJS + +CosmJS documentation can be found at [https://cosmos.github.io/cosmjs](https://cosmos.github.io/cosmjs). As of January 2021, CosmJS documentation is still work in progress. + +## Using the REST Endpoints + +As described in the [gRPC guide](../../learn/advanced/06-grpc_rest.md), all gRPC services on the Cosmos SDK are made available for more convenient REST-based queries through gRPC-gateway. The format of the URL path is based on the Protobuf service method's full-qualified name, but may contain small customizations so that final URLs look more idiomatic. For example, the REST endpoint for the `cosmos.bank.v1beta1.Query/AllBalances` method is `GET /cosmos/bank/v1beta1/balances/{address}`. Request arguments are passed as query parameters. + +Note that the REST endpoints are not enabled by default. To enable them, edit the `api` section of your `~/.simapp/config/app.toml` file: + +```toml +# Enable defines if the API server should be enabled. +enable = true +``` + +As a concrete example, the `curl` command to make balances request is: + +```bash +curl \ + -X GET \ + -H "Content-Type: application/json" \ + http://localhost:1317/cosmos/bank/v1beta1/balances/$MY_VALIDATOR_ADDRESS +``` + +Make sure to replace `localhost:1317` with the REST endpoint of your node, configured under the `api.address` field. + +The list of all available REST endpoints is available as a Swagger specification file, it can be viewed at `localhost:1317/swagger`. Make sure that the `api.swagger` field is set to true in your [`app.toml`](../run-node/01-run-node.md#configuring-the-node-using-apptoml-and-configtoml) file. + +### Query for historical state using REST + +Querying for historical state is done using the HTTP header `x-cosmos-block-height`. For example, a curl command would look like: + +```bash +curl \ + -X GET \ + -H "Content-Type: application/json" \ + -H "x-cosmos-block-height: 123" \ + http://localhost:1317/cosmos/bank/v1beta1/balances/$MY_VALIDATOR_ADDRESS +``` + +Assuming the state at that block has not yet been pruned by the node, this query should return a non-empty response. + +### Cross-Origin Resource Sharing (CORS) + +[CORS policies](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) are not enabled by default to help with security. If you would like to use the rest-server in a public environment we recommend you provide a reverse proxy, this can be done with [nginx](https://www.nginx.com/). For testing and development purposes there is an `enabled-unsafe-cors` field inside [`app.toml`](../run-node/01-run-node.md#configuring-the-node-using-apptoml-and-configtoml). diff --git a/docs/user/run-node/03-txs.md b/docs/user/run-node/03-txs.md new file mode 100644 index 000000000000..106f02e8e8e8 --- /dev/null +++ b/docs/user/run-node/03-txs.md @@ -0,0 +1,387 @@ +--- +sidebar_position: 1 +--- + +# Generating, Signing and Broadcasting Transactions + +:::note Synopsis +This document describes how to generate an (unsigned) transaction, signing it (with one or multiple keys), and broadcasting it to the network. +::: + +## Using the CLI + +The easiest way to send transactions is using the CLI, as we have seen in the previous page when [interacting with a node](./02-interact-node.md#using-the-cli). For example, running the following command + +```bash +simd tx bank send $MY_VALIDATOR_ADDRESS $RECIPIENT 1000stake --chain-id my-test-chain --keyring-backend test +``` + +will run the following steps: + +* generate a transaction with one `Msg` (`x/bank`'s `MsgSend`), and print the generated transaction to the console. +* ask the user for confirmation to send the transaction from the `$MY_VALIDATOR_ADDRESS` account. +* fetch `$MY_VALIDATOR_ADDRESS` from the keyring. This is possible because we have [set up the CLI's keyring](./00-keyring.md) in a previous step. +* sign the generated transaction with the keyring's account. +* broadcast the signed transaction to the network. This is possible because the CLI connects to the node's CometBFT RPC endpoint. + +The CLI bundles all the necessary steps into a simple-to-use user experience. However, it's possible to run all the steps individually too. + +### Generating a Transaction + +Generating a transaction can simply be done by appending the `--generate-only` flag on any `tx` command, e.g.: + +```bash +simd tx bank send $MY_VALIDATOR_ADDRESS $RECIPIENT 1000stake --chain-id my-test-chain --generate-only +``` + +This will output the unsigned transaction as JSON in the console. We can also save the unsigned transaction to a file (to be passed around between signers more easily) by appending `> unsigned_tx.json` to the above command. + +### Signing a Transaction + +Signing a transaction using the CLI requires the unsigned transaction to be saved in a file. Let's assume the unsigned transaction is in a file called `unsigned_tx.json` in the current directory (see previous paragraph on how to do that). Then, simply run the following command: + +```bash +simd tx sign unsigned_tx.json --chain-id my-test-chain --keyring-backend test --from $MY_VALIDATOR_ADDRESS +``` + +This command will decode the unsigned transaction and sign it with `SIGN_MODE_DIRECT` with `$MY_VALIDATOR_ADDRESS`'s key, which we already set up in the keyring. The signed transaction will be output as JSON to the console, and, as above, we can save it to a file by appending `--output-document signed_tx.json`. + +Some useful flags to consider in the `tx sign` command: + +* `--sign-mode`: you may use `amino-json` to sign the transaction using `SIGN_MODE_LEGACY_AMINO_JSON`, +* `--offline`: sign in offline mode. This means that the `tx sign` command doesn't connect to the node to retrieve the signer's account number and sequence, both needed for signing. In this case, you must manually supply the `--account-number` and `--sequence` flags. This is useful for offline signing, i.e. signing in a secure environment which doesn't have access to the internet. + +#### Signing with Multiple Signers + +:::warning +Please note that signing a transaction with multiple signers or with a multisig account, where at least one signer uses `SIGN_MODE_DIRECT`, is not yet possible. You may follow [this Github issue](https://github.com/cosmos/cosmos-sdk/issues/8141) for more info. +::: + +Signing with multiple signers is done with the `tx multisign` command. This command assumes that all signers use `SIGN_MODE_LEGACY_AMINO_JSON`. The flow is similar to the `tx sign` command flow, but instead of signing an unsigned transaction file, each signer signs the file signed by previous signer(s). The `tx multisign` command will append signatures to the existing transactions. It is important that signers sign the transaction **in the same order** as given by the transaction, which is retrievable using the `GetSigners()` method. + +For example, starting with the `unsigned_tx.json`, and assuming the transaction has 4 signers, we would run: + +```bash +# Let signer1 sign the unsigned tx. +simd tx multisign unsigned_tx.json signer_key_1 --chain-id my-test-chain --keyring-backend test > partial_tx_1.json +# Now signer1 will send the partial_tx_1.json to the signer2. +# Signer2 appends their signature: +simd tx multisign partial_tx_1.json signer_key_2 --chain-id my-test-chain --keyring-backend test > partial_tx_2.json +# Signer2 sends the partial_tx_2.json file to signer3, and signer3 can append his signature: +simd tx multisign partial_tx_2.json signer_key_3 --chain-id my-test-chain --keyring-backend test > partial_tx_3.json +``` + +### Broadcasting a Transaction + +Broadcasting a transaction is done using the following command: + +```bash +simd tx broadcast tx_signed.json +``` + +You may optionally pass the `--broadcast-mode` flag to specify which response to receive from the node: + +* `sync`: the CLI waits for a CheckTx execution response only. +* `async`: the CLI returns immediately (transaction might fail). + +### Encoding a Transaction + +In order to broadcast a transaction using the gRPC or REST endpoints, the transaction will need to be encoded first. This can be done using the CLI. + +Encoding a transaction is done using the following command: + +```bash +simd tx encode tx_signed.json +``` + +This will read the transaction from the file, serialize it using Protobuf, and output the transaction bytes as base64 in the console. + +### Decoding a Transaction + +The CLI can also be used to decode transaction bytes. + +Decoding a transaction is done using the following command: + +```bash +simd tx decode [protobuf-byte-string] +``` + +This will decode the transaction bytes and output the transaction as JSON in the console. You can also save the transaction to a file by appending `> tx.json` to the above command. + +## Programmatically with Go + +It is possible to manipulate transactions programmatically via Go using the Cosmos SDK's `TxBuilder` interface. + +### Generating a Transaction + +Before generating a transaction, a new instance of a `TxBuilder` needs to be created. Since the Cosmos SDK supports both Amino and Protobuf transactions, the first step would be to decide which encoding scheme to use. All the subsequent steps remain unchanged, whether you're using Amino or Protobuf, as `TxBuilder` abstracts the encoding mechanisms. In the following snippet, we will use Protobuf. + +```go +import ( + "github.com/cosmos/cosmos-sdk/simapp" +) + +func sendTx() error { + // Choose your codec: Amino or Protobuf. Here, we use Protobuf, given by the following function. + app := simapp.NewSimApp(...) + + // Create a new TxBuilder. + txBuilder := app.TxConfig().NewTxBuilder() + + // --snip-- +} +``` + +We can also set up some keys and addresses that will send and receive the transactions. Here, for the purpose of the tutorial, we will be using some dummy data to create keys. + +```go +import ( + "github.com/cosmos/cosmos-sdk/testutil/testdata" +) + +priv1, _, addr1 := testdata.KeyTestPubAddr() +priv2, _, addr2 := testdata.KeyTestPubAddr() +priv3, _, addr3 := testdata.KeyTestPubAddr() +``` + +Populating the `TxBuilder` can be done via its methods: + +```go reference +https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/client/tx_config.go#L33-L50 +``` + +```go +import ( + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" +) + +func sendTx() error { + // --snip-- + + // Define two x/bank MsgSend messages: + // - from addr1 to addr3, + // - from addr2 to addr3. + // This means that the transactions needs two signers: addr1 and addr2. + msg1 := banktypes.NewMsgSend(addr1, addr3, types.NewCoins(types.NewInt64Coin("atom", 12))) + msg2 := banktypes.NewMsgSend(addr2, addr3, types.NewCoins(types.NewInt64Coin("atom", 34))) + + err := txBuilder.SetMsgs(msg1, msg2) + if err != nil { + return err + } + + txBuilder.SetGasLimit(...) + txBuilder.SetFeeAmount(...) + txBuilder.SetMemo(...) + txBuilder.SetTimeoutHeight(...) +} +``` + +At this point, `TxBuilder`'s underlying transaction is ready to be signed. + +### Signing a Transaction + +We set encoding config to use Protobuf, which will use `SIGN_MODE_DIRECT` by default. As per [ADR-020](https://github.com/cosmos/cosmos-sdk/blob/main/docs/architecture/adr-020-protobuf-transaction-encoding.md), each signer needs to sign the `SignerInfo`s of all other signers. This means that we need to perform two steps sequentially: + +* for each signer, populate the signer's `SignerInfo` inside `TxBuilder`, +* once all `SignerInfo`s are populated, for each signer, sign the `SignDoc` (the payload to be signed). + +In the current `TxBuilder`'s API, both steps are done using the same method: `SetSignatures()`. The current API requires us to first perform a round of `SetSignatures()` _with empty signatures_, only to populate `SignerInfo`s, and a second round of `SetSignatures()` to actually sign the correct payload. + +```go +import ( + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + "github.com/cosmos/cosmos-sdk/types/tx/signing" + xauthsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" +) + +func sendTx() error { + // --snip-- + + privs := []cryptotypes.PrivKey{priv1, priv2} + accNums:= []uint64{..., ...} // The accounts' account numbers + accSeqs:= []uint64{..., ...} // The accounts' sequence numbers + + // First round: we gather all the signer infos. We use the "set empty + // signature" hack to do that. + var sigsV2 []signing.SignatureV2 + for i, priv := range privs { + sigV2 := signing.SignatureV2{ + PubKey: priv.PubKey(), + Data: &signing.SingleSignatureData{ + SignMode: encCfg.TxConfig.SignModeHandler().DefaultMode(), + Signature: nil, + }, + Sequence: accSeqs[i], + } + + sigsV2 = append(sigsV2, sigV2) + } + err := txBuilder.SetSignatures(sigsV2...) + if err != nil { + return err + } + + // Second round: all signer infos are set, so each signer can sign. + sigsV2 = []signing.SignatureV2{} + for i, priv := range privs { + signerData := xauthsigning.SignerData{ + ChainID: chainID, + AccountNumber: accNums[i], + Sequence: accSeqs[i], + } + sigV2, err := tx.SignWithPrivKey( + encCfg.TxConfig.SignModeHandler().DefaultMode(), signerData, + txBuilder, priv, encCfg.TxConfig, accSeqs[i]) + if err != nil { + return nil, err + } + + sigsV2 = append(sigsV2, sigV2) + } + err = txBuilder.SetSignatures(sigsV2...) + if err != nil { + return err + } +} +``` + +The `TxBuilder` is now correctly populated. To print it, you can use the `TxConfig` interface from the initial encoding config `encCfg`: + +```go +func sendTx() error { + // --snip-- + + // Generated Protobuf-encoded bytes. + txBytes, err := encCfg.TxConfig.TxEncoder()(txBuilder.GetTx()) + if err != nil { + return err + } + + // Generate a JSON string. + txJSONBytes, err := encCfg.TxConfig.TxJSONEncoder()(txBuilder.GetTx()) + if err != nil { + return err + } + txJSON := string(txJSONBytes) +} +``` + +### Broadcasting a Transaction + +The preferred way to broadcast a transaction is to use gRPC, though using REST (via `gRPC-gateway`) or the CometBFT RPC is also posible. An overview of the differences between these methods is exposed [here](../../learn/advanced/06-grpc_rest.md). For this tutorial, we will only describe the gRPC method. + +```go +import ( + "context" + "fmt" + + "google.golang.org/grpc" + + "github.com/cosmos/cosmos-sdk/types/tx" +) + +func sendTx(ctx context.Context) error { + // --snip-- + + // Create a connection to the gRPC server. + grpcConn := grpc.Dial( + "127.0.0.1:9090", // Or your gRPC server address. + grpc.WithInsecure(), // The Cosmos SDK doesn't support any transport security mechanism. + ) + defer grpcConn.Close() + + // Broadcast the tx via gRPC. We create a new client for the Protobuf Tx + // service. + txClient := tx.NewServiceClient(grpcConn) + // We then call the BroadcastTx method on this client. + grpcRes, err := txClient.BroadcastTx( + ctx, + &tx.BroadcastTxRequest{ + Mode: tx.BroadcastMode_BROADCAST_MODE_SYNC, + TxBytes: txBytes, // Proto-binary of the signed transaction, see previous step. + }, + ) + if err != nil { + return err + } + + fmt.Println(grpcRes.TxResponse.Code) // Should be `0` if the tx is successful + + return nil +} +``` + +#### Simulating a Transaction + +Before broadcasting a transaction, we sometimes may want to dry-run the transaction, to estimate some information about the transaction without actually committing it. This is called simulating a transaction, and can be done as follows: + +```go +import ( + "context" + "fmt" + "testing" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/types/tx" + authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" +) + +func simulateTx() error { + // --snip-- + + // Simulate the tx via gRPC. We create a new client for the Protobuf Tx + // service. + txClient := tx.NewServiceClient(grpcConn) + txBytes := /* Fill in with your signed transaction bytes. */ + + // We then call the Simulate method on this client. + grpcRes, err := txClient.Simulate( + context.Background(), + &tx.SimulateRequest{ + TxBytes: txBytes, + }, + ) + if err != nil { + return err + } + + fmt.Println(grpcRes.GasInfo) // Prints estimated gas used. + + return nil +} +``` + +## Using gRPC + +It is not possible to generate or sign a transaction using gRPC, only to broadcast one. In order to broadcast a transaction using gRPC, you will need to generate, sign, and encode the transaction using either the CLI or programmatically with Go. + +### Broadcasting a Transaction + +Broadcasting a transaction using the gRPC endpoint can be done by sending a `BroadcastTx` request as follows, where the `txBytes` are the protobuf-encoded bytes of a signed transaction: + +```bash +grpcurl -plaintext \ + -d '{"tx_bytes":"{{txBytes}}","mode":"BROADCAST_MODE_SYNC"}' \ + localhost:9090 \ + cosmos.tx.v1beta1.Service/BroadcastTx +``` + +## Using REST + +It is not possible to generate or sign a transaction using REST, only to broadcast one. In order to broadcast a transaction using REST, you will need to generate, sign, and encode the transaction using either the CLI or programmatically with Go. + +### Broadcasting a Transaction + +Broadcasting a transaction using the REST endpoint (served by `gRPC-gateway`) can be done by sending a POST request as follows, where the `txBytes` are the protobuf-encoded bytes of a signed transaction: + +```bash +curl -X POST \ + -H "Content-Type: application/json" \ + -d'{"tx_bytes":"{{txBytes}}","mode":"BROADCAST_MODE_SYNC"}' \ + localhost:1317/cosmos/tx/v1beta1/txs +``` + +## Using CosmJS (JavaScript & TypeScript) + +CosmJS aims to build client libraries in JavaScript that can be embedded in web applications. Please see [https://cosmos.github.io/cosmjs](https://cosmos.github.io/cosmjs) for more information. As of January 2021, CosmJS documentation is still work in progress. diff --git a/docs/user/run-node/04-rosetta.md b/docs/user/run-node/04-rosetta.md new file mode 100644 index 000000000000..de74d9898b0c --- /dev/null +++ b/docs/user/run-node/04-rosetta.md @@ -0,0 +1,144 @@ +# Rosetta + +The `rosetta` project implements Coinbase's [Rosetta API](https://www.rosetta-api.org). This document provides instructions on how to use the Rosetta API integration. For information about the motivation and design choices, refer to [ADR 035](https://docs.cosmos.network/main/architecture/adr-035-rosetta-api-support). + +## Installing Rosetta + +The Rosetta API server is a stand-alone server that connects to a node of a chain developed with Cosmos SDK. + +Rosetta can be added to any cosmos chain node. standalone or natively. + +### Standalone + +Rosetta can be executed as a standalone service, it connects to the node endpoints and expose the required endpoints. + +Install Rosetta standalone server with the following command: + +```bash +go install github.com/cosmos/rosetta +``` + +Alternatively, for building from source, simply run `make build`. The binary will be located in the root folder. + +### Native - As a node command + +To enable Native Rosetta API support, it's required to add the `RosettaCommand` to your application's root command file (e.g. `simd/cmd/root.go`). + +Import the `rosettaCmd` package: + +```go +import "github.com/cosmos/rosetta/cmd" +``` + +Find the following line: + +```go +initRootCmd(rootCmd, encodingConfig) +``` + +After that line, add the following: + +```go +rootCmd.AddCommand( + rosettaCmd.RosettaCommand(encodingConfig.InterfaceRegistry, encodingConfig.Codec) +) +``` + +The `RosettaCommand` function builds the `rosetta` root command and is defined in the `rosettaCmd` package (`github.com/cosmos/rosetta/cmd`). + +Since we’ve updated the Cosmos SDK to work with the Rosetta API, updating the application's root command file is all you need to do. + +An implementation example can be found in `simapp` package. + +## Use Rosetta Command + +To run Rosetta in your application CLI, use the following command: + +> **Note:** if using the native approach, add your node name before any rosetta comand. + +```shell +rosetta --help +``` + +To test and run Rosetta API endpoints for applications that are running and exposed, use the following command: + +```shell +rosetta + --blockchain "your application name (ex: gaia)" + --network "your chain identifier (ex: testnet-1)" + --tendermint "tendermint endpoint (ex: localhost:26657)" + --grpc "gRPC endpoint (ex: localhost:9090)" + --addr "rosetta binding address (ex: :8080)" + --grpc-types-server (optional) "gRPC endpoint for message descriptor types" +``` + +## Plugins - Multi chain connections + +Rosetta will try to reflect the node types trough reflection over the node gRPC endpoints, there may be cases were this approach is not enough. It is possible to extend or implement the required types easily trough plugins. + +To use Rosetta over any chain, it is required to set up prefixes and registering zone specific interfaces through plugins. + +Each plugin is a minimalist implementation of `InitZone` and `RegisterInterfaces` which allow Rosetta to parse chain specific data. There is an example for cosmos-hub chain under `plugins/cosmos-hun/` folder +- **InitZone**: An empty method that is executed first and defines prefixes, parameters and other settings. +- **RegisterInterfaces**: This method receives an interface registry which is were the zone specific types and interfaces will be loaded + +In order to add a new plugin: +1. Create a folder over `plugins` folder with the name of the desired zone +2. Add a `main.go` file with the mentioned methods above. +3. Build the code binary through `go build -buildmode=plugin -o main.so main.go` + +The plugin folder is selected through the cli `--plugin` flag and loaded into the Rosetta server. + +## Extensions + +There are two ways in which you can customize and extend the implementation with your custom settings. + +### Message extension + +In order to make an `sdk.Msg` understandable by rosetta the only thing which is required is adding the methods to your messages that satisfy the `rosetta.Msg` interface. Examples on how to do so can be found in the staking types such as `MsgDelegate`, or in bank types such as `MsgSend`. + +### Client interface override + +In case more customization is required, it's possible to embed the Client type and override the methods which require customizations. + +Example: + +```go +package custom_client +import ( + +"context" +"github.com/coinbase/rosetta-sdk-go/types" +"github.com/cosmos/rosetta/lib" +) + +// CustomClient embeds the standard cosmos client +// which means that it implements the cosmos-rosetta-gateway Client +// interface while at the same time allowing to customize certain methods +type CustomClient struct { + *rosetta.Client +} + +func (c *CustomClient) ConstructionPayload(_ context.Context, request *types.ConstructionPayloadsRequest) (resp *types.ConstructionPayloadsResponse, err error) { + // provide custom signature bytes + panic("implement me") +} +``` + +NOTE: when using a customized client, the command cannot be used as the constructors required **may** differ, so it's required to create a new one. We intend to provide a way to init a customized client without writing extra code in the future. + +### Error extension + +Since rosetta requires to provide 'returned' errors to network options. In order to declare a new rosetta error, we use the `errors` package in cosmos-rosetta-gateway. + +Example: + +```go +package custom_errors +import crgerrs "github.com/cosmos/rosetta/lib/errors" + +var customErrRetriable = true +var CustomError = crgerrs.RegisterError(100, "custom message", customErrRetriable, "description") +``` + +Note: errors must be registered before cosmos-rosetta-gateway's `Server`.`Start` method is called. Otherwise the registration will be ignored. Errors with same code will be ignored too. diff --git a/docs/user/run-node/05-run-testnet.md b/docs/user/run-node/05-run-testnet.md new file mode 100644 index 000000000000..c2b5da598186 --- /dev/null +++ b/docs/user/run-node/05-run-testnet.md @@ -0,0 +1,101 @@ +--- +sidebar_position: 1 +--- + +# Running a Testnet + +:::note Synopsis +The `simd testnet` subcommand makes it easy to initialize and start a simulated test network for testing purposes. +::: + +In addition to the commands for [running a node](./01-run-node.md), the `simd` binary also includes a `testnet` command that allows you to start a simulated test network in-process or to initialize files for a simulated test network that runs in a separate process. + +## Initialize Files + +First, let's take a look at the `init-files` subcommand. + +This is similar to the `init` command when initializing a single node, but in this case we are initializing multiple nodes, generating the genesis transactions for each node, and then collecting those transactions. + +The `init-files` subcommand initializes the necessary files to run a test network in a separate process (i.e. using a Docker container). Running this command is not a prerequisite for the `start` subcommand ([see below](#start-testnet)). + +In order to initialize the files for a test network, run the following command: + +```bash +simd testnet init-files +``` + +You should see the following output in your terminal: + +```bash +Successfully initialized 4 node directories +``` + +The default output directory is a relative `.testnets` directory. Let's take a look at the files created within the `.testnets` directory. + +### gentxs + +The `gentxs` directory includes a genesis transaction for each validator node. Each file includes a JSON encoded genesis transaction used to register a validator node at the time of genesis. The genesis transactions are added to the `genesis.json` file within each node directory during the initilization process. + +### nodes + +A node directory is created for each validator node. Within each node directory is a `simd` directory. The `simd` directory is the home directory for each node, which includes the configuration and data files for that node (i.e. the same files included in the default `~/.simapp` directory when running a single node). + +## Start Testnet + +Now, let's take a look at the `start` subcommand. + +The `start` subcommand both initializes and starts an in-process test network. This is the fastest way to spin up a local test network for testing purposes. + +You can start the local test network by running the following command: + +```bash +simd testnet start +``` + +You should see something similar to the following: + +```bash +acquiring test network lock +preparing test network with chain-id "chain-mtoD9v" + + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++ THIS MNEMONIC IS FOR TESTING PURPOSES ONLY ++ +++ DO NOT USE IN PRODUCTION ++ +++ ++ +++ sustain know debris minute gate hybrid stereo custom ++ +++ divorce cross spoon machine latin vibrant term oblige ++ +++ moment beauty laundry repeat grab game bronze truly ++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + +starting test network... +started test network +press the Enter Key to terminate +``` + +The first validator node is now running in-process, which means the test network will terminate once you either close the terminal window or you press the Enter key. In the output, the mnemonic phrase for the first validator node is provided for testing purposes. The validator node is using the same default addresses being used when initializing and starting a single node (no need to provide a `--node` flag). + +Check the status of the first validator node: + +```shell +simd status +``` + +Import the key from the provided mnemonic: + +```shell +simd keys add test --recover --keyring-backend test +``` + +Check the balance of the account address: + +```shell +simd q bank balances [address] +``` + +Use this test account to manually test against the test network. + +## Testnet Options + +You can customize the configuration of the test network with flags. In order to see all flag options, append the `--help` flag to each command. diff --git a/docs/user/run-node/06-run-production.md b/docs/user/run-node/06-run-production.md new file mode 100644 index 000000000000..807ceea56efc --- /dev/null +++ b/docs/user/run-node/06-run-production.md @@ -0,0 +1,269 @@ +--- +sidebar_position: 1 +--- + +# Running in Production + +:::note Synopsis +This section describes how to securely run a node in a public setting and/or on a mainnet on one of the many Cosmos SDK public blockchains. +::: + +When operating a node, full node or validator, in production it is important to set your server up securely. + +:::note +There are many different ways to secure a server and your node, the described steps here is one way. To see another way of setting up a server see the [run in production tutorial](https://tutorials.cosmos.network/hands-on-exercise/5-run-in-prod/1-overview.html). +::: + +:::note +This walkthrough assumes the underlying operating system is Ubuntu. +::: + +## Sever Setup + +### User + +When creating a server most times it is created as user `root`. This user has heightened privileges on the server. When operating a node, it is recommended to not run your node as the root user. + +1. Create a new user + +```bash +sudo adduser change_me +``` + +2. We want to allow this user to perform sudo tasks + +```bash +sudo usermod -aG sudo change_me +``` + +Now when logging into the server, the non `root` user can be used. + +### Go + +1. Install the [Go](https://go.dev/doc/install) version preconized by the application. + +:::warning +In the past, validators [have had issues](https://github.com/cosmos/cosmos-sdk/issues/13976) when using different versions of Go. It is recommended that the whole validator set uses the version of Go that is preconized by the application. +::: + +### Firewall + +Nodes should not have all ports open to the public, this is a simple way to get DDOS'd. Secondly it is recommended by [CometBFT](github.com/cometbft/cometbft) to never expose ports that are not required to operate a node. + +When setting up a firewall there are a few ports that can be open when operating a Cosmos SDK node. There is the CometBFT json-RPC, prometheus, p2p, remote signer and Cosmos SDK GRPC and REST. If the node is being operated as a node that does not offer endpoints to be used for submission or querying then a max of three endpoints are needed. + +Most, if not all servers come equipped with [ufw](https://help.ubuntu.com/community/UFW). Ufw will be used in this tutorial. + +1. Reset UFW to disallow all incoming connections and allow outgoing + +```bash +sudo ufw default deny incoming +sudo ufw default allow outgoing +``` + +2. Lets make sure that port 22 (ssh) stays open. + +```bash +sudo ufw allow ssh +``` + +or + +```bash +sudo ufw allow 22 +``` + +Both of the above commands are the same. + +3. Allow Port 26656 (cometbft p2p port). If the node has a modified p2p port then that port must be used here. + +```bash +sudo ufw allow 26656/tcp +``` + +4. Allow port 26660 (cometbft [prometheus](https://prometheus.io)). This acts as the applications monitoring port as well. + +```bash +sudo ufw allow 26660/tcp +``` + +5. IF the node which is being setup would like to expose CometBFTs jsonRPC and Cosmos SDK GRPC and REST then follow this step. (Optional) + +##### CometBFT JsonRPC + +```bash +sudo ufw allow 26657/tcp +``` + +##### Cosmos SDK GRPC + +```bash +sudo ufw allow 9090/tcp +``` + +##### Cosmos SDK REST + +```bash +sudo ufw allow 1317/tcp +``` + +6. Lastly, enable ufw + +```bash +sudo ufw enable +``` + +### Signing + +If the node that is being started is a validator there are multiple ways a validator could sign blocks. + +#### File + +File based signing is the simplest and default approach. This approach works by storing the consensus key, generated on initialization, to sign blocks. This approach is only as safe as your server setup as if the server is compromised so is your key. This key is located in the `config/priv_val_key.json` directory generated on initialization. + +A second file exists that user must be aware of, the file is located in the data directory `data/priv_val_state.json`. This file protects your node from double signing. It keeps track of the consensus keys last sign height, round and latest signature. If the node crashes and needs to be recovered this file must be kept in order to ensure that the consensus key will not be used for signing a block that was previously signed. + +#### Remote Signer + +A remote signer is a secondary server that is separate from the running node that signs blocks with the consensus key. This means that the consensus key does not live on the node itself. This increases security because your full node which is connected to the remote signer can be swapped without missing blocks. + +The two most used remote signers are [tmkms](https://github.com/iqlusioninc/tmkms) from [Iqlusion](https://www.iqlusion.io) and [horcrux](https://github.com/strangelove-ventures/horcrux) from [Strangelove](https://strange.love). + +##### TMKMS + +###### Dependencies + +1. Update server dependencies and install extras needed. + +```sh +sudo apt update -y && sudo apt install build-essential curl jq -y +``` + +2. Install Rust: + +```sh +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh +``` + +3. Install Libusb: + +```sh +sudo apt install libusb-1.0-0-dev +``` + +###### Setup + +There are two ways to install tmkms, from source or `cargo install`. In the examples we will cover downloading or building from source and using softsign. Softsign stands for software signing, but you could use a [yubihsm](https://www.yubico.com/products/hardware-security-module/) as your signing key if you wish. + +1. Build: + +From source: + +```bash +cd $HOME +git clone https://github.com/iqlusioninc/tmkms.git +cd $HOME/tmkms +cargo install tmkms --features=softsign +tmkms init config +tmkms softsign keygen ./config/secrets/secret_connection_key +``` + +or + +Cargo install: + +```bash +cargo install tmkms --features=softsign +tmkms init config +tmkms softsign keygen ./config/secrets/secret_connection_key +``` + +:::note +To use tmkms with a yubikey install the binary with `--features=yubihsm`. +::: + +2. Migrate the validator key from the full node to the new tmkms instance. + +```bash +scp user@123.456.32.123:~/.simd/config/priv_validator_key.json ~/tmkms/config/secrets +``` + +3. Import the validator key into tmkms. + +```bash +tmkms softsign import $HOME/tmkms/config/secrets/priv_validator_key.json $HOME/tmkms/config/secrets/priv_validator_key +``` + +At this point, it is necessary to delete the `priv_validator_key.json` from the validator node and the tmkms node. Since the key has been imported into tmkms (above) it is no longer necessary on the nodes. The key can be safely stored offline. + +4. Modifiy the `tmkms.toml`. + +```bash +vim $HOME/tmkms/config/tmkms.toml +``` + +This example shows a configuration that could be used for soft signing. The example has an IP of `123.456.12.345` with a port of `26659` a chain_id of `test-chain-waSDSe`. These are items that most be modified for the usecase of tmkms and the network. + +```toml +# CometBFT KMS configuration file + +## Chain Configuration + +[[chain]] +id = "osmosis-1" +key_format = { type = "bech32", account_key_prefix = "cosmospub", consensus_key_prefix = "cosmosvalconspub" } +state_file = "/root/tmkms/config/state/priv_validator_state.json" + +## Signing Provider Configuration + +### Software-based Signer Configuration + +[[providers.softsign]] +chain_ids = ["test-chain-waSDSe"] +key_type = "consensus" +path = "/root/tmkms/config/secrets/priv_validator_key" + +## Validator Configuration + +[[validator]] +chain_id = "test-chain-waSDSe" +addr = "tcp://123.456.12.345:26659" +secret_key = "/root/tmkms/config/secrets/secret_connection_key" +protocol_version = "v0.34" +reconnect = true +``` + +5. Set the address of the tmkms instance. + +```bash +vim $HOME/.simd/config/config.toml + +priv_validator_laddr = "tcp://127.0.0.1:26659" +``` + +:::tip +The above address it set to `127.0.0.1` but it is recommended to set the tmkms server to secure the startup +::: + +:::tip +It is recommended to comment or delete the lines that specify the path of the validator key and validator: + +```toml +# Path to the JSON file containing the private key to use as a validator in the consensus protocol +# priv_validator_key_file = "config/priv_validator_key.json" + +# Path to the JSON file containing the last sign state of a validator +# priv_validator_state_file = "data/priv_validator_state.json" +``` + +::: + +6. Start the two processes. + +```bash +tmkms start -c $HOME/tmkms/config/tmkms.toml +``` + +```bash +simd start +``` diff --git a/docs/user/run-node/07-multisig-guide.md b/docs/user/run-node/07-multisig-guide.md new file mode 100644 index 000000000000..f7be5b1f4574 --- /dev/null +++ b/docs/user/run-node/07-multisig-guide.md @@ -0,0 +1,108 @@ +--- +sidebar_position: 1 +--- + +# Guide to Multisig transactions + +## Overview + +Multisignature accounts are accounts that are generated from multiple public keys. A multisig necessitates that any transaction made on its behalf must be signed by a specified threshold of its members. + +A common use case for multisigs is to increase security of a signing account, and/or enable multiple parties to agree on and authorize a transaction. + +The first step is to create a multisig signing key by using the public keys of all possible signers and the minimum threshold of addresses that are needed to sign any transaction from the account. The threshold can be the same amount as the total number of addresses comprising the multisig. + +Whatever machine is generating the multisig, it should at least have all of the public keys imported into the same keyring. + +When you want to create a multisig transaction, you would create the transaction as normal, but instead of signing it with a single account's private key, you would need to sign it with the private keys of the accounts that make up the multisig key. + +This is done by signing the transaction multiple times, once with each private key. The order of the signatures matters and must match the order of the public keys in the multisig key. + +Once you have a transaction with the necessary signatures, it can be broadcasted to the network. The network will verify that the transaction has the necessary signatures from the accounts in the multisig key before it is executed. + +## Step by step guide to multisig transactions + +This tutorial will use the test keyring which will store the keys in the default home directory `~/.simapp` unless otherwise specified. +Verify which keys are available in the test keyring by running `--keyring-backend test`. + +Prior to this tutorial set the keyring backend to "test" in `~/.simapp/client.toml` to always the test keyring which will specify a consistent keyring for the entirety of the tutorial. Additionally, set the default keyring by running `simd config set client keyring-backend test`. + +```shell +simd keys list +``` + +If you don't already have accounts listed create the accounts using the below. + +```shell +simd keys add alice +simd keys add bob +simd keys add recipient +``` + +Alternatively the public keys comprising the multisig can be imported into the keyring. + +```shell +simd keys add alice --pubkey --keyring backend test +``` + +Create the multisig account between bob and alice. + +```shell +simd keys add alice-bob-multisig --multisig alice,bob --multisig-threshold 2 +``` + +Before generating any transaction, verify the balance of each account and note the amount. This step is crucial to confirm that the transaction can be processed successfully. + +```shell +simd query bank balances my_validator +simd query bank balances alice-bob-multisig +``` + +Ensure that the alice-bob-multisig account is funded with a sufficient balance to complete the transaction (gas included). In our case, the genesis account, my_validator, holds our funds. Therefore, we will transfer funds from the `my_validator` account to the `alice-bob-multisig` account. +Fund the multisig by sending it `stake` from the genesis account. + +```shell + simd tx bank send my_validator alice-bob-multisig "10000stake" +``` + +Check both accounts again to see if the funds have transferred. + +```shell +simd query bank balances alice-bob-multisig +``` + +Initiate the transaction. This command will create a transaction from the multisignature account `alice-bob-multisig` to send 1000stake to the recipient account. The transaction will be generated but not broadcasted yet. + +```shell +simd tx bank send alice-bob-multisig recipient 1000stake --generate-only --chain-id my-test-chain > tx.json +``` + +Alice signs the transaction using their key and refers to the multisig address. Execute the command below to accomplish this: + +```shell +simd tx sign --from alice --multisig=cosmos1re6mg24kvzjzmwmly3dqrqzdkruxwvctw8wwds tx.json --chain-id my-test-chain > tx-signed-alice.json +``` + +Let's repeat for Bob. + +```shell +simd tx sign --from bob --multisig=cosmos1re6mg24kvzjzmwmly3dqrqzdkruxwvctw8wwds tx.json --chain-id my-test-chain > tx-signed-bob.json +``` + +Execute a multisign transaction by using the `simd tx multisign` command. This command requires the names and signed transactions of all the participants in the multisig account. Here, Alice and Bob are the participants: + +```shell +simd tx multisign tx.json alice-bob-multisig tx-signed-alice.json tx-signed-bob.json --chain-id my-test-chain > tx-signed.json +``` + +Once the multisigned transaction is generated, it needs to be broadcasted to the network. This is done using the simd tx broadcast command: + +```shell +simd tx broadcast tx-signed.json --chain-id my-test-chain --gas auto --fees 250stake +``` + +Once the transaction is broadcasted, it's a good practice to verify if the transaction was successful. You can query the recipient's account balance again to confirm if the funds were indeed transferred: + +```shell +simd query bank balances alice-bob-multisig +``` diff --git a/docs/user/run-node/08-onchain-multisig.md b/docs/user/run-node/08-onchain-multisig.md new file mode 100644 index 000000000000..a93e59620e54 --- /dev/null +++ b/docs/user/run-node/08-onchain-multisig.md @@ -0,0 +1,248 @@ +--- +sidebar_position: 1 +--- + +# Guide to On-Chain Multisig transactions + +## Overview + +Multisignature **on-chain** accounts are an improvement over the previous implementation as these introduce a new set of +features. + +### Threshold and quorums + +The previous implementation only allowed for m-of-n multisig accounts, where m is the number of signatures required to +authorize a transaction and n is the total number of signers. The new implementation allows for more flexibility by +introducing threshold and quorum values. The quorum is the minimum voting power to make a proposal valid, while the +threshol is the minimum of voting power of YES votes to pass a proposal. + +### Revote + +Multisigs can allow members to change their votes after the initial vote. This is useful when a member changes their mind +or when new information becomes available. + +### Early execution + +Multisigs can be configured to allow for early execution of proposals. This is useful when a proposal is time-sensitive or +when the proposer wants to execute the proposal as soon as it reaches the threshold. It can also be used to mimic the +behavior of the previous multisig implementation. + +### Voting period + +Multisigs can be configured to have a voting period. This is the time window during which members can vote on a proposal. +If the proposal does not reach the threshold within the voting period, it is considered failed. + +## Setup + +We'll create a multisig with 3 members with a 2/3 passing threshold. + +First create the 3 members, Alice, Bob and Carol: + +```bash! +simd keys add alice --keyring-backend test --home ./.testnets/node0/simd/ +simd keys add bob --keyring-backend test --home ./.testnets/node0/simd/ +simd keys add carol --keyring-backend test --home ./.testnets/node0/simd/ +``` + +And we initialize them with some tokens (sent from one of our nodes): + +```bash! +simd tx bank send $(simd keys show node0 --address --keyring-backend=test --home ./.testnets/node0/simd/) $(simd keys show alice --address --keyring-backend=test --home ./.testnets/node0/simd/) 100stake --fees 5stake --chain-id $CHAINID --keyring-backend test --home ./.testnets/node0/simd/ +simd tx bank send $(simd keys show node0 --address --keyring-backend=test --home ./.testnets/node0/simd/) $(simd keys show bob --address --keyring-backend=test --home ./.testnets/node0/simd/) 100stake --fees 5stake --chain-id $CHAINID --keyring-backend test --home ./.testnets/node0/simd/ +simd tx bank send $(simd keys show node0 --address --keyring-backend=test --home ./.testnets/node0/simd/) $(simd keys show carol --address --keyring-backend=test --home ./.testnets/node0/simd/) 100stake --fees 5stake --chain-id $CHAINID --keyring-backend test --home ./.testnets/node0/simd/ +``` + +Now we craft our initialization message, in it we'll include the members' addresses, their weights and the configuration of our multisig. + +```json +{ + "members": [ + { + "address": "cosmos1pr26h2vq9adq3acvh37pz6wtk65u3y8798scq0", + "weight": 1000 + }, + { + "address": "cosmos1j4p2xlg393rg4mma0058alzgvkrjdddd2f5fll", + "weight": 1000 + }, + { + "address": "cosmos1vaqh39cdex9sgr46ef0tdln5cn0hdyd3s0lx4l", + "weight": 1000 + } + ], + "config": { + "threshold": 2000, + "quorum": 2000, + "voting_period": 86400, + "revote": false, + "early_execution": true + } +} +``` + +In the configuration we set the threshold and quorum to the same, 2/3 of the members must vote yes to pass the proposal. Other configurations can set the quorum and threshold to different values to mimic how organizations work. + +We've also set `early_execution` to true, to allow executing as soon as the proposal passes. + +Voting period is in seconds, so we've set that to 24h. And finally `revote` was set to false, because we don't want to allow members to change their vote mid-way through. + +To initialize the multisig, we have to run the `accounts init` passing the account type and the json we created. + + +```bash! +initcontents=$(cat init.json) +simd tx accounts init multisig $initcontents --fees 5stake --chain-id $CHAINID --keyring-backend test --home ./.testnets/node0/simd/ --from alice +``` + +If everything goes well, we'll get back a tx hash, and we'll check the tx result to get our newly created multisig's address. + +```bash! +simd q tx 472B5B4E181D2F399C0ACE4DEEB26FE4351D13E593ED8E793B005C48BFD32621 --output json | jq -r '.events[] | select(.type == "account_creation") | .attributes[] | select(.key == "address") | .value' +``` + +In this case, the address is `cosmos1uds6tz96dxfllz7tz3s3tm8tlg6x95g0mc2987sx6psjz98qlpss89sheu`. We can now send tokens to it, just like to a normal account. + +```bash! +simd tx bank send $(simd keys show node0 --address --keyring-backend=test --home ./.testnets/node0/simd/) cosmos1uds6tz96dxfllz7tz3s3tm8tlg6x95g0mc2987sx6psjz98qlpss89sheu 10000stake --fees 5stake --chain-id $CHAINID --keyring-backend test --home ./.testnets/node0/simd/ +``` + +## Proposals + +#### Create proposal + +In this multisig, every action is a proposal. We'll do a simple proposal to send tokens from the multisig to Alice. + +```json +{ + "proposal": { + "title": "Send 1000 tokens to Alice", + "summary": "Alice is a great multisig member so let's pay her.", + "messages": [ + { + "@type": "/cosmos.bank.v1beta1.MsgSend", + "from_address": "cosmos1uds6tz96dxfllz7tz3s3tm8tlg6x95g0mc2987sx6psjz98qlpss89sheu", + "to_address": "cosmos1pr26h2vq9adq3acvh37pz6wtk65u3y8798scq0", + "amount": [ + { + "denom": "stake", + "amount": "1000" + } + ] + } + ] + } +} +``` + +> The content of messages was created using a simple `tx send` command and passing the flag `--generate-only` so we could copy the message. + +Now we send the tx that will create the proposal: + +```bash! +propcontents=$(cat createprop.json) +simd tx accounts execute cosmos1uds6tz96dxfllz7tz3s3tm8tlg6x95g0mc2987sx6psjz98qlpss89sheu cosmos.accounts.defaults.multisig.v1.MsgCreateProposal $propcontents --fees 5stake --chain-id $CHAINID --keyring-backend test --home ./.testnets/node0/simd/ --from alice +``` + +This will again return a tx hash that we can use to find out the newly created proposal. + +```bash! +simd q tx 5CA4420B67FB040B3DF2484CB875E030123662F43AE9958A9F8028C1281C8654 --output json | jq -r '.events[] | select(.type == "proposal_created") | .attributes[] | select(.key == "proposal_id") | .value' +``` + +In this case, because this is the first proposal, we'll get that the proposal ID is 0. We can use this to query it. + +```bash! +simd q accounts query cosmos1uds6tz96dxfllz7tz3s3tm8tlg6x95g0mc2987sx6psjz98qlpss89sheu cosmos.accounts.defaults.multisig.v1.QueryProposal '{"proposal_id":1}' +``` + +We get back all the details from the proposal, including the end of the voting period and the current status of the proposal. + +```yaml +response: + '@type': /cosmos.accounts.defaults.multisig.v1.QueryProposalResponse + proposal: + messages: + - '@type': /cosmos.bank.v1beta1.MsgSend + amount: + - amount: "1000" + denom: stake + from_address: cosmos1uds6tz96dxfllz7tz3s3tm8tlg6x95g0mc2987sx6psjz98qlpss89sheu + to_address: cosmos1pr26h2vq9adq3acvh37pz6wtk65u3y8798scq0 + status: PROPOSAL_STATUS_VOTING_PERIOD + summary: Alice is a great multisig member so let's pay her. + title: Send 1000 tokens to Alice + voting_period_end: "1717064354" +``` + +### Vote on the proposal + +Just like before, we'll use `tx accounts execute`, but this time to vote. As we have a 2/3 passing threshold, we have to vote with at least 2 members. + +```bash! +simd tx accounts execute cosmos1uds6tz96dxfllz7tz3s3tm8tlg6x95g0mc2987sx6psjz98qlpss89sheu cosmos.accounts.defaults.multisig.v1.MsgVote '{"proposal_id":0, "vote":"VOTE_OPTION_YES"}' --fees 5stake --chain-id $CHAINID --keyring-backend test --home ./.testnets/node0/simd/ --from alice --yes +simd tx accounts execute cosmos1uds6tz96dxfllz7tz3s3tm8tlg6x95g0mc2987sx6psjz98qlpss89sheu cosmos.accounts.defaults.multisig.v1.MsgVote '{"proposal_id":0, "vote":"VOTE_OPTION_YES"}' --fees 5stake --chain-id $CHAINID --keyring-backend test --home ./.testnets/node0/simd/ --from bob --yes +``` + +### Execute the proposal + +Once we got enough votes, we can execute the proposal. + +```bash! +simd tx accounts execute cosmos1uds6tz96dxfllz7tz3s3tm8tlg6x95g0mc2987sx6psjz98qlpss89sheu cosmos.accounts.defaults.multisig.v1.MsgExecuteProposal '{"proposal_id":0}' --fees 5stake --chain-id $CHAINID --keyring-backend test --home ./.testnets/node0/simd/ --from bob --yes +``` + +Querying the tx hash will get us information about the success or failure of the proposal execution. + +```yaml +- attributes: + - index: true + key: proposal_id + value: "0" + - index: true + key: yes_votes + value: "2000" + - index: true + key: no_votes + value: "0" + - index: true + key: abstain_votes + value: "0" + - index: true + key: status + value: PROPOSAL_STATUS_PASSED + - index: true + key: reject_err + value: + - index: true + key: exec_err + value: + - index: true + key: msg_index + value: "0" + type: proposal_tally +``` + +Now checking the multisig and Alice's balance, we'll see that the send was performed correctly. + +```bash! +simd q bank balances cosmos1uds6tz96dxfllz7tz3s3tm8tlg6x95g0mc2987sx6psjz98qlpss89sheu + +balances: +- amount: "9000" + denom: stake +pagination: + total: "1" +``` + +```bash! +simd q bank balances $(./build/simd keys show alice --address) + +balances: +- amount: "1080" + denom: stake +pagination: + total: "1" +``` + + + diff --git a/docs/user/run-node/_category_.json b/docs/user/run-node/_category_.json new file mode 100644 index 000000000000..7fcac509a58b --- /dev/null +++ b/docs/user/run-node/_category_.json @@ -0,0 +1,5 @@ +{ + "label": "Running a Node, API and CLI", + "position": 1, + "link": null +} \ No newline at end of file diff --git a/docs/user/user.md b/docs/user/user.md new file mode 100644 index 000000000000..5429e8ad6e29 --- /dev/null +++ b/docs/user/user.md @@ -0,0 +1,10 @@ +--- +sidebar_position: 0 +--- +# User Guides + +This section is designed for developers who are using the Cosmos SDK to build applications. It provides essential guides and references to effectively use the SDK's features. + +* [Setting up keys](./run-node/00-keyring.md) - Learn how to set up secure key management using the Cosmos SDK's keyring feature. This guide provides a streamlined approach to cryptographic key handling, which is crucial for securing your application. +* [Running a node](./run-node/01-run-node.md) - This guide provides step-by-step instructions to deploy and manage a node in the Cosmos network. It ensures a smooth and reliable operation of your blockchain application by covering all the necessary setup and maintenance steps. +* [CLI](./run-node/02-interact-node.md) - Discover how to navigate and interact with the Cosmos SDK using the Command Line Interface (CLI). This section covers efficient and powerful command-based operations that can help you manage your application effectively. From 5b53ccaf0c1b2e7724fa69898340b6e04024b2f0 Mon Sep 17 00:00:00 2001 From: psiphi5 <158285278+psiphi5@users.noreply.github.com> Date: Thu, 10 Oct 2024 18:31:29 +1100 Subject: [PATCH 17/57] feat(tools/cosmovisor): cosmovisor batch upgrades (#21790) Co-authored-by: Julien Robert --- tools/cosmovisor/CHANGELOG.md | 1 + tools/cosmovisor/args.go | 5 + .../cosmovisor/cmd/cosmovisor/add_upgrade.go | 69 +++++--- .../cmd/cosmovisor/batch_upgrade.go | 143 ++++++++++++++++ tools/cosmovisor/cmd/cosmovisor/root.go | 1 + tools/cosmovisor/go.mod | 4 +- tools/cosmovisor/process.go | 159 ++++++++++++++++++ 7 files changed, 354 insertions(+), 28 deletions(-) create mode 100644 tools/cosmovisor/cmd/cosmovisor/batch_upgrade.go diff --git a/tools/cosmovisor/CHANGELOG.md b/tools/cosmovisor/CHANGELOG.md index 1285007e6d84..3dd65d805595 100644 --- a/tools/cosmovisor/CHANGELOG.md +++ b/tools/cosmovisor/CHANGELOG.md @@ -38,6 +38,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Features +* [#21790](https://github.com/cosmos/cosmos-sdk/pull/21790) Add `add-batch-upgrade` command. * [#21972](https://github.com/cosmos/cosmos-sdk/pull/21972) Add `prepare-upgrade` command ### Improvements diff --git a/tools/cosmovisor/args.go b/tools/cosmovisor/args.go index 577a16f251fc..733f561faf1a 100644 --- a/tools/cosmovisor/args.go +++ b/tools/cosmovisor/args.go @@ -111,6 +111,11 @@ func (cfg *Config) UpgradeInfoFilePath() string { return filepath.Join(cfg.Home, "data", upgradetypes.UpgradeInfoFilename) } +// UpgradeInfoBatchFilePath is the same as UpgradeInfoFilePath but with a batch suffix. +func (cfg *Config) UpgradeInfoBatchFilePath() string { + return cfg.UpgradeInfoFilePath() + ".batch" +} + // SymLinkToGenesis creates a symbolic link from "./current" to the genesis directory. func (cfg *Config) SymLinkToGenesis() (string, error) { // workdir is set to cosmovisor directory so relative diff --git a/tools/cosmovisor/cmd/cosmovisor/add_upgrade.go b/tools/cosmovisor/cmd/cosmovisor/add_upgrade.go index a197f33bc1dc..3832efa05e81 100644 --- a/tools/cosmovisor/cmd/cosmovisor/add_upgrade.go +++ b/tools/cosmovisor/cmd/cosmovisor/add_upgrade.go @@ -19,7 +19,7 @@ func NewAddUpgradeCmd() *cobra.Command { Short: "Add APP upgrade binary to cosmovisor", SilenceUsage: true, Args: cobra.ExactArgs(2), - RunE: AddUpgrade, + RunE: addUpgradeCmd, } addUpgrade.Flags().Bool(cosmovisor.FlagForce, false, "overwrite existing upgrade binary / upgrade-info.json file") @@ -28,26 +28,14 @@ func NewAddUpgradeCmd() *cobra.Command { return addUpgrade } -// AddUpgrade adds upgrade info to manifest -func AddUpgrade(cmd *cobra.Command, args []string) error { - configPath, err := cmd.Flags().GetString(cosmovisor.FlagCosmovisorConfig) - if err != nil { - return fmt.Errorf("failed to get config flag: %w", err) - } - - cfg, err := cosmovisor.GetConfigFromFile(configPath) - if err != nil { - return err - } - +// addUpgrade adds upgrade info to manifest +func addUpgrade(cfg *cosmovisor.Config, force bool, upgradeHeight int64, upgradeName, executablePath, upgradeInfoPath string) error { logger := cfg.Logger(os.Stdout) - upgradeName := args[0] if !cfg.DisableRecase { - upgradeName = strings.ToLower(args[0]) + upgradeName = strings.ToLower(upgradeName) } - executablePath := args[1] if _, err := os.Stat(executablePath); err != nil { if os.IsNotExist(err) { return fmt.Errorf("invalid executable path: %w", err) @@ -68,11 +56,6 @@ func AddUpgrade(cmd *cobra.Command, args []string) error { return fmt.Errorf("failed to read binary: %w", err) } - force, err := cmd.Flags().GetBool(cosmovisor.FlagForce) - if err != nil { - return fmt.Errorf("failed to get force flag: %w", err) - } - if err := saveOrAbort(cfg.UpgradeBin(upgradeName), executableData, force); err != nil { return err } @@ -80,9 +63,7 @@ func AddUpgrade(cmd *cobra.Command, args []string) error { logger.Info(fmt.Sprintf("Using %s for %s upgrade", executablePath, upgradeName)) logger.Info(fmt.Sprintf("Upgrade binary located at %s", cfg.UpgradeBin(upgradeName))) - if upgradeHeight, err := cmd.Flags().GetInt64(cosmovisor.FlagUpgradeHeight); err != nil { - return fmt.Errorf("failed to get upgrade-height flag: %w", err) - } else if upgradeHeight > 0 { + if upgradeHeight > 0 { plan := upgradetypes.Plan{Name: upgradeName, Height: upgradeHeight} if err := plan.ValidateBasic(); err != nil { panic(fmt.Errorf("something is wrong with cosmovisor: %w", err)) @@ -94,16 +75,52 @@ func AddUpgrade(cmd *cobra.Command, args []string) error { return fmt.Errorf("failed to marshal upgrade plan: %w", err) } - if err := saveOrAbort(cfg.UpgradeInfoFilePath(), planData, force); err != nil { + if err := saveOrAbort(upgradeInfoPath, planData, force); err != nil { return err } - logger.Info(fmt.Sprintf("%s created, %s upgrade binary will switch at height %d", cfg.UpgradeInfoFilePath(), upgradeName, upgradeHeight)) + logger.Info(fmt.Sprintf("%s created, %s upgrade binary will switch at height %d", upgradeInfoPath, upgradeName, upgradeHeight)) } return nil } +// GetConfig returns a Config using passed-in flag +func getConfigFromCmd(cmd *cobra.Command) (*cosmovisor.Config, error) { + configPath, err := cmd.Flags().GetString(cosmovisor.FlagCosmovisorConfig) + if err != nil { + return nil, fmt.Errorf("failed to get config flag: %w", err) + } + + cfg, err := cosmovisor.GetConfigFromFile(configPath) + if err != nil { + return nil, err + } + return cfg, nil +} + +// addUpgradeCmd parses input flags and adds upgrade info to manifest +func addUpgradeCmd(cmd *cobra.Command, args []string) error { + cfg, err := getConfigFromCmd(cmd) + if err != nil { + return err + } + + upgradeName, executablePath := args[0], args[1] + + force, err := cmd.Flags().GetBool(cosmovisor.FlagForce) + if err != nil { + return fmt.Errorf("failed to get force flag: %w", err) + } + + upgradeHeight, err := cmd.Flags().GetInt64(cosmovisor.FlagUpgradeHeight) + if err != nil { + return fmt.Errorf("failed to get upgrade-height flag: %w", err) + } + + return addUpgrade(cfg, force, upgradeHeight, upgradeName, executablePath, cfg.UpgradeInfoFilePath()) +} + // saveOrAbort saves data to path or aborts if file exists and force is false func saveOrAbort(path string, data []byte, force bool) error { if _, err := os.Stat(path); err == nil { diff --git a/tools/cosmovisor/cmd/cosmovisor/batch_upgrade.go b/tools/cosmovisor/cmd/cosmovisor/batch_upgrade.go new file mode 100644 index 000000000000..a66f65b406ab --- /dev/null +++ b/tools/cosmovisor/cmd/cosmovisor/batch_upgrade.go @@ -0,0 +1,143 @@ +package main + +import ( + "encoding/csv" + "encoding/json" + "fmt" + "os" + "path/filepath" + "strconv" + "strings" + + "github.com/spf13/cobra" + + "cosmossdk.io/tools/cosmovisor" +) + +func NewBatchAddUpgradeCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "add-batch-upgrade [flags]", + Short: "Add multiple upgrade binaries at specified heights to cosmovisor", + Long: `This command allows you to specify multiple upgrades at once at specific heights, copying or creating a batch upgrade file that's actively watched during 'cosmovisor run'. +You can provide upgrades in two ways: + +1. Using --upgrade-file: Specify a path to a headerless CSV batch upgrade file in the format: + upgrade-name,path-to-exec,upgrade-height + +2. Using --upgrade-list: Provide a comma-separated list of upgrades. + Each upgrade is defined by three colon-separated values: + a. upgrade-name: A unique identifier for the upgrade + b. path-to-exec: The file path to the upgrade's executable binary + c. upgrade-height: The block height at which the upgrade should occur + This creates a batch upgrade JSON file with the upgrade-info objects in the upgrade directory. + +Note: You must provide either --upgrade-file or --upgrade-list.`, + Example: `cosmovisor add-batch-upgrade --upgrade-list upgrade_v2:/path/to/v2/binary:1000000,upgrade_v3:/path/to/v3/binary:2000000 + +cosmovisor add-batch-upgrade --upgrade-file /path/to/batch_upgrade.csv`, + SilenceUsage: true, + Args: cobra.NoArgs, + RunE: addBatchUpgrade, + } + + cmd.Flags().String("upgrade-file", "", "Path to a batch upgrade file which is a JSON array of upgrade-info objects") + cmd.Flags().StringSlice("upgrade-list", []string{}, "List of comma-separated upgrades in the format 'name:path/to/binary:height'") + cmd.MarkFlagsMutuallyExclusive("upgrade-file", "upgrade-list") + + return cmd +} + +// addBatchUpgrade takes in multiple specified upgrades and creates a single +// batch upgrade file out of them +func addBatchUpgrade(cmd *cobra.Command, args []string) error { + cfg, err := getConfigFromCmd(cmd) + if err != nil { + return err + } + upgradeFile, err := cmd.Flags().GetString("upgrade-file") + if err == nil && upgradeFile != "" { + return processUpgradeFile(cfg, upgradeFile) + } + upgradeList, err := cmd.Flags().GetStringSlice("upgrade-list") + if err != nil || len(upgradeList) == 0 { + return fmt.Errorf("either --upgrade-file or --upgrade-list must be provided") + } + var splitUpgrades [][]string + for _, upgrade := range upgradeList { + splitUpgrades = append(splitUpgrades, strings.Split(upgrade, ":")) + } + return processUpgradeList(cfg, splitUpgrades) +} + +// processUpgradeList takes in a list of upgrades and creates a batch upgrade file +func processUpgradeList(cfg *cosmovisor.Config, upgradeList [][]string) error { + upgradeInfoPaths := []string{} + for i, upgrade := range upgradeList { + if len(upgrade) != 3 { + return fmt.Errorf("argument at position %d (%s) is invalid", i, upgrade) + } + upgradeName := filepath.Base(upgrade[0]) + upgradePath := upgrade[1] + upgradeHeight, err := strconv.ParseInt(upgrade[2], 10, 64) + if err != nil { + return fmt.Errorf("upgrade height at position %d (%s) is invalid", i, upgrade[2]) + } + upgradeInfoPath := cfg.UpgradeInfoFilePath() + "." + upgradeName + upgradeInfoPaths = append(upgradeInfoPaths, upgradeInfoPath) + if err := addUpgrade(cfg, true, upgradeHeight, upgradeName, upgradePath, upgradeInfoPath); err != nil { + return err + } + } + + var allData []json.RawMessage + for _, uip := range upgradeInfoPaths { + fileData, err := os.ReadFile(uip) + if err != nil { + return fmt.Errorf("error reading file %s: %w", uip, err) + } + + // Verify it's valid JSON + var jsonData json.RawMessage + if err := json.Unmarshal(fileData, &jsonData); err != nil { + return fmt.Errorf("error parsing JSON from file %s: %w", uip, err) + } + + // Add to our slice + allData = append(allData, jsonData) + } + + // Marshal the combined data + batchData, err := json.MarshalIndent(allData, "", " ") + if err != nil { + return fmt.Errorf("error marshaling combined JSON: %w", err) + } + + // Write to output file + err = os.WriteFile(cfg.UpgradeInfoBatchFilePath(), batchData, 0o600) + if err != nil { + return fmt.Errorf("error writing combined JSON to file: %w", err) + } + + return nil +} + +// processUpgradeFile takes in a CSV batch upgrade file, parses it and calls processUpgradeList +func processUpgradeFile(cfg *cosmovisor.Config, upgradeFile string) error { + file, err := os.Open(upgradeFile) + if err != nil { + return fmt.Errorf("error opening upgrade CSV file %s: %w", upgradeFile, err) + } + defer file.Close() + + r := csv.NewReader(file) + r.FieldsPerRecord = 3 + r.TrimLeadingSpace = true + records, err := r.ReadAll() + if err != nil { + return fmt.Errorf("error parsing upgrade CSV file %s: %w", upgradeFile, err) + } + if err := processUpgradeList(cfg, records); err != nil { + return err + } + return nil +} diff --git a/tools/cosmovisor/cmd/cosmovisor/root.go b/tools/cosmovisor/cmd/cosmovisor/root.go index de5e06d83e3e..92b1af2e11cf 100644 --- a/tools/cosmovisor/cmd/cosmovisor/root.go +++ b/tools/cosmovisor/cmd/cosmovisor/root.go @@ -20,6 +20,7 @@ func NewRootCmd() *cobra.Command { NewVersionCmd(), NewAddUpgradeCmd(), NewShowUpgradeInfoCmd(), + NewBatchAddUpgradeCmd(), NewPrepareUpgradeCmd(), ) diff --git a/tools/cosmovisor/go.mod b/tools/cosmovisor/go.mod index 8174ce1566b7..b04d101494bf 100644 --- a/tools/cosmovisor/go.mod +++ b/tools/cosmovisor/go.mod @@ -5,6 +5,8 @@ go 1.23 require ( cosmossdk.io/log v1.4.1 cosmossdk.io/x/upgrade v0.1.4 + github.com/cosmos/cosmos-sdk v0.50.7 + github.com/fsnotify/fsnotify v1.7.0 github.com/otiai10/copy v1.14.0 github.com/pelletier/go-toml/v2 v2.2.3 github.com/spf13/cobra v1.8.1 @@ -51,7 +53,6 @@ require ( github.com/cosmos/btcutil v1.0.5 // indirect github.com/cosmos/cosmos-db v1.0.2 // indirect github.com/cosmos/cosmos-proto v1.0.0-beta.5 // indirect - github.com/cosmos/cosmos-sdk v0.50.7 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/gogoproto v1.7.0 // indirect @@ -69,7 +70,6 @@ require ( github.com/emicklei/dot v1.6.2 // indirect github.com/fatih/color v1.17.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect - github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/getsentry/sentry-go v0.28.0 // indirect github.com/go-kit/kit v0.13.0 // indirect github.com/go-kit/log v0.2.1 // indirect diff --git a/tools/cosmovisor/process.go b/tools/cosmovisor/process.go index ac759bde39f4..4e9fad8be81f 100644 --- a/tools/cosmovisor/process.go +++ b/tools/cosmovisor/process.go @@ -1,6 +1,7 @@ package cosmovisor import ( + "context" "encoding/json" "errors" "fmt" @@ -9,16 +10,23 @@ import ( "os/exec" "os/signal" "path/filepath" + "sort" "strconv" "strings" + "sync" "syscall" "time" + "github.com/fsnotify/fsnotify" "github.com/otiai10/copy" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" "cosmossdk.io/log" "cosmossdk.io/x/upgrade/plan" upgradetypes "cosmossdk.io/x/upgrade/types" + + cmtservice "github.com/cosmos/cosmos-sdk/client/grpc/cmtservice" ) type Launcher struct { @@ -36,6 +44,144 @@ func NewLauncher(logger log.Logger, cfg *Config) (Launcher, error) { return Launcher{logger: logger, cfg: cfg, fw: fw}, nil } +// loadBatchUpgradeFile loads the batch upgrade file into memory, sorted by +// their upgrade heights +func loadBatchUpgradeFile(cfg *Config) ([]upgradetypes.Plan, error) { + var uInfos []upgradetypes.Plan + upgradeInfoFile, err := os.ReadFile(cfg.UpgradeInfoBatchFilePath()) + if os.IsNotExist(err) { + return uInfos, nil + } else if err != nil { + return nil, fmt.Errorf("error while reading %s: %w", cfg.UpgradeInfoBatchFilePath(), err) + } + + if err = json.Unmarshal(upgradeInfoFile, &uInfos); err != nil { + return nil, err + } + sort.Slice(uInfos, func(i, j int) bool { + return uInfos[i].Height < uInfos[j].Height + }) + return uInfos, nil +} + +// BatchUpgradeWatcher starts a watcher loop that swaps upgrade manifests at the correct +// height, given the batch upgrade file. It watches the current state of the chain +// via the websocket API. +func BatchUpgradeWatcher(ctx context.Context, cfg *Config, logger log.Logger) { + // load batch file in memory + uInfos, err := loadBatchUpgradeFile(cfg) + if err != nil { + logger.Warn("failed to load batch upgrade file", "error", err) + uInfos = []upgradetypes.Plan{} + } + + watcher, err := fsnotify.NewWatcher() + if err != nil { + logger.Warn("failed to init watcher", "error", err) + return + } + defer watcher.Close() + err = watcher.Add(filepath.Dir(cfg.UpgradeInfoBatchFilePath())) + if err != nil { + logger.Warn("watcher failed to add upgrade directory", "error", err) + return + } + + var conn *grpc.ClientConn + var grpcErr error + + defer func() { + if conn != nil { + if err := conn.Close(); err != nil { + logger.Warn("couldn't stop gRPC client", "error", err) + } + } + }() + + // Wait for the chain process to be ready +pollLoop: + for { + select { + case <-ctx.Done(): + return + default: + conn, grpcErr = grpc.NewClient(cfg.GRPCAddress, grpc.WithTransportCredentials(insecure.NewCredentials())) + if grpcErr == nil { + break pollLoop + } + time.Sleep(time.Second) + } + } + + client := cmtservice.NewServiceClient(conn) + + var prevUpgradeHeight int64 = -1 + + logger.Info("starting the batch watcher loop") + for { + select { + case event := <-watcher.Events: + if event.Op&(fsnotify.Write|fsnotify.Create) != 0 { + uInfos, err = loadBatchUpgradeFile(cfg) + if err != nil { + logger.Warn("failed to load batch upgrade file", "error", err) + continue + } + } + case <-ctx.Done(): + return + default: + if len(uInfos) == 0 { + // prevent spending extra CPU cycles + time.Sleep(time.Second) + continue + } + resp, err := client.GetLatestBlock(ctx, &cmtservice.GetLatestBlockRequest{}) + if err != nil { + logger.Warn("error getting latest block", "error", err) + time.Sleep(time.Second) + continue + } + + h := resp.SdkBlock.Header.Height + upcomingUpgrade := uInfos[0].Height + // replace upgrade-info and upgrade-info batch file + if h > prevUpgradeHeight && h < upcomingUpgrade { + jsonBytes, err := json.Marshal(uInfos[0]) + if err != nil { + logger.Warn("error marshaling JSON for upgrade-info.json", "error", err, "upgrade", uInfos[0]) + continue + } + if err := os.WriteFile(cfg.UpgradeInfoFilePath(), jsonBytes, 0o600); err != nil { + logger.Warn("error writing upgrade-info.json", "error", err) + continue + } + uInfos = uInfos[1:] + + jsonBytes, err = json.Marshal(uInfos) + if err != nil { + logger.Warn("error marshaling JSON for upgrade-info.json.batch", "error", err, "upgrades", uInfos) + continue + } + if err := os.WriteFile(cfg.UpgradeInfoBatchFilePath(), jsonBytes, 0o600); err != nil { + logger.Warn("error writing upgrade-info.json.batch", "error", err) + // remove the upgrade-info.json.batch file to avoid non-deterministic behavior + err := os.Remove(cfg.UpgradeInfoBatchFilePath()) + if err != nil && !os.IsNotExist(err) { + logger.Warn("error removing upgrade-info.json.batch", "error", err) + return + } + continue + } + prevUpgradeHeight = upcomingUpgrade + } + + // Add a small delay to avoid hammering the gRPC endpoint + time.Sleep(time.Second) + } + } +} + // Run launches the app in a subprocess and returns when the subprocess (app) // exits (either when it dies, or *after* a successful upgrade.) and upgrade finished. // Returns true if the upgrade request was detected and the upgrade process started. @@ -58,10 +204,20 @@ func (l Launcher) Run(args []string, stdin io.Reader, stdout, stderr io.Writer) return false, fmt.Errorf("launching process %s %s failed: %w", bin, strings.Join(args, " "), err) } + ctx, cancel := context.WithCancel(context.Background()) + var wg sync.WaitGroup + wg.Add(1) + go func() { + defer wg.Done() + BatchUpgradeWatcher(ctx, l.cfg, l.logger) + }() + sigs := make(chan os.Signal, 1) signal.Notify(sigs, syscall.SIGQUIT, syscall.SIGTERM) go func() { sig := <-sigs + cancel() + wg.Wait() if err := cmd.Process.Signal(sig); err != nil { l.logger.Error("terminated", "error", err, "bin", bin) os.Exit(1) @@ -94,6 +250,9 @@ func (l Launcher) Run(args []string, stdin io.Reader, stdout, stderr io.Writer) return true, nil } + cancel() + wg.Wait() + return false, nil } From e6a719c1a6c2c2c231f707e9207c6e1390b6d4d3 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Thu, 10 Oct 2024 10:15:33 +0200 Subject: [PATCH 18/57] docs: add docs boilerplate (#22202) --- docs/build/_category_.json | 5 +++++ docs/build/build.md | 13 +++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 docs/build/_category_.json create mode 100644 docs/build/build.md diff --git a/docs/build/_category_.json b/docs/build/_category_.json new file mode 100644 index 000000000000..9f3088236274 --- /dev/null +++ b/docs/build/_category_.json @@ -0,0 +1,5 @@ +{ + "label": "Build", + "position": 0, + "link": null +} \ No newline at end of file diff --git a/docs/build/build.md b/docs/build/build.md new file mode 100644 index 000000000000..3b86eb472b52 --- /dev/null +++ b/docs/build/build.md @@ -0,0 +1,13 @@ +--- +sidebar_position: 0 +--- + +# Build + +* [Building Apps](./building-apps/00-app-go.md) - The documentation in this section will guide you through the process of developing your dApp using the Cosmos SDK framework. +* [Modules](./modules/README.md) - Information about the various modules available in the Cosmos SDK: Auth, Authz, Bank, Crisis, Distribution, Evidence, Feegrant, Governance, Mint, Params, Slashing, Staking, Upgrade, NFT, Consensus, Circuit, Genutil. +* [Migrations](./migrations/01-intro.md) - See what has been updated in each release the process of the transition between versions. +* [Packages](./packages/README.md) - Explore a curated collection of pre-built modules and functionalities, streamlining the development process. +* [Tooling](./tooling/README.md) - A suite of utilities designed to enhance the development workflow, optimizing the efficiency of Cosmos SDK-based projects. +* [ADR's](./architecture/README.md) - Provides a structured repository of key decisions made during the development process, which have been documented and offers rationale behind key decisions being made. +* [REST API](https://docs.cosmos.network/api) - A comprehensive reference for the application programming interfaces (APIs) provided by the SDK. From 910a97af4b76dcde056e1facb0a3b612d23fd1f1 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Thu, 10 Oct 2024 11:19:24 +0200 Subject: [PATCH 19/57] chore: bring v0.52.0-beta.2 changelog to main (#22188) --- CHANGELOG.md | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index db1e8bed256c..e2670454a86a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,31 +44,17 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i * (baseapp) [#20291](https://github.com/cosmos/cosmos-sdk/pull/20291) Simulate nested messages. * (crypto/keyring) [#21653](https://github.com/cosmos/cosmos-sdk/pull/21653) New Linux-only backend that adds Linux kernel's `keyctl` support. -* (runtime) [#21704](https://github.com/cosmos/cosmos-sdk/pull/21704) Add StoreLoader in simappv2. * (client/keys) [#21829](https://github.com/cosmos/cosmos-sdk/pull/21829) Add support for importing hex key using standard input. -* (x/validate) [#21822](https://github.com/cosmos/cosmos-sdk/pull/21822) New module solely responsible for providing ante/post handlers and tx validators for v2. It can be extended by the app developer to provide extra tx validators. - * In comparison to x/auth/tx/config, there is no app config to skip ante/post handlers, as overwriting them in baseapp or not injecting the x/validate module has the same effect. -* (baeapp) [#21979](https://github.com/cosmos/cosmos-sdk/pull/21979) Create CheckTxHandler to allow extending the logic of CheckTx. ### Improvements -* (crypto/ledger) [#22116](https://github.com/cosmos/cosmos-sdk/pull/22116) Improve error message when deriving paths using index >100 -* (sims) [#21613](https://github.com/cosmos/cosmos-sdk/pull/21613) Add sims2 framework and factory methods for simpler message factories in modules -* (modules) [#21963](https://github.com/cosmos/cosmos-sdk/pull/21963) Duplicatable metrics are no more collected in modules. They were unecessary overhead. - ### Bug Fixes -* (sims) [#21952](https://github.com/cosmos/cosmos-sdk/pull/21952) Use liveness matrix for validator sign status in sims * (sims) [#21906](https://github.com/cosmos/cosmos-sdk/pull/21906) Skip sims test when running dry on validators * (cli) [#21919](https://github.com/cosmos/cosmos-sdk/pull/21919) Query address-by-acc-num by account_id instead of id. -* (baseapp) [#21003](https://github.com/cosmos/cosmos-sdk/pull/21003) Align block header when query with latest height. ### API Breaking Changes -* (types/mempool) [#21744](https://github.com/cosmos/cosmos-sdk/pull/21744) Update types/mempool.Mempool interface to take decoded transactions. This avoid to decode the transaction twice. -* (x/auth/tx/config) [#21822](https://github.com/cosmos/cosmos-sdk/pull/21822) Sign mode textual is no more automatically added to tx config when using runtime. Should be added manually on the server side. -* (x/auth/tx/config) [#21822](https://github.com/cosmos/cosmos-sdk/pull/21822) This depinject module now only provide txconfig and tx config options. `x/validate` now handles the providing of ante/post handlers, alongside tx validators for v2. The corresponding app config options have been removed from the depinject module config. - ### Deprecated ## [v0.52.0](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.52.0) - 2024-XX-XX @@ -100,6 +86,9 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i * (crypto/keyring) [#20212](https://github.com/cosmos/cosmos-sdk/pull/20212) Expose the db keyring used in the keystore. * (client/tx) [#20870](https://github.com/cosmos/cosmos-sdk/pull/20870) Add `timeout-timestamp` field for tx body defines time based timeout.Add `WithTimeoutTimestamp` to tx factory. Increased gas cost for processing newly added timeout timestamp field in tx body. * (client) [#21074](https://github.com/cosmos/cosmos-sdk/pull/21074) Add auto cli for node service +* (x/validate) [#21822](https://github.com/cosmos/cosmos-sdk/pull/21822) New module solely responsible for providing ante/post handlers and tx validators for v2. It can be extended by the app developer to provide extra tx validators. + * In comparison to x/auth/tx/config, there is no app config to skip ante/post handlers, as overwriting them in baseapp or not injecting the x/validate module has the same effect. +* (baseapp) [#21979](https://github.com/cosmos/cosmos-sdk/pull/21979) Create CheckTxHandler to allow extending the logic of CheckTx. ### Improvements @@ -144,7 +133,11 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i * (internal) [#21412](https://github.com/cosmos/cosmos-sdk/pull/21412) Using unsafe.String and unsafe.SliceData. * (client) [#21436](https://github.com/cosmos/cosmos-sdk/pull/21436) Use `address.Codec` from client.Context in `tx.Sign`. * (x/genutil) [#21249](https://github.com/cosmos/cosmos-sdk/pull/21249) Incremental JSON parsing for AppGenesis where possible. -* (testnet) [#21941](https://github.com/cosmos/cosmos-sdk/pull/21941) Regenerate addrbook.json for in place testnet. +* (genutil) [#21701](https://github.com/cosmos/cosmos-sdk/pull/21701) Improved error messages for genesis validation. +* (runtime) [#21704](https://github.com/cosmos/cosmos-sdk/pull/21704) Move `upgradetypes.StoreLoader` to runtime and alias it in upgrade for backward compatibility. +* (sims)[#21613](https://github.com/cosmos/cosmos-sdk/pull/21613) Add sims2 framework and factory methods for simpler message factories in modules +* (modules) [#21963](https://github.com/cosmos/cosmos-sdk/pull/21963) Duplicatable metrics are no more collected in modules. They were unecessary overhead. +* (crypto/ledger) [#22116](https://github.com/cosmos/cosmos-sdk/pull/22116) Improve error message when deriving paths using index >100 ### Bug Fixes @@ -157,6 +150,8 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i * (server) [#18994](https://github.com/cosmos/cosmos-sdk/pull/18994) Update server context directly rather than a reference to a sub-object * [#19833](https://github.com/cosmos/cosmos-sdk/pull/19833) Fix some places in which we call Remove inside a Walk. * [#19851](https://github.com/cosmos/cosmos-sdk/pull/19851) Fix some places in which we call Remove inside a Walk (x/staking and x/gov). +* (sims) [#21952](https://github.com/cosmos/cosmos-sdk/pull/21952) Use liveness matrix for validator sign status in sims +* (baseapp) [#21003](https://github.com/cosmos/cosmos-sdk/pull/21003) Align block header when query with latest height. ### API Breaking Changes @@ -230,6 +225,9 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i * (sims) [#21039](https://github.com/cosmos/cosmos-sdk/pull/21039): Remove Baseapp from sims by a new interface `simtypes.AppEntrypoint`. * (x/genutil) [#21372](https://github.com/cosmos/cosmos-sdk/pull/21372) Remove `AddGenesisAccount` for `AddGenesisAccounts`. * (baseapp) [#21413](https://github.com/cosmos/cosmos-sdk/pull/21413) Add `SelectBy` method to `Mempool` interface, which is thread-safe to use. +* (types/mempool) [#21744](https://github.com/cosmos/cosmos-sdk/pull/21744) Update types/mempool.Mempool interface to take decoded transactions. This avoid to decode the transaction twice. +* (x/auth/tx/config) [#21822](https://github.com/cosmos/cosmos-sdk/pull/21822) Sign mode textual is no more automatically added to tx config when using runtime. Should be added manually on the server side. +* (x/auth/tx/config) [#21822](https://github.com/cosmos/cosmos-sdk/pull/21822) This depinject module now only provide txconfig and tx config options. `x/validate` now handles the providing of ante/post handlers, alongside tx validators for v2. The corresponding app config options have been removed from the depinject module config. ### Client Breaking Changes From 04c1590a6e156ff0c8ddd2446dddf8582ed2194c Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Thu, 10 Oct 2024 11:56:49 +0200 Subject: [PATCH 20/57] docs: fix rendering issue (#22211) --- docs/learn/advanced/17-core.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/learn/advanced/17-core.md b/docs/learn/advanced/17-core.md index 85f5b110cec5..b6a453fbb130 100644 --- a/docs/learn/advanced/17-core.md +++ b/docs/learn/advanced/17-core.md @@ -30,7 +30,7 @@ interface to execute arbitrary code in a branched store. This is useful for exe that needs to make changes to the store, but may need to be rolled back if an error occurs. Below is a contrived example based on the `x/epoch` module's BeginBlocker logic. -```go reference +```go func (k Keeper) BeginBlocker(ctx context.Context) error { err := k.EpochInfo.Walk( // ... From 3a03804c148d0da8d6df1ad839b08c50f6896fa1 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Thu, 10 Oct 2024 12:25:26 +0200 Subject: [PATCH 21/57] refactor(store/v2): replace dboptions by dynamic config (#22185) --- store/v2/db/db.go | 4 ++-- store/v2/db/goleveldb.go | 4 ++-- store/v2/db/pebbledb.go | 4 ++-- store/v2/db/rocksdb_noflag.go | 4 ++-- store/v2/options.go | 5 ----- store/v2/root/reader.go | 7 +------ 6 files changed, 9 insertions(+), 19 deletions(-) diff --git a/store/v2/db/db.go b/store/v2/db/db.go index a8c741e45424..3be46d750f39 100644 --- a/store/v2/db/db.go +++ b/store/v2/db/db.go @@ -3,8 +3,8 @@ package db import ( "fmt" + coreserver "cosmossdk.io/core/server" corestore "cosmossdk.io/core/store" - "cosmossdk.io/store/v2" ) type DBType string @@ -18,7 +18,7 @@ const ( DBFileSuffix string = ".db" ) -func NewDB(dbType DBType, name, dataDir string, opts store.DBOptions) (corestore.KVStoreWithBatch, error) { +func NewDB(dbType DBType, name, dataDir string, opts coreserver.DynamicConfig) (corestore.KVStoreWithBatch, error) { switch dbType { case DBTypeGoLevelDB: return NewGoLevelDB(name, dataDir, opts) diff --git a/store/v2/db/goleveldb.go b/store/v2/db/goleveldb.go index 59e2e08ad8e4..d1c1242e497d 100644 --- a/store/v2/db/goleveldb.go +++ b/store/v2/db/goleveldb.go @@ -14,8 +14,8 @@ import ( "github.com/syndtr/goleveldb/leveldb/opt" "github.com/syndtr/goleveldb/leveldb/util" + coreserver "cosmossdk.io/core/server" corestore "cosmossdk.io/core/store" - "cosmossdk.io/store/v2" storeerrors "cosmossdk.io/store/v2/errors" ) @@ -28,7 +28,7 @@ type GoLevelDB struct { db *leveldb.DB } -func NewGoLevelDB(name, dir string, opts store.DBOptions) (*GoLevelDB, error) { +func NewGoLevelDB(name, dir string, opts coreserver.DynamicConfig) (*GoLevelDB, error) { defaultOpts := &opt.Options{ Filter: filter.NewBloomFilter(10), // by default, goleveldb doesn't use a bloom filter. } diff --git a/store/v2/db/pebbledb.go b/store/v2/db/pebbledb.go index 382ee7079911..e5265883c348 100644 --- a/store/v2/db/pebbledb.go +++ b/store/v2/db/pebbledb.go @@ -10,8 +10,8 @@ import ( "github.com/cockroachdb/pebble" "github.com/spf13/cast" + coreserver "cosmossdk.io/core/server" corestore "cosmossdk.io/core/store" - "cosmossdk.io/store/v2" storeerrors "cosmossdk.io/store/v2/errors" ) @@ -28,7 +28,7 @@ func NewPebbleDB(name, dataDir string) (*PebbleDB, error) { return NewPebbleDBWithOpts(name, dataDir, nil) } -func NewPebbleDBWithOpts(name, dataDir string, opts store.DBOptions) (*PebbleDB, error) { +func NewPebbleDBWithOpts(name, dataDir string, opts coreserver.DynamicConfig) (*PebbleDB, error) { do := &pebble.Options{ MaxConcurrentCompactions: func() int { return 3 }, // default 1 } diff --git a/store/v2/db/rocksdb_noflag.go b/store/v2/db/rocksdb_noflag.go index 6e05c9a10a38..ab6ecba70753 100644 --- a/store/v2/db/rocksdb_noflag.go +++ b/store/v2/db/rocksdb_noflag.go @@ -4,8 +4,8 @@ package db import ( + coreserver "cosmossdk.io/core/server" corestore "cosmossdk.io/core/store" - "cosmossdk.io/store/v2" ) var _ corestore.KVStoreWithBatch = (*RocksDB)(nil) @@ -19,7 +19,7 @@ func NewRocksDB(name, dataDir string) (*RocksDB, error) { panic("rocksdb must be built with -tags rocksdb") } -func NewRocksDBWithOpts(dataDir string, opts store.DBOptions) (*RocksDB, error) { +func NewRocksDBWithOpts(dataDir string, opts coreserver.DynamicConfig) (*RocksDB, error) { panic("rocksdb must be built with -tags rocksdb") } diff --git a/store/v2/options.go b/store/v2/options.go index f87475e4a6d2..a2e64ab2b269 100644 --- a/store/v2/options.go +++ b/store/v2/options.go @@ -77,8 +77,3 @@ func (opts *PruningOption) ShouldPrune(version uint64) (bool, uint64) { return false, 0 } - -// DBOptions defines the interface of a database options. -type DBOptions interface { - Get(string) interface{} -} diff --git a/store/v2/root/reader.go b/store/v2/root/reader.go index 39737f812266..b7d8c59fa27a 100644 --- a/store/v2/root/reader.go +++ b/store/v2/root/reader.go @@ -54,12 +54,7 @@ func (roa *Reader) Has(key []byte) (bool, error) { } func (roa *Reader) Get(key []byte) ([]byte, error) { - result, err := roa.rootStore.GetStateStorage().Get(roa.actor, roa.version, key) - if err != nil { - return nil, err - } - - return result, nil + return roa.rootStore.GetStateStorage().Get(roa.actor, roa.version, key) } func (roa *Reader) Iterator(start, end []byte) (corestore.Iterator, error) { From db6a8352c333889599e3168e84c0bc4787e254f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juli=C3=A1n=20Toledano?= Date: Thu, 10 Oct 2024 15:01:33 +0200 Subject: [PATCH 22/57] docs(x/staking): update readme (#22216) --- x/staking/README.md | 76 +++++++++++++++++++-------------------- x/staking/types/params.go | 12 ++++--- 2 files changed, 45 insertions(+), 43 deletions(-) diff --git a/x/staking/README.md b/x/staking/README.md index 9e302bfba913..e09065481d86 100644 --- a/x/staking/README.md +++ b/x/staking/README.md @@ -69,20 +69,20 @@ Pool is used for tracking bonded and not-bonded token supply of the bond denomin LastTotalPower tracks the total amounts of bonded tokens recorded during the previous end block. Store entries prefixed with "Last" must remain unchanged until EndBlock. -* LastTotalPower: `0x12 -> ProtocolBuffer(math.Int)` +* LastTotalPower: `collections.NewPrefix(18)` ### UnbondingID UnbondingID stores the ID of the latest unbonding operation. It enables creating unique IDs for unbonding operations, i.e., UnbondingID is incremented every time a new unbonding operation (validator unbonding, unbonding delegation, redelegation) is initiated. -* UnbondingID: `0x37 -> uint64` +* UnbondingID: `55` ### Params The staking module stores its params in state with the prefix of `0x51`, it can be updated with governance or the address with authority. -* Params: `0x51 | ProtocolBuffer(Params)` +* Params: `81` ```protobuf reference https://github.com/cosmos/cosmos-sdk/blob/release/v0.52.x/x/staking/proto/cosmos/staking/v1beta1/staking.proto#L300-L328 @@ -117,18 +117,18 @@ required lookups for slashing and validator-set updates. A third special index throughout each block, unlike the first two indices which mirror the validator records within a block. -* Validators: `0x21 | OperatorAddrLen (1 byte) | OperatorAddr -> ProtocolBuffer(validator)` -* ValidatorsByConsAddr: `0x22 | ConsAddrLen (1 byte) | ConsAddr -> OperatorAddr` -* ValidatorsByPower: `0x23 | BigEndian(ConsensusPower) | OperatorAddrLen (1 byte) | OperatorAddr -> OperatorAddr` -* LastValidatorsPower: `0x11 | OperatorAddrLen (1 byte) | OperatorAddr -> ProtocolBuffer(ConsensusPower)` -* ValidatorsByUnbondingID: `0x38 | UnbondingID -> 0x21 | OperatorAddrLen (1 byte) | OperatorAddr` +* Validators: `33 | OperatorAddrLen (1 byte) | OperatorAddr -> ProtocolBuffer(validator)` +* ValidatorsByConsAddr: `34 | ConsAddrLen (1 byte) | ConsAddr -> OperatorAddr` +* ValidatorsByPower: `23 | BigEndian(ConsensusPower) | OperatorAddrLen (1 byte) | OperatorAddr -> OperatorAddr` +* LastValidatorsPower: `17 | OperatorAddrLen (1 byte) | OperatorAddr -> ProtocolBuffer(ConsensusPower)` +* UnbondingIndex: `56 | UnbondingID -> 21 | OperatorAddrLen (1 byte) | OperatorAddr` `Validators` is the primary index - it ensures that each operator can have only one associated validator, where the public key of that validator can change in the future. Delegators can refer to the immutable operator of the validator, without concern for the changing public key. -`ValidatorsByUnbondingID` is an additional index that enables lookups for +`UnbondingIndex` is an additional index that enables lookups for validators by the unbonding IDs corresponding to their current unbonding. `ValidatorByConsAddr` is an additional index that enables lookups for slashing. @@ -161,9 +161,9 @@ https://github.com/cosmos/cosmos-sdk/blob/release/v0.52.x/x/staking/proto/cosmos ### Delegation Delegations are identified by combining `DelegatorAddr` (the address of the delegator) -with the `ValidatorAddr` Delegators are indexed in the store as follows: +with the `ValidatorAddr`. Delegators are indexed in the store as follows: -* Delegation: `0x31 | DelegatorAddrLen (1 byte) | DelegatorAddr | ValidatorAddrLen (1 byte) | ValidatorAddr -> ProtocolBuffer(delegation)` +* Delegation: `49 | DelegatorAddrLen (1 byte) | DelegatorAddr | ValidatorAddrLen (1 byte) | ValidatorAddr -> ProtocolBuffer(delegation)` Stake holders may delegate coins to validators; under this circumstance their funds are held in a `Delegation` data structure. It is owned by one @@ -183,7 +183,7 @@ validator and the number of shares issued so far: `Shares per Token = validator.TotalShares() / validator.Tokens()` Only the number of shares received is stored on the DelegationEntry. When a delegator then -Undelegates, the token amount they receive is calculated from the number of shares they currently +undelegates, the token amount they receive is calculated from the number of shares they currently hold and the inverse exchange rate: `Tokens per Share = validator.Tokens() / validatorShares()` @@ -201,17 +201,17 @@ detected. `UnbondingDelegation` are indexed in the store as: -* UnbondingDelegation: `0x32 | DelegatorAddrLen (1 byte) | DelegatorAddr | ValidatorAddrLen (1 byte) | ValidatorAddr -> ProtocolBuffer(unbondingDelegation)` -* UnbondingDelegationsFromValidator: `0x33 | ValidatorAddrLen (1 byte) | ValidatorAddr | DelegatorAddrLen (1 byte) | DelegatorAddr -> nil` -* UnbondingDelegationByUnbondingId: `0x38 | UnbondingId -> 0x32 | DelegatorAddrLen (1 byte) | DelegatorAddr | ValidatorAddrLen (1 byte) | ValidatorAddr` +* UnbondingDelegation: `50 | DelegatorAddrLen (1 byte) | DelegatorAddr | ValidatorAddrLen (1 byte) | ValidatorAddr -> ProtocolBuffer(unbondingDelegation)` +* UnbondingDelegationByValIndex: `51 | ValidatorAddrLen (1 byte) | ValidatorAddr | DelegatorAddrLen (1 byte) | DelegatorAddr -> nil` +* UnbondingIndex: `56 | UnbondingId -> 0x32 | DelegatorAddrLen (1 byte) | DelegatorAddr | ValidatorAddrLen (1 byte) | ValidatorAddr` `UnbondingDelegation` is used in queries, to lookup all unbonding delegations for a given delegator. -`UnbondingDelegationsFromValidator` is used in slashing, to lookup all +`UnbondingDelegationByValIndex` is used in slashing, to lookup all unbonding delegations associated with a given validator that need to be slashed. - `UnbondingDelegationByUnbondingId` is an additional index that enables + `UnbondingIndex` is an additional index that enables lookups for unbonding delegations by the unbonding IDs of the containing unbonding delegation entries. @@ -232,23 +232,23 @@ committed by the source validator. `Redelegation` are indexed in the store as: -* Redelegations: `0x34 | DelegatorAddrLen (1 byte) | DelegatorAddr | ValidatorAddrLen (1 byte) | ValidatorSrcAddr | ValidatorDstAddr -> ProtocolBuffer(redelegation)` -* RedelegationsBySrc: `0x35 | ValidatorSrcAddrLen (1 byte) | ValidatorSrcAddr | ValidatorDstAddrLen (1 byte) | ValidatorDstAddr | DelegatorAddrLen (1 byte) | DelegatorAddr -> nil` -* RedelegationsByDst: `0x36 | ValidatorDstAddrLen (1 byte) | ValidatorDstAddr | ValidatorSrcAddrLen (1 byte) | ValidatorSrcAddr | DelegatorAddrLen (1 byte) | DelegatorAddr -> nil` -* RedelegationByUnbondingId: `0x38 | UnbondingId -> 0x34 | DelegatorAddrLen (1 byte) | DelegatorAddr | ValidatorAddrLen (1 byte) | ValidatorSrcAddr | ValidatorDstAddr` +* Redelegations: `52 | DelegatorAddrLen (1 byte) | DelegatorAddr | ValidatorAddrLen (1 byte) | ValidatorSrcAddr | ValidatorDstAddrLen (1 byte) | ValidatorDstAddr -> ProtocolBuffer(redelegation)` +* RedelegationsByValSrc: `53 | ValidatorSrcAddrLen (1 byte) | ValidatorSrcAddr | ValidatorDstAddrLen (1 byte) | ValidatorDstAddr | DelegatorAddrLen (1 byte) | DelegatorAddr -> nil` +* RedelegationsByValDst: `54 | ValidatorDstAddrLen (1 byte) | ValidatorDstAddr | ValidatorSrcAddrLen (1 byte) | ValidatorSrcAddr | DelegatorAddrLen (1 byte) | DelegatorAddr -> nil` +* RedelegationByUnbondingId: `56 | UnbondingId -> 0x34 | DelegatorAddrLen (1 byte) | DelegatorAddr | ValidatorAddrLen (1 byte) | ValidatorSrcAddr | ValidatorDstAddr` `Redelegations` is used for queries, to lookup all redelegations for a given delegator. - `RedelegationsBySrc` is used for slashing based on the `ValidatorSrcAddr`. + `RedelegationsByValSrc` is used for slashing based on the `ValidatorSrcAddr`. - `RedelegationsByDst` is used for slashing based on the `ValidatorDstAddr` + `RedelegationsByValDst` is used for slashing based on the `ValidatorDstAddr` The first map here is used for queries, to lookup all redelegations for a given delegator. The second map is used for slashing based on the `ValidatorSrcAddr`, while the third map is for slashing based on the `ValidatorDstAddr`. -`RedelegationByUnbondingId` is an additional index that enables +`UnbondingIndex` is an additional index that enables lookups for redelegations by the unbonding IDs of the containing redelegation entries. @@ -317,7 +317,7 @@ element. For the purpose of tracking progress of unbonding delegations the unbonding delegations queue is kept. -* UnbondingDelegation: `0x41 | format(time) -> []DVPair` +* UnbondingQueue: `65 | format(time) -> []DVPair` ```protobuf reference https://github.com/cosmos/cosmos-sdk/blob/release/v0.52.x/x/staking/proto/cosmos/staking/v1beta1/staking.proto#L159-L173 @@ -328,7 +328,7 @@ https://github.com/cosmos/cosmos-sdk/blob/release/v0.52.x/x/staking/proto/cosmos For the purpose of tracking progress of redelegations the redelegation queue is kept. -* RedelegationQueue: `0x42 | format(time) -> []DVVTriplet` +* RedelegationQueue: `66 | format(time) -> []DVVTriplet` ```protobuf reference https://github.com/cosmos/cosmos-sdk/blob/release/v0.52.x/x/staking/proto/cosmos/staking/v1beta1/staking.proto#L175-L191 @@ -339,7 +339,7 @@ https://github.com/cosmos/cosmos-sdk/blob/release/v0.52.x/x/staking/proto/cosmos For the purpose of tracking progress of unbonding validators the validator queue is kept. -* ValidatorQueueTime: `0x43 | format(time) -> []sdk.ValAddress` +* ValidatorQueue: `67 | format(time) -> []sdk.ValAddress` The stored object by each key is an array of validator operator addresses from which the validator object can be accessed. Typically it is expected that only @@ -348,7 +348,7 @@ that multiple validators exist in the queue at the same location. #### ValidatorConsensusKeyRotationRecordQueueKey -For the purpose of tracking progress or consensus pubkey rotations the `ValidatorConsensusKeyRotationRecordQueueKey` kept. +For the purpose of tracking progress of consensus pubkey rotations, the `ValidatorConsensusKeyRotationRecordQueueKey` is kept. * ValidatorConsensusKeyRotationRecordQueueKey: `103 | format(time) -> types.ValAddrsOfRotatedConsKeys` @@ -361,9 +361,6 @@ the present store info and append the `ValAddress` to the array and set it back https://github.com/cosmos/cosmos-sdk/blob/release/v0.52.x/x/staking/proto/cosmos/staking/v1beta1/staking.proto#L420-L424 ``` - - - ## State Transitions ### Validators @@ -401,7 +398,7 @@ When a validator begins the unbonding process the following operations occur: #### Unbonding to Unbonded A validator moves from unbonding to unbonded when the `ValidatorQueue` object -moves from bonded to unbonded +moves from bonded to unbonded. * update the `Validator` object for this validator * set `validator.Status` to `Unbonded` @@ -423,7 +420,7 @@ Jailed validators are not present in any of the following stores: #### Delegate -When a delegation occurs both the validator and the delegation objects are affected +When a delegation occurs both the validator and the delegation objects are affected. * determine the delegators shares based on tokens delegated and the validator's exchange rate * remove tokens from the sending account @@ -894,10 +891,12 @@ following hooks can registered with staking: * called when a delegation is created * `BeforeDelegationSharesModified(Context, AccAddress, ValAddress) error` * called when a delegation's shares are modified -* `AfterDelegationModified(Context, AccAddress, ValAddress) error` - * called when a delegation is created or modified * `BeforeDelegationRemoved(Context, AccAddress, ValAddress) error` * called when a delegation is removed +* `AfterDelegationModified(Context, AccAddress, ValAddress) error` + * called when a delegation is created or modified +* `BeforeValidatorSlashed(Context, sdk.ValAddress, math.LegacyDec) error` + * called when a validator is slashed * `AfterUnbondingInitiated(Context, UnbondingID)` * called when an unbonding operation (validator unbonding, unbonding delegation, redelegation) was initiated * `AfterConsensusPubKeyUpdate(ctx Context, oldpubkey, newpubkey types.PubKey, fee sdk.Coin)` @@ -916,11 +915,9 @@ The staking module emits the following events: | complete_unbonding | validator | {validatorAddress} | | complete_unbonding | delegator | {delegatorAddress} | | complete_redelegation | amount | {totalRedelegationAmount} | +| complete_redelegation | delegator | {delegatorAddress} | | complete_redelegation | source_validator | {srcValidatorAddress} | | complete_redelegation | destination_validator | {dstValidatorAddress} | -| complete_redelegation | delegator | {delegatorAddress} | - -## Msg's ### MsgCreateValidator @@ -947,7 +944,9 @@ The staking module emits the following events: | Type | Attribute Key | Attribute Value | | -------- | ------------- | ------------------ | | delegate | validator | {validatorAddress} | +| delegate | delegator | {delegatorAddress} | | delegate | amount | {delegationAmount} | +| delegate | new_shares | {newShares} | | message | module | staking | | message | action | delegate | | message | sender | {senderAddress} | @@ -957,6 +956,7 @@ The staking module emits the following events: | Type | Attribute Key | Attribute Value | | ------- | ------------------- | ------------------ | | unbond | validator | {validatorAddress} | +| unbond | delegator | {delegatorAddress} | | unbond | amount | {unbondAmount} | | unbond | completion_time [0] | {completionTime} | | message | module | staking | diff --git a/x/staking/types/params.go b/x/staking/types/params.go index bd619ae2c0b2..72e6df6c910c 100644 --- a/x/staking/types/params.go +++ b/x/staking/types/params.go @@ -19,10 +19,11 @@ const ( // TODO: Justify our choice of default here. DefaultUnbondingTime time.Duration = time.Hour * 24 * 7 * 3 - // Default maximum number of bonded validators + // DefaultMaxValidators is the default maximum number of bonded validators. DefaultMaxValidators uint32 = 100 - // Default maximum entries in a UBD/RED pair + // DefaultMaxEntries is the default maximum number of entries + // in a UBD (Unbonding Delegation) or RED (Redelegation) pair. DefaultMaxEntries uint32 = 7 ) @@ -63,7 +64,7 @@ func DefaultParams() Params { ) } -// unmarshal the current staking params value from store key or panic +// MustUnmarshalParams unmarshal the current staking params value from store key or panic func MustUnmarshalParams(cdc *codec.LegacyAmino, value []byte) Params { params, err := UnmarshalParams(cdc, value) if err != nil { @@ -73,7 +74,7 @@ func MustUnmarshalParams(cdc *codec.LegacyAmino, value []byte) Params { return params } -// unmarshal the current staking params value from store key +// UnmarshalParams unmarshal the current staking params value from store key func UnmarshalParams(cdc *codec.LegacyAmino, value []byte) (params Params, err error) { err = cdc.Unmarshal(value, ¶ms) if err != nil { @@ -83,7 +84,7 @@ func UnmarshalParams(cdc *codec.LegacyAmino, value []byte) (params Params, err e return } -// validate a set of params +// Validate validates a set of params func (p Params) Validate() error { if err := validateUnbondingTime(p.UnbondingTime); err != nil { return err @@ -181,6 +182,7 @@ func validateBondDenom(i interface{}) error { return nil } +// ValidatePowerReduction validates the PowerReduction parameter. func ValidatePowerReduction(i interface{}) error { v, ok := i.(math.Int) if !ok { From 63b1652d987d91987bdc2aa71f6f82e3274faf95 Mon Sep 17 00:00:00 2001 From: xujk-byte Date: Thu, 10 Oct 2024 22:20:01 +0800 Subject: [PATCH 23/57] docs(collections): add comments for funcs (#22214) --- collections/quad.go | 6 ++++++ collections/triple.go | 3 +++ 2 files changed, 9 insertions(+) diff --git a/collections/quad.go b/collections/quad.go index a5dfc2929b01..2e0678e69ea2 100644 --- a/collections/quad.go +++ b/collections/quad.go @@ -106,6 +106,8 @@ type quadKeyCodec[K1, K2, K3, K4 any] struct { type jsonQuadKey [4]json.RawMessage + +// EncodeJSON encodes Quads to json func (t quadKeyCodec[K1, K2, K3, K4]) EncodeJSON(value Quad[K1, K2, K3, K4]) ([]byte, error) { json1, err := t.keyCodec1.EncodeJSON(*value.k1) if err != nil { @@ -130,6 +132,7 @@ func (t quadKeyCodec[K1, K2, K3, K4]) EncodeJSON(value Quad[K1, K2, K3, K4]) ([] return json.Marshal(jsonQuadKey{json1, json2, json3, json4}) } +// DecodeJSON decodes json to Quads func (t quadKeyCodec[K1, K2, K3, K4]) DecodeJSON(b []byte) (Quad[K1, K2, K3, K4], error) { var jsonKey jsonQuadKey err := json.Unmarshal(b, &jsonKey) @@ -160,6 +163,7 @@ func (t quadKeyCodec[K1, K2, K3, K4]) DecodeJSON(b []byte) (Quad[K1, K2, K3, K4] return Join4(key1, key2, key3, key4), nil } +// Stringify converts Quads to string func (t quadKeyCodec[K1, K2, K3, K4]) Stringify(key Quad[K1, K2, K3, K4]) string { b := new(strings.Builder) b.WriteByte('(') @@ -206,6 +210,7 @@ func (t quadKeyCodec[K1, K2, K3, K4]) KeyType() string { return fmt.Sprintf("Quad[%s,%s,%s,%s]", t.keyCodec1.KeyType(), t.keyCodec2.KeyType(), t.keyCodec3.KeyType(), t.keyCodec4.KeyType()) } + func (t quadKeyCodec[K1, K2, K3, K4]) Encode(buffer []byte, key Quad[K1, K2, K3, K4]) (int, error) { writtenTotal := 0 if key.k1 != nil { @@ -239,6 +244,7 @@ func (t quadKeyCodec[K1, K2, K3, K4]) Encode(buffer []byte, key Quad[K1, K2, K3, return writtenTotal, nil } + func (t quadKeyCodec[K1, K2, K3, K4]) Decode(buffer []byte) (int, Quad[K1, K2, K3, K4], error) { readTotal := 0 read, key1, err := t.keyCodec1.DecodeNonTerminal(buffer) diff --git a/collections/triple.go b/collections/triple.go index e4a07970945c..17f519d54d6d 100644 --- a/collections/triple.go +++ b/collections/triple.go @@ -85,6 +85,7 @@ type tripleKeyCodec[K1, K2, K3 any] struct { type jsonTripleKey [3]json.RawMessage +// EncodeJSON convert triple keys to json func (t tripleKeyCodec[K1, K2, K3]) EncodeJSON(value Triple[K1, K2, K3]) ([]byte, error) { json1, err := t.keyCodec1.EncodeJSON(*value.k1) if err != nil { @@ -104,6 +105,7 @@ func (t tripleKeyCodec[K1, K2, K3]) EncodeJSON(value Triple[K1, K2, K3]) ([]byte return json.Marshal(jsonTripleKey{json1, json2, json3}) } +// DecodeJSON convert json to triple keys func (t tripleKeyCodec[K1, K2, K3]) DecodeJSON(b []byte) (Triple[K1, K2, K3], error) { var jsonKey jsonTripleKey err := json.Unmarshal(b, &jsonKey) @@ -129,6 +131,7 @@ func (t tripleKeyCodec[K1, K2, K3]) DecodeJSON(b []byte) (Triple[K1, K2, K3], er return Join3(key1, key2, key3), nil } +// Stringify convert triple keys to string func (t tripleKeyCodec[K1, K2, K3]) Stringify(key Triple[K1, K2, K3]) string { b := new(strings.Builder) b.WriteByte('(') From dd2369daf2dce11d4d234ee11590a03e57812096 Mon Sep 17 00:00:00 2001 From: Matt Kocubinski Date: Thu, 10 Oct 2024 09:29:40 -0500 Subject: [PATCH 24/57] refactor(runtime/v2): use AppI.GetStore() to fetch an initialized RootStore (#22205) --- runtime/v2/module.go | 3 +++ runtime/v2/store.go | 22 ---------------------- server/v2/cometbft/server.go | 16 +--------------- server/v2/server_test.go | 15 +++------------ server/v2/store/server.go | 23 +++++++---------------- server/v2/types.go | 2 ++ simapp/v2/app_di.go | 3 +-- simapp/v2/app_test.go | 2 -- simapp/v2/simdv2/cmd/commands.go | 7 ++----- simapp/v2/simdv2/cmd/root_di.go | 5 +---- simapp/v2/simdv2/cmd/testnet.go | 13 +++++-------- 11 files changed, 25 insertions(+), 86 deletions(-) diff --git a/runtime/v2/module.go b/runtime/v2/module.go index 9637871c6aba..dcde5ae48772 100644 --- a/runtime/v2/module.go +++ b/runtime/v2/module.go @@ -229,6 +229,7 @@ func ProvideEnvironment( // - header.Service // - comet.Service // - event.Service +// - store/v2/root.Builder // // They are all required. For most use cases these default services bindings should be sufficient. // Power users (or tests) may wish to provide their own services bindings, in which case they must @@ -244,11 +245,13 @@ func DefaultServiceBindings() depinject.Config { cometService comet.Service = &services.ContextAwareCometInfoService{} headerService = services.NewGenesisHeaderService(stf.HeaderService{}) eventService = services.NewGenesisEventService(stf.NewEventService()) + storeBuilder = root.NewBuilder() ) return depinject.Supply( kvServiceFactory, headerService, cometService, eventService, + storeBuilder, ) } diff --git a/runtime/v2/store.go b/runtime/v2/store.go index 7f7b2135c809..40912ea41f48 100644 --- a/runtime/v2/store.go +++ b/runtime/v2/store.go @@ -3,35 +3,13 @@ package runtime import ( "errors" "fmt" - "sync" "cosmossdk.io/core/store" "cosmossdk.io/server/v2/stf" storev2 "cosmossdk.io/store/v2" "cosmossdk.io/store/v2/proof" - "cosmossdk.io/store/v2/root" ) -var ( - storeBuilderSingleton root.Builder - storeBuilderSingletonOnce sync.Once -) - -// ProvideSingletonScopedStoreBuilder returns a store builder that is a singleton -// in the scope of the process lifetime. -func ProvideSingletonScopedStoreBuilder() root.Builder { - storeBuilderSingletonOnce.Do(func() { - storeBuilderSingleton = root.NewBuilder() - }) - return storeBuilderSingleton -} - -// ResetSingletonScopedStoreBuilder resets the singleton store builder. Applications -// should not ever need to call this, but it may be useful in tests. -func ResetSingletonScopedStoreBuilder() { - storeBuilderSingletonOnce = sync.Once{} -} - // NewKVStoreService creates a new KVStoreService. // This wrapper is kept for backwards compatibility. // When migrating from runtime to runtime/v2, use runtimev2.NewKVStoreService(storeKey.Name()) instead of runtime.NewKVStoreService(storeKey). diff --git a/server/v2/cometbft/server.go b/server/v2/cometbft/server.go index 7fa1a94d8ee6..e5076b897073 100644 --- a/server/v2/cometbft/server.go +++ b/server/v2/cometbft/server.go @@ -8,9 +8,6 @@ import ( "os" "path/filepath" - "cosmossdk.io/server/v2/store" - "cosmossdk.io/store/v2/root" - abciserver "github.com/cometbft/cometbft/abci/server" cmtcmd "github.com/cometbft/cometbft/cmd/cometbft/commands" cmtcfg "github.com/cometbft/cometbft/config" @@ -45,7 +42,6 @@ type CometBFTServer[T transaction.Tx] struct { initTxCodec transaction.Codec[T] logger log.Logger - storeBuilder root.Builder serverOptions ServerOptions[T] config Config cfgOptions []CfgOption @@ -53,13 +49,11 @@ type CometBFTServer[T transaction.Tx] struct { func New[T transaction.Tx]( txCodec transaction.Codec[T], - storeBuilder root.Builder, serverOptions ServerOptions[T], cfgOptions ...CfgOption, ) *CometBFTServer[T] { return &CometBFTServer[T]{ initTxCodec: txCodec, - storeBuilder: storeBuilder, serverOptions: serverOptions, cfgOptions: cfgOptions, } @@ -106,16 +100,8 @@ func (s *CometBFTServer[T]) Init(appI serverv2.AppI[T], cfg map[string]any, logg indexEvents[e] = struct{}{} } - storeCfg, err := store.UnmarshalConfig(cfg) - if err != nil { - return err - } - rs, err := s.storeBuilder.Build(logger, storeCfg) - if err != nil { - return err - } - s.logger = logger.With(log.ModuleKey, s.Name()) + rs := appI.GetStore() consensus := NewConsensus( s.logger, appI.Name(), diff --git a/server/v2/server_test.go b/server/v2/server_test.go index c216824fb652..b67fd209e1bd 100644 --- a/server/v2/server_test.go +++ b/server/v2/server_test.go @@ -20,7 +20,6 @@ import ( "cosmossdk.io/server/v2/appmanager" "cosmossdk.io/server/v2/store" storev2 "cosmossdk.io/store/v2" - "cosmossdk.io/store/v2/root" ) type mockInterfaceRegistry struct{} @@ -50,18 +49,10 @@ func (*mockApp[T]) InterfaceRegistry() coreserver.InterfaceRegistry { return &mockInterfaceRegistry{} } -var _ root.Builder = &mockStoreBuilder{} - -type mockStoreBuilder struct{} - -func (m mockStoreBuilder) Build(logger log.Logger, config *root.Config) (storev2.RootStore, error) { - return nil, nil +func (*mockApp[T]) GetStore() storev2.RootStore { + return nil } -func (m mockStoreBuilder) RegisterKey(string) {} - -func (m mockStoreBuilder) Get() storev2.RootStore { return nil } - func TestServer(t *testing.T) { currentDir, err := os.Getwd() require.NoError(t, err) @@ -78,7 +69,7 @@ func TestServer(t *testing.T) { err = grpcServer.Init(&mockApp[transaction.Tx]{}, cfg, logger) require.NoError(t, err) - storeServer := store.New[transaction.Tx](&mockStoreBuilder{}) + storeServer := store.New[transaction.Tx]() err = storeServer.Init(&mockApp[transaction.Tx]{}, cfg, logger) require.NoError(t, err) diff --git a/server/v2/store/server.go b/server/v2/store/server.go index a793a1912dba..20ed3b15b0ea 100644 --- a/server/v2/store/server.go +++ b/server/v2/store/server.go @@ -24,26 +24,17 @@ const ServerName = "store" // Server manages store config and contains prune & snapshot commands type Server[T transaction.Tx] struct { config *root.Config - builder root.Builder backend storev2.Backend } -func New[T transaction.Tx](builder root.Builder) *Server[T] { - return &Server[T]{builder: builder} +func New[T transaction.Tx]() *Server[T] { + return &Server[T]{} } -func (s *Server[T]) Init(_ serverv2.AppI[T], cfg map[string]any, log log.Logger) error { - var err error - s.config, err = UnmarshalConfig(cfg) - if err != nil { - return fmt.Errorf("failed to unmarshal config: %w", err) - } - s.backend, err = s.builder.Build(log, s.config) - if err != nil { - return fmt.Errorf("failed to create store backend: %w", err) - } - - return nil +func (s *Server[T]) Init(app serverv2.AppI[T], v map[string]any, _ log.Logger) (err error) { + s.backend = app.GetStore() + s.config, err = UnmarshalConfig(v) + return err } func (s *Server[T]) Name() string { @@ -90,7 +81,7 @@ func UnmarshalConfig(cfg map[string]any) (*root.Config, error) { Options: root.DefaultStoreOptions(), } if err := serverv2.UnmarshalSubConfig(cfg, ServerName, config); err != nil { - return nil, fmt.Errorf("failed to unmarshal config: %w", err) + return nil, fmt.Errorf("failed to unmarshal store config: %w", err) } home := cfg[serverv2.FlagHome] if home != nil { diff --git a/server/v2/types.go b/server/v2/types.go index a28385922178..8bd04d3221af 100644 --- a/server/v2/types.go +++ b/server/v2/types.go @@ -8,6 +8,7 @@ import ( "cosmossdk.io/core/transaction" "cosmossdk.io/log" "cosmossdk.io/server/v2/appmanager" + "cosmossdk.io/store/v2" ) type AppCreator[T transaction.Tx] func(log.Logger, *viper.Viper) AppI[T] @@ -17,4 +18,5 @@ type AppI[T transaction.Tx] interface { InterfaceRegistry() server.InterfaceRegistry GetAppManager() *appmanager.AppManager[T] GetQueryHandlers() map[string]appmodulev2.Handler + GetStore() store.RootStore } diff --git a/simapp/v2/app_di.go b/simapp/v2/app_di.go index 29f62defcde6..b1dfc26f99ff 100644 --- a/simapp/v2/app_di.go +++ b/simapp/v2/app_di.go @@ -66,7 +66,6 @@ func AppConfig() depinject.Config { codec.ProvideAddressCodec, codec.ProvideProtoCodec, codec.ProvideLegacyAmino, - runtime.ProvideSingletonScopedStoreBuilder, ), depinject.Invoke( std.RegisterInterfaces, @@ -83,8 +82,8 @@ func NewSimApp[T transaction.Tx]( var ( app = &SimApp[T]{} appBuilder *runtime.AppBuilder[T] - storeBuilder root.Builder err error + storeBuilder root.Builder // merge the AppConfig and other configuration in one config appConfig = depinject.Configs( diff --git a/simapp/v2/app_test.go b/simapp/v2/app_test.go index 8c705565956c..a5d7f352b4d9 100644 --- a/simapp/v2/app_test.go +++ b/simapp/v2/app_test.go @@ -18,7 +18,6 @@ import ( "cosmossdk.io/core/transaction" "cosmossdk.io/log" sdkmath "cosmossdk.io/math" - "cosmossdk.io/runtime/v2" serverv2 "cosmossdk.io/server/v2" serverv2store "cosmossdk.io/server/v2/store" "cosmossdk.io/store/v2/db" @@ -40,7 +39,6 @@ func NewTestApp(t *testing.T) (*SimApp[transaction.Tx], context.Context) { vp.Set(serverv2store.FlagAppDBBackend, string(db.DBTypeGoLevelDB)) vp.Set(serverv2.FlagHome, t.TempDir()) - runtime.ResetSingletonScopedStoreBuilder() app := NewSimApp[transaction.Tx](logger, vp) genesis := app.ModuleManager().DefaultGenesis() diff --git a/simapp/v2/simdv2/cmd/commands.go b/simapp/v2/simdv2/cmd/commands.go index 6cc233cc9b19..3fcbed114d9e 100644 --- a/simapp/v2/simdv2/cmd/commands.go +++ b/simapp/v2/simdv2/cmd/commands.go @@ -19,7 +19,6 @@ import ( "cosmossdk.io/server/v2/cometbft" serverstore "cosmossdk.io/server/v2/store" "cosmossdk.io/simapp/v2" - "cosmossdk.io/store/v2/root" confixcmd "cosmossdk.io/tools/confix/cmd" "github.com/cosmos/cosmos-sdk/client" @@ -44,7 +43,6 @@ func newApp[T transaction.Tx](logger log.Logger, viper *viper.Viper) serverv2.Ap func initRootCmd[T transaction.Tx]( rootCmd *cobra.Command, txConfig client.TxConfig, - storeBuilder root.Builder, moduleManager *runtimev2.MM[T], ) { cfg := sdk.GetConfig() @@ -54,7 +52,7 @@ func initRootCmd[T transaction.Tx]( genutilcli.InitCmd(moduleManager), debug.Cmd(), confixcmd.ConfigCommand(), - NewTestnetCmd(storeBuilder, moduleManager), + NewTestnetCmd(moduleManager), ) logger, err := serverv2.NewLogger(viper.New(), rootCmd.OutOrStdout()) @@ -79,12 +77,11 @@ func initRootCmd[T transaction.Tx]( initServerConfig(), cometbft.New( &genericTxDecoder[T]{txConfig}, - storeBuilder, initCometOptions[T](), initCometConfig(), ), grpc.New[T](), - serverstore.New[T](storeBuilder), + serverstore.New[T](), telemetry.New[T](), ); err != nil { panic(err) diff --git a/simapp/v2/simdv2/cmd/root_di.go b/simapp/v2/simdv2/cmd/root_di.go index 30291b4ecdb3..6b13b7201342 100644 --- a/simapp/v2/simdv2/cmd/root_di.go +++ b/simapp/v2/simdv2/cmd/root_di.go @@ -14,7 +14,6 @@ import ( "cosmossdk.io/log" "cosmossdk.io/runtime/v2" "cosmossdk.io/simapp/v2" - "cosmossdk.io/store/v2/root" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/config" @@ -32,7 +31,6 @@ func NewRootCmd[T transaction.Tx]() *cobra.Command { autoCliOpts autocli.AppOptions moduleManager *runtime.MM[T] clientCtx client.Context - storeBuilder root.Builder ) if err := depinject.Inject( @@ -41,7 +39,6 @@ func NewRootCmd[T transaction.Tx]() *cobra.Command { depinject.Provide(ProvideClientContext), depinject.Supply(log.NewNopLogger()), ), - &storeBuilder, &autoCliOpts, &moduleManager, &clientCtx, @@ -74,7 +71,7 @@ func NewRootCmd[T transaction.Tx]() *cobra.Command { }, } - initRootCmd(rootCmd, clientCtx.TxConfig, storeBuilder, moduleManager) + initRootCmd(rootCmd, clientCtx.TxConfig, moduleManager) nodeCmds := nodeservice.NewNodeCommands() autoCliOpts.ModuleOptions = make(map[string]*autocliv1.ModuleOptions) diff --git a/simapp/v2/simdv2/cmd/testnet.go b/simapp/v2/simdv2/cmd/testnet.go index 4e24f7083654..f030db8e5956 100644 --- a/simapp/v2/simdv2/cmd/testnet.go +++ b/simapp/v2/simdv2/cmd/testnet.go @@ -23,7 +23,6 @@ import ( "cosmossdk.io/server/v2/api/grpc" "cosmossdk.io/server/v2/cometbft" "cosmossdk.io/server/v2/store" - "cosmossdk.io/store/v2/root" banktypes "cosmossdk.io/x/bank/types" bankv2types "cosmossdk.io/x/bank/v2/types" stakingtypes "cosmossdk.io/x/staking/types" @@ -88,7 +87,7 @@ func addTestnetFlagsToCmd(cmd *cobra.Command) { // NewTestnetCmd creates a root testnet command with subcommands to run an in-process testnet or initialize // validator configuration files for running a multi-validator testnet in a separate process -func NewTestnetCmd[T transaction.Tx](sb root.Builder, mm *runtimev2.MM[T]) *cobra.Command { +func NewTestnetCmd[T transaction.Tx](mm *runtimev2.MM[T]) *cobra.Command { testnetCmd := &cobra.Command{ Use: "testnet", Short: "subcommands for starting or configuring local testnets", @@ -97,13 +96,13 @@ func NewTestnetCmd[T transaction.Tx](sb root.Builder, mm *runtimev2.MM[T]) *cobr RunE: client.ValidateCmd, } - testnetCmd.AddCommand(testnetInitFilesCmd(sb, mm)) + testnetCmd.AddCommand(testnetInitFilesCmd(mm)) return testnetCmd } // testnetInitFilesCmd returns a cmd to initialize all files for CometBFT testnet and application -func testnetInitFilesCmd[T transaction.Tx](sb root.Builder, mm *runtimev2.MM[T]) *cobra.Command { +func testnetInitFilesCmd[T transaction.Tx](mm *runtimev2.MM[T]) *cobra.Command { cmd := &cobra.Command{ Use: "init-files", Short: "Initialize config directories & files for a multi-validator testnet running locally via separate processes (e.g. Docker Compose or similar)", @@ -144,7 +143,7 @@ Example: return err } - return initTestnetFiles(clientCtx, sb, cmd, config, mm, args) + return initTestnetFiles(clientCtx, cmd, config, mm, args) }, } @@ -166,7 +165,6 @@ const nodeDirPerm = 0o755 // initTestnetFiles initializes testnet files for a testnet to be run in a separate process func initTestnetFiles[T transaction.Tx]( clientCtx client.Context, - sb root.Builder, cmd *cobra.Command, nodeConfig *cmtconfig.Config, mm *runtimev2.MM[T], @@ -341,11 +339,10 @@ func initTestnetFiles[T transaction.Tx]( // Write server config cometServer := cometbft.New[T]( &genericTxDecoder[T]{clientCtx.TxConfig}, - sb, cometbft.ServerOptions[T]{}, cometbft.OverwriteDefaultConfigTomlConfig(nodeConfig), ) - storeServer := store.New[T](sb) + storeServer := store.New[T]() grpcServer := grpc.New[T](grpc.OverwriteDefaultConfig(grpcConfig)) server := serverv2.NewServer[T](log.NewNopLogger(), serverCfg, cometServer, grpcServer, storeServer) err = server.WriteConfig(filepath.Join(nodeDir, "config")) From e84c0eb86b20dc95be413b21b0da7377a9bbedc6 Mon Sep 17 00:00:00 2001 From: cool-developer <51834436+cool-develope@users.noreply.github.com> Date: Thu, 10 Oct 2024 17:40:14 -0400 Subject: [PATCH 25/57] feat(server/v2): init the indexer in server/v2 (#22218) Co-authored-by: Julien Robert --- runtime/v2/app.go | 10 ++++++++++ runtime/v2/go.mod | 2 +- schema/indexer/start.go | 8 ++++---- server/v2/cometbft/abci.go | 5 ----- server/v2/cometbft/config.go | 8 +++++++- server/v2/cometbft/go.mod | 2 +- server/v2/cometbft/go.sum | 4 ++-- server/v2/cometbft/server.go | 14 ++++++++++++++ server/v2/config.go | 7 ++----- server/v2/go.mod | 2 +- server/v2/go.sum | 4 ++-- server/v2/types.go | 2 ++ simapp/v2/go.mod | 2 +- simapp/v2/go.sum | 4 ++-- tools/confix/data/v2-app.toml | 10 +++++++++- 15 files changed, 58 insertions(+), 26 deletions(-) diff --git a/runtime/v2/app.go b/runtime/v2/app.go index d5999f3bd99f..e52ea26c6e9f 100644 --- a/runtime/v2/app.go +++ b/runtime/v2/app.go @@ -8,6 +8,7 @@ import ( "cosmossdk.io/core/registry" "cosmossdk.io/core/transaction" "cosmossdk.io/log" + "cosmossdk.io/schema/decoding" "cosmossdk.io/server/v2/appmanager" "cosmossdk.io/server/v2/stf" ) @@ -96,3 +97,12 @@ func (a *App[T]) GetAppManager() *appmanager.AppManager[T] { func (a *App[T]) GetQueryHandlers() map[string]appmodulev2.Handler { return a.QueryHandlers } + +// GetSchemaDecoderResolver returns the module schema resolver. +func (a *App[T]) GetSchemaDecoderResolver() decoding.DecoderResolver { + moduleSet := map[string]any{} + for moduleName, module := range a.moduleManager.Modules() { + moduleSet[moduleName] = module + } + return decoding.ModuleSetDecoderResolver(moduleSet) +} diff --git a/runtime/v2/go.mod b/runtime/v2/go.mod index c28b2b52a05b..5147e8ad1362 100644 --- a/runtime/v2/go.mod +++ b/runtime/v2/go.mod @@ -16,6 +16,7 @@ require ( cosmossdk.io/core v1.0.0-alpha.4 cosmossdk.io/depinject v1.0.0 cosmossdk.io/log v1.4.1 + cosmossdk.io/schema v0.3.0 cosmossdk.io/server/v2/appmanager v0.0.0-00010101000000-000000000000 cosmossdk.io/server/v2/stf v0.0.0-00010101000000-000000000000 cosmossdk.io/store/v2 v2.0.0-00010101000000-000000000000 @@ -30,7 +31,6 @@ require ( buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect cosmossdk.io/core/testing v0.0.0-20240923163230-04da382a9f29 // indirect cosmossdk.io/errors/v2 v2.0.0-20240731132947-df72853b3ca5 // indirect - cosmossdk.io/schema v0.3.0 // indirect github.com/DataDog/zstd v1.5.5 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect diff --git a/schema/indexer/start.go b/schema/indexer/start.go index 909db71ed61a..f675c2916026 100644 --- a/schema/indexer/start.go +++ b/schema/indexer/start.go @@ -51,11 +51,11 @@ type IndexingOptions struct { // IndexingConfig is the configuration of the indexer manager and contains the configuration for each indexer target. type IndexingConfig struct { // Target is a map of named indexer targets to their configuration. - Target map[string]Config + Target map[string]Config `mapstructure:"target" toml:"target" json:"target" comment:"Target is a map of named indexer targets to their configuration."` // ChannelBufferSize is the buffer size of the channels used for buffering data sent to indexer go routines. // It defaults to 1024. - ChannelBufferSize *int `json:"channel_buffer_size,omitempty"` + ChannelBufferSize int `mapstructure:"channel_buffer_size" toml:"channel_buffer_size" json:"channel_buffer_size,omitempty" comment:"Buffer size of the channels used for buffering data sent to indexer go routines."` } // IndexingTarget returns the indexing target listener and associated data. @@ -142,8 +142,8 @@ func StartIndexing(opts IndexingOptions) (IndexingTarget, error) { } bufSize := 1024 - if cfg.ChannelBufferSize != nil { - bufSize = *cfg.ChannelBufferSize + if cfg.ChannelBufferSize != 0 { + bufSize = cfg.ChannelBufferSize } asyncOpts := appdata.AsyncListenerOptions{ Context: ctx, diff --git a/server/v2/cometbft/abci.go b/server/v2/cometbft/abci.go index cbcf387168a2..95eeec9bb5da 100644 --- a/server/v2/cometbft/abci.go +++ b/server/v2/cometbft/abci.go @@ -114,11 +114,6 @@ func (c *Consensus[T]) SetStreamingManager(sm streaming.Manager) { c.streaming = sm } -// SetListener sets the listener for the consensus module. -func (c *Consensus[T]) SetListener(l *appdata.Listener) { - c.listener = l -} - // RegisterSnapshotExtensions registers the given extensions with the consensus module's snapshot manager. // It allows additional snapshotter implementations to be used for creating and restoring snapshots. func (c *Consensus[T]) RegisterSnapshotExtensions(extensions ...snapshots.ExtensionSnapshotter) error { diff --git a/server/v2/cometbft/config.go b/server/v2/cometbft/config.go index 4525e7563c27..d8e591a9695c 100644 --- a/server/v2/cometbft/config.go +++ b/server/v2/cometbft/config.go @@ -3,6 +3,7 @@ package cometbft import ( cmtcfg "github.com/cometbft/cometbft/config" + "cosmossdk.io/schema/indexer" "cosmossdk.io/server/v2/cometbft/mempool" ) @@ -23,6 +24,10 @@ func DefaultAppTomlConfig() *AppTomlConfig { Trace: false, Standalone: false, Mempool: mempool.DefaultConfig(), + Indexer: indexer.IndexingConfig{ + Target: make(map[string]indexer.Config), + ChannelBufferSize: 1024, + }, } } @@ -37,7 +42,8 @@ type AppTomlConfig struct { Standalone bool `mapstructure:"standalone" toml:"standalone" comment:"standalone starts the application without the CometBFT node. The node should be started separately."` // Sub configs - Mempool mempool.Config `mapstructure:"mempool" toml:"mempool" comment:"mempool defines the configuration for the SDK built-in app-side mempool implementations."` + Mempool mempool.Config `mapstructure:"mempool" toml:"mempool" comment:"mempool defines the configuration for the SDK built-in app-side mempool implementations."` + Indexer indexer.IndexingConfig `mapstructure:"indexer" toml:"indexer" comment:"indexer defines the configuration for the SDK built-in indexer implementation."` } // CfgOption is a function that allows to overwrite the default server configuration. diff --git a/server/v2/cometbft/go.mod b/server/v2/cometbft/go.mod index c95f22af817a..46a403768850 100644 --- a/server/v2/cometbft/go.mod +++ b/server/v2/cometbft/go.mod @@ -22,7 +22,7 @@ require ( cosmossdk.io/core v1.0.0-alpha.4 cosmossdk.io/errors/v2 v2.0.0-20240731132947-df72853b3ca5 cosmossdk.io/log v1.4.1 - cosmossdk.io/schema v0.3.1-0.20240930054013-7c6e0388a3f9 + cosmossdk.io/schema v0.3.1-0.20241010135032-192601639cac cosmossdk.io/server/v2 v2.0.0-00010101000000-000000000000 cosmossdk.io/server/v2/appmanager v0.0.0-20240802110823-cffeedff643d cosmossdk.io/server/v2/stf v0.0.0-20240708142107-25e99c54bac1 diff --git a/server/v2/cometbft/go.sum b/server/v2/cometbft/go.sum index 4343a0df72ca..311e601f7d43 100644 --- a/server/v2/cometbft/go.sum +++ b/server/v2/cometbft/go.sum @@ -20,8 +20,8 @@ cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= -cosmossdk.io/schema v0.3.1-0.20240930054013-7c6e0388a3f9 h1:DmOoS/1PeY6Ih0hAVlJ69kLMUrLV+TCbfICrZtB1vdU= -cosmossdk.io/schema v0.3.1-0.20240930054013-7c6e0388a3f9/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= +cosmossdk.io/schema v0.3.1-0.20241010135032-192601639cac h1:3joNZZWZ3k7fMsrBDL1ktuQ2xQwYLZOaDhkruadDFmc= +cosmossdk.io/schema v0.3.1-0.20241010135032-192601639cac/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= diff --git a/server/v2/cometbft/server.go b/server/v2/cometbft/server.go index e5076b897073..8bd2935149e7 100644 --- a/server/v2/cometbft/server.go +++ b/server/v2/cometbft/server.go @@ -20,6 +20,7 @@ import ( "cosmossdk.io/core/transaction" "cosmossdk.io/log" + "cosmossdk.io/schema/indexer" serverv2 "cosmossdk.io/server/v2" cometlog "cosmossdk.io/server/v2/cometbft/log" "cosmossdk.io/server/v2/cometbft/mempool" @@ -131,6 +132,19 @@ func (s *CometBFTServer[T]) Init(appI serverv2.AppI[T], cfg map[string]any, logg } consensus.snapshotManager = snapshots.NewManager(snapshotStore, s.serverOptions.SnapshotOptions(cfg), sc, ss, nil, s.logger) + // initialize the indexer + if indexerCfg := s.config.AppTomlConfig.Indexer; len(indexerCfg.Target) > 0 { + listener, err := indexer.StartIndexing(indexer.IndexingOptions{ + Config: indexerCfg, + Resolver: appI.GetSchemaDecoderResolver(), + Logger: s.logger.With(log.ModuleKey, "indexer"), + }) + if err != nil { + return fmt.Errorf("failed to start indexing: %w", err) + } + consensus.listener = &listener.Listener + } + s.Consensus = consensus return nil diff --git a/server/v2/config.go b/server/v2/config.go index 0670bc374a24..1ab396f0c148 100644 --- a/server/v2/config.go +++ b/server/v2/config.go @@ -44,11 +44,8 @@ func ReadConfig(configPath string) (*viper.Viper, error) { func UnmarshalSubConfig(cfg map[string]any, subName string, target any) error { var sub any if subName != "" { - for k, val := range cfg { - if k == subName { - sub = val - break - } + if val, ok := cfg[subName]; ok { + sub = val } } else { sub = cfg diff --git a/server/v2/go.mod b/server/v2/go.mod index 1fca8cbb4416..11389921eb76 100644 --- a/server/v2/go.mod +++ b/server/v2/go.mod @@ -16,6 +16,7 @@ require ( cosmossdk.io/core v1.0.0-alpha.4 cosmossdk.io/core/testing v0.0.0-20240923163230-04da382a9f29 cosmossdk.io/log v1.4.1 + cosmossdk.io/schema v0.3.1-0.20241010135032-192601639cac cosmossdk.io/server/v2/appmanager v0.0.0-00010101000000-000000000000 cosmossdk.io/store/v2 v2.0.0-00010101000000-000000000000 github.com/cosmos/cosmos-proto v1.0.0-beta.5 @@ -42,7 +43,6 @@ require ( require ( cosmossdk.io/errors/v2 v2.0.0-20240731132947-df72853b3ca5 // indirect - cosmossdk.io/schema v0.3.0 // indirect github.com/DataDog/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect diff --git a/server/v2/go.sum b/server/v2/go.sum index 26e67ab39a4c..4a7c52d6f39a 100644 --- a/server/v2/go.sum +++ b/server/v2/go.sum @@ -8,8 +8,8 @@ cosmossdk.io/errors/v2 v2.0.0-20240731132947-df72853b3ca5 h1:IQNdY2kB+k+1OM2DvqF cosmossdk.io/errors/v2 v2.0.0-20240731132947-df72853b3ca5/go.mod h1:0CuYKkFHxc1vw2JC+t21THBCALJVROrWVR/3PQ1urpc= cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= -cosmossdk.io/schema v0.3.0 h1:01lcaM4trhzZ1HQTfTV8z6Ma1GziOZ/YmdzBN3F720c= -cosmossdk.io/schema v0.3.0/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= +cosmossdk.io/schema v0.3.1-0.20241010135032-192601639cac h1:3joNZZWZ3k7fMsrBDL1ktuQ2xQwYLZOaDhkruadDFmc= +cosmossdk.io/schema v0.3.1-0.20241010135032-192601639cac/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= diff --git a/server/v2/types.go b/server/v2/types.go index 8bd04d3221af..e628fb30c90f 100644 --- a/server/v2/types.go +++ b/server/v2/types.go @@ -7,6 +7,7 @@ import ( "cosmossdk.io/core/server" "cosmossdk.io/core/transaction" "cosmossdk.io/log" + "cosmossdk.io/schema/decoding" "cosmossdk.io/server/v2/appmanager" "cosmossdk.io/store/v2" ) @@ -19,4 +20,5 @@ type AppI[T transaction.Tx] interface { GetAppManager() *appmanager.AppManager[T] GetQueryHandlers() map[string]appmodulev2.Handler GetStore() store.RootStore + GetSchemaDecoderResolver() decoding.DecoderResolver } diff --git a/simapp/v2/go.mod b/simapp/v2/go.mod index 448a98a8928f..1ae8b374709f 100644 --- a/simapp/v2/go.mod +++ b/simapp/v2/go.mod @@ -61,7 +61,7 @@ require ( cosmossdk.io/core/testing v0.0.0-20240923163230-04da382a9f29 // indirect cosmossdk.io/errors v1.0.1 // indirect cosmossdk.io/errors/v2 v2.0.0-20240731132947-df72853b3ca5 // indirect - cosmossdk.io/schema v0.3.1-0.20240930054013-7c6e0388a3f9 // indirect + cosmossdk.io/schema v0.3.1-0.20241010135032-192601639cac // indirect cosmossdk.io/server/v2/appmanager v0.0.0-20240802110823-cffeedff643d // indirect cosmossdk.io/server/v2/stf v0.0.0-20240708142107-25e99c54bac1 // indirect cosmossdk.io/store v1.1.1 // indirect diff --git a/simapp/v2/go.sum b/simapp/v2/go.sum index f29f693d6539..c64c8320652f 100644 --- a/simapp/v2/go.sum +++ b/simapp/v2/go.sum @@ -206,8 +206,8 @@ cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= -cosmossdk.io/schema v0.3.1-0.20240930054013-7c6e0388a3f9 h1:DmOoS/1PeY6Ih0hAVlJ69kLMUrLV+TCbfICrZtB1vdU= -cosmossdk.io/schema v0.3.1-0.20240930054013-7c6e0388a3f9/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= +cosmossdk.io/schema v0.3.1-0.20241010135032-192601639cac h1:3joNZZWZ3k7fMsrBDL1ktuQ2xQwYLZOaDhkruadDFmc= +cosmossdk.io/schema v0.3.1-0.20241010135032-192601639cac/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= diff --git a/tools/confix/data/v2-app.toml b/tools/confix/data/v2-app.toml index c4f19348ce52..ef144a0b90dd 100644 --- a/tools/confix/data/v2-app.toml +++ b/tools/confix/data/v2-app.toml @@ -21,6 +21,14 @@ standalone = false # max-txs defines the maximum number of transactions that can be in the mempool. A value of 0 indicates an unbounded mempool, a negative value disables the app-side mempool. max-txs = -1 +# indexer defines the configuration for the SDK built-in indexer implementation. +[comet.indexer] +# Buffer size of the channels used for buffering data sent to indexer go routines. +channel_buffer_size = 1024 + +# Target is a map of named indexer targets to their configuration. +[comet.indexer.target] + [grpc] # Enable defines if the gRPC server should be enabled. enable = true @@ -71,7 +79,7 @@ skip-fast-storage-upgrade = true # Enable enables the application telemetry functionality. When enabled, an in-memory sink is also enabled by default. Operators may also enabled other sinks such as Prometheus. enable = true # Address defines the metrics server address to bind to. -address = 'localhost:1338' +address = 'localhost:1318' # Prefixed with keys to separate services. service-name = '' # Enable prefixing gauge values with hostname. From ae9ddffcdd055c18b8ad5d3b8f090088ed356ef9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 11 Oct 2024 12:53:46 +0700 Subject: [PATCH 26/57] build(deps): Bump github.com/cosmos/cosmos-sdk from 0.50.7 to 0.50.10 in /tools/cosmovisor (#22225) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- tools/cosmovisor/go.mod | 20 +++++++++---------- tools/cosmovisor/go.sum | 44 ++++++++++++++++++++--------------------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/tools/cosmovisor/go.mod b/tools/cosmovisor/go.mod index b04d101494bf..559eb945d7fd 100644 --- a/tools/cosmovisor/go.mod +++ b/tools/cosmovisor/go.mod @@ -5,7 +5,7 @@ go 1.23 require ( cosmossdk.io/log v1.4.1 cosmossdk.io/x/upgrade v0.1.4 - github.com/cosmos/cosmos-sdk v0.50.7 + github.com/cosmos/cosmos-sdk v0.50.10 github.com/fsnotify/fsnotify v1.7.0 github.com/otiai10/copy v1.14.0 github.com/pelletier/go-toml/v2 v2.2.3 @@ -24,12 +24,12 @@ require ( cloud.google.com/go/storage v1.43.0 // indirect cosmossdk.io/api v0.7.6 // indirect cosmossdk.io/collections v0.4.0 // indirect - cosmossdk.io/core v0.11.0 // indirect + cosmossdk.io/core v0.11.1 // indirect cosmossdk.io/depinject v1.0.0 // indirect cosmossdk.io/errors v1.0.1 // indirect cosmossdk.io/math v1.3.0 // indirect - cosmossdk.io/store v1.1.0 // indirect - cosmossdk.io/x/tx v0.13.3 // indirect + cosmossdk.io/store v1.1.1 // indirect + cosmossdk.io/x/tx v0.13.5 // indirect filippo.io/edwards25519 v1.1.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.2 // indirect @@ -40,15 +40,16 @@ require ( github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect github.com/bgentry/speakeasy v0.2.0 // indirect - github.com/btcsuite/btcd/btcec/v2 v2.3.3 // indirect + github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect github.com/cenkalti/backoff/v4 v4.3.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/cockroachdb/errors v1.11.3 // indirect + github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce // indirect github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect - github.com/cockroachdb/pebble v1.1.0 // indirect + github.com/cockroachdb/pebble v1.1.1 // indirect github.com/cockroachdb/redact v1.1.5 // indirect github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect - github.com/cometbft/cometbft v0.38.9 // indirect + github.com/cometbft/cometbft v0.38.12 // indirect github.com/cometbft/cometbft-db v0.12.0 // indirect github.com/cosmos/btcutil v1.0.5 // indirect github.com/cosmos/cosmos-db v1.0.2 // indirect @@ -92,7 +93,7 @@ require ( github.com/googleapis/gax-go/v2 v2.13.0 // indirect github.com/gorilla/handlers v1.5.2 // indirect github.com/gorilla/mux v1.8.1 // indirect - github.com/gorilla/websocket v1.5.1 // indirect + github.com/gorilla/websocket v1.5.3 // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect @@ -118,7 +119,6 @@ require ( github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/lib/pq v1.10.9 // indirect - github.com/libp2p/go-buffer-pool v0.1.0 // indirect github.com/linxGnu/grocksdb v1.9.3 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect @@ -139,7 +139,7 @@ require ( github.com/prometheus/procfs v0.15.1 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect - github.com/rs/cors v1.11.0 // indirect + github.com/rs/cors v1.11.1 // indirect github.com/rs/zerolog v1.33.0 // indirect github.com/sagikazarmark/locafero v0.6.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect diff --git a/tools/cosmovisor/go.sum b/tools/cosmovisor/go.sum index 2937d1f261b6..62506d928996 100644 --- a/tools/cosmovisor/go.sum +++ b/tools/cosmovisor/go.sum @@ -192,8 +192,8 @@ cosmossdk.io/api v0.7.6 h1:PC20PcXy1xYKH2KU4RMurVoFjjKkCgYRbVAD4PdqUuY= cosmossdk.io/api v0.7.6/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= -cosmossdk.io/core v0.11.0 h1:vtIafqUi+1ZNAE/oxLOQQ7Oek2n4S48SWLG8h/+wdbo= -cosmossdk.io/core v0.11.0/go.mod h1:LaTtayWBSoacF5xNzoF8tmLhehqlA9z1SWiPuNC6X1w= +cosmossdk.io/core v0.11.1 h1:h9WfBey7NAiFfIcUhDVNS503I2P2HdZLebJlUIs8LPA= +cosmossdk.io/core v0.11.1/go.mod h1:OJzxcdC+RPrgGF8NJZR2uoQr56tc7gfBKhiKeDO7hH0= cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= @@ -202,10 +202,10 @@ cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= -cosmossdk.io/store v1.1.0 h1:LnKwgYMc9BInn9PhpTFEQVbL9UK475G2H911CGGnWHk= -cosmossdk.io/store v1.1.0/go.mod h1:oZfW/4Fc/zYqu3JmQcQdUJ3fqu5vnYTn3LZFFy8P8ng= -cosmossdk.io/x/tx v0.13.3 h1:Ha4mNaHmxBc6RMun9aKuqul8yHiL78EKJQ8g23Zf73g= -cosmossdk.io/x/tx v0.13.3/go.mod h1:I8xaHv0rhUdIvIdptKIqzYy27+n2+zBVaxO6fscFhys= +cosmossdk.io/store v1.1.1 h1:NA3PioJtWDVU7cHHeyvdva5J/ggyLDkyH0hGHl2804Y= +cosmossdk.io/store v1.1.1/go.mod h1:8DwVTz83/2PSI366FERGbWSH7hL6sB7HbYp8bqksNwM= +cosmossdk.io/x/tx v0.13.5 h1:FdnU+MdmFWn1pTsbfU0OCf2u6mJ8cqc1H4OMG418MLw= +cosmossdk.io/x/tx v0.13.5/go.mod h1:V6DImnwJMTq5qFjeGWpXNiT/fjgE4HtmclRmTqRVM3w= cosmossdk.io/x/upgrade v0.1.4 h1:/BWJim24QHoXde8Bc64/2BSEB6W4eTydq0X/2f8+g38= cosmossdk.io/x/upgrade v0.1.4/go.mod h1:9v0Aj+fs97O+Ztw+tG3/tp5JSlrmT7IcFhAebQHmOPo= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= @@ -261,10 +261,10 @@ github.com/bgentry/speakeasy v0.2.0 h1:tgObeVOf8WAvtuAX6DhJ4xks4CFNwPDZiqzGqIHE5 github.com/bgentry/speakeasy v0.2.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bits-and-blooms/bitset v1.8.0 h1:FD+XqgOZDUxxZ8hzoBFuV9+cGWY9CslN6d5MS5JVb4c= github.com/bits-and-blooms/bitset v1.8.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= -github.com/btcsuite/btcd/btcec/v2 v2.3.3 h1:6+iXlDKE8RMtKsvK0gshlXIuPbyWM/h84Ensb7o3sC0= -github.com/btcsuite/btcd/btcec/v2 v2.3.3/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= -github.com/btcsuite/btcd/btcutil v1.1.3 h1:xfbtw8lwpp0G6NwSHb+UE67ryTFHJAiNuipusjXSohQ= -github.com/btcsuite/btcd/btcutil v1.1.3/go.mod h1:UR7dsSJzJUfMmFiiLlIrMq1lS9jh9EdCV7FStZSnpi0= +github.com/btcsuite/btcd/btcec/v2 v2.3.4 h1:3EJjcN70HCu/mwqlUsGK8GcNVyLVxFDlWurTXGPFfiQ= +github.com/btcsuite/btcd/btcec/v2 v2.3.4/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= +github.com/btcsuite/btcd/btcutil v1.1.6 h1:zFL2+c3Lb9gEgqKNzowKUPQNb8jV7v5Oaodi/AYFd6c= +github.com/btcsuite/btcd/btcutil v1.1.6/go.mod h1:9dFymx8HpuLqBnsPELrImQeTQfKBQqzqGbbV3jK55aE= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/bufbuild/protocompile v0.6.0 h1:Uu7WiSQ6Yj9DbkdnOe7U4mNKp58y9WDMKDn28/ZlunY= @@ -303,17 +303,19 @@ github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f h1:otljaY github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= github.com/cockroachdb/errors v1.11.3 h1:5bA+k2Y6r+oz/6Z/RFlNeVCesGARKuC6YymtcDrbC/I= github.com/cockroachdb/errors v1.11.3/go.mod h1:m4UIW4CDjx+R5cybPsNrRbreomiFqt8o1h1wUVazSd8= +github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce h1:giXvy4KSc/6g/esnpM7Geqxka4WSqI1SZc7sMJFd3y4= +github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce/go.mod h1:9/y3cnZ5GKakj/H4y9r9GTjCvAFta7KLgSHPJJYc52M= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= -github.com/cockroachdb/pebble v1.1.0 h1:pcFh8CdCIt2kmEpK0OIatq67Ln9uGDYY3d5XnE0LJG4= -github.com/cockroachdb/pebble v1.1.0/go.mod h1:sEHm5NOXxyiAoKWhoFxT8xMgd/f3RA6qUqQ1BXKrh2E= +github.com/cockroachdb/pebble v1.1.1 h1:XnKU22oiCLy2Xn8vp1re67cXg4SAasg/WDt1NtcRFaw= +github.com/cockroachdb/pebble v1.1.1/go.mod h1:4exszw1r40423ZsmkG/09AFEG83I0uDgfujJdbL6kYU= github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/cometbft/cometbft v0.38.9 h1:cJBJBG0mPKz+sqelCi/hlfZjadZQGdDNnu6YQ1ZsUHQ= -github.com/cometbft/cometbft v0.38.9/go.mod h1:xOoGZrtUT+A5izWfHSJgl0gYZUE7lu7Z2XIS1vWG/QQ= +github.com/cometbft/cometbft v0.38.12 h1:OWsLZN2KcSSFe8bet9xCn07VwhBnavPea3VyPnNq1bg= +github.com/cometbft/cometbft v0.38.12/go.mod h1:GPHp3/pehPqgX1930HmK1BpBLZPxB75v/dZg8Viwy+o= github.com/cometbft/cometbft-db v0.12.0 h1:v77/z0VyfSU7k682IzZeZPFZrQAKiQwkqGN0QzAjMi0= github.com/cometbft/cometbft-db v0.12.0/go.mod h1:aX2NbCrjNVd2ZajYxt1BsiFf/Z+TQ2MN0VxdicheYuw= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= @@ -326,8 +328,8 @@ github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAK github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= -github.com/cosmos/cosmos-sdk v0.50.7 h1:LsBGKxifENR/DN4E1RZaitsyL93HU44x0p8EnMHp4V4= -github.com/cosmos/cosmos-sdk v0.50.7/go.mod h1:84xDDJEHttRT7NDGwBaUOLVOMN0JNE9x7NbsYIxXs1s= +github.com/cosmos/cosmos-sdk v0.50.10 h1:zXfeu/z653tWZARr/jESzAEiCUYjgJwwG4ytnYWMoDM= +github.com/cosmos/cosmos-sdk v0.50.10/go.mod h1:6Eesrx3ZE7vxBZWpK++30H+Uc7Q4ahQWCL7JKU/LEdU= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= @@ -585,8 +587,8 @@ github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= -github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= +github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= +github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI= @@ -706,8 +708,6 @@ github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= -github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg= github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= github.com/linxGnu/grocksdb v1.9.3 h1:s1cbPcOd0cU2SKXRG1nEqCOWYAELQjdqg3RVI2MH9ik= @@ -874,8 +874,8 @@ github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/f github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= -github.com/rs/cors v1.11.0 h1:0B9GE/r9Bc2UxRMMtymBkHTenPkHDv0CW4Y98GBY+po= -github.com/rs/cors v1.11.0/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= +github.com/rs/cors v1.11.1 h1:eU3gRzXLRK57F5rKMGMZURNdIG4EoAmX8k94r9wXWHA= +github.com/rs/cors v1.11.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8= github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= From 60cbe2db29c4cef12c7a743f3a87060e7f781978 Mon Sep 17 00:00:00 2001 From: Luis Carvalho Date: Fri, 11 Oct 2024 09:17:06 +0100 Subject: [PATCH 27/57] fix(x/tx): sort with oneof field name in amino-json (#21782) Co-authored-by: Matt Kocubinski --- tests/integration/rapidgen/rapidgen.go | 4 +- .../tx/aminojson/aminojson_test.go | 21 ++++++-- x/tx/CHANGELOG.md | 1 + x/tx/signing/aminojson/json_marshal.go | 51 +++++++++++++------ 4 files changed, 56 insertions(+), 21 deletions(-) diff --git a/tests/integration/rapidgen/rapidgen.go b/tests/integration/rapidgen/rapidgen.go index 0060ca1976ce..2d2f5ab48630 100644 --- a/tests/integration/rapidgen/rapidgen.go +++ b/tests/integration/rapidgen/rapidgen.go @@ -259,9 +259,7 @@ var ( GenType(&slashingtypes.Params{}, &slashingapi.Params{}, GenOpts.WithDisallowNil()), - // JSON ordering of one of fields to be fixed in https://github.com/cosmos/cosmos-sdk/pull/21782 - // TODO uncomment once merged - // GenType(&stakingtypes.StakeAuthorization{}, &stakingapi.StakeAuthorization{}, GenOpts), + GenType(&stakingtypes.StakeAuthorization{}, &stakingapi.StakeAuthorization{}, GenOpts), GenType(&upgradetypes.CancelSoftwareUpgradeProposal{}, &upgradeapi.CancelSoftwareUpgradeProposal{}, GenOpts), //nolint:staticcheck // testing legacy code path GenType(&upgradetypes.SoftwareUpgradeProposal{}, &upgradeapi.SoftwareUpgradeProposal{}, GenOpts.WithDisallowNil()), //nolint:staticcheck // testing legacy code path diff --git a/tests/integration/tx/aminojson/aminojson_test.go b/tests/integration/tx/aminojson/aminojson_test.go index 69ab768ff4c3..c68f24e97865 100644 --- a/tests/integration/tx/aminojson/aminojson_test.go +++ b/tests/integration/tx/aminojson/aminojson_test.go @@ -2,6 +2,7 @@ package aminojson import ( "bytes" + "encoding/json" "fmt" stdmath "math" "testing" @@ -316,9 +317,6 @@ func TestAminoJSON_LegacyParity(t *testing.T) { }, AuthorizationType: stakingtypes.AuthorizationType_AUTHORIZATION_TYPE_DELEGATE, }, - // to be fixed in https://github.com/cosmos/cosmos-sdk/pull/21782 - // TODO remove once merged - fails: true, }, "vesting/base_account_empty": { gogo: &vestingtypes.BaseVestingAccount{BaseAccount: &authtypes.BaseAccount{}}, @@ -456,3 +454,20 @@ func postFixPulsarMessage(msg proto.Message) { } } } + +// sortJson sorts the JSON bytes by way of the side effect of unmarshalling and remarshalling the JSON +// using encoding/json. This hacky way of sorting JSON fields was used by the legacy amino JSON encoding in +// x/auth/migrations/legacytx.StdSignBytes. It is used here ensure the x/tx JSON encoding is equivalent to +// the legacy amino JSON encoding. +func sortJson(bz []byte) ([]byte, error) { + var c any + err := json.Unmarshal(bz, &c) + if err != nil { + return nil, err + } + js, err := json.Marshal(c) + if err != nil { + return nil, err + } + return js, nil +} diff --git a/x/tx/CHANGELOG.md b/x/tx/CHANGELOG.md index 9fc07fac5acf..182c6dbfefb5 100644 --- a/x/tx/CHANGELOG.md +++ b/x/tx/CHANGELOG.md @@ -33,6 +33,7 @@ Since v0.13.0, x/tx follows Cosmos SDK semver: https://github.com/cosmos/cosmos- ## [Unreleased] +* [#21782](https://github.com/cosmos/cosmos-sdk/pull/21782) Fix JSON attribute sort order on messages with oneof fields. * [#21825](https://github.com/cosmos/cosmos-sdk/pull/21825) Fix decimal encoding and field ordering in Amino JSON encoder. * [#21850](https://github.com/cosmos/cosmos-sdk/pull/21850) Support bytes field as signer. diff --git a/x/tx/signing/aminojson/json_marshal.go b/x/tx/signing/aminojson/json_marshal.go index 6629fb350506..1e5d1b59af81 100644 --- a/x/tx/signing/aminojson/json_marshal.go +++ b/x/tx/signing/aminojson/json_marshal.go @@ -270,8 +270,11 @@ func (enc Encoder) marshal(value protoreflect.Value, fd protoreflect.FieldDescri } type nameAndIndex struct { - i int - name string + i int + name string + oneof protoreflect.OneofDescriptor + oneofFieldName string + oneofTypeName string } func (enc Encoder) marshalMessage(msg protoreflect.Message, writer io.Writer) error { @@ -302,14 +305,37 @@ func (enc Encoder) marshalMessage(msg protoreflect.Message, writer io.Writer) er indices := make([]*nameAndIndex, 0, fields.Len()) for i := 0; i < fields.Len(); i++ { f := fields.Get(i) - name := getAminoFieldName(f) - indices = append(indices, &nameAndIndex{i: i, name: name}) + entry := &nameAndIndex{ + i: i, + name: getAminoFieldName(f), + oneof: f.ContainingOneof(), + } + + if entry.oneof != nil { + var err error + entry.oneofFieldName, entry.oneofTypeName, err = getOneOfNames(f) + if err != nil { + return err + } + } + + indices = append(indices, entry) } if shouldSortFields := !enc.doNotSortFields; shouldSortFields { sort.Slice(indices, func(i, j int) bool { ni, nj := indices[i], indices[j] - return ni.name < nj.name + niName, njName := ni.name, nj.name + + if indices[i].oneof != nil { + niName = indices[i].oneofFieldName + } + + if indices[j].oneof != nil { + njName = indices[j].oneofFieldName + } + + return niName < njName }) } @@ -318,22 +344,17 @@ func (enc Encoder) marshalMessage(msg protoreflect.Message, writer io.Writer) er name := ni.name f := fields.Get(i) v := msg.Get(f) - oneof := f.ContainingOneof() - isOneOf := oneof != nil - oneofFieldName, oneofTypeName, err := getOneOfNames(f) - if err != nil && isOneOf { - return err - } + isOneOf := ni.oneof != nil writeNil := false if !msg.Has(f) { // msg.WhichOneof(oneof) == nil: no field of the oneof has been set // !emptyOneOfWritten: we haven't written a null for this oneof yet (only write one null per empty oneof) switch { - case isOneOf && msg.WhichOneof(oneof) == nil && !emptyOneOfWritten[oneofFieldName]: - name = oneofFieldName + case isOneOf && msg.WhichOneof(ni.oneof) == nil && !emptyOneOfWritten[ni.oneofFieldName]: + name = ni.oneofFieldName writeNil = true - emptyOneOfWritten[oneofFieldName] = true + emptyOneOfWritten[ni.oneofFieldName] = true case omitEmpty(f): continue case f.Kind() == protoreflect.MessageKind && @@ -351,7 +372,7 @@ func (enc Encoder) marshalMessage(msg protoreflect.Message, writer io.Writer) er } if isOneOf && !writeNil { - _, err = fmt.Fprintf(writer, `"%s":{"type":"%s","value":{`, oneofFieldName, oneofTypeName) + _, err = fmt.Fprintf(writer, `"%s":{"type":"%s","value":{`, ni.oneofFieldName, ni.oneofTypeName) if err != nil { return err } From 8ad20815dd931f6cc52b6e1f53f072df9773497b Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Fri, 11 Oct 2024 13:36:02 +0200 Subject: [PATCH 28/57] chore(x/group): update supported flags (#22229) --- x/group/client/cli/tx.go | 2 +- x/group/client/cli/util.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/x/group/client/cli/tx.go b/x/group/client/cli/tx.go index 9054767ff142..ab7915feb865 100644 --- a/x/group/client/cli/tx.go +++ b/x/group/client/cli/tx.go @@ -534,7 +534,7 @@ metadata example: }, } - cmd.Flags().String(FlagExec, "", "Set to 1 to try to execute proposal immediately after creation (proposers signatures are considered as Yes votes)") + cmd.Flags().String(FlagExec, "", "Set to 1 or 'try' to try to execute proposal immediately after creation (proposers signatures are considered as Yes votes)") flags.AddTxFlagsToCmd(cmd) return cmd diff --git a/x/group/client/cli/util.go b/x/group/client/cli/util.go index 162a7addd310..53772e11ab46 100644 --- a/x/group/client/cli/util.go +++ b/x/group/client/cli/util.go @@ -55,7 +55,7 @@ func parseMembers(membersFile string) ([]group.MemberRequest, error) { func execFromString(execStr string) group.Exec { exec := group.Exec_EXEC_UNSPECIFIED - if execStr == ExecTry { + if execStr == ExecTry || execStr == "1" { exec = group.Exec_EXEC_TRY } From 4733fc1769a6a82a54ffd8fd3679a978d842547d Mon Sep 17 00:00:00 2001 From: Akhil Kumar P <36399231+akhilkumarpilli@users.noreply.github.com> Date: Fri, 11 Oct 2024 17:43:00 +0530 Subject: [PATCH 29/57] test: migrate e2e/auth to system tests and fix sign-batch (#22149) --- client/account_retriever.go | 24 +- tests/e2e/auth/cli_test.go | 20 - tests/e2e/auth/suite.go | 1808 ------------------------ tests/systemtests/auth_test.go | 508 +++++++ tests/systemtests/cli.go | 18 - tests/systemtests/distribution_test.go | 4 +- x/auth/client/cli/tx_sign.go | 8 +- 7 files changed, 538 insertions(+), 1852 deletions(-) delete mode 100644 tests/e2e/auth/cli_test.go delete mode 100644 tests/e2e/auth/suite.go create mode 100644 tests/systemtests/auth_test.go diff --git a/client/account_retriever.go b/client/account_retriever.go index 63ff674dfd1e..7ffcc0e17f42 100644 --- a/client/account_retriever.go +++ b/client/account_retriever.go @@ -13,6 +13,26 @@ type Account interface { GetSequence() uint64 } +type mockAccount struct { + addr []byte +} + +func (m mockAccount) GetAddress() sdk.AccAddress { + return m.addr +} + +func (m mockAccount) GetPubKey() cryptotypes.PubKey { + return nil +} + +func (m mockAccount) GetAccountNumber() uint64 { + return 0 +} + +func (m mockAccount) GetSequence() uint64 { + return 0 +} + // AccountRetriever defines the interfaces required by transactions to // ensure an account exists and to be able to query for account fields necessary // for signing. @@ -32,8 +52,8 @@ type MockAccountRetriever struct { ReturnAccNum, ReturnAccSeq uint64 } -func (mar MockAccountRetriever) GetAccount(_ Context, _ sdk.AccAddress) (Account, error) { - return nil, nil +func (mar MockAccountRetriever) GetAccount(_ Context, address sdk.AccAddress) (Account, error) { + return mockAccount{addr: address}, nil } func (mar MockAccountRetriever) GetAccountWithHeight(_ Context, _ sdk.AccAddress) (Account, int64, error) { diff --git a/tests/e2e/auth/cli_test.go b/tests/e2e/auth/cli_test.go deleted file mode 100644 index a029338e3d57..000000000000 --- a/tests/e2e/auth/cli_test.go +++ /dev/null @@ -1,20 +0,0 @@ -//go:build e2e -// +build e2e - -package auth - -import ( - "testing" - - "github.com/stretchr/testify/suite" - - "cosmossdk.io/simapp" - - "github.com/cosmos/cosmos-sdk/testutil/network" -) - -func TestE2ETestSuite(t *testing.T) { - cfg := network.DefaultConfig(simapp.NewTestNetworkFixture) - cfg.NumValidators = 2 - suite.Run(t, NewE2ETestSuite(cfg)) -} diff --git a/tests/e2e/auth/suite.go b/tests/e2e/auth/suite.go deleted file mode 100644 index 31dca150f87e..000000000000 --- a/tests/e2e/auth/suite.go +++ /dev/null @@ -1,1808 +0,0 @@ -package auth - -import ( - "context" - "encoding/base64" - "fmt" - "strings" - "testing" - - abci "github.com/cometbft/cometbft/api/cometbft/abci/v1" - "github.com/stretchr/testify/require" - "github.com/stretchr/testify/suite" - - "cosmossdk.io/core/address" - "cosmossdk.io/depinject" - "cosmossdk.io/math" - banktypes "cosmossdk.io/x/bank/types" - govtestutil "cosmossdk.io/x/gov/client/testutil" - govtypes "cosmossdk.io/x/gov/types/v1beta1" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - addresscodec "github.com/cosmos/cosmos-sdk/codec/address" - "github.com/cosmos/cosmos-sdk/crypto/hd" - "github.com/cosmos/cosmos-sdk/crypto/keyring" - kmultisig "github.com/cosmos/cosmos-sdk/crypto/keys/multisig" - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - authtestkeeper "github.com/cosmos/cosmos-sdk/tests/e2e/auth/keeper" - "github.com/cosmos/cosmos-sdk/testutil" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" - "github.com/cosmos/cosmos-sdk/testutil/network" - "github.com/cosmos/cosmos-sdk/testutil/testdata" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/tx" - "github.com/cosmos/cosmos-sdk/types/tx/signing" - authcli "github.com/cosmos/cosmos-sdk/x/auth/client/cli" - authclitestutil "github.com/cosmos/cosmos-sdk/x/auth/client/testutil" - "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" -) - -type E2ETestSuite struct { - suite.Suite - - cfg network.Config - ac address.Codec - network network.NetworkI -} - -func NewE2ETestSuite(cfg network.Config) *E2ETestSuite { - return &E2ETestSuite{cfg: cfg} -} - -func (s *E2ETestSuite) SetupSuite() { - s.T().Log("setting up e2e test suite") - var err error - s.network, err = network.New(s.T(), s.T().TempDir(), s.cfg) - s.Require().NoError(err) - - kb := s.network.GetValidators()[0].GetClientCtx().Keyring - _, _, err = kb.NewMnemonic("newAccount", keyring.English, sdk.FullFundraiserPath, keyring.DefaultBIP39Passphrase, hd.Secp256k1) - s.Require().NoError(err) - - account1, _, err := kb.NewMnemonic("newAccount1", keyring.English, sdk.FullFundraiserPath, keyring.DefaultBIP39Passphrase, hd.Secp256k1) - s.Require().NoError(err) - - account2, _, err := kb.NewMnemonic("newAccount2", keyring.English, sdk.FullFundraiserPath, keyring.DefaultBIP39Passphrase, hd.Secp256k1) - s.Require().NoError(err) - pub1, err := account1.GetPubKey() - s.Require().NoError(err) - pub2, err := account2.GetPubKey() - s.Require().NoError(err) - - // Create a dummy account for testing purpose - _, _, err = kb.NewMnemonic("dummyAccount", keyring.English, sdk.FullFundraiserPath, keyring.DefaultBIP39Passphrase, hd.Secp256k1) - s.Require().NoError(err) - - multi := kmultisig.NewLegacyAminoPubKey(2, []cryptotypes.PubKey{pub1, pub2}) - _, err = kb.SaveMultisig("multi", multi) - s.Require().NoError(err) - s.Require().NoError(s.network.WaitForNextBlock()) - - s.ac = addresscodec.NewBech32Codec("cosmos") -} - -func (s *E2ETestSuite) TearDownSuite() { - s.T().Log("tearing down e2e test suite") - s.network.Cleanup() -} - -func (s *E2ETestSuite) TestCLISignGenOnly() { - val := s.network.GetValidators()[0] - val2 := s.network.GetValidators()[1] - - k, err := val.GetClientCtx().Keyring.KeyByAddress(val.GetAddress()) - s.Require().NoError(err) - keyName := k.Name - - addr, err := k.GetAddress() - s.Require().NoError(err) - - account, err := val.GetClientCtx().AccountRetriever.GetAccount(val.GetClientCtx(), addr) - s.Require().NoError(err) - - sendTokens := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(10))) - msgSend := &banktypes.MsgSend{ - FromAddress: val.GetAddress().String(), - ToAddress: val2.GetAddress().String(), - Amount: sendTokens, - } - - generatedStd, err := clitestutil.SubmitTestTx( - val.GetClientCtx(), - msgSend, - val.GetAddress(), - clitestutil.TestTxConfig{ - GenOnly: true, - }, - ) - s.Require().NoError(err) - opFile := testutil.WriteToNewTempFile(s.T(), generatedStd.String()) - defer opFile.Close() - - commonArgs := []string{ - fmt.Sprintf("--%s=%s", flags.FlagKeyringBackend, keyring.BackendTest), - fmt.Sprintf("--%s=%s", flags.FlagHome, strings.Replace(val.GetClientCtx().HomeDir, "simd", "simcli", 1)), - fmt.Sprintf("--%s=%s", flags.FlagChainID, val.GetClientCtx().ChainID), - } - - cases := []struct { - name string - args []string - expErr bool - errMsg string - }{ - { - "offline mode with account-number, sequence and keyname (valid)", - []string{ - opFile.Name(), - fmt.Sprintf("--%s=true", flags.FlagOffline), - fmt.Sprintf("--%s=%s", flags.FlagFrom, keyName), - fmt.Sprintf("--%s=%d", flags.FlagAccountNumber, account.GetAccountNumber()), - fmt.Sprintf("--%s=%d", flags.FlagSequence, account.GetSequence()), - }, - false, - "", - }, - { - "offline mode with account-number, sequence and address key (valid)", - []string{ - opFile.Name(), - fmt.Sprintf("--%s=true", flags.FlagOffline), - fmt.Sprintf("--%s=%s", flags.FlagFrom, val.GetAddress().String()), - fmt.Sprintf("--%s=%d", flags.FlagAccountNumber, account.GetAccountNumber()), - fmt.Sprintf("--%s=%d", flags.FlagSequence, account.GetSequence()), - }, - false, - "", - }, - { - "offline mode without account-number and keyname (invalid)", - []string{ - opFile.Name(), - fmt.Sprintf("--%s=true", flags.FlagOffline), - fmt.Sprintf("--%s=%s", flags.FlagFrom, keyName), - fmt.Sprintf("--%s=%d", flags.FlagSequence, account.GetSequence()), - }, - true, - `required flag(s) "account-number" not set`, - }, - { - "offline mode without sequence and keyname (invalid)", - []string{ - opFile.Name(), - fmt.Sprintf("--%s=true", flags.FlagOffline), - fmt.Sprintf("--%s=%s", flags.FlagFrom, keyName), - fmt.Sprintf("--%s=%d", flags.FlagAccountNumber, account.GetAccountNumber()), - }, - true, - `required flag(s) "sequence" not set`, - }, - { - "offline mode without account-number, sequence and keyname (invalid)", - []string{ - opFile.Name(), - fmt.Sprintf("--%s=%s", flags.FlagFrom, keyName), - fmt.Sprintf("--%s=true", flags.FlagOffline), - }, - true, - `required flag(s) "account-number", "sequence" not set`, - }, - } - - for _, tc := range cases { - cmd := authcli.GetSignCommand() - cmd.PersistentFlags().String(flags.FlagHome, val.GetClientCtx().HomeDir, "directory for config and data") - out, err := clitestutil.ExecTestCLICmd(val.GetClientCtx(), cmd, append(tc.args, commonArgs...)) - if tc.expErr { - s.Require().Error(err) - s.Require().Contains(err.Error(), tc.errMsg) - } else { - s.Require().NoError(err) - func() { - signedTx := testutil.WriteToNewTempFile(s.T(), out.String()) - defer signedTx.Close() - _, err := authclitestutil.TxBroadcastExec(val.GetClientCtx(), signedTx.Name()) - s.Require().NoError(err) - }() - } - } -} - -func (s *E2ETestSuite) TestCLISignBatch() { - val := s.network.GetValidators()[0] - clientCtx := val.GetClientCtx() - sendTokens := sdk.NewCoins( - sdk.NewCoin(fmt.Sprintf("%stoken", val.GetMoniker()), math.NewInt(10)), - sdk.NewCoin(s.cfg.BondDenom, math.NewInt(10)), - ) - - generatedStd, err := s.createBankMsg( - val, - val.GetAddress(), - sendTokens, clitestutil.TestTxConfig{ - GenOnly: true, - }, - ) - s.Require().NoError(err) - - outputFile := testutil.WriteToNewTempFile(s.T(), strings.Repeat(generatedStd.String()+"\n", 3)) - defer outputFile.Close() - clientCtx.HomeDir = strings.Replace(clientCtx.HomeDir, "simd", "simcli", 1) - - // sign-batch file - offline is set but account-number and sequence are not - _, err = authclitestutil.TxSignBatchExec(clientCtx, val.GetAddress(), outputFile.Name(), fmt.Sprintf("--%s=%s", flags.FlagChainID, clientCtx.ChainID), "--offline") - s.Require().EqualError(err, "required flag(s) \"account-number\", \"sequence\" not set") - - // sign-batch file - offline and sequence is set but account-number is not set - _, err = authclitestutil.TxSignBatchExec(clientCtx, val.GetAddress(), outputFile.Name(), fmt.Sprintf("--%s=%s", flags.FlagChainID, clientCtx.ChainID), fmt.Sprintf("--%s=%s", flags.FlagSequence, "1"), "--offline") - s.Require().EqualError(err, "required flag(s) \"account-number\" not set") - - // sign-batch file - offline and account-number is set but sequence is not set - _, err = authclitestutil.TxSignBatchExec(clientCtx, val.GetAddress(), outputFile.Name(), fmt.Sprintf("--%s=%s", flags.FlagChainID, clientCtx.ChainID), fmt.Sprintf("--%s=%s", flags.FlagAccountNumber, "1"), "--offline") - s.Require().EqualError(err, "required flag(s) \"sequence\" not set") - - // sign-batch file - sequence and account-number are set when offline is false - res, err := authclitestutil.TxSignBatchExec(clientCtx, val.GetAddress(), outputFile.Name(), fmt.Sprintf("--%s=%s", flags.FlagChainID, clientCtx.ChainID), fmt.Sprintf("--%s=%s", flags.FlagSequence, "1"), fmt.Sprintf("--%s=%s", flags.FlagAccountNumber, "1")) - s.Require().NoError(err) - s.Require().Equal(3, len(strings.Split(strings.Trim(res.String(), "\n"), "\n"))) - - // sign-batch file - res, err = authclitestutil.TxSignBatchExec(clientCtx, val.GetAddress(), outputFile.Name(), fmt.Sprintf("--%s=%s", flags.FlagChainID, clientCtx.ChainID)) - s.Require().NoError(err) - s.Require().Equal(3, len(strings.Split(strings.Trim(res.String(), "\n"), "\n"))) - - // sign-batch file signature only - res, err = authclitestutil.TxSignBatchExec(clientCtx, val.GetAddress(), outputFile.Name(), fmt.Sprintf("--%s=%s", flags.FlagChainID, clientCtx.ChainID), "--signature-only") - s.Require().NoError(err) - s.Require().Equal(3, len(strings.Split(strings.Trim(res.String(), "\n"), "\n"))) - - // Sign batch malformed tx file. - malformedFile := testutil.WriteToNewTempFile(s.T(), fmt.Sprintf("malformed%s", generatedStd)) - defer malformedFile.Close() - _, err = authclitestutil.TxSignBatchExec(clientCtx, val.GetAddress(), malformedFile.Name(), fmt.Sprintf("--%s=%s", flags.FlagChainID, clientCtx.ChainID)) - s.Require().Error(err) - - // Sign batch malformed tx file signature only. - _, err = authclitestutil.TxSignBatchExec(clientCtx, val.GetAddress(), malformedFile.Name(), fmt.Sprintf("--%s=%s", flags.FlagChainID, clientCtx.ChainID), "--signature-only") - s.Require().Error(err) - - // make a txn to increase the sequence of sender - _, seq, err := clientCtx.AccountRetriever.GetAccountNumberSequence(clientCtx, val.GetAddress()) - s.Require().NoError(err) - - account1, err := clientCtx.Keyring.Key("newAccount1") - s.Require().NoError(err) - - addr, err := account1.GetAddress() - s.Require().NoError(err) - - // Send coins from validator to multisig. - _, err = s.createBankMsg( - val, - addr, - sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 1000)), - clitestutil.TestTxConfig{}, - ) - s.Require().NoError(err) - s.Require().NoError(s.network.WaitForNextBlock()) - - // fetch the sequence after a tx, should be incremented. - _, seq1, err := clientCtx.AccountRetriever.GetAccountNumberSequence(clientCtx, val.GetAddress()) - s.Require().NoError(err) - s.Require().Equal(seq+1, seq1) - - // signing sign-batch should start from the last sequence. - signed, err := authclitestutil.TxSignBatchExec(clientCtx, val.GetAddress(), outputFile.Name(), fmt.Sprintf("--%s=%s", flags.FlagChainID, clientCtx.ChainID), "--signature-only") - s.Require().NoError(err) - signedTxs := strings.Split(strings.Trim(signed.String(), "\n"), "\n") - s.Require().GreaterOrEqual(len(signedTxs), 1) - - sigs, err := s.cfg.TxConfig.UnmarshalSignatureJSON([]byte(signedTxs[0])) - s.Require().NoError(err) - s.Require().Equal(sigs[0].Sequence, seq1) -} - -func (s *E2ETestSuite) TestCLIQueryTxCmdByHash() { - val := s.network.GetValidators()[0] - - account2, err := val.GetClientCtx().Keyring.Key("newAccount2") - s.Require().NoError(err) - - sendTokens := sdk.NewInt64Coin(s.cfg.BondDenom, 10) - - addr, err := account2.GetAddress() - s.Require().NoError(err) - - // Send coins. - res, err := s.createBankMsg( - val, - addr, - sdk.NewCoins(sendTokens), - clitestutil.TestTxConfig{}, - ) - s.Require().NoError(err) - s.Require().NoError(s.network.WaitForNextBlock()) - - var txRes sdk.TxResponse - s.Require().NoError(val.GetClientCtx().Codec.UnmarshalJSON(res.Bytes(), &txRes)) - - testCases := []struct { - name string - args []string - expectErr bool - rawLogContains string - }{ - { - "not enough args", - []string{}, - true, "", - }, - { - "with invalid hash", - []string{"somethinginvalid", fmt.Sprintf("--%s=json", flags.FlagOutput)}, - true, "", - }, - { - "with valid and not existing hash", - []string{"C7E7D3A86A17AB3A321172239F3B61357937AF0F25D9FA4D2F4DCCAD9B0D7747", fmt.Sprintf("--%s=json", flags.FlagOutput)}, - true, "", - }, - { - "happy case", - []string{txRes.TxHash, fmt.Sprintf("--%s=json", flags.FlagOutput)}, - false, - sdk.MsgTypeURL(&banktypes.MsgSend{}), - }, - } - - for _, tc := range testCases { - s.Run(tc.name, func() { - cmd := authcli.QueryTxCmd() - clientCtx := val.GetClientCtx() - var ( - out testutil.BufferWriter - err error - ) - - err = s.network.RetryForBlocks(func() error { - out, err = clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) - return err - }, 2) - if tc.expectErr { - s.Require().Error(err) - s.Require().NotEqual("internal", err.Error()) - } else { - var result sdk.TxResponse - s.Require().NoError(val.GetClientCtx().Codec.UnmarshalJSON(out.Bytes(), &result)) - s.Require().NotNil(result.Height) - if ok := s.deepContains(result.Events, tc.rawLogContains); !ok { - s.Require().Fail("raw log does not contain the expected value, expected value: %s", tc.rawLogContains) - } - } - }) - } -} - -func (s *E2ETestSuite) TestCLIQueryTxCmdByEvents() { - val := s.network.GetValidators()[0] - - account2, err := val.GetClientCtx().Keyring.Key("newAccount2") - s.Require().NoError(err) - - sendTokens := sdk.NewInt64Coin(s.cfg.BondDenom, 10) - - addr2, err := account2.GetAddress() - s.Require().NoError(err) - - // Send coins. - res, err := s.createBankMsg( - val, - addr2, - sdk.NewCoins(sendTokens), - clitestutil.TestTxConfig{}, - ) - s.Require().NoError(err) - var txRes sdk.TxResponse - s.Require().NoError(val.GetClientCtx().Codec.UnmarshalJSON(res.Bytes(), &txRes)) - s.Require().NoError(s.network.WaitForNextBlock()) - - var out testutil.BufferWriter - // Query the tx by hash to get the inner tx. - err = s.network.RetryForBlocks(func() error { - out, err = clitestutil.ExecTestCLICmd(val.GetClientCtx(), authcli.QueryTxCmd(), []string{txRes.TxHash, fmt.Sprintf("--%s=json", flags.FlagOutput)}) - return err - }, 3) - s.Require().NoError(err) - s.Require().NoError(val.GetClientCtx().Codec.UnmarshalJSON(out.Bytes(), &txRes)) - protoTx := txRes.GetTx().(*tx.Tx) - - testCases := []struct { - name string - args []string - expectErr bool - expectErrStr string - }{ - { - "invalid --type", - []string{ - fmt.Sprintf("--type=%s", "foo"), - "bar", - fmt.Sprintf("--%s=json", flags.FlagOutput), - }, - true, "unknown --type value foo", - }, - { - "--type=acc_seq with no addr+seq", - []string{ - "--type=acc_seq", - "", - fmt.Sprintf("--%s=json", flags.FlagOutput), - }, - true, "`acc_seq` type takes an argument '/'", - }, - { - "non-existing addr+seq combo", - []string{ - "--type=acc_seq", - "foobar", - fmt.Sprintf("--%s=json", flags.FlagOutput), - }, - true, "found no txs matching given address and sequence combination", - }, - { - "addr+seq happy case", - []string{ - "--type=acc_seq", - fmt.Sprintf("%s/%d", val.GetAddress(), protoTx.AuthInfo.SignerInfos[0].Sequence), - fmt.Sprintf("--%s=json", flags.FlagOutput), - }, - false, "", - }, - { - "--type=signature with no signature", - []string{ - "--type=signature", - "", - fmt.Sprintf("--%s=json", flags.FlagOutput), - }, - true, "argument should be comma-separated signatures", - }, - { - "non-existing signatures", - []string{ - "--type=signature", - "foo", - fmt.Sprintf("--%s=json", flags.FlagOutput), - }, - true, "found no txs matching given signatures", - }, - { - "with --signatures happy case", - []string{ - "--type=signature", - base64.StdEncoding.EncodeToString(protoTx.Signatures[0]), - fmt.Sprintf("--%s=json", flags.FlagOutput), - }, - false, "", - }, - } - - for _, tc := range testCases { - s.Run(tc.name, func() { - cmd := authcli.QueryTxCmd() - clientCtx := val.GetClientCtx() - - out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) - if tc.expectErr { - s.Require().Error(err) - s.Require().Contains(err.Error(), tc.expectErrStr) - } else { - var result sdk.TxResponse - s.Require().NoError(err) - s.Require().NoError(val.GetClientCtx().Codec.UnmarshalJSON(out.Bytes(), &result)) - s.Require().NotNil(result.Height) - } - }) - } -} - -func (s *E2ETestSuite) TestCLIQueryTxsCmdByEvents() { - val := s.network.GetValidators()[0] - - account2, err := val.GetClientCtx().Keyring.Key("newAccount2") - s.Require().NoError(err) - - sendTokens := sdk.NewInt64Coin(s.cfg.BondDenom, 10) - - addr2, err := account2.GetAddress() - s.Require().NoError(err) - // Send coins. - res, err := s.createBankMsg( - val, - addr2, - sdk.NewCoins(sendTokens), - clitestutil.TestTxConfig{}, - ) - s.Require().NoError(err) - var txRes sdk.TxResponse - s.Require().NoError(val.GetClientCtx().Codec.UnmarshalJSON(res.Bytes(), &txRes)) - s.Require().NoError(s.network.WaitForNextBlock()) - - var out testutil.BufferWriter - // Query the tx by hash to get the inner tx. - err = s.network.RetryForBlocks(func() error { - out, err = clitestutil.ExecTestCLICmd(val.GetClientCtx(), authcli.QueryTxCmd(), []string{txRes.TxHash, fmt.Sprintf("--%s=json", flags.FlagOutput)}) - return err - }, 3) - s.Require().NoError(err) - s.Require().NoError(val.GetClientCtx().Codec.UnmarshalJSON(out.Bytes(), &txRes)) - - testCases := []struct { - name string - args []string - expectEmpty bool - }{ - { - "fee event happy case", - []string{ - fmt.Sprintf( - "--query=tx.fee='%s'", - sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, math.NewInt(10))).String(), - ), - fmt.Sprintf("--%s=json", flags.FlagOutput), - }, - false, - }, - { - "no matching fee event", - []string{ - fmt.Sprintf( - "--query=tx.fee='%s'", - sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, math.NewInt(0))).String(), - ), - fmt.Sprintf("--%s=json", flags.FlagOutput), - }, - true, - }, - } - - for _, tc := range testCases { - s.Run(tc.name, func() { - cmd := authcli.QueryTxsByEventsCmd() - clientCtx := val.GetClientCtx() - - out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) - s.Require().NoError(err) - - var result sdk.SearchTxsResult - s.Require().NoError(val.GetClientCtx().Codec.UnmarshalJSON(out.Bytes(), &result)) - - if tc.expectEmpty { - s.Require().Equal(0, len(result.Txs)) - } else { - s.Require().NotEqual(0, len(result.Txs)) - s.Require().NotNil(result.Txs[0]) - } - }) - } -} - -func (s *E2ETestSuite) TestCLISendGenerateSignAndBroadcast() { - val1 := s.network.GetValidators()[0] - clientCtx := val1.GetClientCtx() - - account, err := clientCtx.Keyring.Key("newAccount") - s.Require().NoError(err) - - sendTokens := sdk.NewCoin(s.cfg.BondDenom, sdk.TokensFromConsensusPower(10, sdk.DefaultPowerReduction)) - - addr, err := account.GetAddress() - s.Require().NoError(err) - normalGeneratedTx, err := s.createBankMsg( - val1, - addr, - sdk.NewCoins(sendTokens), - clitestutil.TestTxConfig{ - GenOnly: true, - }, - ) - s.Require().NoError(err) - txCfg := clientCtx.TxConfig - - normalGeneratedStdTx, err := txCfg.TxJSONDecoder()(normalGeneratedTx.Bytes()) - s.Require().NoError(err) - txBuilder, err := txCfg.WrapTxBuilder(normalGeneratedStdTx) - s.Require().NoError(err) - s.Require().Equal(txBuilder.GetTx().GetGas(), uint64(flags.DefaultGasLimit)) - s.Require().Equal(len(txBuilder.GetTx().GetMsgs()), 1) - sigs, err := txBuilder.GetTx().GetSignaturesV2() - s.Require().NoError(err) - s.Require().Equal(0, len(sigs)) - - // Test generate sendTx with --gas=$amount - limitedGasGeneratedTx, err := s.createBankMsg(val1, addr, - sdk.NewCoins(sendTokens), clitestutil.TestTxConfig{ - GenOnly: true, - Gas: 100, - }, - ) - s.Require().NoError(err) - - limitedGasStdTx, err := txCfg.TxJSONDecoder()(limitedGasGeneratedTx.Bytes()) - s.Require().NoError(err) - txBuilder, err = txCfg.WrapTxBuilder(limitedGasStdTx) - s.Require().NoError(err) - s.Require().Equal(txBuilder.GetTx().GetGas(), uint64(100)) - s.Require().Equal(len(txBuilder.GetTx().GetMsgs()), 1) - sigs, err = txBuilder.GetTx().GetSignaturesV2() - s.Require().NoError(err) - s.Require().Equal(0, len(sigs)) - - resp, err := testutil.GetRequest(fmt.Sprintf("%s/cosmos/bank/v1beta1/balances/%s", val1.GetAPIAddress(), val1.GetAddress())) - s.Require().NoError(err) - - var balRes banktypes.QueryAllBalancesResponse - err = clientCtx.Codec.UnmarshalJSON(resp, &balRes) - s.Require().NoError(err) - startTokens := balRes.Balances.AmountOf(s.cfg.BondDenom) - - // Test generate sendTx, estimate gas - finalGeneratedTx, err := s.createBankMsg( - val1, - addr, - sdk.NewCoins(sendTokens), clitestutil.TestTxConfig{ - GenOnly: true, - Gas: flags.DefaultGasLimit, - }) - s.Require().NoError(err) - - finalStdTx, err := txCfg.TxJSONDecoder()(finalGeneratedTx.Bytes()) - s.Require().NoError(err) - txBuilder, err = txCfg.WrapTxBuilder(finalStdTx) - s.Require().NoError(err) - s.Require().Equal(uint64(flags.DefaultGasLimit), txBuilder.GetTx().GetGas()) - s.Require().Equal(len(finalStdTx.GetMsgs()), 1) - - // Write the output to disk - unsignedTxFile := testutil.WriteToNewTempFile(s.T(), finalGeneratedTx.String()) - defer unsignedTxFile.Close() - - // Test validate-signatures - res, err := authclitestutil.TxValidateSignaturesExec(clientCtx, unsignedTxFile.Name()) - s.Require().EqualError(err, "signatures validation failed") - s.Require().True(strings.Contains(res.String(), fmt.Sprintf("Signers:\n 0: %v\n\nSignatures:\n\n", val1.GetAddress().String()))) - - // Test sign - - // Does not work in offline mode - _, err = authclitestutil.TxSignExec(clientCtx, val1.GetAddress(), unsignedTxFile.Name(), "--offline") - s.Require().EqualError(err, "required flag(s) \"account-number\", \"sequence\" not set") - - // But works offline if we set account number and sequence - clientCtx.HomeDir = strings.Replace(clientCtx.HomeDir, "simd", "simcli", 1) - _, err = authclitestutil.TxSignExec(clientCtx, val1.GetAddress(), unsignedTxFile.Name(), "--offline", "--account-number", "1", "--sequence", "1") - s.Require().NoError(err) - - // Sign transaction - signedTx, err := authclitestutil.TxSignExec(clientCtx, val1.GetAddress(), unsignedTxFile.Name()) - s.Require().NoError(err) - signedFinalTx, err := txCfg.TxJSONDecoder()(signedTx.Bytes()) - s.Require().NoError(err) - txBuilder, err = clientCtx.TxConfig.WrapTxBuilder(signedFinalTx) - s.Require().NoError(err) - s.Require().Equal(len(txBuilder.GetTx().GetMsgs()), 1) - sigs, err = txBuilder.GetTx().GetSignaturesV2() - s.Require().NoError(err) - s.Require().Equal(1, len(sigs)) - signers, err := txBuilder.GetTx().GetSigners() - s.Require().NoError(err) - s.Require().Equal([]byte(val1.GetAddress()), signers[0]) - - // Write the output to disk - signedTxFile := testutil.WriteToNewTempFile(s.T(), signedTx.String()) - defer signedTxFile.Close() - - // validate Signature - res, err = authclitestutil.TxValidateSignaturesExec(clientCtx, signedTxFile.Name()) - s.Require().NoError(err) - s.Require().True(strings.Contains(res.String(), "[OK]")) - s.Require().NoError(s.network.WaitForNextBlock()) - - // Ensure foo has right amount of funds - resp, err = testutil.GetRequest(fmt.Sprintf("%s/cosmos/bank/v1beta1/balances/%s", val1.GetAPIAddress(), val1.GetAddress())) - s.Require().NoError(err) - err = clientCtx.Codec.UnmarshalJSON(resp, &balRes) - s.Require().NoError(err) - s.Require().Equal(startTokens, balRes.Balances.AmountOf(s.cfg.BondDenom)) - - // Test broadcast - - // Does not work in offline mode - _, err = authclitestutil.TxBroadcastExec(clientCtx, signedTxFile.Name(), "--offline") - s.Require().EqualError(err, "cannot broadcast tx during offline mode") - s.Require().NoError(s.network.WaitForNextBlock()) - - // Broadcast correct transaction. - clientCtx.BroadcastMode = flags.BroadcastSync - _, err = authclitestutil.TxBroadcastExec(clientCtx, signedTxFile.Name()) - s.Require().NoError(err) - s.Require().NoError(s.network.WaitForNextBlock()) - - // Ensure destiny account state - err = s.network.RetryForBlocks(func() error { - resp, err = testutil.GetRequest(fmt.Sprintf("%s/cosmos/bank/v1beta1/balances/%s", val1.GetAPIAddress(), addr)) - s.Require().NoError(err) - return err - }, 3) - s.Require().NoError(err) - - err = clientCtx.Codec.UnmarshalJSON(resp, &balRes) - s.Require().NoError(err) - s.Require().Equal(sendTokens.Amount, balRes.Balances.AmountOf(s.cfg.BondDenom)) - - // Ensure origin account state - resp, err = testutil.GetRequest(fmt.Sprintf("%s/cosmos/bank/v1beta1/balances/%s", val1.GetAPIAddress(), val1.GetAddress())) - s.Require().NoError(err) - err = clientCtx.Codec.UnmarshalJSON(resp, &balRes) - s.Require().NoError(err) -} - -func (s *E2ETestSuite) TestCLIMultisignInsufficientCosigners() { - val1 := s.network.GetValidators()[0] - clientCtx := val1.GetClientCtx() - - // Fetch account and a multisig info - account1, err := clientCtx.Keyring.Key("newAccount1") - s.Require().NoError(err) - - multisigRecord, err := clientCtx.Keyring.Key("multi") - s.Require().NoError(err) - - addr, err := multisigRecord.GetAddress() - s.Require().NoError(err) - // Send coins from validator to multisig. - _, err = s.createBankMsg( - val1, - addr, - sdk.NewCoins( - sdk.NewInt64Coin(s.cfg.BondDenom, 10), - ), - clitestutil.TestTxConfig{}, - ) - s.Require().NoError(err) - s.Require().NoError(s.network.WaitForNextBlock()) - - coins := sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 5)) - msgSend := &banktypes.MsgSend{ - FromAddress: addr.String(), - ToAddress: val1.GetAddress().String(), - Amount: coins, - } - - // Generate multisig transaction. - multiGeneratedTx, err := clitestutil.SubmitTestTx( - clientCtx, - msgSend, - addr, - clitestutil.TestTxConfig{ - GenOnly: true, - }, - ) - s.Require().NoError(err) - - // Save tx to file - multiGeneratedTxFile := testutil.WriteToNewTempFile(s.T(), multiGeneratedTx.String()) - defer multiGeneratedTxFile.Close() - - // Multisign, sign with one signature - clientCtx.HomeDir = strings.Replace(clientCtx.HomeDir, "simd", "simcli", 1) - addr1, err := account1.GetAddress() - s.Require().NoError(err) - account1Signature, err := authclitestutil.TxSignExec(clientCtx, addr1, multiGeneratedTxFile.Name(), "--multisig", addr.String()) - s.Require().NoError(err) - - sign1File := testutil.WriteToNewTempFile(s.T(), account1Signature.String()) - defer sign1File.Close() - - multiSigWith1Signature, err := authclitestutil.TxMultiSignExec(clientCtx, multisigRecord.Name, multiGeneratedTxFile.Name(), sign1File.Name()) - s.Require().NoError(err) - - // Save tx to file - multiSigWith1SignatureFile := testutil.WriteToNewTempFile(s.T(), multiSigWith1Signature.String()) - defer multiSigWith1SignatureFile.Close() - - _, err = authclitestutil.TxValidateSignaturesExec(clientCtx, multiSigWith1SignatureFile.Name()) - s.Require().Error(err) -} - -func (s *E2ETestSuite) TestCLIEncode() { - val1 := s.network.GetValidators()[0] - - sendTokens := sdk.NewCoin(s.cfg.BondDenom, sdk.TokensFromConsensusPower(10, sdk.DefaultPowerReduction)) - - normalGeneratedTx, err := s.createBankMsg( - val1, val1.GetAddress(), - sdk.NewCoins(sendTokens), - clitestutil.TestTxConfig{ - GenOnly: true, - Memo: "deadbeef", - }, - ) - s.Require().NoError(err) - savedTxFile := testutil.WriteToNewTempFile(s.T(), normalGeneratedTx.String()) - defer savedTxFile.Close() - - // Encode - encodeExec, err := authclitestutil.TxEncodeExec(val1.GetClientCtx(), savedTxFile.Name()) - s.Require().NoError(err) - trimmedBase64 := strings.Trim(encodeExec.String(), "\"\n") - - // Check that the transaction decodes as expected - decodedTx, err := authclitestutil.TxDecodeExec(val1.GetClientCtx(), trimmedBase64) - s.Require().NoError(err) - - txCfg := val1.GetClientCtx().TxConfig - theTx, err := txCfg.TxJSONDecoder()(decodedTx.Bytes()) - s.Require().NoError(err) - txBuilder, err := val1.GetClientCtx().TxConfig.WrapTxBuilder(theTx) - s.Require().NoError(err) - s.Require().Equal("deadbeef", txBuilder.GetTx().GetMemo()) -} - -func (s *E2ETestSuite) TestCLIMultisignSortSignatures() { - val1 := s.network.GetValidators()[0] - clientCtx := val1.GetClientCtx() - - // Generate 2 accounts and a multisig. - account1, err := clientCtx.Keyring.Key("newAccount1") - s.Require().NoError(err) - - account2, err := clientCtx.Keyring.Key("newAccount2") - s.Require().NoError(err) - - multisigRecord, err := clientCtx.Keyring.Key("multi") - s.Require().NoError(err) - - // Generate dummy account which is not a part of multisig. - dummyAcc, err := clientCtx.Keyring.Key("dummyAccount") - s.Require().NoError(err) - - addr, err := multisigRecord.GetAddress() - s.Require().NoError(err) - resp, err := testutil.GetRequest(fmt.Sprintf("%s/cosmos/bank/v1beta1/balances/%s", val1.GetAPIAddress(), addr)) - s.Require().NoError(err) - - var balRes banktypes.QueryAllBalancesResponse - err = clientCtx.Codec.UnmarshalJSON(resp, &balRes) - s.Require().NoError(err) - initialCoins := balRes.Balances - - // Send coins from validator to multisig. - sendTokens := sdk.NewInt64Coin(s.cfg.BondDenom, 10) - _, err = s.createBankMsg( - val1, - addr, - sdk.NewCoins(sendTokens), - clitestutil.TestTxConfig{}, - ) - s.Require().NoError(err) - s.Require().NoError(s.network.WaitForNextBlock()) - - resp, err = testutil.GetRequest(fmt.Sprintf("%s/cosmos/bank/v1beta1/balances/%s", val1.GetAPIAddress(), addr)) - s.Require().NoError(err) - err = clientCtx.Codec.UnmarshalJSON(resp, &balRes) - s.Require().NoError(err) - diff, _ := balRes.Balances.SafeSub(initialCoins...) - s.Require().Equal(sendTokens.Amount, diff.AmountOf(s.cfg.BondDenom)) - - tokens := sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 5)) - msgSend := &banktypes.MsgSend{ - FromAddress: addr.String(), - ToAddress: val1.GetAddress().String(), - Amount: tokens, - } - - // Generate multisig transaction. - multiGeneratedTx, err := clitestutil.SubmitTestTx( - clientCtx, - msgSend, - addr, - clitestutil.TestTxConfig{ - GenOnly: true, - }, - ) - s.Require().NoError(err) - - // Save tx to file - multiGeneratedTxFile := testutil.WriteToNewTempFile(s.T(), multiGeneratedTx.String()) - defer multiGeneratedTxFile.Close() - - // Sign with account1 - addr1, err := account1.GetAddress() - s.Require().NoError(err) - clientCtx.HomeDir = strings.Replace(clientCtx.HomeDir, "simd", "simcli", 1) - account1Signature, err := authclitestutil.TxSignExec(clientCtx, addr1, multiGeneratedTxFile.Name(), "--multisig", addr.String()) - s.Require().NoError(err) - - sign1File := testutil.WriteToNewTempFile(s.T(), account1Signature.String()) - defer sign1File.Close() - - // Sign with account2 - addr2, err := account2.GetAddress() - s.Require().NoError(err) - account2Signature, err := authclitestutil.TxSignExec(clientCtx, addr2, multiGeneratedTxFile.Name(), "--multisig", addr.String()) - s.Require().NoError(err) - - sign2File := testutil.WriteToNewTempFile(s.T(), account2Signature.String()) - defer sign2File.Close() - - // Sign with dummy account - dummyAddr, err := dummyAcc.GetAddress() - s.Require().NoError(err) - _, err = authclitestutil.TxSignExec(clientCtx, dummyAddr, multiGeneratedTxFile.Name(), "--multisig", addr.String()) - s.Require().Error(err) - s.Require().Contains(err.Error(), "signing key is not a part of multisig key") - - multiSigWith2Signatures, err := authclitestutil.TxMultiSignExec(clientCtx, multisigRecord.Name, multiGeneratedTxFile.Name(), sign1File.Name(), sign2File.Name()) - s.Require().NoError(err) - - // Write the output to disk - signedTxFile := testutil.WriteToNewTempFile(s.T(), multiSigWith2Signatures.String()) - defer signedTxFile.Close() - - _, err = authclitestutil.TxValidateSignaturesExec(clientCtx, signedTxFile.Name()) - s.Require().NoError(err) - - clientCtx.BroadcastMode = flags.BroadcastSync - _, err = authclitestutil.TxBroadcastExec(clientCtx, signedTxFile.Name()) - s.Require().NoError(err) - - s.Require().NoError(s.network.WaitForNextBlock()) -} - -func (s *E2ETestSuite) TestSignWithMultisig() { - val1 := s.network.GetValidators()[0] - - // Generate a account for signing. - account1, err := val1.GetClientCtx().Keyring.Key("newAccount1") - s.Require().NoError(err) - - addr1, err := account1.GetAddress() - s.Require().NoError(err) - - // Create an address that is not in the keyring, will be used to simulate `--multisig` - multisig := "cosmos1hd6fsrvnz6qkp87s3u86ludegq97agxsdkwzyh" - multisigAddr, err := sdk.AccAddressFromBech32(multisig) - s.Require().NoError(err) - - tokens := sdk.NewCoins( - sdk.NewInt64Coin(s.cfg.BondDenom, 5), - ) - msgSend := &banktypes.MsgSend{ - FromAddress: val1.GetAddress().String(), - ToAddress: val1.GetAddress().String(), - Amount: tokens, - } - - // Generate a transaction for testing --multisig with an address not in the keyring. - multisigTx, err := clitestutil.SubmitTestTx( - val1.GetClientCtx(), - msgSend, - val1.GetAddress(), - clitestutil.TestTxConfig{ - GenOnly: true, - }, - ) - s.Require().NoError(err) - - // Save multi tx to file - multiGeneratedTx2File := testutil.WriteToNewTempFile(s.T(), multisigTx.String()) - defer multiGeneratedTx2File.Close() - - // Sign using multisig. We're signing a tx on behalf of the multisig address, - // even though the tx signer is NOT the multisig address. This is fine though, - // as the main point of this test is to test the `--multisig` flag with an address - // that is not in the keyring. - _, err = authclitestutil.TxSignExec(val1.GetClientCtx(), addr1, multiGeneratedTx2File.Name(), "--multisig", multisigAddr.String()) - s.Require().Contains(err.Error(), "error getting account from keybase") -} - -func (s *E2ETestSuite) TestCLIMultisign() { - val1 := s.network.GetValidators()[0] - clientCtx := val1.GetClientCtx() - - // Generate 2 accounts and a multisig. - account1, err := clientCtx.Keyring.Key("newAccount1") - s.Require().NoError(err) - - account2, err := clientCtx.Keyring.Key("newAccount2") - s.Require().NoError(err) - - multisigRecord, err := clientCtx.Keyring.Key("multi") - s.Require().NoError(err) - - addr, err := multisigRecord.GetAddress() - s.Require().NoError(err) - - // Send coins from validator to multisig. - sendTokens := sdk.NewInt64Coin(s.cfg.BondDenom, 10) - s.Require().NoError(s.network.WaitForNextBlock()) - _, err = s.createBankMsg( - val1, addr, - sdk.NewCoins(sendTokens), - clitestutil.TestTxConfig{}, - ) - s.Require().NoError(err) - s.Require().NoError(s.network.WaitForNextBlock()) - - var balRes banktypes.QueryAllBalancesResponse - err = s.network.RetryForBlocks(func() error { - resp, err := testutil.GetRequest(fmt.Sprintf("%s/cosmos/bank/v1beta1/balances/%s", val1.GetAPIAddress(), addr)) - if err != nil { - return err - } - return clientCtx.Codec.UnmarshalJSON(resp, &balRes) - }, 3) - s.Require().NoError(err) - s.Require().True(sendTokens.Amount.Equal(balRes.Balances.AmountOf(s.cfg.BondDenom))) - - tokens := sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 5)) - msgSend := &banktypes.MsgSend{ - FromAddress: addr.String(), - ToAddress: val1.GetAddress().String(), - Amount: tokens, - } - - // Generate multisig transaction. - multiGeneratedTx, err := clitestutil.SubmitTestTx( - clientCtx, - msgSend, - addr, - clitestutil.TestTxConfig{ - GenOnly: true, - }, - ) - s.Require().NoError(err) - - // Save tx to file - multiGeneratedTxFile := testutil.WriteToNewTempFile(s.T(), multiGeneratedTx.String()) - defer multiGeneratedTxFile.Close() - - addr1, err := account1.GetAddress() - s.Require().NoError(err) - // Sign with account1 - clientCtx.HomeDir = strings.Replace(clientCtx.HomeDir, "simd", "simcli", 1) - account1Signature, err := authclitestutil.TxSignExec(clientCtx, addr1, multiGeneratedTxFile.Name(), "--multisig", addr.String()) - s.Require().NoError(err) - - sign1File := testutil.WriteToNewTempFile(s.T(), account1Signature.String()) - defer sign1File.Close() - - addr2, err := account2.GetAddress() - s.Require().NoError(err) - // Sign with account2 - account2Signature, err := authclitestutil.TxSignExec(clientCtx, addr2, multiGeneratedTxFile.Name(), "--multisig", addr.String()) - s.Require().NoError(err) - - sign2File := testutil.WriteToNewTempFile(s.T(), account2Signature.String()) - defer sign2File.Close() - - // Work in offline mode. - multisigAccNum, multisigSeq, err := clientCtx.AccountRetriever.GetAccountNumberSequence(clientCtx, addr) - s.Require().NoError(err) - _, err = authclitestutil.TxMultiSignExec( - clientCtx, - multisigRecord.Name, - multiGeneratedTxFile.Name(), - fmt.Sprintf("--%s", flags.FlagOffline), - fmt.Sprintf("--%s=%d", flags.FlagAccountNumber, multisigAccNum), - fmt.Sprintf("--%s=%d", flags.FlagSequence, multisigSeq), - sign1File.Name(), - sign2File.Name(), - ) - s.Require().NoError(err) - - clientCtx.Offline = false - multiSigWith2Signatures, err := authclitestutil.TxMultiSignExec(clientCtx, multisigRecord.Name, multiGeneratedTxFile.Name(), sign1File.Name(), sign2File.Name()) - s.Require().NoError(err) - - // Write the output to disk - signedTxFile := testutil.WriteToNewTempFile(s.T(), multiSigWith2Signatures.String()) - defer signedTxFile.Close() - - _, err = authclitestutil.TxValidateSignaturesExec(clientCtx, signedTxFile.Name()) - s.Require().NoError(err) - - clientCtx.BroadcastMode = flags.BroadcastSync - _, err = authclitestutil.TxBroadcastExec(clientCtx, signedTxFile.Name()) - s.Require().NoError(err) - - s.Require().NoError(s.network.WaitForNextBlock()) -} - -func (s *E2ETestSuite) TestSignBatchMultisig() { - val := s.network.GetValidators()[0] - clientCtx := val.GetClientCtx() - - // Fetch 2 accounts and a multisig. - account1, err := clientCtx.Keyring.Key("newAccount1") - s.Require().NoError(err) - account2, err := clientCtx.Keyring.Key("newAccount2") - s.Require().NoError(err) - multisigRecord, err := clientCtx.Keyring.Key("multi") - s.Require().NoError(err) - - addr, err := multisigRecord.GetAddress() - s.Require().NoError(err) - // Send coins from validator to multisig. - sendTokens := sdk.NewInt64Coin(s.cfg.BondDenom, 10) - _, err = s.createBankMsg( - val, - addr, - sdk.NewCoins(sendTokens), - clitestutil.TestTxConfig{}, - ) - s.Require().NoError(err) - s.Require().NoError(s.network.WaitForNextBlock()) - - tokens := sdk.NewCoins( - sdk.NewCoin(s.cfg.BondDenom, math.NewInt(1)), - ) - msgSend := &banktypes.MsgSend{ - FromAddress: addr.String(), - ToAddress: val.GetAddress().String(), - Amount: tokens, - } - - generatedStd, err := clitestutil.SubmitTestTx( - clientCtx, - msgSend, - addr, - clitestutil.TestTxConfig{ - GenOnly: true, - }, - ) - s.Require().NoError(err) - - // Write the output to disk - filename := testutil.WriteToNewTempFile(s.T(), strings.Repeat(generatedStd.String(), 1)) - defer filename.Close() - clientCtx.HomeDir = strings.Replace(clientCtx.HomeDir, "simd", "simcli", 1) - - addr1, err := account1.GetAddress() - s.Require().NoError(err) - // sign-batch file - res, err := authclitestutil.TxSignBatchExec(clientCtx, addr1, filename.Name(), fmt.Sprintf("--%s=%s", flags.FlagChainID, clientCtx.ChainID), "--multisig", addr.String(), "--signature-only") - s.Require().NoError(err) - s.Require().Equal(1, len(strings.Split(strings.Trim(res.String(), "\n"), "\n"))) - // write sigs to file - file1 := testutil.WriteToNewTempFile(s.T(), res.String()) - defer file1.Close() - - addr2, err := account2.GetAddress() - s.Require().NoError(err) - // sign-batch file with account2 - res, err = authclitestutil.TxSignBatchExec(clientCtx, addr2, filename.Name(), fmt.Sprintf("--%s=%s", flags.FlagChainID, clientCtx.ChainID), "--multisig", addr.String(), "--signature-only") - s.Require().NoError(err) - s.Require().Equal(1, len(strings.Split(strings.Trim(res.String(), "\n"), "\n"))) - // write sigs to file2 - file2 := testutil.WriteToNewTempFile(s.T(), res.String()) - defer file2.Close() - _, err = authclitestutil.TxMultiSignExec(clientCtx, multisigRecord.Name, filename.Name(), file1.Name(), file2.Name()) - s.Require().NoError(err) -} - -func (s *E2ETestSuite) TestMultisignBatch() { - val := s.network.GetValidators()[0] - clientCtx := val.GetClientCtx() - - // Fetch 2 accounts and a multisig. - account1, err := clientCtx.Keyring.Key("newAccount1") - s.Require().NoError(err) - account2, err := clientCtx.Keyring.Key("newAccount2") - s.Require().NoError(err) - multisigRecord, err := clientCtx.Keyring.Key("multi") - s.Require().NoError(err) - - addr, err := multisigRecord.GetAddress() - s.Require().NoError(err) - // Send coins from validator to multisig. - sendTokens := sdk.NewInt64Coin(s.cfg.BondDenom, 1000) - _, err = s.createBankMsg( - val, - addr, - sdk.NewCoins(sendTokens), - clitestutil.TestTxConfig{}, - ) - s.Require().NoError(err) - s.Require().NoError(s.network.WaitForNextBlock()) - - tokens := sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, math.NewInt(1))) - msgSend := &banktypes.MsgSend{ - FromAddress: addr.String(), - ToAddress: val.GetAddress().String(), - Amount: tokens, - } - - generatedStd, err := clitestutil.SubmitTestTx( - clientCtx, - msgSend, - addr, - clitestutil.TestTxConfig{ - GenOnly: true, - }, - ) - s.Require().NoError(err) - - // Write the output to disk - filename := testutil.WriteToNewTempFile(s.T(), strings.Repeat(generatedStd.String()+"\n", 3)) - defer filename.Close() - clientCtx.HomeDir = strings.Replace(clientCtx.HomeDir, "simd", "simcli", 1) - - account, err := clientCtx.AccountRetriever.GetAccount(clientCtx, addr) - s.Require().NoError(err) - - // sign-batch file - addr1, err := account1.GetAddress() - s.Require().NoError(err) - res, err := authclitestutil.TxSignBatchExec(clientCtx, addr1, filename.Name(), fmt.Sprintf("--%s=%s", flags.FlagChainID, clientCtx.ChainID), "--multisig", addr.String(), fmt.Sprintf("--%s", flags.FlagOffline), fmt.Sprintf("--%s=%s", flags.FlagAccountNumber, fmt.Sprint(account.GetAccountNumber())), fmt.Sprintf("--%s=%s", flags.FlagSequence, fmt.Sprint(account.GetSequence())), "--signature-only") - s.Require().NoError(err) - s.Require().Equal(3, len(strings.Split(strings.Trim(res.String(), "\n"), "\n"))) - // write sigs to file - file1 := testutil.WriteToNewTempFile(s.T(), res.String()) - defer file1.Close() - - // sign-batch file with account2 - addr2, err := account2.GetAddress() - s.Require().NoError(err) - res, err = authclitestutil.TxSignBatchExec(clientCtx, addr2, filename.Name(), fmt.Sprintf("--%s=%s", flags.FlagChainID, clientCtx.ChainID), "--multisig", addr.String(), fmt.Sprintf("--%s", flags.FlagOffline), fmt.Sprintf("--%s=%s", flags.FlagAccountNumber, fmt.Sprint(account.GetAccountNumber())), fmt.Sprintf("--%s=%s", flags.FlagSequence, fmt.Sprint(account.GetSequence())), "--signature-only") - s.Require().NoError(err) - s.Require().Equal(3, len(strings.Split(strings.Trim(res.String(), "\n"), "\n"))) - - // multisign the file - file2 := testutil.WriteToNewTempFile(s.T(), res.String()) - defer file2.Close() - res, err = authclitestutil.TxMultiSignBatchExec(clientCtx, filename.Name(), multisigRecord.Name, file1.Name(), file2.Name()) - s.Require().NoError(err) - signedTxs := strings.Split(strings.Trim(res.String(), "\n"), "\n") - - // Broadcast transactions. - for _, signedTx := range signedTxs { - func() { - signedTxFile := testutil.WriteToNewTempFile(s.T(), signedTx) - defer signedTxFile.Close() - clientCtx.BroadcastMode = flags.BroadcastSync - _, err = authclitestutil.TxBroadcastExec(clientCtx, signedTxFile.Name()) - s.Require().NoError(err) - s.Require().NoError(s.network.WaitForNextBlock()) - }() - } -} - -func TestGetBroadcastCommandOfflineFlag(t *testing.T) { - cmd := authcli.GetBroadcastCommand() - _ = testutil.ApplyMockIODiscardOutErr(cmd) - cmd.SetArgs([]string{fmt.Sprintf("--%s=true", flags.FlagOffline), ""}) - - require.EqualError(t, cmd.Execute(), "cannot broadcast tx during offline mode") -} - -func TestGetBroadcastCommandWithoutOfflineFlag(t *testing.T) { - var txCfg client.TxConfig - err := depinject.Inject(authtestkeeper.AppConfig, &txCfg) - require.NoError(t, err) - clientCtx := client.Context{} - clientCtx = clientCtx.WithTxConfig(txCfg) - - ctx := context.Background() - ctx = context.WithValue(ctx, client.ClientContextKey, &clientCtx) - - cmd := authcli.GetBroadcastCommand() - _, out := testutil.ApplyMockIO(cmd) - - // Create new file with tx - builder := txCfg.NewTxBuilder() - builder.SetGasLimit(200000) - err = builder.SetMsgs(banktypes.NewMsgSend("cosmos1cxlt8kznps92fwu3j6npahx4mjfutydyene2qw", "cosmos1cxlt8kznps92fwu3j6npahx4mjfutydyene2qw", sdk.Coins{sdk.NewInt64Coin("stake", 10000)})) - require.NoError(t, err) - txContents, err := txCfg.TxJSONEncoder()(builder.GetTx()) - require.NoError(t, err) - txFile := testutil.WriteToNewTempFile(t, string(txContents)) - defer txFile.Close() - - cmd.SetArgs([]string{txFile.Name()}) - err = cmd.ExecuteContext(ctx) - require.Error(t, err) - require.Contains(t, err.Error(), "connect: connection refused") - require.Contains(t, out.String(), "connect: connection refused") -} - -// TestTxWithoutPublicKey makes sure sending a proto tx message without the -// public key doesn't cause any error in the RPC layer (broadcast). -// See https://github.com/cosmos/cosmos-sdk/issues/7585 for more details. -func (s *E2ETestSuite) TestTxWithoutPublicKey() { - val1 := s.network.GetValidators()[0] - clientCtx := val1.GetClientCtx() - txCfg := clientCtx.TxConfig - - // Create a txBuilder with an unsigned tx. - txBuilder := txCfg.NewTxBuilder() - msg := banktypes.NewMsgSend(val1.GetAddress().String(), val1.GetAddress().String(), sdk.NewCoins( - sdk.NewCoin(s.cfg.BondDenom, math.NewInt(10)), - )) - err := txBuilder.SetMsgs(msg) - s.Require().NoError(err) - txBuilder.SetFeeAmount(sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, math.NewInt(150)))) - txBuilder.SetGasLimit(testdata.NewTestGasLimit()) - // Set empty signature to set signer infos. - sigV2 := signing.SignatureV2{ - PubKey: val1.GetPubKey(), - Data: &signing.SingleSignatureData{ - SignMode: signing.SignMode_SIGN_MODE_DIRECT, - Signature: nil, - }, - } - err = txBuilder.SetSignatures(sigV2) - s.Require().NoError(err) - - // Create a file with the unsigned tx. - txJSON, err := txCfg.TxJSONEncoder()(txBuilder.GetTx()) - s.Require().NoError(err) - unsignedTxFile := testutil.WriteToNewTempFile(s.T(), string(txJSON)) - defer unsignedTxFile.Close() - - // Sign the file with the unsignedTx. - signedTx, err := authclitestutil.TxSignExec(clientCtx, val1.GetAddress(), unsignedTxFile.Name(), fmt.Sprintf("--%s=true", cli.FlagOverwrite)) - s.Require().NoError(err) - - // Remove the signerInfo's `public_key` field manually from the signedTx. - // Note: this method is only used for test purposes! In general, one should - // use txBuilder and TxEncoder/TxDecoder to manipulate txs. - var tx tx.Tx - err = clientCtx.Codec.UnmarshalJSON(signedTx.Bytes(), &tx) - s.Require().NoError(err) - tx.AuthInfo.SignerInfos[0].PublicKey = nil - // Re-encode the tx again, to another file. - txJSON, err = clientCtx.Codec.MarshalJSON(&tx) - s.Require().NoError(err) - signedTxFile := testutil.WriteToNewTempFile(s.T(), string(txJSON)) - defer signedTxFile.Close() - s.Require().True(strings.Contains(string(txJSON), "\"public_key\":null")) - - // Broadcast tx, test that it shouldn't panic. - clientCtx.BroadcastMode = flags.BroadcastSync - out, err := authclitestutil.TxBroadcastExec(clientCtx, signedTxFile.Name()) - s.Require().NoError(err) - var res sdk.TxResponse - s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &res)) - s.Require().NotEqual(0, res.Code) -} - -// TestSignWithMultiSignersAminoJSON tests the case where a transaction with 2 -// messages which has to be signed with 2 different keys. Sign and append the -// signatures using the CLI with Amino signing mode. Finally, send the -// transaction to the blockchain. -func (s *E2ETestSuite) TestSignWithMultiSignersAminoJSON() { - require := s.Require() - val0, val1 := s.network.GetValidators()[0], s.network.GetValidators()[1] - val0Coin := sdk.NewCoin(fmt.Sprintf("%stoken", val0.GetMoniker()), math.NewInt(10)) - val1Coin := sdk.NewCoin(fmt.Sprintf("%stoken", val1.GetMoniker()), math.NewInt(10)) - _, _, addr1 := testdata.KeyTestPubAddr() - - // Creating a tx with 2 msgs from 2 signers: val0 and val1. - // The validators need to sign with SIGN_MODE_LEGACY_AMINO_JSON, - // because DIRECT doesn't support multi signers via the CLI. - // Since we use amino, we don't need to pre-populate signer_infos. - txBuilder := val0.GetClientCtx().TxConfig.NewTxBuilder() - val0Str, err := s.ac.BytesToString(val0.GetAddress()) - s.Require().NoError(err) - val1Str, err := s.ac.BytesToString(val1.GetAddress()) - s.Require().NoError(err) - addrStr, err := s.ac.BytesToString(addr1) - s.Require().NoError(err) - err = txBuilder.SetMsgs( - banktypes.NewMsgSend(val0Str, addrStr, sdk.NewCoins(val0Coin)), - banktypes.NewMsgSend(val1Str, addrStr, sdk.NewCoins(val1Coin)), - ) - require.NoError(err) - txBuilder.SetFeeAmount(sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, math.NewInt(10)))) - txBuilder.SetGasLimit(testdata.NewTestGasLimit() * 2) - signers, err := txBuilder.GetTx().GetSigners() - require.NoError(err) - require.Equal([][]byte{val0.GetAddress(), val1.GetAddress()}, signers) - - // Write the unsigned tx into a file. - txJSON, err := val0.GetClientCtx().TxConfig.TxJSONEncoder()(txBuilder.GetTx()) - require.NoError(err) - unsignedTxFile := testutil.WriteToNewTempFile(s.T(), string(txJSON)) - defer unsignedTxFile.Close() - - // Let val0 sign first the file with the unsignedTx. - signedByVal0, err := authclitestutil.TxSignExec(val0.GetClientCtx(), val0.GetAddress(), unsignedTxFile.Name(), "--overwrite", "--sign-mode=amino-json") - require.NoError(err) - signedByVal0File := testutil.WriteToNewTempFile(s.T(), signedByVal0.String()) - defer signedByVal0File.Close() - - // Then let val1 sign the file with signedByVal0. - val1AccNum, val1Seq, err := val0.GetClientCtx().AccountRetriever.GetAccountNumberSequence(val0.GetClientCtx(), val1.GetAddress()) - require.NoError(err) - - signedTx, err := authclitestutil.TxSignExec( - val1.GetClientCtx(), - val1.GetAddress(), - signedByVal0File.Name(), - "--offline", - fmt.Sprintf("--account-number=%d", val1AccNum), - fmt.Sprintf("--sequence=%d", val1Seq), - "--sign-mode=amino-json", - ) - require.NoError(err) - signedTxFile := testutil.WriteToNewTempFile(s.T(), signedTx.String()) - defer signedTxFile.Close() - - res, err := authclitestutil.TxBroadcastExec( - val0.GetClientCtx(), - signedTxFile.Name(), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - ) - require.NoError(err) - require.NoError(s.network.WaitForNextBlock()) - - var txRes sdk.TxResponse - require.NoError(val0.GetClientCtx().Codec.UnmarshalJSON(res.Bytes(), &txRes)) - require.Equal(uint32(0), txRes.Code, txRes.RawLog) - - // Make sure the addr1's balance got funded. - resp, err := testutil.GetRequest(fmt.Sprintf("%s/cosmos/bank/v1beta1/balances/%s", val0.GetAPIAddress(), addr1)) - s.Require().NoError(err) - var queryRes banktypes.QueryAllBalancesResponse - err = val0.GetClientCtx().Codec.UnmarshalJSON(resp, &queryRes) - require.NoError(err) - require.Equal(sdk.NewCoins(val0Coin, val1Coin), queryRes.Balances) -} - -func (s *E2ETestSuite) TestAuxSigner() { - s.T().Skip("re-enable this when we bring back sign mode aux client testing") - require := s.Require() - val := s.network.GetValidators()[0] - val0Coin := sdk.NewCoin(fmt.Sprintf("%stoken", val.GetMoniker()), math.NewInt(10)) - - testCases := []struct { - name string - args []string - expectErr bool - }{ - { - "error with SIGN_MODE_DIRECT_AUX and --aux unset", - []string{ - fmt.Sprintf("--%s=%s", flags.FlagSignMode, flags.SignModeDirectAux), - }, - true, - }, - { - "no error with SIGN_MDOE_DIRECT_AUX mode and generate-only set (ignores generate-only)", - []string{ - fmt.Sprintf("--%s=%s", flags.FlagSignMode, flags.SignModeDirectAux), - fmt.Sprintf("--%s=true", flags.FlagGenerateOnly), - }, - false, - }, - { - "no error with SIGN_MDOE_DIRECT_AUX mode and generate-only, tip flag set", - []string{ - fmt.Sprintf("--%s=%s", flags.FlagSignMode, flags.SignModeDirectAux), - fmt.Sprintf("--%s=true", flags.FlagGenerateOnly), - fmt.Sprintf("--%s=%s", flags.FlagTip, val0Coin.String()), - }, - false, - }, - } - - for _, tc := range testCases { - s.Run(tc.name, func() { - _, err := govtestutil.MsgSubmitLegacyProposal( - val.GetClientCtx(), - val.GetAddress().String(), - "test", - "test desc", - govtypes.ProposalTypeText, - tc.args..., - ) - if tc.expectErr { - require.Error(err) - } else { - require.NoError(err) - } - }) - } -} - -func (s *E2ETestSuite) TestAuxToFeeWithTips() { - // Skipping this test as it needs a simapp with the TipDecorator in post handler. - s.T().Skip() - - require := s.Require() - val := s.network.GetValidators()[0] - - kb := s.network.GetValidators()[0].GetClientCtx().Keyring - acc, _, err := kb.NewMnemonic("tipperAccount", keyring.English, sdk.FullFundraiserPath, keyring.DefaultBIP39Passphrase, hd.Secp256k1) - require.NoError(err) - - tipper, err := acc.GetAddress() - require.NoError(err) - tipperInitialBal := sdk.NewCoin(fmt.Sprintf("%stoken", val.GetMoniker()), math.NewInt(10000)) - - feePayer := val.GetAddress() - fee := sdk.NewCoin(s.cfg.BondDenom, math.NewInt(1000)) - tip := sdk.NewCoin(fmt.Sprintf("%stoken", val.GetMoniker()), math.NewInt(1000)) - - require.NoError(s.network.WaitForNextBlock()) - _, err = s.createBankMsg( - val, - tipper, - sdk.NewCoins(tipperInitialBal), - clitestutil.TestTxConfig{}, - ) - require.NoError(err) - require.NoError(s.network.WaitForNextBlock()) - - bal := s.getBalances(val.GetClientCtx(), tipper, tip.Denom) - require.True(bal.Equal(tipperInitialBal.Amount)) - - testCases := []struct { - name string - tipper sdk.AccAddress - feePayer sdk.AccAddress - tip sdk.Coin - expectErrAux bool - expectErrBroadCast bool - errMsg string - tipperArgs []string - feePayerArgs []string - }{ - { - name: "when --aux and --sign-mode = direct set: error", - tipper: tipper, - feePayer: feePayer, - tip: tip, - tipperArgs: []string{ - fmt.Sprintf("--%s=%s", flags.FlagSignMode, flags.SignModeDirect), - fmt.Sprintf("--%s=%s", flags.FlagTip, tip), - fmt.Sprintf("--%s=true", flags.FlagAux), - }, - expectErrAux: true, - feePayerArgs: []string{ - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFrom, feePayer), - fmt.Sprintf("--%s=%s", flags.FlagFees, fee.String()), - }, - }, - { - name: "both tipper, fee payer uses AMINO: no error", - tipper: tipper, - feePayer: feePayer, - tip: tip, - tipperArgs: []string{ - fmt.Sprintf("--%s=%s", flags.FlagSignMode, flags.SignModeLegacyAminoJSON), - fmt.Sprintf("--%s=%s", flags.FlagTip, tip), - fmt.Sprintf("--%s=true", flags.FlagAux), - }, - feePayerArgs: []string{ - fmt.Sprintf("--%s=%s", flags.FlagSignMode, flags.SignModeLegacyAminoJSON), - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFrom, feePayer), - fmt.Sprintf("--%s=%s", flags.FlagFees, fee.String()), - }, - }, - { - name: "tipper uses DIRECT_AUX, fee payer uses AMINO: no error", - tipper: tipper, - feePayer: feePayer, - tip: tip, - tipperArgs: []string{ - fmt.Sprintf("--%s=%s", flags.FlagSignMode, flags.SignModeDirectAux), - fmt.Sprintf("--%s=%s", flags.FlagTip, tip), - fmt.Sprintf("--%s=true", flags.FlagAux), - }, - feePayerArgs: []string{ - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagSignMode, flags.SignModeLegacyAminoJSON), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFrom, feePayer), - fmt.Sprintf("--%s=%s", flags.FlagFees, fee.String()), - }, - }, - { - name: "--tip flag unset: no error", - tipper: tipper, - feePayer: feePayer, - tip: sdk.Coin{Denom: fmt.Sprintf("%stoken", val.GetMoniker()), Amount: math.NewInt(0)}, - tipperArgs: []string{ - fmt.Sprintf("--%s=%s", flags.FlagSignMode, flags.SignModeDirectAux), - fmt.Sprintf("--%s=true", flags.FlagAux), - }, - feePayerArgs: []string{ - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagSignMode, flags.SignModeLegacyAminoJSON), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFrom, feePayer), - fmt.Sprintf("--%s=%s", flags.FlagFees, fee.String()), - }, - }, - { - name: "legacy amino json: no error", - tipper: tipper, - feePayer: feePayer, - tip: tip, - tipperArgs: []string{ - fmt.Sprintf("--%s=%s", flags.FlagSignMode, flags.SignModeLegacyAminoJSON), - fmt.Sprintf("--%s=%s", flags.FlagTip, tip), - fmt.Sprintf("--%s=true", flags.FlagAux), - }, - feePayerArgs: []string{ - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFrom, feePayer), - fmt.Sprintf("--%s=%s", flags.FlagFees, fee.String()), - }, - }, - { - name: "tipper uses direct aux, fee payer uses direct: happy case", - tipper: tipper, - feePayer: feePayer, - tip: tip, - tipperArgs: []string{ - fmt.Sprintf("--%s=%s", flags.FlagSignMode, flags.SignModeDirectAux), - fmt.Sprintf("--%s=%s", flags.FlagTip, tip), - fmt.Sprintf("--%s=true", flags.FlagAux), - }, - feePayerArgs: []string{ - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFrom, feePayer), - fmt.Sprintf("--%s=%s", flags.FlagFees, fee.String()), - }, - }, - { - name: "chain-id mismatch: error", - tipper: tipper, - feePayer: feePayer, - tip: tip, - tipperArgs: []string{ - fmt.Sprintf("--%s=%s", flags.FlagSignMode, flags.SignModeDirectAux), - fmt.Sprintf("--%s=%s", flags.FlagTip, tip), - fmt.Sprintf("--%s=true", flags.FlagAux), - }, - expectErrAux: false, - feePayerArgs: []string{ - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFrom, feePayer), - fmt.Sprintf("--%s=%s", flags.FlagFees, fee.String()), - fmt.Sprintf("--%s=%s", flags.FlagChainID, "foobar"), - }, - expectErrBroadCast: true, - }, - { - name: "wrong denom in tip: error", - tipper: tipper, - feePayer: feePayer, - tip: sdk.Coin{Denom: fmt.Sprintf("%stoken", val.GetMoniker()), Amount: math.NewInt(0)}, - tipperArgs: []string{ - fmt.Sprintf("--%s=%s", flags.FlagTip, "1000wrongDenom"), - fmt.Sprintf("--%s=%s", flags.FlagSignMode, flags.SignModeDirectAux), - fmt.Sprintf("--%s=true", flags.FlagAux), - }, - feePayerArgs: []string{ - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagSignMode, flags.SignModeDirect), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFrom, feePayer), - fmt.Sprintf("--%s=%s", flags.FlagFees, fee.String()), - }, - errMsg: "insufficient funds", - }, - { - name: "insufficient fees: error", - tipper: tipper, - feePayer: feePayer, - tip: sdk.Coin{Denom: fmt.Sprintf("%stoken", val.GetMoniker()), Amount: math.NewInt(0)}, - tipperArgs: []string{ - fmt.Sprintf("--%s=%s", flags.FlagTip, tip), - fmt.Sprintf("--%s=%s", flags.FlagSignMode, flags.SignModeDirectAux), - fmt.Sprintf("--%s=true", flags.FlagAux), - }, - feePayerArgs: []string{ - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagSignMode, flags.SignModeDirect), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFrom, feePayer), - }, - errMsg: "insufficient fees", - }, - } - - for _, tc := range testCases { - s.Run(tc.name, func() { - res, err := govtestutil.MsgSubmitLegacyProposal( - val.GetClientCtx(), - tipper.String(), - "test", - "test desc", - govtypes.ProposalTypeText, - tc.tipperArgs..., - ) - - if tc.expectErrAux { - require.Error(err) - } else { - require.NoError(err) - genTxFile := testutil.WriteToNewTempFile(s.T(), string(res.Bytes())) - defer genTxFile.Close() - - s.Require().NoError(s.network.WaitForNextBlock()) - - switch { - case tc.expectErrBroadCast: - require.Error(err) - - case tc.errMsg != "": - require.NoError(err) - - var txRes sdk.TxResponse - require.NoError(val.GetClientCtx().Codec.UnmarshalJSON(res.Bytes(), &txRes)) - - require.Contains(txRes.RawLog, tc.errMsg) - - default: - require.NoError(err) - - var txRes sdk.TxResponse - require.NoError(val.GetClientCtx().Codec.UnmarshalJSON(res.Bytes(), &txRes)) - - require.Equal(uint32(0), txRes.Code) - require.NotNil(int64(0), txRes.Height) - - bal = s.getBalances(val.GetClientCtx(), tipper, tc.tip.Denom) - tipperInitialBal = tipperInitialBal.Sub(tc.tip) - require.True(bal.Equal(tipperInitialBal.Amount)) - } - } - }) - } -} - -func (s *E2ETestSuite) createBankMsg(val network.ValidatorI, toAddr sdk.AccAddress, amount sdk.Coins, config clitestutil.TestTxConfig) (testutil.BufferWriter, error) { - msgSend := &banktypes.MsgSend{ - FromAddress: val.GetAddress().String(), - ToAddress: toAddr.String(), - Amount: amount, - } - - return clitestutil.SubmitTestTx(val.GetClientCtx(), msgSend, val.GetAddress(), config) -} - -func (s *E2ETestSuite) getBalances(clientCtx client.Context, addr sdk.AccAddress, denom string) math.Int { - resp, err := testutil.GetRequest(fmt.Sprintf("%s/cosmos/bank/v1beta1/balances/%s/by_denom?denom=%s", s.cfg.APIAddress, addr.String(), denom)) - s.Require().NoError(err) - - var balRes banktypes.QueryAllBalancesResponse - err = clientCtx.Codec.UnmarshalJSON(resp, &balRes) - s.Require().NoError(err) - startTokens := balRes.Balances.AmountOf(denom) - return startTokens -} - -func (s *E2ETestSuite) deepContains(events []abci.Event, value string) bool { - for _, e := range events { - for _, attr := range e.Attributes { - if strings.Contains(attr.Value, value) { - return true - } - } - } - return false -} diff --git a/tests/systemtests/auth_test.go b/tests/systemtests/auth_test.go new file mode 100644 index 000000000000..c45652f3cf8a --- /dev/null +++ b/tests/systemtests/auth_test.go @@ -0,0 +1,508 @@ +//go:build system_test + +package systemtests + +import ( + "fmt" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/tidwall/gjson" + "github.com/tidwall/sjson" +) + +const ( + authTestDenom = "stake" +) + +func TestAuthSignAndBroadcastTxCmd(t *testing.T) { + // scenario: test auth sign and broadcast commands + // given a running chain + + sut.ResetChain(t) + require.GreaterOrEqual(t, sut.NodesCount(), 2) + + cli := NewCLIWrapper(t, sut, verbose) + + // get validator addresses + val1Addr := cli.GetKeyAddr("node0") + require.NotEmpty(t, val1Addr) + + val2Addr := cli.GetKeyAddr("node1") + require.NotEmpty(t, val2Addr) + + sut.StartChain(t) + + var transferAmount, feeAmount int64 = 1000, 1 + + // test sign tx command + + // run bank tx send with --generate-only flag + sendTx := generateBankSendTx(t, cli, val1Addr, val2Addr, transferAmount, feeAmount, "") + txFile := StoreTempFile(t, []byte(fmt.Sprintf("%s\n", sendTx))) + + // query node0 account details + signTxCmd := []string{"tx", "sign", txFile.Name(), "--from=" + val1Addr, "--chain-id=" + cli.chainID} + testSignTxBroadcast(t, cli, signTxCmd, "sign tx", val1Addr, val2Addr, transferAmount, feeAmount) + + // test broadcast with empty public key in signed tx + rsp := cli.RunCommandWithArgs(cli.withTXFlags("tx", "sign", txFile.Name(), "--from="+val1Addr)...) + updated, err := sjson.Set(rsp, "auth_info.signer_infos.0.public_key", nil) + require.NoError(t, err) + newSignFile := StoreTempFile(t, []byte(updated)) + + broadcastCmd := []string{"tx", "broadcast", newSignFile.Name()} + rsp = cli.RunCommandWithArgs(cli.withTXFlags(broadcastCmd...)...) + RequireTxFailure(t, rsp) + + // test sign-batch tx command + + // generate another bank send tx with less amount + newAmount := int64(100) + sendTx2 := generateBankSendTx(t, cli, val1Addr, val2Addr, newAmount, feeAmount, "") + tx2File := StoreTempFile(t, []byte(fmt.Sprintf("%s\n", sendTx2))) + + signBatchCmd := []string{"tx", "sign-batch", txFile.Name(), tx2File.Name(), "--from=" + val1Addr, "--chain-id=" + cli.chainID} + sendAmount := transferAmount + newAmount + fees := feeAmount * 2 + + // TODO: remove below block code once v2 supports multi messages + // ref: https://github.com/cosmos/cosmos-sdk/issues/22215 + if isV2() { + sendAmount = transferAmount + fees = feeAmount + } + + testSignTxBroadcast(t, cli, signBatchCmd, "sign-batch tx", val1Addr, val2Addr, sendAmount, fees) +} + +func testSignTxBroadcast(t *testing.T, cli *CLIWrapper, txCmd []string, prefix, fromAddr, toAddr string, amount, fees int64) { + t.Helper() + + fromAddrBal := cli.QueryBalance(fromAddr, authTestDenom) + toAddrBal := cli.QueryBalance(toAddr, authTestDenom) + + // query from account details + rsp := cli.CustomQuery("q", "auth", "accounts") + details := gjson.Get(rsp, fmt.Sprintf("accounts.#(value.address==%s).value", fromAddr)).String() + accSeq := gjson.Get(details, "sequence").Int() + accNum := gjson.Get(details, "account_number").Int() + + testCases := []struct { + name string + extraArgs []string + }{ + { + "valid tx sign with offline mode", + []string{ + "--offline", + fmt.Sprintf("--account-number=%d", accNum), + fmt.Sprintf("--sequence=%d", accSeq), + }, + }, + { + "valid tx sign", + []string{}, + }, + { + "valid tx sign with sign-mode", + []string{"--sign-mode=amino-json"}, + }, + } + + for _, tc := range testCases { + t.Run(prefix+"-"+tc.name, func(t *testing.T) { + cmd := append(txCmd, tc.extraArgs...) + + // run tx sign command and verify signatures count + rsp = cli.RunCommandWithArgs(cli.withKeyringFlags(cmd...)...) + + signatures := gjson.Get(rsp, "signatures").Array() + require.Len(t, signatures, 1) + + signFile := StoreTempFile(t, []byte(rsp)) + + // validate signature + rsp = cli.RunCommandWithArgs(cli.withKeyringFlags("tx", "validate-signatures", signFile.Name(), "--from="+fromAddr, "--chain-id="+cli.chainID)...) + require.Contains(t, rsp, "[OK]") + + // run broadcast tx command + broadcastCmd := []string{"tx", "broadcast", signFile.Name()} + rsp = cli.RunAndWait(broadcastCmd...) + RequireTxSuccess(t, rsp) + + // query balance and confirm transaction + expVal1Bal := fromAddrBal - amount - fees + fromAddrBal = cli.QueryBalance(fromAddr, authTestDenom) + require.Equal(t, expVal1Bal, fromAddrBal) + + expVal2Bal := toAddrBal + amount + toAddrBal = cli.QueryBalance(toAddr, authTestDenom) + require.Equal(t, expVal2Bal, toAddrBal) + }) + } +} + +func TestAuthQueryTxCmds(t *testing.T) { + // scenario: test query tx and txs commands + // given a running chain + + sut.ResetChain(t) + require.GreaterOrEqual(t, sut.NodesCount(), 2) + + cli := NewCLIWrapper(t, sut, verbose) + + // get validator addresses + val1Addr := cli.GetKeyAddr("node0") + require.NotEmpty(t, val1Addr) + + val2Addr := cli.GetKeyAddr("node1") + require.NotEmpty(t, val2Addr) + + sut.StartChain(t) + + // do a bank transfer and use it for query txs + feeAmount := "2stake" + rsp := cli.RunAndWait("tx", "bank", "send", val1Addr, val2Addr, "10000stake", "--fees="+feeAmount) + RequireTxSuccess(t, rsp) + + // parse values from above tx + height := gjson.Get(rsp, "height").String() + txHash := gjson.Get(rsp, "txhash").String() + accSeq := fmt.Sprintf("%s/%d", val1Addr, gjson.Get(rsp, "tx.auth_info.signer_infos.0.sequence").Int()) + signature := gjson.Get(rsp, "tx.signatures.0").String() + + // test query tx command + testCases := []struct { + name string + args []string + }{ + { + "valid query with txhash", + []string{txHash}, + }, + { + "valid query with addr+seq filter", + []string{"--type=acc_seq", accSeq}, + }, + { + "valid query with signature filter", + []string{"--type=signature", signature}, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + cmd := []string{"q", "tx"} + rsp = cli.CustomQuery(append(cmd, tc.args...)...) + txHeight := gjson.Get(rsp, "height").String() + require.Equal(t, height, txHeight) + }) + } + + // test query txs command + txsTestCases := []struct { + name string + query string + expLen int + }{ + { + "fee event happy case", + fmt.Sprintf("--query=tx.fee='%s'", feeAmount), + 1, + }, + { + "no matching fee event", + "--query=tx.fee='120stake'", + 0, + }, + { + "query with tx height", + fmt.Sprintf("--query=tx.height='%s'", height), + 1, + }, + } + + for _, tc := range txsTestCases { + t.Run(tc.name, func(t *testing.T) { + cmd := []string{"q", "txs", tc.query} + rsp = cli.CustomQuery(cmd...) + txs := gjson.Get(rsp, "txs").Array() + require.Equal(t, tc.expLen, len(txs)) + }) + } +} + +func TestAuthMultisigTxCmds(t *testing.T) { + // scenario: test auth multisig related tx commands + // given a running chain + + sut.ResetChain(t) + cli := NewCLIWrapper(t, sut, verbose) + + // get validator address + valAddr := cli.GetKeyAddr("node0") + require.NotEmpty(t, valAddr) + + // add new keys for multisig + acc1Addr := cli.AddKey("acc1") + require.NotEmpty(t, acc1Addr) + + acc2Addr := cli.AddKey("acc2") + require.NotEqual(t, acc1Addr, acc2Addr) + + acc3Addr := cli.AddKey("acc3") + require.NotEqual(t, acc1Addr, acc3Addr) + + out := cli.RunCommandWithArgs(cli.withKeyringFlags("keys", "add", "multi", "--multisig=acc1,acc2,acc3", "--multisig-threshold=2")...) + multiAddr := gjson.Get(out, "address").String() + require.NotEmpty(t, multiAddr) + + sut.StartChain(t) + + // fund multisig address some amount + var initialAmount, transferAmount, feeAmount int64 = 10000, 100, 1 + _ = cli.FundAddress(multiAddr, fmt.Sprintf("%d%s", initialAmount, authTestDenom)) + + multiAddrBal := cli.QueryBalance(multiAddr, authTestDenom) + require.Equal(t, initialAmount, multiAddrBal) + + // test multisign tx command + + // run bank tx send with --generate-only flag + sendTx := generateBankSendTx(t, cli, multiAddr, valAddr, transferAmount, feeAmount, "") + txFile := StoreTempFile(t, []byte(sendTx)) + + signTxCmd := cli.withKeyringFlags("tx", "sign", txFile.Name(), "--multisig="+multiAddr, "--chain-id="+cli.chainID) + multiSignTxCmd := cli.withKeyringFlags("tx", "multisign", txFile.Name(), "multi", "--chain-id="+cli.chainID) + + testMultisigTxBroadcast(t, cli, multiSigTxInput{ + "multisign", + multiAddr, + valAddr, + acc1Addr, + acc2Addr, + acc3Addr, + signTxCmd, + multiSignTxCmd, + transferAmount, + feeAmount, + }) + + // test multisign-batch tx command + + // generate two send transactions in single file + multiSendTx := fmt.Sprintf("%s\n%s", sendTx, sendTx) + multiTxFile := StoreTempFile(t, []byte(multiSendTx)) + + signBatchTxCmd := cli.withKeyringFlags("tx", "sign-batch", multiTxFile.Name(), "--multisig="+multiAddr, "--signature-only", "--chain-id="+cli.chainID) + multiSignBatchTxCmd := cli.withKeyringFlags("tx", "multisign-batch", multiTxFile.Name(), "multi", "--chain-id="+cli.chainID) + + // as we done couple of bank transactions as batch, + // transferred amount will be twice + sendAmount := transferAmount * 2 + fees := feeAmount * 2 + + // TODO: remove below block code once v2 supports multi messages + // ref: https://github.com/cosmos/cosmos-sdk/issues/22215 + if isV2() { + sendAmount = transferAmount + fees = feeAmount + } + + testMultisigTxBroadcast(t, cli, multiSigTxInput{ + "multisign-batch", + multiAddr, + valAddr, + acc1Addr, + acc2Addr, + acc3Addr, + signBatchTxCmd, + multiSignBatchTxCmd, + sendAmount, + fees, + }) +} + +func generateBankSendTx(t *testing.T, cli *CLIWrapper, fromAddr, toAddr string, amount, fees int64, memo string) string { + t.Helper() + + bankSendGenCmd := []string{ + "tx", "bank", "send", fromAddr, toAddr, + fmt.Sprintf("%d%s", amount, authTestDenom), + fmt.Sprintf("--fees=%d%s", fees, authTestDenom), + "--generate-only", + "--note=" + memo, + } + + return cli.RunCommandWithArgs(cli.withTXFlags(bankSendGenCmd...)...) +} + +type multiSigTxInput struct { + prefix string + multiAddr string + toAddr string + acc1Addr string + acc2Addr string + acc3Addr string + signCmd []string + multiSignCmd []string + transferAmount int64 + feeAmount int64 +} + +func testMultisigTxBroadcast(t *testing.T, cli *CLIWrapper, i multiSigTxInput) { + t.Helper() + + multiAddrBal := cli.QueryBalance(i.multiAddr, authTestDenom) + toAddrBal := cli.QueryBalance(i.toAddr, authTestDenom) + + testCases := []struct { + name string + signingAccs []string + expErrMsg string + }{ + { + "minimum threshold not reached", + []string{i.acc1Addr}, + "signature size is incorrect", + }, + { + "valid tx with two signers", + []string{i.acc1Addr, i.acc2Addr}, + "", + }, + { + "valid tx with three signed files", + []string{i.acc1Addr, i.acc2Addr, i.acc3Addr}, + "", + }, + } + + for _, tc := range testCases { + t.Run(i.prefix+"-"+tc.name, func(t *testing.T) { + // append signed files to multisign command + cmd := i.multiSignCmd + for _, acc := range tc.signingAccs { + rsp := cli.RunCommandWithArgs(append(i.signCmd, "--from="+acc)...) + signFile := StoreTempFile(t, []byte(rsp)) + cmd = append(cmd, signFile.Name()) + } + rsp := cli.RunCommandWithArgs(cmd...) + multiSignFile := StoreTempFile(t, []byte(rsp)) + + // run broadcast tx command + broadcastCmd := []string{"tx", "broadcast", multiSignFile.Name()} + if tc.expErrMsg != "" { + rsp = cli.RunCommandWithArgs(cli.withTXFlags(broadcastCmd...)...) + RequireTxFailure(t, rsp) + require.Contains(t, rsp, tc.expErrMsg) + return + } + + rsp = cli.RunAndWait(broadcastCmd...) + RequireTxSuccess(t, rsp) + + // query balance and confirm transaction + expMultiBal := multiAddrBal - i.transferAmount - i.feeAmount + multiAddrBal = cli.QueryBalance(i.multiAddr, authTestDenom) + require.Equal(t, expMultiBal, multiAddrBal) + + expVal2Bal := toAddrBal + i.transferAmount + toAddrBal = cli.QueryBalance(i.toAddr, authTestDenom) + require.Equal(t, expVal2Bal, toAddrBal) + }) + } +} + +func TestAuxSigner(t *testing.T) { + // scenario: test tx with direct aux sign mode + // given a running chain + + sut.ResetChain(t) + require.GreaterOrEqual(t, sut.NodesCount(), 2) + + cli := NewCLIWrapper(t, sut, verbose) + + // get validator addresses + val1Addr := cli.GetKeyAddr("node0") + require.NotEmpty(t, val1Addr) + + val2Addr := cli.GetKeyAddr("node1") + require.NotEmpty(t, val2Addr) + + sut.StartChain(t) + + bankSendCmd := []string{"tx", "bank", "send", val1Addr, val2Addr, "10000stake", "--from=" + val1Addr} + + testCases := []struct { + name string + args []string + expErrMsg string + }{ + { + "error with SIGN_MODE_DIRECT_AUX and --aux unset", + []string{ + "--sign-mode=direct-aux", + }, + "cannot sign with SIGN_MODE_DIRECT_AUX", + }, + { + "no error with SIGN_MDOE_DIRECT_AUX mode and generate-only set (ignores generate-only)", + []string{ + "--sign-mode=direct-aux", + "--generate-only", + }, + "", + }, + { + "no error with SIGN_MDOE_DIRECT_AUX mode and generate-only, tip flag set", + []string{ + "--sign-mode=direct-aux", + "--generate-only", + "--tip=10stake", + }, + "", + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + cmd := append(bankSendCmd, tc.args...) + assertTxOutput := func(_ assert.TestingT, gotErr error, gotOutputs ...interface{}) bool { + require.Len(t, gotOutputs, 1) + output := gotOutputs[0].(string) + if tc.expErrMsg != "" { + require.Contains(t, output, tc.expErrMsg) + } else { + require.Len(t, gjson.Get(output, "body.messages").Array(), 1) + } + return false + } + + _ = cli.WithRunErrorMatcher(assertTxOutput).Run(cli.withTXFlags(cmd...)...) + }) + } +} + +func TestTxEncodeandDecode(t *testing.T) { + // scenario: test tx encode and decode commands + + cli := NewCLIWrapper(t, sut, verbose) + + // get validator address + val1Addr := cli.GetKeyAddr("node0") + require.NotEmpty(t, val1Addr) + + memoText := "testmemo" + sendTx := generateBankSendTx(t, cli, val1Addr, val1Addr, 100, 1, memoText) + txFile := StoreTempFile(t, []byte(sendTx)) + + // run encode command + encodedText := cli.RunCommandWithArgs("tx", "encode", txFile.Name()) + + // check transaction decodes as expected + decodedTx := cli.RunCommandWithArgs("tx", "decode", encodedText) + require.Equal(t, gjson.Get(decodedTx, "body.memo").String(), memoText) +} diff --git a/tests/systemtests/cli.go b/tests/systemtests/cli.go index d7ac2368ae79..6c8dffc4bbd5 100644 --- a/tests/systemtests/cli.go +++ b/tests/systemtests/cli.go @@ -1,8 +1,6 @@ package systemtests import ( - "bufio" - "bytes" "fmt" "io" "os" @@ -243,26 +241,10 @@ func (c CLIWrapper) runWithInput(args []string, input io.Reader) (output string, cmd.Stdin = input return cmd.CombinedOutput() }() - gotOut = filterProtoNoise(gotOut) ok = c.assertErrorFn(c.t, gotErr, string(gotOut)) return strings.TrimSpace(string(gotOut)), ok } -func filterProtoNoise(in []byte) []byte { - // temporary hack to get rid of all the noise on the stderr - var out bytes.Buffer - scanner := bufio.NewScanner(bytes.NewReader(in)) - for scanner.Scan() { - if !strings.Contains(scanner.Text(), " proto: duplicate proto type registered") { - _, _ = out.Write(scanner.Bytes()) - } - } - if err := scanner.Err(); err != nil { - panic(err) - } - return out.Bytes() -} - func (c CLIWrapper) withQueryFlags(args ...string) []string { args = append(args, "--output", "json") return c.withChainFlags(args...) diff --git a/tests/systemtests/distribution_test.go b/tests/systemtests/distribution_test.go index 6d8eaf2ae0c0..e074b89e7cf3 100644 --- a/tests/systemtests/distribution_test.go +++ b/tests/systemtests/distribution_test.go @@ -89,8 +89,8 @@ func TestWithdrawAllRewardsCmd(t *testing.T) { t.Run(tc.name, func(t *testing.T) { assertGenOnlyOutput := func(_ assert.TestingT, gotErr error, gotOutputs ...interface{}) bool { require.Len(t, gotOutputs, 1) - // gets output combining two objects without any space or new line - splitOutput := strings.Split(gotOutputs[0].(string), "}{") + // split txs with new line + splitOutput := strings.Split(strings.Trim(gotOutputs[0].(string), "\n"), "\n") require.Len(t, splitOutput, tc.expTxLen) return false } diff --git a/x/auth/client/cli/tx_sign.go b/x/auth/client/cli/tx_sign.go index 07d8f5330f41..bf0fb453d102 100644 --- a/x/auth/client/cli/tx_sign.go +++ b/x/auth/client/cli/tx_sign.go @@ -98,12 +98,16 @@ func makeSignBatchCmd() func(cmd *cobra.Command, args []string) error { return err } - if !clientCtx.Offline && multisigKey == "" { + if !clientCtx.Offline { from, err := cmd.Flags().GetString(flags.FlagFrom) if err != nil { return err } + if multisigKey != "" { + from = multisigKey + } + fromAddr, _, _, err := client.GetFromFields(clientCtx, txFactory.Keybase(), from) if err != nil { return err @@ -267,7 +271,7 @@ func multisigSign(clientCtx client.Context, txBuilder client.TxBuilder, txFactor multisigAddr, clientCtx.FromName, txBuilder, - clientCtx.Offline, + true, true, ); err != nil { return err From 65ed5eb8007fe3d3c5f74a89bdbdd4c71d2eee65 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Fri, 11 Oct 2024 22:44:12 +0200 Subject: [PATCH 30/57] refactor(core): structural typing for kvstore (#22242) --- core/store/store.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/store/store.go b/core/store/store.go index 164bcca6112e..5c50855e2b7b 100644 --- a/core/store/store.go +++ b/core/store/store.go @@ -1,7 +1,7 @@ package store // KVStore describes the basic interface for interacting with key-value stores. -type KVStore interface { +type KVStore = interface { // Get returns nil iff key doesn't exist. Errors on nil key. Get(key []byte) ([]byte, error) From 1f941bbec73ea22487db0c8ed28d583e9c5d61b9 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Mon, 14 Oct 2024 08:05:47 +0200 Subject: [PATCH 31/57] fix(server/v2): use only one logger for app and server (#22241) --- server/v2/commands.go | 8 ++--- server/v2/server.go | 9 +++--- server/v2/server_test.go | 7 +++-- server/v2/util.go | 52 +++++++++++++++++++++----------- simapp/v2/simdv2/cmd/commands.go | 8 +---- simapp/v2/simdv2/cmd/config.go | 2 +- simapp/v2/simdv2/cmd/testnet.go | 3 +- 7 files changed, 50 insertions(+), 39 deletions(-) diff --git a/server/v2/commands.go b/server/v2/commands.go index 0357fe180d93..86f8e400467c 100644 --- a/server/v2/commands.go +++ b/server/v2/commands.go @@ -13,7 +13,6 @@ import ( "github.com/spf13/viper" "cosmossdk.io/core/transaction" - "cosmossdk.io/log" ) // Execute executes the root command of an application. @@ -37,7 +36,6 @@ func Execute(rootCmd *cobra.Command, envPrefix, defaultHome string) error { func AddCommands[T transaction.Tx]( rootCmd *cobra.Command, newApp AppCreator[T], - logger log.Logger, globalServerCfg ServerConfig, components ...ServerComponent[T], ) error { @@ -45,7 +43,7 @@ func AddCommands[T transaction.Tx]( return errors.New("no components provided") } - server := NewServer(logger, globalServerCfg, components...) + server := NewServer(globalServerCfg, components...) originalPersistentPreRunE := rootCmd.PersistentPreRunE rootCmd.PersistentPreRunE = func(cmd *cobra.Command, args []string) error { // set the default command outputs @@ -170,12 +168,12 @@ func configHandle[T transaction.Tx](s *Server[T], cmd *cobra.Command) error { return err } - log, err := NewLogger(v, cmd.OutOrStdout()) + logger, err := NewLogger(v, cmd.OutOrStdout()) if err != nil { return err } - return SetCmdServerContext(cmd, v, log) + return SetCmdServerContext(cmd, v, logger) } // findSubCommand finds a sub-command of the provided command whose Use diff --git a/server/v2/server.go b/server/v2/server.go index a628fbdf1000..486f5c0ceecb 100644 --- a/server/v2/server.go +++ b/server/v2/server.go @@ -63,18 +63,15 @@ var _ ServerComponent[transaction.Tx] = (*Server[transaction.Tx])(nil) // Server is the top-level server component which contains all other server components. type Server[T transaction.Tx] struct { - logger log.Logger components []ServerComponent[T] config ServerConfig } func NewServer[T transaction.Tx]( - logger log.Logger, config ServerConfig, components ...ServerComponent[T], ) *Server[T] { return &Server[T]{ - logger: logger, config: config, components: components, } @@ -86,7 +83,8 @@ func (s *Server[T]) Name() string { // Start starts all components concurrently. func (s *Server[T]) Start(ctx context.Context) error { - s.logger.Info("starting servers...") + logger := GetLoggerFromContext(ctx) + logger.With(log.ModuleKey, s.Name()).Info("starting servers...") g, ctx := errgroup.WithContext(ctx) for _, mod := range s.components { @@ -106,7 +104,8 @@ func (s *Server[T]) Start(ctx context.Context) error { // Stop stops all components concurrently. func (s *Server[T]) Stop(ctx context.Context) error { - s.logger.Info("stopping servers...") + logger := GetLoggerFromContext(ctx) + logger.With(log.ModuleKey, s.Name()).Info("stopping servers...") g, ctx := errgroup.WithContext(ctx) for _, mod := range s.components { diff --git a/server/v2/server_test.go b/server/v2/server_test.go index b67fd209e1bd..c35dea1fc627 100644 --- a/server/v2/server_test.go +++ b/server/v2/server_test.go @@ -65,6 +65,10 @@ func TestServer(t *testing.T) { cfg := v.AllSettings() logger := log.NewLogger(os.Stdout) + + ctx, err := serverv2.SetServerContext(context.Background(), v, logger) + require.NoError(t, err) + grpcServer := grpc.New[transaction.Tx]() err = grpcServer.Init(&mockApp[transaction.Tx]{}, cfg, logger) require.NoError(t, err) @@ -76,7 +80,6 @@ func TestServer(t *testing.T) { mockServer := &mockServer{name: "mock-server-1", ch: make(chan string, 100)} server := serverv2.NewServer( - logger, serverv2.DefaultServerConfig(), grpcServer, storeServer, @@ -97,7 +100,7 @@ func TestServer(t *testing.T) { require.Equal(t, v.GetString(grpcServer.Name()+".address"), grpc.DefaultConfig().Address) // start empty - ctx, cancelFn := context.WithCancel(context.TODO()) + ctx, cancelFn := context.WithCancel(ctx) go func() { // wait 5sec and cancel context <-time.After(5 * time.Second) diff --git a/server/v2/util.go b/server/v2/util.go index 72335621b44b..d02ea30125e5 100644 --- a/server/v2/util.go +++ b/server/v2/util.go @@ -13,44 +13,62 @@ import ( "cosmossdk.io/log" ) +// SetServerContext sets the logger and viper in the context. +// The server manager expects the logger and viper to be set in the context. +func SetServerContext(ctx context.Context, viper *viper.Viper, logger log.Logger) (context.Context, error) { + if ctx == nil { + ctx = context.Background() + } + + ctx = context.WithValue(ctx, corectx.LoggerContextKey, logger) + ctx = context.WithValue(ctx, corectx.ViperContextKey, viper) + return ctx, nil +} + // SetCmdServerContext sets a command's Context value to the provided argument. +// The server manager expects the logger and viper to be set in the context. // If the context has not been set, set the given context as the default. func SetCmdServerContext(cmd *cobra.Command, viper *viper.Viper, logger log.Logger) error { - var cmdCtx context.Context - if cmd.Context() == nil { - cmdCtx = context.Background() - } else { - cmdCtx = cmd.Context() + ctx, err := SetServerContext(cmd.Context(), viper, logger) + if err != nil { + return err } - - cmdCtx = context.WithValue(cmdCtx, corectx.LoggerContextKey, logger) - cmdCtx = context.WithValue(cmdCtx, corectx.ViperContextKey, viper) - cmd.SetContext(cmdCtx) - + cmd.SetContext(ctx) return nil } -func GetViperFromCmd(cmd *cobra.Command) *viper.Viper { - value := cmd.Context().Value(corectx.ViperContextKey) +// GetViperFromContext returns the viper instance from the context. +func GetViperFromContext(ctx context.Context) *viper.Viper { + value := ctx.Value(corectx.ViperContextKey) v, ok := value.(*viper.Viper) if !ok { - panic(fmt.Sprintf("incorrect viper type %T: expected *viper.Viper. Have you forgot to set the viper in the command context?", value)) + panic(fmt.Sprintf("incorrect viper type %T: expected *viper.Viper. Have you forgot to set the viper in the context?", value)) } return v } -func GetLoggerFromCmd(cmd *cobra.Command) log.Logger { - v := cmd.Context().Value(corectx.LoggerContextKey) +// GetViperFromCmd returns the viper instance from the command context. +func GetViperFromCmd(cmd *cobra.Command) *viper.Viper { + return GetViperFromContext(cmd.Context()) +} + +// GetLoggerFromContext returns the logger instance from the context. +func GetLoggerFromContext(ctx context.Context) log.Logger { + v := ctx.Value(corectx.LoggerContextKey) logger, ok := v.(log.Logger) if !ok { - panic(fmt.Sprintf("incorrect logger type %T: expected log.Logger. Have you forgot to set the logger in the command context?", v)) + panic(fmt.Sprintf("incorrect logger type %T: expected log.Logger. Have you forgot to set the logger in the context?", v)) } return logger } +// GetLoggerFromCmd returns the logger instance from the command context. +func GetLoggerFromCmd(cmd *cobra.Command) log.Logger { + return GetLoggerFromContext(cmd.Context()) +} + // ExternalIP https://stackoverflow.com/questions/23558425/how-do-i-get-the-local-ip-address-in-go -// TODO there must be a better way to get external IP func ExternalIP() (string, error) { ifaces, err := net.Interfaces() if err != nil { diff --git a/simapp/v2/simdv2/cmd/commands.go b/simapp/v2/simdv2/cmd/commands.go index 3fcbed114d9e..8d4186be8d19 100644 --- a/simapp/v2/simdv2/cmd/commands.go +++ b/simapp/v2/simdv2/cmd/commands.go @@ -55,11 +55,6 @@ func initRootCmd[T transaction.Tx]( NewTestnetCmd(moduleManager), ) - logger, err := serverv2.NewLogger(viper.New(), rootCmd.OutOrStdout()) - if err != nil { - panic(fmt.Sprintf("failed to create logger: %v", err)) - } - // add keybase, auxiliary RPC, query, genesis, and tx child commands rootCmd.AddCommand( genesisCommand(moduleManager), @@ -70,10 +65,9 @@ func initRootCmd[T transaction.Tx]( ) // wire server commands - if err = serverv2.AddCommands( + if err := serverv2.AddCommands( rootCmd, newApp, - logger, initServerConfig(), cometbft.New( &genericTxDecoder[T]{txConfig}, diff --git a/simapp/v2/simdv2/cmd/config.go b/simapp/v2/simdv2/cmd/config.go index 51a7adb178e9..16cb19db93e7 100644 --- a/simapp/v2/simdv2/cmd/config.go +++ b/simapp/v2/simdv2/cmd/config.go @@ -79,7 +79,7 @@ func initCometConfig() cometbft.CfgOption { cfg := cmtcfg.DefaultConfig() // display only warn logs by default except for p2p and state - cfg.LogLevel = "*:warn,p2p:info,state:info" + cfg.LogLevel = "*:warn,server:info,p2p:info,state:info" // increase block timeout cfg.Consensus.TimeoutCommit = 5 * time.Second // overwrite default pprof listen address diff --git a/simapp/v2/simdv2/cmd/testnet.go b/simapp/v2/simdv2/cmd/testnet.go index f030db8e5956..7b71e98b588d 100644 --- a/simapp/v2/simdv2/cmd/testnet.go +++ b/simapp/v2/simdv2/cmd/testnet.go @@ -15,7 +15,6 @@ import ( "github.com/spf13/pflag" "cosmossdk.io/core/transaction" - "cosmossdk.io/log" "cosmossdk.io/math" "cosmossdk.io/math/unsafe" runtimev2 "cosmossdk.io/runtime/v2" @@ -344,7 +343,7 @@ func initTestnetFiles[T transaction.Tx]( ) storeServer := store.New[T]() grpcServer := grpc.New[T](grpc.OverwriteDefaultConfig(grpcConfig)) - server := serverv2.NewServer[T](log.NewNopLogger(), serverCfg, cometServer, grpcServer, storeServer) + server := serverv2.NewServer[T](serverCfg, cometServer, grpcServer, storeServer) err = server.WriteConfig(filepath.Join(nodeDir, "config")) if err != nil { return err From 0b43fcc2164c34b67c9bd0b5795a9c84afb6d16c Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Mon, 14 Oct 2024 08:07:34 +0200 Subject: [PATCH 32/57] fix(server/v2/cometbft): wire app closer (#22240) --- server/v2/cometbft/abci.go | 3 +++ server/v2/cometbft/abci_test.go | 6 +++--- server/v2/cometbft/server.go | 1 + server/v2/testdata/app.toml | 2 +- server/v2/types.go | 1 + simapp/v2/app_di.go | 10 ++++++++++ store/v2/commitment/metadata.go | 1 + store/v2/root/factory.go | 4 ++-- store/v2/root/migrate_test.go | 2 +- store/v2/root/store.go | 7 +++++++ store/v2/root/store_test.go | 6 +++--- store/v2/root/upgrade_test.go | 4 ++-- tools/confix/data/v2-app.toml | 2 +- 13 files changed, 36 insertions(+), 13 deletions(-) diff --git a/server/v2/cometbft/abci.go b/server/v2/cometbft/abci.go index 95eeec9bb5da..75618e296022 100644 --- a/server/v2/cometbft/abci.go +++ b/server/v2/cometbft/abci.go @@ -43,6 +43,7 @@ type Consensus[T transaction.Tx] struct { logger log.Logger appName, version string app *appmanager.AppManager[T] + appCloser func() error txCodec transaction.Codec[T] store types.Store streaming streaming.Manager @@ -77,6 +78,7 @@ func NewConsensus[T transaction.Tx]( logger log.Logger, appName string, app *appmanager.AppManager[T], + appCloser func() error, mp mempool.Mempool[T], indexedEvents map[string]struct{}, queryHandlersMap map[string]appmodulev2.Handler, @@ -89,6 +91,7 @@ func NewConsensus[T transaction.Tx]( appName: appName, version: getCometBFTServerVersion(), app: app, + appCloser: appCloser, cfg: cfg, store: store, logger: logger, diff --git a/server/v2/cometbft/abci_test.go b/server/v2/cometbft/abci_test.go index 3af3fbec8f29..9a42948c6c61 100644 --- a/server/v2/cometbft/abci_test.go +++ b/server/v2/cometbft/abci_test.go @@ -19,7 +19,7 @@ import ( "cosmossdk.io/core/store" "cosmossdk.io/core/transaction" "cosmossdk.io/log" - am "cosmossdk.io/server/v2/appmanager" + "cosmossdk.io/server/v2/appmanager" "cosmossdk.io/server/v2/cometbft/handlers" cometmock "cosmossdk.io/server/v2/cometbft/internal/mock" "cosmossdk.io/server/v2/cometbft/mempool" @@ -672,7 +672,7 @@ func setUpConsensus(t *testing.T, gasLimit uint64, mempool mempool.Mempool[mock. sc := cometmock.NewMockCommiter(log.NewNopLogger(), string(actorName), "stf") mockStore := cometmock.NewMockStore(ss, sc) - b := am.Builder[mock.Tx]{ + b := appmanager.Builder[mock.Tx]{ STF: s, DB: mockStore, ValidateTxGasLimit: gasLimit, @@ -688,7 +688,7 @@ func setUpConsensus(t *testing.T, gasLimit uint64, mempool mempool.Mempool[mock. am, err := b.Build() require.NoError(t, err) - return NewConsensus[mock.Tx](log.NewNopLogger(), "testing-app", am, mempool, map[string]struct{}{}, nil, mockStore, Config{AppTomlConfig: DefaultAppTomlConfig()}, mock.TxCodec{}, "test") + return NewConsensus[mock.Tx](log.NewNopLogger(), "testing-app", am, func() error { return nil }, mempool, map[string]struct{}{}, nil, mockStore, Config{AppTomlConfig: DefaultAppTomlConfig()}, mock.TxCodec{}, "test") } // Check target version same with store's latest version diff --git a/server/v2/cometbft/server.go b/server/v2/cometbft/server.go index 8bd2935149e7..20cd63d07ca4 100644 --- a/server/v2/cometbft/server.go +++ b/server/v2/cometbft/server.go @@ -107,6 +107,7 @@ func (s *CometBFTServer[T]) Init(appI serverv2.AppI[T], cfg map[string]any, logg s.logger, appI.Name(), appI.GetAppManager(), + appI.Close, s.serverOptions.Mempool(cfg), indexEvents, appI.GetQueryHandlers(), diff --git a/server/v2/testdata/app.toml b/server/v2/testdata/app.toml index 094ac068d94a..3d32be7e57ef 100644 --- a/server/v2/testdata/app.toml +++ b/server/v2/testdata/app.toml @@ -25,7 +25,7 @@ minimum-gas-prices = '0stake' app-db-backend = 'goleveldb' [store.options] -# SState storage database type. Currently we support: "sqlite", "pebble" and "rocksdb" +# State storage database type. Currently we support: "sqlite", "pebble" and "rocksdb" ss-type = 'sqlite' # State commitment database type. Currently we support: "iavl" and "iavl-v2" sc-type = 'iavl' diff --git a/server/v2/types.go b/server/v2/types.go index e628fb30c90f..5406313b080e 100644 --- a/server/v2/types.go +++ b/server/v2/types.go @@ -21,4 +21,5 @@ type AppI[T transaction.Tx] interface { GetQueryHandlers() map[string]appmodulev2.Handler GetStore() store.RootStore GetSchemaDecoderResolver() decoding.DecoderResolver + Close() error } diff --git a/simapp/v2/app_di.go b/simapp/v2/app_di.go index b1dfc26f99ff..3c9933721f12 100644 --- a/simapp/v2/app_di.go +++ b/simapp/v2/app_di.go @@ -218,6 +218,16 @@ func (app *SimApp[T]) TxConfig() client.TxConfig { return app.txConfig } +// GetStore returns the root store. func (app *SimApp[T]) GetStore() store.RootStore { return app.store } + +// Close overwrites the base Close method to close the stores. +func (app *SimApp[T]) Close() error { + if err := app.store.Close(); err != nil { + return err + } + + return app.App.Close() +} diff --git a/store/v2/commitment/metadata.go b/store/v2/commitment/metadata.go index 642e6b630dac..a054acf26e89 100644 --- a/store/v2/commitment/metadata.go +++ b/store/v2/commitment/metadata.go @@ -17,6 +17,7 @@ const ( ) // MetadataStore is a store for metadata related to the commitment store. +// It isn't metadata store role to close the underlying KVStore. type MetadataStore struct { kv corestore.KVStoreWithBatch } diff --git a/store/v2/root/factory.go b/store/v2/root/factory.go index 9e1f76a36ceb..2511a53b434e 100644 --- a/store/v2/root/factory.go +++ b/store/v2/root/factory.go @@ -35,7 +35,7 @@ const ( // Options are the options for creating a root store. type Options struct { - SSType SSType `mapstructure:"ss-type" toml:"ss-type" comment:"SState storage database type. Currently we support: \"sqlite\", \"pebble\" and \"rocksdb\""` + SSType SSType `mapstructure:"ss-type" toml:"ss-type" comment:"State storage database type. Currently we support: \"sqlite\", \"pebble\" and \"rocksdb\""` SCType SCType `mapstructure:"sc-type" toml:"sc-type" comment:"State commitment database type. Currently we support: \"iavl\" and \"iavl-v2\""` SSPruningOption *store.PruningOption `mapstructure:"ss-pruning-option" toml:"ss-pruning-option" comment:"Pruning options for state storage"` SCPruningOption *store.PruningOption `mapstructure:"sc-pruning-option" toml:"sc-pruning-option" comment:"Pruning options for state commitment"` @@ -177,5 +177,5 @@ func CreateRootStore(opts *FactoryOptions) (store.RootStore, error) { } pm := pruning.NewManager(sc, ss, storeOpts.SCPruningOption, storeOpts.SSPruningOption) - return New(opts.Logger, ss, sc, pm, nil, nil) + return New(opts.SCRawDB, opts.Logger, ss, sc, pm, nil, nil) } diff --git a/store/v2/root/migrate_test.go b/store/v2/root/migrate_test.go index 0cc20ae940d9..9bd8dfdd2ef8 100644 --- a/store/v2/root/migrate_test.go +++ b/store/v2/root/migrate_test.go @@ -80,7 +80,7 @@ func (s *MigrateStoreTestSuite) SetupTest() { pm := pruning.NewManager(sc, ss, nil, nil) // assume no storage store, simulate the migration process - s.rootStore, err = New(testLog, ss, orgSC, pm, migrationManager, nil) + s.rootStore, err = New(dbm.NewMemDB(), testLog, ss, orgSC, pm, migrationManager, nil) s.Require().NoError(err) } diff --git a/store/v2/root/store.go b/store/v2/root/store.go index c39119a9aaf3..7447c60ae7b2 100644 --- a/store/v2/root/store.go +++ b/store/v2/root/store.go @@ -5,6 +5,7 @@ import ( "crypto/sha256" "errors" "fmt" + "io" "sync" "time" @@ -33,6 +34,9 @@ type Store struct { logger corelog.Logger initialVersion uint64 + // holds the db instance for closing it + dbCloser io.Closer + // stateStorage reflects the state storage backend stateStorage store.VersionedDatabase @@ -68,6 +72,7 @@ type Store struct { // // NOTE: The migration manager is optional and can be nil if no migration is required. func New( + dbCloser io.Closer, logger corelog.Logger, ss store.VersionedDatabase, sc store.Committer, @@ -76,6 +81,7 @@ func New( m metrics.StoreMetrics, ) (store.RootStore, error) { return &Store{ + dbCloser: dbCloser, logger: logger, initialVersion: 1, stateStorage: ss, @@ -92,6 +98,7 @@ func New( func (s *Store) Close() (err error) { err = errors.Join(err, s.stateStorage.Close()) err = errors.Join(err, s.stateCommitment.Close()) + err = errors.Join(err, s.dbCloser.Close()) s.stateStorage = nil s.stateCommitment = nil diff --git a/store/v2/root/store_test.go b/store/v2/root/store_test.go index e8cf34e014e0..9f925b098b9c 100644 --- a/store/v2/root/store_test.go +++ b/store/v2/root/store_test.go @@ -59,7 +59,7 @@ func (s *RootStoreTestSuite) SetupTest() { s.Require().NoError(err) pm := pruning.NewManager(sc, ss, nil, nil) - rs, err := New(noopLog, ss, sc, pm, nil, nil) + rs, err := New(dbm.NewMemDB(), noopLog, ss, sc, pm, nil, nil) s.Require().NoError(err) s.rootStore = rs @@ -84,7 +84,7 @@ func (s *RootStoreTestSuite) newStoreWithPruneConfig(config *store.PruningOption pm := pruning.NewManager(sc, ss, config, config) - rs, err := New(noopLog, ss, sc, pm, nil, nil) + rs, err := New(dbm.NewMemDB(), noopLog, ss, sc, pm, nil, nil) s.Require().NoError(err) s.rootStore = rs @@ -93,7 +93,7 @@ func (s *RootStoreTestSuite) newStoreWithPruneConfig(config *store.PruningOption func (s *RootStoreTestSuite) newStoreWithBackendMount(ss store.VersionedDatabase, sc store.Committer, pm *pruning.Manager) { noopLog := coretesting.NewNopLogger() - rs, err := New(noopLog, ss, sc, pm, nil, nil) + rs, err := New(dbm.NewMemDB(), noopLog, ss, sc, pm, nil, nil) s.Require().NoError(err) s.rootStore = rs diff --git a/store/v2/root/upgrade_test.go b/store/v2/root/upgrade_test.go index a4aee1d5bcfa..47c2882dc2ef 100644 --- a/store/v2/root/upgrade_test.go +++ b/store/v2/root/upgrade_test.go @@ -50,7 +50,7 @@ func (s *UpgradeStoreTestSuite) SetupTest() { sc, err := commitment.NewCommitStore(multiTrees, nil, s.commitDB, testLog) s.Require().NoError(err) pm := pruning.NewManager(sc, ss, nil, nil) - s.rootStore, err = New(testLog, ss, sc, pm, nil, nil) + s.rootStore, err = New(s.commitDB, testLog, ss, sc, pm, nil, nil) s.Require().NoError(err) // commit changeset @@ -92,7 +92,7 @@ func (s *UpgradeStoreTestSuite) loadWithUpgrades(upgrades *corestore.StoreUpgrad sc, err := commitment.NewCommitStore(multiTrees, oldTrees, s.commitDB, testLog) s.Require().NoError(err) pm := pruning.NewManager(sc, s.rootStore.GetStateStorage().(store.Pruner), nil, nil) - s.rootStore, err = New(testLog, s.rootStore.GetStateStorage(), sc, pm, nil, nil) + s.rootStore, err = New(s.commitDB, testLog, s.rootStore.GetStateStorage(), sc, pm, nil, nil) s.Require().NoError(err) } diff --git a/tools/confix/data/v2-app.toml b/tools/confix/data/v2-app.toml index ef144a0b90dd..8a35d32f543b 100644 --- a/tools/confix/data/v2-app.toml +++ b/tools/confix/data/v2-app.toml @@ -50,7 +50,7 @@ minimum-gas-prices = '0stake' app-db-backend = 'goleveldb' [store.options] -# SState storage database type. Currently we support: "sqlite", "pebble" and "rocksdb" +# State storage database type. Currently we support: "sqlite", "pebble" and "rocksdb" ss-type = 'sqlite' # State commitment database type. Currently we support: "iavl" and "iavl-v2" sc-type = 'iavl' From 8c39f41101b02e75425fe64f4d05acbf1f764fd9 Mon Sep 17 00:00:00 2001 From: xujikks Date: Mon, 14 Oct 2024 20:18:51 +0800 Subject: [PATCH 33/57] docs(crypto): update docs (#22247) Co-authored-by: keke-ka --- collections/quad.go | 4 ---- crypto/codec/pubkey.go | 16 ++++++++++++++ crypto/hd/hdpath.go | 10 ++++----- crypto/keyring/keyring.go | 44 +++++++++++++++++++++++++++++++++++++++ crypto/keyring/record.go | 7 +++++++ 5 files changed, 72 insertions(+), 9 deletions(-) diff --git a/collections/quad.go b/collections/quad.go index 2e0678e69ea2..9d8d42a60644 100644 --- a/collections/quad.go +++ b/collections/quad.go @@ -106,7 +106,6 @@ type quadKeyCodec[K1, K2, K3, K4 any] struct { type jsonQuadKey [4]json.RawMessage - // EncodeJSON encodes Quads to json func (t quadKeyCodec[K1, K2, K3, K4]) EncodeJSON(value Quad[K1, K2, K3, K4]) ([]byte, error) { json1, err := t.keyCodec1.EncodeJSON(*value.k1) @@ -210,7 +209,6 @@ func (t quadKeyCodec[K1, K2, K3, K4]) KeyType() string { return fmt.Sprintf("Quad[%s,%s,%s,%s]", t.keyCodec1.KeyType(), t.keyCodec2.KeyType(), t.keyCodec3.KeyType(), t.keyCodec4.KeyType()) } - func (t quadKeyCodec[K1, K2, K3, K4]) Encode(buffer []byte, key Quad[K1, K2, K3, K4]) (int, error) { writtenTotal := 0 if key.k1 != nil { @@ -243,8 +241,6 @@ func (t quadKeyCodec[K1, K2, K3, K4]) Encode(buffer []byte, key Quad[K1, K2, K3, } return writtenTotal, nil } - - func (t quadKeyCodec[K1, K2, K3, K4]) Decode(buffer []byte) (int, Quad[K1, K2, K3, K4], error) { readTotal := 0 read, key1, err := t.keyCodec1.DecodeNonTerminal(buffer) diff --git a/crypto/codec/pubkey.go b/crypto/codec/pubkey.go index c45f258517b0..7710e9275abc 100644 --- a/crypto/codec/pubkey.go +++ b/crypto/codec/pubkey.go @@ -11,6 +11,14 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) +// PubKeyToProto converts a JSON public key (in `cryptokeys.JSONPubkey` format) to its corresponding protobuf public key type. +// +// Parameters: +// - pk: A `cryptokeys.JSONPubkey` containing the public key and its type. +// +// Returns: +// - cryptotypes.PubKey: The protobuf public key corresponding to the provided JSON public key. +// - error: An error if the key type is invalid or unsupported. func PubKeyToProto(pk cryptokeys.JSONPubkey) (cryptotypes.PubKey, error) { switch pk.KeyType { case ed25519.PubKeyName: @@ -30,6 +38,14 @@ func PubKeyToProto(pk cryptokeys.JSONPubkey) (cryptotypes.PubKey, error) { } } +// PubKeyFromProto converts a protobuf public key (in `cryptotypes.PubKey` format) to a JSON public key format (`cryptokeys.JSONPubkey`). +// +// Parameters: +// - pk: A `cryptotypes.PubKey` which is the protobuf representation of a public key. +// +// Returns: +// - cryptokeys.JSONPubkey: The JSON-formatted public key corresponding to the provided protobuf public key. +// - error: An error if the key type is invalid or unsupported. func PubKeyFromProto(pk cryptotypes.PubKey) (cryptokeys.JSONPubkey, error) { switch pk := pk.(type) { case *ed25519.PubKey: diff --git a/crypto/hd/hdpath.go b/crypto/hd/hdpath.go index 9ef9961d1213..7e3107dfba77 100644 --- a/crypto/hd/hdpath.go +++ b/crypto/hd/hdpath.go @@ -230,11 +230,11 @@ func derivePrivateKey(privKeyBytes, chainCode [32]byte, index uint32, harden boo pubkeyBytes := ecPub.SerializeCompressed() data = pubkeyBytes - /* By using btcec, we can remove the dependency on tendermint/crypto/secp256k1 - pubkey := secp256k1.PrivKeySecp256k1(privKeyBytes).PubKey() - public := pubkey.(secp256k1.PubKeySecp256k1) - data = public[:] - */ + // By using btcec, we can remove the dependency on tendermint/crypto/secp256k1 + // pubkey := secp256k1.PrivKeySecp256k1(privKeyBytes).PubKey() + // public := pubkey.(secp256k1.PubKeySecp256k1) + // data = public[:] + } data = append(data, uint32ToBytes(index)...) diff --git a/crypto/keyring/keyring.go b/crypto/keyring/keyring.go index ef3b0a16df08..950ecbab440f 100644 --- a/crypto/keyring/keyring.go +++ b/crypto/keyring/keyring.go @@ -376,6 +376,17 @@ func (ks keystore) ImportPubKey(uid, armor string) error { return nil } +// Sign signs a message using the private key associated with the provided UID. +// +// Parameters: +// - uid: The unique identifier of the account/key to use for signing. +// - msg: The message or data to be signed. +// - signMode: The signing mode that specifies how the message should be signed. +// +// Returns: +// - []byte: The generated signature. +// - types.PubKey: The public key corresponding to the private key used for signing. +// - error: Any error encountered during the signing process. func (ks keystore) Sign(uid string, msg []byte, signMode signing.SignMode) ([]byte, types.PubKey, error) { k, err := ks.Key(uid) if err != nil { @@ -536,6 +547,19 @@ func (ks keystore) List() ([]*Record, error) { return ks.MigrateAll() } +// NewMnemonic generates a new mnemonic and derives a new account from it. +// +// Parameters: +// - uid: A unique identifier for the account. +// - language: The language for the mnemonic (only English is supported). +// - hdPath: The hierarchical deterministic (HD) path for key derivation. +// - bip39Passphrase: The passphrase used in conjunction with the mnemonic for BIP-39. +// - algo: The signature algorithm used for signing keys. +// +// Returns: +// - *Record: A new key record that contains the private and public key information. +// - string: The generated mnemonic phrase. +// - error: Any error encountered during the process. func (ks keystore) NewMnemonic(uid string, language Language, hdPath, bip39Passphrase string, algo SignatureAlgo) (*Record, string, error) { if language != English { return nil, "", ErrUnsupportedLanguage @@ -707,6 +731,15 @@ func newFileBackendKeyringConfig(name, dir string, buf io.Reader) keyring.Config } } +// newRealPrompt creates a password prompt function to retrieve or create a passphrase +// for the keyring system. +// +// Parameters: +// - dir: The directory where the keyhash file is stored. +// - buf: An io.Reader input, typically used for reading user input (e.g., the passphrase). +// +// Returns: +// - A function that accepts a prompt string and returns the passphrase or an error. func newRealPrompt(dir string, buf io.Reader) func(string) (string, error) { return func(prompt string) (string, error) { keyhashStored := false @@ -896,6 +929,7 @@ func (ks keystore) writeMultisigKey(name string, pk types.PubKey) (*Record, erro return k, ks.writeRecord(k) } +// MigrateAll migrates all legacy key information stored in the keystore to the new Record format. func (ks keystore) MigrateAll() ([]*Record, error) { keys, err := ks.db.Keys() if err != nil { @@ -1008,6 +1042,16 @@ func (ks keystore) SetItem(item keyring.Item) error { return ks.db.Set(item) } +// convertFromLegacyInfo converts a legacy account info (LegacyInfo) into a new Record format. +// It handles different types of legacy info and creates the corresponding Record based on the type. +// +// Parameters: +// - info: The legacy account information (LegacyInfo) that needs to be converted. +// It provides the name, public key, and other data depending on the type of account. + +// Returns: +// - *Record: A pointer to the newly created Record that corresponds to the legacy account info. +// - error: An error if the conversion fails due to invalid info or an unsupported account type. func (ks keystore) convertFromLegacyInfo(info LegacyInfo) (*Record, error) { if info == nil { return nil, errorsmod.Wrap(ErrLegacyToRecord, "info is nil") diff --git a/crypto/keyring/record.go b/crypto/keyring/record.go index 2e19c5b91576..009a89ebda35 100644 --- a/crypto/keyring/record.go +++ b/crypto/keyring/record.go @@ -128,6 +128,13 @@ func extractPrivKeyFromRecord(k *Record) (cryptotypes.PrivKey, error) { return extractPrivKeyFromLocal(rl) } +// extractPrivKeyFromLocal extracts the private key from a local record. +// It checks if the private key is available in the provided Record_Local instance. +// Parameters: +// - rl: A pointer to a Record_Local instance from which the private key will be extracted. +// Returns: +// - priv: The extracted cryptotypes.PrivKey if successful. +// - error: An error if the private key is not available or if the casting fails. func extractPrivKeyFromLocal(rl *Record_Local) (cryptotypes.PrivKey, error) { if rl.PrivKey == nil { return nil, ErrPrivKeyNotAvailable From 4274dcf4429cc725a3bda58410bd8325d721a3e9 Mon Sep 17 00:00:00 2001 From: Hoa Nguyen Date: Tue, 15 Oct 2024 04:25:11 +0700 Subject: [PATCH 34/57] refactor: add close body after use and fix lint (#22248) --- collections/quad.go | 1 + server/v2/cometbft/abci.go | 2 +- .../integration/tx/aminojson/aminojson_test.go | 18 ------------------ tools/hubl/internal/registry.go | 5 ++++- 4 files changed, 6 insertions(+), 20 deletions(-) diff --git a/collections/quad.go b/collections/quad.go index 9d8d42a60644..cf17cc32eaba 100644 --- a/collections/quad.go +++ b/collections/quad.go @@ -241,6 +241,7 @@ func (t quadKeyCodec[K1, K2, K3, K4]) Encode(buffer []byte, key Quad[K1, K2, K3, } return writtenTotal, nil } + func (t quadKeyCodec[K1, K2, K3, K4]) Decode(buffer []byte) (int, Quad[K1, K2, K3, K4], error) { readTotal := 0 read, key1, err := t.keyCodec1.DecodeNonTerminal(buffer) diff --git a/server/v2/cometbft/abci.go b/server/v2/cometbft/abci.go index 75618e296022..f64ecb5b8c11 100644 --- a/server/v2/cometbft/abci.go +++ b/server/v2/cometbft/abci.go @@ -108,7 +108,7 @@ func NewConsensus[T transaction.Tx]( indexedEvents: indexedEvents, initialHeight: 0, queryHandlersMap: queryHandlersMap, - getProtoRegistry: sync.OnceValues(func() (*protoregistry.Files, error) { return gogoproto.MergedRegistry() }), + getProtoRegistry: sync.OnceValues(gogoproto.MergedRegistry), } } diff --git a/tests/integration/tx/aminojson/aminojson_test.go b/tests/integration/tx/aminojson/aminojson_test.go index c68f24e97865..38aecaa9b30f 100644 --- a/tests/integration/tx/aminojson/aminojson_test.go +++ b/tests/integration/tx/aminojson/aminojson_test.go @@ -2,7 +2,6 @@ package aminojson import ( "bytes" - "encoding/json" "fmt" stdmath "math" "testing" @@ -454,20 +453,3 @@ func postFixPulsarMessage(msg proto.Message) { } } } - -// sortJson sorts the JSON bytes by way of the side effect of unmarshalling and remarshalling the JSON -// using encoding/json. This hacky way of sorting JSON fields was used by the legacy amino JSON encoding in -// x/auth/migrations/legacytx.StdSignBytes. It is used here ensure the x/tx JSON encoding is equivalent to -// the legacy amino JSON encoding. -func sortJson(bz []byte) ([]byte, error) { - var c any - err := json.Unmarshal(bz, &c) - if err != nil { - return nil, err - } - js, err := json.Marshal(c) - if err != nil { - return nil, err - } - return js, nil -} diff --git a/tools/hubl/internal/registry.go b/tools/hubl/internal/registry.go index a3eea12391e4..945e0ff4296c 100644 --- a/tools/hubl/internal/registry.go +++ b/tools/hubl/internal/registry.go @@ -26,12 +26,15 @@ func GetChainRegistryEntry(chain string) (*ChainRegistryEntry, error) { if err != nil { return nil, err } - bz, err := io.ReadAll(res.Body) if err != nil { return nil, err } + if err = res.Body.Close(); err != nil { + return nil, err + } + data := &ChainRegistryEntry{} if err = json.Unmarshal(bz, data); err != nil { return nil, err From 77254b735b613d53f6acfcb8ea1709b95de446f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juli=C3=A1n=20Toledano?= Date: Tue, 15 Oct 2024 09:19:09 +0200 Subject: [PATCH 35/57] docs: update some learn/advanced (#22255) --- docs/learn/advanced/00-baseapp.md | 43 ++++++++++---------- docs/learn/advanced/01-transactions.md | 32 ++++++++------- docs/learn/advanced/02-context.md | 5 ++- docs/learn/advanced/03-node.md | 16 ++++---- docs/learn/advanced/04-store.md | 56 +++++++++++++------------- 5 files changed, 78 insertions(+), 74 deletions(-) diff --git a/docs/learn/advanced/00-baseapp.md b/docs/learn/advanced/00-baseapp.md index 46f6cce403f0..95f1fc9b5b93 100644 --- a/docs/learn/advanced/00-baseapp.md +++ b/docs/learn/advanced/00-baseapp.md @@ -49,7 +49,7 @@ management logic. The `BaseApp` type holds many important parameters for any Cosmos SDK based application. -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/baseapp/baseapp.go#L58-L182 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/baseapp/baseapp.go#L63-L191 Let us go through the most important components. @@ -71,7 +71,7 @@ First, the important parameters that are initialized during the bootstrapping of * [gRPC Query Router](#grpc-query-router): The `grpcQueryRouter` facilitates the routing of gRPC queries to the appropriate module for it to be processed. These queries are not ABCI messages themselves, but they are relayed to the relevant module's gRPC `Query` service. -* [`TxDecoder`](https://pkg.go.dev/github.com/cosmos/cosmos-sdk/types#TxDecoder): It is used to decode +* [`TxDecoder`](https://pkg.go.dev/github.com/cosmos/cosmos-sdk@v0.52.0-beta.2/types#TxDecoder): It is used to decode raw transaction bytes relayed by the underlying CometBFT engine. * [`AnteHandler`](#antehandler): This handler is used to handle signature verification, fee payment, and other pre-message execution checks when a transaction is received. It's executed during @@ -216,7 +216,7 @@ When messages and queries are received by the application, they must be routed t [`sdk.Msg`s](../../build/building-modules/02-messages-and-queries.md#messages) need to be routed after they are extracted from transactions, which are sent from the underlying CometBFT engine via the [`CheckTx`](#checktx) and [`FinalizeBlock`](#finalizeblock) ABCI messages. To do so, `BaseApp` holds a `msgServiceRouter` which maps fully-qualified service methods (`string`, defined in each module's Protobuf `Msg` service) to the appropriate module's `MsgServer` implementation. -The [default `msgServiceRouter` included in `BaseApp`](https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/baseapp/msg_service_router.go) is stateless. However, some applications may want to make use of more stateful routing mechanisms such as allowing governance to disable certain routes or point them to new modules for upgrade purposes. For this reason, the `sdk.Context` is also passed into each [route handler inside `msgServiceRouter`](https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/baseapp/msg_service_router.go#L31-L32). For a stateless router that doesn't want to make use of this, you can just ignore the `ctx`. +The [default `msgServiceRouter` included in `BaseApp`](https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/baseapp/msg_service_router.go) is stateless. However, some applications may want to make use of more stateful routing mechanisms such as allowing governance to disable certain routes or point them to new modules for upgrade purposes. For this reason, the `sdk.Context` is also passed into each [route handler inside `msgServiceRouter`](https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/baseapp/msg_service_router.go#L42). For a stateless router that doesn't want to make use of this, you can just ignore the `ctx`. The application's `msgServiceRouter` is initialized with all the routes using the application's [module manager](../../build/building-modules/01-module-manager.md#manager) (via the `RegisterServices` method), which itself is initialized with all the application's modules in the application's [constructor](../beginner/00-app-anatomy.md#constructor-function). @@ -224,7 +224,7 @@ The application's `msgServiceRouter` is initialized with all the routes using th Similar to `sdk.Msg`s, [`queries`](../../build/building-modules/02-messages-and-queries.md#queries) need to be routed to the appropriate module's [`Query` service](../../build/building-modules/04-query-services.md). To do so, `BaseApp` holds a `grpcQueryRouter`, which maps modules' fully-qualified service methods (`string`, defined in their Protobuf `Query` gRPC) to their `QueryServer` implementation. The `grpcQueryRouter` is called during the initial stages of query processing, which can be either by directly sending a gRPC query to the gRPC endpoint, or via the [`Query` ABCI message](#query) on the CometBFT RPC endpoint. -Just like the `msgServiceRouter`, the `grpcQueryRouter` is initialized with all the query routes using the application's [module manager](../../build/building-modules/01-module-manager.md) (via the `RegisterServices` method), which itself is initialized with all the application's modules in the application's [constructor](../beginner/00-app-anatomy.md#app-constructor). +Just like the `msgServiceRouter`, the `grpcQueryRouter` is initialized with all the query routes using the application's [module manager](../../build/building-modules/01-module-manager.md) (via the `RegisterServices` method), which itself is initialized with all the application's modules in the application's [constructor](../beginner/00-app-anatomy.md#constructor-function). ## Main ABCI 2.0 Messages @@ -237,7 +237,7 @@ The consensus engine handles two main tasks: It is **not** the role of the consensus engine to define the state or the validity of transactions. Generally, transactions are handled by the consensus engine in the form of `[]bytes`, and relayed to the application via the ABCI to be decoded and processed. At keys moments in the networking and consensus processes (e.g. beginning of a block, commit of a block, reception of an unconfirmed transaction, ...), the consensus engine emits ABCI messages for the state-machine to act on. -Developers building on top of the Cosmos SDK need not implement the ABCI themselves, as `BaseApp` comes with a built-in implementation of the interface. Let us go through the main ABCI messages that `BaseApp` implements: +Developers building on top of the Cosmos SDK don't need to implement the ABCI themselves, as `BaseApp` comes with a built-in implementation of the interface. Let us go through the main ABCI messages that `BaseApp` implements: * [`Prepare Proposal`](#prepare-proposal) * [`Process Proposal`](#process-proposal) @@ -255,7 +255,7 @@ Here is how the `PrepareProposal` function can be implemented: 1. Extract the `sdk.Msg`s from the transaction. 2. Perform _stateful_ checks by calling `Validate()` on each of the `sdk.Msg`'s. This is done after _stateless_ checks as _stateful_ checks are more computationally expensive. If `Validate()` fails, `PrepareProposal` returns before running further checks, which saves resources. -3. Perform any additional checks that are specific to the application, such as checking account balances, or ensuring that certain conditions are met before a transaction is proposed.hey are processed by the consensus engine, if necessary. +3. Perform any additional checks that are specific to the application, such as checking account balances, or ensuring that certain conditions are met before a transaction is proposed. They are processed by the consensus engine, if necessary. 4. Return the updated transactions to be processed by the consensus engine Note that, unlike `CheckTx()`, `PrepareProposal` process `sdk.Msg`s, so it can directly update the state. However, unlike `FinalizeBlock()`, it does not commit the state updates. It's important to exercise caution when using `PrepareProposal` as incorrect coding could affect the overall liveness of the network. @@ -289,7 +289,7 @@ However, developers must exercise greater caution when using these methods. Inco * `Status (ProposalStatus)`: Status of the proposal processing -where `ProposalStatus` can be one of the following status value: +where `ProposalStatus` can be one of the [following status value](https://docs.cometbft.com/v1.0/spec/abci/abci++_methods#proposalstatus): ``` enum ProposalStatus { @@ -311,7 +311,7 @@ make the checks **lightweight** because gas fees are not charged for the resourc The [`Context`](../advanced/02-context.md), which includes a `GasMeter` that tracks how much gas is used during the execution of `Tx`, is initialized at the beginning of `CheckTx`. The user-provided amount of gas for `Tx` is referred to as `GasWanted`. If `GasConsumed`, the amount of gas used during execution, exceeds `GasWanted`, the execution is halted and the changes made to the cached copy of the state are not committed. Otherwise, `CheckTx` sets `GasUsed` equal to `GasConsumed` and returns it in the result. After calculating the gas and fee values, validator-nodes ensure that the user-specified `gas-prices` exceed their locally defined `min-gas-prices`. -In the Cosmos SDK, after [decoding transactions](https://docs.cosmos.network/main/learn/advanced/encoding), `CheckTx()` is implemented +In the Cosmos SDK, after [decoding transactions](./05-encoding.md), `CheckTx()` is implemented to do the following checks: 1. Extract the `sdk.Msg`s from the transaction. @@ -351,7 +351,7 @@ The response contains: * `GasUsed (int64)`: Amount of gas consumed by transaction. During `CheckTx`, this value is computed by multiplying the standard cost of a transaction byte by the size of the raw transaction. Next is an example: ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/x/auth/ante/basic.go#L102 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/x/auth/ante/basic.go#L141-L144 ``` * `Events ([]cmn.KVPair)`: Key-Value tags for filtering and indexing transactions (eg. by account). See [`events`](./08-events.md) for more. @@ -379,7 +379,7 @@ After that, `RunTx()` calls `ValidateBasic()`, when available and for backward c Then, the [`anteHandler`](#antehandler) of the application is run (if it exists). In preparation of this step, both the `checkState`/`finalizeBlockState`'s `context` and `context`'s `CacheMultiStore` are branched using the `cacheTxContext()` function. ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/baseapp/baseapp.go#L663-L680 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/baseapp/baseapp.go#L683-L699 ``` This allows `RunTx` not to commit the changes made to the state during the execution of `anteHandler` if it ends up failing. It also prevents the module implementing the `anteHandler` from writing to state, which is an important part of the [object-capabilities](./10-ocap.md) of the Cosmos SDK. @@ -403,12 +403,12 @@ These operations are crucial for maintaining the security and integrity of trans For more detailed examples, see the [`auth` module's `AnteHandler`](https://github.com/cosmos/cosmos-sdk/tree/main/x/auth) which is widely used for these purposes. :::warning -Ante handlers typically operate at the transaction level. By default, they process only the outermost message of a transaction. However, transactions that embed multiple messages, such as those found in modules like x/authz or x/gov, may have inner messages that are not automatically processed by these default ante handlers. These inner messages are generally routed directly to the [message router](https://docs.cosmos.network/main/learn/advanced/baseapp#msg-service-router) bypassing the ante handlers. To ensure comprehensive processing, custom ante handlers can be designed to recursively inspect and apply necessary checks to all embedded messages within a transaction. This capability must be explicitly implemented to extend the awareness of ante handlers to inner messages. +Ante handlers typically operate at the transaction level. By default, they process only the outermost message of a transaction. However, transactions that embed multiple messages, such as those found in modules like x/authz or x/gov, may have inner messages that are not automatically processed by these default ante handlers. These inner messages are generally routed directly to the [message router](#msg-service-router) bypassing the ante handlers. To ensure comprehensive processing, custom ante handlers can be designed to recursively inspect and apply necessary checks to all embedded messages within a transaction. This capability must be explicitly implemented to extend the awareness of ante handlers to inner messages. ::: The `AnteHandler` is a primary line of defense against spam and a second line of defense (the first one being the mempool) against transaction replay with fees deduction and [`sequence`](./01-transactions.md#transaction-generation) checking. It also performs preliminary _stateful_ validity checks like ensuring signatures are valid or that the sender has enough funds to pay for fees, and plays a role in the incentivisation of stakeholders via the collection of transaction fees. -`BaseApp` holds an `anteHandler` as parameter that is initialized in the [application's constructor](../beginner/00-app-anatomy.md#application-constructor). The most widely used `anteHandler` is the [`auth` module](https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/x/auth/ante/ante.go). +`BaseApp` holds an `anteHandler` as parameter that is initialized in the [application's constructor](../beginner/00-app-anatomy.md#constructor-function). The most widely used `anteHandler` is the [`auth` module](https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/x/auth/ante/ante.go). Click [here](../beginner/04-gas-fees.md#antehandler) for more on the `anteHandler`. @@ -431,7 +431,7 @@ Like `AnteHandler`s, `PostHandler`s are theoretically optional. Other use cases like unused gas refund can also be enabled by `PostHandler`s. ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/x/auth/posthandler/post.go#L1-L15 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/x/auth/posthandler/post.go#L1-L15 ``` Note, when `PostHandler`s fail, the state from `runMsgs` is also reverted, effectively making the transaction fail. @@ -455,25 +455,25 @@ The [`FinalizeBlock` ABCI message](https://docs.cometbft.com/v1.0/spec/abci/abci ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/baseapp/abci.go#L623 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/baseapp/abci.go#L894 ``` #### PreBlock -* Run the application's [`preBlocker()`](../beginner/00-app-anatomy.md#preblocker), which mainly runs the [`PreBlocker()`](../../build/building-modules/06-preblock-beginblock-endblock.md#preblock) method of each of the modules. +* Run the application's [`preBlocker()`](../beginner/00-app-anatomy.md#preblocker), which mainly runs the [`PreBlocker()`](../../build/building-modules/06-preblock-beginblock-endblock.md#preblocker) method of each of the modules. #### BeginBlock * Initialize [`finalizeBlockState`](#state-updates) with the latest header using the `req abci.RequestFinalizeBlock` passed as parameter via the `setState` function. ```go reference - https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/baseapp/baseapp.go#L682-L706 + https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/baseapp/baseapp.go#L729-L754 ``` This function also resets the [main gas meter](../beginner/04-gas-fees.md#main-gas-meter). * Initialize the [block gas meter](../beginner/04-gas-fees.md#block-gas-meter) with the `maxGas` limit. The `gas` consumed within the block cannot go above `maxGas`. This parameter is defined in the application's consensus parameters. -* Run the application's [`beginBlocker()`](../beginner/00-app-anatomy.md#beginblocker-and-endblocker), which mainly runs the [`BeginBlocker()`](../../build/building-modules/06-preblock-beginblock-endblock.md#beginblock) method of each of the modules. +* Run the application's [`beginBlocker()`](../beginner/00-app-anatomy.md#beginblocker-and-endblocker), which mainly runs the [`BeginBlocker()`](../../build/building-modules/06-preblock-beginblock-endblock.md#beginblocker-and-endblocker) method of each of the modules. * Set the [`VoteInfos`](https://docs.cometbft.com/v1.0/spec/abci/abci++_methods#voteinfo) of the application, i.e. the list of validators whose _precommit_ for the previous block was included by the proposer of the current block. This information is carried into the [`Context`](./02-context.md) so that it can be used during transaction execution and EndBlock. #### Transaction Execution @@ -490,8 +490,7 @@ The `FinalizeBlock` ABCI function defined in `BaseApp` does the bulk of the stat Instead of using their `checkState`, full-nodes use `finalizeblock`: -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/baseapp/baseapp.go#LL708-L743 - +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/baseapp/baseapp.go#L756-L791 Transaction execution within `FinalizeBlock` performs the **exact same steps as `CheckTx`**, with a little caveat at step 3 and the addition of a fifth step: @@ -501,7 +500,7 @@ Transaction execution within `FinalizeBlock` performs the **exact same steps as During the additional fifth step outlined in (2), each read/write to the store increases the value of `GasConsumed`. You can find the default cost of each operation: ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/store/types/gas.go#L230-L241 +https://github.com/cosmos/cosmos-sdk/blob/store/v1.1.1/store/types/gas.go#L231-L242 ``` At any point, if `GasConsumed > GasWanted`, the function returns with `Code != 0` and the execution fails. @@ -524,7 +523,7 @@ Each transaction returns a response to the underlying consensus engine of type [ EndBlock is run after transaction execution completes. It allows developers to have logic be executed at the end of each block. In the Cosmos SDK, the bulk EndBlock() method is to run the application's EndBlocker(), which mainly runs the EndBlocker() method of each of the application's modules. ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/baseapp/baseapp.go#L747-L769 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/baseapp/baseapp.go#L729-L754 ``` ### Commit @@ -560,7 +559,7 @@ Each CometBFT `query` comes with a `path`, which is a `string` which denotes wha In the Cosmos-SDK this is implemented as a NoOp: ``` go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/baseapp/abci_utils.go#L274-L281 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/baseapp/abci_utils.go#L456-L462 ``` ### VerifyVoteExtension diff --git a/docs/learn/advanced/01-transactions.md b/docs/learn/advanced/01-transactions.md index 6bb246cfcca8..5eba0acc1759 100644 --- a/docs/learn/advanced/01-transactions.md +++ b/docs/learn/advanced/01-transactions.md @@ -25,13 +25,18 @@ When users want to interact with an application and make state changes (e.g. sen Transaction objects are Cosmos SDK types that implement the `Tx` interface ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/types/tx_msg.go#L51-L56 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/types/tx_msg.go#L53-L66 ``` It contains the following methods: * **GetMsgs:** unwraps the transaction and returns a list of contained `sdk.Msg`s - one transaction may have one or multiple messages, which are defined by module developers. -* **ValidateBasic:** lightweight, [_stateless_](../beginner/01-tx-lifecycle.md#types-of-checks) checks used by ABCI messages [`CheckTx`](./00-baseapp.md#checktx) and [`DeliverTx`](./00-baseapp.md#delivertx) to make sure transactions are not invalid. For example, the [`auth`](https://github.com/cosmos/cosmos-sdk/tree/main/x/auth) module's `ValidateBasic` function checks that its transactions are signed by the correct number of signers and that the fees do not exceed the user's maximum. When [`runTx`](./00-baseapp.md#runtx) is checking a transaction created from the [`auth`](https://github.com/cosmos/cosmos-sdk/tree/main/x/auth/) module, it first runs `ValidateBasic` on each message, then runs the `auth` module AnteHandler which calls `ValidateBasic` for the transaction itself. +* **ValidateBasic:** lightweight, [_stateless_](../beginner/01-tx-lifecycle.md#types-of-checks) checks used by ABCI messages [`CheckTx`](./00-baseapp.md#checktx) and [`RunTx`](./00-baseapp.md#runtx) to make sure transactions are not invalid. For example, the [`auth`](https://github.com/cosmos/cosmos-sdk/tree/main/x/auth) module's `ValidateBasic` function checks that its transactions are signed by the correct number of signers and that the fees do not exceed the user's maximum. When [`runTx`](./00-baseapp.md#runtx) is checking a transaction created from the [`auth`](https://github.com/cosmos/cosmos-sdk/tree/main/x/auth/) module, it first runs `ValidateBasic` on each message, then runs the `auth` module AnteHandler which calls `ValidateBasic` for the transaction itself. +* **Hash()**: returns the unique identifier for the Tx. +* **GetMessages:** returns the list of `sdk.Msg`s contained in the transaction. +* **GetSenders:** returns the addresses of the signers who signed the transaction. +* **GetGasLimit:** returns the gas limit for the transaction. Returns `math.MaxUint64` for transactions with unlimited gas. +* **Bytes:** returns the encoded bytes of the transaction. This is typically cached after the first decoding of the transaction. :::note This function is different from the deprecated `sdk.Msg` [`ValidateBasic`](../beginner/01-tx-lifecycle.md#ValidateBasic) methods, which was performing basic validity checks on messages only. @@ -48,13 +53,13 @@ Every message in a transaction must be signed by the addresses specified by its The most used implementation of the `Tx` interface is the Protobuf `Tx` message, which is used in `SIGN_MODE_DIRECT`: ```protobuf reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/proto/cosmos/tx/v1beta1/tx.proto#L13-L26 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/proto/cosmos/tx/v1beta1/tx.proto#L15-L28 ``` Because Protobuf serialization is not deterministic, the Cosmos SDK uses an additional `TxRaw` type to denote the pinned bytes over which a transaction is signed. Any user can generate a valid `body` and `auth_info` for a transaction, and serialize these two messages using Protobuf. `TxRaw` then pins the user's exact binary representation of `body` and `auth_info`, called respectively `body_bytes` and `auth_info_bytes`. The document that is signed by all signers of the transaction is `SignDoc` (deterministically serialized using [ADR-027](../../architecture/adr-027-deterministic-protobuf-serialization.md)): ```protobuf reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/proto/cosmos/tx/v1beta1/tx.proto#L48-L65 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/proto/cosmos/tx/v1beta1/tx.proto#L50-L67 ``` Once signed by all signers, the `body_bytes`, `auth_info_bytes` and `signatures` are gathered into `TxRaw`, whose serialized bytes are broadcasted over the network. @@ -64,13 +69,13 @@ Once signed by all signers, the `body_bytes`, `auth_info_bytes` and `signatures` The legacy implementation of the `Tx` interface is the `StdTx` struct from `x/auth`: ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/x/auth/migrations/legacytx/stdtx.go#L83-L90 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/x/auth/migrations/legacytx/stdtx.go#L81-L91 ``` The document signed by all signers is `StdSignDoc`: ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/x/auth/migrations/legacytx/stdsign.go#L31-L45 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/x/auth/migrations/legacytx/stdsign.go#L32-L45 ``` which is encoded into bytes using Amino JSON. Once all signatures are gathered into `StdTx`, `StdTx` is serialized using Amino JSON, and these bytes are broadcasted over the network. @@ -85,7 +90,7 @@ The Cosmos SDK also provides a couple of other sign modes for particular use cas need to sign over the fees: ```protobuf reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/proto/cosmos/tx/v1beta1/tx.proto#L67-L98 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/proto/cosmos/tx/v1beta1/tx.proto#L69-L93 ``` The use case is a multi-signer transaction, where one of the signers is appointed to gather all signatures, broadcast the signature and pay for fees, and the others only care about the transaction body. This generally allows for a better multi-signing UX. If Alice, Bob and Charlie are part of a 3-signer transaction, then Alice and Bob can both use `SIGN_MODE_DIRECT_AUX` to sign over the `TxBody` and their own signer info (no need an additional step to gather other signers' ones, like in `SIGN_MODE_DIRECT`), without specifying a fee in their SignDoc. Charlie can then gather both signatures from Alice and Bob, and @@ -104,7 +109,7 @@ If you wish to learn more, please refer to [ADR-050](../../architecture/adr-050- #### Custom Sign modes -There is the opportunity to add your own custom sign mode to the Cosmos-SDK. While we can not accept the implementation of the sign mode to the repository, we can accept a pull request to add the custom signmode to the SignMode enum located [here](https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/proto/cosmos/tx/signing/v1beta1/signing.proto#L17) +There is the opportunity to add your own custom sign mode to the Cosmos-SDK. While we can not accept the implementation of the sign mode to the repository, we can accept a pull request to add the custom signmode to the SignMode enum located [here](https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/proto/cosmos/tx/signing/v1beta1/signing.proto#L9-L17) ## Transaction Process @@ -136,7 +141,7 @@ While messages contain the information for state transition logic, a transaction The `TxBuilder` interface contains data closely related with the generation of transactions, which an end-user can freely set to generate the desired transaction: ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/client/tx_config.go#L40-L53 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/client/tx_config.go#L39-L57 ``` * `Msg`s, the array of [messages](#messages) included in the transaction. @@ -148,13 +153,13 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/client/tx_config.go#L4 As there are currently two sign modes for signing transactions, there are also two implementations of `TxBuilder`: -* [wrapper](https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/x/auth/tx/builder.go#L26-L43) for creating transactions for `SIGN_MODE_DIRECT`, -* [StdTxBuilder](https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/x/auth/migrations/legacytx/stdtx_builder.go#L14-L17) for `SIGN_MODE_LEGACY_AMINO_JSON`. +* [builder](https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/x/auth/tx/builder.go#L79-L98) for creating transactions for `SIGN_MODE_DIRECT`, +* [StdTxBuilder](https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/x/auth/migrations/legacytx/stdtx_builder.go#L11-L17) for `SIGN_MODE_LEGACY_AMINO_JSON`. However, the two implementations of `TxBuilder` should be hidden away from end-users, as they should prefer using the overarching `TxConfig` interface: ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/client/tx_config.go#L24-L34 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/client/tx_config.go#L27-L37 ``` `TxConfig` is an app-wide configuration for managing transactions. Most importantly, it holds the information about whether to sign each transaction with `SIGN_MODE_DIRECT` or `SIGN_MODE_LEGACY_AMINO_JSON`. By calling `txBuilder := txConfig.NewTxBuilder()`, a new `TxBuilder` will be created with the appropriate sign mode. @@ -187,8 +192,7 @@ simd tx send $MY_VALIDATOR_ADDRESS $RECIPIENT 1000stake [gRPC](https://grpc.io) is the main component for the Cosmos SDK's RPC layer. Its principal usage is in the context of modules' [`Query` services](../../build/building-modules/04-query-services.md). However, the Cosmos SDK also exposes a few other module-agnostic gRPC services, one of them being the `Tx` service: -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/proto/cosmos/tx/v1beta1/service.proto - +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/proto/cosmos/tx/v1beta1/service.proto The `Tx` service exposes a handful of utility functions, such as simulating a transaction or querying a transaction, and also one method to broadcast transactions. diff --git a/docs/learn/advanced/02-context.md b/docs/learn/advanced/02-context.md index 33d530b52988..eb0405df3fab 100644 --- a/docs/learn/advanced/02-context.md +++ b/docs/learn/advanced/02-context.md @@ -20,7 +20,7 @@ The `context` is a data structure intended to be passed from function to functio The Cosmos SDK `Context` is a custom data structure that contains Go's stdlib [`context`](https://pkg.go.dev/context) as its base, and has many additional types within its definition that are specific to the Cosmos SDK. The `Context` is integral to transaction processing in that it allows modules to easily access their respective [store](./04-store.md#base-layer-kvstores) in the [`multistore`](./04-store.md#multistore) and retrieve transactional context such as the block header and gas meter. ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/types/context.go#L41-L67 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/types/context.go#L40-L64 ``` * **Base Context:** The base type is a Go [Context](https://pkg.go.dev/context), which is explained further in the [Go Context Package](#go-context-package) section below. @@ -32,7 +32,8 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/types/context.go#L41-L * **Logger:** A `logger` from the CometBFT libraries. Learn more about logs [here](https://docs.cometbft.com/v1.0/references/config/config.toml#log_level). Modules call this method to create their own unique module-specific logger. * **VoteInfo:** A list of the ABCI type [`VoteInfo`](https://docs.cometbft.com/v1.0/spec/abci/abci++_methods#voteinfo), which includes the name of a validator and a boolean indicating whether they have signed the block. * **Gas Meters:** Specifically, a [`gasMeter`](../beginner/04-gas-fees.md#main-gas-meter) for the transaction currently being processed using the context and a [`blockGasMeter`](../beginner/04-gas-fees.md#block-gas-meter) for the entire block it belongs to. Users specify how much in fees they wish to pay for the execution of their transaction; these gas meters keep track of how much [gas](../beginner/04-gas-fees.md) has been used in the transaction or block so far. If the gas meter runs out, execution halts. -* **CheckTx Mode:** A boolean value indicating whether a transaction should be processed in `CheckTx` or `DeliverTx` mode. +* **CheckTx Mode:** A boolean value indicating whether a transaction should be processed in `CheckTx` or `DeliverTx` mode. It is deprecated and replaced by `execMode`. +* **execMode**: defines the execution mode of the transaction. * **Min Gas Price:** The minimum [gas](../beginner/04-gas-fees.md) price a node is willing to take in order to include a transaction in its block. This price is a local value configured by each node individually, and should therefore **not be used in any functions used in sequences leading to state-transitions**. * **Consensus Params:** The ABCI type [Consensus Parameters](https://docs.cometbft.com/v1.0/spec/abci/abci++_app_requirements#consensus-parameters), which specify certain limits for the blockchain, such as maximum gas for a block. * **Event Manager:** The event manager allows any caller with access to a `Context` to emit [`Events`](./08-events.md). Modules may define module specific diff --git a/docs/learn/advanced/03-node.md b/docs/learn/advanced/03-node.md index 65dc867939f5..af1cbaf85e0d 100644 --- a/docs/learn/advanced/03-node.md +++ b/docs/learn/advanced/03-node.md @@ -24,7 +24,7 @@ In general, developers will implement the `main.go` function with the following * Then, the `config` is retrieved and config parameters are set. This mainly involves setting the Bech32 prefixes for [addresses](../beginner/03-accounts.md#addresses). ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/types/config.go#L14-L29 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/types/config.go#L20-L29 ``` * Using [cobra](https://github.com/spf13/cobra), the root command of the full-node client is created. After that, all the custom commands of the application are added using the `AddCommand()` method of `rootCmd`. @@ -32,13 +32,13 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/types/config.go#L14-L2 * Prepare and execute the `executor`. ```go reference -https://github.com/cometbft/cometbft/blob/v0.37.0/libs/cli/setup.go#L74-L78 +https://github.com/cometbft/cometbft/blob/v1.0.0-rc1/libs/cli/setup.go#L74-L78 ``` See an example of `main` function from the `simapp` application, the Cosmos SDK's application for demo purposes: ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/simapp/simd/main.go +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/simapp/simd/main.go ``` ## `start` command @@ -60,25 +60,25 @@ The flow of the `start` command is pretty straightforward. First, it retrieves t With the `db`, the `start` command creates a new instance of the application using an `appCreator` function: ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/server/start.go#L220 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/server/start.go#L201 ``` Note that an `appCreator` is a function that fulfills the `AppCreator` signature: ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/server/types/app.go#L68 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/server/types/app.go#L69-L71 ``` In practice, the [constructor of the application](../beginner/00-app-anatomy.md#constructor-function) is passed as the `appCreator`. ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/simapp/simd/cmd/root_v2.go#L294-L308 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.1/server/util.go#L334-L360 ``` Then, the instance of `app` is used to instantiate a new CometBFT node: ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/server/start.go#L341-L378 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/server/start.go#L367-L410 ``` The CometBFT node can be created with `app` because the latter satisfies the [`abci.Application` interface](https://pkg.go.dev/github.com/cometbft/cometbft/api/cometbft/abci/v1#Application) (given that `app` extends [`baseapp`](./00-baseapp.md)). As part of the `node.New` method, CometBFT makes sure that the height of the application (i.e. number of blocks since genesis) is equal to the height of the CometBFT node. The difference between these two heights should always be negative or null. If it is strictly negative, `node.New` will replay blocks until the height of the application reaches the height of the CometBFT node. Finally, if the height of the application is `0`, the CometBFT node will call [`InitChain`](./00-baseapp.md#initchain) on the application to initialize the state from the genesis file. @@ -86,7 +86,7 @@ The CometBFT node can be created with `app` because the latter satisfies the [`a Once the CometBFT node is instantiated and in sync with the application, the node can be started: ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/server/start.go#L350-L352 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/server/start.go#L383-L384 ``` Upon starting, the node will bootstrap its RPC and P2P server and start dialing peers. During handshake with its peers, if the node realizes they are ahead, it will query all the blocks sequentially in order to catch up. Then, it will wait for new block proposals and block signatures from validators in order to make progress. diff --git a/docs/learn/advanced/04-store.md b/docs/learn/advanced/04-store.md index 4d084f1a357c..9c5b7dd9913b 100644 --- a/docs/learn/advanced/04-store.md +++ b/docs/learn/advanced/04-store.md @@ -36,29 +36,29 @@ flowchart TB At its very core, a Cosmos SDK `store` is an object that holds a `CacheWrapper` and has a `GetStoreType()` method: ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/store/types/store.go#L15-L18 +https://github.com/cosmos/cosmos-sdk/blob/store/v1.1.1/store/types/store.go#L15-L18 ``` The `GetStoreType` is a simple method that returns the type of store, whereas a `CacheWrapper` is a simple interface that implements store read caching and write branching through the `Write` method: ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/store/types/store.go#L287-L320 +https://github.com/cosmos/cosmos-sdk/blob/store/v1.1.1/store/types/store.go#L287-L303 ``` -Branching and cache is used ubiquitously in the Cosmos SDK and required to be implemented on every store type. A storage branch creates an isolated, ephemeral branch of a store that can be passed around and updated without affecting the main underlying store. This is used to trigger temporary state-transitions that may be reverted later should an error occur. Read more about it in [context](./02-context.md#Store-branching) +Branching and cache is used ubiquitously in the Cosmos SDK and required to be implemented on every store type. A storage branch creates an isolated, ephemeral branch of a store that can be passed around and updated without affecting the main underlying store. This is used to trigger temporary state-transitions that may be reverted later should an error occur. Read more about it in [context](./02-context.md#store-branching) ### Commit Store A commit store is a store that has the ability to commit changes made to the underlying tree or db. The Cosmos SDK differentiates simple stores from commit stores by extending the basic store interfaces with a `Committer`: ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/store/types/store.go#L32-L37 +https://github.com/cosmos/cosmos-sdk/blob/store/v1.1.1/store/types/store.go#L32-L36 ``` The `Committer` is an interface that defines methods to persist changes to disk: ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/store/types/store.go#L20-L30 +https://github.com/cosmos/cosmos-sdk/blob/store/v1.1.1/store/types/store.go#L20-L30 ``` The `CommitID` is a deterministic commit of the state tree. Its hash is returned to the underlying consensus engine and stored in the block header. Note that commit store interfaces exist for various purposes, one of which is to make sure not every object can commit the store. As part of the [object-capabilities model](./10-ocap.md) of the Cosmos SDK, only `baseapp` should have the ability to commit stores. For example, this is the reason why the `ctx.KVStore()` method by which modules typically access stores returns a `KVStore` and not a `CommitKVStore`. @@ -72,7 +72,7 @@ The Cosmos SDK comes with many types of stores, the most used being [`CommitMult Each Cosmos SDK application holds a multistore at its root to persist its state. The multistore is a store of `KVStores` that follows the `Multistore` interface: ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/store/types/store.go#L123-L155 +https://github.com/cosmos/cosmos-sdk/blob/store/v1.1.1/store/types/store.go#L123-L155 ``` If tracing is enabled, then branching the multistore will firstly wrap all the underlying `KVStore` in [`TraceKv.Store`](#tracekv-store). @@ -82,23 +82,23 @@ If tracing is enabled, then branching the multistore will firstly wrap all the u The main type of `Multistore` used in the Cosmos SDK is `CommitMultiStore`, which is an extension of the `Multistore` interface: ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/store/types/store.go#L164-L227 +https://github.com/cosmos/cosmos-sdk/blob/store/v1.1.1/store/types/store.go#L163-L227 ``` -As for concrete implementation, the [`rootMulti.Store`] is the go-to implementation of the `CommitMultiStore` interface. +As for concrete implementation, the [`rootMulti.Store`](https://github.com/cosmos/cosmos-sdk/blob/store/v1.1.1/store/rootmulti/store.go) is the go-to implementation of the `CommitMultiStore` interface. ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/store/rootmulti/store.go#L53-L77 +https://github.com/cosmos/cosmos-sdk/blob/store/v1.1.1/store/rootmulti/store.go#L55-L77 ``` The `rootMulti.Store` is a base-layer multistore built around a `db` on top of which multiple `KVStores` can be mounted, and is the default multistore store used in [`baseapp`](./00-baseapp.md). ### CacheMultiStore -Whenever the `rootMulti.Store` needs to be branched, a [`cachemulti.Store`](https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/store/cachemulti/store.go) is used. +Whenever the `rootMulti.Store` needs to be branched, a [`cachemulti.Store`](https://github.com/cosmos/cosmos-sdk/blob/store/v1.1.1/store/cachemulti/store.go) is used. ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/store/cachemulti/store.go#L19-L33 +https://github.com/cosmos/cosmos-sdk/blob/store/v1.1.1/store/cachemulti/store.go#L20-L33 ``` `cachemulti.Store` branches all substores (creates a virtual store for each substore) in its constructor and hold them in `Store.stores`. Moreover caches all read queries. `Store.GetKVStore()` returns the store from `Store.stores`, and `Store.Write()` recursively calls `CacheWrap.Write()` on all the substores. @@ -114,13 +114,13 @@ Individual `KVStore`s are used by modules to manage a subset of the global state `CommitKVStore`s are declared by proxy of their respective `key` and mounted on the application's [multistore](#multistore) in the [main application file](../beginner/00-app-anatomy.md#core-application-file). In the same file, the `key` is also passed to the module's `keeper` that is responsible for managing the store. ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/store/types/store.go#L229-L266 +https://github.com/cosmos/cosmos-sdk/blob/store/v1.1.1/store/types/store.go#L229-L266 ``` Apart from the traditional `Get` and `Set` methods, that a `KVStore` must implement via the `BasicKVStore` interface; a `KVStore` must provide an `Iterator(start, end)` method which returns an `Iterator` object. It is used to iterate over a range of keys, typically keys that share a common prefix. Below is an example from the bank's module keeper, used to iterate over all account balances: ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/x/bank/keeper/view.go#L125-L140 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/x/bank/keeper/view.go#L114-L134 ``` ### `IAVL` Store @@ -128,7 +128,7 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/x/bank/keeper/view.go# The default implementation of `KVStore` and `CommitKVStore` used in `baseapp` is the `iavl.Store`. ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/store/iavl/store.go#L35-L40 +https://github.com/cosmos/cosmos-sdk/blob/store/v1.1.1/store/iavl/store.go#L36-L41 ``` `iavl` stores are based around an [IAVL Tree](https://github.com/cosmos/iavl), a self-balancing binary tree which guarantees that: @@ -144,7 +144,7 @@ The documentation on the IAVL Tree is located [here](https://github.com/cosmos/i `dbadapter.Store` is an adapter for `corestore.KVStoreWithBatch` making it fulfilling the `KVStore` interface. ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/store/dbadapter/store.go#L13-L16 +https://github.com/cosmos/cosmos-sdk/blob/store/v1.1.1/store/dbadapter/store.go#L13-L16 ``` `dbadapter.Store` embeds `corestore.KVStoreWithBatch`, meaning most of the `KVStore` interface functions are implemented. The other functions (mostly miscellaneous) are manually implemented. This store is primarily used within [Transient Stores](#transient-store) @@ -154,7 +154,7 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/store/dbadapter/store. `Transient.Store` is a base-layer `KVStore` which is automatically discarded at the end of the block. ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/store/transient/store.go#L16-L19 +https://github.com/cosmos/cosmos-sdk/blob/store/v1.1.1/store/transient/store.go#L16-L19 ``` `Transient.Store` is a `dbadapter.Store` with a `coretesting.NewMemDB()`. All `KVStore` methods are reused. When `Store.Commit()` is called, a new `dbadapter.Store` is assigned, discarding previous reference and making it garbage collected. @@ -162,13 +162,13 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/store/transient/store. This type of store is useful to persist information that is only relevant per-block. One example would be to store parameter changes (i.e. a bool set to `true` if a parameter changed in a block). ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/x/params/types/subspace.go#L21-L31 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/x/params/types/subspace.go#L23-L33 ``` Transient stores are typically accessed via the [`context`](./02-context.md) via the `TransientStore()` method: ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/types/context.go#L340-L343 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/types/context.go#L344-L347 ``` ## KVStore Wrappers @@ -178,7 +178,7 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/types/context.go#L340- `cachekv.Store` is a wrapper `KVStore` which provides buffered writing / cached reading functionalities over the underlying `KVStore`. ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/store/cachekv/store.go#L26-L36 +https://github.com/cosmos/cosmos-sdk/blob/store/v1.1.1/store/cachekv/store.go#L26-L35 ``` This is the type used whenever an IAVL Store needs to be branched to create an isolated store (typically when we need to mutate a state that might be reverted later). @@ -197,29 +197,29 @@ This is the type used whenever an IAVL Store needs to be branched to create an i ### `GasKv` Store -Cosmos SDK applications use [`gas`](../beginner/04-gas-fees.md) to track resources usage and prevent spam. [`GasKv.Store`](https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/store/gaskv/store.go) is a `KVStore` wrapper that enables automatic gas consumption each time a read or write to the store is made. It is the solution of choice to track storage usage in Cosmos SDK applications. +Cosmos SDK applications use [`gas`](../beginner/04-gas-fees.md) to track resources usage and prevent spam. [`GasKv.Store`](https://github.com/cosmos/cosmos-sdk/blob/store/v1.1.1/store/gaskv/store.go) is a `KVStore` wrapper that enables automatic gas consumption each time a read or write to the store is made. It is the solution of choice to track storage usage in Cosmos SDK applications. ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/store/gaskv/store.go#L11-L17 +https://github.com/cosmos/cosmos-sdk/blob/store/v1.1.1/store/gaskv/store.go#L11-L17 ``` When methods of the parent `KVStore` are called, `GasKv.Store` automatically consumes appropriate amount of gas depending on the `Store.gasConfig`: ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/store/types/gas.go#L219-L228 +https://github.com/cosmos/cosmos-sdk/blob/store/v1.1.1/store/types/gas.go#L220-L229 ``` By default, all `KVStores` are wrapped in `GasKv.Stores` when retrieved. This is done in the `KVStore()` method of the [`context`](./02-context.md): ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/types/context.go#L335-L338 +https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/types/context.go#L339-L342 ``` In this case, the gas configuration set in the `context` is used. The gas configuration can be set using the `WithKVGasConfig` method of the `context`. Otherwise it uses the following default: ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/store/types/gas.go#L230-L241 +https://github.com/cosmos/cosmos-sdk/blob/store/v1.1.1/store/types/gas.go#L231-L242 ``` ### `TraceKv` Store @@ -227,7 +227,7 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/store/types/gas.go#L23 `tracekv.Store` is a wrapper `KVStore` which provides operation tracing functionalities over the underlying `KVStore`. It is applied automatically by the Cosmos SDK on all `KVStore` if tracing is enabled on the parent `MultiStore`. ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/store/tracekv/store.go#L20-L43 +https://github.com/cosmos/cosmos-sdk/blob/store/v1.1.1/store/tracekv/store.go#L20-L43 ``` When each `KVStore` methods are called, `tracekv.Store` automatically logs `traceOperation` to the `Store.writer`. `traceOperation.Metadata` is filled with `Store.context` when it is not nil. `TraceContext` is a `map[string]interface{}`. @@ -237,7 +237,7 @@ When each `KVStore` methods are called, `tracekv.Store` automatically logs `trac `prefix.Store` is a wrapper `KVStore` which provides automatic key-prefixing functionalities over the underlying `KVStore`. ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/store/prefix/store.go#L15-L21 +https://github.com/cosmos/cosmos-sdk/blob/store/v1.1.1/store/prefix/store.go#L15-L21 ``` When `Store.{Get, Set}()` is called, the store forwards the call to its parent, with the key prefixed with the `Store.prefix`. @@ -248,10 +248,10 @@ When `Store.Iterator()` is called, it does not simply prefix the `Store.prefix`, `listenkv.Store` is a wrapper `KVStore` which provides state listening capabilities over the underlying `KVStore`. It is applied automatically by the Cosmos SDK on any `KVStore` whose `StoreKey` is specified during state streaming configuration. -Additional information about state streaming configuration can be found in the [store/streaming/README.md](https://github.com/cosmos/cosmos-sdk/tree/v0.50.0-alpha.0/store/streaming). +Additional information about state streaming configuration can be found in the [store/streaming/README.md](https://github.com/cosmos/cosmos-sdk/blob/store/v1.1.1/store/streaming/README.md). ```go reference -https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/store/listenkv/store.go#L11-L18 +https://github.com/cosmos/cosmos-sdk/blob/store/v1.1.1/store/listenkv/store.go#L11-L18 ``` When `KVStore.Set` or `KVStore.Delete` methods are called, `listenkv.Store` automatically writes the operations to the set of `Store.listeners`. From 3862ebabf63edee24046bf74acb05861f679d22b Mon Sep 17 00:00:00 2001 From: Alexander Peters Date: Tue, 15 Oct 2024 15:00:44 +0200 Subject: [PATCH 36/57] chore(doc): Update sims doc (#22258) --- docs/learn/advanced/12-simulation.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/docs/learn/advanced/12-simulation.md b/docs/learn/advanced/12-simulation.md index c30d398c32e9..6a43bb10ff51 100644 --- a/docs/learn/advanced/12-simulation.md +++ b/docs/learn/advanced/12-simulation.md @@ -4,7 +4,7 @@ sidebar_position: 1 # Cosmos Blockchain Simulator -The Cosmos SDK offers a full fledged simulation framework to fuzz test every +The Cosmos SDK offers a full fledged simulation framework to [fuzz test](https://en.wikipedia.org/wiki/Fuzzing) every message defined by a module. On the Cosmos SDK, this functionality is provided by [`SimApp`](https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/simapp/app_v2.go), which is a `Baseapp` application that is used for running the [`simulation`](https://github.com/cosmos/cosmos-sdk/blob/23cf89cce1882ba9c8280e64735ae200504bfdce/simsx/README.md#L1) package. This package defines all the simulation logic as well as the operations for randomized parameters like accounts, balances etc. @@ -17,16 +17,15 @@ Its main difference with integration testing is that the simulator app allows yo ## Simulation commands -The simulation app has different commands, each of which tests a different +The simulation test setup has different scenarios, each of which tests a different failure type: * `AppImportExport`: The simulator exports the initial app state and then it creates a new app with the exported `genesis.json` as an input, checking for inconsistencies between the stores. * `AppSimulationAfterImport`: Queues two simulations together. The first one provides the app state (_i.e_ genesis) to the second. Useful to test software upgrades or hard-forks from a live chain. -* `AppStateDeterminism`: Checks that all the nodes return the same values, in the same order. +* `AppStateDeterminism`: Runs a few seeds many times to test that the apphash is deterministic across the runs. * `BenchmarkInvariants`: Analysis of the performance of running all modules' invariants (_i.e_ sequentially runs a [benchmark](https://pkg.go.dev/testing/#hdr-Benchmarks) test). An invariant checks for differences between the values that are on the store and the passive tracker. Eg: total coins held by accounts vs total supply tracker. * `FullAppSimulation`: General simulation mode. Runs the chain and the specified operations for a given number of blocks. Tests that there're no `panics` on the simulation. It does also run invariant checks on every `Period` but they are not benchmarked. * `FuzzFullAppSimulation`: Runs general simulation mode with the [go fuzzer](https://go.dev/doc/security/fuzz/) to find panics. -* `AppStateDeterminism`: Runs a few seeds many times to test that the apphash is deterministic across the runs. Each simulation must receive a set of inputs (_i.e_ flags) such as the number of blocks that the simulation is run, seed, block size, etc. @@ -66,13 +65,10 @@ Here are some suggestions when encountering a simulation failure: involved. * Reduce the simulation `-Period`. This will run the invariants checks more frequently. -* Print all the failed invariants at once with `-PrintAllInvariants`. * Try using another `-Seed`. If it can reproduce the same error and if it fails sooner, you will spend less time running the simulations. * Reduce the `-NumBlocks` . How's the app state at the height previous to the failure? -* Run invariants on every operation with `-SimulateEveryOperation`. _Note_: this - will slow down your simulation **a lot**. * Try adding logs to operations that are not logged. You will have to define a [Logger](https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/x/staking/keeper/keeper.go#L65-L68) on your `Keeper`. From f89382df90254a6365898eda295ce42ca52b5c50 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 15 Oct 2024 13:30:45 +0000 Subject: [PATCH 37/57] build(deps): Bump buf.build/gen/go/cometbft/cometbft/protocolbuffers/go from 1.34.2-20240701160653-fedbb9acfd2f.2 to 1.35.1-20240701160653-fedbb9acfd2f.1 in /api (#22262) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] Co-authored-by: Julien Robert Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- api/go.mod | 4 ++-- api/go.sum | 8 ++++---- client/v2/go.mod | 4 ++-- client/v2/go.sum | 8 ++++---- go.mod | 4 ++-- go.sum | 8 ++++---- runtime/v2/go.mod | 4 ++-- runtime/v2/go.sum | 8 ++++---- server/v2/cometbft/go.mod | 4 ++-- server/v2/cometbft/go.sum | 8 ++++---- simapp/go.mod | 4 ++-- simapp/go.sum | 8 ++++---- simapp/v2/go.mod | 4 ++-- simapp/v2/go.sum | 8 ++++---- tests/go.mod | 4 ++-- tests/go.sum | 8 ++++---- x/accounts/defaults/base/go.mod | 4 ++-- x/accounts/defaults/base/go.sum | 8 ++++---- x/accounts/defaults/lockup/go.mod | 4 ++-- x/accounts/defaults/lockup/go.sum | 8 ++++---- x/accounts/defaults/multisig/go.mod | 4 ++-- x/accounts/defaults/multisig/go.sum | 8 ++++---- x/accounts/go.mod | 4 ++-- x/accounts/go.sum | 8 ++++---- x/authz/go.mod | 4 ++-- x/authz/go.sum | 8 ++++---- x/bank/go.mod | 4 ++-- x/bank/go.sum | 8 ++++---- x/circuit/go.mod | 4 ++-- x/circuit/go.sum | 8 ++++---- x/consensus/go.mod | 4 ++-- x/consensus/go.sum | 8 ++++---- x/distribution/go.mod | 4 ++-- x/distribution/go.sum | 8 ++++---- x/epochs/go.mod | 4 ++-- x/epochs/go.sum | 8 ++++---- x/evidence/go.mod | 4 ++-- x/evidence/go.sum | 8 ++++---- x/feegrant/go.mod | 4 ++-- x/feegrant/go.sum | 8 ++++---- x/gov/go.mod | 4 ++-- x/gov/go.sum | 8 ++++---- x/group/go.mod | 4 ++-- x/group/go.sum | 8 ++++---- x/mint/go.mod | 4 ++-- x/mint/go.sum | 8 ++++---- x/nft/go.mod | 4 ++-- x/nft/go.sum | 8 ++++---- x/params/go.mod | 4 ++-- x/params/go.sum | 8 ++++---- x/protocolpool/go.mod | 4 ++-- x/protocolpool/go.sum | 8 ++++---- x/slashing/go.mod | 4 ++-- x/slashing/go.sum | 8 ++++---- x/staking/go.mod | 4 ++-- x/staking/go.sum | 8 ++++---- x/upgrade/go.mod | 4 ++-- x/upgrade/go.sum | 8 ++++---- 58 files changed, 174 insertions(+), 174 deletions(-) diff --git a/api/go.mod b/api/go.mod index 0e67e47d69cf..723f4fdab37d 100644 --- a/api/go.mod +++ b/api/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/api go 1.21 require ( - buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 + buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 github.com/cosmos/cosmos-proto v1.0.0-beta.5 github.com/cosmos/gogoproto v1.7.0 google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 @@ -12,7 +12,7 @@ require ( ) require ( - buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect + buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 // indirect github.com/google/go-cmp v0.6.0 // indirect golang.org/x/net v0.29.0 // indirect golang.org/x/sys v0.25.0 // indirect diff --git a/api/go.sum b/api/go.sum index 54ee95f23708..c31e3013c9b7 100644 --- a/api/go.sum +++ b/api/go.sum @@ -1,7 +1,7 @@ -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 h1:90/4O5QkHb8EZdA2SAhueRzYw6u5ZHCPKtReFqshnTY= -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2/go.mod h1:1+3gJj2NvZ1mTLAtHu+lMhOjGgQPiCKCeo+9MBww0Eo= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 h1:b7EEYTUHmWSBEyISHlHvXbJPqtKiHRuUignL1tsHnNQ= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2/go.mod h1:HqcXMSa5qnNuakaMUo+hWhF51mKbcrZxGl9Vp5EeJXc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 h1:DIUSA9vcIz63uUotWfbXXlwv1iTL+C0O2kEMLsnIIbc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1/go.mod h1:JTBMfyi+qAXUHumX+rcD2WIq9FNWmdcNh5MjBnSw0L0= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 h1:F78ecjvMtgd1aZ1Aj9cvBjURxVGCYvRM+OOy5eR+pjw= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1/go.mod h1:zqi/LZjZhyvjCMTEVIwAf5VRlkLduuCfqmZxgoormq0= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro= diff --git a/client/v2/go.mod b/client/v2/go.mod index 6b1bbc12f80d..a55b13e882d0 100644 --- a/client/v2/go.mod +++ b/client/v2/go.mod @@ -20,8 +20,8 @@ require ( ) require ( - buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect - buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect + buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 // indirect + buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 // indirect cosmossdk.io/collections v0.4.0 // indirect cosmossdk.io/core/testing v0.0.0-20240923163230-04da382a9f29 // indirect cosmossdk.io/errors v1.0.1 // indirect diff --git a/client/v2/go.sum b/client/v2/go.sum index 0fed52563946..e9b07cd27b81 100644 --- a/client/v2/go.sum +++ b/client/v2/go.sum @@ -1,7 +1,7 @@ -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 h1:90/4O5QkHb8EZdA2SAhueRzYw6u5ZHCPKtReFqshnTY= -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2/go.mod h1:1+3gJj2NvZ1mTLAtHu+lMhOjGgQPiCKCeo+9MBww0Eo= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 h1:b7EEYTUHmWSBEyISHlHvXbJPqtKiHRuUignL1tsHnNQ= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2/go.mod h1:HqcXMSa5qnNuakaMUo+hWhF51mKbcrZxGl9Vp5EeJXc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 h1:DIUSA9vcIz63uUotWfbXXlwv1iTL+C0O2kEMLsnIIbc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1/go.mod h1:JTBMfyi+qAXUHumX+rcD2WIq9FNWmdcNh5MjBnSw0L0= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 h1:F78ecjvMtgd1aZ1Aj9cvBjURxVGCYvRM+OOy5eR+pjw= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1/go.mod h1:zqi/LZjZhyvjCMTEVIwAf5VRlkLduuCfqmZxgoormq0= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= diff --git a/go.mod b/go.mod index b2dc62a8bc62..d06a15278821 100644 --- a/go.mod +++ b/go.mod @@ -65,8 +65,8 @@ require ( ) require ( - buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect - buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect + buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 // indirect + buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 // indirect filippo.io/edwards25519 v1.1.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/DataDog/datadog-go v4.8.3+incompatible // indirect diff --git a/go.sum b/go.sum index 39a05c2011fc..90bf32a034f5 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,7 @@ -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 h1:90/4O5QkHb8EZdA2SAhueRzYw6u5ZHCPKtReFqshnTY= -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2/go.mod h1:1+3gJj2NvZ1mTLAtHu+lMhOjGgQPiCKCeo+9MBww0Eo= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 h1:b7EEYTUHmWSBEyISHlHvXbJPqtKiHRuUignL1tsHnNQ= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2/go.mod h1:HqcXMSa5qnNuakaMUo+hWhF51mKbcrZxGl9Vp5EeJXc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 h1:DIUSA9vcIz63uUotWfbXXlwv1iTL+C0O2kEMLsnIIbc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1/go.mod h1:JTBMfyi+qAXUHumX+rcD2WIq9FNWmdcNh5MjBnSw0L0= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 h1:F78ecjvMtgd1aZ1Aj9cvBjURxVGCYvRM+OOy5eR+pjw= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1/go.mod h1:zqi/LZjZhyvjCMTEVIwAf5VRlkLduuCfqmZxgoormq0= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/core v1.0.0-alpha.4 h1:9iuroT9ejDYETCsGkzkvs/wAY/5UFl7nCIINFRxyMJY= diff --git a/runtime/v2/go.mod b/runtime/v2/go.mod index 5147e8ad1362..74749ef367e7 100644 --- a/runtime/v2/go.mod +++ b/runtime/v2/go.mod @@ -27,8 +27,8 @@ require ( ) require ( - buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect - buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect + buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 // indirect + buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 // indirect cosmossdk.io/core/testing v0.0.0-20240923163230-04da382a9f29 // indirect cosmossdk.io/errors/v2 v2.0.0-20240731132947-df72853b3ca5 // indirect github.com/DataDog/zstd v1.5.5 // indirect diff --git a/runtime/v2/go.sum b/runtime/v2/go.sum index 2ee0283004bf..b67058f3e108 100644 --- a/runtime/v2/go.sum +++ b/runtime/v2/go.sum @@ -1,7 +1,7 @@ -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 h1:90/4O5QkHb8EZdA2SAhueRzYw6u5ZHCPKtReFqshnTY= -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2/go.mod h1:1+3gJj2NvZ1mTLAtHu+lMhOjGgQPiCKCeo+9MBww0Eo= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 h1:b7EEYTUHmWSBEyISHlHvXbJPqtKiHRuUignL1tsHnNQ= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2/go.mod h1:HqcXMSa5qnNuakaMUo+hWhF51mKbcrZxGl9Vp5EeJXc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 h1:DIUSA9vcIz63uUotWfbXXlwv1iTL+C0O2kEMLsnIIbc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1/go.mod h1:JTBMfyi+qAXUHumX+rcD2WIq9FNWmdcNh5MjBnSw0L0= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 h1:F78ecjvMtgd1aZ1Aj9cvBjURxVGCYvRM+OOy5eR+pjw= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1/go.mod h1:zqi/LZjZhyvjCMTEVIwAf5VRlkLduuCfqmZxgoormq0= cosmossdk.io/core v1.0.0-alpha.4 h1:9iuroT9ejDYETCsGkzkvs/wAY/5UFl7nCIINFRxyMJY= cosmossdk.io/core v1.0.0-alpha.4/go.mod h1:3u9cWq1FAVtiiCrDPpo4LhR+9V6k/ycSG4/Y/tREWCY= cosmossdk.io/core/testing v0.0.0-20240923163230-04da382a9f29 h1:NxxUo0GMJUbIuVg0R70e3cbn9eFTEuMr7ev1AFvypdY= diff --git a/server/v2/cometbft/go.mod b/server/v2/cometbft/go.mod index 46a403768850..89e3c93d112f 100644 --- a/server/v2/cometbft/go.mod +++ b/server/v2/cometbft/go.mod @@ -41,8 +41,8 @@ require ( ) require ( - buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect - buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect + buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 // indirect + buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 // indirect cosmossdk.io/core/testing v0.0.0-20240923163230-04da382a9f29 // indirect cosmossdk.io/depinject v1.0.0 // indirect cosmossdk.io/errors v1.0.1 // indirect diff --git a/server/v2/cometbft/go.sum b/server/v2/cometbft/go.sum index 311e601f7d43..f248d60a370d 100644 --- a/server/v2/cometbft/go.sum +++ b/server/v2/cometbft/go.sum @@ -1,7 +1,7 @@ -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 h1:90/4O5QkHb8EZdA2SAhueRzYw6u5ZHCPKtReFqshnTY= -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2/go.mod h1:1+3gJj2NvZ1mTLAtHu+lMhOjGgQPiCKCeo+9MBww0Eo= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 h1:b7EEYTUHmWSBEyISHlHvXbJPqtKiHRuUignL1tsHnNQ= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2/go.mod h1:HqcXMSa5qnNuakaMUo+hWhF51mKbcrZxGl9Vp5EeJXc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 h1:DIUSA9vcIz63uUotWfbXXlwv1iTL+C0O2kEMLsnIIbc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1/go.mod h1:JTBMfyi+qAXUHumX+rcD2WIq9FNWmdcNh5MjBnSw0L0= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 h1:F78ecjvMtgd1aZ1Aj9cvBjURxVGCYvRM+OOy5eR+pjw= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1/go.mod h1:zqi/LZjZhyvjCMTEVIwAf5VRlkLduuCfqmZxgoormq0= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= diff --git a/simapp/go.mod b/simapp/go.mod index 7adefe7f1f51..4885801831da 100644 --- a/simapp/go.mod +++ b/simapp/go.mod @@ -53,8 +53,8 @@ require ( ) require ( - buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect - buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect + buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 // indirect + buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 // indirect cloud.google.com/go v0.115.1 // indirect cloud.google.com/go/auth v0.8.1 // indirect cloud.google.com/go/auth/oauth2adapt v0.2.4 // indirect diff --git a/simapp/go.sum b/simapp/go.sum index 640946116d42..16288a075bd5 100644 --- a/simapp/go.sum +++ b/simapp/go.sum @@ -1,7 +1,7 @@ -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 h1:90/4O5QkHb8EZdA2SAhueRzYw6u5ZHCPKtReFqshnTY= -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2/go.mod h1:1+3gJj2NvZ1mTLAtHu+lMhOjGgQPiCKCeo+9MBww0Eo= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 h1:b7EEYTUHmWSBEyISHlHvXbJPqtKiHRuUignL1tsHnNQ= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2/go.mod h1:HqcXMSa5qnNuakaMUo+hWhF51mKbcrZxGl9Vp5EeJXc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 h1:DIUSA9vcIz63uUotWfbXXlwv1iTL+C0O2kEMLsnIIbc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1/go.mod h1:JTBMfyi+qAXUHumX+rcD2WIq9FNWmdcNh5MjBnSw0L0= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 h1:F78ecjvMtgd1aZ1Aj9cvBjURxVGCYvRM+OOy5eR+pjw= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1/go.mod h1:zqi/LZjZhyvjCMTEVIwAf5VRlkLduuCfqmZxgoormq0= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= diff --git a/simapp/v2/go.mod b/simapp/v2/go.mod index 1ae8b374709f..85371497dbb6 100644 --- a/simapp/v2/go.mod +++ b/simapp/v2/go.mod @@ -49,8 +49,8 @@ require ( ) require ( - buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect - buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect + buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 // indirect + buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 // indirect cloud.google.com/go v0.115.1 // indirect cloud.google.com/go/auth v0.8.1 // indirect cloud.google.com/go/auth/oauth2adapt v0.2.4 // indirect diff --git a/simapp/v2/go.sum b/simapp/v2/go.sum index c64c8320652f..a3a95a365dee 100644 --- a/simapp/v2/go.sum +++ b/simapp/v2/go.sum @@ -1,7 +1,7 @@ -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 h1:90/4O5QkHb8EZdA2SAhueRzYw6u5ZHCPKtReFqshnTY= -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2/go.mod h1:1+3gJj2NvZ1mTLAtHu+lMhOjGgQPiCKCeo+9MBww0Eo= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 h1:b7EEYTUHmWSBEyISHlHvXbJPqtKiHRuUignL1tsHnNQ= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2/go.mod h1:HqcXMSa5qnNuakaMUo+hWhF51mKbcrZxGl9Vp5EeJXc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 h1:DIUSA9vcIz63uUotWfbXXlwv1iTL+C0O2kEMLsnIIbc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1/go.mod h1:JTBMfyi+qAXUHumX+rcD2WIq9FNWmdcNh5MjBnSw0L0= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 h1:F78ecjvMtgd1aZ1Aj9cvBjURxVGCYvRM+OOy5eR+pjw= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1/go.mod h1:zqi/LZjZhyvjCMTEVIwAf5VRlkLduuCfqmZxgoormq0= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= diff --git a/tests/go.mod b/tests/go.mod index 7cebd970e657..786ef4f455a0 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -55,8 +55,8 @@ require ( ) require ( - buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect - buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect + buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 // indirect + buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 // indirect cloud.google.com/go v0.115.1 // indirect cloud.google.com/go/auth v0.8.1 // indirect cloud.google.com/go/auth/oauth2adapt v0.2.4 // indirect diff --git a/tests/go.sum b/tests/go.sum index f4a8e65b27be..1b718202ffe1 100644 --- a/tests/go.sum +++ b/tests/go.sum @@ -1,7 +1,7 @@ -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 h1:90/4O5QkHb8EZdA2SAhueRzYw6u5ZHCPKtReFqshnTY= -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2/go.mod h1:1+3gJj2NvZ1mTLAtHu+lMhOjGgQPiCKCeo+9MBww0Eo= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 h1:b7EEYTUHmWSBEyISHlHvXbJPqtKiHRuUignL1tsHnNQ= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2/go.mod h1:HqcXMSa5qnNuakaMUo+hWhF51mKbcrZxGl9Vp5EeJXc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 h1:DIUSA9vcIz63uUotWfbXXlwv1iTL+C0O2kEMLsnIIbc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1/go.mod h1:JTBMfyi+qAXUHumX+rcD2WIq9FNWmdcNh5MjBnSw0L0= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 h1:F78ecjvMtgd1aZ1Aj9cvBjURxVGCYvRM+OOy5eR+pjw= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1/go.mod h1:zqi/LZjZhyvjCMTEVIwAf5VRlkLduuCfqmZxgoormq0= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= diff --git a/x/accounts/defaults/base/go.mod b/x/accounts/defaults/base/go.mod index 50c7b6e3ca62..b3fae40a91df 100644 --- a/x/accounts/defaults/base/go.mod +++ b/x/accounts/defaults/base/go.mod @@ -17,8 +17,8 @@ require ( ) require ( - buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect - buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect + buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 // indirect + buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 // indirect cosmossdk.io/core/testing v0.0.0-20240923163230-04da382a9f29 // indirect cosmossdk.io/errors v1.0.1 // indirect cosmossdk.io/log v1.4.1 // indirect diff --git a/x/accounts/defaults/base/go.sum b/x/accounts/defaults/base/go.sum index 72343047ffd5..41381a89bab9 100644 --- a/x/accounts/defaults/base/go.sum +++ b/x/accounts/defaults/base/go.sum @@ -1,7 +1,7 @@ -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 h1:90/4O5QkHb8EZdA2SAhueRzYw6u5ZHCPKtReFqshnTY= -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2/go.mod h1:1+3gJj2NvZ1mTLAtHu+lMhOjGgQPiCKCeo+9MBww0Eo= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 h1:b7EEYTUHmWSBEyISHlHvXbJPqtKiHRuUignL1tsHnNQ= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2/go.mod h1:HqcXMSa5qnNuakaMUo+hWhF51mKbcrZxGl9Vp5EeJXc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 h1:DIUSA9vcIz63uUotWfbXXlwv1iTL+C0O2kEMLsnIIbc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1/go.mod h1:JTBMfyi+qAXUHumX+rcD2WIq9FNWmdcNh5MjBnSw0L0= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 h1:F78ecjvMtgd1aZ1Aj9cvBjURxVGCYvRM+OOy5eR+pjw= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1/go.mod h1:zqi/LZjZhyvjCMTEVIwAf5VRlkLduuCfqmZxgoormq0= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/core v1.0.0-alpha.4 h1:9iuroT9ejDYETCsGkzkvs/wAY/5UFl7nCIINFRxyMJY= diff --git a/x/accounts/defaults/lockup/go.mod b/x/accounts/defaults/lockup/go.mod index fcda08a89adb..abff5b67217d 100644 --- a/x/accounts/defaults/lockup/go.mod +++ b/x/accounts/defaults/lockup/go.mod @@ -14,8 +14,8 @@ require ( ) require ( - buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect - buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect + buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 // indirect + buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 // indirect cosmossdk.io/api v0.7.6 // indirect cosmossdk.io/core/testing v0.0.0-20240923163230-04da382a9f29 // indirect cosmossdk.io/depinject v1.0.0 // indirect diff --git a/x/accounts/defaults/lockup/go.sum b/x/accounts/defaults/lockup/go.sum index 5173c72592b8..0ad92c23bcbd 100644 --- a/x/accounts/defaults/lockup/go.sum +++ b/x/accounts/defaults/lockup/go.sum @@ -1,7 +1,7 @@ -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 h1:90/4O5QkHb8EZdA2SAhueRzYw6u5ZHCPKtReFqshnTY= -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2/go.mod h1:1+3gJj2NvZ1mTLAtHu+lMhOjGgQPiCKCeo+9MBww0Eo= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 h1:b7EEYTUHmWSBEyISHlHvXbJPqtKiHRuUignL1tsHnNQ= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2/go.mod h1:HqcXMSa5qnNuakaMUo+hWhF51mKbcrZxGl9Vp5EeJXc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 h1:DIUSA9vcIz63uUotWfbXXlwv1iTL+C0O2kEMLsnIIbc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1/go.mod h1:JTBMfyi+qAXUHumX+rcD2WIq9FNWmdcNh5MjBnSw0L0= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 h1:F78ecjvMtgd1aZ1Aj9cvBjURxVGCYvRM+OOy5eR+pjw= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1/go.mod h1:zqi/LZjZhyvjCMTEVIwAf5VRlkLduuCfqmZxgoormq0= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/core v1.0.0-alpha.4 h1:9iuroT9ejDYETCsGkzkvs/wAY/5UFl7nCIINFRxyMJY= diff --git a/x/accounts/defaults/multisig/go.mod b/x/accounts/defaults/multisig/go.mod index 0d048b168cd2..1a52ed73ec60 100644 --- a/x/accounts/defaults/multisig/go.mod +++ b/x/accounts/defaults/multisig/go.mod @@ -16,8 +16,8 @@ require ( ) require ( - buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect - buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect + buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 // indirect + buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 // indirect cosmossdk.io/api v0.7.6 // indirect cosmossdk.io/core/testing v0.0.0-20240923163230-04da382a9f29 // indirect cosmossdk.io/depinject v1.0.0 // indirect diff --git a/x/accounts/defaults/multisig/go.sum b/x/accounts/defaults/multisig/go.sum index 72343047ffd5..41381a89bab9 100644 --- a/x/accounts/defaults/multisig/go.sum +++ b/x/accounts/defaults/multisig/go.sum @@ -1,7 +1,7 @@ -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 h1:90/4O5QkHb8EZdA2SAhueRzYw6u5ZHCPKtReFqshnTY= -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2/go.mod h1:1+3gJj2NvZ1mTLAtHu+lMhOjGgQPiCKCeo+9MBww0Eo= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 h1:b7EEYTUHmWSBEyISHlHvXbJPqtKiHRuUignL1tsHnNQ= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2/go.mod h1:HqcXMSa5qnNuakaMUo+hWhF51mKbcrZxGl9Vp5EeJXc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 h1:DIUSA9vcIz63uUotWfbXXlwv1iTL+C0O2kEMLsnIIbc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1/go.mod h1:JTBMfyi+qAXUHumX+rcD2WIq9FNWmdcNh5MjBnSw0L0= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 h1:F78ecjvMtgd1aZ1Aj9cvBjURxVGCYvRM+OOy5eR+pjw= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1/go.mod h1:zqi/LZjZhyvjCMTEVIwAf5VRlkLduuCfqmZxgoormq0= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/core v1.0.0-alpha.4 h1:9iuroT9ejDYETCsGkzkvs/wAY/5UFl7nCIINFRxyMJY= diff --git a/x/accounts/go.mod b/x/accounts/go.mod index 75a49ef00dd3..a7381834bc62 100644 --- a/x/accounts/go.mod +++ b/x/accounts/go.mod @@ -26,8 +26,8 @@ require ( ) require ( - buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect - buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect + buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 // indirect + buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 // indirect cosmossdk.io/errors v1.0.1 // indirect cosmossdk.io/log v1.4.1 // indirect cosmossdk.io/math v1.3.0 diff --git a/x/accounts/go.sum b/x/accounts/go.sum index 4d7d4939fa72..19d76b3ec23a 100644 --- a/x/accounts/go.sum +++ b/x/accounts/go.sum @@ -1,7 +1,7 @@ -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 h1:90/4O5QkHb8EZdA2SAhueRzYw6u5ZHCPKtReFqshnTY= -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2/go.mod h1:1+3gJj2NvZ1mTLAtHu+lMhOjGgQPiCKCeo+9MBww0Eo= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 h1:b7EEYTUHmWSBEyISHlHvXbJPqtKiHRuUignL1tsHnNQ= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2/go.mod h1:HqcXMSa5qnNuakaMUo+hWhF51mKbcrZxGl9Vp5EeJXc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 h1:DIUSA9vcIz63uUotWfbXXlwv1iTL+C0O2kEMLsnIIbc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1/go.mod h1:JTBMfyi+qAXUHumX+rcD2WIq9FNWmdcNh5MjBnSw0L0= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 h1:F78ecjvMtgd1aZ1Aj9cvBjURxVGCYvRM+OOy5eR+pjw= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1/go.mod h1:zqi/LZjZhyvjCMTEVIwAf5VRlkLduuCfqmZxgoormq0= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/core v1.0.0-alpha.4 h1:9iuroT9ejDYETCsGkzkvs/wAY/5UFl7nCIINFRxyMJY= diff --git a/x/authz/go.mod b/x/authz/go.mod index 1f83435bb72f..c7fa7d641a4a 100644 --- a/x/authz/go.mod +++ b/x/authz/go.mod @@ -27,8 +27,8 @@ require ( ) require ( - buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect - buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect + buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 // indirect + buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 // indirect cosmossdk.io/collections v0.4.0 // indirect cosmossdk.io/schema v0.3.1-0.20240930054013-7c6e0388a3f9 // indirect filippo.io/edwards25519 v1.1.0 // indirect diff --git a/x/authz/go.sum b/x/authz/go.sum index 4d7d4939fa72..19d76b3ec23a 100644 --- a/x/authz/go.sum +++ b/x/authz/go.sum @@ -1,7 +1,7 @@ -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 h1:90/4O5QkHb8EZdA2SAhueRzYw6u5ZHCPKtReFqshnTY= -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2/go.mod h1:1+3gJj2NvZ1mTLAtHu+lMhOjGgQPiCKCeo+9MBww0Eo= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 h1:b7EEYTUHmWSBEyISHlHvXbJPqtKiHRuUignL1tsHnNQ= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2/go.mod h1:HqcXMSa5qnNuakaMUo+hWhF51mKbcrZxGl9Vp5EeJXc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 h1:DIUSA9vcIz63uUotWfbXXlwv1iTL+C0O2kEMLsnIIbc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1/go.mod h1:JTBMfyi+qAXUHumX+rcD2WIq9FNWmdcNh5MjBnSw0L0= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 h1:F78ecjvMtgd1aZ1Aj9cvBjURxVGCYvRM+OOy5eR+pjw= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1/go.mod h1:zqi/LZjZhyvjCMTEVIwAf5VRlkLduuCfqmZxgoormq0= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/core v1.0.0-alpha.4 h1:9iuroT9ejDYETCsGkzkvs/wAY/5UFl7nCIINFRxyMJY= diff --git a/x/bank/go.mod b/x/bank/go.mod index 619a816df1a3..d8b14b6f04c3 100644 --- a/x/bank/go.mod +++ b/x/bank/go.mod @@ -28,8 +28,8 @@ require ( ) require ( - buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect - buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect + buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 // indirect + buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 // indirect cosmossdk.io/core/testing v0.0.0-20240923163230-04da382a9f29 cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/tx v0.13.3 // indirect diff --git a/x/bank/go.sum b/x/bank/go.sum index 4d7d4939fa72..19d76b3ec23a 100644 --- a/x/bank/go.sum +++ b/x/bank/go.sum @@ -1,7 +1,7 @@ -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 h1:90/4O5QkHb8EZdA2SAhueRzYw6u5ZHCPKtReFqshnTY= -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2/go.mod h1:1+3gJj2NvZ1mTLAtHu+lMhOjGgQPiCKCeo+9MBww0Eo= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 h1:b7EEYTUHmWSBEyISHlHvXbJPqtKiHRuUignL1tsHnNQ= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2/go.mod h1:HqcXMSa5qnNuakaMUo+hWhF51mKbcrZxGl9Vp5EeJXc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 h1:DIUSA9vcIz63uUotWfbXXlwv1iTL+C0O2kEMLsnIIbc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1/go.mod h1:JTBMfyi+qAXUHumX+rcD2WIq9FNWmdcNh5MjBnSw0L0= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 h1:F78ecjvMtgd1aZ1Aj9cvBjURxVGCYvRM+OOy5eR+pjw= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1/go.mod h1:zqi/LZjZhyvjCMTEVIwAf5VRlkLduuCfqmZxgoormq0= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/core v1.0.0-alpha.4 h1:9iuroT9ejDYETCsGkzkvs/wAY/5UFl7nCIINFRxyMJY= diff --git a/x/circuit/go.mod b/x/circuit/go.mod index 80d3c9de3dbc..793d1e0e629f 100644 --- a/x/circuit/go.mod +++ b/x/circuit/go.mod @@ -20,8 +20,8 @@ require ( ) require ( - buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect - buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect + buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 // indirect + buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 // indirect cosmossdk.io/log v1.4.1 // indirect cosmossdk.io/math v1.3.0 // indirect cosmossdk.io/schema v0.3.1-0.20240930054013-7c6e0388a3f9 // indirect diff --git a/x/circuit/go.sum b/x/circuit/go.sum index 32bdeed756c7..22beb1c7c24b 100644 --- a/x/circuit/go.sum +++ b/x/circuit/go.sum @@ -1,7 +1,7 @@ -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 h1:90/4O5QkHb8EZdA2SAhueRzYw6u5ZHCPKtReFqshnTY= -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2/go.mod h1:1+3gJj2NvZ1mTLAtHu+lMhOjGgQPiCKCeo+9MBww0Eo= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 h1:b7EEYTUHmWSBEyISHlHvXbJPqtKiHRuUignL1tsHnNQ= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2/go.mod h1:HqcXMSa5qnNuakaMUo+hWhF51mKbcrZxGl9Vp5EeJXc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 h1:DIUSA9vcIz63uUotWfbXXlwv1iTL+C0O2kEMLsnIIbc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1/go.mod h1:JTBMfyi+qAXUHumX+rcD2WIq9FNWmdcNh5MjBnSw0L0= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 h1:F78ecjvMtgd1aZ1Aj9cvBjURxVGCYvRM+OOy5eR+pjw= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1/go.mod h1:zqi/LZjZhyvjCMTEVIwAf5VRlkLduuCfqmZxgoormq0= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= diff --git a/x/consensus/go.mod b/x/consensus/go.mod index b33bdb6344f3..82cbefaea465 100644 --- a/x/consensus/go.mod +++ b/x/consensus/go.mod @@ -22,8 +22,8 @@ require ( ) require ( - buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect - buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect + buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 // indirect + buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 // indirect cosmossdk.io/errors v1.0.1 // indirect cosmossdk.io/log v1.4.1 // indirect cosmossdk.io/math v1.3.0 // indirect diff --git a/x/consensus/go.sum b/x/consensus/go.sum index 4c92f8acc3d6..7f7157c35eed 100644 --- a/x/consensus/go.sum +++ b/x/consensus/go.sum @@ -1,7 +1,7 @@ -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 h1:90/4O5QkHb8EZdA2SAhueRzYw6u5ZHCPKtReFqshnTY= -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2/go.mod h1:1+3gJj2NvZ1mTLAtHu+lMhOjGgQPiCKCeo+9MBww0Eo= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 h1:b7EEYTUHmWSBEyISHlHvXbJPqtKiHRuUignL1tsHnNQ= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2/go.mod h1:HqcXMSa5qnNuakaMUo+hWhF51mKbcrZxGl9Vp5EeJXc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 h1:DIUSA9vcIz63uUotWfbXXlwv1iTL+C0O2kEMLsnIIbc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1/go.mod h1:JTBMfyi+qAXUHumX+rcD2WIq9FNWmdcNh5MjBnSw0L0= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 h1:F78ecjvMtgd1aZ1Aj9cvBjURxVGCYvRM+OOy5eR+pjw= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1/go.mod h1:zqi/LZjZhyvjCMTEVIwAf5VRlkLduuCfqmZxgoormq0= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= diff --git a/x/distribution/go.mod b/x/distribution/go.mod index d930923ddf37..d4d493052eb1 100644 --- a/x/distribution/go.mod +++ b/x/distribution/go.mod @@ -26,8 +26,8 @@ require ( ) require ( - buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect - buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect + buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 // indirect + buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 // indirect cosmossdk.io/log v1.4.1 // indirect cosmossdk.io/schema v0.3.1-0.20240930054013-7c6e0388a3f9 // indirect cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91 // indirect diff --git a/x/distribution/go.sum b/x/distribution/go.sum index 4d7d4939fa72..19d76b3ec23a 100644 --- a/x/distribution/go.sum +++ b/x/distribution/go.sum @@ -1,7 +1,7 @@ -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 h1:90/4O5QkHb8EZdA2SAhueRzYw6u5ZHCPKtReFqshnTY= -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2/go.mod h1:1+3gJj2NvZ1mTLAtHu+lMhOjGgQPiCKCeo+9MBww0Eo= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 h1:b7EEYTUHmWSBEyISHlHvXbJPqtKiHRuUignL1tsHnNQ= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2/go.mod h1:HqcXMSa5qnNuakaMUo+hWhF51mKbcrZxGl9Vp5EeJXc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 h1:DIUSA9vcIz63uUotWfbXXlwv1iTL+C0O2kEMLsnIIbc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1/go.mod h1:JTBMfyi+qAXUHumX+rcD2WIq9FNWmdcNh5MjBnSw0L0= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 h1:F78ecjvMtgd1aZ1Aj9cvBjURxVGCYvRM+OOy5eR+pjw= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1/go.mod h1:zqi/LZjZhyvjCMTEVIwAf5VRlkLduuCfqmZxgoormq0= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/core v1.0.0-alpha.4 h1:9iuroT9ejDYETCsGkzkvs/wAY/5UFl7nCIINFRxyMJY= diff --git a/x/epochs/go.mod b/x/epochs/go.mod index 76282884976c..f7bf518fdd2d 100644 --- a/x/epochs/go.mod +++ b/x/epochs/go.mod @@ -23,8 +23,8 @@ require ( require cosmossdk.io/schema v0.3.1-0.20240930054013-7c6e0388a3f9 // indirect require ( - buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect - buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect + buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 // indirect + buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 // indirect cosmossdk.io/log v1.4.1 // indirect cosmossdk.io/math v1.3.0 // indirect cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91 // indirect diff --git a/x/epochs/go.sum b/x/epochs/go.sum index 4c92f8acc3d6..7f7157c35eed 100644 --- a/x/epochs/go.sum +++ b/x/epochs/go.sum @@ -1,7 +1,7 @@ -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 h1:90/4O5QkHb8EZdA2SAhueRzYw6u5ZHCPKtReFqshnTY= -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2/go.mod h1:1+3gJj2NvZ1mTLAtHu+lMhOjGgQPiCKCeo+9MBww0Eo= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 h1:b7EEYTUHmWSBEyISHlHvXbJPqtKiHRuUignL1tsHnNQ= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2/go.mod h1:HqcXMSa5qnNuakaMUo+hWhF51mKbcrZxGl9Vp5EeJXc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 h1:DIUSA9vcIz63uUotWfbXXlwv1iTL+C0O2kEMLsnIIbc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1/go.mod h1:JTBMfyi+qAXUHumX+rcD2WIq9FNWmdcNh5MjBnSw0L0= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 h1:F78ecjvMtgd1aZ1Aj9cvBjURxVGCYvRM+OOy5eR+pjw= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1/go.mod h1:zqi/LZjZhyvjCMTEVIwAf5VRlkLduuCfqmZxgoormq0= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= diff --git a/x/evidence/go.mod b/x/evidence/go.mod index ee4784f1bb35..830b3e5f3685 100644 --- a/x/evidence/go.mod +++ b/x/evidence/go.mod @@ -25,8 +25,8 @@ require ( ) require ( - buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect - buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect + buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 // indirect + buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 // indirect cosmossdk.io/log v1.4.1 // indirect cosmossdk.io/schema v0.3.1-0.20240930054013-7c6e0388a3f9 // indirect cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91 // indirect diff --git a/x/evidence/go.sum b/x/evidence/go.sum index 32bdeed756c7..22beb1c7c24b 100644 --- a/x/evidence/go.sum +++ b/x/evidence/go.sum @@ -1,7 +1,7 @@ -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 h1:90/4O5QkHb8EZdA2SAhueRzYw6u5ZHCPKtReFqshnTY= -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2/go.mod h1:1+3gJj2NvZ1mTLAtHu+lMhOjGgQPiCKCeo+9MBww0Eo= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 h1:b7EEYTUHmWSBEyISHlHvXbJPqtKiHRuUignL1tsHnNQ= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2/go.mod h1:HqcXMSa5qnNuakaMUo+hWhF51mKbcrZxGl9Vp5EeJXc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 h1:DIUSA9vcIz63uUotWfbXXlwv1iTL+C0O2kEMLsnIIbc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1/go.mod h1:JTBMfyi+qAXUHumX+rcD2WIq9FNWmdcNh5MjBnSw0L0= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 h1:F78ecjvMtgd1aZ1Aj9cvBjURxVGCYvRM+OOy5eR+pjw= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1/go.mod h1:zqi/LZjZhyvjCMTEVIwAf5VRlkLduuCfqmZxgoormq0= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= diff --git a/x/feegrant/go.mod b/x/feegrant/go.mod index be9061fa3ad3..3dcbec2c3d85 100644 --- a/x/feegrant/go.mod +++ b/x/feegrant/go.mod @@ -34,8 +34,8 @@ require ( ) require ( - buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect - buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect + buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 // indirect + buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 // indirect cosmossdk.io/log v1.4.1 // indirect cosmossdk.io/schema v0.3.1-0.20240930054013-7c6e0388a3f9 // indirect cosmossdk.io/x/protocolpool v0.0.0-20230925135524-a1bc045b3190 // indirect diff --git a/x/feegrant/go.sum b/x/feegrant/go.sum index 9d5ec6f2fe78..24c27ebed8a4 100644 --- a/x/feegrant/go.sum +++ b/x/feegrant/go.sum @@ -1,7 +1,7 @@ -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 h1:90/4O5QkHb8EZdA2SAhueRzYw6u5ZHCPKtReFqshnTY= -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2/go.mod h1:1+3gJj2NvZ1mTLAtHu+lMhOjGgQPiCKCeo+9MBww0Eo= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 h1:b7EEYTUHmWSBEyISHlHvXbJPqtKiHRuUignL1tsHnNQ= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2/go.mod h1:HqcXMSa5qnNuakaMUo+hWhF51mKbcrZxGl9Vp5EeJXc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 h1:DIUSA9vcIz63uUotWfbXXlwv1iTL+C0O2kEMLsnIIbc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1/go.mod h1:JTBMfyi+qAXUHumX+rcD2WIq9FNWmdcNh5MjBnSw0L0= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 h1:F78ecjvMtgd1aZ1Aj9cvBjURxVGCYvRM+OOy5eR+pjw= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1/go.mod h1:zqi/LZjZhyvjCMTEVIwAf5VRlkLduuCfqmZxgoormq0= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/core v1.0.0-alpha.4 h1:9iuroT9ejDYETCsGkzkvs/wAY/5UFl7nCIINFRxyMJY= diff --git a/x/gov/go.mod b/x/gov/go.mod index aa00aff38213..a0fe618a5af1 100644 --- a/x/gov/go.mod +++ b/x/gov/go.mod @@ -33,8 +33,8 @@ require ( ) require ( - buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect - buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect + buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 // indirect + buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 // indirect cosmossdk.io/schema v0.3.1-0.20240930054013-7c6e0388a3f9 // indirect cosmossdk.io/x/tx v0.13.3 // indirect filippo.io/edwards25519 v1.1.0 // indirect diff --git a/x/gov/go.sum b/x/gov/go.sum index 44543b2fdd80..75d64ba2c563 100644 --- a/x/gov/go.sum +++ b/x/gov/go.sum @@ -1,7 +1,7 @@ -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 h1:90/4O5QkHb8EZdA2SAhueRzYw6u5ZHCPKtReFqshnTY= -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2/go.mod h1:1+3gJj2NvZ1mTLAtHu+lMhOjGgQPiCKCeo+9MBww0Eo= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 h1:b7EEYTUHmWSBEyISHlHvXbJPqtKiHRuUignL1tsHnNQ= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2/go.mod h1:HqcXMSa5qnNuakaMUo+hWhF51mKbcrZxGl9Vp5EeJXc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 h1:DIUSA9vcIz63uUotWfbXXlwv1iTL+C0O2kEMLsnIIbc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1/go.mod h1:JTBMfyi+qAXUHumX+rcD2WIq9FNWmdcNh5MjBnSw0L0= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 h1:F78ecjvMtgd1aZ1Aj9cvBjURxVGCYvRM+OOy5eR+pjw= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1/go.mod h1:zqi/LZjZhyvjCMTEVIwAf5VRlkLduuCfqmZxgoormq0= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/core v1.0.0-alpha.4 h1:9iuroT9ejDYETCsGkzkvs/wAY/5UFl7nCIINFRxyMJY= diff --git a/x/group/go.mod b/x/group/go.mod index 3bcfadb12dbd..2557151fc2cb 100644 --- a/x/group/go.mod +++ b/x/group/go.mod @@ -35,8 +35,8 @@ require ( ) require ( - buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect - buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect + buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 // indirect + buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 // indirect cosmossdk.io/collections v0.4.0 // indirect cosmossdk.io/schema v0.3.1-0.20240930054013-7c6e0388a3f9 // indirect cosmossdk.io/x/epochs v0.0.0-20240522060652-a1ae4c3e0337 // indirect diff --git a/x/group/go.sum b/x/group/go.sum index 3a730ba75617..d438e2dbd1c1 100644 --- a/x/group/go.sum +++ b/x/group/go.sum @@ -1,7 +1,7 @@ -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 h1:90/4O5QkHb8EZdA2SAhueRzYw6u5ZHCPKtReFqshnTY= -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2/go.mod h1:1+3gJj2NvZ1mTLAtHu+lMhOjGgQPiCKCeo+9MBww0Eo= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 h1:b7EEYTUHmWSBEyISHlHvXbJPqtKiHRuUignL1tsHnNQ= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2/go.mod h1:HqcXMSa5qnNuakaMUo+hWhF51mKbcrZxGl9Vp5EeJXc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 h1:DIUSA9vcIz63uUotWfbXXlwv1iTL+C0O2kEMLsnIIbc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1/go.mod h1:JTBMfyi+qAXUHumX+rcD2WIq9FNWmdcNh5MjBnSw0L0= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 h1:F78ecjvMtgd1aZ1Aj9cvBjURxVGCYvRM+OOy5eR+pjw= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1/go.mod h1:zqi/LZjZhyvjCMTEVIwAf5VRlkLduuCfqmZxgoormq0= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/core v1.0.0-alpha.4 h1:9iuroT9ejDYETCsGkzkvs/wAY/5UFl7nCIINFRxyMJY= diff --git a/x/mint/go.mod b/x/mint/go.mod index 3fa424b75c6f..47b03c3054f6 100644 --- a/x/mint/go.mod +++ b/x/mint/go.mod @@ -27,8 +27,8 @@ require ( ) require ( - buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect - buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect + buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 // indirect + buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 // indirect cosmossdk.io/schema v0.3.1-0.20240930054013-7c6e0388a3f9 // indirect cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91 // indirect cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 // indirect diff --git a/x/mint/go.sum b/x/mint/go.sum index 32bdeed756c7..22beb1c7c24b 100644 --- a/x/mint/go.sum +++ b/x/mint/go.sum @@ -1,7 +1,7 @@ -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 h1:90/4O5QkHb8EZdA2SAhueRzYw6u5ZHCPKtReFqshnTY= -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2/go.mod h1:1+3gJj2NvZ1mTLAtHu+lMhOjGgQPiCKCeo+9MBww0Eo= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 h1:b7EEYTUHmWSBEyISHlHvXbJPqtKiHRuUignL1tsHnNQ= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2/go.mod h1:HqcXMSa5qnNuakaMUo+hWhF51mKbcrZxGl9Vp5EeJXc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 h1:DIUSA9vcIz63uUotWfbXXlwv1iTL+C0O2kEMLsnIIbc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1/go.mod h1:JTBMfyi+qAXUHumX+rcD2WIq9FNWmdcNh5MjBnSw0L0= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 h1:F78ecjvMtgd1aZ1Aj9cvBjURxVGCYvRM+OOy5eR+pjw= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1/go.mod h1:zqi/LZjZhyvjCMTEVIwAf5VRlkLduuCfqmZxgoormq0= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= diff --git a/x/nft/go.mod b/x/nft/go.mod index 218cf068c65e..1173c73301f2 100644 --- a/x/nft/go.mod +++ b/x/nft/go.mod @@ -22,8 +22,8 @@ require ( ) require ( - buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect - buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect + buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 // indirect + buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 // indirect cosmossdk.io/collections v0.4.0 // indirect cosmossdk.io/core/testing v0.0.0-20240923163230-04da382a9f29 // indirect cosmossdk.io/schema v0.3.1-0.20240930054013-7c6e0388a3f9 // indirect diff --git a/x/nft/go.sum b/x/nft/go.sum index 32bdeed756c7..22beb1c7c24b 100644 --- a/x/nft/go.sum +++ b/x/nft/go.sum @@ -1,7 +1,7 @@ -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 h1:90/4O5QkHb8EZdA2SAhueRzYw6u5ZHCPKtReFqshnTY= -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2/go.mod h1:1+3gJj2NvZ1mTLAtHu+lMhOjGgQPiCKCeo+9MBww0Eo= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 h1:b7EEYTUHmWSBEyISHlHvXbJPqtKiHRuUignL1tsHnNQ= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2/go.mod h1:HqcXMSa5qnNuakaMUo+hWhF51mKbcrZxGl9Vp5EeJXc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 h1:DIUSA9vcIz63uUotWfbXXlwv1iTL+C0O2kEMLsnIIbc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1/go.mod h1:JTBMfyi+qAXUHumX+rcD2WIq9FNWmdcNh5MjBnSw0L0= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 h1:F78ecjvMtgd1aZ1Aj9cvBjURxVGCYvRM+OOy5eR+pjw= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1/go.mod h1:zqi/LZjZhyvjCMTEVIwAf5VRlkLduuCfqmZxgoormq0= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= diff --git a/x/params/go.mod b/x/params/go.mod index 3c17e2ee24e7..902a2bd521ae 100644 --- a/x/params/go.mod +++ b/x/params/go.mod @@ -26,8 +26,8 @@ require ( ) require ( - buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect - buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect + buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 // indirect + buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 // indirect cosmossdk.io/collections v0.4.0 // indirect cosmossdk.io/schema v0.3.1-0.20240930054013-7c6e0388a3f9 // indirect cosmossdk.io/x/tx v0.13.3 // indirect diff --git a/x/params/go.sum b/x/params/go.sum index b4a09a3147fc..dbf213cb524a 100644 --- a/x/params/go.sum +++ b/x/params/go.sum @@ -1,7 +1,7 @@ -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 h1:90/4O5QkHb8EZdA2SAhueRzYw6u5ZHCPKtReFqshnTY= -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2/go.mod h1:1+3gJj2NvZ1mTLAtHu+lMhOjGgQPiCKCeo+9MBww0Eo= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 h1:b7EEYTUHmWSBEyISHlHvXbJPqtKiHRuUignL1tsHnNQ= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2/go.mod h1:HqcXMSa5qnNuakaMUo+hWhF51mKbcrZxGl9Vp5EeJXc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 h1:DIUSA9vcIz63uUotWfbXXlwv1iTL+C0O2kEMLsnIIbc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1/go.mod h1:JTBMfyi+qAXUHumX+rcD2WIq9FNWmdcNh5MjBnSw0L0= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 h1:F78ecjvMtgd1aZ1Aj9cvBjURxVGCYvRM+OOy5eR+pjw= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1/go.mod h1:zqi/LZjZhyvjCMTEVIwAf5VRlkLduuCfqmZxgoormq0= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= diff --git a/x/protocolpool/go.mod b/x/protocolpool/go.mod index 68a32e3a3a09..bfdbb3242e4c 100644 --- a/x/protocolpool/go.mod +++ b/x/protocolpool/go.mod @@ -24,8 +24,8 @@ require ( ) require ( - buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect - buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect + buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 // indirect + buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 // indirect cosmossdk.io/log v1.4.1 // indirect cosmossdk.io/schema v0.3.1-0.20240930054013-7c6e0388a3f9 // indirect cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91 // indirect diff --git a/x/protocolpool/go.sum b/x/protocolpool/go.sum index 32bdeed756c7..22beb1c7c24b 100644 --- a/x/protocolpool/go.sum +++ b/x/protocolpool/go.sum @@ -1,7 +1,7 @@ -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 h1:90/4O5QkHb8EZdA2SAhueRzYw6u5ZHCPKtReFqshnTY= -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2/go.mod h1:1+3gJj2NvZ1mTLAtHu+lMhOjGgQPiCKCeo+9MBww0Eo= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 h1:b7EEYTUHmWSBEyISHlHvXbJPqtKiHRuUignL1tsHnNQ= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2/go.mod h1:HqcXMSa5qnNuakaMUo+hWhF51mKbcrZxGl9Vp5EeJXc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 h1:DIUSA9vcIz63uUotWfbXXlwv1iTL+C0O2kEMLsnIIbc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1/go.mod h1:JTBMfyi+qAXUHumX+rcD2WIq9FNWmdcNh5MjBnSw0L0= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 h1:F78ecjvMtgd1aZ1Aj9cvBjURxVGCYvRM+OOy5eR+pjw= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1/go.mod h1:zqi/LZjZhyvjCMTEVIwAf5VRlkLduuCfqmZxgoormq0= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= diff --git a/x/slashing/go.mod b/x/slashing/go.mod index c68f85babc20..2384cf3f5232 100644 --- a/x/slashing/go.mod +++ b/x/slashing/go.mod @@ -27,8 +27,8 @@ require ( ) require ( - buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect - buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect + buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 // indirect + buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 // indirect cosmossdk.io/log v1.4.1 // indirect cosmossdk.io/schema v0.3.1-0.20240930054013-7c6e0388a3f9 // indirect cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91 // indirect diff --git a/x/slashing/go.sum b/x/slashing/go.sum index 63c75b76d330..365e63a28ebe 100644 --- a/x/slashing/go.sum +++ b/x/slashing/go.sum @@ -1,7 +1,7 @@ -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 h1:90/4O5QkHb8EZdA2SAhueRzYw6u5ZHCPKtReFqshnTY= -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2/go.mod h1:1+3gJj2NvZ1mTLAtHu+lMhOjGgQPiCKCeo+9MBww0Eo= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 h1:b7EEYTUHmWSBEyISHlHvXbJPqtKiHRuUignL1tsHnNQ= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2/go.mod h1:HqcXMSa5qnNuakaMUo+hWhF51mKbcrZxGl9Vp5EeJXc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 h1:DIUSA9vcIz63uUotWfbXXlwv1iTL+C0O2kEMLsnIIbc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1/go.mod h1:JTBMfyi+qAXUHumX+rcD2WIq9FNWmdcNh5MjBnSw0L0= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 h1:F78ecjvMtgd1aZ1Aj9cvBjURxVGCYvRM+OOy5eR+pjw= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1/go.mod h1:zqi/LZjZhyvjCMTEVIwAf5VRlkLduuCfqmZxgoormq0= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= diff --git a/x/staking/go.mod b/x/staking/go.mod index b6cd0cf1a177..f82ffe3a4915 100644 --- a/x/staking/go.mod +++ b/x/staking/go.mod @@ -29,7 +29,7 @@ require ( ) require ( - buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect + buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 // indirect cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91 // indirect cosmossdk.io/x/tx v0.13.3 // indirect filippo.io/edwards25519 v1.1.0 // indirect @@ -151,7 +151,7 @@ require ( ) require ( - buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect + buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 // indirect cosmossdk.io/log v1.4.1 github.com/cosmos/crypto v0.1.2 // indirect github.com/dgraph-io/badger/v4 v4.3.0 // indirect diff --git a/x/staking/go.sum b/x/staking/go.sum index 4d7d4939fa72..19d76b3ec23a 100644 --- a/x/staking/go.sum +++ b/x/staking/go.sum @@ -1,7 +1,7 @@ -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 h1:90/4O5QkHb8EZdA2SAhueRzYw6u5ZHCPKtReFqshnTY= -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2/go.mod h1:1+3gJj2NvZ1mTLAtHu+lMhOjGgQPiCKCeo+9MBww0Eo= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 h1:b7EEYTUHmWSBEyISHlHvXbJPqtKiHRuUignL1tsHnNQ= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2/go.mod h1:HqcXMSa5qnNuakaMUo+hWhF51mKbcrZxGl9Vp5EeJXc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 h1:DIUSA9vcIz63uUotWfbXXlwv1iTL+C0O2kEMLsnIIbc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1/go.mod h1:JTBMfyi+qAXUHumX+rcD2WIq9FNWmdcNh5MjBnSw0L0= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 h1:F78ecjvMtgd1aZ1Aj9cvBjURxVGCYvRM+OOy5eR+pjw= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1/go.mod h1:zqi/LZjZhyvjCMTEVIwAf5VRlkLduuCfqmZxgoormq0= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/core v1.0.0-alpha.4 h1:9iuroT9ejDYETCsGkzkvs/wAY/5UFl7nCIINFRxyMJY= diff --git a/x/upgrade/go.mod b/x/upgrade/go.mod index 7f9a2eafcd9e..21f27de763cc 100644 --- a/x/upgrade/go.mod +++ b/x/upgrade/go.mod @@ -32,8 +32,8 @@ require ( ) require ( - buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect - buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect + buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 // indirect + buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 // indirect cloud.google.com/go v0.115.1 // indirect cloud.google.com/go/auth v0.8.1 // indirect cloud.google.com/go/auth/oauth2adapt v0.2.4 // indirect diff --git a/x/upgrade/go.sum b/x/upgrade/go.sum index 026ac0a983fc..18eaeacc6e12 100644 --- a/x/upgrade/go.sum +++ b/x/upgrade/go.sum @@ -1,7 +1,7 @@ -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 h1:90/4O5QkHb8EZdA2SAhueRzYw6u5ZHCPKtReFqshnTY= -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2/go.mod h1:1+3gJj2NvZ1mTLAtHu+lMhOjGgQPiCKCeo+9MBww0Eo= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 h1:b7EEYTUHmWSBEyISHlHvXbJPqtKiHRuUignL1tsHnNQ= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2/go.mod h1:HqcXMSa5qnNuakaMUo+hWhF51mKbcrZxGl9Vp5EeJXc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 h1:DIUSA9vcIz63uUotWfbXXlwv1iTL+C0O2kEMLsnIIbc= +buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1/go.mod h1:JTBMfyi+qAXUHumX+rcD2WIq9FNWmdcNh5MjBnSw0L0= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 h1:F78ecjvMtgd1aZ1Aj9cvBjURxVGCYvRM+OOy5eR+pjw= +buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1/go.mod h1:zqi/LZjZhyvjCMTEVIwAf5VRlkLduuCfqmZxgoormq0= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= From ee3d320eaa55e5aab1bf216f03a8d8aa5833d549 Mon Sep 17 00:00:00 2001 From: Hoa Nguyen Date: Tue, 15 Oct 2024 21:00:36 +0700 Subject: [PATCH 38/57] chore(server): bump cosmossdk.io/core and correct comment naming (#22245) --- server/v2/appmanager/go.mod | 2 +- server/v2/appmanager/go.sum | 4 ++-- server/v2/cometbft/abci.go | 2 +- server/v2/cometbft/internal/mock/mock_reader.go | 2 +- server/v2/stf/core_router_service.go | 2 +- server/v2/stf/gas/defaults.go | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/server/v2/appmanager/go.mod b/server/v2/appmanager/go.mod index 110213b868b9..381fca3bdd29 100644 --- a/server/v2/appmanager/go.mod +++ b/server/v2/appmanager/go.mod @@ -2,6 +2,6 @@ module cosmossdk.io/server/v2/appmanager go 1.23 -require cosmossdk.io/core v1.0.0-alpha.3 +require cosmossdk.io/core v1.0.0-alpha.4 require cosmossdk.io/schema v0.3.0 // indirect diff --git a/server/v2/appmanager/go.sum b/server/v2/appmanager/go.sum index e5d225b85b5e..f798f0c9257f 100644 --- a/server/v2/appmanager/go.sum +++ b/server/v2/appmanager/go.sum @@ -1,4 +1,4 @@ -cosmossdk.io/core v1.0.0-alpha.3 h1:pnxaYAas7llXgVz1lM7X6De74nWrhNKnB3yMKe4OUUA= -cosmossdk.io/core v1.0.0-alpha.3/go.mod h1:3u9cWq1FAVtiiCrDPpo4LhR+9V6k/ycSG4/Y/tREWCY= +cosmossdk.io/core v1.0.0-alpha.4 h1:9iuroT9ejDYETCsGkzkvs/wAY/5UFl7nCIINFRxyMJY= +cosmossdk.io/core v1.0.0-alpha.4/go.mod h1:3u9cWq1FAVtiiCrDPpo4LhR+9V6k/ycSG4/Y/tREWCY= cosmossdk.io/schema v0.3.0 h1:01lcaM4trhzZ1HQTfTV8z6Ma1GziOZ/YmdzBN3F720c= cosmossdk.io/schema v0.3.0/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= diff --git a/server/v2/cometbft/abci.go b/server/v2/cometbft/abci.go index f64ecb5b8c11..d9e20a8ebe65 100644 --- a/server/v2/cometbft/abci.go +++ b/server/v2/cometbft/abci.go @@ -242,7 +242,7 @@ func (c *Consensus[T]) Query(ctx context.Context, req *abciproto.QueryRequest) ( } func (c *Consensus[T]) maybeRunGRPCQuery(ctx context.Context, req *abci.QueryRequest) (resp *abciproto.QueryResponse, isGRPC bool, err error) { - // if this fails then we cannot serve queries anymore + // if this fails then we cannot serve queries anymore registry, err := c.getProtoRegistry() if err != nil { return nil, false, err diff --git a/server/v2/cometbft/internal/mock/mock_reader.go b/server/v2/cometbft/internal/mock/mock_reader.go index 7638fc3f115b..9911ee55eb81 100644 --- a/server/v2/cometbft/internal/mock/mock_reader.go +++ b/server/v2/cometbft/internal/mock/mock_reader.go @@ -23,7 +23,7 @@ func (roa *ReaderMap) GetReader(actor []byte) (corestore.Reader, error) { return NewMockReader(roa.version, roa.store, actor), nil } -// Reader represents a read-only adapter for accessing data from the root store. +// MockReader represents a read-only adapter for accessing data from the root store. type MockReader struct { version uint64 // The version of the data. store *MockStore // The root store to read data from. diff --git a/server/v2/stf/core_router_service.go b/server/v2/stf/core_router_service.go index e3a3f95940a6..7506372b8e9d 100644 --- a/server/v2/stf/core_router_service.go +++ b/server/v2/stf/core_router_service.go @@ -60,7 +60,7 @@ func (m queryRouterService) CanInvoke(ctx context.Context, typeURL string) error return exCtx.queryRouter.CanInvoke(ctx, typeURL) } -// InvokeUntyped execute a message and returns a response. +// Invoke execute a message and returns a response. func (m queryRouterService) Invoke( ctx context.Context, req transaction.Msg, diff --git a/server/v2/stf/gas/defaults.go b/server/v2/stf/gas/defaults.go index 5b032e81da7e..54d092a83bbb 100644 --- a/server/v2/stf/gas/defaults.go +++ b/server/v2/stf/gas/defaults.go @@ -23,7 +23,7 @@ func DefaultGasMeter(gasLimit uint64) coregas.Meter { return NewMeter(gasLimit) } -// DefaultGasConfig returns the default gas config. +// DefaultConfig returns the default gas config. // Unless overridden, the default gas costs are: var DefaultConfig = coregas.GasConfig{ HasCost: 1000, From 4adbd6faddb039051c52ba48b7f762e6d6a7ee36 Mon Sep 17 00:00:00 2001 From: Wukingbow <389092100@qq.com> Date: Wed, 16 Oct 2024 22:08:01 +0800 Subject: [PATCH 39/57] docs: add comments for funcs (#22279) --- crypto/keyring/autocli.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crypto/keyring/autocli.go b/crypto/keyring/autocli.go index 26f39b3e4362..9af9f1528729 100644 --- a/crypto/keyring/autocli.go +++ b/crypto/keyring/autocli.go @@ -30,7 +30,7 @@ type autoCLIKeyring interface { KeyInfo(name string) (string, string, uint, error) } -// NewAutoCLIKeyring wraps the SDK keyring and make it compatible with the AutoCLI keyring interfaces. +// NewAutoCLIKeyring wraps the SDK keyring and makes it compatible with the AutoCLI keyring interfaces. func NewAutoCLIKeyring(kr Keyring, ac address.Codec) (autoCLIKeyring, error) { return &autoCLIKeyringAdapter{kr, ac}, nil } @@ -40,6 +40,7 @@ type autoCLIKeyringAdapter struct { ac address.Codec } +// List returns the names of all keys stored in the keyring. func (a *autoCLIKeyringAdapter) List() ([]string, error) { list, err := a.Keyring.List() if err != nil { @@ -69,6 +70,7 @@ func (a *autoCLIKeyringAdapter) LookupAddressByKeyName(name string) ([]byte, err return addr, nil } +// GetPubKey returns the public key of the key with the given name. func (a *autoCLIKeyringAdapter) GetPubKey(name string) (cryptotypes.PubKey, error) { record, err := a.Keyring.Key(name) if err != nil { @@ -78,6 +80,7 @@ func (a *autoCLIKeyringAdapter) GetPubKey(name string) (cryptotypes.PubKey, erro return record.GetPubKey() } +// Sign signs the given bytes with the key with the given name. func (a *autoCLIKeyringAdapter) Sign(name string, msg []byte, signMode signingv1beta1.SignMode) ([]byte, error) { record, err := a.Keyring.Key(name) if err != nil { @@ -93,6 +96,7 @@ func (a *autoCLIKeyringAdapter) Sign(name string, msg []byte, signMode signingv1 return signBytes, err } +// KeyType returns the type of the key with the given name. func (a *autoCLIKeyringAdapter) KeyType(name string) (uint, error) { record, err := a.Keyring.Key(name) if err != nil { @@ -102,6 +106,7 @@ func (a *autoCLIKeyringAdapter) KeyType(name string) (uint, error) { return uint(record.GetType()), nil } +// KeyInfo returns key name, key address, and key type given a key name or address. func (a *autoCLIKeyringAdapter) KeyInfo(nameOrAddr string) (string, string, uint, error) { addr, err := a.ac.StringToBytes(nameOrAddr) if err != nil { From e666764af6c8f4245738c4c9a5c736aa07125a76 Mon Sep 17 00:00:00 2001 From: Randy Grok <98407738+randygrok@users.noreply.github.com> Date: Wed, 16 Oct 2024 16:21:18 +0200 Subject: [PATCH 40/57] feat: wire v2 handlers (#22112) Co-authored-by: Randy Grok <@faulttolerance.net> Co-authored-by: Julien Robert --- runtime/v2/go.mod | 3 +- runtime/v2/go.sum | 2 + runtime/v2/services_test.go | 50 ++++++++++++++++ server/v2/api/rest/README.md | 73 +++++++++++++++++++++++ server/v2/api/rest/config.go | 32 ++++++++++ server/v2/api/rest/handler.go | 99 +++++++++++++++++++++++++++++++ server/v2/api/rest/server.go | 96 ++++++++++++++++++++++++++++++ server/v2/api/rest/server_test.go | 46 ++++++++++++++ simapp/v2/simdv2/cmd/commands.go | 2 + 9 files changed, 402 insertions(+), 1 deletion(-) create mode 100644 runtime/v2/services_test.go create mode 100644 server/v2/api/rest/README.md create mode 100644 server/v2/api/rest/config.go create mode 100644 server/v2/api/rest/handler.go create mode 100644 server/v2/api/rest/server.go create mode 100644 server/v2/api/rest/server_test.go diff --git a/runtime/v2/go.mod b/runtime/v2/go.mod index 74749ef367e7..44a3c9a9bc31 100644 --- a/runtime/v2/go.mod +++ b/runtime/v2/go.mod @@ -22,6 +22,7 @@ require ( cosmossdk.io/store/v2 v2.0.0-00010101000000-000000000000 cosmossdk.io/x/tx v0.13.3 github.com/cosmos/gogoproto v1.7.0 + github.com/stretchr/testify v1.9.0 google.golang.org/grpc v1.67.1 google.golang.org/protobuf v1.35.1 ) @@ -70,7 +71,7 @@ require ( github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/rs/zerolog v1.33.0 // indirect github.com/spf13/cast v1.7.0 // indirect - github.com/stretchr/testify v1.9.0 // indirect + github.com/stretchr/objx v0.5.2 // indirect github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect github.com/tendermint/go-amino v0.16.0 // indirect github.com/tidwall/btree v1.7.0 // indirect diff --git a/runtime/v2/go.sum b/runtime/v2/go.sum index b67058f3e108..96f2f2e144a6 100644 --- a/runtime/v2/go.sum +++ b/runtime/v2/go.sum @@ -221,6 +221,8 @@ github.com/spf13/cast v1.7.0 h1:ntdiHjuueXFgm5nzDRdOS4yfT43P5Fnud6DH50rz/7w= github.com/spf13/cast v1.7.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= diff --git a/runtime/v2/services_test.go b/runtime/v2/services_test.go new file mode 100644 index 000000000000..83e16d4e7141 --- /dev/null +++ b/runtime/v2/services_test.go @@ -0,0 +1,50 @@ +package runtime + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" + + appmodulev2 "cosmossdk.io/core/appmodule/v2" + "cosmossdk.io/core/transaction" + "cosmossdk.io/server/v2/stf" +) + +// MockModule implements both HasMsgHandlers and HasQueryHandlers +type MockModule struct { + mock.Mock + appmodulev2.AppModule +} + +func (m *MockModule) RegisterMsgHandlers(router appmodulev2.MsgRouter) { + m.Called(router) +} + +func (m *MockModule) RegisterQueryHandlers(router appmodulev2.QueryRouter) { + m.Called(router) +} + +func TestRegisterServices(t *testing.T) { + mockModule := new(MockModule) + + app := &App[transaction.Tx]{ + msgRouterBuilder: stf.NewMsgRouterBuilder(), + queryRouterBuilder: stf.NewMsgRouterBuilder(), + } + + mm := &MM[transaction.Tx]{ + modules: map[string]appmodulev2.AppModule{ + "mock": mockModule, + }, + } + + mockModule.On("RegisterMsgHandlers", app.msgRouterBuilder).Once() + mockModule.On("RegisterQueryHandlers", app.queryRouterBuilder).Once() + + err := mm.RegisterServices(app) + + assert.NoError(t, err) + + mockModule.AssertExpectations(t) +} diff --git a/server/v2/api/rest/README.md b/server/v2/api/rest/README.md new file mode 100644 index 000000000000..dd53f848e58e --- /dev/null +++ b/server/v2/api/rest/README.md @@ -0,0 +1,73 @@ +# Cosmos SDK REST API + +This document describes how to use a service that exposes endpoints based on Cosmos SDK Protobuf message types. Each endpoint responds with data in JSON format. + +## General Description + +The service allows querying the blockchain using any type of Protobuf message available in the Cosmos SDK application through HTTP `POST` requests. Each endpoint corresponds to a Cosmos SDK protocol message (`proto`), and responses are returned in JSON format. + +## Example + +### 1. `QueryBalanceRequest` + +This endpoint allows querying the balance of an account given an address and a token denomination. + +- **URL:** `localhost:8080/cosmos.bank.v2.QueryBalanceRequest` + +- **Method:** `POST` + +- **Headers:** + + - `Content-Type: application/json` + +- **Body (JSON):** + + ```json + { + "address": "", + "denom": "" + } + ``` + + - `address`: Account address on the Cosmos network. + - `denom`: Token denomination (e.g., `stake`). + +- **Request Example:** + + ``` + POST localhost:8080/cosmos.bank.v2.QueryBalanceRequest + Content-Type: application/json + + { + "address": "cosmos16tms8tax3ha9exdu7x3maxrvall07yum3rdcu0", + "denom": "stake" + } + ``` + +- **Response Example (JSON):** + + ```json + { + "balance": { + "denom": "stake", + "amount": "1000000" + } + } + ``` + + The response shows the balance of the specified token for the given account. + +## Using Tools + +### 1. Using `curl` + +To make a request using `curl`, you can run the following command: + +```bash +curl -X POST localhost:8080/cosmos.bank.v2.QueryBalanceRequest \ + -H "Content-Type: application/json" \ + -d '{ + "address": "cosmos16tms8tax3ha9exdu7x3maxrvall07yum3rdcu0", + "denom": "stake" + }' +``` \ No newline at end of file diff --git a/server/v2/api/rest/config.go b/server/v2/api/rest/config.go new file mode 100644 index 000000000000..c1e9eb260fc6 --- /dev/null +++ b/server/v2/api/rest/config.go @@ -0,0 +1,32 @@ +package rest + +func DefaultConfig() *Config { + return &Config{ + Enable: true, + Address: "localhost:8080", + } +} + +type CfgOption func(*Config) + +// Config defines configuration for the REST server. +type Config struct { + // Enable defines if the REST server should be enabled. + Enable bool `mapstructure:"enable" toml:"enable" comment:"Enable defines if the REST server should be enabled."` + // Address defines the API server to listen on + Address string `mapstructure:"address" toml:"address" comment:"Address defines the REST server address to bind to."` +} + +// OverwriteDefaultConfig overwrites the default config with the new config. +func OverwriteDefaultConfig(newCfg *Config) CfgOption { + return func(cfg *Config) { + *cfg = *newCfg + } +} + +// Disable the rest server by default (default enabled). +func Disable() CfgOption { + return func(cfg *Config) { + cfg.Enable = false + } +} diff --git a/server/v2/api/rest/handler.go b/server/v2/api/rest/handler.go new file mode 100644 index 000000000000..a5338f35cf31 --- /dev/null +++ b/server/v2/api/rest/handler.go @@ -0,0 +1,99 @@ +package rest + +import ( + "encoding/json" + "fmt" + "io" + "net/http" + "reflect" + "strings" + + "github.com/cosmos/gogoproto/jsonpb" + gogoproto "github.com/cosmos/gogoproto/proto" + + "cosmossdk.io/core/transaction" + "cosmossdk.io/server/v2/appmanager" +) + +const ( + ContentTypeJSON = "application/json" + MaxBodySize = 1 << 20 // 1 MB +) + +func NewDefaultHandler[T transaction.Tx](appManager *appmanager.AppManager[T]) http.Handler { + return &DefaultHandler[T]{appManager: appManager} +} + +type DefaultHandler[T transaction.Tx] struct { + appManager *appmanager.AppManager[T] +} + +func (h *DefaultHandler[T]) ServeHTTP(w http.ResponseWriter, r *http.Request) { + if err := h.validateMethodIsPOST(r); err != nil { + http.Error(w, err.Error(), http.StatusMethodNotAllowed) + return + } + + if err := h.validateContentTypeIsJSON(r); err != nil { + http.Error(w, err.Error(), http.StatusUnsupportedMediaType) + return + } + + msg, err := h.createMessage(r) + if err != nil { + http.Error(w, err.Error(), http.StatusBadRequest) + return + } + + query, err := h.appManager.Query(r.Context(), 0, msg) + if err != nil { + http.Error(w, "Error querying", http.StatusInternalServerError) + return + } + + w.Header().Set("Content-Type", ContentTypeJSON) + if err := json.NewEncoder(w).Encode(query); err != nil { + http.Error(w, fmt.Sprintf("Error encoding response: %v", err), http.StatusInternalServerError) + } +} + +// validateMethodIsPOST validates that the request method is POST. +func (h *DefaultHandler[T]) validateMethodIsPOST(r *http.Request) error { + if r.Method != http.MethodPost { + return fmt.Errorf("method not allowed") + } + return nil +} + +// validateContentTypeIsJSON validates that the request content type is JSON. +func (h *DefaultHandler[T]) validateContentTypeIsJSON(r *http.Request) error { + contentType := r.Header.Get("Content-Type") + if contentType != ContentTypeJSON { + return fmt.Errorf("unsupported content type, expected %s", ContentTypeJSON) + } + + return nil +} + +// createMessage creates the message by unmarshalling the request body. +func (h *DefaultHandler[T]) createMessage(r *http.Request) (gogoproto.Message, error) { + path := strings.TrimPrefix(r.URL.Path, "/") + requestType := gogoproto.MessageType(path) + if requestType == nil { + return nil, fmt.Errorf("unknown request type") + } + + msg, ok := reflect.New(requestType.Elem()).Interface().(gogoproto.Message) + if !ok { + return nil, fmt.Errorf("failed to create message instance") + } + + defer r.Body.Close() + limitedReader := io.LimitReader(r.Body, MaxBodySize) + err := jsonpb.Unmarshal(limitedReader, msg) + if err != nil { + return nil, fmt.Errorf("error parsing body: %w", err) + } + + return msg, nil +} diff --git a/server/v2/api/rest/server.go b/server/v2/api/rest/server.go new file mode 100644 index 000000000000..eaa0fe8b6b94 --- /dev/null +++ b/server/v2/api/rest/server.go @@ -0,0 +1,96 @@ +package rest + +import ( + "context" + "errors" + "fmt" + "net/http" + + "cosmossdk.io/core/transaction" + "cosmossdk.io/log" + serverv2 "cosmossdk.io/server/v2" +) + +const ( + ServerName = "rest-v2" +) + +type Server[T transaction.Tx] struct { + logger log.Logger + router *http.ServeMux + + httpServer *http.Server + config *Config + cfgOptions []CfgOption +} + +func New[T transaction.Tx](cfgOptions ...CfgOption) *Server[T] { + return &Server[T]{ + cfgOptions: cfgOptions, + } +} + +func (s *Server[T]) Name() string { + return ServerName +} + +func (s *Server[T]) Init(appI serverv2.AppI[T], cfg map[string]any, logger log.Logger) error { + s.logger = logger.With(log.ModuleKey, s.Name()) + + serverCfg := s.Config().(*Config) + if len(cfg) > 0 { + if err := serverv2.UnmarshalSubConfig(cfg, s.Name(), &serverCfg); err != nil { + return fmt.Errorf("failed to unmarshal config: %w", err) + } + } + + s.router = http.NewServeMux() + s.router.Handle("/", NewDefaultHandler(appI.GetAppManager())) + s.config = serverCfg + + return nil +} + +func (s *Server[T]) Start(ctx context.Context) error { + if !s.config.Enable { + s.logger.Info(fmt.Sprintf("%s server is disabled via config", s.Name())) + return nil + } + + s.httpServer = &http.Server{ + Addr: s.config.Address, + Handler: s.router, + } + + s.logger.Info("starting HTTP server", "address", s.config.Address) + if err := s.httpServer.ListenAndServe(); err != nil && !errors.Is(err, http.ErrServerClosed) { + s.logger.Error("failed to start HTTP server", "error", err) + return err + } + + return nil +} + +func (s *Server[T]) Stop(ctx context.Context) error { + if !s.config.Enable { + return nil + } + + s.logger.Info("stopping HTTP server") + + return s.httpServer.Shutdown(ctx) +} + +func (s *Server[T]) Config() any { + if s.config == nil || s.config.Address == "" { + cfg := DefaultConfig() + + for _, opt := range s.cfgOptions { + opt(cfg) + } + + return cfg + } + + return s.config +} diff --git a/server/v2/api/rest/server_test.go b/server/v2/api/rest/server_test.go new file mode 100644 index 000000000000..cec027f5d24b --- /dev/null +++ b/server/v2/api/rest/server_test.go @@ -0,0 +1,46 @@ +package rest + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "cosmossdk.io/core/transaction" +) + +func TestServerConfig(t *testing.T) { + testCases := []struct { + name string + setupFunc func() *Config + expectedConfig *Config + }{ + { + name: "Default configuration, no custom configuration", + setupFunc: func() *Config { + s := New[transaction.Tx]() + return s.Config().(*Config) + }, + expectedConfig: DefaultConfig(), + }, + { + name: "Custom configuration", + setupFunc: func() *Config { + s := New[transaction.Tx](func(config *Config) { + config.Enable = false + }) + return s.Config().(*Config) + }, + expectedConfig: &Config{ + Enable: false, // Custom configuration + Address: "localhost:8080", + }, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + config := tc.setupFunc() + require.Equal(t, tc.expectedConfig, config) + }) + } +} diff --git a/simapp/v2/simdv2/cmd/commands.go b/simapp/v2/simdv2/cmd/commands.go index 8d4186be8d19..4d669f91749b 100644 --- a/simapp/v2/simdv2/cmd/commands.go +++ b/simapp/v2/simdv2/cmd/commands.go @@ -15,6 +15,7 @@ import ( runtimev2 "cosmossdk.io/runtime/v2" serverv2 "cosmossdk.io/server/v2" "cosmossdk.io/server/v2/api/grpc" + "cosmossdk.io/server/v2/api/rest" "cosmossdk.io/server/v2/api/telemetry" "cosmossdk.io/server/v2/cometbft" serverstore "cosmossdk.io/server/v2/store" @@ -77,6 +78,7 @@ func initRootCmd[T transaction.Tx]( grpc.New[T](), serverstore.New[T](), telemetry.New[T](), + rest.New[T](), ); err != nil { panic(err) } From abaccb4d4b1f0ec0dd1f4b3df2aeb05bf3fb3e5d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 16 Oct 2024 15:10:39 +0000 Subject: [PATCH 41/57] build(deps): Bump github.com/prometheus/client_golang from 1.20.4 to 1.20.5 (#22270) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] Co-authored-by: Julien Robert --- client/v2/go.mod | 2 +- client/v2/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- orm/go.mod | 2 +- orm/go.sum | 4 ++-- runtime/v2/go.mod | 2 +- runtime/v2/go.sum | 4 ++-- server/v2/cometbft/go.mod | 2 +- server/v2/cometbft/go.sum | 4 ++-- server/v2/go.mod | 2 +- server/v2/go.sum | 4 ++-- simapp/go.mod | 2 +- simapp/go.sum | 4 ++-- simapp/v2/go.mod | 2 +- simapp/v2/go.sum | 4 ++-- store/v2/go.mod | 2 +- store/v2/go.sum | 4 ++-- tests/go.mod | 2 +- tests/go.sum | 4 ++-- tests/systemtests/go.mod | 2 +- tests/systemtests/go.sum | 4 ++-- tools/confix/go.mod | 2 +- tools/confix/go.sum | 4 ++-- tools/cosmovisor/go.mod | 2 +- tools/cosmovisor/go.sum | 4 ++-- tools/hubl/go.mod | 2 +- tools/hubl/go.sum | 4 ++-- x/accounts/defaults/base/go.mod | 2 +- x/accounts/defaults/base/go.sum | 4 ++-- x/accounts/defaults/lockup/go.mod | 2 +- x/accounts/defaults/lockup/go.sum | 4 ++-- x/accounts/defaults/multisig/go.mod | 2 +- x/accounts/defaults/multisig/go.sum | 4 ++-- x/accounts/go.mod | 2 +- x/accounts/go.sum | 4 ++-- x/authz/go.mod | 2 +- x/authz/go.sum | 4 ++-- x/bank/go.mod | 2 +- x/bank/go.sum | 4 ++-- x/circuit/go.mod | 2 +- x/circuit/go.sum | 4 ++-- x/consensus/go.mod | 2 +- x/consensus/go.sum | 4 ++-- x/distribution/go.mod | 2 +- x/distribution/go.sum | 4 ++-- x/epochs/go.mod | 2 +- x/epochs/go.sum | 4 ++-- x/evidence/go.mod | 2 +- x/evidence/go.sum | 4 ++-- x/feegrant/go.mod | 2 +- x/feegrant/go.sum | 4 ++-- x/gov/go.mod | 2 +- x/gov/go.sum | 4 ++-- x/group/go.mod | 2 +- x/group/go.sum | 4 ++-- x/mint/go.mod | 2 +- x/mint/go.sum | 4 ++-- x/nft/go.mod | 2 +- x/nft/go.sum | 4 ++-- x/params/go.mod | 2 +- x/params/go.sum | 4 ++-- x/protocolpool/go.mod | 2 +- x/protocolpool/go.sum | 4 ++-- x/slashing/go.mod | 2 +- x/slashing/go.sum | 4 ++-- x/staking/go.mod | 2 +- x/staking/go.sum | 4 ++-- x/upgrade/go.mod | 2 +- x/upgrade/go.sum | 4 ++-- 70 files changed, 105 insertions(+), 105 deletions(-) diff --git a/client/v2/go.mod b/client/v2/go.mod index a55b13e882d0..0b4f281d7021 100644 --- a/client/v2/go.mod +++ b/client/v2/go.mod @@ -125,7 +125,7 @@ require ( github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.20.4 // indirect + github.com/prometheus/client_golang v1.20.5 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.60.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect diff --git a/client/v2/go.sum b/client/v2/go.sum index e9b07cd27b81..236f4ac476a9 100644 --- a/client/v2/go.sum +++ b/client/v2/go.sum @@ -414,8 +414,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= -github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= +github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= diff --git a/go.mod b/go.mod index d06a15278821..58dba9be0b5c 100644 --- a/go.mod +++ b/go.mod @@ -44,7 +44,7 @@ require ( github.com/mattn/go-isatty v0.0.20 github.com/mdp/qrterminal/v3 v3.2.0 github.com/muesli/termenv v0.15.2 - github.com/prometheus/client_golang v1.20.4 + github.com/prometheus/client_golang v1.20.5 github.com/prometheus/common v0.60.0 github.com/rs/zerolog v1.33.0 github.com/spf13/cast v1.7.0 diff --git a/go.sum b/go.sum index 90bf32a034f5..5c0c2f19141f 100644 --- a/go.sum +++ b/go.sum @@ -401,8 +401,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= -github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= +github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= diff --git a/orm/go.mod b/orm/go.mod index 03ab714a3d20..439116b77d9a 100644 --- a/orm/go.mod +++ b/orm/go.mod @@ -54,7 +54,7 @@ require ( github.com/onsi/gomega v1.20.0 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.20.4 // indirect + github.com/prometheus/client_golang v1.20.5 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.60.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect diff --git a/orm/go.sum b/orm/go.sum index fe975253538d..726ff3f59a2d 100644 --- a/orm/go.sum +++ b/orm/go.sum @@ -138,8 +138,8 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= -github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= +github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= github.com/prometheus/common v0.60.0 h1:+V9PAREWNvJMAuJ1x1BaWl9dewMW4YrHZQbx0sJNllA= diff --git a/runtime/v2/go.mod b/runtime/v2/go.mod index 44a3c9a9bc31..27ed971add6a 100644 --- a/runtime/v2/go.mod +++ b/runtime/v2/go.mod @@ -64,7 +64,7 @@ require ( github.com/onsi/gomega v1.28.1 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.20.4 // indirect + github.com/prometheus/client_golang v1.20.5 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.60.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect diff --git a/runtime/v2/go.sum b/runtime/v2/go.sum index 96f2f2e144a6..3cde1737ee77 100644 --- a/runtime/v2/go.sum +++ b/runtime/v2/go.sum @@ -193,8 +193,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= -github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= +github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= diff --git a/server/v2/cometbft/go.mod b/server/v2/cometbft/go.mod index 89e3c93d112f..aa08bf57a0de 100644 --- a/server/v2/cometbft/go.mod +++ b/server/v2/cometbft/go.mod @@ -140,7 +140,7 @@ require ( github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.20.4 // indirect + github.com/prometheus/client_golang v1.20.5 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.60.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect diff --git a/server/v2/cometbft/go.sum b/server/v2/cometbft/go.sum index f248d60a370d..36ae82083f3f 100644 --- a/server/v2/cometbft/go.sum +++ b/server/v2/cometbft/go.sum @@ -408,8 +408,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= -github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= +github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= diff --git a/server/v2/go.mod b/server/v2/go.mod index 11389921eb76..c72f4efe0e1b 100644 --- a/server/v2/go.mod +++ b/server/v2/go.mod @@ -29,7 +29,7 @@ require ( github.com/hashicorp/go-plugin v1.6.1 github.com/mitchellh/mapstructure v1.5.0 github.com/pelletier/go-toml/v2 v2.2.2 - github.com/prometheus/client_golang v1.20.4 + github.com/prometheus/client_golang v1.20.5 github.com/prometheus/common v0.60.0 github.com/rs/zerolog v1.33.0 github.com/spf13/cobra v1.8.1 diff --git a/server/v2/go.sum b/server/v2/go.sum index 4a7c52d6f39a..ad080575a985 100644 --- a/server/v2/go.sum +++ b/server/v2/go.sum @@ -258,8 +258,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= -github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= +github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= diff --git a/simapp/go.mod b/simapp/go.mod index 4885801831da..356623a6423f 100644 --- a/simapp/go.mod +++ b/simapp/go.mod @@ -177,7 +177,7 @@ require ( github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.20.4 // indirect + github.com/prometheus/client_golang v1.20.5 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.60.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect diff --git a/simapp/go.sum b/simapp/go.sum index 16288a075bd5..41a4382b5de7 100644 --- a/simapp/go.sum +++ b/simapp/go.sum @@ -721,8 +721,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= -github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= +github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= diff --git a/simapp/v2/go.mod b/simapp/v2/go.mod index 85371497dbb6..457c1e06364c 100644 --- a/simapp/v2/go.mod +++ b/simapp/v2/go.mod @@ -184,7 +184,7 @@ require ( github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.20.4 // indirect + github.com/prometheus/client_golang v1.20.5 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.60.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect diff --git a/simapp/v2/go.sum b/simapp/v2/go.sum index a3a95a365dee..4417b3e85971 100644 --- a/simapp/v2/go.sum +++ b/simapp/v2/go.sum @@ -725,8 +725,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= -github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= +github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= diff --git a/store/v2/go.mod b/store/v2/go.mod index 953ecfbfa03e..d54a715a3b4c 100644 --- a/store/v2/go.mod +++ b/store/v2/go.mod @@ -50,7 +50,7 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.20.4 // indirect + github.com/prometheus/client_golang v1.20.5 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.60.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect diff --git a/store/v2/go.sum b/store/v2/go.sum index 6daeacc737ef..eb52ef582617 100644 --- a/store/v2/go.sum +++ b/store/v2/go.sum @@ -180,8 +180,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= -github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= +github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= diff --git a/tests/go.mod b/tests/go.mod index 786ef4f455a0..540cb84fd733 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -174,7 +174,7 @@ require ( github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.20.4 // indirect + github.com/prometheus/client_golang v1.20.5 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.60.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect diff --git a/tests/go.sum b/tests/go.sum index 1b718202ffe1..474e0a602b10 100644 --- a/tests/go.sum +++ b/tests/go.sum @@ -712,8 +712,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= -github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= +github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= diff --git a/tests/systemtests/go.mod b/tests/systemtests/go.mod index f32c7597abeb..cc8b27c8bea0 100644 --- a/tests/systemtests/go.mod +++ b/tests/systemtests/go.mod @@ -13,7 +13,7 @@ require ( github.com/gorilla/mux v1.8.0 // indirect github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/prometheus/client_golang v1.20.4 // indirect + github.com/prometheus/client_golang v1.20.5 // indirect github.com/spf13/cast v1.7.0 // indirect github.com/spf13/cobra v1.8.1 // indirect github.com/spf13/pflag v1.0.5 // indirect diff --git a/tests/systemtests/go.sum b/tests/systemtests/go.sum index 3fa24ef0038c..dab25bbfe8ae 100644 --- a/tests/systemtests/go.sum +++ b/tests/systemtests/go.sum @@ -601,8 +601,8 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= -github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= +github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= diff --git a/tools/confix/go.mod b/tools/confix/go.mod index 605ff6f27524..f537f956c81d 100644 --- a/tools/confix/go.mod +++ b/tools/confix/go.mod @@ -115,7 +115,7 @@ require ( github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.20.4 // indirect + github.com/prometheus/client_golang v1.20.5 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.60.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect diff --git a/tools/confix/go.sum b/tools/confix/go.sum index 6ec2ebd78df5..b3decd704e23 100644 --- a/tools/confix/go.sum +++ b/tools/confix/go.sum @@ -602,8 +602,8 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= -github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= +github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= diff --git a/tools/cosmovisor/go.mod b/tools/cosmovisor/go.mod index 559eb945d7fd..7cde5f87512e 100644 --- a/tools/cosmovisor/go.mod +++ b/tools/cosmovisor/go.mod @@ -133,7 +133,7 @@ require ( github.com/petermattis/goid v0.0.0-20240503122002-4b96552b8156 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.20.4 // indirect + github.com/prometheus/client_golang v1.20.5 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.60.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect diff --git a/tools/cosmovisor/go.sum b/tools/cosmovisor/go.sum index 62506d928996..2e3f95e6f163 100644 --- a/tools/cosmovisor/go.sum +++ b/tools/cosmovisor/go.sum @@ -838,8 +838,8 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= -github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= +github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= diff --git a/tools/hubl/go.mod b/tools/hubl/go.mod index e42003d95a92..2247020a8d30 100644 --- a/tools/hubl/go.mod +++ b/tools/hubl/go.mod @@ -115,7 +115,7 @@ require ( github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.20.4 // indirect + github.com/prometheus/client_golang v1.20.5 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.60.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect diff --git a/tools/hubl/go.sum b/tools/hubl/go.sum index 3a5f2623acc8..3c80625ba480 100644 --- a/tools/hubl/go.sum +++ b/tools/hubl/go.sum @@ -602,8 +602,8 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= -github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= +github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= diff --git a/x/accounts/defaults/base/go.mod b/x/accounts/defaults/base/go.mod index b3fae40a91df..bc28cb2f289e 100644 --- a/x/accounts/defaults/base/go.mod +++ b/x/accounts/defaults/base/go.mod @@ -118,7 +118,7 @@ require ( github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.20.4 // indirect + github.com/prometheus/client_golang v1.20.5 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.60.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect diff --git a/x/accounts/defaults/base/go.sum b/x/accounts/defaults/base/go.sum index 41381a89bab9..a5f02361cc93 100644 --- a/x/accounts/defaults/base/go.sum +++ b/x/accounts/defaults/base/go.sum @@ -402,8 +402,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= -github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= +github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= diff --git a/x/accounts/defaults/lockup/go.mod b/x/accounts/defaults/lockup/go.mod index abff5b67217d..315965d73c53 100644 --- a/x/accounts/defaults/lockup/go.mod +++ b/x/accounts/defaults/lockup/go.mod @@ -96,7 +96,7 @@ require ( github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.20.4 // indirect + github.com/prometheus/client_golang v1.20.5 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.60.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect diff --git a/x/accounts/defaults/lockup/go.sum b/x/accounts/defaults/lockup/go.sum index 0ad92c23bcbd..05748373dd70 100644 --- a/x/accounts/defaults/lockup/go.sum +++ b/x/accounts/defaults/lockup/go.sum @@ -349,8 +349,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= -github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= +github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= diff --git a/x/accounts/defaults/multisig/go.mod b/x/accounts/defaults/multisig/go.mod index 1a52ed73ec60..265aa5b79be7 100644 --- a/x/accounts/defaults/multisig/go.mod +++ b/x/accounts/defaults/multisig/go.mod @@ -118,7 +118,7 @@ require ( github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.20.4 // indirect + github.com/prometheus/client_golang v1.20.5 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.60.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect diff --git a/x/accounts/defaults/multisig/go.sum b/x/accounts/defaults/multisig/go.sum index 41381a89bab9..a5f02361cc93 100644 --- a/x/accounts/defaults/multisig/go.sum +++ b/x/accounts/defaults/multisig/go.sum @@ -402,8 +402,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= -github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= +github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= diff --git a/x/accounts/go.mod b/x/accounts/go.mod index a7381834bc62..ec9e3a68f871 100644 --- a/x/accounts/go.mod +++ b/x/accounts/go.mod @@ -123,7 +123,7 @@ require ( github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.20.4 // indirect + github.com/prometheus/client_golang v1.20.5 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.60.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect diff --git a/x/accounts/go.sum b/x/accounts/go.sum index 19d76b3ec23a..58d4121c9e48 100644 --- a/x/accounts/go.sum +++ b/x/accounts/go.sum @@ -402,8 +402,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= -github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= +github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= diff --git a/x/authz/go.mod b/x/authz/go.mod index c7fa7d641a4a..f110c68a5794 100644 --- a/x/authz/go.mod +++ b/x/authz/go.mod @@ -117,7 +117,7 @@ require ( github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.20.4 // indirect + github.com/prometheus/client_golang v1.20.5 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.60.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect diff --git a/x/authz/go.sum b/x/authz/go.sum index 19d76b3ec23a..58d4121c9e48 100644 --- a/x/authz/go.sum +++ b/x/authz/go.sum @@ -402,8 +402,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= -github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= +github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= diff --git a/x/bank/go.mod b/x/bank/go.mod index d8b14b6f04c3..d0e6c97912b2 100644 --- a/x/bank/go.mod +++ b/x/bank/go.mod @@ -115,7 +115,7 @@ require ( github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.20.4 // indirect + github.com/prometheus/client_golang v1.20.5 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.60.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect diff --git a/x/bank/go.sum b/x/bank/go.sum index 19d76b3ec23a..58d4121c9e48 100644 --- a/x/bank/go.sum +++ b/x/bank/go.sum @@ -402,8 +402,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= -github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= +github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= diff --git a/x/circuit/go.mod b/x/circuit/go.mod index 793d1e0e629f..2ba978365c0c 100644 --- a/x/circuit/go.mod +++ b/x/circuit/go.mod @@ -119,7 +119,7 @@ require ( github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.20.4 // indirect + github.com/prometheus/client_golang v1.20.5 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.60.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect diff --git a/x/circuit/go.sum b/x/circuit/go.sum index 22beb1c7c24b..8fd99b8608ea 100644 --- a/x/circuit/go.sum +++ b/x/circuit/go.sum @@ -404,8 +404,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= -github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= +github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= diff --git a/x/consensus/go.mod b/x/consensus/go.mod index 82cbefaea465..40ca70da36a7 100644 --- a/x/consensus/go.mod +++ b/x/consensus/go.mod @@ -118,7 +118,7 @@ require ( github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.20.4 // indirect + github.com/prometheus/client_golang v1.20.5 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.60.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect diff --git a/x/consensus/go.sum b/x/consensus/go.sum index 7f7157c35eed..a856f6d1b923 100644 --- a/x/consensus/go.sum +++ b/x/consensus/go.sum @@ -404,8 +404,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= -github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= +github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= diff --git a/x/distribution/go.mod b/x/distribution/go.mod index d4d493052eb1..b2e2e9213568 100644 --- a/x/distribution/go.mod +++ b/x/distribution/go.mod @@ -120,7 +120,7 @@ require ( github.com/pelletier/go-toml/v2 v2.2.3 // indirect github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.20.4 // indirect + github.com/prometheus/client_golang v1.20.5 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.60.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect diff --git a/x/distribution/go.sum b/x/distribution/go.sum index 19d76b3ec23a..58d4121c9e48 100644 --- a/x/distribution/go.sum +++ b/x/distribution/go.sum @@ -402,8 +402,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= -github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= +github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= diff --git a/x/epochs/go.mod b/x/epochs/go.mod index f7bf518fdd2d..cfa18e12f8e1 100644 --- a/x/epochs/go.mod +++ b/x/epochs/go.mod @@ -117,7 +117,7 @@ require ( github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.20.4 // indirect + github.com/prometheus/client_golang v1.20.5 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.60.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect diff --git a/x/epochs/go.sum b/x/epochs/go.sum index 7f7157c35eed..a856f6d1b923 100644 --- a/x/epochs/go.sum +++ b/x/epochs/go.sum @@ -404,8 +404,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= -github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= +github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= diff --git a/x/evidence/go.mod b/x/evidence/go.mod index 830b3e5f3685..d18950503bd5 100644 --- a/x/evidence/go.mod +++ b/x/evidence/go.mod @@ -121,7 +121,7 @@ require ( github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.20.4 // indirect + github.com/prometheus/client_golang v1.20.5 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.60.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect diff --git a/x/evidence/go.sum b/x/evidence/go.sum index 22beb1c7c24b..8fd99b8608ea 100644 --- a/x/evidence/go.sum +++ b/x/evidence/go.sum @@ -404,8 +404,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= -github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= +github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= diff --git a/x/feegrant/go.mod b/x/feegrant/go.mod index 3dcbec2c3d85..14350cae8f6b 100644 --- a/x/feegrant/go.mod +++ b/x/feegrant/go.mod @@ -129,7 +129,7 @@ require ( github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.20.4 // indirect + github.com/prometheus/client_golang v1.20.5 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.60.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect diff --git a/x/feegrant/go.sum b/x/feegrant/go.sum index 24c27ebed8a4..696a6ef7d845 100644 --- a/x/feegrant/go.sum +++ b/x/feegrant/go.sum @@ -412,8 +412,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= -github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= +github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= diff --git a/x/gov/go.mod b/x/gov/go.mod index a0fe618a5af1..03f041b7968a 100644 --- a/x/gov/go.mod +++ b/x/gov/go.mod @@ -125,7 +125,7 @@ require ( github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.20.4 // indirect + github.com/prometheus/client_golang v1.20.5 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.60.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect diff --git a/x/gov/go.sum b/x/gov/go.sum index 75d64ba2c563..a1587575f635 100644 --- a/x/gov/go.sum +++ b/x/gov/go.sum @@ -410,8 +410,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= -github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= +github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= diff --git a/x/group/go.mod b/x/group/go.mod index 2557151fc2cb..654c56b7d399 100644 --- a/x/group/go.mod +++ b/x/group/go.mod @@ -131,7 +131,7 @@ require ( github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.20.4 // indirect + github.com/prometheus/client_golang v1.20.5 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.60.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect diff --git a/x/group/go.sum b/x/group/go.sum index d438e2dbd1c1..43aac4657e87 100644 --- a/x/group/go.sum +++ b/x/group/go.sum @@ -412,8 +412,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= -github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= +github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= diff --git a/x/mint/go.mod b/x/mint/go.mod index 47b03c3054f6..bd80104b5fc8 100644 --- a/x/mint/go.mod +++ b/x/mint/go.mod @@ -117,7 +117,7 @@ require ( github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.20.4 // indirect + github.com/prometheus/client_golang v1.20.5 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.60.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect diff --git a/x/mint/go.sum b/x/mint/go.sum index 22beb1c7c24b..8fd99b8608ea 100644 --- a/x/mint/go.sum +++ b/x/mint/go.sum @@ -404,8 +404,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= -github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= +github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= diff --git a/x/nft/go.mod b/x/nft/go.mod index 1173c73301f2..bf1eb272e33d 100644 --- a/x/nft/go.mod +++ b/x/nft/go.mod @@ -119,7 +119,7 @@ require ( github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.20.4 // indirect + github.com/prometheus/client_golang v1.20.5 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.60.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect diff --git a/x/nft/go.sum b/x/nft/go.sum index 22beb1c7c24b..8fd99b8608ea 100644 --- a/x/nft/go.sum +++ b/x/nft/go.sum @@ -404,8 +404,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= -github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= +github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= diff --git a/x/params/go.mod b/x/params/go.mod index 902a2bd521ae..006af90f591d 100644 --- a/x/params/go.mod +++ b/x/params/go.mod @@ -113,7 +113,7 @@ require ( github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.20.4 // indirect + github.com/prometheus/client_golang v1.20.5 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.60.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect diff --git a/x/params/go.sum b/x/params/go.sum index dbf213cb524a..bfa925d6aff0 100644 --- a/x/params/go.sum +++ b/x/params/go.sum @@ -380,8 +380,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= -github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= +github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= diff --git a/x/protocolpool/go.mod b/x/protocolpool/go.mod index bfdbb3242e4c..dbbb158bb411 100644 --- a/x/protocolpool/go.mod +++ b/x/protocolpool/go.mod @@ -120,7 +120,7 @@ require ( github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.20.4 // indirect + github.com/prometheus/client_golang v1.20.5 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.60.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect diff --git a/x/protocolpool/go.sum b/x/protocolpool/go.sum index 22beb1c7c24b..8fd99b8608ea 100644 --- a/x/protocolpool/go.sum +++ b/x/protocolpool/go.sum @@ -404,8 +404,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= -github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= +github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= diff --git a/x/slashing/go.mod b/x/slashing/go.mod index 2384cf3f5232..b5537caa655e 100644 --- a/x/slashing/go.mod +++ b/x/slashing/go.mod @@ -122,7 +122,7 @@ require ( github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.20.4 // indirect + github.com/prometheus/client_golang v1.20.5 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.60.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect diff --git a/x/slashing/go.sum b/x/slashing/go.sum index 365e63a28ebe..9a22246ddee4 100644 --- a/x/slashing/go.sum +++ b/x/slashing/go.sum @@ -406,8 +406,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= -github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= +github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= diff --git a/x/staking/go.mod b/x/staking/go.mod index f82ffe3a4915..44e95461200a 100644 --- a/x/staking/go.mod +++ b/x/staking/go.mod @@ -109,7 +109,7 @@ require ( github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.20.4 // indirect + github.com/prometheus/client_golang v1.20.5 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.60.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect diff --git a/x/staking/go.sum b/x/staking/go.sum index 19d76b3ec23a..58d4121c9e48 100644 --- a/x/staking/go.sum +++ b/x/staking/go.sum @@ -402,8 +402,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= -github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= +github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= diff --git a/x/upgrade/go.mod b/x/upgrade/go.mod index 21f27de763cc..122dbd8d25da 100644 --- a/x/upgrade/go.mod +++ b/x/upgrade/go.mod @@ -145,7 +145,7 @@ require ( github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.20.4 // indirect + github.com/prometheus/client_golang v1.20.5 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.60.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect diff --git a/x/upgrade/go.sum b/x/upgrade/go.sum index 18eaeacc6e12..ed7317d738db 100644 --- a/x/upgrade/go.sum +++ b/x/upgrade/go.sum @@ -712,8 +712,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= -github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= +github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= From 76529d768036f4f11a5bb063613db0f01045d3f1 Mon Sep 17 00:00:00 2001 From: Marko Date: Wed, 16 Oct 2024 17:55:23 +0200 Subject: [PATCH 42/57] feat(store/v2): add version exists (#22235) Co-authored-by: Cool Developer --- runtime/v2/store.go | 2 +- store/v2/commitment/store.go | 1 + store/v2/database.go | 28 +++-- store/v2/mock/db_mock.go | 15 +++ store/v2/mock/types.go | 2 +- store/v2/root/store.go | 20 ++-- store/v2/root/store_mock_test.go | 2 +- store/v2/root/store_test.go | 2 +- store/v2/storage/database.go | 1 + store/v2/storage/pebbledb/db.go | 9 ++ store/v2/storage/rocksdb/db.go | 9 ++ store/v2/storage/rocksdb/db_noflag.go | 4 + store/v2/storage/sqlite/db.go | 15 ++- store/v2/storage/storage_bench_test.go | 8 +- store/v2/storage/storage_test_suite.go | 142 ++++++++++++++++++++++++- store/v2/storage/store.go | 7 +- store/v2/store.go | 2 +- 17 files changed, 237 insertions(+), 32 deletions(-) diff --git a/runtime/v2/store.go b/runtime/v2/store.go index 40912ea41f48..5d37c321c1fe 100644 --- a/runtime/v2/store.go +++ b/runtime/v2/store.go @@ -43,7 +43,7 @@ type Store interface { Query(storeKey []byte, version uint64, key []byte, prove bool) (storev2.QueryResult, error) // GetStateStorage returns the SS backend. - GetStateStorage() storev2.VersionedDatabase + GetStateStorage() storev2.VersionedWriter // GetStateCommitment returns the SC backend. GetStateCommitment() storev2.Committer diff --git a/store/v2/commitment/store.go b/store/v2/commitment/store.go index da0440987524..e1f6df9d2024 100644 --- a/store/v2/commitment/store.go +++ b/store/v2/commitment/store.go @@ -275,6 +275,7 @@ func (c *CommitStore) GetProof(storeKey []byte, version uint64, key []byte) ([]p return []proof.CommitmentOp{commitOp, *storeCommitmentOp}, nil } +// Get implements store.VersionedReader. func (c *CommitStore) Get(storeKey []byte, version uint64, key []byte) ([]byte, error) { tree, ok := c.multiTrees[conv.UnsafeBytesToStr(storeKey)] if !ok { diff --git a/store/v2/database.go b/store/v2/database.go index 58a3ee7ef65c..c4f00defe81a 100644 --- a/store/v2/database.go +++ b/store/v2/database.go @@ -7,19 +7,29 @@ import ( "cosmossdk.io/store/v2/proof" ) -// VersionedDatabase defines an API for a versioned database that allows reads, +// VersionedWriter defines an API for a versioned database that allows reads, // writes, iteration and commitment over a series of versions. -type VersionedDatabase interface { +type VersionedWriter interface { + VersionedReader + + SetLatestVersion(version uint64) error + ApplyChangeset(version uint64, cs *corestore.Changeset) error + + // Close releases associated resources. It should NOT be idempotent. It must + // only be called once and any call after may panic. + io.Closer +} + +type VersionedReader interface { Has(storeKey []byte, version uint64, key []byte) (bool, error) Get(storeKey []byte, version uint64, key []byte) ([]byte, error) + GetLatestVersion() (uint64, error) - SetLatestVersion(version uint64) error + VersionExists(v uint64) (bool, error) Iterator(storeKey []byte, version uint64, start, end []byte) (corestore.Iterator, error) ReverseIterator(storeKey []byte, version uint64, start, end []byte) (corestore.Iterator, error) - ApplyChangeset(version uint64, cs *corestore.Changeset) error - // Close releases associated resources. It should NOT be idempotent. It must // only be called once and any call after may panic. io.Closer @@ -53,18 +63,14 @@ type Committer interface { // GetProof returns the proof of existence or non-existence for the given key. GetProof(storeKey []byte, version uint64, key []byte) ([]proof.CommitmentOp, error) - // Get returns the value for the given key at the given version. - // - // NOTE: This method only exists to support migration from IAVL v0/v1 to v2. - // Once migration is complete, this method should be removed and/or not used. - Get(storeKey []byte, version uint64, key []byte) ([]byte, error) - // SetInitialVersion sets the initial version of the committer. SetInitialVersion(version uint64) error // GetCommitInfo returns the CommitInfo for the given version. GetCommitInfo(version uint64) (*proof.CommitInfo, error) + Get(storeKey []byte, version uint64, key []byte) ([]byte, error) + // Close releases associated resources. It should NOT be idempotent. It must // only be called once and any call after may panic. io.Closer diff --git a/store/v2/mock/db_mock.go b/store/v2/mock/db_mock.go index 8014e48514fe..60f660607929 100644 --- a/store/v2/mock/db_mock.go +++ b/store/v2/mock/db_mock.go @@ -404,3 +404,18 @@ func (mr *MockStateStorageMockRecorder) SetLatestVersion(version any) *gomock.Ca mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetLatestVersion", reflect.TypeOf((*MockStateStorage)(nil).SetLatestVersion), version) } + +// VersionExists mocks base method. +func (m *MockStateStorage) VersionExists(v uint64) (bool, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "VersionExists", v) + ret0, _ := ret[0].(bool) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// VersionExists indicates an expected call of VersionExists. +func (mr *MockStateStorageMockRecorder) VersionExists(v any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VersionExists", reflect.TypeOf((*MockStateStorage)(nil).VersionExists), v) +} diff --git a/store/v2/mock/types.go b/store/v2/mock/types.go index 95d623c8396f..a8c2a196d5bb 100644 --- a/store/v2/mock/types.go +++ b/store/v2/mock/types.go @@ -12,7 +12,7 @@ type StateCommitter interface { // StateStorage is a mock of store.VersionedDatabase type StateStorage interface { - store.VersionedDatabase + store.VersionedWriter store.UpgradableDatabase store.Pruner store.PausablePruner diff --git a/store/v2/root/store.go b/store/v2/root/store.go index 7447c60ae7b2..a96c65bafe18 100644 --- a/store/v2/root/store.go +++ b/store/v2/root/store.go @@ -38,7 +38,7 @@ type Store struct { dbCloser io.Closer // stateStorage reflects the state storage backend - stateStorage store.VersionedDatabase + stateStorage store.VersionedWriter // stateCommitment reflects the state commitment (SC) backend stateCommitment store.Committer @@ -74,7 +74,7 @@ type Store struct { func New( dbCloser io.Closer, logger corelog.Logger, - ss store.VersionedDatabase, + ss store.VersionedWriter, sc store.Committer, pm *pruning.Manager, mm *migration.Manager, @@ -127,19 +127,21 @@ func (s *Store) StateLatest() (uint64, corestore.ReaderMap, error) { return v, NewReaderMap(v, s), nil } +// StateAt checks if the requested version is present in ss. func (s *Store) StateAt(v uint64) (corestore.ReaderMap, error) { - // TODO(bez): We may want to avoid relying on the SC metadata here. Instead, - // we should add a VersionExists() method to the VersionedDatabase interface. - // - // Ref: https://github.com/cosmos/cosmos-sdk/issues/19091 - if cInfo, err := s.stateCommitment.GetCommitInfo(v); err != nil || cInfo == nil { - return nil, fmt.Errorf("failed to get commit info for version %d: %w", v, err) + // check if version is present in state storage + isExist, err := s.stateStorage.VersionExists(v) + if err != nil { + return nil, err + } + if !isExist { + return nil, fmt.Errorf("version %d does not exist", v) } return NewReaderMap(v, s), nil } -func (s *Store) GetStateStorage() store.VersionedDatabase { +func (s *Store) GetStateStorage() store.VersionedWriter { return s.stateStorage } diff --git a/store/v2/root/store_mock_test.go b/store/v2/root/store_mock_test.go index 68956ab47922..3a14054cd7e4 100644 --- a/store/v2/root/store_mock_test.go +++ b/store/v2/root/store_mock_test.go @@ -16,7 +16,7 @@ import ( "cosmossdk.io/store/v2/pruning" ) -func newTestRootStore(ss store.VersionedDatabase, sc store.Committer) *Store { +func newTestRootStore(ss store.VersionedWriter, sc store.Committer) *Store { noopLog := coretesting.NewNopLogger() pm := pruning.NewManager(sc.(store.Pruner), ss.(store.Pruner), nil, nil) return &Store{ diff --git a/store/v2/root/store_test.go b/store/v2/root/store_test.go index 9f925b098b9c..2d3f5a5b5758 100644 --- a/store/v2/root/store_test.go +++ b/store/v2/root/store_test.go @@ -90,7 +90,7 @@ func (s *RootStoreTestSuite) newStoreWithPruneConfig(config *store.PruningOption s.rootStore = rs } -func (s *RootStoreTestSuite) newStoreWithBackendMount(ss store.VersionedDatabase, sc store.Committer, pm *pruning.Manager) { +func (s *RootStoreTestSuite) newStoreWithBackendMount(ss store.VersionedWriter, sc store.Committer, pm *pruning.Manager) { noopLog := coretesting.NewNopLogger() rs, err := New(dbm.NewMemDB(), noopLog, ss, sc, pm, nil, nil) diff --git a/store/v2/storage/database.go b/store/v2/storage/database.go index fba599839594..e969a9ee6338 100644 --- a/store/v2/storage/database.go +++ b/store/v2/storage/database.go @@ -16,6 +16,7 @@ type Database interface { Get(storeKey []byte, version uint64, key []byte) ([]byte, error) GetLatestVersion() (uint64, error) SetLatestVersion(version uint64) error + VersionExists(version uint64) (bool, error) Iterator(storeKey []byte, version uint64, start, end []byte) (corestore.Iterator, error) ReverseIterator(storeKey []byte, version uint64, start, end []byte) (corestore.Iterator, error) diff --git a/store/v2/storage/pebbledb/db.go b/store/v2/storage/pebbledb/db.go index e5fd49ca3e5d..1547dba102d9 100644 --- a/store/v2/storage/pebbledb/db.go +++ b/store/v2/storage/pebbledb/db.go @@ -137,6 +137,15 @@ func (db *Database) GetLatestVersion() (uint64, error) { return binary.LittleEndian.Uint64(bz), closer.Close() } +func (db *Database) VersionExists(version uint64) (bool, error) { + latestVersion, err := db.GetLatestVersion() + if err != nil { + return false, err + } + + return latestVersion >= version && version >= db.earliestVersion, nil +} + func (db *Database) setPruneHeight(pruneVersion uint64) error { db.earliestVersion = pruneVersion + 1 diff --git a/store/v2/storage/rocksdb/db.go b/store/v2/storage/rocksdb/db.go index afac4cc9ff22..248b014f7b4e 100644 --- a/store/v2/storage/rocksdb/db.go +++ b/store/v2/storage/rocksdb/db.go @@ -131,6 +131,15 @@ func (db *Database) GetLatestVersion() (uint64, error) { return binary.LittleEndian.Uint64(bz), nil } +func (db *Database) VersionExists(version uint64) (bool, error) { + latestVersion, err := db.GetLatestVersion() + if err != nil { + return false, err + } + + return latestVersion >= version && version >= db.tsLow, nil +} + func (db *Database) Has(storeKey []byte, version uint64, key []byte) (bool, error) { slice, err := db.getSlice(storeKey, version, key) if err != nil { diff --git a/store/v2/storage/rocksdb/db_noflag.go b/store/v2/storage/rocksdb/db_noflag.go index def31e437a44..93bc3090f284 100644 --- a/store/v2/storage/rocksdb/db_noflag.go +++ b/store/v2/storage/rocksdb/db_noflag.go @@ -36,6 +36,10 @@ func (db *Database) GetLatestVersion() (uint64, error) { panic("rocksdb requires a build flag") } +func (db *Database) VersionExists(version uint64) (bool, error) { + panic("rocksdb requires a build flag") +} + func (db *Database) Has(storeKey []byte, version uint64, key []byte) (bool, error) { panic("rocksdb requires a build flag") } diff --git a/store/v2/storage/sqlite/db.go b/store/v2/storage/sqlite/db.go index 38750a0ac9a5..925648928601 100644 --- a/store/v2/storage/sqlite/db.go +++ b/store/v2/storage/sqlite/db.go @@ -103,7 +103,11 @@ func (db *Database) NewBatch(version uint64) (store.Batch, error) { } func (db *Database) GetLatestVersion() (uint64, error) { - stmt, err := db.storage.Prepare("SELECT value FROM state_storage WHERE store_key = ? AND key = ?") + stmt, err := db.storage.Prepare(` + SELECT value + FROM state_storage + WHERE store_key = ? AND key = ? + `) if err != nil { return 0, fmt.Errorf("failed to prepare SQL statement: %w", err) } @@ -123,6 +127,15 @@ func (db *Database) GetLatestVersion() (uint64, error) { return latestHeight, nil } +func (db *Database) VersionExists(v uint64) (bool, error) { + latestVersion, err := db.GetLatestVersion() + if err != nil { + return false, err + } + + return latestVersion >= v && v >= db.earliestVersion, nil +} + func (db *Database) SetLatestVersion(version uint64) error { _, err := db.storage.Exec(reservedUpsertStmt, reservedStoreKey, keyLatestHeight, version, 0, version) if err != nil { diff --git a/store/v2/storage/storage_bench_test.go b/store/v2/storage/storage_bench_test.go index 960c144782a9..35ffbbf5f8ae 100644 --- a/store/v2/storage/storage_bench_test.go +++ b/store/v2/storage/storage_bench_test.go @@ -24,12 +24,12 @@ import ( var storeKey1 = []byte("store1") var ( - backends = map[string]func(dataDir string) (store.VersionedDatabase, error){ - "rocksdb_versiondb_opts": func(dataDir string) (store.VersionedDatabase, error) { + backends = map[string]func(dataDir string) (store.VersionedWriter, error){ + "rocksdb_versiondb_opts": func(dataDir string) (store.VersionedWriter, error) { db, err := rocksdb.New(dataDir) return storage.NewStorageStore(db, coretesting.NewNopLogger()), err }, - "pebbledb_default_opts": func(dataDir string) (store.VersionedDatabase, error) { + "pebbledb_default_opts": func(dataDir string) (store.VersionedWriter, error) { db, err := pebbledb.New(dataDir) if err == nil && db != nil { db.SetSync(false) @@ -37,7 +37,7 @@ var ( return storage.NewStorageStore(db, coretesting.NewNopLogger()), err }, - "btree_sqlite": func(dataDir string) (store.VersionedDatabase, error) { + "btree_sqlite": func(dataDir string) (store.VersionedWriter, error) { db, err := sqlite.New(dataDir) return storage.NewStorageStore(db, coretesting.NewNopLogger()), err }, diff --git a/store/v2/storage/storage_test_suite.go b/store/v2/storage/storage_test_suite.go index 08f455ca12ca..fb5ff24a0c90 100644 --- a/store/v2/storage/storage_test_suite.go +++ b/store/v2/storage/storage_test_suite.go @@ -880,9 +880,149 @@ func (s *StorageTestSuite) TestRemovingOldStoreKey() { } } +// TestVersionExists tests the VersionExists method of the Database struct. +func (s *StorageTestSuite) TestVersionExists() { + // Define test cases + testCases := []struct { + name string + setup func(t *testing.T, db *StorageStore) + version uint64 + expectedExists bool + expectError bool + }{ + { + name: "Fresh database: version 0 exists", + setup: func(t *testing.T, db *StorageStore) { + t.Helper() + // No setup needed for fresh database + }, + version: 0, + expectedExists: true, + expectError: false, + }, + { + name: "Fresh database: version 1 exists", + setup: func(t *testing.T, db *StorageStore) { + t.Helper() + // No setup needed for fresh database + }, + version: 1, + expectedExists: false, + expectError: false, + }, + { + name: "After setting latest version to 10, version 5 exists", + setup: func(t *testing.T, db *StorageStore) { + t.Helper() + err := db.SetLatestVersion(10) + if err != nil { + t.Fatalf("Setting latest version should not error: %v", err) + } + }, + version: 5, + expectedExists: true, // Since pruning hasn't occurred, earliestVersion is still 0 + expectError: false, + }, + { + name: "After setting latest version to 10 and pruning to 5, version 4 does not exist", + setup: func(t *testing.T, db *StorageStore) { + t.Helper() + err := db.SetLatestVersion(10) + if err != nil { + t.Fatalf("Setting latest version should not error: %v", err) + } + + err = db.Prune(5) + if err != nil { + t.Fatalf("Pruning to version 5 should not error: %v", err) + } + }, + version: 4, + expectedExists: false, + expectError: false, + }, + { + name: "After setting latest version to 10 and pruning to 5, version 5 does not exist", + setup: func(t *testing.T, db *StorageStore) { + t.Helper() + err := db.SetLatestVersion(10) + if err != nil { + t.Fatalf("Setting latest version should not error: %v", err) + } + + err = db.Prune(5) + if err != nil { + t.Fatalf("Pruning to version 5 should not error: %v", err) + } + }, + version: 5, + expectedExists: false, + expectError: false, + }, + { + name: "After setting latest version to 10 and pruning to 5, version 6 exists", + setup: func(t *testing.T, db *StorageStore) { + t.Helper() + err := db.SetLatestVersion(10) + if err != nil { + t.Fatalf("Setting latest version should not error: %v", err) + } + + err = db.Prune(5) + if err != nil { + t.Fatalf("Pruning to version 5 should not error: %v", err) + } + }, + version: 6, + expectedExists: true, + expectError: false, + }, + { + name: "After pruning to 0, all versions >=1 exist", + setup: func(t *testing.T, db *StorageStore) { + t.Helper() + err := db.SetLatestVersion(10) + if err != nil { + t.Fatalf("Setting latest version should not error: %v", err) + } + // Prune to version 0 + err = db.Prune(0) + if err != nil { + t.Fatalf("Pruning to version 0 should not error: %v", err) + } + }, + version: 1, + expectedExists: true, + expectError: false, + }, + } + + // Iterate over each test case + for _, tc := range testCases { + s.T().Run(tc.name, func(t *testing.T) { + // Initialize the database for each test + db, err := s.NewDB(t.TempDir()) + require.NoError(t, err, "Failed to initialize the database") + defer db.Close() + + // Setup test environment + tc.setup(t, db) + + // Call VersionExists and check the result + exists, err := db.VersionExists(tc.version) + if tc.expectError { + require.Error(t, err, "Expected error but got none") + } else { + require.NoError(t, err, "Did not expect an error but got one") + require.Equal(t, tc.expectedExists, exists, "Version existence mismatch") + } + }) + } +} + func dbApplyChangeset( t *testing.T, - db store.VersionedDatabase, + db store.VersionedWriter, version uint64, storeKey string, keys, vals [][]byte, diff --git a/store/v2/storage/store.go b/store/v2/storage/store.go index 9ea839562847..b16ee9e7eae4 100644 --- a/store/v2/storage/store.go +++ b/store/v2/storage/store.go @@ -16,7 +16,7 @@ const ( ) var ( - _ store.VersionedDatabase = (*StorageStore)(nil) + _ store.VersionedWriter = (*StorageStore)(nil) _ snapshots.StorageSnapshotter = (*StorageStore)(nil) _ store.Pruner = (*StorageStore)(nil) _ store.UpgradableDatabase = (*StorageStore)(nil) @@ -84,6 +84,11 @@ func (ss *StorageStore) SetLatestVersion(version uint64) error { return ss.db.SetLatestVersion(version) } +// VersionExists returns true if the given version exists in the store. +func (ss *StorageStore) VersionExists(version uint64) (bool, error) { + return ss.db.VersionExists(version) +} + // Iterator returns an iterator over the specified domain and prefix. func (ss *StorageStore) Iterator(storeKey []byte, version uint64, start, end []byte) (corestore.Iterator, error) { return ss.db.Iterator(storeKey, version, start, end) diff --git a/store/v2/store.go b/store/v2/store.go index 1adf44f0b89b..24ba636e10aa 100644 --- a/store/v2/store.go +++ b/store/v2/store.go @@ -70,7 +70,7 @@ type RootStore interface { // Backend defines the interface for the RootStore backends. type Backend interface { // GetStateStorage returns the SS backend. - GetStateStorage() VersionedDatabase + GetStateStorage() VersionedWriter // GetStateCommitment returns the SC backend. GetStateCommitment() Committer From 8a0244b43b2f9eef46ddf2539be17ea46bdf2e16 Mon Sep 17 00:00:00 2001 From: Marko Date: Wed, 16 Oct 2024 18:26:34 +0200 Subject: [PATCH 43/57] chore: add crisis changelog (#22280) --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e2670454a86a..c6d9cc8c6a55 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -228,6 +228,7 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i * (types/mempool) [#21744](https://github.com/cosmos/cosmos-sdk/pull/21744) Update types/mempool.Mempool interface to take decoded transactions. This avoid to decode the transaction twice. * (x/auth/tx/config) [#21822](https://github.com/cosmos/cosmos-sdk/pull/21822) Sign mode textual is no more automatically added to tx config when using runtime. Should be added manually on the server side. * (x/auth/tx/config) [#21822](https://github.com/cosmos/cosmos-sdk/pull/21822) This depinject module now only provide txconfig and tx config options. `x/validate` now handles the providing of ante/post handlers, alongside tx validators for v2. The corresponding app config options have been removed from the depinject module config. +* (x/crisis) [#20809](https://github.com/cosmos/cosmos-sdk/pull/20809) Crisis module was removed from the Cosmos SDK. ### Client Breaking Changes From 553e11082c8ff1b955a03a6e05de948939d578bf Mon Sep 17 00:00:00 2001 From: Akhil Kumar P <36399231+akhilkumarpilli@users.noreply.github.com> Date: Thu, 17 Oct 2024 01:38:53 +0530 Subject: [PATCH 44/57] test: migrate e2e/group to system tests (#22278) --- tests/e2e/group/cli_test.go | 20 --- tests/e2e/group/suite.go | 290 -------------------------------- tests/systemtests/group_test.go | 131 +++++++++++++++ 3 files changed, 131 insertions(+), 310 deletions(-) delete mode 100644 tests/e2e/group/cli_test.go delete mode 100644 tests/e2e/group/suite.go create mode 100644 tests/systemtests/group_test.go diff --git a/tests/e2e/group/cli_test.go b/tests/e2e/group/cli_test.go deleted file mode 100644 index 7c6e86088623..000000000000 --- a/tests/e2e/group/cli_test.go +++ /dev/null @@ -1,20 +0,0 @@ -//go:build e2e -// +build e2e - -package group - -import ( - "testing" - - "github.com/stretchr/testify/suite" - - "cosmossdk.io/simapp" - - "github.com/cosmos/cosmos-sdk/testutil/network" -) - -func TestE2ETestSuite(t *testing.T) { - cfg := network.DefaultConfig(simapp.NewTestNetworkFixture) - cfg.NumValidators = 1 - suite.Run(t, NewE2ETestSuite(cfg)) -} diff --git a/tests/e2e/group/suite.go b/tests/e2e/group/suite.go deleted file mode 100644 index 2dd59828f719..000000000000 --- a/tests/e2e/group/suite.go +++ /dev/null @@ -1,290 +0,0 @@ -package group - -import ( - "encoding/base64" - "encoding/json" - "fmt" - - "github.com/stretchr/testify/suite" - - // without this import amino json encoding will fail when resolving any types - _ "cosmossdk.io/api/cosmos/group/v1" - "cosmossdk.io/math" - banktypes "cosmossdk.io/x/bank/types" - "cosmossdk.io/x/group" - client "cosmossdk.io/x/group/client/cli" - - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/crypto/hd" - "github.com/cosmos/cosmos-sdk/crypto/keyring" - "github.com/cosmos/cosmos-sdk/testutil" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" - "github.com/cosmos/cosmos-sdk/testutil/network" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -type E2ETestSuite struct { - suite.Suite - - cfg network.Config - network network.NetworkI - - group *group.GroupInfo - groupPolicies []*group.GroupPolicyInfo - proposal *group.Proposal - vote *group.Vote - voter *group.Member - commonFlags []string -} - -const validMetadata = "metadata" - -func NewE2ETestSuite(cfg network.Config) *E2ETestSuite { - return &E2ETestSuite{cfg: cfg} -} - -func (s *E2ETestSuite) SetupSuite() { - s.T().Log("setting up e2e test suite") - - s.commonFlags = []string{ - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, math.NewInt(10))).String()), - } - - var err error - s.network, err = network.New(s.T(), s.T().TempDir(), s.cfg) - s.Require().NoError(err) - s.Require().NoError(s.network.WaitForNextBlock()) - - val := s.network.GetValidators()[0] - - // create a new account - info, _, err := val.GetClientCtx().Keyring.NewMnemonic("NewValidator", keyring.English, sdk.FullFundraiserPath, keyring.DefaultBIP39Passphrase, hd.Secp256k1) - s.Require().NoError(err) - - pk, err := info.GetPubKey() - s.Require().NoError(err) - - account := sdk.AccAddress(pk.Address()) - msgSend := &banktypes.MsgSend{ - FromAddress: val.GetAddress().String(), - ToAddress: account.String(), - Amount: sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, math.NewInt(2000))), - } - - _, err = clitestutil.SubmitTestTx( - val.GetClientCtx(), - msgSend, - val.GetAddress(), - clitestutil.TestTxConfig{ - GenOnly: true, - }, - ) - - s.Require().NoError(err) - s.Require().NoError(s.network.WaitForNextBlock()) - - memberWeight := "3" - // create a group - validMembers := fmt.Sprintf(` - { - "members": [ - { - "address": "%s", - "weight": "%s", - "metadata": "%s" - } - ] - }`, val.GetAddress().String(), memberWeight, validMetadata) - validMembersFile := testutil.WriteToNewTempFile(s.T(), validMembers) - out, err := clitestutil.ExecTestCLICmd(val.GetClientCtx(), client.MsgCreateGroupCmd(), - append( - []string{ - val.GetAddress().String(), - validMetadata, - validMembersFile.Name(), - }, - s.commonFlags..., - ), - ) - s.Require().NoError(err, out.String()) - txResp := sdk.TxResponse{} - s.Require().NoError(val.GetClientCtx().Codec.UnmarshalJSON(out.Bytes(), &txResp), out.String()) - s.Require().NoError(clitestutil.CheckTxCode(s.network, val.GetClientCtx(), txResp.TxHash, 0)) - - s.group = &group.GroupInfo{Id: 1, Admin: val.GetAddress().String(), Metadata: validMetadata, TotalWeight: "3", Version: 1} - - // create 5 group policies - for i := 0; i < 5; i++ { - threshold := i + 1 - if threshold > 3 { - threshold = 3 - } - - s.createGroupThresholdPolicyWithBalance(val.GetAddress().String(), "1", threshold, 1000) - s.Require().NoError(s.network.WaitForNextBlock()) - resp, err := testutil.GetRequest(fmt.Sprintf("%s/cosmos/group/v1/group_policies_by_group/1", val.GetAPIAddress())) - s.Require().NoError(err) - - var groupPoliciesResp group.QueryGroupPoliciesByGroupResponse - s.Require().NoError(val.GetClientCtx().Codec.UnmarshalJSON(resp, &groupPoliciesResp)) - s.Require().Len(groupPoliciesResp.GroupPolicies, i+1) - } - // create group policy with percentage decision policy - out, err = clitestutil.ExecTestCLICmd(val.GetClientCtx(), client.MsgCreateGroupPolicyCmd(), - append( - []string{ - val.GetAddress().String(), - "1", - validMetadata, - testutil.WriteToNewTempFile(s.T(), fmt.Sprintf(`{"@type":"/cosmos.group.v1.PercentageDecisionPolicy", "percentage":"%f", "windows":{"voting_period":"30000s"}}`, 0.5)).Name(), - }, - s.commonFlags..., - ), - ) - s.Require().NoError(err, out.String()) - s.Require().NoError(val.GetClientCtx().Codec.UnmarshalJSON(out.Bytes(), &txResp), out.String()) - s.Require().NoError(clitestutil.CheckTxCode(s.network, val.GetClientCtx(), txResp.TxHash, 0)) - - resp, err := testutil.GetRequest(fmt.Sprintf("%s/cosmos/group/v1/group_policies_by_group/1", val.GetAPIAddress())) - s.Require().NoError(err) - - var groupPoliciesResp group.QueryGroupPoliciesByGroupResponse - s.Require().NoError(val.GetClientCtx().Codec.UnmarshalJSON(resp, &groupPoliciesResp)) - s.Require().Equal(len(groupPoliciesResp.GroupPolicies), 6) - s.groupPolicies = groupPoliciesResp.GroupPolicies - - // create a proposal - out, err = clitestutil.ExecTestCLICmd(val.GetClientCtx(), client.MsgSubmitProposalCmd(), - append( - []string{ - s.createCLIProposal( - s.groupPolicies[0].Address, val.GetAddress().String(), - s.groupPolicies[0].Address, val.GetAddress().String(), - "", "title", "summary"), - }, - s.commonFlags..., - ), - ) - s.Require().NoError(err, out.String()) - s.Require().NoError(val.GetClientCtx().Codec.UnmarshalJSON(out.Bytes(), &txResp), out.String()) - s.Require().NoError(clitestutil.CheckTxCode(s.network, val.GetClientCtx(), txResp.TxHash, 0)) - - msg := &group.MsgVote{ - ProposalId: uint64(1), - Voter: val.GetAddress().String(), - Option: group.VOTE_OPTION_YES, - } - - // vote - out, err = clitestutil.SubmitTestTx(val.GetClientCtx(), msg, val.GetAddress(), clitestutil.TestTxConfig{}) - s.Require().NoError(err, out.String()) - s.Require().NoError(val.GetClientCtx().Codec.UnmarshalJSON(out.Bytes(), &txResp), out.String()) - s.Require().NoError(clitestutil.CheckTxCode(s.network, val.GetClientCtx(), txResp.TxHash, 0)) - - resp, err = testutil.GetRequest(fmt.Sprintf("%s/cosmos/group/v1/proposal/1", val.GetAPIAddress())) - s.Require().NoError(err) - - var proposalRes group.QueryProposalResponse - s.Require().NoError(val.GetClientCtx().Codec.UnmarshalJSON(resp, &proposalRes)) - s.proposal = proposalRes.Proposal - - resp, err = testutil.GetRequest(fmt.Sprintf("%s/cosmos/group/v1/vote_by_proposal_voter/1/%s", val.GetAPIAddress(), val.GetAddress().String())) - s.Require().NoError(err) - - var voteRes group.QueryVoteByProposalVoterResponse - s.Require().NoError(val.GetClientCtx().Codec.UnmarshalJSON(resp, &voteRes)) - s.vote = voteRes.Vote - - s.voter = &group.Member{ - Address: val.GetAddress().String(), - Weight: memberWeight, - Metadata: validMetadata, - } -} - -func (s *E2ETestSuite) TearDownSuite() { - s.T().Log("tearing down e2e test suite") - s.network.Cleanup() -} - -// createCLIProposal writes a CLI proposal with a MsgSend to a file. Returns -// the path to the JSON file. -func (s *E2ETestSuite) createCLIProposal(groupPolicyAddress, proposer, sendFrom, sendTo, metadata, title, summary string) string { - _, err := base64.StdEncoding.DecodeString(metadata) - s.Require().NoError(err) - - msg := banktypes.MsgSend{ - FromAddress: sendFrom, - ToAddress: sendTo, - Amount: sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, math.NewInt(20))), - } - msgJSON, err := s.cfg.Codec.MarshalInterfaceJSON(&msg) - s.Require().NoError(err) - - p := client.Proposal{ - GroupPolicyAddress: groupPolicyAddress, - Messages: []json.RawMessage{msgJSON}, - Metadata: metadata, - Proposers: []string{proposer}, - Title: title, - Summary: summary, - } - - bz, err := json.Marshal(&p) - s.Require().NoError(err) - - return testutil.WriteToNewTempFile(s.T(), string(bz)).Name() -} - -func (s *E2ETestSuite) createGroupThresholdPolicyWithBalance(adminAddress, groupID string, threshold int, tokens int64) string { - s.Require().NoError(s.network.WaitForNextBlock()) - - val := s.network.GetValidators()[0] - clientCtx := val.GetClientCtx() - - out, err := clitestutil.ExecTestCLICmd(clientCtx, client.MsgCreateGroupPolicyCmd(), - append( - []string{ - adminAddress, - groupID, - validMetadata, - testutil.WriteToNewTempFile(s.T(), fmt.Sprintf(`{"@type":"/cosmos.group.v1.ThresholdDecisionPolicy", "threshold":"%d", "windows":{"voting_period":"30000s"}}`, threshold)).Name(), - }, - s.commonFlags..., - ), - ) - txResp := sdk.TxResponse{} - s.Require().NoError(err, out.String()) - s.Require().NoError(val.GetClientCtx().Codec.UnmarshalJSON(out.Bytes(), &txResp), out.String()) - s.Require().NoError(clitestutil.CheckTxCode(s.network, val.GetClientCtx(), txResp.TxHash, 0)) - - resp, err := testutil.GetRequest(fmt.Sprintf("%s/cosmos/group/v1/group_policies_by_group/%s", val.GetAPIAddress(), groupID)) - s.Require().NoError(err) - - var res group.QueryGroupPoliciesByGroupResponse - s.Require().NoError(val.GetClientCtx().Codec.UnmarshalJSON(resp, &res)) - groupPolicyAddress := res.GroupPolicies[0].Address - - addr, err := sdk.AccAddressFromBech32(groupPolicyAddress) - s.Require().NoError(err) - - msgSend := &banktypes.MsgSend{ - FromAddress: val.GetAddress().String(), - ToAddress: addr.String(), - Amount: sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, math.NewInt(tokens))), - } - - _, err = clitestutil.SubmitTestTx( - val.GetClientCtx(), - msgSend, - val.GetAddress(), - clitestutil.TestTxConfig{ - GenOnly: true, - }, - ) - s.Require().NoError(err) - - return groupPolicyAddress -} diff --git a/tests/systemtests/group_test.go b/tests/systemtests/group_test.go new file mode 100644 index 000000000000..6966d30751e5 --- /dev/null +++ b/tests/systemtests/group_test.go @@ -0,0 +1,131 @@ +//go:build system_test + +package systemtests + +import ( + "fmt" + "testing" + + "github.com/stretchr/testify/require" + "github.com/tidwall/gjson" +) + +const ( + validMetadata = "metadata" +) + +func TestGroupCommands(t *testing.T) { + // scenario: test group commands + // given a running chain + + sut.ResetChain(t) + require.GreaterOrEqual(t, sut.NodesCount(), 2) + + cli := NewCLIWrapper(t, sut, verbose) + + // get validator address + valAddr := cli.GetKeyAddr("node0") + require.NotEmpty(t, valAddr) + + sut.StartChain(t) + + baseurl := sut.APIAddress() + + // test create group + memberWeight := "5" + validMembers := fmt.Sprintf(` + { + "members": [ + { + "address": "%s", + "weight": "%s", + "metadata": "%s" + } + ] + }`, valAddr, memberWeight, validMetadata) + validMembersFile := StoreTempFile(t, []byte(validMembers)) + createGroupCmd := []string{"tx", "group", "create-group", valAddr, validMetadata, validMembersFile.Name(), "--from=" + valAddr} + rsp := cli.RunAndWait(createGroupCmd...) + RequireTxSuccess(t, rsp) + + // query groups by admin to confirm group creation + rsp = cli.CustomQuery("q", "group", "groups-by-admin", valAddr) + require.Len(t, gjson.Get(rsp, "groups").Array(), 1) + groupId := gjson.Get(rsp, "groups.0.id").String() + + // test create group policies + for i := 0; i < 5; i++ { + threshold := i + 1 + policyFile := StoreTempFile(t, []byte(fmt.Sprintf(`{"@type":"/cosmos.group.v1.ThresholdDecisionPolicy", "threshold":"%d", "windows":{"voting_period":"30000s"}}`, threshold))) + policyCmd := []string{"tx", "group", "create-group-policy", valAddr, groupId, validMetadata, policyFile.Name(), "--from=" + valAddr} + rsp = cli.RunAndWait(policyCmd...) + RequireTxSuccess(t, rsp) + + // TODO: remove isV2() check once v2 is integrated with grpc gateway + var groupPoliciesResp, policyAddrQuery string + if isV2() { + groupPoliciesResp = cli.CustomQuery("q", "group", "group-policies-by-group", groupId) + policyAddrQuery = fmt.Sprintf("group_policies.#(decision_policy.value.threshold==%d).address", threshold) + } else { + groupPoliciesResp = string(GetRequest(t, fmt.Sprintf("%s/cosmos/group/v1/group_policies_by_group/%s", baseurl, groupId))) + policyAddrQuery = fmt.Sprintf("group_policies.#(decision_policy.threshold==%d).address", threshold) + } + require.Equal(t, gjson.Get(groupPoliciesResp, "pagination.total").Int(), int64(threshold)) + policyAddr := gjson.Get(groupPoliciesResp, policyAddrQuery).String() + require.NotEmpty(t, policyAddr) + + rsp = cli.RunCommandWithArgs(cli.withTXFlags("tx", "bank", "send", valAddr, policyAddr, "1000stake", "--generate-only")...) + require.Equal(t, policyAddr, gjson.Get(rsp, "body.messages.0.to_address").String()) + } + + // test create group policy with percentage decision policy + percentagePolicyType := "/cosmos.group.v1.PercentageDecisionPolicy" + policyFile := StoreTempFile(t, []byte(fmt.Sprintf(`{"@type":"%s", "percentage":"%f", "windows":{"voting_period":"30000s"}}`, percentagePolicyType, 0.5))) + policyCmd := []string{"tx", "group", "create-group-policy", valAddr, groupId, validMetadata, policyFile.Name(), "--from=" + valAddr} + rsp = cli.RunAndWait(policyCmd...) + RequireTxSuccess(t, rsp) + + groupPoliciesResp := cli.CustomQuery("q", "group", "group-policies-by-admin", valAddr) + require.Equal(t, gjson.Get(groupPoliciesResp, "pagination.total").Int(), int64(6)) + policyAddr := gjson.Get(groupPoliciesResp, fmt.Sprintf("group_policies.#(decision_policy.type==%s).address", percentagePolicyType)).String() + require.NotEmpty(t, policyAddr) + + // test create proposal + proposalJSON := fmt.Sprintf(`{ + "group_policy_address": "%s", + "messages":[ + { + "@type": "/cosmos.bank.v1beta1.MsgSend", + "from_address": "%s", + "to_address": "%s", + "amount": [{"denom": "stake","amount": "100"}] + } + ], + "metadata": "%s", + "title": "My Proposal", + "summary": "Summary", + "proposers": ["%s"] + }`, policyAddr, policyAddr, valAddr, validMetadata, valAddr) + proposalFile := StoreTempFile(t, []byte(proposalJSON)) + rsp = cli.RunAndWait("tx", "group", "submit-proposal", proposalFile.Name()) + RequireTxSuccess(t, rsp) + + // query proposals + rsp = cli.CustomQuery("q", "group", "proposals-by-group-policy", policyAddr) + require.Len(t, gjson.Get(rsp, "proposals").Array(), 1) + proposalId := gjson.Get(rsp, "proposals.0.id").String() + + // test vote proposal + rsp = cli.RunAndWait("tx", "group", "vote", proposalId, valAddr, "yes", validMetadata) + RequireTxSuccess(t, rsp) + + // query votes + // TODO: remove isV2() check once v2 is integrated with grpc gateway + var voteResp string + if isV2() { + voteResp = cli.CustomQuery("q", "group", "vote", proposalId, valAddr) + } else { + voteResp = string(GetRequest(t, fmt.Sprintf("%s/cosmos/group/v1/vote_by_proposal_voter/%s/%s", baseurl, proposalId, valAddr))) + } + require.Equal(t, "VOTE_OPTION_YES", gjson.Get(voteResp, "vote.option").String()) +} From 3440ad6e6022975bc96e46df9bbeca9a02968a0e Mon Sep 17 00:00:00 2001 From: Vishal Potpelliwar <71565171+vishal-kanna@users.noreply.github.com> Date: Thu, 17 Oct 2024 14:16:18 +0530 Subject: [PATCH 45/57] docs(x/accounts): fix doc (#22295) --- x/accounts/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/accounts/README.md b/x/accounts/README.md index a7490a9fcc65..9d14fd808b74 100644 --- a/x/accounts/README.md +++ b/x/accounts/README.md @@ -502,7 +502,7 @@ In order to create accounts at genesis, the `x/accounts` module allows developer a list of genesis `MsgInit` messages that will be executed in the `x/accounts` genesis flow. The init messages are generated offline. You can also use the following CLI command to generate the -json messages: `simd accounts tx init [account type] [msg] --from me --genesis`. This will generate +json messages: `simd tx accounts init [account type] [msg] --from me --genesis`. This will generate a jsonified init message wrapped in an x/accounts `MsgInit`. This follows the same initialization flow and rules that would happen if the chain is running. From 20dd65b057e13948a9c8ccde7ff9d2224210190b Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Thu, 17 Oct 2024 16:03:57 +0700 Subject: [PATCH 46/57] refactor: improvements on rest v2 server (#22292) --- scripts/init-simapp-v2.sh | 2 +- server/v2/api/rest/server.go | 2 +- tools/confix/data/v2-app.toml | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/init-simapp-v2.sh b/scripts/init-simapp-v2.sh index ca25b4f706c0..7410b2174746 100755 --- a/scripts/init-simapp-v2.sh +++ b/scripts/init-simapp-v2.sh @@ -9,7 +9,7 @@ if [ -d "$SIMD_HOME" ]; then rm -rv $SIMD_HOME; fi $SIMD_BIN config set client chain-id simapp-v2-chain $SIMD_BIN config set client keyring-backend test $SIMD_BIN config set client keyring-default-keyname alice -$SIMD_BIN config set app api.enable true +$SIMD_BIN config set app rest.enable true $SIMD_BIN keys add alice --indiscreet $SIMD_BIN keys add bob --indiscreet $SIMD_BIN init simapp-v2-node --chain-id simapp-v2-chain diff --git a/server/v2/api/rest/server.go b/server/v2/api/rest/server.go index eaa0fe8b6b94..993501c710eb 100644 --- a/server/v2/api/rest/server.go +++ b/server/v2/api/rest/server.go @@ -12,7 +12,7 @@ import ( ) const ( - ServerName = "rest-v2" + ServerName = "rest" ) type Server[T transaction.Tx] struct { diff --git a/tools/confix/data/v2-app.toml b/tools/confix/data/v2-app.toml index 8a35d32f543b..842dc0df561b 100644 --- a/tools/confix/data/v2-app.toml +++ b/tools/confix/data/v2-app.toml @@ -41,6 +41,12 @@ max-recv-msg-size = 10485760 # The default value is math.MaxInt32. max-send-msg-size = 2147483647 +[rest] +# Enable defines if the REST server should be enabled. +enable = true +# Address defines the REST server address to bind to. +address = 'localhost:8080' + [server] # minimum-gas-prices defines the price which a validator is willing to accept for processing a transaction. A transaction's fees must meet the minimum of any denomination specified in this config (e.g. 0.25token1;0.0001token2). minimum-gas-prices = '0stake' From f01baf302e2bbe9648cf454372115dfd1488b663 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Thu, 17 Oct 2024 11:14:05 +0200 Subject: [PATCH 47/57] fix(server/v2/cometbft): fix mock store (#22293) --- server/v2/cometbft/internal/mock/mock_store.go | 8 ++++---- store/v2/mock/types.go | 2 +- store/v2/storage/README.md | 8 ++++---- store/v2/storage/store.go | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/server/v2/cometbft/internal/mock/mock_store.go b/server/v2/cometbft/internal/mock/mock_store.go index 15a47b33d639..765659ce6042 100644 --- a/server/v2/cometbft/internal/mock/mock_store.go +++ b/server/v2/cometbft/internal/mock/mock_store.go @@ -16,11 +16,11 @@ import ( ) type MockStore struct { - Storage storev2.VersionedDatabase + Storage storev2.VersionedWriter Committer storev2.Committer } -func NewMockStorage(logger log.Logger, dir string) storev2.VersionedDatabase { +func NewMockStorage(logger log.Logger, dir string) storev2.VersionedWriter { storageDB, _ := sqlite.New(dir) ss := storage.NewStorageStore(storageDB, logger) return ss @@ -36,7 +36,7 @@ func NewMockCommiter(logger log.Logger, actors ...string) storev2.Committer { return sc } -func NewMockStore(ss storev2.VersionedDatabase, sc storev2.Committer) *MockStore { +func NewMockStore(ss storev2.VersionedWriter, sc storev2.Committer) *MockStore { return &MockStore{Storage: ss, Committer: sc} } @@ -83,7 +83,7 @@ func (s *MockStore) StateAt(version uint64) (corestore.ReaderMap, error) { return NewMockReaderMap(version, s), nil } -func (s *MockStore) GetStateStorage() storev2.VersionedDatabase { +func (s *MockStore) GetStateStorage() storev2.VersionedWriter { return s.Storage } diff --git a/store/v2/mock/types.go b/store/v2/mock/types.go index a8c2a196d5bb..83eba3326f26 100644 --- a/store/v2/mock/types.go +++ b/store/v2/mock/types.go @@ -10,7 +10,7 @@ type StateCommitter interface { store.UpgradeableStore } -// StateStorage is a mock of store.VersionedDatabase +// StateStorage is a mock of store.VersionedWriter type StateStorage interface { store.VersionedWriter store.UpgradableDatabase diff --git a/store/v2/storage/README.md b/store/v2/storage/README.md index 5467bff24a05..aaffab357c30 100644 --- a/store/v2/storage/README.md +++ b/store/v2/storage/README.md @@ -2,7 +2,7 @@ The `storage` package contains the state storage (SS) implementation. Specifically, it contains RocksDB, PebbleDB, and SQLite (Btree) backend implementations of the -`VersionedDatabase` interface. +`VersionedWriter` interface. The goal of SS is to provide a modular storage backend, i.e. multiple implementations, to facilitate storing versioned raw key/value pairs in a fast embedded database, @@ -26,7 +26,7 @@ latest and historical versions efficiently. ### RocksDB The RocksDB implementation is a CGO-based SS implementation. It fully supports -the `VersionedDatabase` API and is arguably the most efficient implementation. It +the `VersionedWriter` API and is arguably the most efficient implementation. It also supports versioning out-of-the-box using User-defined Timestamps in ColumnFamilies (CF). However, it requires the CGO dependency which can complicate an app’s build process. @@ -42,7 +42,7 @@ and does not require CGO. ### SQLite (Btree) The SQLite implementation is another CGO-based SS implementation. It fully supports -the `VersionedDatabase` API. The implementation is relatively straightforward and +the `VersionedWriter` API. The implementation is relatively straightforward and easy to understand as it’s entirely SQL-based. However, benchmarks show that this options is least performant, even for reads. This SS backend has a lot of promise, but needs more benchmarking and potential SQL optimizations, like dedicated tables @@ -92,7 +92,7 @@ batch object which is committed to the underlying SS engine. An SS backend is meant to be used within a broader store implementation, as it only stores data for direct and historical query purposes. We define a `Database` -interface in the `storage` package which is mean to be represent a `VersionedDatabase` +interface in the `storage` package which is mean to be represent a `VersionedWriter` with only the necessary methods. The `StorageStore` interface is meant to wrap or accept this `Database` type, e.g. RocksDB. diff --git a/store/v2/storage/store.go b/store/v2/storage/store.go index b16ee9e7eae4..aa1095cd11aa 100644 --- a/store/v2/storage/store.go +++ b/store/v2/storage/store.go @@ -22,7 +22,7 @@ var ( _ store.UpgradableDatabase = (*StorageStore)(nil) ) -// StorageStore is a wrapper around the store.VersionedDatabase interface. +// StorageStore is a wrapper around the store.VersionedWriter interface. type StorageStore struct { logger log.Logger db Database From 11698aa864f69f7f2e8a79106989dcb32dcc0ac7 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Thu, 17 Oct 2024 15:09:57 +0200 Subject: [PATCH 48/57] feat(baseapp): Abort OE in PrepareProposal (Upstream dydx) (#22287) Co-authored-by: Teddy Ding --- baseapp/abci.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/baseapp/abci.go b/baseapp/abci.go index 15646e438ab6..979089c5c86d 100644 --- a/baseapp/abci.go +++ b/baseapp/abci.go @@ -409,6 +409,14 @@ func (app *BaseApp) PrepareProposal(req *abci.PrepareProposalRequest) (resp *abc return nil, errors.New("PrepareProposal handler not set") } + // Abort any running OE so it cannot overlap with `PrepareProposal`. This could happen if optimistic + // `internalFinalizeBlock` from previous round takes a long time, but consensus has moved on to next round. + // Overlap is undesirable, since `internalFinalizeBlock` and `PrepareProoposal` could share access to + // in-memory structs depending on application implementation. + // No-op if OE is not enabled. + // Similar call to Abort() is done in `ProcessProposal`. + app.optimisticExec.Abort() + // Always reset state given that PrepareProposal can timeout and be called // again in a subsequent round. header := cmtproto.Header{ From c905c5ee9b7ea631183715ee61e87614611483b9 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Thu, 17 Oct 2024 15:10:13 +0200 Subject: [PATCH 49/57] feat(server/v2): enable pprof (#22284) --- server/v2/commands.go | 41 ++++++++++++++++++++++++++++++++++++----- server/v2/flags.go | 5 ++++- server/v2/server.go | 2 ++ 3 files changed, 42 insertions(+), 6 deletions(-) diff --git a/server/v2/commands.go b/server/v2/commands.go index 86f8e400467c..d5c202ade9f7 100644 --- a/server/v2/commands.go +++ b/server/v2/commands.go @@ -6,6 +6,7 @@ import ( "os" "os/signal" "path/filepath" + "runtime/pprof" "strings" "syscall" @@ -13,6 +14,7 @@ import ( "github.com/spf13/viper" "cosmossdk.io/core/transaction" + "cosmossdk.io/log" ) // Execute executes the root command of an application. @@ -127,11 +129,9 @@ func createStartCommand[T transaction.Tx]( } }() - if err := server.Start(ctx); err != nil { - return err - } - - return nil + return wrapCPUProfile(l, v, func() error { + return server.Start(ctx) + }) }, } @@ -143,6 +143,37 @@ func createStartCommand[T transaction.Tx]( return cmd } +// wrapCPUProfile starts CPU profiling, if enabled, and executes the provided +// callbackFn, then waits for it to return. +func wrapCPUProfile(logger log.Logger, v *viper.Viper, callbackFn func() error) error { + cpuProfileFile := v.GetString(FlagCPUProfiling) + if len(cpuProfileFile) == 0 { + // if cpu profiling is not enabled, just run the callback + return callbackFn() + } + + f, err := os.Create(cpuProfileFile) + if err != nil { + return err + } + + logger.Info("starting CPU profiler", "profile", cpuProfileFile) + if err := pprof.StartCPUProfile(f); err != nil { + _ = f.Close() + return err + } + + defer func() { + logger.Info("stopping CPU profiler", "profile", cpuProfileFile) + pprof.StopCPUProfile() + if err := f.Close(); err != nil { + logger.Info("failed to close cpu-profile file", "profile", cpuProfileFile, "err", err.Error()) + } + }() + + return callbackFn() +} + // configHandle writes the default config to the home directory if it does not exist and sets the server context func configHandle[T transaction.Tx](s *Server[T], cmd *cobra.Command) error { home, err := cmd.Flags().GetString(FlagHome) diff --git a/server/v2/flags.go b/server/v2/flags.go index fc36cdcf2b4c..46925cc526e5 100644 --- a/server/v2/flags.go +++ b/server/v2/flags.go @@ -9,7 +9,10 @@ func prefix(f string) string { return fmt.Sprintf("%s.%s", serverName, f) } -var FlagMinGasPrices = prefix("minimum-gas-prices") +var ( + FlagMinGasPrices = prefix("minimum-gas-prices") + FlagCPUProfiling = prefix("cpu-profile") +) const ( // FlagHome specifies the home directory flag. diff --git a/server/v2/server.go b/server/v2/server.go index 486f5c0ceecb..980cb3e5fed2 100644 --- a/server/v2/server.go +++ b/server/v2/server.go @@ -181,6 +181,8 @@ func (s *Server[T]) Configs() map[string]any { func (s *Server[T]) StartCmdFlags() *pflag.FlagSet { flags := pflag.NewFlagSet(s.Name(), pflag.ExitOnError) flags.String(FlagMinGasPrices, "", "Minimum gas prices to accept for transactions; Any fee in a tx must meet this minimum (e.g. 0.01photino;0.0001stake)") + flags.String(FlagCPUProfiling, "", "Enable CPU profiling and write to the specified file") + return flags } From 29ea9c8a5e985dcbe1e9d44da361ec3bba7dafd2 Mon Sep 17 00:00:00 2001 From: Akhil Kumar P <36399231+akhilkumarpilli@users.noreply.github.com> Date: Thu, 17 Oct 2024 18:45:56 +0530 Subject: [PATCH 50/57] test: migrate e2e/mint to system tests (#22294) --- tests/e2e/mint/cli_test.go | 20 ------- tests/e2e/mint/grpc.go | 64 ---------------------- tests/e2e/mint/suite.go | 50 ----------------- tests/systemtests/mint_test.go | 98 ++++++++++++++++++++++++++++++++++ 4 files changed, 98 insertions(+), 134 deletions(-) delete mode 100644 tests/e2e/mint/cli_test.go delete mode 100644 tests/e2e/mint/grpc.go delete mode 100644 tests/e2e/mint/suite.go create mode 100644 tests/systemtests/mint_test.go diff --git a/tests/e2e/mint/cli_test.go b/tests/e2e/mint/cli_test.go deleted file mode 100644 index 08158c279684..000000000000 --- a/tests/e2e/mint/cli_test.go +++ /dev/null @@ -1,20 +0,0 @@ -//go:build e2e -// +build e2e - -package mint - -import ( - "testing" - - "github.com/stretchr/testify/suite" - - "cosmossdk.io/simapp" - - "github.com/cosmos/cosmos-sdk/testutil/network" -) - -func TestE2ETestSuite(t *testing.T) { - cfg := network.DefaultConfig(simapp.NewTestNetworkFixture) - cfg.NumValidators = 1 - suite.Run(t, NewE2ETestSuite(cfg)) -} diff --git a/tests/e2e/mint/grpc.go b/tests/e2e/mint/grpc.go deleted file mode 100644 index 188d641d5d41..000000000000 --- a/tests/e2e/mint/grpc.go +++ /dev/null @@ -1,64 +0,0 @@ -package mint - -import ( - "fmt" - - "github.com/cosmos/gogoproto/proto" - - "cosmossdk.io/math" - minttypes "cosmossdk.io/x/mint/types" - - "github.com/cosmos/cosmos-sdk/testutil" - grpctypes "github.com/cosmos/cosmos-sdk/types/grpc" -) - -func (s *E2ETestSuite) TestQueryGRPC() { - val := s.network.GetValidators()[0] - baseURL := val.GetAPIAddress() - testCases := []struct { - name string - url string - headers map[string]string - respType proto.Message - expected proto.Message - }{ - { - "gRPC request params", - fmt.Sprintf("%s/cosmos/mint/v1beta1/params", baseURL), - map[string]string{}, - &minttypes.QueryParamsResponse{}, - &minttypes.QueryParamsResponse{ - Params: minttypes.NewParams("stake", math.LegacyNewDecWithPrec(13, 2), math.LegacyNewDecWithPrec(100, 2), - math.LegacyNewDec(1), math.LegacyNewDecWithPrec(67, 2), (60 * 60 * 8766 / 5), math.ZeroInt()), - }, - }, - { - "gRPC request inflation", - fmt.Sprintf("%s/cosmos/mint/v1beta1/inflation", baseURL), - map[string]string{}, - &minttypes.QueryInflationResponse{}, - &minttypes.QueryInflationResponse{ - Inflation: math.LegacyNewDec(1), - }, - }, - { - "gRPC request annual provisions", - fmt.Sprintf("%s/cosmos/mint/v1beta1/annual_provisions", baseURL), - map[string]string{ - grpctypes.GRPCBlockHeightHeader: "1", - }, - &minttypes.QueryAnnualProvisionsResponse{}, - &minttypes.QueryAnnualProvisionsResponse{ - AnnualProvisions: math.LegacyNewDec(500000000), - }, - }, - } - for _, tc := range testCases { - resp, err := testutil.GetRequestWithHeaders(tc.url, tc.headers) - s.Run(tc.name, func() { - s.Require().NoError(err) - s.Require().NoError(val.GetClientCtx().Codec.UnmarshalJSON(resp, tc.respType)) - s.Require().Equal(tc.expected.String(), tc.respType.String()) - }) - } -} diff --git a/tests/e2e/mint/suite.go b/tests/e2e/mint/suite.go deleted file mode 100644 index 7f40603246b1..000000000000 --- a/tests/e2e/mint/suite.go +++ /dev/null @@ -1,50 +0,0 @@ -package mint - -import ( - "github.com/stretchr/testify/suite" - - "cosmossdk.io/math" - minttypes "cosmossdk.io/x/mint/types" - - "github.com/cosmos/cosmos-sdk/testutil/network" -) - -type E2ETestSuite struct { - suite.Suite - - cfg network.Config - network network.NetworkI -} - -func NewE2ETestSuite(cfg network.Config) *E2ETestSuite { - return &E2ETestSuite{cfg: cfg} -} - -func (s *E2ETestSuite) SetupSuite() { - s.T().Log("setting up e2e test suite") - - genesisState := s.cfg.GenesisState - - var mintData minttypes.GenesisState - s.Require().NoError(s.cfg.Codec.UnmarshalJSON(genesisState[minttypes.ModuleName], &mintData)) - - inflation := math.LegacyMustNewDecFromStr("1.0") - mintData.Minter.Inflation = inflation - mintData.Params.InflationMin = inflation - mintData.Params.InflationMax = inflation - - mintDataBz, err := s.cfg.Codec.MarshalJSON(&mintData) - s.Require().NoError(err) - genesisState[minttypes.ModuleName] = mintDataBz - s.cfg.GenesisState = genesisState - - s.network, err = network.New(s.T(), s.T().TempDir(), s.cfg) - s.Require().NoError(err) - - s.Require().NoError(s.network.WaitForNextBlock()) -} - -func (s *E2ETestSuite) TearDownSuite() { - s.T().Log("tearing down e2e test suite") - s.network.Cleanup() -} diff --git a/tests/systemtests/mint_test.go b/tests/systemtests/mint_test.go new file mode 100644 index 000000000000..c95aaaee1233 --- /dev/null +++ b/tests/systemtests/mint_test.go @@ -0,0 +1,98 @@ +package systemtests + +import ( + "fmt" + "net/http" + "testing" + + "github.com/stretchr/testify/require" + "github.com/tidwall/sjson" +) + +func TestMintQueries(t *testing.T) { + // scenario: test mint grpc queries + // given a running chain + + sut.ResetChain(t) + cli := NewCLIWrapper(t, sut, verbose) + + sut.ModifyGenesisJSON(t, + func(genesis []byte) []byte { + state, err := sjson.Set(string(genesis), "app_state.mint.minter.inflation", "1.00") + require.NoError(t, err) + return []byte(state) + }, + func(genesis []byte) []byte { + state, err := sjson.Set(string(genesis), "app_state.mint.params.inflation_max", "1.00") + require.NoError(t, err) + return []byte(state) + }, + ) + + sut.StartChain(t) + + sut.AwaitNextBlock(t) + + baseurl := sut.APIAddress() + blockHeightHeader := "x-cosmos-block-height" + queryAtHeight := "1" + + // TODO: check why difference in values when querying with height between v1 and v2 + // ref: https://github.com/cosmos/cosmos-sdk/issues/22302 + if isV2() { + queryAtHeight = "2" + } + + paramsResp := `{"params":{"mint_denom":"stake","inflation_rate_change":"0.130000000000000000","inflation_max":"1.000000000000000000","inflation_min":"0.000000000000000000","goal_bonded":"0.670000000000000000","blocks_per_year":"6311520","max_supply":"0"}}` + inflationResp := `{"inflation":"1.000000000000000000"}` + annualProvisionsResp := `{"annual_provisions":"2000000000.000000000000000000"}` + + testCases := []struct { + name string + url string + headers map[string]string + expOut string + }{ + { + "gRPC request params", + fmt.Sprintf("%s/cosmos/mint/v1beta1/params", baseurl), + map[string]string{}, + paramsResp, + }, + { + "gRPC request inflation", + fmt.Sprintf("%s/cosmos/mint/v1beta1/inflation", baseurl), + map[string]string{}, + inflationResp, + }, + { + "gRPC request annual provisions", + fmt.Sprintf("%s/cosmos/mint/v1beta1/annual_provisions", baseurl), + map[string]string{ + blockHeightHeader: queryAtHeight, + }, + annualProvisionsResp, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + // TODO: remove below check once grpc gateway is implemented in v2 + if isV2() { + return + } + resp := GetRequestWithHeaders(t, tc.url, tc.headers, http.StatusOK) + require.JSONEq(t, tc.expOut, string(resp)) + }) + } + + // test cli queries + rsp := cli.CustomQuery("q", "mint", "params") + require.JSONEq(t, paramsResp, rsp) + + rsp = cli.CustomQuery("q", "mint", "inflation") + require.JSONEq(t, inflationResp, rsp) + + rsp = cli.CustomQuery("q", "mint", "annual-provisions", "--height="+queryAtHeight) + require.JSONEq(t, annualProvisionsResp, rsp) +} From c1707b830856dc44b052096d20b59705a47d8290 Mon Sep 17 00:00:00 2001 From: testinginprod <98415576+testinginprod@users.noreply.github.com> Date: Thu, 17 Oct 2024 17:45:43 +0200 Subject: [PATCH 51/57] fix: sequence should be higher or equal than expected during checktx and equal during deliver tx (#22299) Co-authored-by: Julien Robert Co-authored-by: Matt Kocubinski --- tests/systemtests/auth_test.go | 14 -------------- x/accounts/defaults/base/account.go | 11 ++++++++++- x/accounts/defaults/base/utils_test.go | 12 ++++++++++-- x/auth/ante/ante_test.go | 4 ++++ x/auth/ante/sigverify.go | 16 ++++++++++++---- x/auth/ante/sigverify_test.go | 2 +- 6 files changed, 37 insertions(+), 22 deletions(-) diff --git a/tests/systemtests/auth_test.go b/tests/systemtests/auth_test.go index c45652f3cf8a..975a7909265b 100644 --- a/tests/systemtests/auth_test.go +++ b/tests/systemtests/auth_test.go @@ -67,13 +67,6 @@ func TestAuthSignAndBroadcastTxCmd(t *testing.T) { sendAmount := transferAmount + newAmount fees := feeAmount * 2 - // TODO: remove below block code once v2 supports multi messages - // ref: https://github.com/cosmos/cosmos-sdk/issues/22215 - if isV2() { - sendAmount = transferAmount - fees = feeAmount - } - testSignTxBroadcast(t, cli, signBatchCmd, "sign-batch tx", val1Addr, val2Addr, sendAmount, fees) } @@ -304,13 +297,6 @@ func TestAuthMultisigTxCmds(t *testing.T) { sendAmount := transferAmount * 2 fees := feeAmount * 2 - // TODO: remove below block code once v2 supports multi messages - // ref: https://github.com/cosmos/cosmos-sdk/issues/22215 - if isV2() { - sendAmount = transferAmount - fees = feeAmount - } - testMultisigTxBroadcast(t, cli, multiSigTxInput{ "multisign-batch", multiAddr, diff --git a/x/accounts/defaults/base/account.go b/x/accounts/defaults/base/account.go index b227899aec75..81bf1006d92c 100644 --- a/x/accounts/defaults/base/account.go +++ b/x/accounts/defaults/base/account.go @@ -14,6 +14,7 @@ import ( "cosmossdk.io/collections" "cosmossdk.io/core/address" "cosmossdk.io/core/header" + "cosmossdk.io/core/transaction" "cosmossdk.io/x/accounts/accountstd" v1 "cosmossdk.io/x/accounts/defaults/base/v1" aa_interface_v1 "cosmossdk.io/x/accounts/interfaces/account_abstraction/v1" @@ -43,6 +44,7 @@ func NewAccount(name string, handlerMap *signing.HandlerMap, options ...Option) Sequence: collections.NewSequence(deps.SchemaBuilder, SequencePrefix, "sequence"), addrCodec: deps.AddressCodec, hs: deps.Environment.HeaderService, + ts: deps.Environment.TransactionService, supportedPubKeys: map[string]pubKeyImpl{}, signingHandlers: handlerMap, } @@ -65,6 +67,7 @@ type Account struct { addrCodec address.Codec hs header.Service + ts transaction.Service supportedPubKeys map[string]pubKeyImpl @@ -106,7 +109,13 @@ func (a Account) Authenticate(ctx context.Context, msg *aa_interface_v1.MsgAuthe } gotSeq := msg.Tx.AuthInfo.SignerInfos[msg.SignerIndex].Sequence - if gotSeq != signerData.Sequence { + + execMode := a.ts.ExecMode(ctx) + if execMode == transaction.ExecModeCheck { + if gotSeq < signerData.Sequence { + return nil, fmt.Errorf("sequence number must be higher than: %d, got: %d", signerData.Sequence, gotSeq) + } + } else if gotSeq != signerData.Sequence { return nil, fmt.Errorf("unexpected sequence number, wanted: %d, got: %d", signerData.Sequence, gotSeq) } diff --git a/x/accounts/defaults/base/utils_test.go b/x/accounts/defaults/base/utils_test.go index 93cd76ea8495..5d1a91893064 100644 --- a/x/accounts/defaults/base/utils_test.go +++ b/x/accounts/defaults/base/utils_test.go @@ -66,6 +66,13 @@ func newMockContext(t *testing.T) (context.Context, store.KVStoreService) { ) } +type transactionService struct { +} + +func (t transactionService) ExecMode(ctx context.Context) transaction.ExecMode { + return transaction.ExecModeFinalize +} + func makeMockDependencies(storeservice store.KVStoreService) accountstd.Dependencies { sb := collections.NewSchemaBuilder(storeservice) @@ -74,8 +81,9 @@ func makeMockDependencies(storeservice store.KVStoreService) accountstd.Dependen AddressCodec: addressCodec{}, LegacyStateCodec: mockStateCodec{}, Environment: appmodulev2.Environment{ - EventService: eventService{}, - HeaderService: headerService{}, + EventService: eventService{}, + HeaderService: headerService{}, + TransactionService: transactionService{}, }, } } diff --git a/x/auth/ante/ante_test.go b/x/auth/ante/ante_test.go index fbc4491b9091..0078c2a9803f 100644 --- a/x/auth/ante/ante_test.go +++ b/x/auth/ante/ante_test.go @@ -915,6 +915,8 @@ func TestAnteHandlerBadSignBytes(t *testing.T) { suite.bankKeeper.EXPECT().SendCoinsFromAccountToModule(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil) require.NoError(t, accs[0].acc.SetSequence(2)) // wrong accSeq + suite.ctx = suite.ctx.WithExecMode(sdk.ExecModeFinalize) + return TestCaseArgs{ chainID: suite.ctx.ChainID(), feeAmount: feeAmount, @@ -1081,6 +1083,8 @@ func TestAnteHandlerSetPubKey(t *testing.T) { accs := suite.CreateTestAccounts(2) suite.bankKeeper.EXPECT().SendCoinsFromAccountToModule(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil) + suite.ctx = suite.ctx.WithExecMode(sdk.ExecModeFinalize) + // Make sure public key has not been set from previous test. acc1 := suite.accountKeeper.GetAccount(suite.ctx, accs[1].acc.GetAddress()) require.Nil(t, acc1.GetPubKey()) diff --git a/x/auth/ante/sigverify.go b/x/auth/ante/sigverify.go index f5e5a8626738..3b83b17e3379 100644 --- a/x/auth/ante/sigverify.go +++ b/x/auth/ante/sigverify.go @@ -306,17 +306,25 @@ func (svd SigVerificationDecorator) consumeSignatureGas( // verifySig will verify the signature of the provided signer account. func (svd SigVerificationDecorator) verifySig(ctx context.Context, tx sdk.Tx, acc sdk.AccountI, sig signing.SignatureV2, newlyCreated bool) error { - if sig.Sequence != acc.GetSequence() { + execMode := svd.ak.GetEnvironment().TransactionService.ExecMode(ctx) + if execMode == transaction.ExecModeCheck { + if sig.Sequence < acc.GetSequence() { + return errorsmod.Wrapf( + sdkerrors.ErrWrongSequence, + "account sequence mismatch, expected higher than or equal to %d, got %d", acc.GetSequence(), sig.Sequence, + ) + } + } else if sig.Sequence != acc.GetSequence() { return errorsmod.Wrapf( sdkerrors.ErrWrongSequence, - "account sequence mismatch, expected %d, got %d", acc.GetSequence(), sig.Sequence, + "account sequence mismatch: expected %d, got %d", acc.GetSequence(), sig.Sequence, ) } // we're in simulation mode, or in ReCheckTx, or context is not // on sig verify tx, then we do not need to verify the signatures // in the tx. - if svd.ak.GetEnvironment().TransactionService.ExecMode(ctx) == transaction.ExecModeSimulate || + if execMode == transaction.ExecModeSimulate || isRecheckTx(ctx, svd.ak.GetEnvironment().TransactionService) || !isSigverifyTx(ctx) { return nil @@ -352,7 +360,7 @@ func (svd SigVerificationDecorator) verifySig(ctx context.Context, tx sdk.Tx, ac Address: acc.GetAddress().String(), ChainID: chainID, AccountNumber: accNum, - Sequence: acc.GetSequence(), + Sequence: sig.Sequence, PubKey: &anypb.Any{ TypeUrl: anyPk.TypeUrl, Value: anyPk.Value, diff --git a/x/auth/ante/sigverify_test.go b/x/auth/ante/sigverify_test.go index 00cbb6db6051..d14761fd8aa5 100644 --- a/x/auth/ante/sigverify_test.go +++ b/x/auth/ante/sigverify_test.go @@ -231,7 +231,7 @@ func TestSigVerification(t *testing.T) { if tc.recheck { ctx = ctx.WithExecMode(sdk.ExecModeReCheck) } else { - ctx = ctx.WithExecMode(sdk.ExecModeCheck) + ctx = ctx.WithExecMode(sdk.ExecModeFinalize) } suite.txBuilder = suite.clientCtx.TxConfig.NewTxBuilder() // Create new txBuilder for each test From aa507faeab647fff786d936951c10032c0f24c7e Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Fri, 18 Oct 2024 09:35:55 +0200 Subject: [PATCH 52/57] feat(systemtests): increase verbosity (#22306) --- tests/systemtests/cli.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/systemtests/cli.go b/tests/systemtests/cli.go index 6c8dffc4bbd5..a39cc0dd6d16 100644 --- a/tests/systemtests/cli.go +++ b/tests/systemtests/cli.go @@ -241,6 +241,15 @@ func (c CLIWrapper) runWithInput(args []string, input io.Reader) (output string, cmd.Stdin = input return cmd.CombinedOutput() }() + + if c.Debug { + if gotErr != nil { + c.t.Logf("+++ ERROR output: %s - %s", gotOut, gotErr) + } else { + c.t.Logf("+++ output: %s", gotOut) + } + } + ok = c.assertErrorFn(c.t, gotErr, string(gotOut)) return strings.TrimSpace(string(gotOut)), ok } From f84b5858644fb1463b1e9c25b9baeb77b66bd789 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 18 Oct 2024 11:40:48 +0000 Subject: [PATCH 53/57] build(deps): Bump go.uber.org/mock from 0.4.0 to 0.5.0 in /store (#22309) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] Co-authored-by: Julien Robert --- client/v2/go.sum | 4 ++-- go.sum | 4 ++-- runtime/v2/go.sum | 4 ++-- server/v2/cometbft/go.sum | 4 ++-- server/v2/go.sum | 4 ++-- simapp/go.sum | 4 ++-- simapp/v2/go.sum | 4 ++-- store/go.mod | 2 +- store/go.sum | 4 ++-- store/v2/go.mod | 2 +- store/v2/go.sum | 4 ++-- tests/go.sum | 4 ++-- x/accounts/defaults/base/go.sum | 4 ++-- x/accounts/defaults/lockup/go.sum | 4 ++-- x/accounts/defaults/multisig/go.sum | 4 ++-- x/accounts/go.sum | 4 ++-- x/authz/go.sum | 4 ++-- x/bank/go.sum | 4 ++-- x/circuit/go.sum | 4 ++-- x/consensus/go.sum | 4 ++-- x/distribution/go.sum | 4 ++-- x/epochs/go.sum | 4 ++-- x/evidence/go.sum | 4 ++-- x/feegrant/go.sum | 4 ++-- x/gov/go.sum | 4 ++-- x/group/go.sum | 4 ++-- x/mint/go.sum | 4 ++-- x/nft/go.sum | 4 ++-- x/params/go.sum | 4 ++-- x/protocolpool/go.sum | 4 ++-- x/slashing/go.sum | 4 ++-- x/staking/go.sum | 4 ++-- x/upgrade/go.sum | 4 ++-- 33 files changed, 64 insertions(+), 64 deletions(-) diff --git a/client/v2/go.sum b/client/v2/go.sum index 236f4ac476a9..80545d670102 100644 --- a/client/v2/go.sum +++ b/client/v2/go.sum @@ -512,8 +512,8 @@ go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= -go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= +go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= +go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= diff --git a/go.sum b/go.sum index 5c0c2f19141f..f51f06cc2bf6 100644 --- a/go.sum +++ b/go.sum @@ -501,8 +501,8 @@ go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= -go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= +go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= +go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= diff --git a/runtime/v2/go.sum b/runtime/v2/go.sum index 3cde1737ee77..fd645c890261 100644 --- a/runtime/v2/go.sum +++ b/runtime/v2/go.sum @@ -239,8 +239,8 @@ github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EU github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= -go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= +go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= +go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= diff --git a/server/v2/cometbft/go.sum b/server/v2/cometbft/go.sum index 36ae82083f3f..03c8ee94ecd9 100644 --- a/server/v2/cometbft/go.sum +++ b/server/v2/cometbft/go.sum @@ -505,8 +505,8 @@ go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= -go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= +go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= +go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= diff --git a/server/v2/go.sum b/server/v2/go.sum index ad080575a985..4a0690d589b8 100644 --- a/server/v2/go.sum +++ b/server/v2/go.sum @@ -328,8 +328,8 @@ github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqri github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= -go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= +go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= +go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= diff --git a/simapp/go.sum b/simapp/go.sum index 41a4382b5de7..3b776fc74818 100644 --- a/simapp/go.sum +++ b/simapp/go.sum @@ -848,8 +848,8 @@ go.opentelemetry.io/otel/trace v1.28.0/go.mod h1:jPyXzNPg6da9+38HEwElrQiHlVMTnVf go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= -go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= +go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= +go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= diff --git a/simapp/v2/go.sum b/simapp/v2/go.sum index 4417b3e85971..b0539f4e26df 100644 --- a/simapp/v2/go.sum +++ b/simapp/v2/go.sum @@ -852,8 +852,8 @@ go.opentelemetry.io/otel/trace v1.28.0/go.mod h1:jPyXzNPg6da9+38HEwElrQiHlVMTnVf go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= -go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= +go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= +go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= diff --git a/store/go.mod b/store/go.mod index 260e335619d5..e3d9dd893141 100644 --- a/store/go.mod +++ b/store/go.mod @@ -20,7 +20,7 @@ require ( github.com/hashicorp/golang-lru v1.0.2 github.com/stretchr/testify v1.9.0 github.com/tidwall/btree v1.7.0 - go.uber.org/mock v0.4.0 + go.uber.org/mock v0.5.0 google.golang.org/grpc v1.67.1 google.golang.org/protobuf v1.35.1 gotest.tools/v3 v3.5.1 diff --git a/store/go.sum b/store/go.sum index 43b213989e02..f30db3aaa6e1 100644 --- a/store/go.sum +++ b/store/go.sum @@ -201,8 +201,8 @@ github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EU github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= -go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= +go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= +go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= diff --git a/store/v2/go.mod b/store/v2/go.mod index d54a715a3b4c..ed3dab5dc799 100644 --- a/store/v2/go.mod +++ b/store/v2/go.mod @@ -19,7 +19,7 @@ require ( github.com/spf13/cast v1.7.0 github.com/stretchr/testify v1.9.0 github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d - go.uber.org/mock v0.4.0 + go.uber.org/mock v0.5.0 golang.org/x/sync v0.8.0 ) diff --git a/store/v2/go.sum b/store/v2/go.sum index eb52ef582617..bbd26bfe5d5c 100644 --- a/store/v2/go.sum +++ b/store/v2/go.sum @@ -222,8 +222,8 @@ github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EU github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= -go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= +go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= +go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= diff --git a/tests/go.sum b/tests/go.sum index 474e0a602b10..8955b4efeb4a 100644 --- a/tests/go.sum +++ b/tests/go.sum @@ -837,8 +837,8 @@ go.opentelemetry.io/otel/trace v1.28.0/go.mod h1:jPyXzNPg6da9+38HEwElrQiHlVMTnVf go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= -go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= +go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= +go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= diff --git a/x/accounts/defaults/base/go.sum b/x/accounts/defaults/base/go.sum index a5f02361cc93..bc75393ecca6 100644 --- a/x/accounts/defaults/base/go.sum +++ b/x/accounts/defaults/base/go.sum @@ -499,8 +499,8 @@ go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= -go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= +go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= +go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= diff --git a/x/accounts/defaults/lockup/go.sum b/x/accounts/defaults/lockup/go.sum index 05748373dd70..0ddda37d7acc 100644 --- a/x/accounts/defaults/lockup/go.sum +++ b/x/accounts/defaults/lockup/go.sum @@ -440,8 +440,8 @@ go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5 h1:qxen9oVGzDdIRP6 go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5/go.mod h1:eW0HG9/oHQhvRCvb1/pIXW4cOvtDqeQK+XSi3TnwaXY= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= -go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= +go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= +go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= diff --git a/x/accounts/defaults/multisig/go.sum b/x/accounts/defaults/multisig/go.sum index a5f02361cc93..bc75393ecca6 100644 --- a/x/accounts/defaults/multisig/go.sum +++ b/x/accounts/defaults/multisig/go.sum @@ -499,8 +499,8 @@ go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= -go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= +go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= +go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= diff --git a/x/accounts/go.sum b/x/accounts/go.sum index 58d4121c9e48..5c05f884e0eb 100644 --- a/x/accounts/go.sum +++ b/x/accounts/go.sum @@ -500,8 +500,8 @@ go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= -go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= +go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= +go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= diff --git a/x/authz/go.sum b/x/authz/go.sum index 58d4121c9e48..5c05f884e0eb 100644 --- a/x/authz/go.sum +++ b/x/authz/go.sum @@ -500,8 +500,8 @@ go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= -go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= +go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= +go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= diff --git a/x/bank/go.sum b/x/bank/go.sum index 58d4121c9e48..5c05f884e0eb 100644 --- a/x/bank/go.sum +++ b/x/bank/go.sum @@ -500,8 +500,8 @@ go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= -go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= +go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= +go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= diff --git a/x/circuit/go.sum b/x/circuit/go.sum index 8fd99b8608ea..3041219c2907 100644 --- a/x/circuit/go.sum +++ b/x/circuit/go.sum @@ -502,8 +502,8 @@ go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= -go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= +go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= +go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= diff --git a/x/consensus/go.sum b/x/consensus/go.sum index a856f6d1b923..7d8629bd498b 100644 --- a/x/consensus/go.sum +++ b/x/consensus/go.sum @@ -501,8 +501,8 @@ go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= -go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= +go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= +go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= diff --git a/x/distribution/go.sum b/x/distribution/go.sum index 58d4121c9e48..5c05f884e0eb 100644 --- a/x/distribution/go.sum +++ b/x/distribution/go.sum @@ -500,8 +500,8 @@ go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= -go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= +go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= +go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= diff --git a/x/epochs/go.sum b/x/epochs/go.sum index a856f6d1b923..7d8629bd498b 100644 --- a/x/epochs/go.sum +++ b/x/epochs/go.sum @@ -501,8 +501,8 @@ go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= -go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= +go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= +go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= diff --git a/x/evidence/go.sum b/x/evidence/go.sum index 8fd99b8608ea..3041219c2907 100644 --- a/x/evidence/go.sum +++ b/x/evidence/go.sum @@ -502,8 +502,8 @@ go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= -go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= +go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= +go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= diff --git a/x/feegrant/go.sum b/x/feegrant/go.sum index 696a6ef7d845..f62264df4628 100644 --- a/x/feegrant/go.sum +++ b/x/feegrant/go.sum @@ -510,8 +510,8 @@ go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= -go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= +go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= +go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= diff --git a/x/gov/go.sum b/x/gov/go.sum index a1587575f635..e05931b31009 100644 --- a/x/gov/go.sum +++ b/x/gov/go.sum @@ -508,8 +508,8 @@ go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= -go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= +go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= +go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= diff --git a/x/group/go.sum b/x/group/go.sum index 43aac4657e87..ef56fac13633 100644 --- a/x/group/go.sum +++ b/x/group/go.sum @@ -510,8 +510,8 @@ go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= -go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= +go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= +go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= diff --git a/x/mint/go.sum b/x/mint/go.sum index 8fd99b8608ea..3041219c2907 100644 --- a/x/mint/go.sum +++ b/x/mint/go.sum @@ -502,8 +502,8 @@ go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= -go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= +go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= +go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= diff --git a/x/nft/go.sum b/x/nft/go.sum index 8fd99b8608ea..3041219c2907 100644 --- a/x/nft/go.sum +++ b/x/nft/go.sum @@ -502,8 +502,8 @@ go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= -go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= +go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= +go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= diff --git a/x/params/go.sum b/x/params/go.sum index bfa925d6aff0..a7561e518df0 100644 --- a/x/params/go.sum +++ b/x/params/go.sum @@ -476,8 +476,8 @@ go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= -go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= +go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= +go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= diff --git a/x/protocolpool/go.sum b/x/protocolpool/go.sum index 8fd99b8608ea..3041219c2907 100644 --- a/x/protocolpool/go.sum +++ b/x/protocolpool/go.sum @@ -502,8 +502,8 @@ go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= -go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= +go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= +go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= diff --git a/x/slashing/go.sum b/x/slashing/go.sum index 9a22246ddee4..5f4269b3bc6b 100644 --- a/x/slashing/go.sum +++ b/x/slashing/go.sum @@ -504,8 +504,8 @@ go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= -go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= +go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= +go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= diff --git a/x/staking/go.sum b/x/staking/go.sum index 58d4121c9e48..5c05f884e0eb 100644 --- a/x/staking/go.sum +++ b/x/staking/go.sum @@ -500,8 +500,8 @@ go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= -go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= +go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= +go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= diff --git a/x/upgrade/go.sum b/x/upgrade/go.sum index ed7317d738db..21f78ea56ae4 100644 --- a/x/upgrade/go.sum +++ b/x/upgrade/go.sum @@ -837,8 +837,8 @@ go.opentelemetry.io/otel/trace v1.28.0/go.mod h1:jPyXzNPg6da9+38HEwElrQiHlVMTnVf go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= -go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= +go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= +go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= From 71ac584b380a91d12084965c87ef20e99aeef971 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 20 Oct 2024 13:44:11 +0200 Subject: [PATCH 54/57] build(deps): Bump rtCamp/action-slack-notify from 2.3.0 to 2.3.1 (#22308) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Julien Robert --- .github/workflows/md-link-checker.yml | 2 +- .github/workflows/pr-reminder.yml | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/sims-047.yml | 4 ++-- .github/workflows/sims-050.yml | 4 ++-- .github/workflows/sims-052.yml | 4 ++-- .github/workflows/sims-nightly.yml | 4 ++-- .github/workflows/sims.yml | 4 ++-- .github/workflows/software-compat-v052.yml | 4 ++-- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/md-link-checker.yml b/.github/workflows/md-link-checker.yml index ec5c4d94c146..218dd6b25180 100644 --- a/.github/workflows/md-link-checker.yml +++ b/.github/workflows/md-link-checker.yml @@ -20,7 +20,7 @@ jobs: if: ${{ failure() }} steps: - name: Notify Slack on failure - uses: rtCamp/action-slack-notify@v2.3.0 + uses: rtCamp/action-slack-notify@v2.3.1 env: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} SLACK_CHANNEL: sdk-sims diff --git a/.github/workflows/pr-reminder.yml b/.github/workflows/pr-reminder.yml index ade3fbdcde7e..de174f5d77b5 100644 --- a/.github/workflows/pr-reminder.yml +++ b/.github/workflows/pr-reminder.yml @@ -38,7 +38,7 @@ jobs: - name: Send Slack Reminder if: steps.pr-list.outputs.result != '' - uses: rtCamp/action-slack-notify@v2.3.0 + uses: rtCamp/action-slack-notify@v2.3.1 env: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} SLACK_CHANNEL: pr-github diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 962a75136f06..13ca5a1db4d7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -37,7 +37,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Notify Slack on success - uses: rtCamp/action-slack-notify@v2.3.0 + uses: rtCamp/action-slack-notify@v2.3.1 env: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} SLACK_CHANNEL: cosmos-tech diff --git a/.github/workflows/sims-047.yml b/.github/workflows/sims-047.yml index 4a6a0427d751..90b03b492146 100644 --- a/.github/workflows/sims-047.yml +++ b/.github/workflows/sims-047.yml @@ -115,7 +115,7 @@ jobs: - name: Notify Slack on success if: ${{ steps.last_status.outputs.last_status == 'failure' }} - uses: rtCamp/action-slack-notify@v2.3.0 + uses: rtCamp/action-slack-notify@v2.3.1 env: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} SLACK_CHANNEL: sdk-sims @@ -134,7 +134,7 @@ jobs: if: ${{ failure() }} steps: - name: Notify Slack on failure - uses: rtCamp/action-slack-notify@v2.3.0 + uses: rtCamp/action-slack-notify@v2.3.1 env: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} SLACK_CHANNEL: sdk-sims diff --git a/.github/workflows/sims-050.yml b/.github/workflows/sims-050.yml index afc04b2a0ea5..eabc8faee224 100644 --- a/.github/workflows/sims-050.yml +++ b/.github/workflows/sims-050.yml @@ -115,7 +115,7 @@ jobs: - name: Notify Slack on success if: ${{ steps.last_status.outputs.last_status == 'failure' }} - uses: rtCamp/action-slack-notify@v2.3.0 + uses: rtCamp/action-slack-notify@v2.3.1 env: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} SLACK_CHANNEL: sdk-sims @@ -134,7 +134,7 @@ jobs: if: ${{ failure() }} steps: - name: Notify Slack on failure - uses: rtCamp/action-slack-notify@v2.3.0 + uses: rtCamp/action-slack-notify@v2.3.1 env: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} SLACK_CHANNEL: sdk-sims diff --git a/.github/workflows/sims-052.yml b/.github/workflows/sims-052.yml index 2b3955d809d7..dacb30a887d1 100644 --- a/.github/workflows/sims-052.yml +++ b/.github/workflows/sims-052.yml @@ -111,7 +111,7 @@ jobs: - name: Notify Slack on success if: ${{ steps.last_status.outputs.last_status == 'failure' }} - uses: rtCamp/action-slack-notify@v2.3.0 + uses: rtCamp/action-slack-notify@v2.3.1 env: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} SLACK_CHANNEL: sdk-sims @@ -135,7 +135,7 @@ jobs: if: ${{ failure() }} steps: - name: Notify Slack on failure - uses: rtCamp/action-slack-notify@v2.3.0 + uses: rtCamp/action-slack-notify@v2.3.1 env: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} SLACK_CHANNEL: sdk-sims diff --git a/.github/workflows/sims-nightly.yml b/.github/workflows/sims-nightly.yml index 0473bcad5268..f41d240c88fb 100644 --- a/.github/workflows/sims-nightly.yml +++ b/.github/workflows/sims-nightly.yml @@ -44,7 +44,7 @@ jobs: - name: Notify Slack on success if: ${{ steps.last_status.outputs.last_status == 'failure' }} - uses: rtCamp/action-slack-notify@v2.3.0 + uses: rtCamp/action-slack-notify@v2.3.1 env: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} SLACK_CHANNEL: sdk-sims @@ -62,7 +62,7 @@ jobs: if: ${{ failure() }} steps: - name: Notify Slack on failure - uses: rtCamp/action-slack-notify@v2.3.0 + uses: rtCamp/action-slack-notify@v2.3.1 env: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} SLACK_CHANNEL: sdk-sims diff --git a/.github/workflows/sims.yml b/.github/workflows/sims.yml index 1b9a7fe54d48..ed166028b428 100644 --- a/.github/workflows/sims.yml +++ b/.github/workflows/sims.yml @@ -102,7 +102,7 @@ jobs: - name: Notify Slack on success if: ${{ steps.last_status.outputs.last_status == 'failure' }} - uses: rtCamp/action-slack-notify@v2.3.0 + uses: rtCamp/action-slack-notify@v2.3.1 env: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} SLACK_CHANNEL: sdk-sims @@ -126,7 +126,7 @@ jobs: if: ${{ failure() }} steps: - name: Notify Slack on failure - uses: rtCamp/action-slack-notify@v2.3.0 + uses: rtCamp/action-slack-notify@v2.3.1 env: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} SLACK_CHANNEL: sdk-sims diff --git a/.github/workflows/software-compat-v052.yml b/.github/workflows/software-compat-v052.yml index c3b6d02c64d7..e4f86589ca71 100644 --- a/.github/workflows/software-compat-v052.yml +++ b/.github/workflows/software-compat-v052.yml @@ -46,7 +46,7 @@ jobs: - name: Notify Slack on success if: ${{ steps.last_status.outputs.last_status == 'failure' }} - uses: rtCamp/action-slack-notify@v2.3.0 + uses: rtCamp/action-slack-notify@v2.3.1 env: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} SLACK_CHANNEL: sdk-sims @@ -64,7 +64,7 @@ jobs: if: ${{ failure() }} steps: - name: Notify Slack on failure - uses: rtCamp/action-slack-notify@v2.3.0 + uses: rtCamp/action-slack-notify@v2.3.1 env: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} SLACK_CHANNEL: sdk-sims From 64e6d882c6a747ad142b81dd6ac16ce0b3f95dfa Mon Sep 17 00:00:00 2001 From: XiaoBei <1505929057@qq.com> Date: Mon, 21 Oct 2024 13:11:51 +0800 Subject: [PATCH 55/57] docs: fix markdown code grammar (#22316) --- collections/README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/collections/README.md b/collections/README.md index 421bc255d1c0..d6d73da218ee 100644 --- a/collections/README.md +++ b/collections/README.md @@ -163,7 +163,7 @@ You might need to implement them only if you're migrating to collections and the Let's explore an example: -````go +```go package collections import ( @@ -186,7 +186,7 @@ func NewKeeper(storeKey *storetypes.KVStoreKey) Keeper { IDs: collections.NewMap(sb, IDsPrefix, "ids", collections.StringKey, collections.Uint64Value), } } -```` +``` We're now instantiating a map where the key is string and the value is `uint64`. We already know the first three arguments of the ``NewMap`` function. @@ -687,9 +687,9 @@ func NewKeeper(storeKey *storetypes.KVStoreKey) Keeper { First of all we can see that in order to define a composite key of two elements we use the `collections.Pair` type: -````go +```go collections.Map[collections.Pair[sdk.AccAddress, string], math.Int] -```` +``` `collections.Pair` defines a key composed of two other keys, in our case the first part is `sdk.AccAddress`, the second part is `string`. @@ -706,7 +706,7 @@ encode the second part of the key. Let's expand on the example we used before: -````go +```go var BalancesPrefix = collections.NewPrefix(1) type Keeper struct { @@ -766,7 +766,7 @@ func (k Keeper) GetAllAddressBalancesBetween(ctx sdk.Context, address sdk.AccAdd } ... } -```` +``` #### SetBalance From fc91e76354512e8538f9da5bc9d3518f54921417 Mon Sep 17 00:00:00 2001 From: Shude Li Date: Mon, 21 Oct 2024 17:58:09 +0800 Subject: [PATCH 56/57] build(all): migrate to `go.uber.org/mock` (#22315) --- baseapp/abci_test.go | 2 +- baseapp/abci_utils_test.go | 2 +- baseapp/testutil/mock/mocks.go | 25 +++-- client/v2/go.mod | 6 +- client/v2/go.sum | 12 +-- core/testing/gas/service_mocks.go | 17 +++- core/testing/go.mod | 2 +- core/testing/go.sum | 27 +----- go.mod | 5 +- go.sum | 8 +- orm/go.mod | 2 +- orm/go.sum | 11 +-- orm/model/ormdb/module_test.go | 2 +- orm/testing/ormmocks/hooks.go | 21 ++-- orm/testing/ormmocks/match.go | 2 +- scripts/build/build.mk | 2 +- server/v2/cometbft/go.mod | 4 +- server/v2/cometbft/go.sum | 8 +- simapp/app_test.go | 2 +- simapp/go.mod | 6 +- simapp/go.sum | 8 +- simapp/v2/go.mod | 6 +- simapp/v2/go.sum | 8 +- tests/go.mod | 6 +- tests/go.sum | 8 +- .../bank/keeper/deterministic_test.go | 2 +- .../distribution/keeper/msg_server_test.go | 2 +- .../distribution/migration_v4_test.go | 2 +- .../evidence/keeper/infraction_test.go | 2 +- tests/integration/example/example_test.go | 2 +- tests/integration/gov/keeper/keeper_test.go | 2 +- .../slashing/keeper/keeper_test.go | 2 +- .../integration/staking/keeper/common_test.go | 2 +- .../staking/keeper/deterministic_test.go | 2 +- .../staking/keeper/unbonding_test.go | 2 +- testutil/mock/account_retriever.go | 17 +++- testutil/mock/grpc_server.go | 16 ++- testutil/mock/logger.go | 62 ++++++------ testutil/mock/types_handler.go | 2 +- testutil/mock/types_invariant.go | 10 +- testutil/mock/types_mock_appmodule.go | 69 +++++++------ testutil/mock/types_module_module.go | 31 ++++-- .../testutil/expected_keepers_mocks.go | 2 +- tools/confix/go.mod | 1 + tools/confix/go.sum | 8 +- types/context_test.go | 2 +- types/handler_test.go | 2 +- types/module/module_test.go | 2 +- x/accounts/defaults/base/go.mod | 4 +- x/accounts/defaults/base/go.sum | 8 +- x/accounts/defaults/base/utils_test.go | 3 +- x/accounts/defaults/lockup/go.sum | 8 +- x/accounts/defaults/multisig/go.mod | 4 +- x/accounts/defaults/multisig/go.sum | 8 +- x/accounts/go.mod | 6 +- x/accounts/go.sum | 12 +-- x/auth/ante/ante_test.go | 2 +- x/auth/ante/fee_test.go | 2 +- x/auth/ante/feegrant_test.go | 2 +- .../ante/testutil/expected_keepers_mocks.go | 24 +++-- x/auth/ante/testutil_test.go | 2 +- x/auth/keeper/deterministic_test.go | 2 +- x/auth/keeper/grpc_query_test.go | 2 +- x/auth/keeper/keeper_test.go | 2 +- x/auth/keeper/msg_server_test.go | 2 +- x/auth/testutil/expected_keepers_mocks.go | 31 +++--- x/auth/tx/testutil/expected_keepers_mocks.go | 10 +- .../testutil/expected_keepers_mocks.go | 18 ++-- x/auth/vesting/types/vesting_account_test.go | 2 +- x/authz/go.mod | 6 +- x/authz/go.sum | 12 +-- x/authz/keeper/keeper_test.go | 2 +- x/authz/testutil/expected_keepers_mocks.go | 16 ++- x/bank/go.mod | 6 +- x/bank/go.sum | 12 +-- x/bank/keeper/collections_test.go | 2 +- x/bank/keeper/keeper_test.go | 2 +- x/bank/testutil/expected_keepers_mocks.go | 18 ++-- x/bank/v2/testutil/expected_keepers_mocks.go | 2 +- x/circuit/go.mod | 6 +- x/circuit/go.sum | 12 +-- x/consensus/go.mod | 4 +- x/consensus/go.sum | 8 +- x/distribution/go.mod | 6 +- x/distribution/go.sum | 12 +-- x/distribution/keeper/allocation_test.go | 2 +- x/distribution/keeper/delegation_test.go | 2 +- x/distribution/keeper/grpc_query_test.go | 2 +- x/distribution/keeper/keeper_test.go | 2 +- x/distribution/keeper/msg_server_test.go | 2 +- .../testutil/expected_keepers_mocks.go | 53 +++++----- x/epochs/go.mod | 4 +- x/epochs/go.sum | 8 +- x/evidence/go.mod | 6 +- x/evidence/go.sum | 12 +-- x/evidence/keeper/keeper_test.go | 2 +- x/evidence/testutil/expected_keepers_mocks.go | 35 ++++--- x/feegrant/go.mod | 6 +- x/feegrant/go.sum | 12 +-- x/feegrant/testutil/expected_keepers_mocks.go | 12 ++- x/genutil/gentx_test.go | 2 +- x/genutil/testutil/expected_keepers_mocks.go | 21 ++-- x/gov/go.mod | 6 +- x/gov/go.sum | 12 +-- x/gov/keeper/common_test.go | 2 +- x/gov/keeper/tally_test.go | 2 +- x/gov/testutil/expected_keepers_mocks.go | 51 ++++++---- x/group/go.mod | 6 +- x/group/go.sum | 12 +-- x/group/keeper/genesis_test.go | 2 +- x/group/keeper/grpc_query_test.go | 2 +- x/group/keeper/keeper_test.go | 2 +- x/group/keeper/msg_server_test.go | 2 +- x/group/migrations/v2/migrate_test.go | 2 +- x/group/testutil/expected_keepers_mocks.go | 35 ++++--- x/mint/go.mod | 6 +- x/mint/go.sum | 12 +-- x/mint/keeper/genesis_test.go | 2 +- x/mint/keeper/grpc_query_test.go | 2 +- x/mint/keeper/keeper_test.go | 2 +- x/mint/module_test.go | 2 +- x/mint/testutil/expected_keepers_mocks.go | 28 ++++-- x/nft/go.mod | 6 +- x/nft/go.sum | 12 +-- x/nft/keeper/keeper_test.go | 2 +- x/nft/testutil/expected_keepers_mocks.go | 15 ++- x/params/go.mod | 6 +- x/params/go.sum | 12 +-- x/params/testutil/staking_keeper_mock.go | 2 +- x/protocolpool/go.mod | 6 +- x/protocolpool/go.sum | 12 +-- x/protocolpool/keeper/keeper_test.go | 2 +- x/protocolpool/keeper/msg_server_test.go | 2 +- .../testutil/expected_keepers_mocks.go | 28 ++++-- x/slashing/go.mod | 6 +- x/slashing/go.sum | 12 +-- x/slashing/keeper/genesis_test.go | 2 +- x/slashing/keeper/keeper_test.go | 2 +- x/slashing/keeper/signing_info_test.go | 2 +- x/slashing/testutil/expected_keepers_mocks.go | 65 +++++++------ x/staking/go.mod | 6 +- x/staking/go.sum | 12 +-- x/staking/keeper/cons_pubkey_test.go | 2 +- x/staking/keeper/delegation_test.go | 2 +- x/staking/keeper/keeper_test.go | 2 +- x/staking/keeper/msg_server_test.go | 2 +- x/staking/keeper/validator_test.go | 2 +- x/staking/testutil/expected_keepers_mocks.go | 97 +++++++++++-------- x/upgrade/go.mod | 6 +- x/upgrade/go.sum | 8 +- x/upgrade/keeper/abci_test.go | 2 +- x/upgrade/keeper/grpc_query_test.go | 2 +- x/upgrade/keeper/keeper_test.go | 2 +- x/upgrade/testutil/expected_keepers_mocks.go | 10 +- 154 files changed, 781 insertions(+), 667 deletions(-) diff --git a/baseapp/abci_test.go b/baseapp/abci_test.go index 111a86938356..e404f7c47932 100644 --- a/baseapp/abci_test.go +++ b/baseapp/abci_test.go @@ -24,8 +24,8 @@ import ( "github.com/cosmos/gogoproto/proto" gogotypes "github.com/cosmos/gogoproto/types" any "github.com/cosmos/gogoproto/types/any" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" coretesting "cosmossdk.io/core/testing" errorsmod "cosmossdk.io/errors" diff --git a/baseapp/abci_utils_test.go b/baseapp/abci_utils_test.go index e2c88c2431b7..aeb6a298e23e 100644 --- a/baseapp/abci_utils_test.go +++ b/baseapp/abci_utils_test.go @@ -13,9 +13,9 @@ import ( protoio "github.com/cosmos/gogoproto/io" "github.com/cosmos/gogoproto/proto" gogotypes "github.com/cosmos/gogoproto/types" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + "go.uber.org/mock/gomock" "cosmossdk.io/core/address" "cosmossdk.io/core/comet" diff --git a/baseapp/testutil/mock/mocks.go b/baseapp/testutil/mock/mocks.go index 33f6fa023f8b..d4a3c5c39d54 100644 --- a/baseapp/testutil/mock/mocks.go +++ b/baseapp/testutil/mock/mocks.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: baseapp/abci_utils.go +// +// Generated by this command: +// +// mockgen -source=baseapp/abci_utils.go -package mock -destination baseapp/testutil/mock/mocks.go +// // Package mock is a generated GoMock package. package mock @@ -10,13 +15,14 @@ import ( types "github.com/cosmos/cosmos-sdk/crypto/types" types0 "github.com/cosmos/cosmos-sdk/types" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockValidatorStore is a mock of ValidatorStore interface. type MockValidatorStore struct { ctrl *gomock.Controller recorder *MockValidatorStoreMockRecorder + isgomock struct{} } // MockValidatorStoreMockRecorder is the mock recorder for MockValidatorStore. @@ -46,7 +52,7 @@ func (m *MockValidatorStore) GetPubKeyByConsAddr(arg0 context.Context, arg1 type } // GetPubKeyByConsAddr indicates an expected call of GetPubKeyByConsAddr. -func (mr *MockValidatorStoreMockRecorder) GetPubKeyByConsAddr(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockValidatorStoreMockRecorder) GetPubKeyByConsAddr(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPubKeyByConsAddr", reflect.TypeOf((*MockValidatorStore)(nil).GetPubKeyByConsAddr), arg0, arg1) } @@ -55,6 +61,7 @@ func (mr *MockValidatorStoreMockRecorder) GetPubKeyByConsAddr(arg0, arg1 interfa type MockGasTx struct { ctrl *gomock.Controller recorder *MockGasTxMockRecorder + isgomock struct{} } // MockGasTxMockRecorder is the mock recorder for MockGasTx. @@ -92,6 +99,7 @@ func (mr *MockGasTxMockRecorder) GetGas() *gomock.Call { type MockProposalTxVerifier struct { ctrl *gomock.Controller recorder *MockProposalTxVerifierMockRecorder + isgomock struct{} } // MockProposalTxVerifierMockRecorder is the mock recorder for MockProposalTxVerifier. @@ -121,7 +129,7 @@ func (m *MockProposalTxVerifier) PrepareProposalVerifyTx(tx types0.Tx) ([]byte, } // PrepareProposalVerifyTx indicates an expected call of PrepareProposalVerifyTx. -func (mr *MockProposalTxVerifierMockRecorder) PrepareProposalVerifyTx(tx interface{}) *gomock.Call { +func (mr *MockProposalTxVerifierMockRecorder) PrepareProposalVerifyTx(tx any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PrepareProposalVerifyTx", reflect.TypeOf((*MockProposalTxVerifier)(nil).PrepareProposalVerifyTx), tx) } @@ -136,7 +144,7 @@ func (m *MockProposalTxVerifier) ProcessProposalVerifyTx(txBz []byte) (types0.Tx } // ProcessProposalVerifyTx indicates an expected call of ProcessProposalVerifyTx. -func (mr *MockProposalTxVerifierMockRecorder) ProcessProposalVerifyTx(txBz interface{}) *gomock.Call { +func (mr *MockProposalTxVerifierMockRecorder) ProcessProposalVerifyTx(txBz any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProcessProposalVerifyTx", reflect.TypeOf((*MockProposalTxVerifier)(nil).ProcessProposalVerifyTx), txBz) } @@ -151,7 +159,7 @@ func (m *MockProposalTxVerifier) TxDecode(txBz []byte) (types0.Tx, error) { } // TxDecode indicates an expected call of TxDecode. -func (mr *MockProposalTxVerifierMockRecorder) TxDecode(txBz interface{}) *gomock.Call { +func (mr *MockProposalTxVerifierMockRecorder) TxDecode(txBz any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TxDecode", reflect.TypeOf((*MockProposalTxVerifier)(nil).TxDecode), txBz) } @@ -166,7 +174,7 @@ func (m *MockProposalTxVerifier) TxEncode(tx types0.Tx) ([]byte, error) { } // TxEncode indicates an expected call of TxEncode. -func (mr *MockProposalTxVerifierMockRecorder) TxEncode(tx interface{}) *gomock.Call { +func (mr *MockProposalTxVerifierMockRecorder) TxEncode(tx any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TxEncode", reflect.TypeOf((*MockProposalTxVerifier)(nil).TxEncode), tx) } @@ -175,6 +183,7 @@ func (mr *MockProposalTxVerifierMockRecorder) TxEncode(tx interface{}) *gomock.C type MockTxSelector struct { ctrl *gomock.Controller recorder *MockTxSelectorMockRecorder + isgomock struct{} } // MockTxSelectorMockRecorder is the mock recorder for MockTxSelector. @@ -215,7 +224,7 @@ func (m *MockTxSelector) SelectTxForProposal(ctx context.Context, maxTxBytes, ma } // SelectTxForProposal indicates an expected call of SelectTxForProposal. -func (mr *MockTxSelectorMockRecorder) SelectTxForProposal(ctx, maxTxBytes, maxBlockGas, memTx, txBz interface{}) *gomock.Call { +func (mr *MockTxSelectorMockRecorder) SelectTxForProposal(ctx, maxTxBytes, maxBlockGas, memTx, txBz any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SelectTxForProposal", reflect.TypeOf((*MockTxSelector)(nil).SelectTxForProposal), ctx, maxTxBytes, maxBlockGas, memTx, txBz) } @@ -229,7 +238,7 @@ func (m *MockTxSelector) SelectedTxs(ctx context.Context) [][]byte { } // SelectedTxs indicates an expected call of SelectedTxs. -func (mr *MockTxSelectorMockRecorder) SelectedTxs(ctx interface{}) *gomock.Call { +func (mr *MockTxSelectorMockRecorder) SelectedTxs(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SelectedTxs", reflect.TypeOf((*MockTxSelector)(nil).SelectedTxs), ctx) } diff --git a/client/v2/go.mod b/client/v2/go.mod index 0b4f281d7021..a9d75f6d8a38 100644 --- a/client/v2/go.mod +++ b/client/v2/go.mod @@ -78,7 +78,6 @@ require ( github.com/gogo/googleapis v1.4.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/golang/mock v1.6.0 // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/btree v1.1.3 // indirect @@ -152,16 +151,17 @@ require ( gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // indirect go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5 // indirect go.opencensus.io v0.24.0 // indirect + go.uber.org/mock v0.5.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.28.0 // indirect golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect - golang.org/x/mod v0.17.0 // indirect + golang.org/x/mod v0.18.0 // indirect golang.org/x/net v0.29.0 // indirect golang.org/x/sync v0.8.0 // indirect golang.org/x/sys v0.26.0 // indirect golang.org/x/term v0.25.0 // indirect golang.org/x/text v0.19.0 // indirect - golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect + golang.org/x/tools v0.22.0 // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f // indirect diff --git a/client/v2/go.sum b/client/v2/go.sum index 80545d670102..77ce94ccb2cb 100644 --- a/client/v2/go.sum +++ b/client/v2/go.sum @@ -496,7 +496,6 @@ github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EU github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= @@ -534,9 +533,8 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0= +golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -567,7 +565,6 @@ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -631,9 +628,8 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= +golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/core/testing/gas/service_mocks.go b/core/testing/gas/service_mocks.go index c328455997a1..0d0f52af45fb 100644 --- a/core/testing/gas/service_mocks.go +++ b/core/testing/gas/service_mocks.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: core/gas/service.go +// +// Generated by this command: +// +// mockgen -source=core/gas/service.go -package gas -destination core/testing/gas/service_mocks.go +// // Package gas is a generated GoMock package. package gas @@ -9,13 +14,14 @@ import ( reflect "reflect" gas "cosmossdk.io/core/gas" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockService is a mock of Service interface. type MockService struct { ctrl *gomock.Controller recorder *MockServiceMockRecorder + isgomock struct{} } // MockServiceMockRecorder is the mock recorder for MockService. @@ -44,7 +50,7 @@ func (m *MockService) GasConfig(ctx context.Context) gas.GasConfig { } // GasConfig indicates an expected call of GasConfig. -func (mr *MockServiceMockRecorder) GasConfig(ctx interface{}) *gomock.Call { +func (mr *MockServiceMockRecorder) GasConfig(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GasConfig", reflect.TypeOf((*MockService)(nil).GasConfig), ctx) } @@ -58,7 +64,7 @@ func (m *MockService) GasMeter(arg0 context.Context) gas.Meter { } // GasMeter indicates an expected call of GasMeter. -func (mr *MockServiceMockRecorder) GasMeter(arg0 interface{}) *gomock.Call { +func (mr *MockServiceMockRecorder) GasMeter(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GasMeter", reflect.TypeOf((*MockService)(nil).GasMeter), arg0) } @@ -67,6 +73,7 @@ func (mr *MockServiceMockRecorder) GasMeter(arg0 interface{}) *gomock.Call { type MockMeter struct { ctrl *gomock.Controller recorder *MockMeterMockRecorder + isgomock struct{} } // MockMeterMockRecorder is the mock recorder for MockMeter. @@ -95,7 +102,7 @@ func (m *MockMeter) Consume(amount gas.Gas, descriptor string) error { } // Consume indicates an expected call of Consume. -func (mr *MockMeterMockRecorder) Consume(amount, descriptor interface{}) *gomock.Call { +func (mr *MockMeterMockRecorder) Consume(amount, descriptor any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Consume", reflect.TypeOf((*MockMeter)(nil).Consume), amount, descriptor) } @@ -137,7 +144,7 @@ func (m *MockMeter) Refund(amount gas.Gas, descriptor string) error { } // Refund indicates an expected call of Refund. -func (mr *MockMeterMockRecorder) Refund(amount, descriptor interface{}) *gomock.Call { +func (mr *MockMeterMockRecorder) Refund(amount, descriptor any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Refund", reflect.TypeOf((*MockMeter)(nil).Refund), amount, descriptor) } diff --git a/core/testing/go.mod b/core/testing/go.mod index 95f3b6a38c59..d58b3ca41c09 100644 --- a/core/testing/go.mod +++ b/core/testing/go.mod @@ -4,8 +4,8 @@ go 1.23 require ( cosmossdk.io/core v1.0.0-alpha.4 - github.com/golang/mock v1.6.0 github.com/tidwall/btree v1.7.0 + go.uber.org/mock v0.5.0 ) require cosmossdk.io/schema v0.3.0 // indirect diff --git a/core/testing/go.sum b/core/testing/go.sum index 9fc6d98fad48..3f2a99ea1c4c 100644 --- a/core/testing/go.sum +++ b/core/testing/go.sum @@ -2,30 +2,7 @@ cosmossdk.io/core v1.0.0-alpha.4 h1:9iuroT9ejDYETCsGkzkvs/wAY/5UFl7nCIINFRxyMJY= cosmossdk.io/core v1.0.0-alpha.4/go.mod h1:3u9cWq1FAVtiiCrDPpo4LhR+9V6k/ycSG4/Y/tREWCY= cosmossdk.io/schema v0.3.0 h1:01lcaM4trhzZ1HQTfTV8z6Ma1GziOZ/YmdzBN3F720c= cosmossdk.io/schema v0.3.0/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= -github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= -github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/tidwall/btree v1.7.0 h1:L1fkJH/AuEh5zBnnBbmTwQ5Lt+bRJ5A8EWecslvo9iI= github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= +go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= diff --git a/go.mod b/go.mod index 58dba9be0b5c..f6286b7dc3e4 100644 --- a/go.mod +++ b/go.mod @@ -54,6 +54,7 @@ require ( github.com/stretchr/testify v1.9.0 github.com/tendermint/go-amino v0.16.0 gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b + go.uber.org/mock v0.5.0 golang.org/x/crypto v0.28.0 golang.org/x/sync v0.8.0 google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 @@ -161,12 +162,12 @@ require ( go.opencensus.io v0.24.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect - golang.org/x/mod v0.17.0 // indirect + golang.org/x/mod v0.18.0 // indirect golang.org/x/net v0.29.0 // indirect golang.org/x/sys v0.26.0 // indirect golang.org/x/term v0.25.0 // indirect golang.org/x/text v0.19.0 // indirect - golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect + golang.org/x/tools v0.22.0 // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/go.sum b/go.sum index f51f06cc2bf6..b71c8aa49ec6 100644 --- a/go.sum +++ b/go.sum @@ -524,8 +524,8 @@ golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0= +golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -614,8 +614,8 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= +golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/orm/go.mod b/orm/go.mod index 439116b77d9a..8ee49c3d0a51 100644 --- a/orm/go.mod +++ b/orm/go.mod @@ -10,11 +10,11 @@ require ( cosmossdk.io/errors v1.0.1 github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 github.com/cosmos/cosmos-proto v1.0.0-beta.5 - github.com/golang/mock v1.6.0 github.com/google/go-cmp v0.6.0 github.com/iancoleman/strcase v0.3.0 github.com/regen-network/gocuke v1.1.1 github.com/stretchr/testify v1.9.0 + go.uber.org/mock v0.5.0 golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 google.golang.org/grpc v1.67.1 google.golang.org/protobuf v1.35.1 diff --git a/orm/go.sum b/orm/go.sum index 726ff3f59a2d..3ed1e309b0ca 100644 --- a/orm/go.sum +++ b/orm/go.sum @@ -68,8 +68,6 @@ github.com/gofrs/uuid v4.4.0+incompatible h1:3qXRTX8/NbyulANqlc0lchS1gqAVxRgsuW1 github.com/gofrs/uuid v4.4.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= -github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= @@ -167,7 +165,8 @@ github.com/tidwall/btree v1.7.0 h1:L1fkJH/AuEh5zBnnBbmTwQ5Lt+bRJ5A8EWecslvo9iI= github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= +go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -175,14 +174,12 @@ golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 h1:vr/HnozRka3pE4EsMEg1lgkXJ golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= @@ -193,7 +190,6 @@ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -207,9 +203,7 @@ golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -230,7 +224,6 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/orm/model/ormdb/module_test.go b/orm/model/ormdb/module_test.go index b6960d833891..362e797a0f37 100644 --- a/orm/model/ormdb/module_test.go +++ b/orm/model/ormdb/module_test.go @@ -8,7 +8,7 @@ import ( "strings" "testing" - "github.com/golang/mock/gomock" + "go.uber.org/mock/gomock" "gotest.tools/v3/assert" "gotest.tools/v3/golden" diff --git a/orm/testing/ormmocks/hooks.go b/orm/testing/ormmocks/hooks.go index c5ad0e6f0b17..8ae173e6a5a6 100644 --- a/orm/testing/ormmocks/hooks.go +++ b/orm/testing/ormmocks/hooks.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: orm/model/ormtable/hooks.go +// +// Generated by this command: +// +// mockgen -source=orm/model/ormtable/hooks.go -package ormmocks -destination orm/testing/ormmocks/hooks.go +// // Package ormmocks is a generated GoMock package. package ormmocks @@ -8,7 +13,7 @@ import ( context "context" reflect "reflect" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" proto "google.golang.org/protobuf/proto" ) @@ -16,6 +21,7 @@ import ( type MockValidateHooks struct { ctrl *gomock.Controller recorder *MockValidateHooksMockRecorder + isgomock struct{} } // MockValidateHooksMockRecorder is the mock recorder for MockValidateHooks. @@ -44,7 +50,7 @@ func (m *MockValidateHooks) ValidateDelete(arg0 context.Context, arg1 proto.Mess } // ValidateDelete indicates an expected call of ValidateDelete. -func (mr *MockValidateHooksMockRecorder) ValidateDelete(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockValidateHooksMockRecorder) ValidateDelete(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidateDelete", reflect.TypeOf((*MockValidateHooks)(nil).ValidateDelete), arg0, arg1) } @@ -58,7 +64,7 @@ func (m *MockValidateHooks) ValidateInsert(arg0 context.Context, arg1 proto.Mess } // ValidateInsert indicates an expected call of ValidateInsert. -func (mr *MockValidateHooksMockRecorder) ValidateInsert(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockValidateHooksMockRecorder) ValidateInsert(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidateInsert", reflect.TypeOf((*MockValidateHooks)(nil).ValidateInsert), arg0, arg1) } @@ -72,7 +78,7 @@ func (m *MockValidateHooks) ValidateUpdate(ctx context.Context, existing, new pr } // ValidateUpdate indicates an expected call of ValidateUpdate. -func (mr *MockValidateHooksMockRecorder) ValidateUpdate(ctx, existing, new interface{}) *gomock.Call { +func (mr *MockValidateHooksMockRecorder) ValidateUpdate(ctx, existing, new any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidateUpdate", reflect.TypeOf((*MockValidateHooks)(nil).ValidateUpdate), ctx, existing, new) } @@ -81,6 +87,7 @@ func (mr *MockValidateHooksMockRecorder) ValidateUpdate(ctx, existing, new inter type MockWriteHooks struct { ctrl *gomock.Controller recorder *MockWriteHooksMockRecorder + isgomock struct{} } // MockWriteHooksMockRecorder is the mock recorder for MockWriteHooks. @@ -107,7 +114,7 @@ func (m *MockWriteHooks) OnDelete(arg0 context.Context, arg1 proto.Message) { } // OnDelete indicates an expected call of OnDelete. -func (mr *MockWriteHooksMockRecorder) OnDelete(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockWriteHooksMockRecorder) OnDelete(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OnDelete", reflect.TypeOf((*MockWriteHooks)(nil).OnDelete), arg0, arg1) } @@ -119,7 +126,7 @@ func (m *MockWriteHooks) OnInsert(arg0 context.Context, arg1 proto.Message) { } // OnInsert indicates an expected call of OnInsert. -func (mr *MockWriteHooksMockRecorder) OnInsert(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockWriteHooksMockRecorder) OnInsert(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OnInsert", reflect.TypeOf((*MockWriteHooks)(nil).OnInsert), arg0, arg1) } @@ -131,7 +138,7 @@ func (m *MockWriteHooks) OnUpdate(ctx context.Context, existing, new proto.Messa } // OnUpdate indicates an expected call of OnUpdate. -func (mr *MockWriteHooksMockRecorder) OnUpdate(ctx, existing, new interface{}) *gomock.Call { +func (mr *MockWriteHooksMockRecorder) OnUpdate(ctx, existing, new any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OnUpdate", reflect.TypeOf((*MockWriteHooks)(nil).OnUpdate), ctx, existing, new) } diff --git a/orm/testing/ormmocks/match.go b/orm/testing/ormmocks/match.go index 8c1da2c022f0..908c931bb4d1 100644 --- a/orm/testing/ormmocks/match.go +++ b/orm/testing/ormmocks/match.go @@ -1,8 +1,8 @@ package ormmocks import ( - "github.com/golang/mock/gomock" "github.com/google/go-cmp/cmp" + "go.uber.org/mock/gomock" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/testing/protocmp" ) diff --git a/scripts/build/build.mk b/scripts/build/build.mk index 9bb6e5789171..f68288ca8a5d 100644 --- a/scripts/build/build.mk +++ b/scripts/build/build.mk @@ -150,7 +150,7 @@ hubl: #? mocks: Generate mock file mocks: $(MOCKS_DIR) - @go install github.com/golang/mock/mockgen@v1.6.0 + @go install go.uber.org/mock/mockgen@v0.5.0 sh ./scripts/mockgen.sh .PHONY: mocks diff --git a/server/v2/cometbft/go.mod b/server/v2/cometbft/go.mod index aa08bf57a0de..b4e2905a546d 100644 --- a/server/v2/cometbft/go.mod +++ b/server/v2/cometbft/go.mod @@ -169,13 +169,13 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.28.0 // indirect golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect - golang.org/x/mod v0.17.0 // indirect + golang.org/x/mod v0.18.0 // indirect golang.org/x/net v0.29.0 // indirect golang.org/x/sync v0.8.0 // indirect golang.org/x/sys v0.26.0 // indirect golang.org/x/term v0.25.0 // indirect golang.org/x/text v0.19.0 // indirect - golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect + golang.org/x/tools v0.22.0 // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f // indirect diff --git a/server/v2/cometbft/go.sum b/server/v2/cometbft/go.sum index 03c8ee94ecd9..6fa28714d8e1 100644 --- a/server/v2/cometbft/go.sum +++ b/server/v2/cometbft/go.sum @@ -527,8 +527,8 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0= +golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -620,8 +620,8 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= +golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/simapp/app_test.go b/simapp/app_test.go index 4bed502db44f..3553b47edf37 100644 --- a/simapp/app_test.go +++ b/simapp/app_test.go @@ -8,8 +8,8 @@ import ( abci "github.com/cometbft/cometbft/api/cometbft/abci/v1" cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1" "github.com/cosmos/gogoproto/proto" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" "google.golang.org/grpc" "cosmossdk.io/core/appmodule" diff --git a/simapp/go.mod b/simapp/go.mod index 356623a6423f..0988fe2f7f78 100644 --- a/simapp/go.mod +++ b/simapp/go.mod @@ -37,12 +37,12 @@ require ( // this version is not used as it is always replaced by the latest Cosmos SDK version github.com/cosmos/cosmos-sdk v0.53.0 github.com/cosmos/gogoproto v1.7.0 - github.com/golang/mock v1.6.0 github.com/spf13/cast v1.7.0 github.com/spf13/cobra v1.8.1 github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.19.0 github.com/stretchr/testify v1.9.0 + go.uber.org/mock v0.5.0 google.golang.org/protobuf v1.35.1 ) @@ -211,7 +211,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.28.0 // indirect golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect - golang.org/x/mod v0.17.0 // indirect + golang.org/x/mod v0.18.0 // indirect golang.org/x/net v0.29.0 // indirect golang.org/x/oauth2 v0.23.0 // indirect golang.org/x/sync v0.8.0 // indirect @@ -219,7 +219,7 @@ require ( golang.org/x/term v0.25.0 // indirect golang.org/x/text v0.19.0 // indirect golang.org/x/time v0.6.0 // indirect - golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect + golang.org/x/tools v0.22.0 // indirect google.golang.org/api v0.192.0 // indirect google.golang.org/genproto v0.0.0-20240814211410-ddb44dafa142 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect diff --git a/simapp/go.sum b/simapp/go.sum index 3b776fc74818..5580a43e71f2 100644 --- a/simapp/go.sum +++ b/simapp/go.sum @@ -902,8 +902,8 @@ golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0= +golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1163,8 +1163,8 @@ golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= +golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/simapp/v2/go.mod b/simapp/v2/go.mod index 457c1e06364c..5059906225c3 100644 --- a/simapp/v2/go.mod +++ b/simapp/v2/go.mod @@ -123,7 +123,6 @@ require ( github.com/gogo/googleapis v1.4.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/golang/mock v1.6.0 // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/btree v1.1.3 // indirect @@ -215,10 +214,11 @@ require ( go.opentelemetry.io/otel v1.28.0 // indirect go.opentelemetry.io/otel/metric v1.28.0 // indirect go.opentelemetry.io/otel/trace v1.28.0 // indirect + go.uber.org/mock v0.5.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.28.0 // indirect golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect - golang.org/x/mod v0.17.0 // indirect + golang.org/x/mod v0.18.0 // indirect golang.org/x/net v0.29.0 // indirect golang.org/x/oauth2 v0.23.0 // indirect golang.org/x/sync v0.8.0 // indirect @@ -226,7 +226,7 @@ require ( golang.org/x/term v0.25.0 // indirect golang.org/x/text v0.19.0 // indirect golang.org/x/time v0.6.0 // indirect - golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect + golang.org/x/tools v0.22.0 // indirect google.golang.org/api v0.192.0 // indirect google.golang.org/genproto v0.0.0-20240814211410-ddb44dafa142 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect diff --git a/simapp/v2/go.sum b/simapp/v2/go.sum index b0539f4e26df..8e389c9b5f17 100644 --- a/simapp/v2/go.sum +++ b/simapp/v2/go.sum @@ -906,8 +906,8 @@ golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0= +golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1167,8 +1167,8 @@ golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= +golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/tests/go.mod b/tests/go.mod index 540cb84fd733..a01b8a1de45d 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -22,9 +22,9 @@ require ( // this version is not used as it is always replaced by the latest Cosmos SDK version github.com/cosmos/cosmos-sdk v0.53.0 github.com/cosmos/gogoproto v1.7.0 - github.com/golang/mock v1.6.0 github.com/spf13/cobra v1.8.1 github.com/stretchr/testify v1.9.0 + go.uber.org/mock v0.5.0 google.golang.org/grpc v1.67.1 google.golang.org/protobuf v1.35.1 gotest.tools/v3 v3.5.1 @@ -208,7 +208,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.28.0 // indirect golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect - golang.org/x/mod v0.17.0 // indirect + golang.org/x/mod v0.18.0 // indirect golang.org/x/net v0.29.0 // indirect golang.org/x/oauth2 v0.23.0 // indirect golang.org/x/sync v0.8.0 // indirect @@ -216,7 +216,7 @@ require ( golang.org/x/term v0.25.0 // indirect golang.org/x/text v0.19.0 // indirect golang.org/x/time v0.6.0 // indirect - golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect + golang.org/x/tools v0.22.0 // indirect google.golang.org/api v0.192.0 // indirect google.golang.org/genproto v0.0.0-20240814211410-ddb44dafa142 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect diff --git a/tests/go.sum b/tests/go.sum index 8955b4efeb4a..c912b0ab64ba 100644 --- a/tests/go.sum +++ b/tests/go.sum @@ -891,8 +891,8 @@ golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0= +golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1152,8 +1152,8 @@ golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= +golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/tests/integration/bank/keeper/deterministic_test.go b/tests/integration/bank/keeper/deterministic_test.go index 7233a4d0ee86..7764352f69a7 100644 --- a/tests/integration/bank/keeper/deterministic_test.go +++ b/tests/integration/bank/keeper/deterministic_test.go @@ -4,7 +4,7 @@ import ( "context" "testing" - "github.com/golang/mock/gomock" + "go.uber.org/mock/gomock" "gotest.tools/v3/assert" "pgregory.net/rapid" diff --git a/tests/integration/distribution/keeper/msg_server_test.go b/tests/integration/distribution/keeper/msg_server_test.go index 7ab94c01a3e1..df45035c1600 100644 --- a/tests/integration/distribution/keeper/msg_server_test.go +++ b/tests/integration/distribution/keeper/msg_server_test.go @@ -5,8 +5,8 @@ import ( "fmt" "testing" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" "gotest.tools/v3/assert" "cosmossdk.io/collections" diff --git a/tests/integration/distribution/migration_v4_test.go b/tests/integration/distribution/migration_v4_test.go index 7be836386982..8da3a416a7aa 100644 --- a/tests/integration/distribution/migration_v4_test.go +++ b/tests/integration/distribution/migration_v4_test.go @@ -4,8 +4,8 @@ import ( "context" "testing" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" "cosmossdk.io/core/comet" coretesting "cosmossdk.io/core/testing" diff --git a/tests/integration/evidence/keeper/infraction_test.go b/tests/integration/evidence/keeper/infraction_test.go index 6be779630903..b82bc1fae114 100644 --- a/tests/integration/evidence/keeper/infraction_test.go +++ b/tests/integration/evidence/keeper/infraction_test.go @@ -8,7 +8,7 @@ import ( "testing" "time" - "github.com/golang/mock/gomock" + "go.uber.org/mock/gomock" "gotest.tools/v3/assert" "cosmossdk.io/collections" diff --git a/tests/integration/example/example_test.go b/tests/integration/example/example_test.go index 7ff625634ac9..c1deca500aab 100644 --- a/tests/integration/example/example_test.go +++ b/tests/integration/example/example_test.go @@ -7,8 +7,8 @@ import ( "io" "testing" - "github.com/golang/mock/gomock" "github.com/google/go-cmp/cmp" + "go.uber.org/mock/gomock" "cosmossdk.io/core/appmodule" "cosmossdk.io/log" diff --git a/tests/integration/gov/keeper/keeper_test.go b/tests/integration/gov/keeper/keeper_test.go index f1f94f575d58..c6b8a21ef7f4 100644 --- a/tests/integration/gov/keeper/keeper_test.go +++ b/tests/integration/gov/keeper/keeper_test.go @@ -4,7 +4,7 @@ import ( "context" "testing" - "github.com/golang/mock/gomock" + "go.uber.org/mock/gomock" "gotest.tools/v3/assert" "cosmossdk.io/core/appmodule" diff --git a/tests/integration/slashing/keeper/keeper_test.go b/tests/integration/slashing/keeper/keeper_test.go index e961dc68233d..c10c56543414 100644 --- a/tests/integration/slashing/keeper/keeper_test.go +++ b/tests/integration/slashing/keeper/keeper_test.go @@ -5,8 +5,8 @@ import ( "testing" "time" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" "gotest.tools/v3/assert" "cosmossdk.io/core/appmodule" diff --git a/tests/integration/staking/keeper/common_test.go b/tests/integration/staking/keeper/common_test.go index e3963efb7bb7..06e9c059486d 100644 --- a/tests/integration/staking/keeper/common_test.go +++ b/tests/integration/staking/keeper/common_test.go @@ -5,7 +5,7 @@ import ( "math/big" "testing" - "github.com/golang/mock/gomock" + "go.uber.org/mock/gomock" "gotest.tools/v3/assert" "cosmossdk.io/core/appmodule" diff --git a/tests/integration/staking/keeper/deterministic_test.go b/tests/integration/staking/keeper/deterministic_test.go index 4b9afd591281..4a47dc2fa6f5 100644 --- a/tests/integration/staking/keeper/deterministic_test.go +++ b/tests/integration/staking/keeper/deterministic_test.go @@ -7,7 +7,7 @@ import ( "testing" "time" - "github.com/golang/mock/gomock" + "go.uber.org/mock/gomock" "gotest.tools/v3/assert" "pgregory.net/rapid" diff --git a/tests/integration/staking/keeper/unbonding_test.go b/tests/integration/staking/keeper/unbonding_test.go index 201a8a7ddde0..7a39f4ab20dd 100644 --- a/tests/integration/staking/keeper/unbonding_test.go +++ b/tests/integration/staking/keeper/unbonding_test.go @@ -4,7 +4,7 @@ import ( "testing" "time" - "github.com/golang/mock/gomock" + "go.uber.org/mock/gomock" "gotest.tools/v3/assert" "cosmossdk.io/core/header" diff --git a/testutil/mock/account_retriever.go b/testutil/mock/account_retriever.go index f1a104e649ca..90c98ca1140c 100644 --- a/testutil/mock/account_retriever.go +++ b/testutil/mock/account_retriever.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: client/account_retriever.go +// +// Generated by this command: +// +// mockgen -source=client/account_retriever.go -package mock -destination testutil/mock/account_retriever.go +// // Package mock is a generated GoMock package. package mock @@ -10,13 +15,14 @@ import ( client "github.com/cosmos/cosmos-sdk/client" types "github.com/cosmos/cosmos-sdk/crypto/types" types0 "github.com/cosmos/cosmos-sdk/types" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockAccount is a mock of Account interface. type MockAccount struct { ctrl *gomock.Controller recorder *MockAccountMockRecorder + isgomock struct{} } // MockAccountMockRecorder is the mock recorder for MockAccount. @@ -96,6 +102,7 @@ func (mr *MockAccountMockRecorder) GetSequence() *gomock.Call { type MockAccountRetriever struct { ctrl *gomock.Controller recorder *MockAccountRetrieverMockRecorder + isgomock struct{} } // MockAccountRetrieverMockRecorder is the mock recorder for MockAccountRetriever. @@ -124,7 +131,7 @@ func (m *MockAccountRetriever) EnsureExists(clientCtx client.Context, addr types } // EnsureExists indicates an expected call of EnsureExists. -func (mr *MockAccountRetrieverMockRecorder) EnsureExists(clientCtx, addr interface{}) *gomock.Call { +func (mr *MockAccountRetrieverMockRecorder) EnsureExists(clientCtx, addr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EnsureExists", reflect.TypeOf((*MockAccountRetriever)(nil).EnsureExists), clientCtx, addr) } @@ -139,7 +146,7 @@ func (m *MockAccountRetriever) GetAccount(clientCtx client.Context, addr types0. } // GetAccount indicates an expected call of GetAccount. -func (mr *MockAccountRetrieverMockRecorder) GetAccount(clientCtx, addr interface{}) *gomock.Call { +func (mr *MockAccountRetrieverMockRecorder) GetAccount(clientCtx, addr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccount", reflect.TypeOf((*MockAccountRetriever)(nil).GetAccount), clientCtx, addr) } @@ -155,7 +162,7 @@ func (m *MockAccountRetriever) GetAccountNumberSequence(clientCtx client.Context } // GetAccountNumberSequence indicates an expected call of GetAccountNumberSequence. -func (mr *MockAccountRetrieverMockRecorder) GetAccountNumberSequence(clientCtx, addr interface{}) *gomock.Call { +func (mr *MockAccountRetrieverMockRecorder) GetAccountNumberSequence(clientCtx, addr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccountNumberSequence", reflect.TypeOf((*MockAccountRetriever)(nil).GetAccountNumberSequence), clientCtx, addr) } @@ -171,7 +178,7 @@ func (m *MockAccountRetriever) GetAccountWithHeight(clientCtx client.Context, ad } // GetAccountWithHeight indicates an expected call of GetAccountWithHeight. -func (mr *MockAccountRetrieverMockRecorder) GetAccountWithHeight(clientCtx, addr interface{}) *gomock.Call { +func (mr *MockAccountRetrieverMockRecorder) GetAccountWithHeight(clientCtx, addr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccountWithHeight", reflect.TypeOf((*MockAccountRetriever)(nil).GetAccountWithHeight), clientCtx, addr) } diff --git a/testutil/mock/grpc_server.go b/testutil/mock/grpc_server.go index 7959051080d4..6afab1ee092f 100644 --- a/testutil/mock/grpc_server.go +++ b/testutil/mock/grpc_server.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/cosmos/gogoproto/grpc (interfaces: Server) +// +// Generated by this command: +// +// mockgen -package mock -destination testutil/mock/grpc_server.go github.com/cosmos/gogoproto/grpc Server +// // Package mock is a generated GoMock package. package mock @@ -7,7 +12,7 @@ package mock import ( reflect "reflect" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" grpc "google.golang.org/grpc" ) @@ -15,6 +20,7 @@ import ( type MockServer struct { ctrl *gomock.Controller recorder *MockServerMockRecorder + isgomock struct{} } // MockServerMockRecorder is the mock recorder for MockServer. @@ -35,13 +41,13 @@ func (m *MockServer) EXPECT() *MockServerMockRecorder { } // RegisterService mocks base method. -func (m *MockServer) RegisterService(arg0 *grpc.ServiceDesc, arg1 interface{}) { +func (m *MockServer) RegisterService(sd *grpc.ServiceDesc, ss any) { m.ctrl.T.Helper() - m.ctrl.Call(m, "RegisterService", arg0, arg1) + m.ctrl.Call(m, "RegisterService", sd, ss) } // RegisterService indicates an expected call of RegisterService. -func (mr *MockServerMockRecorder) RegisterService(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockServerMockRecorder) RegisterService(sd, ss any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterService", reflect.TypeOf((*MockServer)(nil).RegisterService), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterService", reflect.TypeOf((*MockServer)(nil).RegisterService), sd, ss) } diff --git a/testutil/mock/logger.go b/testutil/mock/logger.go index 800210aa241e..75b87274306e 100644 --- a/testutil/mock/logger.go +++ b/testutil/mock/logger.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: cosmossdk.io/log (interfaces: Logger) +// +// Generated by this command: +// +// mockgen -package mock -destination testutil/mock/logger.go cosmossdk.io/log Logger +// // Package mock is a generated GoMock package. package mock @@ -8,13 +13,14 @@ import ( reflect "reflect" log "cosmossdk.io/log" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockLogger is a mock of Logger interface. type MockLogger struct { ctrl *gomock.Controller recorder *MockLoggerMockRecorder + isgomock struct{} } // MockLoggerMockRecorder is the mock recorder for MockLogger. @@ -35,44 +41,44 @@ func (m *MockLogger) EXPECT() *MockLoggerMockRecorder { } // Debug mocks base method. -func (m *MockLogger) Debug(arg0 string, arg1 ...interface{}) { +func (m *MockLogger) Debug(msg string, keyVals ...any) { m.ctrl.T.Helper() - varargs := []interface{}{arg0} - for _, a := range arg1 { + varargs := []any{msg} + for _, a := range keyVals { varargs = append(varargs, a) } m.ctrl.Call(m, "Debug", varargs...) } // Debug indicates an expected call of Debug. -func (mr *MockLoggerMockRecorder) Debug(arg0 interface{}, arg1 ...interface{}) *gomock.Call { +func (mr *MockLoggerMockRecorder) Debug(msg any, keyVals ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0}, arg1...) + varargs := append([]any{msg}, keyVals...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Debug", reflect.TypeOf((*MockLogger)(nil).Debug), varargs...) } // Error mocks base method. -func (m *MockLogger) Error(arg0 string, arg1 ...interface{}) { +func (m *MockLogger) Error(msg string, keyVals ...any) { m.ctrl.T.Helper() - varargs := []interface{}{arg0} - for _, a := range arg1 { + varargs := []any{msg} + for _, a := range keyVals { varargs = append(varargs, a) } m.ctrl.Call(m, "Error", varargs...) } // Error indicates an expected call of Error. -func (mr *MockLoggerMockRecorder) Error(arg0 interface{}, arg1 ...interface{}) *gomock.Call { +func (mr *MockLoggerMockRecorder) Error(msg any, keyVals ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0}, arg1...) + varargs := append([]any{msg}, keyVals...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Error", reflect.TypeOf((*MockLogger)(nil).Error), varargs...) } // Impl mocks base method. -func (m *MockLogger) Impl() interface{} { +func (m *MockLogger) Impl() any { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Impl") - ret0, _ := ret[0].(interface{}) + ret0, _ := ret[0].(any) return ret0 } @@ -83,44 +89,44 @@ func (mr *MockLoggerMockRecorder) Impl() *gomock.Call { } // Info mocks base method. -func (m *MockLogger) Info(arg0 string, arg1 ...interface{}) { +func (m *MockLogger) Info(msg string, keyVals ...any) { m.ctrl.T.Helper() - varargs := []interface{}{arg0} - for _, a := range arg1 { + varargs := []any{msg} + for _, a := range keyVals { varargs = append(varargs, a) } m.ctrl.Call(m, "Info", varargs...) } // Info indicates an expected call of Info. -func (mr *MockLoggerMockRecorder) Info(arg0 interface{}, arg1 ...interface{}) *gomock.Call { +func (mr *MockLoggerMockRecorder) Info(msg any, keyVals ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0}, arg1...) + varargs := append([]any{msg}, keyVals...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Info", reflect.TypeOf((*MockLogger)(nil).Info), varargs...) } // Warn mocks base method. -func (m *MockLogger) Warn(arg0 string, arg1 ...interface{}) { +func (m *MockLogger) Warn(msg string, keyVals ...any) { m.ctrl.T.Helper() - varargs := []interface{}{arg0} - for _, a := range arg1 { + varargs := []any{msg} + for _, a := range keyVals { varargs = append(varargs, a) } m.ctrl.Call(m, "Warn", varargs...) } // Warn indicates an expected call of Warn. -func (mr *MockLoggerMockRecorder) Warn(arg0 interface{}, arg1 ...interface{}) *gomock.Call { +func (mr *MockLoggerMockRecorder) Warn(msg any, keyVals ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0}, arg1...) + varargs := append([]any{msg}, keyVals...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Warn", reflect.TypeOf((*MockLogger)(nil).Warn), varargs...) } // With mocks base method. -func (m *MockLogger) With(arg0 ...interface{}) log.Logger { +func (m *MockLogger) With(keyVals ...any) log.Logger { m.ctrl.T.Helper() - varargs := []interface{}{} - for _, a := range arg0 { + varargs := []any{} + for _, a := range keyVals { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "With", varargs...) @@ -129,7 +135,7 @@ func (m *MockLogger) With(arg0 ...interface{}) log.Logger { } // With indicates an expected call of With. -func (mr *MockLoggerMockRecorder) With(arg0 ...interface{}) *gomock.Call { +func (mr *MockLoggerMockRecorder) With(keyVals ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "With", reflect.TypeOf((*MockLogger)(nil).With), arg0...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "With", reflect.TypeOf((*MockLogger)(nil).With), keyVals...) } diff --git a/testutil/mock/types_handler.go b/testutil/mock/types_handler.go index dfdb46cf3d79..06f603719297 100644 --- a/testutil/mock/types_handler.go +++ b/testutil/mock/types_handler.go @@ -10,7 +10,7 @@ package mock import ( "reflect" - "github.com/golang/mock/gomock" + "go.uber.org/mock/gomock" "github.com/cosmos/cosmos-sdk/types" ) diff --git a/testutil/mock/types_invariant.go b/testutil/mock/types_invariant.go index 7846a9dd9de3..04d8cfa6db61 100644 --- a/testutil/mock/types_invariant.go +++ b/testutil/mock/types_invariant.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: types/invariant.go +// +// Generated by this command: +// +// mockgen -source=types/invariant.go -package mock -destination testutil/mock/types_invariant.go +// // Package mock is a generated GoMock package. package mock @@ -8,13 +13,14 @@ import ( reflect "reflect" types "github.com/cosmos/cosmos-sdk/types" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockInvariantRegistry is a mock of InvariantRegistry interface. type MockInvariantRegistry struct { ctrl *gomock.Controller recorder *MockInvariantRegistryMockRecorder + isgomock struct{} } // MockInvariantRegistryMockRecorder is the mock recorder for MockInvariantRegistry. @@ -41,7 +47,7 @@ func (m *MockInvariantRegistry) RegisterRoute(moduleName, route string, invar ty } // RegisterRoute indicates an expected call of RegisterRoute. -func (mr *MockInvariantRegistryMockRecorder) RegisterRoute(moduleName, route, invar interface{}) *gomock.Call { +func (mr *MockInvariantRegistryMockRecorder) RegisterRoute(moduleName, route, invar any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterRoute", reflect.TypeOf((*MockInvariantRegistry)(nil).RegisterRoute), moduleName, route, invar) } diff --git a/testutil/mock/types_mock_appmodule.go b/testutil/mock/types_mock_appmodule.go index 016660bb0f18..686e246195f7 100644 --- a/testutil/mock/types_mock_appmodule.go +++ b/testutil/mock/types_mock_appmodule.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: types/module/mock_appmodule_test.go +// +// Generated by this command: +// +// mockgen -source=types/module/mock_appmodule_test.go -package mock -destination testutil/mock/types_mock_appmodule.go +// // Package mock is a generated GoMock package. package mock @@ -13,13 +18,14 @@ import ( appmodulev2 "cosmossdk.io/core/appmodule/v2" types "github.com/cosmos/cosmos-sdk/types" module "github.com/cosmos/cosmos-sdk/types/module" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockAppModuleWithAllExtensions is a mock of AppModuleWithAllExtensions interface. type MockAppModuleWithAllExtensions struct { ctrl *gomock.Controller recorder *MockAppModuleWithAllExtensionsMockRecorder + isgomock struct{} } // MockAppModuleWithAllExtensionsMockRecorder is the mock recorder for MockAppModuleWithAllExtensions. @@ -77,7 +83,7 @@ func (m *MockAppModuleWithAllExtensions) EndBlock(arg0 context.Context) ([]modul } // EndBlock indicates an expected call of EndBlock. -func (mr *MockAppModuleWithAllExtensionsMockRecorder) EndBlock(arg0 interface{}) *gomock.Call { +func (mr *MockAppModuleWithAllExtensionsMockRecorder) EndBlock(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EndBlock", reflect.TypeOf((*MockAppModuleWithAllExtensions)(nil).EndBlock), arg0) } @@ -92,7 +98,7 @@ func (m *MockAppModuleWithAllExtensions) ExportGenesis(ctx context.Context) (jso } // ExportGenesis indicates an expected call of ExportGenesis. -func (mr *MockAppModuleWithAllExtensionsMockRecorder) ExportGenesis(ctx interface{}) *gomock.Call { +func (mr *MockAppModuleWithAllExtensionsMockRecorder) ExportGenesis(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ExportGenesis", reflect.TypeOf((*MockAppModuleWithAllExtensions)(nil).ExportGenesis), ctx) } @@ -106,7 +112,7 @@ func (m *MockAppModuleWithAllExtensions) InitGenesis(ctx context.Context, data j } // InitGenesis indicates an expected call of InitGenesis. -func (mr *MockAppModuleWithAllExtensionsMockRecorder) InitGenesis(ctx, data interface{}) *gomock.Call { +func (mr *MockAppModuleWithAllExtensionsMockRecorder) InitGenesis(ctx, data any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InitGenesis", reflect.TypeOf((*MockAppModuleWithAllExtensions)(nil).InitGenesis), ctx, data) } @@ -156,7 +162,7 @@ func (m *MockAppModuleWithAllExtensions) RegisterInvariants(arg0 types.Invariant } // RegisterInvariants indicates an expected call of RegisterInvariants. -func (mr *MockAppModuleWithAllExtensionsMockRecorder) RegisterInvariants(arg0 interface{}) *gomock.Call { +func (mr *MockAppModuleWithAllExtensionsMockRecorder) RegisterInvariants(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterInvariants", reflect.TypeOf((*MockAppModuleWithAllExtensions)(nil).RegisterInvariants), arg0) } @@ -168,7 +174,7 @@ func (m *MockAppModuleWithAllExtensions) RegisterServices(arg0 module.Configurat } // RegisterServices indicates an expected call of RegisterServices. -func (mr *MockAppModuleWithAllExtensionsMockRecorder) RegisterServices(arg0 interface{}) *gomock.Call { +func (mr *MockAppModuleWithAllExtensionsMockRecorder) RegisterServices(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterServices", reflect.TypeOf((*MockAppModuleWithAllExtensions)(nil).RegisterServices), arg0) } @@ -182,7 +188,7 @@ func (m *MockAppModuleWithAllExtensions) ValidateGenesis(data json.RawMessage) e } // ValidateGenesis indicates an expected call of ValidateGenesis. -func (mr *MockAppModuleWithAllExtensionsMockRecorder) ValidateGenesis(data interface{}) *gomock.Call { +func (mr *MockAppModuleWithAllExtensionsMockRecorder) ValidateGenesis(data any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidateGenesis", reflect.TypeOf((*MockAppModuleWithAllExtensions)(nil).ValidateGenesis), data) } @@ -191,6 +197,7 @@ func (mr *MockAppModuleWithAllExtensionsMockRecorder) ValidateGenesis(data inter type MockAppModuleWithAllExtensionsABCI struct { ctrl *gomock.Controller recorder *MockAppModuleWithAllExtensionsABCIMockRecorder + isgomock struct{} } // MockAppModuleWithAllExtensionsABCIMockRecorder is the mock recorder for MockAppModuleWithAllExtensionsABCI. @@ -248,7 +255,7 @@ func (m *MockAppModuleWithAllExtensionsABCI) EndBlock(arg0 context.Context) ([]m } // EndBlock indicates an expected call of EndBlock. -func (mr *MockAppModuleWithAllExtensionsABCIMockRecorder) EndBlock(arg0 interface{}) *gomock.Call { +func (mr *MockAppModuleWithAllExtensionsABCIMockRecorder) EndBlock(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EndBlock", reflect.TypeOf((*MockAppModuleWithAllExtensionsABCI)(nil).EndBlock), arg0) } @@ -263,7 +270,7 @@ func (m *MockAppModuleWithAllExtensionsABCI) ExportGenesis(ctx context.Context) } // ExportGenesis indicates an expected call of ExportGenesis. -func (mr *MockAppModuleWithAllExtensionsABCIMockRecorder) ExportGenesis(ctx interface{}) *gomock.Call { +func (mr *MockAppModuleWithAllExtensionsABCIMockRecorder) ExportGenesis(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ExportGenesis", reflect.TypeOf((*MockAppModuleWithAllExtensionsABCI)(nil).ExportGenesis), ctx) } @@ -278,7 +285,7 @@ func (m *MockAppModuleWithAllExtensionsABCI) InitGenesis(ctx context.Context, da } // InitGenesis indicates an expected call of InitGenesis. -func (mr *MockAppModuleWithAllExtensionsABCIMockRecorder) InitGenesis(ctx, data interface{}) *gomock.Call { +func (mr *MockAppModuleWithAllExtensionsABCIMockRecorder) InitGenesis(ctx, data any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InitGenesis", reflect.TypeOf((*MockAppModuleWithAllExtensionsABCI)(nil).InitGenesis), ctx, data) } @@ -328,7 +335,7 @@ func (m *MockAppModuleWithAllExtensionsABCI) RegisterInvariants(arg0 types.Invar } // RegisterInvariants indicates an expected call of RegisterInvariants. -func (mr *MockAppModuleWithAllExtensionsABCIMockRecorder) RegisterInvariants(arg0 interface{}) *gomock.Call { +func (mr *MockAppModuleWithAllExtensionsABCIMockRecorder) RegisterInvariants(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterInvariants", reflect.TypeOf((*MockAppModuleWithAllExtensionsABCI)(nil).RegisterInvariants), arg0) } @@ -340,7 +347,7 @@ func (m *MockAppModuleWithAllExtensionsABCI) RegisterServices(arg0 module.Config } // RegisterServices indicates an expected call of RegisterServices. -func (mr *MockAppModuleWithAllExtensionsABCIMockRecorder) RegisterServices(arg0 interface{}) *gomock.Call { +func (mr *MockAppModuleWithAllExtensionsABCIMockRecorder) RegisterServices(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterServices", reflect.TypeOf((*MockAppModuleWithAllExtensionsABCI)(nil).RegisterServices), arg0) } @@ -354,7 +361,7 @@ func (m *MockAppModuleWithAllExtensionsABCI) ValidateGenesis(data json.RawMessag } // ValidateGenesis indicates an expected call of ValidateGenesis. -func (mr *MockAppModuleWithAllExtensionsABCIMockRecorder) ValidateGenesis(data interface{}) *gomock.Call { +func (mr *MockAppModuleWithAllExtensionsABCIMockRecorder) ValidateGenesis(data any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidateGenesis", reflect.TypeOf((*MockAppModuleWithAllExtensionsABCI)(nil).ValidateGenesis), data) } @@ -363,6 +370,7 @@ func (mr *MockAppModuleWithAllExtensionsABCIMockRecorder) ValidateGenesis(data i type MockCoreAppModule struct { ctrl *gomock.Controller recorder *MockCoreAppModuleMockRecorder + isgomock struct{} } // MockCoreAppModuleMockRecorder is the mock recorder for MockCoreAppModule. @@ -391,7 +399,7 @@ func (m *MockCoreAppModule) BeginBlock(arg0 context.Context) error { } // BeginBlock indicates an expected call of BeginBlock. -func (mr *MockCoreAppModuleMockRecorder) BeginBlock(arg0 interface{}) *gomock.Call { +func (mr *MockCoreAppModuleMockRecorder) BeginBlock(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BeginBlock", reflect.TypeOf((*MockCoreAppModule)(nil).BeginBlock), arg0) } @@ -405,7 +413,7 @@ func (m *MockCoreAppModule) DefaultGenesis(arg0 appmodule.GenesisTarget) error { } // DefaultGenesis indicates an expected call of DefaultGenesis. -func (mr *MockCoreAppModuleMockRecorder) DefaultGenesis(arg0 interface{}) *gomock.Call { +func (mr *MockCoreAppModuleMockRecorder) DefaultGenesis(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DefaultGenesis", reflect.TypeOf((*MockCoreAppModule)(nil).DefaultGenesis), arg0) } @@ -419,7 +427,7 @@ func (m *MockCoreAppModule) EndBlock(arg0 context.Context) error { } // EndBlock indicates an expected call of EndBlock. -func (mr *MockCoreAppModuleMockRecorder) EndBlock(arg0 interface{}) *gomock.Call { +func (mr *MockCoreAppModuleMockRecorder) EndBlock(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EndBlock", reflect.TypeOf((*MockCoreAppModule)(nil).EndBlock), arg0) } @@ -433,7 +441,7 @@ func (m *MockCoreAppModule) ExportGenesis(arg0 context.Context, arg1 appmodule.G } // ExportGenesis indicates an expected call of ExportGenesis. -func (mr *MockCoreAppModuleMockRecorder) ExportGenesis(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockCoreAppModuleMockRecorder) ExportGenesis(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ExportGenesis", reflect.TypeOf((*MockCoreAppModule)(nil).ExportGenesis), arg0, arg1) } @@ -447,7 +455,7 @@ func (m *MockCoreAppModule) InitGenesis(arg0 context.Context, arg1 appmodule.Gen } // InitGenesis indicates an expected call of InitGenesis. -func (mr *MockCoreAppModuleMockRecorder) InitGenesis(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockCoreAppModuleMockRecorder) InitGenesis(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InitGenesis", reflect.TypeOf((*MockCoreAppModule)(nil).InitGenesis), arg0, arg1) } @@ -485,7 +493,7 @@ func (m *MockCoreAppModule) Precommit(arg0 context.Context) error { } // Precommit indicates an expected call of Precommit. -func (mr *MockCoreAppModuleMockRecorder) Precommit(arg0 interface{}) *gomock.Call { +func (mr *MockCoreAppModuleMockRecorder) Precommit(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Precommit", reflect.TypeOf((*MockCoreAppModule)(nil).Precommit), arg0) } @@ -499,7 +507,7 @@ func (m *MockCoreAppModule) PrepareCheckState(arg0 context.Context) error { } // PrepareCheckState indicates an expected call of PrepareCheckState. -func (mr *MockCoreAppModuleMockRecorder) PrepareCheckState(arg0 interface{}) *gomock.Call { +func (mr *MockCoreAppModuleMockRecorder) PrepareCheckState(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PrepareCheckState", reflect.TypeOf((*MockCoreAppModule)(nil).PrepareCheckState), arg0) } @@ -513,7 +521,7 @@ func (m *MockCoreAppModule) ValidateGenesis(arg0 appmodule.GenesisSource) error } // ValidateGenesis indicates an expected call of ValidateGenesis. -func (mr *MockCoreAppModuleMockRecorder) ValidateGenesis(arg0 interface{}) *gomock.Call { +func (mr *MockCoreAppModuleMockRecorder) ValidateGenesis(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidateGenesis", reflect.TypeOf((*MockCoreAppModule)(nil).ValidateGenesis), arg0) } @@ -522,6 +530,7 @@ func (mr *MockCoreAppModuleMockRecorder) ValidateGenesis(arg0 interface{}) *gomo type MockCoreAppModuleWithPreBlock struct { ctrl *gomock.Controller recorder *MockCoreAppModuleWithPreBlockMockRecorder + isgomock struct{} } // MockCoreAppModuleWithPreBlockMockRecorder is the mock recorder for MockCoreAppModuleWithPreBlock. @@ -550,7 +559,7 @@ func (m *MockCoreAppModuleWithPreBlock) BeginBlock(arg0 context.Context) error { } // BeginBlock indicates an expected call of BeginBlock. -func (mr *MockCoreAppModuleWithPreBlockMockRecorder) BeginBlock(arg0 interface{}) *gomock.Call { +func (mr *MockCoreAppModuleWithPreBlockMockRecorder) BeginBlock(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BeginBlock", reflect.TypeOf((*MockCoreAppModuleWithPreBlock)(nil).BeginBlock), arg0) } @@ -564,7 +573,7 @@ func (m *MockCoreAppModuleWithPreBlock) DefaultGenesis(arg0 appmodule.GenesisTar } // DefaultGenesis indicates an expected call of DefaultGenesis. -func (mr *MockCoreAppModuleWithPreBlockMockRecorder) DefaultGenesis(arg0 interface{}) *gomock.Call { +func (mr *MockCoreAppModuleWithPreBlockMockRecorder) DefaultGenesis(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DefaultGenesis", reflect.TypeOf((*MockCoreAppModuleWithPreBlock)(nil).DefaultGenesis), arg0) } @@ -578,7 +587,7 @@ func (m *MockCoreAppModuleWithPreBlock) EndBlock(arg0 context.Context) error { } // EndBlock indicates an expected call of EndBlock. -func (mr *MockCoreAppModuleWithPreBlockMockRecorder) EndBlock(arg0 interface{}) *gomock.Call { +func (mr *MockCoreAppModuleWithPreBlockMockRecorder) EndBlock(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EndBlock", reflect.TypeOf((*MockCoreAppModuleWithPreBlock)(nil).EndBlock), arg0) } @@ -592,7 +601,7 @@ func (m *MockCoreAppModuleWithPreBlock) ExportGenesis(arg0 context.Context, arg1 } // ExportGenesis indicates an expected call of ExportGenesis. -func (mr *MockCoreAppModuleWithPreBlockMockRecorder) ExportGenesis(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockCoreAppModuleWithPreBlockMockRecorder) ExportGenesis(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ExportGenesis", reflect.TypeOf((*MockCoreAppModuleWithPreBlock)(nil).ExportGenesis), arg0, arg1) } @@ -606,7 +615,7 @@ func (m *MockCoreAppModuleWithPreBlock) InitGenesis(arg0 context.Context, arg1 a } // InitGenesis indicates an expected call of InitGenesis. -func (mr *MockCoreAppModuleWithPreBlockMockRecorder) InitGenesis(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockCoreAppModuleWithPreBlockMockRecorder) InitGenesis(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InitGenesis", reflect.TypeOf((*MockCoreAppModuleWithPreBlock)(nil).InitGenesis), arg0, arg1) } @@ -644,7 +653,7 @@ func (m *MockCoreAppModuleWithPreBlock) PreBlock(arg0 context.Context) error { } // PreBlock indicates an expected call of PreBlock. -func (mr *MockCoreAppModuleWithPreBlockMockRecorder) PreBlock(arg0 interface{}) *gomock.Call { +func (mr *MockCoreAppModuleWithPreBlockMockRecorder) PreBlock(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PreBlock", reflect.TypeOf((*MockCoreAppModuleWithPreBlock)(nil).PreBlock), arg0) } @@ -658,7 +667,7 @@ func (m *MockCoreAppModuleWithPreBlock) Precommit(arg0 context.Context) error { } // Precommit indicates an expected call of Precommit. -func (mr *MockCoreAppModuleWithPreBlockMockRecorder) Precommit(arg0 interface{}) *gomock.Call { +func (mr *MockCoreAppModuleWithPreBlockMockRecorder) Precommit(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Precommit", reflect.TypeOf((*MockCoreAppModuleWithPreBlock)(nil).Precommit), arg0) } @@ -672,7 +681,7 @@ func (m *MockCoreAppModuleWithPreBlock) PrepareCheckState(arg0 context.Context) } // PrepareCheckState indicates an expected call of PrepareCheckState. -func (mr *MockCoreAppModuleWithPreBlockMockRecorder) PrepareCheckState(arg0 interface{}) *gomock.Call { +func (mr *MockCoreAppModuleWithPreBlockMockRecorder) PrepareCheckState(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PrepareCheckState", reflect.TypeOf((*MockCoreAppModuleWithPreBlock)(nil).PrepareCheckState), arg0) } @@ -686,7 +695,7 @@ func (m *MockCoreAppModuleWithPreBlock) ValidateGenesis(arg0 appmodule.GenesisSo } // ValidateGenesis indicates an expected call of ValidateGenesis. -func (mr *MockCoreAppModuleWithPreBlockMockRecorder) ValidateGenesis(arg0 interface{}) *gomock.Call { +func (mr *MockCoreAppModuleWithPreBlockMockRecorder) ValidateGenesis(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidateGenesis", reflect.TypeOf((*MockCoreAppModuleWithPreBlock)(nil).ValidateGenesis), arg0) } diff --git a/testutil/mock/types_module_module.go b/testutil/mock/types_module_module.go index 2cbeff8e6b54..e1b2bf199431 100644 --- a/testutil/mock/types_module_module.go +++ b/testutil/mock/types_module_module.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: types/module/module.go +// +// Generated by this command: +// +// mockgen -source=types/module/module.go -package mock -destination testutil/mock/types_module_module.go +// // Package mock is a generated GoMock package. package mock @@ -12,8 +17,8 @@ import ( client "github.com/cosmos/cosmos-sdk/client" types "github.com/cosmos/cosmos-sdk/types" module "github.com/cosmos/cosmos-sdk/types/module" - gomock "github.com/golang/mock/gomock" runtime "github.com/grpc-ecosystem/grpc-gateway/runtime" + gomock "go.uber.org/mock/gomock" grpc "google.golang.org/grpc" ) @@ -21,6 +26,7 @@ import ( type MockAppModuleBasic struct { ctrl *gomock.Controller recorder *MockAppModuleBasicMockRecorder + isgomock struct{} } // MockAppModuleBasicMockRecorder is the mock recorder for MockAppModuleBasic. @@ -47,7 +53,7 @@ func (m *MockAppModuleBasic) RegisterGRPCGatewayRoutes(arg0 client.Context, arg1 } // RegisterGRPCGatewayRoutes indicates an expected call of RegisterGRPCGatewayRoutes. -func (mr *MockAppModuleBasicMockRecorder) RegisterGRPCGatewayRoutes(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAppModuleBasicMockRecorder) RegisterGRPCGatewayRoutes(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterGRPCGatewayRoutes", reflect.TypeOf((*MockAppModuleBasic)(nil).RegisterGRPCGatewayRoutes), arg0, arg1) } @@ -59,7 +65,7 @@ func (m *MockAppModuleBasic) RegisterLegacyAminoCodec(arg0 registry.AminoRegistr } // RegisterLegacyAminoCodec indicates an expected call of RegisterLegacyAminoCodec. -func (mr *MockAppModuleBasicMockRecorder) RegisterLegacyAminoCodec(arg0 interface{}) *gomock.Call { +func (mr *MockAppModuleBasicMockRecorder) RegisterLegacyAminoCodec(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterLegacyAminoCodec", reflect.TypeOf((*MockAppModuleBasic)(nil).RegisterLegacyAminoCodec), arg0) } @@ -68,6 +74,7 @@ func (mr *MockAppModuleBasicMockRecorder) RegisterLegacyAminoCodec(arg0 interfac type MockAppModule struct { ctrl *gomock.Controller recorder *MockAppModuleMockRecorder + isgomock struct{} } // MockAppModuleMockRecorder is the mock recorder for MockAppModule. @@ -129,6 +136,7 @@ func (mr *MockAppModuleMockRecorder) Name() *gomock.Call { type MockHasAminoCodec struct { ctrl *gomock.Controller recorder *MockHasAminoCodecMockRecorder + isgomock struct{} } // MockHasAminoCodecMockRecorder is the mock recorder for MockHasAminoCodec. @@ -155,7 +163,7 @@ func (m *MockHasAminoCodec) RegisterLegacyAminoCodec(arg0 registry.AminoRegistra } // RegisterLegacyAminoCodec indicates an expected call of RegisterLegacyAminoCodec. -func (mr *MockHasAminoCodecMockRecorder) RegisterLegacyAminoCodec(arg0 interface{}) *gomock.Call { +func (mr *MockHasAminoCodecMockRecorder) RegisterLegacyAminoCodec(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterLegacyAminoCodec", reflect.TypeOf((*MockHasAminoCodec)(nil).RegisterLegacyAminoCodec), arg0) } @@ -164,6 +172,7 @@ func (mr *MockHasAminoCodecMockRecorder) RegisterLegacyAminoCodec(arg0 interface type MockHasGRPCGateway struct { ctrl *gomock.Controller recorder *MockHasGRPCGatewayMockRecorder + isgomock struct{} } // MockHasGRPCGatewayMockRecorder is the mock recorder for MockHasGRPCGateway. @@ -190,7 +199,7 @@ func (m *MockHasGRPCGateway) RegisterGRPCGatewayRoutes(arg0 client.Context, arg1 } // RegisterGRPCGatewayRoutes indicates an expected call of RegisterGRPCGatewayRoutes. -func (mr *MockHasGRPCGatewayMockRecorder) RegisterGRPCGatewayRoutes(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockHasGRPCGatewayMockRecorder) RegisterGRPCGatewayRoutes(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterGRPCGatewayRoutes", reflect.TypeOf((*MockHasGRPCGateway)(nil).RegisterGRPCGatewayRoutes), arg0, arg1) } @@ -199,6 +208,7 @@ func (mr *MockHasGRPCGatewayMockRecorder) RegisterGRPCGatewayRoutes(arg0, arg1 i type MockHasInvariants struct { ctrl *gomock.Controller recorder *MockHasInvariantsMockRecorder + isgomock struct{} } // MockHasInvariantsMockRecorder is the mock recorder for MockHasInvariants. @@ -225,7 +235,7 @@ func (m *MockHasInvariants) RegisterInvariants(arg0 types.InvariantRegistry) { } // RegisterInvariants indicates an expected call of RegisterInvariants. -func (mr *MockHasInvariantsMockRecorder) RegisterInvariants(arg0 interface{}) *gomock.Call { +func (mr *MockHasInvariantsMockRecorder) RegisterInvariants(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterInvariants", reflect.TypeOf((*MockHasInvariants)(nil).RegisterInvariants), arg0) } @@ -234,6 +244,7 @@ func (mr *MockHasInvariantsMockRecorder) RegisterInvariants(arg0 interface{}) *g type MockHasServices struct { ctrl *gomock.Controller recorder *MockHasServicesMockRecorder + isgomock struct{} } // MockHasServicesMockRecorder is the mock recorder for MockHasServices. @@ -260,7 +271,7 @@ func (m *MockHasServices) RegisterServices(arg0 module.Configurator) { } // RegisterServices indicates an expected call of RegisterServices. -func (mr *MockHasServicesMockRecorder) RegisterServices(arg0 interface{}) *gomock.Call { +func (mr *MockHasServicesMockRecorder) RegisterServices(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterServices", reflect.TypeOf((*MockHasServices)(nil).RegisterServices), arg0) } @@ -269,6 +280,7 @@ func (mr *MockHasServicesMockRecorder) RegisterServices(arg0 interface{}) *gomoc type MockhasServicesV1 struct { ctrl *gomock.Controller recorder *MockhasServicesV1MockRecorder + isgomock struct{} } // MockhasServicesV1MockRecorder is the mock recorder for MockhasServicesV1. @@ -321,7 +333,7 @@ func (m *MockhasServicesV1) RegisterServices(arg0 grpc.ServiceRegistrar) error { } // RegisterServices indicates an expected call of RegisterServices. -func (mr *MockhasServicesV1MockRecorder) RegisterServices(arg0 interface{}) *gomock.Call { +func (mr *MockhasServicesV1MockRecorder) RegisterServices(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterServices", reflect.TypeOf((*MockhasServicesV1)(nil).RegisterServices), arg0) } @@ -330,6 +342,7 @@ func (mr *MockhasServicesV1MockRecorder) RegisterServices(arg0 interface{}) *gom type MockHasABCIEndBlock struct { ctrl *gomock.Controller recorder *MockHasABCIEndBlockMockRecorder + isgomock struct{} } // MockHasABCIEndBlockMockRecorder is the mock recorder for MockHasABCIEndBlock. @@ -359,7 +372,7 @@ func (m *MockHasABCIEndBlock) EndBlock(arg0 context.Context) ([]module.Validator } // EndBlock indicates an expected call of EndBlock. -func (mr *MockHasABCIEndBlockMockRecorder) EndBlock(arg0 interface{}) *gomock.Call { +func (mr *MockHasABCIEndBlockMockRecorder) EndBlock(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EndBlock", reflect.TypeOf((*MockHasABCIEndBlock)(nil).EndBlock), arg0) } diff --git a/testutil/x/counter/testutil/expected_keepers_mocks.go b/testutil/x/counter/testutil/expected_keepers_mocks.go index 528d1b2fddb3..9d59980a087f 100644 --- a/testutil/x/counter/testutil/expected_keepers_mocks.go +++ b/testutil/x/counter/testutil/expected_keepers_mocks.go @@ -10,7 +10,7 @@ import ( types0 "github.com/cosmos/cosmos-sdk/x/auth/types" types "github.com/cosmos/cosmos-sdk/types" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockAccountKeeper is a mock of AccountKeeper interface. diff --git a/tools/confix/go.mod b/tools/confix/go.mod index f537f956c81d..6cbf05de8ff4 100644 --- a/tools/confix/go.mod +++ b/tools/confix/go.mod @@ -146,6 +146,7 @@ require ( golang.org/x/sys v0.26.0 // indirect golang.org/x/term v0.25.0 // indirect golang.org/x/text v0.19.0 // indirect + golang.org/x/tools v0.22.0 // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f // indirect diff --git a/tools/confix/go.sum b/tools/confix/go.sum index b3decd704e23..829a419257cb 100644 --- a/tools/confix/go.sum +++ b/tools/confix/go.sum @@ -784,8 +784,8 @@ golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzB golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0= +golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -920,8 +920,8 @@ golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= +golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/types/context_test.go b/types/context_test.go index d4e738edd156..0cb6935b6a87 100644 --- a/types/context_test.go +++ b/types/context_test.go @@ -7,8 +7,8 @@ import ( abci "github.com/cometbft/cometbft/api/cometbft/abci/v1" cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" + "go.uber.org/mock/gomock" "cosmossdk.io/core/comet" storetypes "cosmossdk.io/store/types" diff --git a/types/handler_test.go b/types/handler_test.go index 21eba84a903c..63412dec5625 100644 --- a/types/handler_test.go +++ b/types/handler_test.go @@ -3,8 +3,8 @@ package types_test import ( "testing" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" "github.com/cosmos/cosmos-sdk/testutil/mock" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/types/module/module_test.go b/types/module/module_test.go index fb2b5f746540..cab5b88288fc 100644 --- a/types/module/module_test.go +++ b/types/module/module_test.go @@ -8,9 +8,9 @@ import ( "testing" abci "github.com/cometbft/cometbft/api/cometbft/abci/v1" - "github.com/golang/mock/gomock" "github.com/spf13/cobra" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" "google.golang.org/grpc" "cosmossdk.io/core/appmodule" diff --git a/x/accounts/defaults/base/go.mod b/x/accounts/defaults/base/go.mod index bc28cb2f289e..69957b5dd4b2 100644 --- a/x/accounts/defaults/base/go.mod +++ b/x/accounts/defaults/base/go.mod @@ -149,13 +149,13 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.28.0 // indirect golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect - golang.org/x/mod v0.17.0 // indirect + golang.org/x/mod v0.18.0 // indirect golang.org/x/net v0.29.0 // indirect golang.org/x/sync v0.8.0 // indirect golang.org/x/sys v0.26.0 // indirect golang.org/x/term v0.25.0 // indirect golang.org/x/text v0.19.0 // indirect - golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect + golang.org/x/tools v0.22.0 // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f // indirect diff --git a/x/accounts/defaults/base/go.sum b/x/accounts/defaults/base/go.sum index bc75393ecca6..505182c3fbb8 100644 --- a/x/accounts/defaults/base/go.sum +++ b/x/accounts/defaults/base/go.sum @@ -521,8 +521,8 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0= +golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -614,8 +614,8 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= +golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/x/accounts/defaults/base/utils_test.go b/x/accounts/defaults/base/utils_test.go index 5d1a91893064..9ea432674a39 100644 --- a/x/accounts/defaults/base/utils_test.go +++ b/x/accounts/defaults/base/utils_test.go @@ -66,8 +66,7 @@ func newMockContext(t *testing.T) (context.Context, store.KVStoreService) { ) } -type transactionService struct { -} +type transactionService struct{} func (t transactionService) ExecMode(ctx context.Context) transaction.ExecMode { return transaction.ExecModeFinalize diff --git a/x/accounts/defaults/lockup/go.sum b/x/accounts/defaults/lockup/go.sum index 0ddda37d7acc..9fe9da5785db 100644 --- a/x/accounts/defaults/lockup/go.sum +++ b/x/accounts/defaults/lockup/go.sum @@ -459,8 +459,8 @@ golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvx golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0= +golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -537,8 +537,8 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= +golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/x/accounts/defaults/multisig/go.mod b/x/accounts/defaults/multisig/go.mod index 265aa5b79be7..5601d2011c46 100644 --- a/x/accounts/defaults/multisig/go.mod +++ b/x/accounts/defaults/multisig/go.mod @@ -149,13 +149,13 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.28.0 // indirect golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect - golang.org/x/mod v0.17.0 // indirect + golang.org/x/mod v0.18.0 // indirect golang.org/x/net v0.29.0 // indirect golang.org/x/sync v0.8.0 // indirect golang.org/x/sys v0.26.0 // indirect golang.org/x/term v0.25.0 // indirect golang.org/x/text v0.19.0 // indirect - golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect + golang.org/x/tools v0.22.0 // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f // indirect diff --git a/x/accounts/defaults/multisig/go.sum b/x/accounts/defaults/multisig/go.sum index bc75393ecca6..505182c3fbb8 100644 --- a/x/accounts/defaults/multisig/go.sum +++ b/x/accounts/defaults/multisig/go.sum @@ -521,8 +521,8 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0= +golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -614,8 +614,8 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= +golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/x/accounts/go.mod b/x/accounts/go.mod index ec9e3a68f871..0420c3db5591 100644 --- a/x/accounts/go.mod +++ b/x/accounts/go.mod @@ -78,7 +78,6 @@ require ( github.com/gogo/googleapis v1.4.1 // indirect github.com/gogo/protobuf v1.3.2 github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/golang/mock v1.6.0 // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/btree v1.1.3 // indirect @@ -150,16 +149,17 @@ require ( gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // indirect go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5 // indirect go.opencensus.io v0.24.0 // indirect + go.uber.org/mock v0.5.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.28.0 // indirect golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect - golang.org/x/mod v0.17.0 // indirect + golang.org/x/mod v0.18.0 // indirect golang.org/x/net v0.29.0 // indirect golang.org/x/sync v0.8.0 // indirect golang.org/x/sys v0.26.0 // indirect golang.org/x/term v0.25.0 // indirect golang.org/x/text v0.19.0 // indirect - golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect + golang.org/x/tools v0.22.0 // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f // indirect diff --git a/x/accounts/go.sum b/x/accounts/go.sum index 5c05f884e0eb..505182c3fbb8 100644 --- a/x/accounts/go.sum +++ b/x/accounts/go.sum @@ -484,7 +484,6 @@ github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EU github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= @@ -522,9 +521,8 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0= +golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -555,7 +553,6 @@ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -617,9 +614,8 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= +golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/x/auth/ante/ante_test.go b/x/auth/ante/ante_test.go index 0078c2a9803f..8db7e9f546e5 100644 --- a/x/auth/ante/ante_test.go +++ b/x/auth/ante/ante_test.go @@ -7,8 +7,8 @@ import ( "strings" "testing" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" "cosmossdk.io/core/gas" "cosmossdk.io/core/header" diff --git a/x/auth/ante/fee_test.go b/x/auth/ante/fee_test.go index 540f1d211f72..0b048a9b6097 100644 --- a/x/auth/ante/fee_test.go +++ b/x/auth/ante/fee_test.go @@ -3,8 +3,8 @@ package ante_test import ( "testing" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" "cosmossdk.io/math" diff --git a/x/auth/ante/feegrant_test.go b/x/auth/ante/feegrant_test.go index 234b7eadd7f8..b83d769ce4fd 100644 --- a/x/auth/ante/feegrant_test.go +++ b/x/auth/ante/feegrant_test.go @@ -7,8 +7,8 @@ import ( "testing" "time" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" diff --git a/x/auth/ante/testutil/expected_keepers_mocks.go b/x/auth/ante/testutil/expected_keepers_mocks.go index 8d313c0b0033..0ce54e8a0a98 100644 --- a/x/auth/ante/testutil/expected_keepers_mocks.go +++ b/x/auth/ante/testutil/expected_keepers_mocks.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: x/auth/ante/expected_keepers.go +// +// Generated by this command: +// +// mockgen -source=x/auth/ante/expected_keepers.go -package testutil -destination x/auth/ante/testutil/expected_keepers_mocks.go +// // Package testutil is a generated GoMock package. package testutil @@ -12,13 +17,14 @@ import ( appmodule "cosmossdk.io/core/appmodule" types "github.com/cosmos/cosmos-sdk/types" types0 "github.com/cosmos/cosmos-sdk/x/auth/types" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockAccountKeeper is a mock of AccountKeeper interface. type MockAccountKeeper struct { ctrl *gomock.Controller recorder *MockAccountKeeperMockRecorder + isgomock struct{} } // MockAccountKeeperMockRecorder is the mock recorder for MockAccountKeeper. @@ -61,7 +67,7 @@ func (m *MockAccountKeeper) GetAccount(ctx context.Context, addr types.AccAddres } // GetAccount indicates an expected call of GetAccount. -func (mr *MockAccountKeeperMockRecorder) GetAccount(ctx, addr interface{}) *gomock.Call { +func (mr *MockAccountKeeperMockRecorder) GetAccount(ctx, addr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccount", reflect.TypeOf((*MockAccountKeeper)(nil).GetAccount), ctx, addr) } @@ -89,7 +95,7 @@ func (m *MockAccountKeeper) GetModuleAddress(moduleName string) types.AccAddress } // GetModuleAddress indicates an expected call of GetModuleAddress. -func (mr *MockAccountKeeperMockRecorder) GetModuleAddress(moduleName interface{}) *gomock.Call { +func (mr *MockAccountKeeperMockRecorder) GetModuleAddress(moduleName any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetModuleAddress", reflect.TypeOf((*MockAccountKeeper)(nil).GetModuleAddress), moduleName) } @@ -103,7 +109,7 @@ func (m *MockAccountKeeper) GetParams(ctx context.Context) types0.Params { } // GetParams indicates an expected call of GetParams. -func (mr *MockAccountKeeperMockRecorder) GetParams(ctx interface{}) *gomock.Call { +func (mr *MockAccountKeeperMockRecorder) GetParams(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetParams", reflect.TypeOf((*MockAccountKeeper)(nil).GetParams), ctx) } @@ -117,7 +123,7 @@ func (m *MockAccountKeeper) NewAccountWithAddress(ctx context.Context, addr type } // NewAccountWithAddress indicates an expected call of NewAccountWithAddress. -func (mr *MockAccountKeeperMockRecorder) NewAccountWithAddress(ctx, addr interface{}) *gomock.Call { +func (mr *MockAccountKeeperMockRecorder) NewAccountWithAddress(ctx, addr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewAccountWithAddress", reflect.TypeOf((*MockAccountKeeper)(nil).NewAccountWithAddress), ctx, addr) } @@ -129,7 +135,7 @@ func (m *MockAccountKeeper) SetAccount(ctx context.Context, acc types.AccountI) } // SetAccount indicates an expected call of SetAccount. -func (mr *MockAccountKeeperMockRecorder) SetAccount(ctx, acc interface{}) *gomock.Call { +func (mr *MockAccountKeeperMockRecorder) SetAccount(ctx, acc any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetAccount", reflect.TypeOf((*MockAccountKeeper)(nil).SetAccount), ctx, acc) } @@ -138,6 +144,7 @@ func (mr *MockAccountKeeperMockRecorder) SetAccount(ctx, acc interface{}) *gomoc type MockFeegrantKeeper struct { ctrl *gomock.Controller recorder *MockFeegrantKeeperMockRecorder + isgomock struct{} } // MockFeegrantKeeperMockRecorder is the mock recorder for MockFeegrantKeeper. @@ -166,7 +173,7 @@ func (m *MockFeegrantKeeper) UseGrantedFees(ctx context.Context, granter, grante } // UseGrantedFees indicates an expected call of UseGrantedFees. -func (mr *MockFeegrantKeeperMockRecorder) UseGrantedFees(ctx, granter, grantee, fee, msgs interface{}) *gomock.Call { +func (mr *MockFeegrantKeeperMockRecorder) UseGrantedFees(ctx, granter, grantee, fee, msgs any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UseGrantedFees", reflect.TypeOf((*MockFeegrantKeeper)(nil).UseGrantedFees), ctx, granter, grantee, fee, msgs) } @@ -175,6 +182,7 @@ func (mr *MockFeegrantKeeperMockRecorder) UseGrantedFees(ctx, granter, grantee, type MockConsensusKeeper struct { ctrl *gomock.Controller recorder *MockConsensusKeeperMockRecorder + isgomock struct{} } // MockConsensusKeeperMockRecorder is the mock recorder for MockConsensusKeeper. @@ -205,7 +213,7 @@ func (m *MockConsensusKeeper) BlockParams(arg0 context.Context) (uint64, uint64, } // BlockParams indicates an expected call of BlockParams. -func (mr *MockConsensusKeeperMockRecorder) BlockParams(arg0 interface{}) *gomock.Call { +func (mr *MockConsensusKeeperMockRecorder) BlockParams(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BlockParams", reflect.TypeOf((*MockConsensusKeeper)(nil).BlockParams), arg0) } diff --git a/x/auth/ante/testutil_test.go b/x/auth/ante/testutil_test.go index d6d2f5c7efa9..d28d36c32c22 100644 --- a/x/auth/ante/testutil_test.go +++ b/x/auth/ante/testutil_test.go @@ -4,8 +4,8 @@ import ( "context" "testing" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" // TODO We don't need to import these API types if we use gogo's registry // ref: https://github.com/cosmos/cosmos-sdk/issues/14647 diff --git a/x/auth/keeper/deterministic_test.go b/x/auth/keeper/deterministic_test.go index eabf22bf8aa2..6bf1a034b0f7 100644 --- a/x/auth/keeper/deterministic_test.go +++ b/x/auth/keeper/deterministic_test.go @@ -7,8 +7,8 @@ import ( "sync/atomic" "testing" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" + "go.uber.org/mock/gomock" "pgregory.net/rapid" "cosmossdk.io/core/appmodule" diff --git a/x/auth/keeper/grpc_query_test.go b/x/auth/keeper/grpc_query_test.go index 6f5a8700779e..f2f820dc96cf 100644 --- a/x/auth/keeper/grpc_query_test.go +++ b/x/auth/keeper/grpc_query_test.go @@ -8,7 +8,7 @@ import ( "sort" "github.com/cosmos/gogoproto/proto" - "github.com/golang/mock/gomock" + "go.uber.org/mock/gomock" "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/x/auth/keeper/keeper_test.go b/x/auth/keeper/keeper_test.go index cf7b4e4d0135..0aa0a51c7dd2 100644 --- a/x/auth/keeper/keeper_test.go +++ b/x/auth/keeper/keeper_test.go @@ -5,9 +5,9 @@ import ( "encoding/binary" "testing" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + "go.uber.org/mock/gomock" "cosmossdk.io/core/header" coretesting "cosmossdk.io/core/testing" diff --git a/x/auth/keeper/msg_server_test.go b/x/auth/keeper/msg_server_test.go index 3e7a65cce451..cb7612cb6ee3 100644 --- a/x/auth/keeper/msg_server_test.go +++ b/x/auth/keeper/msg_server_test.go @@ -5,7 +5,7 @@ import ( "github.com/cosmos/gogoproto/proto" any "github.com/cosmos/gogoproto/types/any" - "github.com/golang/mock/gomock" + "go.uber.org/mock/gomock" "google.golang.org/protobuf/runtime/protoiface" codectypes "github.com/cosmos/cosmos-sdk/codec/types" diff --git a/x/auth/testutil/expected_keepers_mocks.go b/x/auth/testutil/expected_keepers_mocks.go index e32b234bed54..75c6f99fd8b7 100644 --- a/x/auth/testutil/expected_keepers_mocks.go +++ b/x/auth/testutil/expected_keepers_mocks.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: x/auth/types/expected_keepers.go +// +// Generated by this command: +// +// mockgen -source=x/auth/types/expected_keepers.go -package testutil -destination x/auth/testutil/expected_keepers_mocks.go +// // Package testutil is a generated GoMock package. package testutil @@ -10,13 +15,14 @@ import ( transaction "cosmossdk.io/core/transaction" types "github.com/cosmos/cosmos-sdk/types" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockBankKeeper is a mock of BankKeeper interface. type MockBankKeeper struct { ctrl *gomock.Controller recorder *MockBankKeeperMockRecorder + isgomock struct{} } // MockBankKeeperMockRecorder is the mock recorder for MockBankKeeper. @@ -39,7 +45,7 @@ func (m *MockBankKeeper) EXPECT() *MockBankKeeperMockRecorder { // IsSendEnabledCoins mocks base method. func (m *MockBankKeeper) IsSendEnabledCoins(ctx context.Context, coins ...types.Coin) error { m.ctrl.T.Helper() - varargs := []interface{}{ctx} + varargs := []any{ctx} for _, a := range coins { varargs = append(varargs, a) } @@ -49,9 +55,9 @@ func (m *MockBankKeeper) IsSendEnabledCoins(ctx context.Context, coins ...types. } // IsSendEnabledCoins indicates an expected call of IsSendEnabledCoins. -func (mr *MockBankKeeperMockRecorder) IsSendEnabledCoins(ctx interface{}, coins ...interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) IsSendEnabledCoins(ctx any, coins ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx}, coins...) + varargs := append([]any{ctx}, coins...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsSendEnabledCoins", reflect.TypeOf((*MockBankKeeper)(nil).IsSendEnabledCoins), varargs...) } @@ -64,7 +70,7 @@ func (m *MockBankKeeper) SendCoins(ctx context.Context, from, to types.AccAddres } // SendCoins indicates an expected call of SendCoins. -func (mr *MockBankKeeperMockRecorder) SendCoins(ctx, from, to, amt interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) SendCoins(ctx, from, to, amt any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoins", reflect.TypeOf((*MockBankKeeper)(nil).SendCoins), ctx, from, to, amt) } @@ -78,7 +84,7 @@ func (m *MockBankKeeper) SendCoinsFromAccountToModule(ctx context.Context, sende } // SendCoinsFromAccountToModule indicates an expected call of SendCoinsFromAccountToModule. -func (mr *MockBankKeeperMockRecorder) SendCoinsFromAccountToModule(ctx, senderAddr, recipientModule, amt interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) SendCoinsFromAccountToModule(ctx, senderAddr, recipientModule, amt any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromAccountToModule", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromAccountToModule), ctx, senderAddr, recipientModule, amt) } @@ -87,6 +93,7 @@ func (mr *MockBankKeeperMockRecorder) SendCoinsFromAccountToModule(ctx, senderAd type MockAccountsModKeeper struct { ctrl *gomock.Controller recorder *MockAccountsModKeeperMockRecorder + isgomock struct{} } // MockAccountsModKeeperMockRecorder is the mock recorder for MockAccountsModKeeper. @@ -115,7 +122,7 @@ func (m *MockAccountsModKeeper) InitAccountNumberSeqUnsafe(ctx context.Context, } // InitAccountNumberSeqUnsafe indicates an expected call of InitAccountNumberSeqUnsafe. -func (mr *MockAccountsModKeeperMockRecorder) InitAccountNumberSeqUnsafe(ctx, currentAccNum interface{}) *gomock.Call { +func (mr *MockAccountsModKeeperMockRecorder) InitAccountNumberSeqUnsafe(ctx, currentAccNum any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InitAccountNumberSeqUnsafe", reflect.TypeOf((*MockAccountsModKeeper)(nil).InitAccountNumberSeqUnsafe), ctx, currentAccNum) } @@ -129,7 +136,7 @@ func (m *MockAccountsModKeeper) IsAccountsModuleAccount(ctx context.Context, acc } // IsAccountsModuleAccount indicates an expected call of IsAccountsModuleAccount. -func (mr *MockAccountsModKeeperMockRecorder) IsAccountsModuleAccount(ctx, accountAddr interface{}) *gomock.Call { +func (mr *MockAccountsModKeeperMockRecorder) IsAccountsModuleAccount(ctx, accountAddr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsAccountsModuleAccount", reflect.TypeOf((*MockAccountsModKeeper)(nil).IsAccountsModuleAccount), ctx, accountAddr) } @@ -144,7 +151,7 @@ func (m *MockAccountsModKeeper) MigrateLegacyAccount(ctx context.Context, addr [ } // MigrateLegacyAccount indicates an expected call of MigrateLegacyAccount. -func (mr *MockAccountsModKeeperMockRecorder) MigrateLegacyAccount(ctx, addr, accNum, accType, msg interface{}) *gomock.Call { +func (mr *MockAccountsModKeeperMockRecorder) MigrateLegacyAccount(ctx, addr, accNum, accType, msg any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MigrateLegacyAccount", reflect.TypeOf((*MockAccountsModKeeper)(nil).MigrateLegacyAccount), ctx, addr, accNum, accType, msg) } @@ -159,7 +166,7 @@ func (m *MockAccountsModKeeper) NextAccountNumber(ctx context.Context) (uint64, } // NextAccountNumber indicates an expected call of NextAccountNumber. -func (mr *MockAccountsModKeeperMockRecorder) NextAccountNumber(ctx interface{}) *gomock.Call { +func (mr *MockAccountsModKeeperMockRecorder) NextAccountNumber(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NextAccountNumber", reflect.TypeOf((*MockAccountsModKeeper)(nil).NextAccountNumber), ctx) } @@ -174,7 +181,7 @@ func (m *MockAccountsModKeeper) Query(ctx context.Context, accountAddr []byte, q } // Query indicates an expected call of Query. -func (mr *MockAccountsModKeeperMockRecorder) Query(ctx, accountAddr, queryRequest interface{}) *gomock.Call { +func (mr *MockAccountsModKeeperMockRecorder) Query(ctx, accountAddr, queryRequest any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Query", reflect.TypeOf((*MockAccountsModKeeper)(nil).Query), ctx, accountAddr, queryRequest) } @@ -189,7 +196,7 @@ func (m *MockAccountsModKeeper) SendModuleMessage(ctx context.Context, sender [] } // SendModuleMessage indicates an expected call of SendModuleMessage. -func (mr *MockAccountsModKeeperMockRecorder) SendModuleMessage(ctx, sender, msg interface{}) *gomock.Call { +func (mr *MockAccountsModKeeperMockRecorder) SendModuleMessage(ctx, sender, msg any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendModuleMessage", reflect.TypeOf((*MockAccountsModKeeper)(nil).SendModuleMessage), ctx, sender, msg) } diff --git a/x/auth/tx/testutil/expected_keepers_mocks.go b/x/auth/tx/testutil/expected_keepers_mocks.go index 4a9256aebe49..e988dfd3342b 100644 --- a/x/auth/tx/testutil/expected_keepers_mocks.go +++ b/x/auth/tx/testutil/expected_keepers_mocks.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: x/auth/tx/config/expected_keepers.go +// +// Generated by this command: +// +// mockgen -source=x/auth/tx/config/expected_keepers.go -package testutil -destination x/auth/tx/testutil/expected_keepers_mocks.go +// // Package testutil is a generated GoMock package. package testutil @@ -9,13 +14,14 @@ import ( reflect "reflect" bankv1beta1 "cosmossdk.io/api/cosmos/bank/v1beta1" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockBankKeeper is a mock of BankKeeper interface. type MockBankKeeper struct { ctrl *gomock.Controller recorder *MockBankKeeperMockRecorder + isgomock struct{} } // MockBankKeeperMockRecorder is the mock recorder for MockBankKeeper. @@ -45,7 +51,7 @@ func (m *MockBankKeeper) DenomMetadataV2(c context.Context, req *bankv1beta1.Que } // DenomMetadataV2 indicates an expected call of DenomMetadataV2. -func (mr *MockBankKeeperMockRecorder) DenomMetadataV2(c, req interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) DenomMetadataV2(c, req any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DenomMetadataV2", reflect.TypeOf((*MockBankKeeper)(nil).DenomMetadataV2), c, req) } diff --git a/x/auth/vesting/testutil/expected_keepers_mocks.go b/x/auth/vesting/testutil/expected_keepers_mocks.go index 1df8f8ebbf2b..71ffdd5e3685 100644 --- a/x/auth/vesting/testutil/expected_keepers_mocks.go +++ b/x/auth/vesting/testutil/expected_keepers_mocks.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: x/auth/vesting/types/expected_keepers.go +// +// Generated by this command: +// +// mockgen -source=x/auth/vesting/types/expected_keepers.go -package testutil -destination x/auth/vesting/testutil/expected_keepers_mocks.go +// // Package testutil is a generated GoMock package. package testutil @@ -9,13 +14,14 @@ import ( reflect "reflect" types "github.com/cosmos/cosmos-sdk/types" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockBankKeeper is a mock of BankKeeper interface. type MockBankKeeper struct { ctrl *gomock.Controller recorder *MockBankKeeperMockRecorder + isgomock struct{} } // MockBankKeeperMockRecorder is the mock recorder for MockBankKeeper. @@ -44,7 +50,7 @@ func (m *MockBankKeeper) BlockedAddr(addr types.AccAddress) bool { } // BlockedAddr indicates an expected call of BlockedAddr. -func (mr *MockBankKeeperMockRecorder) BlockedAddr(addr interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) BlockedAddr(addr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BlockedAddr", reflect.TypeOf((*MockBankKeeper)(nil).BlockedAddr), addr) } @@ -52,7 +58,7 @@ func (mr *MockBankKeeperMockRecorder) BlockedAddr(addr interface{}) *gomock.Call // IsSendEnabledCoins mocks base method. func (m *MockBankKeeper) IsSendEnabledCoins(ctx context.Context, coins ...types.Coin) error { m.ctrl.T.Helper() - varargs := []interface{}{ctx} + varargs := []any{ctx} for _, a := range coins { varargs = append(varargs, a) } @@ -62,9 +68,9 @@ func (m *MockBankKeeper) IsSendEnabledCoins(ctx context.Context, coins ...types. } // IsSendEnabledCoins indicates an expected call of IsSendEnabledCoins. -func (mr *MockBankKeeperMockRecorder) IsSendEnabledCoins(ctx interface{}, coins ...interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) IsSendEnabledCoins(ctx any, coins ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx}, coins...) + varargs := append([]any{ctx}, coins...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsSendEnabledCoins", reflect.TypeOf((*MockBankKeeper)(nil).IsSendEnabledCoins), varargs...) } @@ -77,7 +83,7 @@ func (m *MockBankKeeper) SendCoins(ctx context.Context, fromAddr, toAddr types.A } // SendCoins indicates an expected call of SendCoins. -func (mr *MockBankKeeperMockRecorder) SendCoins(ctx, fromAddr, toAddr, amt interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) SendCoins(ctx, fromAddr, toAddr, amt any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoins", reflect.TypeOf((*MockBankKeeper)(nil).SendCoins), ctx, fromAddr, toAddr, amt) } diff --git a/x/auth/vesting/types/vesting_account_test.go b/x/auth/vesting/types/vesting_account_test.go index f4d3aa044456..fdd5d35efdf3 100644 --- a/x/auth/vesting/types/vesting_account_test.go +++ b/x/auth/vesting/types/vesting_account_test.go @@ -4,9 +4,9 @@ import ( "testing" "time" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + "go.uber.org/mock/gomock" "cosmossdk.io/core/header" coretesting "cosmossdk.io/core/testing" diff --git a/x/authz/go.mod b/x/authz/go.mod index f110c68a5794..b75000dc56ee 100644 --- a/x/authz/go.mod +++ b/x/authz/go.mod @@ -16,11 +16,11 @@ require ( github.com/cosmos/cosmos-proto v1.0.0-beta.5 github.com/cosmos/cosmos-sdk v0.53.0 github.com/cosmos/gogoproto v1.7.0 - github.com/golang/mock v1.6.0 github.com/golang/protobuf v1.5.4 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/spf13/cobra v1.8.1 github.com/stretchr/testify v1.9.0 + go.uber.org/mock v0.5.0 google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 google.golang.org/grpc v1.67.1 google.golang.org/protobuf v1.35.1 @@ -147,13 +147,13 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.28.0 // indirect golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect - golang.org/x/mod v0.17.0 // indirect + golang.org/x/mod v0.18.0 // indirect golang.org/x/net v0.29.0 // indirect golang.org/x/sync v0.8.0 // indirect golang.org/x/sys v0.26.0 // indirect golang.org/x/term v0.25.0 // indirect golang.org/x/text v0.19.0 // indirect - golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect + golang.org/x/tools v0.22.0 // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/x/authz/go.sum b/x/authz/go.sum index 5c05f884e0eb..505182c3fbb8 100644 --- a/x/authz/go.sum +++ b/x/authz/go.sum @@ -484,7 +484,6 @@ github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EU github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= @@ -522,9 +521,8 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0= +golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -555,7 +553,6 @@ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -617,9 +614,8 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= +golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/x/authz/keeper/keeper_test.go b/x/authz/keeper/keeper_test.go index f977ffef22fb..1958725cb2a6 100644 --- a/x/authz/keeper/keeper_test.go +++ b/x/authz/keeper/keeper_test.go @@ -6,8 +6,8 @@ import ( gogoproto "github.com/cosmos/gogoproto/proto" gogoprotoany "github.com/cosmos/gogoproto/types/any" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" + "go.uber.org/mock/gomock" "cosmossdk.io/core/address" "cosmossdk.io/core/header" diff --git a/x/authz/testutil/expected_keepers_mocks.go b/x/authz/testutil/expected_keepers_mocks.go index 0a2d645dd6d2..03675095d7b4 100644 --- a/x/authz/testutil/expected_keepers_mocks.go +++ b/x/authz/testutil/expected_keepers_mocks.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: x/authz/expected_keepers.go +// +// Generated by this command: +// +// mockgen -source=x/authz/expected_keepers.go -package testutil -destination x/authz/testutil/expected_keepers_mocks.go +// // Package testutil is a generated GoMock package. package testutil @@ -9,13 +14,14 @@ import ( reflect "reflect" types "github.com/cosmos/cosmos-sdk/types" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockBankKeeper is a mock of BankKeeper interface. type MockBankKeeper struct { ctrl *gomock.Controller recorder *MockBankKeeperMockRecorder + isgomock struct{} } // MockBankKeeperMockRecorder is the mock recorder for MockBankKeeper. @@ -38,7 +44,7 @@ func (m *MockBankKeeper) EXPECT() *MockBankKeeperMockRecorder { // IsSendEnabledCoins mocks base method. func (m *MockBankKeeper) IsSendEnabledCoins(ctx context.Context, coins ...types.Coin) error { m.ctrl.T.Helper() - varargs := []interface{}{ctx} + varargs := []any{ctx} for _, a := range coins { varargs = append(varargs, a) } @@ -48,9 +54,9 @@ func (m *MockBankKeeper) IsSendEnabledCoins(ctx context.Context, coins ...types. } // IsSendEnabledCoins indicates an expected call of IsSendEnabledCoins. -func (mr *MockBankKeeperMockRecorder) IsSendEnabledCoins(ctx interface{}, coins ...interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) IsSendEnabledCoins(ctx any, coins ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx}, coins...) + varargs := append([]any{ctx}, coins...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsSendEnabledCoins", reflect.TypeOf((*MockBankKeeper)(nil).IsSendEnabledCoins), varargs...) } @@ -63,7 +69,7 @@ func (m *MockBankKeeper) SpendableCoins(ctx context.Context, addr types.AccAddre } // SpendableCoins indicates an expected call of SpendableCoins. -func (mr *MockBankKeeperMockRecorder) SpendableCoins(ctx, addr interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) SpendableCoins(ctx, addr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SpendableCoins", reflect.TypeOf((*MockBankKeeper)(nil).SpendableCoins), ctx, addr) } diff --git a/x/bank/go.mod b/x/bank/go.mod index d0e6c97912b2..57885f75d54b 100644 --- a/x/bank/go.mod +++ b/x/bank/go.mod @@ -16,12 +16,12 @@ require ( github.com/cosmos/cosmos-proto v1.0.0-beta.5 github.com/cosmos/cosmos-sdk v0.53.0 github.com/cosmos/gogoproto v1.7.0 - github.com/golang/mock v1.6.0 github.com/golang/protobuf v1.5.4 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/hashicorp/go-metrics v0.5.3 // indirect github.com/spf13/cobra v1.8.1 github.com/stretchr/testify v1.9.0 + go.uber.org/mock v0.5.0 google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 google.golang.org/grpc v1.67.1 gotest.tools/v3 v3.5.1 @@ -145,13 +145,13 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.28.0 // indirect golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect - golang.org/x/mod v0.17.0 // indirect + golang.org/x/mod v0.18.0 // indirect golang.org/x/net v0.29.0 // indirect golang.org/x/sync v0.8.0 // indirect golang.org/x/sys v0.26.0 // indirect golang.org/x/term v0.25.0 // indirect golang.org/x/text v0.19.0 // indirect - golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect + golang.org/x/tools v0.22.0 // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f // indirect google.golang.org/protobuf v1.35.1 // indirect diff --git a/x/bank/go.sum b/x/bank/go.sum index 5c05f884e0eb..505182c3fbb8 100644 --- a/x/bank/go.sum +++ b/x/bank/go.sum @@ -484,7 +484,6 @@ github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EU github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= @@ -522,9 +521,8 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0= +golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -555,7 +553,6 @@ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -617,9 +614,8 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= +golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/x/bank/keeper/collections_test.go b/x/bank/keeper/collections_test.go index f18fe08f434a..21f49fd2ed4f 100644 --- a/x/bank/keeper/collections_test.go +++ b/x/bank/keeper/collections_test.go @@ -4,8 +4,8 @@ import ( "testing" "time" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" "cosmossdk.io/collections" "cosmossdk.io/core/header" diff --git a/x/bank/keeper/keeper_test.go b/x/bank/keeper/keeper_test.go index 1e984109008b..e9f5bd0f645d 100644 --- a/x/bank/keeper/keeper_test.go +++ b/x/bank/keeper/keeper_test.go @@ -10,8 +10,8 @@ import ( "testing" "time" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" + "go.uber.org/mock/gomock" "cosmossdk.io/core/address" coreevent "cosmossdk.io/core/event" diff --git a/x/bank/testutil/expected_keepers_mocks.go b/x/bank/testutil/expected_keepers_mocks.go index 4b420c3b5c4b..e85c98a367ff 100644 --- a/x/bank/testutil/expected_keepers_mocks.go +++ b/x/bank/testutil/expected_keepers_mocks.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: x/bank/types/expected_keepers.go +// +// Generated by this command: +// +// mockgen -source=x/bank/types/expected_keepers.go -package testutil -destination x/bank/testutil/expected_keepers_mocks.go +// // Package testutil is a generated GoMock package. package testutil @@ -11,13 +16,14 @@ import ( address "cosmossdk.io/core/address" types "github.com/cosmos/cosmos-sdk/types" types0 "github.com/cosmos/cosmos-sdk/x/auth/types" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockAccountKeeper is a mock of AccountKeeper interface. type MockAccountKeeper struct { ctrl *gomock.Controller recorder *MockAccountKeeperMockRecorder + isgomock struct{} } // MockAccountKeeperMockRecorder is the mock recorder for MockAccountKeeper. @@ -60,7 +66,7 @@ func (m *MockAccountKeeper) GetAccount(ctx context.Context, addr types.AccAddres } // GetAccount indicates an expected call of GetAccount. -func (mr *MockAccountKeeperMockRecorder) GetAccount(ctx, addr interface{}) *gomock.Call { +func (mr *MockAccountKeeperMockRecorder) GetAccount(ctx, addr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccount", reflect.TypeOf((*MockAccountKeeper)(nil).GetAccount), ctx, addr) } @@ -74,7 +80,7 @@ func (m *MockAccountKeeper) GetModuleAccount(ctx context.Context, moduleName str } // GetModuleAccount indicates an expected call of GetModuleAccount. -func (mr *MockAccountKeeperMockRecorder) GetModuleAccount(ctx, moduleName interface{}) *gomock.Call { +func (mr *MockAccountKeeperMockRecorder) GetModuleAccount(ctx, moduleName any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetModuleAccount", reflect.TypeOf((*MockAccountKeeper)(nil).GetModuleAccount), ctx, moduleName) } @@ -88,7 +94,7 @@ func (m *MockAccountKeeper) GetModuleAddress(moduleName string) types.AccAddress } // GetModuleAddress indicates an expected call of GetModuleAddress. -func (mr *MockAccountKeeperMockRecorder) GetModuleAddress(moduleName interface{}) *gomock.Call { +func (mr *MockAccountKeeperMockRecorder) GetModuleAddress(moduleName any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetModuleAddress", reflect.TypeOf((*MockAccountKeeper)(nil).GetModuleAddress), moduleName) } @@ -116,7 +122,7 @@ func (m *MockAccountKeeper) HasAccount(ctx context.Context, addr types.AccAddres } // HasAccount indicates an expected call of HasAccount. -func (mr *MockAccountKeeperMockRecorder) HasAccount(ctx, addr interface{}) *gomock.Call { +func (mr *MockAccountKeeperMockRecorder) HasAccount(ctx, addr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HasAccount", reflect.TypeOf((*MockAccountKeeper)(nil).HasAccount), ctx, addr) } @@ -128,7 +134,7 @@ func (m *MockAccountKeeper) SetAccount(ctx context.Context, acc types.AccountI) } // SetAccount indicates an expected call of SetAccount. -func (mr *MockAccountKeeperMockRecorder) SetAccount(ctx, acc interface{}) *gomock.Call { +func (mr *MockAccountKeeperMockRecorder) SetAccount(ctx, acc any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetAccount", reflect.TypeOf((*MockAccountKeeper)(nil).SetAccount), ctx, acc) } diff --git a/x/bank/v2/testutil/expected_keepers_mocks.go b/x/bank/v2/testutil/expected_keepers_mocks.go index aeddace241f3..8536538cbc08 100644 --- a/x/bank/v2/testutil/expected_keepers_mocks.go +++ b/x/bank/v2/testutil/expected_keepers_mocks.go @@ -11,7 +11,7 @@ import ( address "cosmossdk.io/core/address" types "github.com/cosmos/cosmos-sdk/types" types0 "github.com/cosmos/cosmos-sdk/x/auth/types" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockAccountKeeper is a mock of AccountKeeper interface. diff --git a/x/circuit/go.mod b/x/circuit/go.mod index 2ba978365c0c..8b62a92892a3 100644 --- a/x/circuit/go.mod +++ b/x/circuit/go.mod @@ -75,7 +75,6 @@ require ( github.com/gogo/googleapis v1.4.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/golang/mock v1.6.0 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/btree v1.1.3 // indirect github.com/google/flatbuffers v2.0.8+incompatible // indirect @@ -147,16 +146,17 @@ require ( gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // indirect go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5 // indirect go.opencensus.io v0.24.0 // indirect + go.uber.org/mock v0.5.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.28.0 // indirect golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect - golang.org/x/mod v0.17.0 // indirect + golang.org/x/mod v0.18.0 // indirect golang.org/x/net v0.29.0 // indirect golang.org/x/sync v0.8.0 // indirect golang.org/x/sys v0.26.0 // indirect golang.org/x/term v0.25.0 // indirect golang.org/x/text v0.19.0 // indirect - golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect + golang.org/x/tools v0.22.0 // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f // indirect google.golang.org/protobuf v1.35.1 // indirect diff --git a/x/circuit/go.sum b/x/circuit/go.sum index 3041219c2907..0a10fbf93445 100644 --- a/x/circuit/go.sum +++ b/x/circuit/go.sum @@ -486,7 +486,6 @@ github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EU github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= @@ -524,9 +523,8 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0= +golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -557,7 +555,6 @@ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -619,9 +616,8 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= +golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/x/consensus/go.mod b/x/consensus/go.mod index 40ca70da36a7..d7d18f611e58 100644 --- a/x/consensus/go.mod +++ b/x/consensus/go.mod @@ -149,13 +149,13 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.28.0 // indirect golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect - golang.org/x/mod v0.17.0 // indirect + golang.org/x/mod v0.18.0 // indirect golang.org/x/net v0.29.0 // indirect golang.org/x/sync v0.8.0 // indirect golang.org/x/sys v0.26.0 // indirect golang.org/x/term v0.25.0 // indirect golang.org/x/text v0.19.0 // indirect - golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect + golang.org/x/tools v0.22.0 // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f // indirect google.golang.org/protobuf v1.35.1 // indirect diff --git a/x/consensus/go.sum b/x/consensus/go.sum index 7d8629bd498b..0a10fbf93445 100644 --- a/x/consensus/go.sum +++ b/x/consensus/go.sum @@ -523,8 +523,8 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0= +golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -616,8 +616,8 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= +golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/x/distribution/go.mod b/x/distribution/go.mod index b2e2e9213568..ed454d5c31b3 100644 --- a/x/distribution/go.mod +++ b/x/distribution/go.mod @@ -15,12 +15,12 @@ require ( github.com/cosmos/cosmos-proto v1.0.0-beta.5 github.com/cosmos/cosmos-sdk v0.53.0 github.com/cosmos/gogoproto v1.7.0 - github.com/golang/mock v1.6.0 github.com/golang/protobuf v1.5.4 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/pkg/errors v0.9.1 github.com/spf13/cobra v1.8.1 github.com/stretchr/testify v1.9.0 + go.uber.org/mock v0.5.0 google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 google.golang.org/grpc v1.67.1 ) @@ -150,13 +150,13 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.28.0 // indirect golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect - golang.org/x/mod v0.17.0 // indirect + golang.org/x/mod v0.18.0 // indirect golang.org/x/net v0.29.0 // indirect golang.org/x/sync v0.8.0 // indirect golang.org/x/sys v0.26.0 // indirect golang.org/x/term v0.25.0 // indirect golang.org/x/text v0.19.0 // indirect - golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect + golang.org/x/tools v0.22.0 // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f // indirect google.golang.org/protobuf v1.35.1 // indirect diff --git a/x/distribution/go.sum b/x/distribution/go.sum index 5c05f884e0eb..505182c3fbb8 100644 --- a/x/distribution/go.sum +++ b/x/distribution/go.sum @@ -484,7 +484,6 @@ github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EU github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= @@ -522,9 +521,8 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0= +golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -555,7 +553,6 @@ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -617,9 +614,8 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= +golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/x/distribution/keeper/allocation_test.go b/x/distribution/keeper/allocation_test.go index c0b5d1304009..0eaf5ea9d645 100644 --- a/x/distribution/keeper/allocation_test.go +++ b/x/distribution/keeper/allocation_test.go @@ -5,8 +5,8 @@ import ( "testing" "time" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" "cosmossdk.io/collections" "cosmossdk.io/core/comet" diff --git a/x/distribution/keeper/delegation_test.go b/x/distribution/keeper/delegation_test.go index f7f5cff97a3e..a4ee10d9948d 100644 --- a/x/distribution/keeper/delegation_test.go +++ b/x/distribution/keeper/delegation_test.go @@ -3,8 +3,8 @@ package keeper_test import ( "testing" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" "cosmossdk.io/collections" "cosmossdk.io/core/header" diff --git a/x/distribution/keeper/grpc_query_test.go b/x/distribution/keeper/grpc_query_test.go index 24271354930f..97f29a95ebf9 100644 --- a/x/distribution/keeper/grpc_query_test.go +++ b/x/distribution/keeper/grpc_query_test.go @@ -3,8 +3,8 @@ package keeper_test import ( "testing" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" "cosmossdk.io/math" "cosmossdk.io/x/distribution/keeper" diff --git a/x/distribution/keeper/keeper_test.go b/x/distribution/keeper/keeper_test.go index 0d57217a407f..42db289938fd 100644 --- a/x/distribution/keeper/keeper_test.go +++ b/x/distribution/keeper/keeper_test.go @@ -4,8 +4,8 @@ import ( "testing" "time" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" "cosmossdk.io/core/header" coretesting "cosmossdk.io/core/testing" diff --git a/x/distribution/keeper/msg_server_test.go b/x/distribution/keeper/msg_server_test.go index a7acde70e34b..b3d098bb7f48 100644 --- a/x/distribution/keeper/msg_server_test.go +++ b/x/distribution/keeper/msg_server_test.go @@ -3,8 +3,8 @@ package keeper_test import ( "testing" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" "cosmossdk.io/math" "cosmossdk.io/x/distribution/keeper" diff --git a/x/distribution/testutil/expected_keepers_mocks.go b/x/distribution/testutil/expected_keepers_mocks.go index d702ed78a61a..1cfc8df6d463 100644 --- a/x/distribution/testutil/expected_keepers_mocks.go +++ b/x/distribution/testutil/expected_keepers_mocks.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: x/distribution/types/expected_keepers.go +// +// Generated by this command: +// +// mockgen -source=x/distribution/types/expected_keepers.go -package testutil -destination x/distribution/testutil/expected_keepers_mocks.go +// // Package testutil is a generated GoMock package. package testutil @@ -11,13 +16,14 @@ import ( address "cosmossdk.io/core/address" types "cosmossdk.io/x/staking/types" types0 "github.com/cosmos/cosmos-sdk/types" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockAccountKeeper is a mock of AccountKeeper interface. type MockAccountKeeper struct { ctrl *gomock.Controller recorder *MockAccountKeeperMockRecorder + isgomock struct{} } // MockAccountKeeperMockRecorder is the mock recorder for MockAccountKeeper. @@ -60,7 +66,7 @@ func (m *MockAccountKeeper) GetModuleAccount(ctx context.Context, name string) t } // GetModuleAccount indicates an expected call of GetModuleAccount. -func (mr *MockAccountKeeperMockRecorder) GetModuleAccount(ctx, name interface{}) *gomock.Call { +func (mr *MockAccountKeeperMockRecorder) GetModuleAccount(ctx, name any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetModuleAccount", reflect.TypeOf((*MockAccountKeeper)(nil).GetModuleAccount), ctx, name) } @@ -74,7 +80,7 @@ func (m *MockAccountKeeper) GetModuleAddress(name string) types0.AccAddress { } // GetModuleAddress indicates an expected call of GetModuleAddress. -func (mr *MockAccountKeeperMockRecorder) GetModuleAddress(name interface{}) *gomock.Call { +func (mr *MockAccountKeeperMockRecorder) GetModuleAddress(name any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetModuleAddress", reflect.TypeOf((*MockAccountKeeper)(nil).GetModuleAddress), name) } @@ -83,6 +89,7 @@ func (mr *MockAccountKeeperMockRecorder) GetModuleAddress(name interface{}) *gom type MockBankKeeper struct { ctrl *gomock.Controller recorder *MockBankKeeperMockRecorder + isgomock struct{} } // MockBankKeeperMockRecorder is the mock recorder for MockBankKeeper. @@ -111,7 +118,7 @@ func (m *MockBankKeeper) BlockedAddr(addr types0.AccAddress) bool { } // BlockedAddr indicates an expected call of BlockedAddr. -func (mr *MockBankKeeperMockRecorder) BlockedAddr(addr interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) BlockedAddr(addr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BlockedAddr", reflect.TypeOf((*MockBankKeeper)(nil).BlockedAddr), addr) } @@ -125,7 +132,7 @@ func (m *MockBankKeeper) GetAllBalances(ctx context.Context, addr types0.AccAddr } // GetAllBalances indicates an expected call of GetAllBalances. -func (mr *MockBankKeeperMockRecorder) GetAllBalances(ctx, addr interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) GetAllBalances(ctx, addr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllBalances", reflect.TypeOf((*MockBankKeeper)(nil).GetAllBalances), ctx, addr) } @@ -139,7 +146,7 @@ func (m *MockBankKeeper) IsSendEnabledDenom(ctx context.Context, denom string) b } // IsSendEnabledDenom indicates an expected call of IsSendEnabledDenom. -func (mr *MockBankKeeperMockRecorder) IsSendEnabledDenom(ctx, denom interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) IsSendEnabledDenom(ctx, denom any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsSendEnabledDenom", reflect.TypeOf((*MockBankKeeper)(nil).IsSendEnabledDenom), ctx, denom) } @@ -153,7 +160,7 @@ func (m *MockBankKeeper) MintCoins(ctx context.Context, moduleName string, amt t } // MintCoins indicates an expected call of MintCoins. -func (mr *MockBankKeeperMockRecorder) MintCoins(ctx, moduleName, amt interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) MintCoins(ctx, moduleName, amt any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MintCoins", reflect.TypeOf((*MockBankKeeper)(nil).MintCoins), ctx, moduleName, amt) } @@ -167,7 +174,7 @@ func (m *MockBankKeeper) SendCoinsFromAccountToModule(ctx context.Context, sende } // SendCoinsFromAccountToModule indicates an expected call of SendCoinsFromAccountToModule. -func (mr *MockBankKeeperMockRecorder) SendCoinsFromAccountToModule(ctx, senderAddr, recipientModule, amt interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) SendCoinsFromAccountToModule(ctx, senderAddr, recipientModule, amt any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromAccountToModule", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromAccountToModule), ctx, senderAddr, recipientModule, amt) } @@ -181,7 +188,7 @@ func (m *MockBankKeeper) SendCoinsFromModuleToAccount(ctx context.Context, sende } // SendCoinsFromModuleToAccount indicates an expected call of SendCoinsFromModuleToAccount. -func (mr *MockBankKeeperMockRecorder) SendCoinsFromModuleToAccount(ctx, senderModule, recipientAddr, amt interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) SendCoinsFromModuleToAccount(ctx, senderModule, recipientAddr, amt any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromModuleToAccount", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromModuleToAccount), ctx, senderModule, recipientAddr, amt) } @@ -195,7 +202,7 @@ func (m *MockBankKeeper) SendCoinsFromModuleToModule(ctx context.Context, sender } // SendCoinsFromModuleToModule indicates an expected call of SendCoinsFromModuleToModule. -func (mr *MockBankKeeperMockRecorder) SendCoinsFromModuleToModule(ctx, senderModule, recipientModule, amt interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) SendCoinsFromModuleToModule(ctx, senderModule, recipientModule, amt any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromModuleToModule", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromModuleToModule), ctx, senderModule, recipientModule, amt) } @@ -209,7 +216,7 @@ func (m *MockBankKeeper) SpendableCoins(ctx context.Context, addr types0.AccAddr } // SpendableCoins indicates an expected call of SpendableCoins. -func (mr *MockBankKeeperMockRecorder) SpendableCoins(ctx, addr interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) SpendableCoins(ctx, addr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SpendableCoins", reflect.TypeOf((*MockBankKeeper)(nil).SpendableCoins), ctx, addr) } @@ -218,6 +225,7 @@ func (mr *MockBankKeeperMockRecorder) SpendableCoins(ctx, addr interface{}) *gom type MockStakingKeeper struct { ctrl *gomock.Controller recorder *MockStakingKeeperMockRecorder + isgomock struct{} } // MockStakingKeeperMockRecorder is the mock recorder for MockStakingKeeper. @@ -247,7 +255,7 @@ func (m *MockStakingKeeper) BondDenom(ctx context.Context) (string, error) { } // BondDenom indicates an expected call of BondDenom. -func (mr *MockStakingKeeperMockRecorder) BondDenom(ctx interface{}) *gomock.Call { +func (mr *MockStakingKeeperMockRecorder) BondDenom(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BondDenom", reflect.TypeOf((*MockStakingKeeper)(nil).BondDenom), ctx) } @@ -276,7 +284,7 @@ func (m *MockStakingKeeper) Delegation(arg0 context.Context, arg1 types0.AccAddr } // Delegation indicates an expected call of Delegation. -func (mr *MockStakingKeeperMockRecorder) Delegation(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockStakingKeeperMockRecorder) Delegation(arg0, arg1, arg2 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delegation", reflect.TypeOf((*MockStakingKeeper)(nil).Delegation), arg0, arg1, arg2) } @@ -291,7 +299,7 @@ func (m *MockStakingKeeper) GetAllDelegatorDelegations(ctx context.Context, dele } // GetAllDelegatorDelegations indicates an expected call of GetAllDelegatorDelegations. -func (mr *MockStakingKeeperMockRecorder) GetAllDelegatorDelegations(ctx, delegator interface{}) *gomock.Call { +func (mr *MockStakingKeeperMockRecorder) GetAllDelegatorDelegations(ctx, delegator any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllDelegatorDelegations", reflect.TypeOf((*MockStakingKeeper)(nil).GetAllDelegatorDelegations), ctx, delegator) } @@ -306,7 +314,7 @@ func (m *MockStakingKeeper) GetAllSDKDelegations(ctx context.Context) ([]types.D } // GetAllSDKDelegations indicates an expected call of GetAllSDKDelegations. -func (mr *MockStakingKeeperMockRecorder) GetAllSDKDelegations(ctx interface{}) *gomock.Call { +func (mr *MockStakingKeeperMockRecorder) GetAllSDKDelegations(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllSDKDelegations", reflect.TypeOf((*MockStakingKeeper)(nil).GetAllSDKDelegations), ctx) } @@ -321,7 +329,7 @@ func (m *MockStakingKeeper) GetAllValidators(ctx context.Context) ([]types.Valid } // GetAllValidators indicates an expected call of GetAllValidators. -func (mr *MockStakingKeeperMockRecorder) GetAllValidators(ctx interface{}) *gomock.Call { +func (mr *MockStakingKeeperMockRecorder) GetAllValidators(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllValidators", reflect.TypeOf((*MockStakingKeeper)(nil).GetAllValidators), ctx) } @@ -335,7 +343,7 @@ func (m *MockStakingKeeper) IterateDelegations(ctx context.Context, delegator ty } // IterateDelegations indicates an expected call of IterateDelegations. -func (mr *MockStakingKeeperMockRecorder) IterateDelegations(ctx, delegator, fn interface{}) *gomock.Call { +func (mr *MockStakingKeeperMockRecorder) IterateDelegations(ctx, delegator, fn any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IterateDelegations", reflect.TypeOf((*MockStakingKeeper)(nil).IterateDelegations), ctx, delegator, fn) } @@ -349,7 +357,7 @@ func (m *MockStakingKeeper) IterateValidators(arg0 context.Context, arg1 func(in } // IterateValidators indicates an expected call of IterateValidators. -func (mr *MockStakingKeeperMockRecorder) IterateValidators(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockStakingKeeperMockRecorder) IterateValidators(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IterateValidators", reflect.TypeOf((*MockStakingKeeper)(nil).IterateValidators), arg0, arg1) } @@ -364,7 +372,7 @@ func (m *MockStakingKeeper) Validator(arg0 context.Context, arg1 types0.ValAddre } // Validator indicates an expected call of Validator. -func (mr *MockStakingKeeperMockRecorder) Validator(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockStakingKeeperMockRecorder) Validator(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Validator", reflect.TypeOf((*MockStakingKeeper)(nil).Validator), arg0, arg1) } @@ -393,7 +401,7 @@ func (m *MockStakingKeeper) ValidatorByConsAddr(arg0 context.Context, arg1 types } // ValidatorByConsAddr indicates an expected call of ValidatorByConsAddr. -func (mr *MockStakingKeeperMockRecorder) ValidatorByConsAddr(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockStakingKeeperMockRecorder) ValidatorByConsAddr(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidatorByConsAddr", reflect.TypeOf((*MockStakingKeeper)(nil).ValidatorByConsAddr), arg0, arg1) } @@ -402,6 +410,7 @@ func (mr *MockStakingKeeperMockRecorder) ValidatorByConsAddr(arg0, arg1 interfac type MockStakingHooks struct { ctrl *gomock.Controller recorder *MockStakingHooksMockRecorder + isgomock struct{} } // MockStakingHooksMockRecorder is the mock recorder for MockStakingHooks. @@ -430,7 +439,7 @@ func (m *MockStakingHooks) AfterDelegationModified(ctx context.Context, delAddr } // AfterDelegationModified indicates an expected call of AfterDelegationModified. -func (mr *MockStakingHooksMockRecorder) AfterDelegationModified(ctx, delAddr, valAddr interface{}) *gomock.Call { +func (mr *MockStakingHooksMockRecorder) AfterDelegationModified(ctx, delAddr, valAddr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AfterDelegationModified", reflect.TypeOf((*MockStakingHooks)(nil).AfterDelegationModified), ctx, delAddr, valAddr) } @@ -444,7 +453,7 @@ func (m *MockStakingHooks) AfterValidatorCreated(ctx context.Context, valAddr ty } // AfterValidatorCreated indicates an expected call of AfterValidatorCreated. -func (mr *MockStakingHooksMockRecorder) AfterValidatorCreated(ctx, valAddr interface{}) *gomock.Call { +func (mr *MockStakingHooksMockRecorder) AfterValidatorCreated(ctx, valAddr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AfterValidatorCreated", reflect.TypeOf((*MockStakingHooks)(nil).AfterValidatorCreated), ctx, valAddr) } diff --git a/x/epochs/go.mod b/x/epochs/go.mod index cfa18e12f8e1..7fc714002adb 100644 --- a/x/epochs/go.mod +++ b/x/epochs/go.mod @@ -148,13 +148,13 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.28.0 // indirect golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect - golang.org/x/mod v0.17.0 // indirect + golang.org/x/mod v0.18.0 // indirect golang.org/x/net v0.29.0 // indirect golang.org/x/sync v0.8.0 // indirect golang.org/x/sys v0.26.0 // indirect golang.org/x/term v0.25.0 // indirect golang.org/x/text v0.19.0 // indirect - golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect + golang.org/x/tools v0.22.0 // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f // indirect google.golang.org/protobuf v1.35.1 diff --git a/x/epochs/go.sum b/x/epochs/go.sum index 7d8629bd498b..0a10fbf93445 100644 --- a/x/epochs/go.sum +++ b/x/epochs/go.sum @@ -523,8 +523,8 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0= +golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -616,8 +616,8 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= +golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/x/evidence/go.mod b/x/evidence/go.mod index d18950503bd5..25e2d8221dea 100644 --- a/x/evidence/go.mod +++ b/x/evidence/go.mod @@ -14,11 +14,11 @@ require ( github.com/cosmos/cosmos-proto v1.0.0-beta.5 github.com/cosmos/cosmos-sdk v0.53.0 github.com/cosmos/gogoproto v1.7.0 - github.com/golang/mock v1.6.0 github.com/golang/protobuf v1.5.4 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/spf13/cobra v1.8.1 github.com/stretchr/testify v1.9.0 + go.uber.org/mock v0.5.0 google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 google.golang.org/grpc v1.67.1 google.golang.org/protobuf v1.35.1 @@ -151,13 +151,13 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.28.0 // indirect golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect - golang.org/x/mod v0.17.0 // indirect + golang.org/x/mod v0.18.0 // indirect golang.org/x/net v0.29.0 // indirect golang.org/x/sync v0.8.0 // indirect golang.org/x/sys v0.26.0 // indirect golang.org/x/term v0.25.0 // indirect golang.org/x/text v0.19.0 // indirect - golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect + golang.org/x/tools v0.22.0 // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/x/evidence/go.sum b/x/evidence/go.sum index 3041219c2907..0a10fbf93445 100644 --- a/x/evidence/go.sum +++ b/x/evidence/go.sum @@ -486,7 +486,6 @@ github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EU github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= @@ -524,9 +523,8 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0= +golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -557,7 +555,6 @@ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -619,9 +616,8 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= +golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/x/evidence/keeper/keeper_test.go b/x/evidence/keeper/keeper_test.go index 0113c9deaa28..32c91e0f9e47 100644 --- a/x/evidence/keeper/keeper_test.go +++ b/x/evidence/keeper/keeper_test.go @@ -6,8 +6,8 @@ import ( "fmt" "time" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" + "go.uber.org/mock/gomock" "cosmossdk.io/collections" coreaddress "cosmossdk.io/core/address" diff --git a/x/evidence/testutil/expected_keepers_mocks.go b/x/evidence/testutil/expected_keepers_mocks.go index b9efeb2f1385..c13e4b407292 100644 --- a/x/evidence/testutil/expected_keepers_mocks.go +++ b/x/evidence/testutil/expected_keepers_mocks.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: x/evidence/types/expected_keepers.go +// +// Generated by this command: +// +// mockgen -source=x/evidence/types/expected_keepers.go -package testutil -destination x/evidence/testutil/expected_keepers_mocks.go +// // Package testutil is a generated GoMock package. package testutil @@ -13,13 +18,14 @@ import ( math "cosmossdk.io/math" types "github.com/cosmos/cosmos-sdk/crypto/types" types0 "github.com/cosmos/cosmos-sdk/types" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockStakingKeeper is a mock of StakingKeeper interface. type MockStakingKeeper struct { ctrl *gomock.Controller recorder *MockStakingKeeperMockRecorder + isgomock struct{} } // MockStakingKeeperMockRecorder is the mock recorder for MockStakingKeeper. @@ -49,7 +55,7 @@ func (m *MockStakingKeeper) ValidatorByConsAddr(arg0 context.Context, arg1 types } // ValidatorByConsAddr indicates an expected call of ValidatorByConsAddr. -func (mr *MockStakingKeeperMockRecorder) ValidatorByConsAddr(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockStakingKeeperMockRecorder) ValidatorByConsAddr(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidatorByConsAddr", reflect.TypeOf((*MockStakingKeeper)(nil).ValidatorByConsAddr), arg0, arg1) } @@ -58,6 +64,7 @@ func (mr *MockStakingKeeperMockRecorder) ValidatorByConsAddr(arg0, arg1 interfac type MockSlashingKeeper struct { ctrl *gomock.Controller recorder *MockSlashingKeeperMockRecorder + isgomock struct{} } // MockSlashingKeeperMockRecorder is the mock recorder for MockSlashingKeeper. @@ -87,7 +94,7 @@ func (m *MockSlashingKeeper) GetPubkey(arg0 context.Context, arg1 types.Address) } // GetPubkey indicates an expected call of GetPubkey. -func (mr *MockSlashingKeeperMockRecorder) GetPubkey(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockSlashingKeeperMockRecorder) GetPubkey(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPubkey", reflect.TypeOf((*MockSlashingKeeper)(nil).GetPubkey), arg0, arg1) } @@ -101,7 +108,7 @@ func (m *MockSlashingKeeper) HasValidatorSigningInfo(arg0 context.Context, arg1 } // HasValidatorSigningInfo indicates an expected call of HasValidatorSigningInfo. -func (mr *MockSlashingKeeperMockRecorder) HasValidatorSigningInfo(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockSlashingKeeperMockRecorder) HasValidatorSigningInfo(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HasValidatorSigningInfo", reflect.TypeOf((*MockSlashingKeeper)(nil).HasValidatorSigningInfo), arg0, arg1) } @@ -115,7 +122,7 @@ func (m *MockSlashingKeeper) IsTombstoned(arg0 context.Context, arg1 types0.Cons } // IsTombstoned indicates an expected call of IsTombstoned. -func (mr *MockSlashingKeeperMockRecorder) IsTombstoned(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockSlashingKeeperMockRecorder) IsTombstoned(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsTombstoned", reflect.TypeOf((*MockSlashingKeeper)(nil).IsTombstoned), arg0, arg1) } @@ -129,7 +136,7 @@ func (m *MockSlashingKeeper) Jail(arg0 context.Context, arg1 types0.ConsAddress) } // Jail indicates an expected call of Jail. -func (mr *MockSlashingKeeperMockRecorder) Jail(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockSlashingKeeperMockRecorder) Jail(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Jail", reflect.TypeOf((*MockSlashingKeeper)(nil).Jail), arg0, arg1) } @@ -143,7 +150,7 @@ func (m *MockSlashingKeeper) JailUntil(arg0 context.Context, arg1 types0.ConsAdd } // JailUntil indicates an expected call of JailUntil. -func (mr *MockSlashingKeeperMockRecorder) JailUntil(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockSlashingKeeperMockRecorder) JailUntil(arg0, arg1, arg2 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "JailUntil", reflect.TypeOf((*MockSlashingKeeper)(nil).JailUntil), arg0, arg1, arg2) } @@ -157,7 +164,7 @@ func (m *MockSlashingKeeper) Slash(arg0 context.Context, arg1 types0.ConsAddress } // Slash indicates an expected call of Slash. -func (mr *MockSlashingKeeperMockRecorder) Slash(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { +func (mr *MockSlashingKeeperMockRecorder) Slash(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Slash", reflect.TypeOf((*MockSlashingKeeper)(nil).Slash), arg0, arg1, arg2, arg3, arg4) } @@ -172,7 +179,7 @@ func (m *MockSlashingKeeper) SlashFractionDoubleSign(arg0 context.Context) (math } // SlashFractionDoubleSign indicates an expected call of SlashFractionDoubleSign. -func (mr *MockSlashingKeeperMockRecorder) SlashFractionDoubleSign(arg0 interface{}) *gomock.Call { +func (mr *MockSlashingKeeperMockRecorder) SlashFractionDoubleSign(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SlashFractionDoubleSign", reflect.TypeOf((*MockSlashingKeeper)(nil).SlashFractionDoubleSign), arg0) } @@ -186,7 +193,7 @@ func (m *MockSlashingKeeper) SlashWithInfractionReason(arg0 context.Context, arg } // SlashWithInfractionReason indicates an expected call of SlashWithInfractionReason. -func (mr *MockSlashingKeeperMockRecorder) SlashWithInfractionReason(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call { +func (mr *MockSlashingKeeperMockRecorder) SlashWithInfractionReason(arg0, arg1, arg2, arg3, arg4, arg5 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SlashWithInfractionReason", reflect.TypeOf((*MockSlashingKeeper)(nil).SlashWithInfractionReason), arg0, arg1, arg2, arg3, arg4, arg5) } @@ -200,7 +207,7 @@ func (m *MockSlashingKeeper) Tombstone(arg0 context.Context, arg1 types0.ConsAdd } // Tombstone indicates an expected call of Tombstone. -func (mr *MockSlashingKeeperMockRecorder) Tombstone(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockSlashingKeeperMockRecorder) Tombstone(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Tombstone", reflect.TypeOf((*MockSlashingKeeper)(nil).Tombstone), arg0, arg1) } @@ -209,6 +216,7 @@ func (mr *MockSlashingKeeperMockRecorder) Tombstone(arg0, arg1 interface{}) *gom type MockAccountKeeper struct { ctrl *gomock.Controller recorder *MockAccountKeeperMockRecorder + isgomock struct{} } // MockAccountKeeperMockRecorder is the mock recorder for MockAccountKeeper. @@ -235,7 +243,7 @@ func (m *MockAccountKeeper) SetAccount(ctx context.Context, acc types0.AccountI) } // SetAccount indicates an expected call of SetAccount. -func (mr *MockAccountKeeperMockRecorder) SetAccount(ctx, acc interface{}) *gomock.Call { +func (mr *MockAccountKeeperMockRecorder) SetAccount(ctx, acc any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetAccount", reflect.TypeOf((*MockAccountKeeper)(nil).SetAccount), ctx, acc) } @@ -244,6 +252,7 @@ func (mr *MockAccountKeeperMockRecorder) SetAccount(ctx, acc interface{}) *gomoc type MockConsensusKeeper struct { ctrl *gomock.Controller recorder *MockConsensusKeeperMockRecorder + isgomock struct{} } // MockConsensusKeeperMockRecorder is the mock recorder for MockConsensusKeeper. @@ -275,7 +284,7 @@ func (m *MockConsensusKeeper) EvidenceParams(arg0 context.Context) (int64, time. } // EvidenceParams indicates an expected call of EvidenceParams. -func (mr *MockConsensusKeeperMockRecorder) EvidenceParams(arg0 interface{}) *gomock.Call { +func (mr *MockConsensusKeeperMockRecorder) EvidenceParams(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EvidenceParams", reflect.TypeOf((*MockConsensusKeeper)(nil).EvidenceParams), arg0) } diff --git a/x/feegrant/go.mod b/x/feegrant/go.mod index 14350cae8f6b..3871cf57139b 100644 --- a/x/feegrant/go.mod +++ b/x/feegrant/go.mod @@ -17,11 +17,11 @@ require ( github.com/cosmos/cosmos-proto v1.0.0-beta.5 github.com/cosmos/cosmos-sdk v0.53.0 github.com/cosmos/gogoproto v1.7.0 - github.com/golang/mock v1.6.0 github.com/golang/protobuf v1.5.4 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/spf13/cobra v1.8.1 github.com/stretchr/testify v1.9.0 + go.uber.org/mock v0.5.0 google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 google.golang.org/grpc v1.67.1 google.golang.org/protobuf v1.35.1 @@ -159,13 +159,13 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.28.0 // indirect golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect - golang.org/x/mod v0.17.0 // indirect + golang.org/x/mod v0.18.0 // indirect golang.org/x/net v0.29.0 // indirect golang.org/x/sync v0.8.0 // indirect golang.org/x/sys v0.26.0 // indirect golang.org/x/term v0.25.0 // indirect golang.org/x/text v0.19.0 // indirect - golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect + golang.org/x/tools v0.22.0 // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/x/feegrant/go.sum b/x/feegrant/go.sum index f62264df4628..a2dce77f0c14 100644 --- a/x/feegrant/go.sum +++ b/x/feegrant/go.sum @@ -494,7 +494,6 @@ github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EU github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= @@ -532,9 +531,8 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0= +golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -565,7 +563,6 @@ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -629,9 +626,8 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= +golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/x/feegrant/testutil/expected_keepers_mocks.go b/x/feegrant/testutil/expected_keepers_mocks.go index d1149afa8503..7b8a9e81cbca 100644 --- a/x/feegrant/testutil/expected_keepers_mocks.go +++ b/x/feegrant/testutil/expected_keepers_mocks.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: x/feegrant/expected_keepers.go +// +// Generated by this command: +// +// mockgen -source=x/feegrant/expected_keepers.go -package testutil -destination x/feegrant/testutil/expected_keepers_mocks.go +// // Package testutil is a generated GoMock package. package testutil @@ -9,13 +14,14 @@ import ( reflect "reflect" types "github.com/cosmos/cosmos-sdk/types" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockBankKeeper is a mock of BankKeeper interface. type MockBankKeeper struct { ctrl *gomock.Controller recorder *MockBankKeeperMockRecorder + isgomock struct{} } // MockBankKeeperMockRecorder is the mock recorder for MockBankKeeper. @@ -44,7 +50,7 @@ func (m *MockBankKeeper) SendCoinsFromAccountToModule(ctx context.Context, sende } // SendCoinsFromAccountToModule indicates an expected call of SendCoinsFromAccountToModule. -func (mr *MockBankKeeperMockRecorder) SendCoinsFromAccountToModule(ctx, senderAddr, recipientModule, amt interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) SendCoinsFromAccountToModule(ctx, senderAddr, recipientModule, amt any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromAccountToModule", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromAccountToModule), ctx, senderAddr, recipientModule, amt) } @@ -58,7 +64,7 @@ func (m *MockBankKeeper) SpendableCoins(ctx context.Context, addr types.AccAddre } // SpendableCoins indicates an expected call of SpendableCoins. -func (mr *MockBankKeeperMockRecorder) SpendableCoins(ctx, addr interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) SpendableCoins(ctx, addr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SpendableCoins", reflect.TypeOf((*MockBankKeeper)(nil).SpendableCoins), ctx, addr) } diff --git a/x/genutil/gentx_test.go b/x/genutil/gentx_test.go index d93199ce2e6c..3a79c9bcceb1 100644 --- a/x/genutil/gentx_test.go +++ b/x/genutil/gentx_test.go @@ -8,8 +8,8 @@ import ( "testing" "time" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" + "go.uber.org/mock/gomock" _ "cosmossdk.io/api/cosmos/crypto/secp256k1" "cosmossdk.io/math" diff --git a/x/genutil/testutil/expected_keepers_mocks.go b/x/genutil/testutil/expected_keepers_mocks.go index db89dd19e3ee..d1c8ab2105b2 100644 --- a/x/genutil/testutil/expected_keepers_mocks.go +++ b/x/genutil/testutil/expected_keepers_mocks.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: x/genutil/types/expected_keepers.go +// +// Generated by this command: +// +// mockgen -source=x/genutil/types/expected_keepers.go -package testutil -destination x/genutil/testutil/expected_keepers_mocks.go +// // Package testutil is a generated GoMock package. package testutil @@ -13,13 +18,14 @@ import ( codec "github.com/cosmos/cosmos-sdk/codec" types "github.com/cosmos/cosmos-sdk/types" module "github.com/cosmos/cosmos-sdk/types/module" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockStakingKeeper is a mock of StakingKeeper interface. type MockStakingKeeper struct { ctrl *gomock.Controller recorder *MockStakingKeeperMockRecorder + isgomock struct{} } // MockStakingKeeperMockRecorder is the mock recorder for MockStakingKeeper. @@ -49,7 +55,7 @@ func (m *MockStakingKeeper) ApplyAndReturnValidatorSetUpdates(arg0 context.Conte } // ApplyAndReturnValidatorSetUpdates indicates an expected call of ApplyAndReturnValidatorSetUpdates. -func (mr *MockStakingKeeperMockRecorder) ApplyAndReturnValidatorSetUpdates(arg0 interface{}) *gomock.Call { +func (mr *MockStakingKeeperMockRecorder) ApplyAndReturnValidatorSetUpdates(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ApplyAndReturnValidatorSetUpdates", reflect.TypeOf((*MockStakingKeeper)(nil).ApplyAndReturnValidatorSetUpdates), arg0) } @@ -58,6 +64,7 @@ func (mr *MockStakingKeeperMockRecorder) ApplyAndReturnValidatorSetUpdates(arg0 type MockAccountKeeper struct { ctrl *gomock.Controller recorder *MockAccountKeeperMockRecorder + isgomock struct{} } // MockAccountKeeperMockRecorder is the mock recorder for MockAccountKeeper. @@ -86,7 +93,7 @@ func (m *MockAccountKeeper) NewAccount(arg0 context.Context, arg1 types.AccountI } // NewAccount indicates an expected call of NewAccount. -func (mr *MockAccountKeeperMockRecorder) NewAccount(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAccountKeeperMockRecorder) NewAccount(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewAccount", reflect.TypeOf((*MockAccountKeeper)(nil).NewAccount), arg0, arg1) } @@ -98,7 +105,7 @@ func (m *MockAccountKeeper) SetAccount(arg0 context.Context, arg1 types.AccountI } // SetAccount indicates an expected call of SetAccount. -func (mr *MockAccountKeeperMockRecorder) SetAccount(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAccountKeeperMockRecorder) SetAccount(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetAccount", reflect.TypeOf((*MockAccountKeeper)(nil).SetAccount), arg0, arg1) } @@ -107,6 +114,7 @@ func (mr *MockAccountKeeperMockRecorder) SetAccount(arg0, arg1 interface{}) *gom type MockGenesisAccountsIterator struct { ctrl *gomock.Controller recorder *MockGenesisAccountsIteratorMockRecorder + isgomock struct{} } // MockGenesisAccountsIteratorMockRecorder is the mock recorder for MockGenesisAccountsIterator. @@ -133,7 +141,7 @@ func (m *MockGenesisAccountsIterator) IterateGenesisAccounts(cdc *codec.LegacyAm } // IterateGenesisAccounts indicates an expected call of IterateGenesisAccounts. -func (mr *MockGenesisAccountsIteratorMockRecorder) IterateGenesisAccounts(cdc, appGenesis, cb interface{}) *gomock.Call { +func (mr *MockGenesisAccountsIteratorMockRecorder) IterateGenesisAccounts(cdc, appGenesis, cb any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IterateGenesisAccounts", reflect.TypeOf((*MockGenesisAccountsIterator)(nil).IterateGenesisAccounts), cdc, appGenesis, cb) } @@ -142,6 +150,7 @@ func (mr *MockGenesisAccountsIteratorMockRecorder) IterateGenesisAccounts(cdc, a type MockGenesisBalancesIterator struct { ctrl *gomock.Controller recorder *MockGenesisBalancesIteratorMockRecorder + isgomock struct{} } // MockGenesisBalancesIteratorMockRecorder is the mock recorder for MockGenesisBalancesIterator. @@ -168,7 +177,7 @@ func (m *MockGenesisBalancesIterator) IterateGenesisBalances(cdc codec.JSONCodec } // IterateGenesisBalances indicates an expected call of IterateGenesisBalances. -func (mr *MockGenesisBalancesIteratorMockRecorder) IterateGenesisBalances(cdc, appGenesis, cb interface{}) *gomock.Call { +func (mr *MockGenesisBalancesIteratorMockRecorder) IterateGenesisBalances(cdc, appGenesis, cb any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IterateGenesisBalances", reflect.TypeOf((*MockGenesisBalancesIterator)(nil).IterateGenesisBalances), cdc, appGenesis, cb) } diff --git a/x/gov/go.mod b/x/gov/go.mod index 03f041b7968a..05115ce30964 100644 --- a/x/gov/go.mod +++ b/x/gov/go.mod @@ -20,13 +20,13 @@ require ( github.com/cosmos/cosmos-proto v1.0.0-beta.5 github.com/cosmos/cosmos-sdk v0.53.0 github.com/cosmos/gogoproto v1.7.0 - github.com/golang/mock v1.6.0 github.com/golang/protobuf v1.5.4 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/manifoldco/promptui v0.9.0 github.com/spf13/cobra v1.8.1 github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.9.0 + go.uber.org/mock v0.5.0 google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 google.golang.org/grpc v1.67.1 google.golang.org/protobuf v1.35.1 @@ -154,13 +154,13 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.28.0 // indirect golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect - golang.org/x/mod v0.17.0 // indirect + golang.org/x/mod v0.18.0 // indirect golang.org/x/net v0.29.0 // indirect golang.org/x/sync v0.8.0 golang.org/x/sys v0.26.0 // indirect golang.org/x/term v0.25.0 // indirect golang.org/x/text v0.19.0 // indirect - golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect + golang.org/x/tools v0.22.0 // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/x/gov/go.sum b/x/gov/go.sum index e05931b31009..6d8f9ea58704 100644 --- a/x/gov/go.sum +++ b/x/gov/go.sum @@ -492,7 +492,6 @@ github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EU github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= @@ -530,9 +529,8 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0= +golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -563,7 +561,6 @@ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -627,9 +624,8 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= +golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/x/gov/keeper/common_test.go b/x/gov/keeper/common_test.go index 3b8da3aa8605..cdb3d9d9443a 100644 --- a/x/gov/keeper/common_test.go +++ b/x/gov/keeper/common_test.go @@ -6,8 +6,8 @@ import ( "testing" "time" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" "cosmossdk.io/core/header" coretesting "cosmossdk.io/core/testing" diff --git a/x/gov/keeper/tally_test.go b/x/gov/keeper/tally_test.go index fa1109b03115..5e9f0a8a5086 100644 --- a/x/gov/keeper/tally_test.go +++ b/x/gov/keeper/tally_test.go @@ -4,9 +4,9 @@ import ( "context" "testing" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" "cosmossdk.io/collections" sdkmath "cosmossdk.io/math" diff --git a/x/gov/testutil/expected_keepers_mocks.go b/x/gov/testutil/expected_keepers_mocks.go index 4636f53df68e..83c3a95153f5 100644 --- a/x/gov/testutil/expected_keepers_mocks.go +++ b/x/gov/testutil/expected_keepers_mocks.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: x/gov/testutil/expected_keepers.go +// +// Generated by this command: +// +// mockgen -source=x/gov/testutil/expected_keepers.go -package testutil -destination x/gov/testutil/expected_keepers_mocks.go +// // Package testutil is a generated GoMock package. package testutil @@ -11,13 +16,14 @@ import ( address "cosmossdk.io/core/address" math "cosmossdk.io/math" types "github.com/cosmos/cosmos-sdk/types" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockAccountKeeper is a mock of AccountKeeper interface. type MockAccountKeeper struct { ctrl *gomock.Controller recorder *MockAccountKeeperMockRecorder + isgomock struct{} } // MockAccountKeeperMockRecorder is the mock recorder for MockAccountKeeper. @@ -60,7 +66,7 @@ func (m *MockAccountKeeper) GetAccount(ctx context.Context, addr types.AccAddres } // GetAccount indicates an expected call of GetAccount. -func (mr *MockAccountKeeperMockRecorder) GetAccount(ctx, addr interface{}) *gomock.Call { +func (mr *MockAccountKeeperMockRecorder) GetAccount(ctx, addr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccount", reflect.TypeOf((*MockAccountKeeper)(nil).GetAccount), ctx, addr) } @@ -74,7 +80,7 @@ func (m *MockAccountKeeper) GetModuleAccount(ctx context.Context, name string) t } // GetModuleAccount indicates an expected call of GetModuleAccount. -func (mr *MockAccountKeeperMockRecorder) GetModuleAccount(ctx, name interface{}) *gomock.Call { +func (mr *MockAccountKeeperMockRecorder) GetModuleAccount(ctx, name any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetModuleAccount", reflect.TypeOf((*MockAccountKeeper)(nil).GetModuleAccount), ctx, name) } @@ -88,7 +94,7 @@ func (m *MockAccountKeeper) GetModuleAddress(name string) types.AccAddress { } // GetModuleAddress indicates an expected call of GetModuleAddress. -func (mr *MockAccountKeeperMockRecorder) GetModuleAddress(name interface{}) *gomock.Call { +func (mr *MockAccountKeeperMockRecorder) GetModuleAddress(name any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetModuleAddress", reflect.TypeOf((*MockAccountKeeper)(nil).GetModuleAddress), name) } @@ -100,7 +106,7 @@ func (m *MockAccountKeeper) IterateAccounts(ctx context.Context, cb func(types.A } // IterateAccounts indicates an expected call of IterateAccounts. -func (mr *MockAccountKeeperMockRecorder) IterateAccounts(ctx, cb interface{}) *gomock.Call { +func (mr *MockAccountKeeperMockRecorder) IterateAccounts(ctx, cb any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IterateAccounts", reflect.TypeOf((*MockAccountKeeper)(nil).IterateAccounts), ctx, cb) } @@ -112,7 +118,7 @@ func (m *MockAccountKeeper) SetModuleAccount(arg0 context.Context, arg1 types.Mo } // SetModuleAccount indicates an expected call of SetModuleAccount. -func (mr *MockAccountKeeperMockRecorder) SetModuleAccount(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAccountKeeperMockRecorder) SetModuleAccount(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetModuleAccount", reflect.TypeOf((*MockAccountKeeper)(nil).SetModuleAccount), arg0, arg1) } @@ -121,6 +127,7 @@ func (mr *MockAccountKeeperMockRecorder) SetModuleAccount(arg0, arg1 interface{} type MockBankKeeper struct { ctrl *gomock.Controller recorder *MockBankKeeperMockRecorder + isgomock struct{} } // MockBankKeeperMockRecorder is the mock recorder for MockBankKeeper. @@ -149,7 +156,7 @@ func (m *MockBankKeeper) BurnCoins(ctx context.Context, address []byte, amt type } // BurnCoins indicates an expected call of BurnCoins. -func (mr *MockBankKeeperMockRecorder) BurnCoins(ctx, address, amt interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) BurnCoins(ctx, address, amt any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BurnCoins", reflect.TypeOf((*MockBankKeeper)(nil).BurnCoins), ctx, address, amt) } @@ -163,7 +170,7 @@ func (m *MockBankKeeper) GetAllBalances(ctx context.Context, addr types.AccAddre } // GetAllBalances indicates an expected call of GetAllBalances. -func (mr *MockBankKeeperMockRecorder) GetAllBalances(ctx, addr interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) GetAllBalances(ctx, addr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllBalances", reflect.TypeOf((*MockBankKeeper)(nil).GetAllBalances), ctx, addr) } @@ -177,7 +184,7 @@ func (m *MockBankKeeper) GetBalance(ctx context.Context, addr types.AccAddress, } // GetBalance indicates an expected call of GetBalance. -func (mr *MockBankKeeperMockRecorder) GetBalance(ctx, addr, denom interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) GetBalance(ctx, addr, denom any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBalance", reflect.TypeOf((*MockBankKeeper)(nil).GetBalance), ctx, addr, denom) } @@ -191,7 +198,7 @@ func (m *MockBankKeeper) LockedCoins(ctx context.Context, addr types.AccAddress) } // LockedCoins indicates an expected call of LockedCoins. -func (mr *MockBankKeeperMockRecorder) LockedCoins(ctx, addr interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) LockedCoins(ctx, addr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LockedCoins", reflect.TypeOf((*MockBankKeeper)(nil).LockedCoins), ctx, addr) } @@ -205,7 +212,7 @@ func (m *MockBankKeeper) MintCoins(ctx context.Context, moduleName string, amt t } // MintCoins indicates an expected call of MintCoins. -func (mr *MockBankKeeperMockRecorder) MintCoins(ctx, moduleName, amt interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) MintCoins(ctx, moduleName, amt any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MintCoins", reflect.TypeOf((*MockBankKeeper)(nil).MintCoins), ctx, moduleName, amt) } @@ -219,7 +226,7 @@ func (m *MockBankKeeper) SendCoinsFromAccountToModule(ctx context.Context, sende } // SendCoinsFromAccountToModule indicates an expected call of SendCoinsFromAccountToModule. -func (mr *MockBankKeeperMockRecorder) SendCoinsFromAccountToModule(ctx, senderAddr, recipientModule, amt interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) SendCoinsFromAccountToModule(ctx, senderAddr, recipientModule, amt any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromAccountToModule", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromAccountToModule), ctx, senderAddr, recipientModule, amt) } @@ -233,7 +240,7 @@ func (m *MockBankKeeper) SendCoinsFromModuleToAccount(ctx context.Context, sende } // SendCoinsFromModuleToAccount indicates an expected call of SendCoinsFromModuleToAccount. -func (mr *MockBankKeeperMockRecorder) SendCoinsFromModuleToAccount(ctx, senderModule, recipientAddr, amt interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) SendCoinsFromModuleToAccount(ctx, senderModule, recipientAddr, amt any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromModuleToAccount", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromModuleToAccount), ctx, senderModule, recipientAddr, amt) } @@ -247,7 +254,7 @@ func (m *MockBankKeeper) SendCoinsFromModuleToModule(ctx context.Context, sender } // SendCoinsFromModuleToModule indicates an expected call of SendCoinsFromModuleToModule. -func (mr *MockBankKeeperMockRecorder) SendCoinsFromModuleToModule(ctx, senderModule, recipientModule, amt interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) SendCoinsFromModuleToModule(ctx, senderModule, recipientModule, amt any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromModuleToModule", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromModuleToModule), ctx, senderModule, recipientModule, amt) } @@ -261,7 +268,7 @@ func (m *MockBankKeeper) SpendableCoins(ctx context.Context, addr types.AccAddre } // SpendableCoins indicates an expected call of SpendableCoins. -func (mr *MockBankKeeperMockRecorder) SpendableCoins(ctx, addr interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) SpendableCoins(ctx, addr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SpendableCoins", reflect.TypeOf((*MockBankKeeper)(nil).SpendableCoins), ctx, addr) } @@ -270,6 +277,7 @@ func (mr *MockBankKeeperMockRecorder) SpendableCoins(ctx, addr interface{}) *gom type MockPoolKeeper struct { ctrl *gomock.Controller recorder *MockPoolKeeperMockRecorder + isgomock struct{} } // MockPoolKeeperMockRecorder is the mock recorder for MockPoolKeeper. @@ -298,7 +306,7 @@ func (m *MockPoolKeeper) FundCommunityPool(ctx context.Context, amount types.Coi } // FundCommunityPool indicates an expected call of FundCommunityPool. -func (mr *MockPoolKeeperMockRecorder) FundCommunityPool(ctx, amount, sender interface{}) *gomock.Call { +func (mr *MockPoolKeeperMockRecorder) FundCommunityPool(ctx, amount, sender any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FundCommunityPool", reflect.TypeOf((*MockPoolKeeper)(nil).FundCommunityPool), ctx, amount, sender) } @@ -307,6 +315,7 @@ func (mr *MockPoolKeeperMockRecorder) FundCommunityPool(ctx, amount, sender inte type MockStakingKeeper struct { ctrl *gomock.Controller recorder *MockStakingKeeperMockRecorder + isgomock struct{} } // MockStakingKeeperMockRecorder is the mock recorder for MockStakingKeeper. @@ -336,7 +345,7 @@ func (m *MockStakingKeeper) BondDenom(ctx context.Context) (string, error) { } // BondDenom indicates an expected call of BondDenom. -func (mr *MockStakingKeeperMockRecorder) BondDenom(ctx interface{}) *gomock.Call { +func (mr *MockStakingKeeperMockRecorder) BondDenom(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BondDenom", reflect.TypeOf((*MockStakingKeeper)(nil).BondDenom), ctx) } @@ -350,7 +359,7 @@ func (m *MockStakingKeeper) IterateBondedValidatorsByPower(arg0 context.Context, } // IterateBondedValidatorsByPower indicates an expected call of IterateBondedValidatorsByPower. -func (mr *MockStakingKeeperMockRecorder) IterateBondedValidatorsByPower(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockStakingKeeperMockRecorder) IterateBondedValidatorsByPower(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IterateBondedValidatorsByPower", reflect.TypeOf((*MockStakingKeeper)(nil).IterateBondedValidatorsByPower), arg0, arg1) } @@ -364,7 +373,7 @@ func (m *MockStakingKeeper) IterateDelegations(ctx context.Context, delegator ty } // IterateDelegations indicates an expected call of IterateDelegations. -func (mr *MockStakingKeeperMockRecorder) IterateDelegations(ctx, delegator, fn interface{}) *gomock.Call { +func (mr *MockStakingKeeperMockRecorder) IterateDelegations(ctx, delegator, fn any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IterateDelegations", reflect.TypeOf((*MockStakingKeeper)(nil).IterateDelegations), ctx, delegator, fn) } @@ -378,7 +387,7 @@ func (m *MockStakingKeeper) TokensFromConsensusPower(ctx context.Context, power } // TokensFromConsensusPower indicates an expected call of TokensFromConsensusPower. -func (mr *MockStakingKeeperMockRecorder) TokensFromConsensusPower(ctx, power interface{}) *gomock.Call { +func (mr *MockStakingKeeperMockRecorder) TokensFromConsensusPower(ctx, power any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TokensFromConsensusPower", reflect.TypeOf((*MockStakingKeeper)(nil).TokensFromConsensusPower), ctx, power) } @@ -393,7 +402,7 @@ func (m *MockStakingKeeper) TotalBondedTokens(arg0 context.Context) (math.Int, e } // TotalBondedTokens indicates an expected call of TotalBondedTokens. -func (mr *MockStakingKeeperMockRecorder) TotalBondedTokens(arg0 interface{}) *gomock.Call { +func (mr *MockStakingKeeperMockRecorder) TotalBondedTokens(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TotalBondedTokens", reflect.TypeOf((*MockStakingKeeper)(nil).TotalBondedTokens), arg0) } diff --git a/x/group/go.mod b/x/group/go.mod index 654c56b7d399..8883eefcc238 100644 --- a/x/group/go.mod +++ b/x/group/go.mod @@ -22,12 +22,12 @@ require ( github.com/cosmos/cosmos-proto v1.0.0-beta.5 github.com/cosmos/cosmos-sdk v0.53.0 github.com/cosmos/gogoproto v1.7.0 - github.com/golang/mock v1.6.0 github.com/golang/protobuf v1.5.4 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/manifoldco/promptui v0.9.0 github.com/spf13/cobra v1.8.1 github.com/stretchr/testify v1.9.0 + go.uber.org/mock v0.5.0 google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 google.golang.org/grpc v1.67.1 google.golang.org/protobuf v1.35.1 @@ -161,13 +161,13 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.28.0 // indirect golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect - golang.org/x/mod v0.17.0 // indirect + golang.org/x/mod v0.18.0 // indirect golang.org/x/net v0.29.0 // indirect golang.org/x/sync v0.8.0 // indirect golang.org/x/sys v0.26.0 // indirect golang.org/x/term v0.25.0 // indirect golang.org/x/text v0.19.0 // indirect - golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect + golang.org/x/tools v0.22.0 // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/x/group/go.sum b/x/group/go.sum index ef56fac13633..dc0cec8f43ba 100644 --- a/x/group/go.sum +++ b/x/group/go.sum @@ -494,7 +494,6 @@ github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EU github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= @@ -532,9 +531,8 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0= +golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -565,7 +563,6 @@ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -629,9 +626,8 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= +golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/x/group/keeper/genesis_test.go b/x/group/keeper/genesis_test.go index a960529e84c6..4a39fad4998f 100644 --- a/x/group/keeper/genesis_test.go +++ b/x/group/keeper/genesis_test.go @@ -6,8 +6,8 @@ import ( "testing" "time" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" + "go.uber.org/mock/gomock" coreaddress "cosmossdk.io/core/address" "cosmossdk.io/log" diff --git a/x/group/keeper/grpc_query_test.go b/x/group/keeper/grpc_query_test.go index 8f90ebd6e917..d97320ad9f2e 100644 --- a/x/group/keeper/grpc_query_test.go +++ b/x/group/keeper/grpc_query_test.go @@ -5,8 +5,8 @@ import ( "testing" "time" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" diff --git a/x/group/keeper/keeper_test.go b/x/group/keeper/keeper_test.go index 449fe039407f..2ef382f6df71 100644 --- a/x/group/keeper/keeper_test.go +++ b/x/group/keeper/keeper_test.go @@ -6,8 +6,8 @@ import ( "testing" "time" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" + "go.uber.org/mock/gomock" "cosmossdk.io/core/header" "cosmossdk.io/log" diff --git a/x/group/keeper/msg_server_test.go b/x/group/keeper/msg_server_test.go index d03f8721d563..646fd702d484 100644 --- a/x/group/keeper/msg_server_test.go +++ b/x/group/keeper/msg_server_test.go @@ -8,7 +8,7 @@ import ( "strings" "time" - "github.com/golang/mock/gomock" + "go.uber.org/mock/gomock" "cosmossdk.io/core/header" banktypes "cosmossdk.io/x/bank/types" diff --git a/x/group/migrations/v2/migrate_test.go b/x/group/migrations/v2/migrate_test.go index 34af6c3f256d..39a9fa291233 100644 --- a/x/group/migrations/v2/migrate_test.go +++ b/x/group/migrations/v2/migrate_test.go @@ -3,8 +3,8 @@ package v2_test import ( "testing" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" "cosmossdk.io/core/address" corestore "cosmossdk.io/core/store" diff --git a/x/group/testutil/expected_keepers_mocks.go b/x/group/testutil/expected_keepers_mocks.go index b957703406e7..701d53f264b5 100644 --- a/x/group/testutil/expected_keepers_mocks.go +++ b/x/group/testutil/expected_keepers_mocks.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: x/group/testutil/expected_keepers.go +// +// Generated by this command: +// +// mockgen -source=x/group/testutil/expected_keepers.go -package testutil -destination x/group/testutil/expected_keepers_mocks.go +// // Package testutil is a generated GoMock package. package testutil @@ -11,13 +16,14 @@ import ( address "cosmossdk.io/core/address" types "cosmossdk.io/x/bank/types" types0 "github.com/cosmos/cosmos-sdk/types" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockAccountKeeper is a mock of AccountKeeper interface. type MockAccountKeeper struct { ctrl *gomock.Controller recorder *MockAccountKeeperMockRecorder + isgomock struct{} } // MockAccountKeeperMockRecorder is the mock recorder for MockAccountKeeper. @@ -60,7 +66,7 @@ func (m *MockAccountKeeper) GetAccount(arg0 context.Context, arg1 types0.AccAddr } // GetAccount indicates an expected call of GetAccount. -func (mr *MockAccountKeeperMockRecorder) GetAccount(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAccountKeeperMockRecorder) GetAccount(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccount", reflect.TypeOf((*MockAccountKeeper)(nil).GetAccount), arg0, arg1) } @@ -74,7 +80,7 @@ func (m *MockAccountKeeper) NewAccount(arg0 context.Context, arg1 types0.Account } // NewAccount indicates an expected call of NewAccount. -func (mr *MockAccountKeeperMockRecorder) NewAccount(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAccountKeeperMockRecorder) NewAccount(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewAccount", reflect.TypeOf((*MockAccountKeeper)(nil).NewAccount), arg0, arg1) } @@ -86,7 +92,7 @@ func (m *MockAccountKeeper) RemoveAccount(ctx context.Context, acc types0.Accoun } // RemoveAccount indicates an expected call of RemoveAccount. -func (mr *MockAccountKeeperMockRecorder) RemoveAccount(ctx, acc interface{}) *gomock.Call { +func (mr *MockAccountKeeperMockRecorder) RemoveAccount(ctx, acc any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveAccount", reflect.TypeOf((*MockAccountKeeper)(nil).RemoveAccount), ctx, acc) } @@ -98,7 +104,7 @@ func (m *MockAccountKeeper) SetAccount(arg0 context.Context, arg1 types0.Account } // SetAccount indicates an expected call of SetAccount. -func (mr *MockAccountKeeperMockRecorder) SetAccount(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAccountKeeperMockRecorder) SetAccount(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetAccount", reflect.TypeOf((*MockAccountKeeper)(nil).SetAccount), arg0, arg1) } @@ -107,6 +113,7 @@ func (mr *MockAccountKeeperMockRecorder) SetAccount(arg0, arg1 interface{}) *gom type MockBankKeeper struct { ctrl *gomock.Controller recorder *MockBankKeeperMockRecorder + isgomock struct{} } // MockBankKeeperMockRecorder is the mock recorder for MockBankKeeper. @@ -136,7 +143,7 @@ func (m *MockBankKeeper) Burn(arg0 context.Context, arg1 *types.MsgBurn) (*types } // Burn indicates an expected call of Burn. -func (mr *MockBankKeeperMockRecorder) Burn(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) Burn(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Burn", reflect.TypeOf((*MockBankKeeper)(nil).Burn), arg0, arg1) } @@ -150,7 +157,7 @@ func (m *MockBankKeeper) GetAllBalances(ctx context.Context, addr types0.AccAddr } // GetAllBalances indicates an expected call of GetAllBalances. -func (mr *MockBankKeeperMockRecorder) GetAllBalances(ctx, addr interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) GetAllBalances(ctx, addr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllBalances", reflect.TypeOf((*MockBankKeeper)(nil).GetAllBalances), ctx, addr) } @@ -164,7 +171,7 @@ func (m *MockBankKeeper) MintCoins(ctx context.Context, moduleName string, amt t } // MintCoins indicates an expected call of MintCoins. -func (mr *MockBankKeeperMockRecorder) MintCoins(ctx, moduleName, amt interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) MintCoins(ctx, moduleName, amt any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MintCoins", reflect.TypeOf((*MockBankKeeper)(nil).MintCoins), ctx, moduleName, amt) } @@ -179,7 +186,7 @@ func (m *MockBankKeeper) MultiSend(arg0 context.Context, arg1 *types.MsgMultiSen } // MultiSend indicates an expected call of MultiSend. -func (mr *MockBankKeeperMockRecorder) MultiSend(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) MultiSend(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MultiSend", reflect.TypeOf((*MockBankKeeper)(nil).MultiSend), arg0, arg1) } @@ -194,7 +201,7 @@ func (m *MockBankKeeper) Send(arg0 context.Context, arg1 *types.MsgSend) (*types } // Send indicates an expected call of Send. -func (mr *MockBankKeeperMockRecorder) Send(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) Send(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Send", reflect.TypeOf((*MockBankKeeper)(nil).Send), arg0, arg1) } @@ -208,7 +215,7 @@ func (m *MockBankKeeper) SendCoinsFromModuleToAccount(ctx context.Context, sende } // SendCoinsFromModuleToAccount indicates an expected call of SendCoinsFromModuleToAccount. -func (mr *MockBankKeeperMockRecorder) SendCoinsFromModuleToAccount(ctx, senderModule, recipientAddr, amt interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) SendCoinsFromModuleToAccount(ctx, senderModule, recipientAddr, amt any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromModuleToAccount", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromModuleToAccount), ctx, senderModule, recipientAddr, amt) } @@ -223,7 +230,7 @@ func (m *MockBankKeeper) SetSendEnabled(arg0 context.Context, arg1 *types.MsgSet } // SetSendEnabled indicates an expected call of SetSendEnabled. -func (mr *MockBankKeeperMockRecorder) SetSendEnabled(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) SetSendEnabled(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetSendEnabled", reflect.TypeOf((*MockBankKeeper)(nil).SetSendEnabled), arg0, arg1) } @@ -237,7 +244,7 @@ func (m *MockBankKeeper) SpendableCoins(ctx context.Context, addr types0.AccAddr } // SpendableCoins indicates an expected call of SpendableCoins. -func (mr *MockBankKeeperMockRecorder) SpendableCoins(ctx, addr interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) SpendableCoins(ctx, addr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SpendableCoins", reflect.TypeOf((*MockBankKeeper)(nil).SpendableCoins), ctx, addr) } @@ -252,7 +259,7 @@ func (m *MockBankKeeper) UpdateParams(arg0 context.Context, arg1 *types.MsgUpdat } // UpdateParams indicates an expected call of UpdateParams. -func (mr *MockBankKeeperMockRecorder) UpdateParams(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) UpdateParams(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateParams", reflect.TypeOf((*MockBankKeeper)(nil).UpdateParams), arg0, arg1) } diff --git a/x/mint/go.mod b/x/mint/go.mod index bd80104b5fc8..72eb389ca4b0 100644 --- a/x/mint/go.mod +++ b/x/mint/go.mod @@ -17,10 +17,10 @@ require ( github.com/cosmos/cosmos-proto v1.0.0-beta.5 github.com/cosmos/cosmos-sdk v0.53.0 github.com/cosmos/gogoproto v1.7.0 - github.com/golang/mock v1.6.0 github.com/golang/protobuf v1.5.4 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/stretchr/testify v1.9.0 + go.uber.org/mock v0.5.0 google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 google.golang.org/grpc v1.67.1 gotest.tools/v3 v3.5.1 // indirect @@ -148,13 +148,13 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.28.0 // indirect golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect - golang.org/x/mod v0.17.0 // indirect + golang.org/x/mod v0.18.0 // indirect golang.org/x/net v0.29.0 // indirect golang.org/x/sync v0.8.0 // indirect golang.org/x/sys v0.26.0 // indirect golang.org/x/term v0.25.0 // indirect golang.org/x/text v0.19.0 // indirect - golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect + golang.org/x/tools v0.22.0 // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f // indirect google.golang.org/protobuf v1.35.1 // indirect diff --git a/x/mint/go.sum b/x/mint/go.sum index 3041219c2907..0a10fbf93445 100644 --- a/x/mint/go.sum +++ b/x/mint/go.sum @@ -486,7 +486,6 @@ github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EU github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= @@ -524,9 +523,8 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0= +golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -557,7 +555,6 @@ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -619,9 +616,8 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= +golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/x/mint/keeper/genesis_test.go b/x/mint/keeper/genesis_test.go index 4c1b17ccafa2..2e988a53d6a2 100644 --- a/x/mint/keeper/genesis_test.go +++ b/x/mint/keeper/genesis_test.go @@ -4,8 +4,8 @@ import ( "context" "testing" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" + "go.uber.org/mock/gomock" "cosmossdk.io/collections" "cosmossdk.io/core/appmodule" diff --git a/x/mint/keeper/grpc_query_test.go b/x/mint/keeper/grpc_query_test.go index 75b17808af0a..6855b69aeaee 100644 --- a/x/mint/keeper/grpc_query_test.go +++ b/x/mint/keeper/grpc_query_test.go @@ -4,8 +4,8 @@ import ( gocontext "context" "testing" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" + "go.uber.org/mock/gomock" "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" diff --git a/x/mint/keeper/keeper_test.go b/x/mint/keeper/keeper_test.go index 6bec00095a18..55bab8297f42 100644 --- a/x/mint/keeper/keeper_test.go +++ b/x/mint/keeper/keeper_test.go @@ -4,8 +4,8 @@ import ( "context" "testing" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" + "go.uber.org/mock/gomock" "cosmossdk.io/core/appmodule" coretesting "cosmossdk.io/core/testing" diff --git a/x/mint/module_test.go b/x/mint/module_test.go index 1ba64d0bd8fe..9ba025e4706c 100644 --- a/x/mint/module_test.go +++ b/x/mint/module_test.go @@ -3,8 +3,8 @@ package mint_test import ( "testing" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" + "go.uber.org/mock/gomock" "cosmossdk.io/log" "cosmossdk.io/math" diff --git a/x/mint/testutil/expected_keepers_mocks.go b/x/mint/testutil/expected_keepers_mocks.go index 0f799d05fb01..988308d92fe5 100644 --- a/x/mint/testutil/expected_keepers_mocks.go +++ b/x/mint/testutil/expected_keepers_mocks.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: x/mint/types/expected_keepers.go +// +// Generated by this command: +// +// mockgen -source=x/mint/types/expected_keepers.go -package testutil -destination x/mint/testutil/expected_keepers_mocks.go +// // Package testutil is a generated GoMock package. package testutil @@ -11,13 +16,14 @@ import ( address "cosmossdk.io/core/address" math "cosmossdk.io/math" types "github.com/cosmos/cosmos-sdk/types" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockStakingKeeper is a mock of StakingKeeper interface. type MockStakingKeeper struct { ctrl *gomock.Controller recorder *MockStakingKeeperMockRecorder + isgomock struct{} } // MockStakingKeeperMockRecorder is the mock recorder for MockStakingKeeper. @@ -47,7 +53,7 @@ func (m *MockStakingKeeper) BondedRatio(ctx context.Context) (math.LegacyDec, er } // BondedRatio indicates an expected call of BondedRatio. -func (mr *MockStakingKeeperMockRecorder) BondedRatio(ctx interface{}) *gomock.Call { +func (mr *MockStakingKeeperMockRecorder) BondedRatio(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BondedRatio", reflect.TypeOf((*MockStakingKeeper)(nil).BondedRatio), ctx) } @@ -62,7 +68,7 @@ func (m *MockStakingKeeper) StakingTokenSupply(ctx context.Context) (math.Int, e } // StakingTokenSupply indicates an expected call of StakingTokenSupply. -func (mr *MockStakingKeeperMockRecorder) StakingTokenSupply(ctx interface{}) *gomock.Call { +func (mr *MockStakingKeeperMockRecorder) StakingTokenSupply(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StakingTokenSupply", reflect.TypeOf((*MockStakingKeeper)(nil).StakingTokenSupply), ctx) } @@ -71,6 +77,7 @@ func (mr *MockStakingKeeperMockRecorder) StakingTokenSupply(ctx interface{}) *go type MockAccountKeeper struct { ctrl *gomock.Controller recorder *MockAccountKeeperMockRecorder + isgomock struct{} } // MockAccountKeeperMockRecorder is the mock recorder for MockAccountKeeper. @@ -113,7 +120,7 @@ func (m *MockAccountKeeper) GetModuleAccount(ctx context.Context, moduleName str } // GetModuleAccount indicates an expected call of GetModuleAccount. -func (mr *MockAccountKeeperMockRecorder) GetModuleAccount(ctx, moduleName interface{}) *gomock.Call { +func (mr *MockAccountKeeperMockRecorder) GetModuleAccount(ctx, moduleName any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetModuleAccount", reflect.TypeOf((*MockAccountKeeper)(nil).GetModuleAccount), ctx, moduleName) } @@ -127,7 +134,7 @@ func (m *MockAccountKeeper) GetModuleAddress(name string) types.AccAddress { } // GetModuleAddress indicates an expected call of GetModuleAddress. -func (mr *MockAccountKeeperMockRecorder) GetModuleAddress(name interface{}) *gomock.Call { +func (mr *MockAccountKeeperMockRecorder) GetModuleAddress(name any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetModuleAddress", reflect.TypeOf((*MockAccountKeeper)(nil).GetModuleAddress), name) } @@ -139,7 +146,7 @@ func (m *MockAccountKeeper) SetModuleAccount(arg0 context.Context, arg1 types.Mo } // SetModuleAccount indicates an expected call of SetModuleAccount. -func (mr *MockAccountKeeperMockRecorder) SetModuleAccount(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAccountKeeperMockRecorder) SetModuleAccount(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetModuleAccount", reflect.TypeOf((*MockAccountKeeper)(nil).SetModuleAccount), arg0, arg1) } @@ -148,6 +155,7 @@ func (mr *MockAccountKeeperMockRecorder) SetModuleAccount(arg0, arg1 interface{} type MockBankKeeper struct { ctrl *gomock.Controller recorder *MockBankKeeperMockRecorder + isgomock struct{} } // MockBankKeeperMockRecorder is the mock recorder for MockBankKeeper. @@ -176,7 +184,7 @@ func (m *MockBankKeeper) GetSupply(ctx context.Context, denom string) types.Coin } // GetSupply indicates an expected call of GetSupply. -func (mr *MockBankKeeperMockRecorder) GetSupply(ctx, denom interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) GetSupply(ctx, denom any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSupply", reflect.TypeOf((*MockBankKeeper)(nil).GetSupply), ctx, denom) } @@ -190,7 +198,7 @@ func (m *MockBankKeeper) MintCoins(ctx context.Context, name string, amt types.C } // MintCoins indicates an expected call of MintCoins. -func (mr *MockBankKeeperMockRecorder) MintCoins(ctx, name, amt interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) MintCoins(ctx, name, amt any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MintCoins", reflect.TypeOf((*MockBankKeeper)(nil).MintCoins), ctx, name, amt) } @@ -204,7 +212,7 @@ func (m *MockBankKeeper) SendCoinsFromModuleToAccount(ctx context.Context, sende } // SendCoinsFromModuleToAccount indicates an expected call of SendCoinsFromModuleToAccount. -func (mr *MockBankKeeperMockRecorder) SendCoinsFromModuleToAccount(ctx, senderModule, recipientAddr, amt interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) SendCoinsFromModuleToAccount(ctx, senderModule, recipientAddr, amt any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromModuleToAccount", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromModuleToAccount), ctx, senderModule, recipientAddr, amt) } @@ -218,7 +226,7 @@ func (m *MockBankKeeper) SendCoinsFromModuleToModule(ctx context.Context, sender } // SendCoinsFromModuleToModule indicates an expected call of SendCoinsFromModuleToModule. -func (mr *MockBankKeeperMockRecorder) SendCoinsFromModuleToModule(ctx, senderModule, recipientModule, amt interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) SendCoinsFromModuleToModule(ctx, senderModule, recipientModule, amt any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromModuleToModule", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromModuleToModule), ctx, senderModule, recipientModule, amt) } diff --git a/x/nft/go.mod b/x/nft/go.mod index bf1eb272e33d..a7850b4196a1 100644 --- a/x/nft/go.mod +++ b/x/nft/go.mod @@ -13,10 +13,10 @@ require ( github.com/cosmos/cosmos-proto v1.0.0-beta.5 github.com/cosmos/cosmos-sdk v0.53.0 github.com/cosmos/gogoproto v1.7.0 - github.com/golang/mock v1.6.0 github.com/golang/protobuf v1.5.4 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/stretchr/testify v1.9.0 + go.uber.org/mock v0.5.0 google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 google.golang.org/grpc v1.67.1 ) @@ -150,13 +150,13 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.28.0 // indirect golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect - golang.org/x/mod v0.17.0 // indirect + golang.org/x/mod v0.18.0 // indirect golang.org/x/net v0.29.0 // indirect golang.org/x/sync v0.8.0 // indirect golang.org/x/sys v0.26.0 // indirect golang.org/x/term v0.25.0 // indirect golang.org/x/text v0.19.0 // indirect - golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect + golang.org/x/tools v0.22.0 // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f // indirect google.golang.org/protobuf v1.35.1 // indirect diff --git a/x/nft/go.sum b/x/nft/go.sum index 3041219c2907..0a10fbf93445 100644 --- a/x/nft/go.sum +++ b/x/nft/go.sum @@ -486,7 +486,6 @@ github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EU github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= @@ -524,9 +523,8 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0= +golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -557,7 +555,6 @@ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -619,9 +616,8 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= +golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/x/nft/keeper/keeper_test.go b/x/nft/keeper/keeper_test.go index 27c929bba25e..d907afc1611d 100644 --- a/x/nft/keeper/keeper_test.go +++ b/x/nft/keeper/keeper_test.go @@ -4,8 +4,8 @@ import ( "testing" "time" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" + "go.uber.org/mock/gomock" "cosmossdk.io/core/header" "cosmossdk.io/log" diff --git a/x/nft/testutil/expected_keepers_mocks.go b/x/nft/testutil/expected_keepers_mocks.go index 3329058f4488..99139a84150b 100644 --- a/x/nft/testutil/expected_keepers_mocks.go +++ b/x/nft/testutil/expected_keepers_mocks.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: x/nft/expected_keepers.go +// +// Generated by this command: +// +// mockgen -source=x/nft/expected_keepers.go -package testutil -destination x/nft/testutil/expected_keepers_mocks.go +// // Package testutil is a generated GoMock package. package testutil @@ -10,13 +15,14 @@ import ( address "cosmossdk.io/core/address" types "github.com/cosmos/cosmos-sdk/types" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockBankKeeper is a mock of BankKeeper interface. type MockBankKeeper struct { ctrl *gomock.Controller recorder *MockBankKeeperMockRecorder + isgomock struct{} } // MockBankKeeperMockRecorder is the mock recorder for MockBankKeeper. @@ -45,7 +51,7 @@ func (m *MockBankKeeper) SpendableCoins(ctx context.Context, addr types.AccAddre } // SpendableCoins indicates an expected call of SpendableCoins. -func (mr *MockBankKeeperMockRecorder) SpendableCoins(ctx, addr interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) SpendableCoins(ctx, addr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SpendableCoins", reflect.TypeOf((*MockBankKeeper)(nil).SpendableCoins), ctx, addr) } @@ -54,6 +60,7 @@ func (mr *MockBankKeeperMockRecorder) SpendableCoins(ctx, addr interface{}) *gom type MockAccountKeeper struct { ctrl *gomock.Controller recorder *MockAccountKeeperMockRecorder + isgomock struct{} } // MockAccountKeeperMockRecorder is the mock recorder for MockAccountKeeper. @@ -96,7 +103,7 @@ func (m *MockAccountKeeper) GetAccount(ctx context.Context, addr types.AccAddres } // GetAccount indicates an expected call of GetAccount. -func (mr *MockAccountKeeperMockRecorder) GetAccount(ctx, addr interface{}) *gomock.Call { +func (mr *MockAccountKeeperMockRecorder) GetAccount(ctx, addr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccount", reflect.TypeOf((*MockAccountKeeper)(nil).GetAccount), ctx, addr) } @@ -110,7 +117,7 @@ func (m *MockAccountKeeper) GetModuleAddress(name string) types.AccAddress { } // GetModuleAddress indicates an expected call of GetModuleAddress. -func (mr *MockAccountKeeperMockRecorder) GetModuleAddress(name interface{}) *gomock.Call { +func (mr *MockAccountKeeperMockRecorder) GetModuleAddress(name any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetModuleAddress", reflect.TypeOf((*MockAccountKeeper)(nil).GetModuleAddress), name) } diff --git a/x/params/go.mod b/x/params/go.mod index 006af90f591d..f80ffacf7580 100644 --- a/x/params/go.mod +++ b/x/params/go.mod @@ -16,11 +16,11 @@ require ( github.com/cosmos/cosmos-proto v1.0.0-beta.5 github.com/cosmos/cosmos-sdk v0.53.0 github.com/cosmos/gogoproto v1.7.0 - github.com/golang/mock v1.6.0 github.com/golang/protobuf v1.5.4 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/spf13/cobra v1.8.1 github.com/stretchr/testify v1.9.0 + go.uber.org/mock v0.5.0 google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 google.golang.org/grpc v1.67.1 ) @@ -142,13 +142,13 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.28.0 // indirect golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect - golang.org/x/mod v0.17.0 // indirect + golang.org/x/mod v0.18.0 // indirect golang.org/x/net v0.29.0 // indirect golang.org/x/sync v0.8.0 // indirect golang.org/x/sys v0.26.0 // indirect golang.org/x/term v0.25.0 // indirect golang.org/x/text v0.19.0 // indirect - golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect + golang.org/x/tools v0.22.0 // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f // indirect google.golang.org/protobuf v1.35.1 // indirect diff --git a/x/params/go.sum b/x/params/go.sum index a7561e518df0..b99b90c57899 100644 --- a/x/params/go.sum +++ b/x/params/go.sum @@ -460,7 +460,6 @@ github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EU github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= @@ -498,9 +497,8 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0= +golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -531,7 +529,6 @@ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -592,9 +589,8 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= +golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/x/params/testutil/staking_keeper_mock.go b/x/params/testutil/staking_keeper_mock.go index bc5a94ffb50b..d0f560a9e79d 100644 --- a/x/params/testutil/staking_keeper_mock.go +++ b/x/params/testutil/staking_keeper_mock.go @@ -8,7 +8,7 @@ import ( context "context" reflect "reflect" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockStakingKeeper is a mock of StakingKeeper interface. diff --git a/x/protocolpool/go.mod b/x/protocolpool/go.mod index dbbb158bb411..386dc1672dbc 100644 --- a/x/protocolpool/go.mod +++ b/x/protocolpool/go.mod @@ -14,10 +14,10 @@ require ( github.com/cosmos/cosmos-proto v1.0.0-beta.5 github.com/cosmos/cosmos-sdk v0.53.0 github.com/cosmos/gogoproto v1.7.0 - github.com/golang/mock v1.6.0 github.com/golang/protobuf v1.5.4 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/stretchr/testify v1.9.0 + go.uber.org/mock v0.5.0 google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 google.golang.org/grpc v1.67.1 google.golang.org/protobuf v1.35.1 @@ -151,13 +151,13 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.28.0 // indirect golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect - golang.org/x/mod v0.17.0 // indirect + golang.org/x/mod v0.18.0 // indirect golang.org/x/net v0.29.0 // indirect golang.org/x/sync v0.8.0 // indirect golang.org/x/sys v0.26.0 // indirect golang.org/x/term v0.25.0 // indirect golang.org/x/text v0.19.0 // indirect - golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect + golang.org/x/tools v0.22.0 // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/x/protocolpool/go.sum b/x/protocolpool/go.sum index 3041219c2907..0a10fbf93445 100644 --- a/x/protocolpool/go.sum +++ b/x/protocolpool/go.sum @@ -486,7 +486,6 @@ github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EU github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= @@ -524,9 +523,8 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0= +golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -557,7 +555,6 @@ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -619,9 +616,8 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= +golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/x/protocolpool/keeper/keeper_test.go b/x/protocolpool/keeper/keeper_test.go index e4fc05d1a6a3..41375b39cfa9 100644 --- a/x/protocolpool/keeper/keeper_test.go +++ b/x/protocolpool/keeper/keeper_test.go @@ -4,8 +4,8 @@ import ( "testing" "time" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" + "go.uber.org/mock/gomock" "cosmossdk.io/core/appmodule" "cosmossdk.io/core/header" diff --git a/x/protocolpool/keeper/msg_server_test.go b/x/protocolpool/keeper/msg_server_test.go index b053ef9ff681..14538755edff 100644 --- a/x/protocolpool/keeper/msg_server_test.go +++ b/x/protocolpool/keeper/msg_server_test.go @@ -3,7 +3,7 @@ package keeper_test import ( "time" - "github.com/golang/mock/gomock" + "go.uber.org/mock/gomock" "cosmossdk.io/collections" "cosmossdk.io/core/header" diff --git a/x/protocolpool/testutil/expected_keepers_mocks.go b/x/protocolpool/testutil/expected_keepers_mocks.go index 9bbdfc58284b..874c8e9d074a 100644 --- a/x/protocolpool/testutil/expected_keepers_mocks.go +++ b/x/protocolpool/testutil/expected_keepers_mocks.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: x/protocolpool/types/expected_keepers.go +// +// Generated by this command: +// +// mockgen -source=x/protocolpool/types/expected_keepers.go -package testutil -destination x/protocolpool/testutil/expected_keepers_mocks.go +// // Package testutil is a generated GoMock package. package testutil @@ -10,13 +15,14 @@ import ( address "cosmossdk.io/core/address" types "github.com/cosmos/cosmos-sdk/types" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockAccountKeeper is a mock of AccountKeeper interface. type MockAccountKeeper struct { ctrl *gomock.Controller recorder *MockAccountKeeperMockRecorder + isgomock struct{} } // MockAccountKeeperMockRecorder is the mock recorder for MockAccountKeeper. @@ -59,7 +65,7 @@ func (m *MockAccountKeeper) GetAccount(ctx context.Context, addr types.AccAddres } // GetAccount indicates an expected call of GetAccount. -func (mr *MockAccountKeeperMockRecorder) GetAccount(ctx, addr interface{}) *gomock.Call { +func (mr *MockAccountKeeperMockRecorder) GetAccount(ctx, addr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccount", reflect.TypeOf((*MockAccountKeeper)(nil).GetAccount), ctx, addr) } @@ -73,7 +79,7 @@ func (m *MockAccountKeeper) GetModuleAccount(ctx context.Context, name string) t } // GetModuleAccount indicates an expected call of GetModuleAccount. -func (mr *MockAccountKeeperMockRecorder) GetModuleAccount(ctx, name interface{}) *gomock.Call { +func (mr *MockAccountKeeperMockRecorder) GetModuleAccount(ctx, name any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetModuleAccount", reflect.TypeOf((*MockAccountKeeper)(nil).GetModuleAccount), ctx, name) } @@ -87,7 +93,7 @@ func (m *MockAccountKeeper) GetModuleAddress(name string) types.AccAddress { } // GetModuleAddress indicates an expected call of GetModuleAddress. -func (mr *MockAccountKeeperMockRecorder) GetModuleAddress(name interface{}) *gomock.Call { +func (mr *MockAccountKeeperMockRecorder) GetModuleAddress(name any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetModuleAddress", reflect.TypeOf((*MockAccountKeeper)(nil).GetModuleAddress), name) } @@ -96,6 +102,7 @@ func (mr *MockAccountKeeperMockRecorder) GetModuleAddress(name interface{}) *gom type MockBankKeeper struct { ctrl *gomock.Controller recorder *MockBankKeeperMockRecorder + isgomock struct{} } // MockBankKeeperMockRecorder is the mock recorder for MockBankKeeper. @@ -124,7 +131,7 @@ func (m *MockBankKeeper) GetAllBalances(ctx context.Context, addr types.AccAddre } // GetAllBalances indicates an expected call of GetAllBalances. -func (mr *MockBankKeeperMockRecorder) GetAllBalances(ctx, addr interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) GetAllBalances(ctx, addr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllBalances", reflect.TypeOf((*MockBankKeeper)(nil).GetAllBalances), ctx, addr) } @@ -138,7 +145,7 @@ func (m *MockBankKeeper) SendCoinsFromAccountToModule(ctx context.Context, sende } // SendCoinsFromAccountToModule indicates an expected call of SendCoinsFromAccountToModule. -func (mr *MockBankKeeperMockRecorder) SendCoinsFromAccountToModule(ctx, senderAddr, recipientModule, amt interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) SendCoinsFromAccountToModule(ctx, senderAddr, recipientModule, amt any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromAccountToModule", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromAccountToModule), ctx, senderAddr, recipientModule, amt) } @@ -152,7 +159,7 @@ func (m *MockBankKeeper) SendCoinsFromModuleToAccount(ctx context.Context, sende } // SendCoinsFromModuleToAccount indicates an expected call of SendCoinsFromModuleToAccount. -func (mr *MockBankKeeperMockRecorder) SendCoinsFromModuleToAccount(ctx, senderModule, recipientAddr, amt interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) SendCoinsFromModuleToAccount(ctx, senderModule, recipientAddr, amt any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromModuleToAccount", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromModuleToAccount), ctx, senderModule, recipientAddr, amt) } @@ -166,7 +173,7 @@ func (m *MockBankKeeper) SendCoinsFromModuleToModule(ctx context.Context, sender } // SendCoinsFromModuleToModule indicates an expected call of SendCoinsFromModuleToModule. -func (mr *MockBankKeeperMockRecorder) SendCoinsFromModuleToModule(ctx, senderModule, recipientModule, amt interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) SendCoinsFromModuleToModule(ctx, senderModule, recipientModule, amt any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromModuleToModule", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromModuleToModule), ctx, senderModule, recipientModule, amt) } @@ -180,7 +187,7 @@ func (m *MockBankKeeper) SpendableCoins(ctx context.Context, addr types.AccAddre } // SpendableCoins indicates an expected call of SpendableCoins. -func (mr *MockBankKeeperMockRecorder) SpendableCoins(ctx, addr interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) SpendableCoins(ctx, addr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SpendableCoins", reflect.TypeOf((*MockBankKeeper)(nil).SpendableCoins), ctx, addr) } @@ -189,6 +196,7 @@ func (mr *MockBankKeeperMockRecorder) SpendableCoins(ctx, addr interface{}) *gom type MockStakingKeeper struct { ctrl *gomock.Controller recorder *MockStakingKeeperMockRecorder + isgomock struct{} } // MockStakingKeeperMockRecorder is the mock recorder for MockStakingKeeper. @@ -218,7 +226,7 @@ func (m *MockStakingKeeper) BondDenom(ctx context.Context) (string, error) { } // BondDenom indicates an expected call of BondDenom. -func (mr *MockStakingKeeperMockRecorder) BondDenom(ctx interface{}) *gomock.Call { +func (mr *MockStakingKeeperMockRecorder) BondDenom(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BondDenom", reflect.TypeOf((*MockStakingKeeper)(nil).BondDenom), ctx) } diff --git a/x/slashing/go.mod b/x/slashing/go.mod index b5537caa655e..aa7ff1650254 100644 --- a/x/slashing/go.mod +++ b/x/slashing/go.mod @@ -16,10 +16,10 @@ require ( github.com/cosmos/cosmos-proto v1.0.0-beta.5 github.com/cosmos/cosmos-sdk v0.53.0 github.com/cosmos/gogoproto v1.7.0 - github.com/golang/mock v1.6.0 github.com/golang/protobuf v1.5.4 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/stretchr/testify v1.9.0 + go.uber.org/mock v0.5.0 google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 google.golang.org/grpc v1.67.1 google.golang.org/protobuf v1.35.1 @@ -153,13 +153,13 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.28.0 // indirect golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect - golang.org/x/mod v0.17.0 // indirect + golang.org/x/mod v0.18.0 // indirect golang.org/x/net v0.29.0 // indirect golang.org/x/sync v0.8.0 // indirect golang.org/x/sys v0.26.0 // indirect golang.org/x/term v0.25.0 // indirect golang.org/x/text v0.19.0 // indirect - golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect + golang.org/x/tools v0.22.0 // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/x/slashing/go.sum b/x/slashing/go.sum index 5f4269b3bc6b..199ef6b981a0 100644 --- a/x/slashing/go.sum +++ b/x/slashing/go.sum @@ -488,7 +488,6 @@ github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EU github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= @@ -526,9 +525,8 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0= +golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -559,7 +557,6 @@ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -621,9 +618,8 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= +golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/x/slashing/keeper/genesis_test.go b/x/slashing/keeper/genesis_test.go index 0f5485c01bcf..940c24fbd93e 100644 --- a/x/slashing/keeper/genesis_test.go +++ b/x/slashing/keeper/genesis_test.go @@ -3,7 +3,7 @@ package keeper_test import ( "time" - "github.com/golang/mock/gomock" + "go.uber.org/mock/gomock" "cosmossdk.io/x/slashing/testutil" "cosmossdk.io/x/slashing/types" diff --git a/x/slashing/keeper/keeper_test.go b/x/slashing/keeper/keeper_test.go index 95e464b422da..19e95bac9758 100644 --- a/x/slashing/keeper/keeper_test.go +++ b/x/slashing/keeper/keeper_test.go @@ -5,8 +5,8 @@ import ( "testing" "time" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" + "go.uber.org/mock/gomock" st "cosmossdk.io/api/cosmos/staking/v1beta1" "cosmossdk.io/core/header" diff --git a/x/slashing/keeper/signing_info_test.go b/x/slashing/keeper/signing_info_test.go index 8de1e0b83cd7..9cab661fa6a4 100644 --- a/x/slashing/keeper/signing_info_test.go +++ b/x/slashing/keeper/signing_info_test.go @@ -3,7 +3,7 @@ package keeper_test import ( "time" - "github.com/golang/mock/gomock" + "go.uber.org/mock/gomock" "cosmossdk.io/x/slashing/testutil" slashingtypes "cosmossdk.io/x/slashing/types" diff --git a/x/slashing/testutil/expected_keepers_mocks.go b/x/slashing/testutil/expected_keepers_mocks.go index 8c9accc757aa..860cd4d7a80b 100644 --- a/x/slashing/testutil/expected_keepers_mocks.go +++ b/x/slashing/testutil/expected_keepers_mocks.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: x/slashing/types/expected_keepers.go +// +// Generated by this command: +// +// mockgen -source=x/slashing/types/expected_keepers.go -package testutil -destination x/slashing/testutil/expected_keepers_mocks.go +// // Package testutil is a generated GoMock package. package testutil @@ -13,13 +18,14 @@ import ( math "cosmossdk.io/math" types "cosmossdk.io/x/staking/types" types0 "github.com/cosmos/cosmos-sdk/types" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockAccountKeeper is a mock of AccountKeeper interface. type MockAccountKeeper struct { ctrl *gomock.Controller recorder *MockAccountKeeperMockRecorder + isgomock struct{} } // MockAccountKeeperMockRecorder is the mock recorder for MockAccountKeeper. @@ -62,7 +68,7 @@ func (m *MockAccountKeeper) GetAccount(ctx context.Context, addr types0.AccAddre } // GetAccount indicates an expected call of GetAccount. -func (mr *MockAccountKeeperMockRecorder) GetAccount(ctx, addr interface{}) *gomock.Call { +func (mr *MockAccountKeeperMockRecorder) GetAccount(ctx, addr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccount", reflect.TypeOf((*MockAccountKeeper)(nil).GetAccount), ctx, addr) } @@ -71,6 +77,7 @@ func (mr *MockAccountKeeperMockRecorder) GetAccount(ctx, addr interface{}) *gomo type MockBankKeeper struct { ctrl *gomock.Controller recorder *MockBankKeeperMockRecorder + isgomock struct{} } // MockBankKeeperMockRecorder is the mock recorder for MockBankKeeper. @@ -99,7 +106,7 @@ func (m *MockBankKeeper) GetAllBalances(ctx context.Context, addr types0.AccAddr } // GetAllBalances indicates an expected call of GetAllBalances. -func (mr *MockBankKeeperMockRecorder) GetAllBalances(ctx, addr interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) GetAllBalances(ctx, addr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllBalances", reflect.TypeOf((*MockBankKeeper)(nil).GetAllBalances), ctx, addr) } @@ -113,7 +120,7 @@ func (m *MockBankKeeper) GetBalance(ctx context.Context, addr types0.AccAddress, } // GetBalance indicates an expected call of GetBalance. -func (mr *MockBankKeeperMockRecorder) GetBalance(ctx, addr, denom interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) GetBalance(ctx, addr, denom any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBalance", reflect.TypeOf((*MockBankKeeper)(nil).GetBalance), ctx, addr, denom) } @@ -127,7 +134,7 @@ func (m *MockBankKeeper) LockedCoins(ctx context.Context, addr types0.AccAddress } // LockedCoins indicates an expected call of LockedCoins. -func (mr *MockBankKeeperMockRecorder) LockedCoins(ctx, addr interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) LockedCoins(ctx, addr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LockedCoins", reflect.TypeOf((*MockBankKeeper)(nil).LockedCoins), ctx, addr) } @@ -141,7 +148,7 @@ func (m *MockBankKeeper) SpendableCoins(ctx context.Context, addr types0.AccAddr } // SpendableCoins indicates an expected call of SpendableCoins. -func (mr *MockBankKeeperMockRecorder) SpendableCoins(ctx, addr interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) SpendableCoins(ctx, addr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SpendableCoins", reflect.TypeOf((*MockBankKeeper)(nil).SpendableCoins), ctx, addr) } @@ -150,6 +157,7 @@ func (mr *MockBankKeeperMockRecorder) SpendableCoins(ctx, addr interface{}) *gom type MockStakingKeeper struct { ctrl *gomock.Controller recorder *MockStakingKeeperMockRecorder + isgomock struct{} } // MockStakingKeeperMockRecorder is the mock recorder for MockStakingKeeper. @@ -193,7 +201,7 @@ func (m *MockStakingKeeper) Delegation(arg0 context.Context, arg1 types0.AccAddr } // Delegation indicates an expected call of Delegation. -func (mr *MockStakingKeeperMockRecorder) Delegation(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockStakingKeeperMockRecorder) Delegation(arg0, arg1, arg2 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delegation", reflect.TypeOf((*MockStakingKeeper)(nil).Delegation), arg0, arg1, arg2) } @@ -208,7 +216,7 @@ func (m *MockStakingKeeper) GetAllValidators(ctx context.Context) ([]types.Valid } // GetAllValidators indicates an expected call of GetAllValidators. -func (mr *MockStakingKeeperMockRecorder) GetAllValidators(ctx interface{}) *gomock.Call { +func (mr *MockStakingKeeperMockRecorder) GetAllValidators(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllValidators", reflect.TypeOf((*MockStakingKeeper)(nil).GetAllValidators), ctx) } @@ -223,7 +231,7 @@ func (m *MockStakingKeeper) IsValidatorJailed(ctx context.Context, addr types0.C } // IsValidatorJailed indicates an expected call of IsValidatorJailed. -func (mr *MockStakingKeeperMockRecorder) IsValidatorJailed(ctx, addr interface{}) *gomock.Call { +func (mr *MockStakingKeeperMockRecorder) IsValidatorJailed(ctx, addr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsValidatorJailed", reflect.TypeOf((*MockStakingKeeper)(nil).IsValidatorJailed), ctx, addr) } @@ -237,7 +245,7 @@ func (m *MockStakingKeeper) IterateValidators(arg0 context.Context, arg1 func(in } // IterateValidators indicates an expected call of IterateValidators. -func (mr *MockStakingKeeperMockRecorder) IterateValidators(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockStakingKeeperMockRecorder) IterateValidators(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IterateValidators", reflect.TypeOf((*MockStakingKeeper)(nil).IterateValidators), arg0, arg1) } @@ -251,7 +259,7 @@ func (m *MockStakingKeeper) Jail(arg0 context.Context, arg1 types0.ConsAddress) } // Jail indicates an expected call of Jail. -func (mr *MockStakingKeeperMockRecorder) Jail(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockStakingKeeperMockRecorder) Jail(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Jail", reflect.TypeOf((*MockStakingKeeper)(nil).Jail), arg0, arg1) } @@ -266,7 +274,7 @@ func (m *MockStakingKeeper) MaxValidators(arg0 context.Context) (uint32, error) } // MaxValidators indicates an expected call of MaxValidators. -func (mr *MockStakingKeeperMockRecorder) MaxValidators(arg0 interface{}) *gomock.Call { +func (mr *MockStakingKeeperMockRecorder) MaxValidators(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MaxValidators", reflect.TypeOf((*MockStakingKeeper)(nil).MaxValidators), arg0) } @@ -281,7 +289,7 @@ func (m *MockStakingKeeper) Slash(arg0 context.Context, arg1 types0.ConsAddress, } // Slash indicates an expected call of Slash. -func (mr *MockStakingKeeperMockRecorder) Slash(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { +func (mr *MockStakingKeeperMockRecorder) Slash(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Slash", reflect.TypeOf((*MockStakingKeeper)(nil).Slash), arg0, arg1, arg2, arg3, arg4) } @@ -296,7 +304,7 @@ func (m *MockStakingKeeper) SlashWithInfractionReason(arg0 context.Context, arg1 } // SlashWithInfractionReason indicates an expected call of SlashWithInfractionReason. -func (mr *MockStakingKeeperMockRecorder) SlashWithInfractionReason(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call { +func (mr *MockStakingKeeperMockRecorder) SlashWithInfractionReason(arg0, arg1, arg2, arg3, arg4, arg5 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SlashWithInfractionReason", reflect.TypeOf((*MockStakingKeeper)(nil).SlashWithInfractionReason), arg0, arg1, arg2, arg3, arg4, arg5) } @@ -310,7 +318,7 @@ func (m *MockStakingKeeper) Unjail(arg0 context.Context, arg1 types0.ConsAddress } // Unjail indicates an expected call of Unjail. -func (mr *MockStakingKeeperMockRecorder) Unjail(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockStakingKeeperMockRecorder) Unjail(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Unjail", reflect.TypeOf((*MockStakingKeeper)(nil).Unjail), arg0, arg1) } @@ -325,7 +333,7 @@ func (m *MockStakingKeeper) Validator(arg0 context.Context, arg1 types0.ValAddre } // Validator indicates an expected call of Validator. -func (mr *MockStakingKeeperMockRecorder) Validator(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockStakingKeeperMockRecorder) Validator(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Validator", reflect.TypeOf((*MockStakingKeeper)(nil).Validator), arg0, arg1) } @@ -354,7 +362,7 @@ func (m *MockStakingKeeper) ValidatorByConsAddr(arg0 context.Context, arg1 types } // ValidatorByConsAddr indicates an expected call of ValidatorByConsAddr. -func (mr *MockStakingKeeperMockRecorder) ValidatorByConsAddr(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockStakingKeeperMockRecorder) ValidatorByConsAddr(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidatorByConsAddr", reflect.TypeOf((*MockStakingKeeper)(nil).ValidatorByConsAddr), arg0, arg1) } @@ -369,7 +377,7 @@ func (m *MockStakingKeeper) ValidatorIdentifier(arg0 context.Context, arg1 types } // ValidatorIdentifier indicates an expected call of ValidatorIdentifier. -func (mr *MockStakingKeeperMockRecorder) ValidatorIdentifier(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockStakingKeeperMockRecorder) ValidatorIdentifier(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidatorIdentifier", reflect.TypeOf((*MockStakingKeeper)(nil).ValidatorIdentifier), arg0, arg1) } @@ -378,6 +386,7 @@ func (mr *MockStakingKeeperMockRecorder) ValidatorIdentifier(arg0, arg1 interfac type MockStakingHooks struct { ctrl *gomock.Controller recorder *MockStakingHooksMockRecorder + isgomock struct{} } // MockStakingHooksMockRecorder is the mock recorder for MockStakingHooks. @@ -406,7 +415,7 @@ func (m *MockStakingHooks) AfterDelegationModified(ctx context.Context, delAddr } // AfterDelegationModified indicates an expected call of AfterDelegationModified. -func (mr *MockStakingHooksMockRecorder) AfterDelegationModified(ctx, delAddr, valAddr interface{}) *gomock.Call { +func (mr *MockStakingHooksMockRecorder) AfterDelegationModified(ctx, delAddr, valAddr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AfterDelegationModified", reflect.TypeOf((*MockStakingHooks)(nil).AfterDelegationModified), ctx, delAddr, valAddr) } @@ -420,7 +429,7 @@ func (m *MockStakingHooks) AfterValidatorBeginUnbonding(ctx context.Context, con } // AfterValidatorBeginUnbonding indicates an expected call of AfterValidatorBeginUnbonding. -func (mr *MockStakingHooksMockRecorder) AfterValidatorBeginUnbonding(ctx, consAddr, valAddr interface{}) *gomock.Call { +func (mr *MockStakingHooksMockRecorder) AfterValidatorBeginUnbonding(ctx, consAddr, valAddr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AfterValidatorBeginUnbonding", reflect.TypeOf((*MockStakingHooks)(nil).AfterValidatorBeginUnbonding), ctx, consAddr, valAddr) } @@ -434,7 +443,7 @@ func (m *MockStakingHooks) AfterValidatorBonded(ctx context.Context, consAddr ty } // AfterValidatorBonded indicates an expected call of AfterValidatorBonded. -func (mr *MockStakingHooksMockRecorder) AfterValidatorBonded(ctx, consAddr, valAddr interface{}) *gomock.Call { +func (mr *MockStakingHooksMockRecorder) AfterValidatorBonded(ctx, consAddr, valAddr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AfterValidatorBonded", reflect.TypeOf((*MockStakingHooks)(nil).AfterValidatorBonded), ctx, consAddr, valAddr) } @@ -448,7 +457,7 @@ func (m *MockStakingHooks) AfterValidatorCreated(ctx context.Context, valAddr ty } // AfterValidatorCreated indicates an expected call of AfterValidatorCreated. -func (mr *MockStakingHooksMockRecorder) AfterValidatorCreated(ctx, valAddr interface{}) *gomock.Call { +func (mr *MockStakingHooksMockRecorder) AfterValidatorCreated(ctx, valAddr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AfterValidatorCreated", reflect.TypeOf((*MockStakingHooks)(nil).AfterValidatorCreated), ctx, valAddr) } @@ -462,7 +471,7 @@ func (m *MockStakingHooks) AfterValidatorRemoved(ctx context.Context, consAddr t } // AfterValidatorRemoved indicates an expected call of AfterValidatorRemoved. -func (mr *MockStakingHooksMockRecorder) AfterValidatorRemoved(ctx, consAddr, valAddr interface{}) *gomock.Call { +func (mr *MockStakingHooksMockRecorder) AfterValidatorRemoved(ctx, consAddr, valAddr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AfterValidatorRemoved", reflect.TypeOf((*MockStakingHooks)(nil).AfterValidatorRemoved), ctx, consAddr, valAddr) } @@ -476,7 +485,7 @@ func (m *MockStakingHooks) BeforeDelegationCreated(ctx context.Context, delAddr } // BeforeDelegationCreated indicates an expected call of BeforeDelegationCreated. -func (mr *MockStakingHooksMockRecorder) BeforeDelegationCreated(ctx, delAddr, valAddr interface{}) *gomock.Call { +func (mr *MockStakingHooksMockRecorder) BeforeDelegationCreated(ctx, delAddr, valAddr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BeforeDelegationCreated", reflect.TypeOf((*MockStakingHooks)(nil).BeforeDelegationCreated), ctx, delAddr, valAddr) } @@ -490,7 +499,7 @@ func (m *MockStakingHooks) BeforeDelegationRemoved(ctx context.Context, delAddr } // BeforeDelegationRemoved indicates an expected call of BeforeDelegationRemoved. -func (mr *MockStakingHooksMockRecorder) BeforeDelegationRemoved(ctx, delAddr, valAddr interface{}) *gomock.Call { +func (mr *MockStakingHooksMockRecorder) BeforeDelegationRemoved(ctx, delAddr, valAddr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BeforeDelegationRemoved", reflect.TypeOf((*MockStakingHooks)(nil).BeforeDelegationRemoved), ctx, delAddr, valAddr) } @@ -504,7 +513,7 @@ func (m *MockStakingHooks) BeforeDelegationSharesModified(ctx context.Context, d } // BeforeDelegationSharesModified indicates an expected call of BeforeDelegationSharesModified. -func (mr *MockStakingHooksMockRecorder) BeforeDelegationSharesModified(ctx, delAddr, valAddr interface{}) *gomock.Call { +func (mr *MockStakingHooksMockRecorder) BeforeDelegationSharesModified(ctx, delAddr, valAddr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BeforeDelegationSharesModified", reflect.TypeOf((*MockStakingHooks)(nil).BeforeDelegationSharesModified), ctx, delAddr, valAddr) } @@ -518,7 +527,7 @@ func (m *MockStakingHooks) BeforeValidatorModified(ctx context.Context, valAddr } // BeforeValidatorModified indicates an expected call of BeforeValidatorModified. -func (mr *MockStakingHooksMockRecorder) BeforeValidatorModified(ctx, valAddr interface{}) *gomock.Call { +func (mr *MockStakingHooksMockRecorder) BeforeValidatorModified(ctx, valAddr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BeforeValidatorModified", reflect.TypeOf((*MockStakingHooks)(nil).BeforeValidatorModified), ctx, valAddr) } @@ -532,7 +541,7 @@ func (m *MockStakingHooks) BeforeValidatorSlashed(ctx context.Context, valAddr t } // BeforeValidatorSlashed indicates an expected call of BeforeValidatorSlashed. -func (mr *MockStakingHooksMockRecorder) BeforeValidatorSlashed(ctx, valAddr, fraction interface{}) *gomock.Call { +func (mr *MockStakingHooksMockRecorder) BeforeValidatorSlashed(ctx, valAddr, fraction any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BeforeValidatorSlashed", reflect.TypeOf((*MockStakingHooks)(nil).BeforeValidatorSlashed), ctx, valAddr, fraction) } diff --git a/x/staking/go.mod b/x/staking/go.mod index 44e95461200a..902634281cd4 100644 --- a/x/staking/go.mod +++ b/x/staking/go.mod @@ -16,13 +16,13 @@ require ( github.com/cosmos/cosmos-proto v1.0.0-beta.5 github.com/cosmos/cosmos-sdk v0.53.0 github.com/cosmos/gogoproto v1.7.0 - github.com/golang/mock v1.6.0 github.com/golang/protobuf v1.5.4 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/hashicorp/go-metrics v0.5.3 // indirect github.com/spf13/cobra v1.8.1 github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.9.0 + go.uber.org/mock v0.5.0 google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 google.golang.org/grpc v1.67.1 google.golang.org/protobuf v1.35.1 @@ -135,13 +135,13 @@ require ( go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.28.0 // indirect - golang.org/x/mod v0.17.0 // indirect + golang.org/x/mod v0.18.0 // indirect golang.org/x/net v0.29.0 // indirect golang.org/x/sync v0.8.0 // indirect golang.org/x/sys v0.26.0 // indirect golang.org/x/term v0.25.0 // indirect golang.org/x/text v0.19.0 // indirect - golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect + golang.org/x/tools v0.22.0 // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/x/staking/go.sum b/x/staking/go.sum index 5c05f884e0eb..505182c3fbb8 100644 --- a/x/staking/go.sum +++ b/x/staking/go.sum @@ -484,7 +484,6 @@ github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EU github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= @@ -522,9 +521,8 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0= +golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -555,7 +553,6 @@ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -617,9 +614,8 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= +golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/x/staking/keeper/cons_pubkey_test.go b/x/staking/keeper/cons_pubkey_test.go index aeaca41ecb43..b91ef5279a32 100644 --- a/x/staking/keeper/cons_pubkey_test.go +++ b/x/staking/keeper/cons_pubkey_test.go @@ -3,7 +3,7 @@ package keeper_test import ( "time" - "github.com/golang/mock/gomock" + "go.uber.org/mock/gomock" "cosmossdk.io/collections" "cosmossdk.io/core/header" diff --git a/x/staking/keeper/delegation_test.go b/x/staking/keeper/delegation_test.go index 662d5a5bdcfc..00ee26d4bda8 100644 --- a/x/staking/keeper/delegation_test.go +++ b/x/staking/keeper/delegation_test.go @@ -3,7 +3,7 @@ package keeper_test import ( "time" - "github.com/golang/mock/gomock" + "go.uber.org/mock/gomock" "cosmossdk.io/collections" coreheader "cosmossdk.io/core/header" diff --git a/x/staking/keeper/keeper_test.go b/x/staking/keeper/keeper_test.go index 24e0f1bd7437..9043e261d25d 100644 --- a/x/staking/keeper/keeper_test.go +++ b/x/staking/keeper/keeper_test.go @@ -5,8 +5,8 @@ import ( "time" gogotypes "github.com/cosmos/gogoproto/types" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" + "go.uber.org/mock/gomock" "cosmossdk.io/collections" "cosmossdk.io/core/header" diff --git a/x/staking/keeper/msg_server_test.go b/x/staking/keeper/msg_server_test.go index b5d92d62f535..d87a90b7f5c1 100644 --- a/x/staking/keeper/msg_server_test.go +++ b/x/staking/keeper/msg_server_test.go @@ -4,7 +4,7 @@ import ( "testing" "time" - "github.com/golang/mock/gomock" + "go.uber.org/mock/gomock" "cosmossdk.io/collections" "cosmossdk.io/core/header" diff --git a/x/staking/keeper/validator_test.go b/x/staking/keeper/validator_test.go index 9780823a6e66..20cd57b228c4 100644 --- a/x/staking/keeper/validator_test.go +++ b/x/staking/keeper/validator_test.go @@ -3,7 +3,7 @@ package keeper_test import ( "time" - "github.com/golang/mock/gomock" + "go.uber.org/mock/gomock" "cosmossdk.io/collections" "cosmossdk.io/core/appmodule" diff --git a/x/staking/testutil/expected_keepers_mocks.go b/x/staking/testutil/expected_keepers_mocks.go index 322243108cf5..d2bd42c4505d 100644 --- a/x/staking/testutil/expected_keepers_mocks.go +++ b/x/staking/testutil/expected_keepers_mocks.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: x/staking/types/expected_keepers.go +// +// Generated by this command: +// +// mockgen -source=x/staking/types/expected_keepers.go -package testutil -destination x/staking/testutil/expected_keepers_mocks.go +// // Package testutil is a generated GoMock package. package testutil @@ -14,13 +19,14 @@ import ( types "cosmossdk.io/x/staking/types" types0 "github.com/cosmos/cosmos-sdk/crypto/types" types1 "github.com/cosmos/cosmos-sdk/types" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockAccountKeeper is a mock of AccountKeeper interface. type MockAccountKeeper struct { ctrl *gomock.Controller recorder *MockAccountKeeperMockRecorder + isgomock struct{} } // MockAccountKeeperMockRecorder is the mock recorder for MockAccountKeeper. @@ -63,7 +69,7 @@ func (m *MockAccountKeeper) GetAccount(ctx context.Context, addr types1.AccAddre } // GetAccount indicates an expected call of GetAccount. -func (mr *MockAccountKeeperMockRecorder) GetAccount(ctx, addr interface{}) *gomock.Call { +func (mr *MockAccountKeeperMockRecorder) GetAccount(ctx, addr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccount", reflect.TypeOf((*MockAccountKeeper)(nil).GetAccount), ctx, addr) } @@ -77,7 +83,7 @@ func (m *MockAccountKeeper) GetModuleAccount(ctx context.Context, moduleName str } // GetModuleAccount indicates an expected call of GetModuleAccount. -func (mr *MockAccountKeeperMockRecorder) GetModuleAccount(ctx, moduleName interface{}) *gomock.Call { +func (mr *MockAccountKeeperMockRecorder) GetModuleAccount(ctx, moduleName any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetModuleAccount", reflect.TypeOf((*MockAccountKeeper)(nil).GetModuleAccount), ctx, moduleName) } @@ -91,7 +97,7 @@ func (m *MockAccountKeeper) GetModuleAddress(name string) types1.AccAddress { } // GetModuleAddress indicates an expected call of GetModuleAddress. -func (mr *MockAccountKeeperMockRecorder) GetModuleAddress(name interface{}) *gomock.Call { +func (mr *MockAccountKeeperMockRecorder) GetModuleAddress(name any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetModuleAddress", reflect.TypeOf((*MockAccountKeeper)(nil).GetModuleAddress), name) } @@ -103,7 +109,7 @@ func (m *MockAccountKeeper) SetModuleAccount(arg0 context.Context, arg1 types1.M } // SetModuleAccount indicates an expected call of SetModuleAccount. -func (mr *MockAccountKeeperMockRecorder) SetModuleAccount(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAccountKeeperMockRecorder) SetModuleAccount(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetModuleAccount", reflect.TypeOf((*MockAccountKeeper)(nil).SetModuleAccount), arg0, arg1) } @@ -112,6 +118,7 @@ func (mr *MockAccountKeeperMockRecorder) SetModuleAccount(arg0, arg1 interface{} type MockBankKeeper struct { ctrl *gomock.Controller recorder *MockBankKeeperMockRecorder + isgomock struct{} } // MockBankKeeperMockRecorder is the mock recorder for MockBankKeeper. @@ -140,7 +147,7 @@ func (m *MockBankKeeper) BurnCoins(arg0 context.Context, arg1 []byte, arg2 types } // BurnCoins indicates an expected call of BurnCoins. -func (mr *MockBankKeeperMockRecorder) BurnCoins(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) BurnCoins(arg0, arg1, arg2 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BurnCoins", reflect.TypeOf((*MockBankKeeper)(nil).BurnCoins), arg0, arg1, arg2) } @@ -154,7 +161,7 @@ func (m *MockBankKeeper) DelegateCoinsFromAccountToModule(ctx context.Context, s } // DelegateCoinsFromAccountToModule indicates an expected call of DelegateCoinsFromAccountToModule. -func (mr *MockBankKeeperMockRecorder) DelegateCoinsFromAccountToModule(ctx, senderAddr, recipientModule, amt interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) DelegateCoinsFromAccountToModule(ctx, senderAddr, recipientModule, amt any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DelegateCoinsFromAccountToModule", reflect.TypeOf((*MockBankKeeper)(nil).DelegateCoinsFromAccountToModule), ctx, senderAddr, recipientModule, amt) } @@ -168,7 +175,7 @@ func (m *MockBankKeeper) GetAllBalances(ctx context.Context, addr types1.AccAddr } // GetAllBalances indicates an expected call of GetAllBalances. -func (mr *MockBankKeeperMockRecorder) GetAllBalances(ctx, addr interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) GetAllBalances(ctx, addr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllBalances", reflect.TypeOf((*MockBankKeeper)(nil).GetAllBalances), ctx, addr) } @@ -182,7 +189,7 @@ func (m *MockBankKeeper) GetBalance(ctx context.Context, addr types1.AccAddress, } // GetBalance indicates an expected call of GetBalance. -func (mr *MockBankKeeperMockRecorder) GetBalance(ctx, addr, denom interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) GetBalance(ctx, addr, denom any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBalance", reflect.TypeOf((*MockBankKeeper)(nil).GetBalance), ctx, addr, denom) } @@ -196,7 +203,7 @@ func (m *MockBankKeeper) GetSupply(ctx context.Context, denom string) types1.Coi } // GetSupply indicates an expected call of GetSupply. -func (mr *MockBankKeeperMockRecorder) GetSupply(ctx, denom interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) GetSupply(ctx, denom any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSupply", reflect.TypeOf((*MockBankKeeper)(nil).GetSupply), ctx, denom) } @@ -210,7 +217,7 @@ func (m *MockBankKeeper) IsSendEnabledDenom(ctx context.Context, denom string) b } // IsSendEnabledDenom indicates an expected call of IsSendEnabledDenom. -func (mr *MockBankKeeperMockRecorder) IsSendEnabledDenom(ctx, denom interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) IsSendEnabledDenom(ctx, denom any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsSendEnabledDenom", reflect.TypeOf((*MockBankKeeper)(nil).IsSendEnabledDenom), ctx, denom) } @@ -224,7 +231,7 @@ func (m *MockBankKeeper) LockedCoins(ctx context.Context, addr types1.AccAddress } // LockedCoins indicates an expected call of LockedCoins. -func (mr *MockBankKeeperMockRecorder) LockedCoins(ctx, addr interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) LockedCoins(ctx, addr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LockedCoins", reflect.TypeOf((*MockBankKeeper)(nil).LockedCoins), ctx, addr) } @@ -238,7 +245,7 @@ func (m *MockBankKeeper) SendCoinsFromAccountToModule(ctx context.Context, sende } // SendCoinsFromAccountToModule indicates an expected call of SendCoinsFromAccountToModule. -func (mr *MockBankKeeperMockRecorder) SendCoinsFromAccountToModule(ctx, senderAddr, recipientModule, amt interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) SendCoinsFromAccountToModule(ctx, senderAddr, recipientModule, amt any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromAccountToModule", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromAccountToModule), ctx, senderAddr, recipientModule, amt) } @@ -252,7 +259,7 @@ func (m *MockBankKeeper) SendCoinsFromModuleToModule(ctx context.Context, sender } // SendCoinsFromModuleToModule indicates an expected call of SendCoinsFromModuleToModule. -func (mr *MockBankKeeperMockRecorder) SendCoinsFromModuleToModule(ctx, senderPool, recipientPool, amt interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) SendCoinsFromModuleToModule(ctx, senderPool, recipientPool, amt any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromModuleToModule", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromModuleToModule), ctx, senderPool, recipientPool, amt) } @@ -266,7 +273,7 @@ func (m *MockBankKeeper) SpendableCoins(ctx context.Context, addr types1.AccAddr } // SpendableCoins indicates an expected call of SpendableCoins. -func (mr *MockBankKeeperMockRecorder) SpendableCoins(ctx, addr interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) SpendableCoins(ctx, addr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SpendableCoins", reflect.TypeOf((*MockBankKeeper)(nil).SpendableCoins), ctx, addr) } @@ -280,7 +287,7 @@ func (m *MockBankKeeper) UndelegateCoinsFromModuleToAccount(ctx context.Context, } // UndelegateCoinsFromModuleToAccount indicates an expected call of UndelegateCoinsFromModuleToAccount. -func (mr *MockBankKeeperMockRecorder) UndelegateCoinsFromModuleToAccount(ctx, senderModule, recipientAddr, amt interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) UndelegateCoinsFromModuleToAccount(ctx, senderModule, recipientAddr, amt any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UndelegateCoinsFromModuleToAccount", reflect.TypeOf((*MockBankKeeper)(nil).UndelegateCoinsFromModuleToAccount), ctx, senderModule, recipientAddr, amt) } @@ -289,6 +296,7 @@ func (mr *MockBankKeeperMockRecorder) UndelegateCoinsFromModuleToAccount(ctx, se type MockValidatorSet struct { ctrl *gomock.Controller recorder *MockValidatorSetMockRecorder + isgomock struct{} } // MockValidatorSetMockRecorder is the mock recorder for MockValidatorSet. @@ -318,7 +326,7 @@ func (m *MockValidatorSet) Delegation(arg0 context.Context, arg1 types1.AccAddre } // Delegation indicates an expected call of Delegation. -func (mr *MockValidatorSetMockRecorder) Delegation(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockValidatorSetMockRecorder) Delegation(arg0, arg1, arg2 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delegation", reflect.TypeOf((*MockValidatorSet)(nil).Delegation), arg0, arg1, arg2) } @@ -333,7 +341,7 @@ func (m *MockValidatorSet) GetPubKeyByConsAddr(arg0 context.Context, arg1 types1 } // GetPubKeyByConsAddr indicates an expected call of GetPubKeyByConsAddr. -func (mr *MockValidatorSetMockRecorder) GetPubKeyByConsAddr(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockValidatorSetMockRecorder) GetPubKeyByConsAddr(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPubKeyByConsAddr", reflect.TypeOf((*MockValidatorSet)(nil).GetPubKeyByConsAddr), arg0, arg1) } @@ -347,7 +355,7 @@ func (m *MockValidatorSet) IterateBondedValidatorsByPower(arg0 context.Context, } // IterateBondedValidatorsByPower indicates an expected call of IterateBondedValidatorsByPower. -func (mr *MockValidatorSetMockRecorder) IterateBondedValidatorsByPower(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockValidatorSetMockRecorder) IterateBondedValidatorsByPower(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IterateBondedValidatorsByPower", reflect.TypeOf((*MockValidatorSet)(nil).IterateBondedValidatorsByPower), arg0, arg1) } @@ -361,7 +369,7 @@ func (m *MockValidatorSet) IterateValidators(arg0 context.Context, arg1 func(int } // IterateValidators indicates an expected call of IterateValidators. -func (mr *MockValidatorSetMockRecorder) IterateValidators(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockValidatorSetMockRecorder) IterateValidators(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IterateValidators", reflect.TypeOf((*MockValidatorSet)(nil).IterateValidators), arg0, arg1) } @@ -375,7 +383,7 @@ func (m *MockValidatorSet) Jail(arg0 context.Context, arg1 types1.ConsAddress) e } // Jail indicates an expected call of Jail. -func (mr *MockValidatorSetMockRecorder) Jail(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockValidatorSetMockRecorder) Jail(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Jail", reflect.TypeOf((*MockValidatorSet)(nil).Jail), arg0, arg1) } @@ -390,7 +398,7 @@ func (m *MockValidatorSet) MaxValidators(arg0 context.Context) (uint32, error) { } // MaxValidators indicates an expected call of MaxValidators. -func (mr *MockValidatorSetMockRecorder) MaxValidators(arg0 interface{}) *gomock.Call { +func (mr *MockValidatorSetMockRecorder) MaxValidators(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MaxValidators", reflect.TypeOf((*MockValidatorSet)(nil).MaxValidators), arg0) } @@ -405,7 +413,7 @@ func (m *MockValidatorSet) Slash(arg0 context.Context, arg1 types1.ConsAddress, } // Slash indicates an expected call of Slash. -func (mr *MockValidatorSetMockRecorder) Slash(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { +func (mr *MockValidatorSetMockRecorder) Slash(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Slash", reflect.TypeOf((*MockValidatorSet)(nil).Slash), arg0, arg1, arg2, arg3, arg4) } @@ -420,7 +428,7 @@ func (m *MockValidatorSet) SlashWithInfractionReason(arg0 context.Context, arg1 } // SlashWithInfractionReason indicates an expected call of SlashWithInfractionReason. -func (mr *MockValidatorSetMockRecorder) SlashWithInfractionReason(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call { +func (mr *MockValidatorSetMockRecorder) SlashWithInfractionReason(arg0, arg1, arg2, arg3, arg4, arg5 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SlashWithInfractionReason", reflect.TypeOf((*MockValidatorSet)(nil).SlashWithInfractionReason), arg0, arg1, arg2, arg3, arg4, arg5) } @@ -435,7 +443,7 @@ func (m *MockValidatorSet) StakingTokenSupply(arg0 context.Context) (math.Int, e } // StakingTokenSupply indicates an expected call of StakingTokenSupply. -func (mr *MockValidatorSetMockRecorder) StakingTokenSupply(arg0 interface{}) *gomock.Call { +func (mr *MockValidatorSetMockRecorder) StakingTokenSupply(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StakingTokenSupply", reflect.TypeOf((*MockValidatorSet)(nil).StakingTokenSupply), arg0) } @@ -450,7 +458,7 @@ func (m *MockValidatorSet) TotalBondedTokens(arg0 context.Context) (math.Int, er } // TotalBondedTokens indicates an expected call of TotalBondedTokens. -func (mr *MockValidatorSetMockRecorder) TotalBondedTokens(arg0 interface{}) *gomock.Call { +func (mr *MockValidatorSetMockRecorder) TotalBondedTokens(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TotalBondedTokens", reflect.TypeOf((*MockValidatorSet)(nil).TotalBondedTokens), arg0) } @@ -464,7 +472,7 @@ func (m *MockValidatorSet) Unjail(arg0 context.Context, arg1 types1.ConsAddress) } // Unjail indicates an expected call of Unjail. -func (mr *MockValidatorSetMockRecorder) Unjail(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockValidatorSetMockRecorder) Unjail(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Unjail", reflect.TypeOf((*MockValidatorSet)(nil).Unjail), arg0, arg1) } @@ -479,7 +487,7 @@ func (m *MockValidatorSet) Validator(arg0 context.Context, arg1 types1.ValAddres } // Validator indicates an expected call of Validator. -func (mr *MockValidatorSetMockRecorder) Validator(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockValidatorSetMockRecorder) Validator(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Validator", reflect.TypeOf((*MockValidatorSet)(nil).Validator), arg0, arg1) } @@ -494,7 +502,7 @@ func (m *MockValidatorSet) ValidatorByConsAddr(arg0 context.Context, arg1 types1 } // ValidatorByConsAddr indicates an expected call of ValidatorByConsAddr. -func (mr *MockValidatorSetMockRecorder) ValidatorByConsAddr(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockValidatorSetMockRecorder) ValidatorByConsAddr(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidatorByConsAddr", reflect.TypeOf((*MockValidatorSet)(nil).ValidatorByConsAddr), arg0, arg1) } @@ -503,6 +511,7 @@ func (mr *MockValidatorSetMockRecorder) ValidatorByConsAddr(arg0, arg1 interface type MockDelegationSet struct { ctrl *gomock.Controller recorder *MockDelegationSetMockRecorder + isgomock struct{} } // MockDelegationSetMockRecorder is the mock recorder for MockDelegationSet. @@ -545,7 +554,7 @@ func (m *MockDelegationSet) IterateDelegations(ctx context.Context, delegator ty } // IterateDelegations indicates an expected call of IterateDelegations. -func (mr *MockDelegationSetMockRecorder) IterateDelegations(ctx, delegator, fn interface{}) *gomock.Call { +func (mr *MockDelegationSetMockRecorder) IterateDelegations(ctx, delegator, fn any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IterateDelegations", reflect.TypeOf((*MockDelegationSet)(nil).IterateDelegations), ctx, delegator, fn) } @@ -554,6 +563,7 @@ func (mr *MockDelegationSetMockRecorder) IterateDelegations(ctx, delegator, fn i type MockStakingHooks struct { ctrl *gomock.Controller recorder *MockStakingHooksMockRecorder + isgomock struct{} } // MockStakingHooksMockRecorder is the mock recorder for MockStakingHooks. @@ -582,7 +592,7 @@ func (m *MockStakingHooks) AfterConsensusPubKeyUpdate(ctx context.Context, oldPu } // AfterConsensusPubKeyUpdate indicates an expected call of AfterConsensusPubKeyUpdate. -func (mr *MockStakingHooksMockRecorder) AfterConsensusPubKeyUpdate(ctx, oldPubKey, newPubKey, rotationFee interface{}) *gomock.Call { +func (mr *MockStakingHooksMockRecorder) AfterConsensusPubKeyUpdate(ctx, oldPubKey, newPubKey, rotationFee any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AfterConsensusPubKeyUpdate", reflect.TypeOf((*MockStakingHooks)(nil).AfterConsensusPubKeyUpdate), ctx, oldPubKey, newPubKey, rotationFee) } @@ -596,7 +606,7 @@ func (m *MockStakingHooks) AfterDelegationModified(ctx context.Context, delAddr } // AfterDelegationModified indicates an expected call of AfterDelegationModified. -func (mr *MockStakingHooksMockRecorder) AfterDelegationModified(ctx, delAddr, valAddr interface{}) *gomock.Call { +func (mr *MockStakingHooksMockRecorder) AfterDelegationModified(ctx, delAddr, valAddr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AfterDelegationModified", reflect.TypeOf((*MockStakingHooks)(nil).AfterDelegationModified), ctx, delAddr, valAddr) } @@ -610,7 +620,7 @@ func (m *MockStakingHooks) AfterUnbondingInitiated(ctx context.Context, id uint6 } // AfterUnbondingInitiated indicates an expected call of AfterUnbondingInitiated. -func (mr *MockStakingHooksMockRecorder) AfterUnbondingInitiated(ctx, id interface{}) *gomock.Call { +func (mr *MockStakingHooksMockRecorder) AfterUnbondingInitiated(ctx, id any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AfterUnbondingInitiated", reflect.TypeOf((*MockStakingHooks)(nil).AfterUnbondingInitiated), ctx, id) } @@ -624,7 +634,7 @@ func (m *MockStakingHooks) AfterValidatorBeginUnbonding(ctx context.Context, con } // AfterValidatorBeginUnbonding indicates an expected call of AfterValidatorBeginUnbonding. -func (mr *MockStakingHooksMockRecorder) AfterValidatorBeginUnbonding(ctx, consAddr, valAddr interface{}) *gomock.Call { +func (mr *MockStakingHooksMockRecorder) AfterValidatorBeginUnbonding(ctx, consAddr, valAddr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AfterValidatorBeginUnbonding", reflect.TypeOf((*MockStakingHooks)(nil).AfterValidatorBeginUnbonding), ctx, consAddr, valAddr) } @@ -638,7 +648,7 @@ func (m *MockStakingHooks) AfterValidatorBonded(ctx context.Context, consAddr ty } // AfterValidatorBonded indicates an expected call of AfterValidatorBonded. -func (mr *MockStakingHooksMockRecorder) AfterValidatorBonded(ctx, consAddr, valAddr interface{}) *gomock.Call { +func (mr *MockStakingHooksMockRecorder) AfterValidatorBonded(ctx, consAddr, valAddr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AfterValidatorBonded", reflect.TypeOf((*MockStakingHooks)(nil).AfterValidatorBonded), ctx, consAddr, valAddr) } @@ -652,7 +662,7 @@ func (m *MockStakingHooks) AfterValidatorCreated(ctx context.Context, valAddr ty } // AfterValidatorCreated indicates an expected call of AfterValidatorCreated. -func (mr *MockStakingHooksMockRecorder) AfterValidatorCreated(ctx, valAddr interface{}) *gomock.Call { +func (mr *MockStakingHooksMockRecorder) AfterValidatorCreated(ctx, valAddr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AfterValidatorCreated", reflect.TypeOf((*MockStakingHooks)(nil).AfterValidatorCreated), ctx, valAddr) } @@ -666,7 +676,7 @@ func (m *MockStakingHooks) AfterValidatorRemoved(ctx context.Context, consAddr t } // AfterValidatorRemoved indicates an expected call of AfterValidatorRemoved. -func (mr *MockStakingHooksMockRecorder) AfterValidatorRemoved(ctx, consAddr, valAddr interface{}) *gomock.Call { +func (mr *MockStakingHooksMockRecorder) AfterValidatorRemoved(ctx, consAddr, valAddr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AfterValidatorRemoved", reflect.TypeOf((*MockStakingHooks)(nil).AfterValidatorRemoved), ctx, consAddr, valAddr) } @@ -680,7 +690,7 @@ func (m *MockStakingHooks) BeforeDelegationCreated(ctx context.Context, delAddr } // BeforeDelegationCreated indicates an expected call of BeforeDelegationCreated. -func (mr *MockStakingHooksMockRecorder) BeforeDelegationCreated(ctx, delAddr, valAddr interface{}) *gomock.Call { +func (mr *MockStakingHooksMockRecorder) BeforeDelegationCreated(ctx, delAddr, valAddr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BeforeDelegationCreated", reflect.TypeOf((*MockStakingHooks)(nil).BeforeDelegationCreated), ctx, delAddr, valAddr) } @@ -694,7 +704,7 @@ func (m *MockStakingHooks) BeforeDelegationRemoved(ctx context.Context, delAddr } // BeforeDelegationRemoved indicates an expected call of BeforeDelegationRemoved. -func (mr *MockStakingHooksMockRecorder) BeforeDelegationRemoved(ctx, delAddr, valAddr interface{}) *gomock.Call { +func (mr *MockStakingHooksMockRecorder) BeforeDelegationRemoved(ctx, delAddr, valAddr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BeforeDelegationRemoved", reflect.TypeOf((*MockStakingHooks)(nil).BeforeDelegationRemoved), ctx, delAddr, valAddr) } @@ -708,7 +718,7 @@ func (m *MockStakingHooks) BeforeDelegationSharesModified(ctx context.Context, d } // BeforeDelegationSharesModified indicates an expected call of BeforeDelegationSharesModified. -func (mr *MockStakingHooksMockRecorder) BeforeDelegationSharesModified(ctx, delAddr, valAddr interface{}) *gomock.Call { +func (mr *MockStakingHooksMockRecorder) BeforeDelegationSharesModified(ctx, delAddr, valAddr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BeforeDelegationSharesModified", reflect.TypeOf((*MockStakingHooks)(nil).BeforeDelegationSharesModified), ctx, delAddr, valAddr) } @@ -722,7 +732,7 @@ func (m *MockStakingHooks) BeforeValidatorModified(ctx context.Context, valAddr } // BeforeValidatorModified indicates an expected call of BeforeValidatorModified. -func (mr *MockStakingHooksMockRecorder) BeforeValidatorModified(ctx, valAddr interface{}) *gomock.Call { +func (mr *MockStakingHooksMockRecorder) BeforeValidatorModified(ctx, valAddr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BeforeValidatorModified", reflect.TypeOf((*MockStakingHooks)(nil).BeforeValidatorModified), ctx, valAddr) } @@ -736,7 +746,7 @@ func (m *MockStakingHooks) BeforeValidatorSlashed(ctx context.Context, valAddr t } // BeforeValidatorSlashed indicates an expected call of BeforeValidatorSlashed. -func (mr *MockStakingHooksMockRecorder) BeforeValidatorSlashed(ctx, valAddr, fraction interface{}) *gomock.Call { +func (mr *MockStakingHooksMockRecorder) BeforeValidatorSlashed(ctx, valAddr, fraction any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BeforeValidatorSlashed", reflect.TypeOf((*MockStakingHooks)(nil).BeforeValidatorSlashed), ctx, valAddr, fraction) } @@ -745,6 +755,7 @@ func (mr *MockStakingHooksMockRecorder) BeforeValidatorSlashed(ctx, valAddr, fra type MockConsensusKeeper struct { ctrl *gomock.Controller recorder *MockConsensusKeeperMockRecorder + isgomock struct{} } // MockConsensusKeeperMockRecorder is the mock recorder for MockConsensusKeeper. @@ -774,7 +785,7 @@ func (m *MockConsensusKeeper) ValidatorPubKeyTypes(arg0 context.Context) ([]stri } // ValidatorPubKeyTypes indicates an expected call of ValidatorPubKeyTypes. -func (mr *MockConsensusKeeperMockRecorder) ValidatorPubKeyTypes(arg0 interface{}) *gomock.Call { +func (mr *MockConsensusKeeperMockRecorder) ValidatorPubKeyTypes(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidatorPubKeyTypes", reflect.TypeOf((*MockConsensusKeeper)(nil).ValidatorPubKeyTypes), arg0) } diff --git a/x/upgrade/go.mod b/x/upgrade/go.mod index 122dbd8d25da..e775340906f8 100644 --- a/x/upgrade/go.mod +++ b/x/upgrade/go.mod @@ -16,7 +16,6 @@ require ( github.com/cosmos/cosmos-proto v1.0.0-beta.5 github.com/cosmos/cosmos-sdk v0.53.0 github.com/cosmos/gogoproto v1.7.0 - github.com/golang/mock v1.6.0 github.com/golang/protobuf v1.5.4 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/hashicorp/go-cleanhttp v0.5.2 @@ -26,6 +25,7 @@ require ( github.com/spf13/cobra v1.8.1 github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.9.0 + go.uber.org/mock v0.5.0 google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 google.golang.org/grpc v1.67.1 google.golang.org/protobuf v1.35.1 @@ -179,7 +179,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.28.0 // indirect golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect - golang.org/x/mod v0.17.0 // indirect + golang.org/x/mod v0.18.0 // indirect golang.org/x/net v0.29.0 // indirect golang.org/x/oauth2 v0.23.0 // indirect golang.org/x/sync v0.8.0 // indirect @@ -187,7 +187,7 @@ require ( golang.org/x/term v0.25.0 // indirect golang.org/x/text v0.19.0 // indirect golang.org/x/time v0.6.0 // indirect - golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect + golang.org/x/tools v0.22.0 // indirect google.golang.org/api v0.192.0 // indirect google.golang.org/genproto v0.0.0-20240814211410-ddb44dafa142 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f // indirect diff --git a/x/upgrade/go.sum b/x/upgrade/go.sum index 21f78ea56ae4..88553d2d67cb 100644 --- a/x/upgrade/go.sum +++ b/x/upgrade/go.sum @@ -891,8 +891,8 @@ golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0= +golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1152,8 +1152,8 @@ golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= +golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/x/upgrade/keeper/abci_test.go b/x/upgrade/keeper/abci_test.go index 8838abbd469b..41cf9ebe94ed 100644 --- a/x/upgrade/keeper/abci_test.go +++ b/x/upgrade/keeper/abci_test.go @@ -8,8 +8,8 @@ import ( "time" cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" "cosmossdk.io/core/appmodule" "cosmossdk.io/core/header" diff --git a/x/upgrade/keeper/grpc_query_test.go b/x/upgrade/keeper/grpc_query_test.go index df97a2e72249..2f6b2e4b301d 100644 --- a/x/upgrade/keeper/grpc_query_test.go +++ b/x/upgrade/keeper/grpc_query_test.go @@ -5,8 +5,8 @@ import ( "fmt" "testing" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" + "go.uber.org/mock/gomock" "cosmossdk.io/core/appmodule" "cosmossdk.io/core/header" diff --git a/x/upgrade/keeper/keeper_test.go b/x/upgrade/keeper/keeper_test.go index 66297a3fe6d9..8d18641789f0 100644 --- a/x/upgrade/keeper/keeper_test.go +++ b/x/upgrade/keeper/keeper_test.go @@ -7,8 +7,8 @@ import ( cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1" cmttypes "github.com/cometbft/cometbft/types" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" + "go.uber.org/mock/gomock" "cosmossdk.io/core/appmodule" "cosmossdk.io/core/header" diff --git a/x/upgrade/testutil/expected_keepers_mocks.go b/x/upgrade/testutil/expected_keepers_mocks.go index 31d3d209248f..c4931f946129 100644 --- a/x/upgrade/testutil/expected_keepers_mocks.go +++ b/x/upgrade/testutil/expected_keepers_mocks.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: x/upgrade/types/expected_keepers.go +// +// Generated by this command: +// +// mockgen -source=x/upgrade/types/expected_keepers.go -package testutil -destination x/upgrade/testutil/expected_keepers_mocks.go +// // Package testutil is a generated GoMock package. package testutil @@ -8,13 +13,14 @@ import ( context "context" reflect "reflect" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockConsensusKeeper is a mock of ConsensusKeeper interface. type MockConsensusKeeper struct { ctrl *gomock.Controller recorder *MockConsensusKeeperMockRecorder + isgomock struct{} } // MockConsensusKeeperMockRecorder is the mock recorder for MockConsensusKeeper. @@ -44,7 +50,7 @@ func (m *MockConsensusKeeper) AppVersion(ctx context.Context) (uint64, error) { } // AppVersion indicates an expected call of AppVersion. -func (mr *MockConsensusKeeperMockRecorder) AppVersion(ctx interface{}) *gomock.Call { +func (mr *MockConsensusKeeperMockRecorder) AppVersion(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppVersion", reflect.TypeOf((*MockConsensusKeeper)(nil).AppVersion), ctx) } From 2f0a2b400c466d1cc463a48d31593813c3e17a5f Mon Sep 17 00:00:00 2001 From: Matt Kocubinski Date: Mon, 21 Oct 2024 06:28:43 -0500 Subject: [PATCH 57/57] refactor(x/tx): rm dependency on core (#22281) Co-authored-by: Julien Robert --- README.md | 2 +- x/tx/CHANGELOG.md | 2 ++ x/tx/decode/decode.go | 10 ++++++---- x/tx/go.mod | 1 - x/tx/go.sum | 2 -- x/tx/signing/context.go | 21 +++++++++++++-------- x/tx/signing/context_test.go | 5 ----- x/tx/signing/directaux/direct_aux_test.go | 3 --- 8 files changed, 22 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index b44232d3c006..36883246e05f 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ Core dependencies not mentioned here as compatible across all maintained SDK ver | Cosmos SDK | cosmossdk.io/core | cosmossdk.io/api | cosmossdk.io/x/tx | | ---------- | ----------------- | ---------------- | ----------------- | -| 0.52.z | 1.y.z | 0.8.z | 0.14.z | +| 0.52.z | 1.y.z | 0.8.z | 1.y.z | | 0.50.z | 0.11.z | 0.7.z | 0.13.z | | 0.47.z | 0.5.z | 0.3.z | N/A | diff --git a/x/tx/CHANGELOG.md b/x/tx/CHANGELOG.md index 182c6dbfefb5..bf8fccec6f84 100644 --- a/x/tx/CHANGELOG.md +++ b/x/tx/CHANGELOG.md @@ -33,6 +33,8 @@ Since v0.13.0, x/tx follows Cosmos SDK semver: https://github.com/cosmos/cosmos- ## [Unreleased] +## [v1.0.0-alpha.1](https://github.com/cosmos/cosmos-sdk/releases/tag/x/tx/v1.0.0-alpha.1) - 2024-10-17 + * [#21782](https://github.com/cosmos/cosmos-sdk/pull/21782) Fix JSON attribute sort order on messages with oneof fields. * [#21825](https://github.com/cosmos/cosmos-sdk/pull/21825) Fix decimal encoding and field ordering in Amino JSON encoder. * [#21850](https://github.com/cosmos/cosmos-sdk/pull/21850) Support bytes field as signer. diff --git a/x/tx/decode/decode.go b/x/tx/decode/decode.go index bf4f3a54f31f..61b01f77e43f 100644 --- a/x/tx/decode/decode.go +++ b/x/tx/decode/decode.go @@ -13,7 +13,6 @@ import ( "google.golang.org/protobuf/types/dynamicpb" v1beta1 "cosmossdk.io/api/cosmos/tx/v1beta1" - "cosmossdk.io/core/transaction" errorsmod "cosmossdk.io/errors" "cosmossdk.io/x/tx/signing" ) @@ -32,8 +31,11 @@ type DecodedTx struct { cachedBytes []byte cachedHashed bool } - -var _ transaction.Tx = &DecodedTx{} +type Msg = interface { + Reset() + String() string + ProtoMessage() +} type gogoProtoCodec interface { Unmarshal([]byte, gogoproto.Message) error @@ -192,7 +194,7 @@ func (dtx *DecodedTx) GetGasLimit() (uint64, error) { return dtx.Tx.AuthInfo.Fee.GasLimit, nil } -func (dtx *DecodedTx) GetMessages() ([]transaction.Msg, error) { +func (dtx *DecodedTx) GetMessages() ([]Msg, error) { if dtx == nil || dtx.Messages == nil { return nil, errors.New("messages not available or are nil") } diff --git a/x/tx/go.mod b/x/tx/go.mod index d430694f1dc7..42abe2a63b79 100644 --- a/x/tx/go.mod +++ b/x/tx/go.mod @@ -4,7 +4,6 @@ go 1.23 require ( cosmossdk.io/api v0.7.6 - cosmossdk.io/core v1.0.0-alpha.4 cosmossdk.io/errors v1.0.1 cosmossdk.io/math v1.3.0 github.com/cosmos/cosmos-proto v1.0.0-beta.5 diff --git a/x/tx/go.sum b/x/tx/go.sum index 0a507668b549..09bbde461a3f 100644 --- a/x/tx/go.sum +++ b/x/tx/go.sum @@ -1,7 +1,5 @@ cosmossdk.io/api v0.7.6 h1:PC20PcXy1xYKH2KU4RMurVoFjjKkCgYRbVAD4PdqUuY= cosmossdk.io/api v0.7.6/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= -cosmossdk.io/core v1.0.0-alpha.4 h1:9iuroT9ejDYETCsGkzkvs/wAY/5UFl7nCIINFRxyMJY= -cosmossdk.io/core v1.0.0-alpha.4/go.mod h1:3u9cWq1FAVtiiCrDPpo4LhR+9V6k/ycSG4/Y/tREWCY= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= diff --git a/x/tx/signing/context.go b/x/tx/signing/context.go index d02be6d12523..db02a100f79d 100644 --- a/x/tx/signing/context.go +++ b/x/tx/signing/context.go @@ -13,7 +13,6 @@ import ( "google.golang.org/protobuf/reflect/protoregistry" msgv1 "cosmossdk.io/api/cosmos/msg/v1" - "cosmossdk.io/core/address" ) type TypeResolver interface { @@ -21,6 +20,12 @@ type TypeResolver interface { protoregistry.ExtensionTypeResolver } +// AddressCodec is the cosmossdk.io/core/address codec interface used by the context. +type AddressCodec interface { + StringToBytes(string) ([]byte, error) + BytesToString([]byte) (string, error) +} + // Context is a context for retrieving the list of signers from a // message where signers are specified by the cosmos.msg.v1.signer protobuf // option. It also contains the ProtoFileResolver and address.Codec's used @@ -28,8 +33,8 @@ type TypeResolver interface { type Context struct { fileResolver ProtoFileResolver typeResolver protoregistry.MessageTypeResolver - addressCodec address.Codec - validatorAddressCodec address.Codec + addressCodec AddressCodec + validatorAddressCodec AddressCodec getSignersFuncs sync.Map customGetSignerFuncs map[protoreflect.FullName]GetSignersFunc maxRecursionDepth int @@ -45,10 +50,10 @@ type Options struct { TypeResolver TypeResolver // AddressCodec is the codec for converting addresses between strings and bytes. - AddressCodec address.Codec + AddressCodec AddressCodec // ValidatorAddressCodec is the codec for converting validator addresses between strings and bytes. - ValidatorAddressCodec address.Codec + ValidatorAddressCodec AddressCodec // CustomGetSigners is a map of message types to custom GetSignersFuncs. CustomGetSigners map[protoreflect.FullName]GetSignersFunc @@ -323,7 +328,7 @@ func (c *Context) makeGetSignersFunc(descriptor protoreflect.MessageDescriptor) }, nil } -func (c *Context) getAddressCodec(field protoreflect.FieldDescriptor) address.Codec { +func (c *Context) getAddressCodec(field protoreflect.FieldDescriptor) AddressCodec { scalarOpt := proto.GetExtension(field.Options(), cosmos_proto.E_Scalar) addrCdc := c.addressCodec if scalarOpt != nil { @@ -367,12 +372,12 @@ func (c *Context) GetSigners(msg proto.Message) ([][]byte, error) { } // AddressCodec returns the address codec used by the context. -func (c *Context) AddressCodec() address.Codec { +func (c *Context) AddressCodec() AddressCodec { return c.addressCodec } // ValidatorAddressCodec returns the validator address codec used by the context. -func (c *Context) ValidatorAddressCodec() address.Codec { +func (c *Context) ValidatorAddressCodec() AddressCodec { return c.validatorAddressCodec } diff --git a/x/tx/signing/context_test.go b/x/tx/signing/context_test.go index 88f0bf4aadf9..8fb83d327f3d 100644 --- a/x/tx/signing/context_test.go +++ b/x/tx/signing/context_test.go @@ -10,7 +10,6 @@ import ( bankv1beta1 "cosmossdk.io/api/cosmos/bank/v1beta1" groupv1 "cosmossdk.io/api/cosmos/group/v1" - "cosmossdk.io/core/address" "cosmossdk.io/x/tx/internal/testpb" ) @@ -280,8 +279,6 @@ func (d dummyAddressCodec) BytesToString(bz []byte) (string, error) { return hex.EncodeToString(bz), nil } -var _ address.Codec = dummyAddressCodec{} - type dummyValidatorAddressCodec struct{} func (d dummyValidatorAddressCodec) StringToBytes(text string) ([]byte, error) { @@ -291,5 +288,3 @@ func (d dummyValidatorAddressCodec) StringToBytes(text string) ([]byte, error) { func (d dummyValidatorAddressCodec) BytesToString(bz []byte) (string, error) { return "val" + hex.EncodeToString(bz), nil } - -var _ address.Codec = dummyValidatorAddressCodec{} diff --git a/x/tx/signing/directaux/direct_aux_test.go b/x/tx/signing/directaux/direct_aux_test.go index 00c48222aa89..9cabf4e4e9f3 100644 --- a/x/tx/signing/directaux/direct_aux_test.go +++ b/x/tx/signing/directaux/direct_aux_test.go @@ -16,7 +16,6 @@ import ( "cosmossdk.io/api/cosmos/crypto/secp256k1" signingv1beta1 "cosmossdk.io/api/cosmos/tx/signing/v1beta1" txv1beta1 "cosmossdk.io/api/cosmos/tx/v1beta1" - "cosmossdk.io/core/address" "cosmossdk.io/x/tx/signing" "cosmossdk.io/x/tx/signing/directaux" ) @@ -158,5 +157,3 @@ func (d dummyAddressCodec) StringToBytes(text string) ([]byte, error) { func (d dummyAddressCodec) BytesToString(bz []byte) (string, error) { return hex.EncodeToString(bz), nil } - -var _ address.Codec = dummyAddressCodec{}