From f504e2821f01246a94a54b6e21cd45c903ab751e Mon Sep 17 00:00:00 2001 From: zemyblue Date: Fri, 11 Feb 2022 15:41:05 +0900 Subject: [PATCH 1/7] Revert "feat: Introduce sig block height for the new replay protection (#265)" This reverts commit c1c71f11af03c10fb57ddf325c336f0a7abf3225. # Conflicts: # CHANGELOG.md # baseapp/msg_service_router_test.go # client/tx/tx.go # codec/amino_codec_test.go # docs/core/proto-docs.md # proto/lbm/auth/v1/auth.proto # server/grpc/server_test.go # simapp/genesis_account_test.go # simapp/test_helpers.go # testutil/testdata/unknonwnproto.pb.go # types/errors/errors.go # types/grpc/headers.go # types/rest/rest_test.go # types/tx/tx.pb.go # types/tx/types.go # x/auth/ante/ante.go # x/auth/ante/ante_test.go # x/auth/ante/sigverify_test.go # x/auth/ante/testutil_test.go # x/auth/client/cli/cli_test.go # x/auth/keeper/keeper.go # x/auth/legacy/legacytx/amino_signing_test.go # x/auth/signing/handler_map_test.go # x/auth/signing/verify_test.go # x/auth/simulation/decoder.go # x/auth/simulation/genesis.go # x/auth/tx/builder.go # x/auth/tx/direct_test.go # x/auth/tx/legacy_amino_json_test.go # x/auth/types/account.go # x/auth/types/account_retriever.go # x/auth/types/account_test.go # x/auth/types/auth.pb.go # x/auth/types/params.go # x/auth/vesting/types/vesting_account.go # x/auth/vesting/types/vesting_account_test.go # x/evidence/keeper/keeper_test.go # x/ibc/testing/chain.go # x/wasm/keeper/keeper_test.go # x/wasm/keeper/submsg_test.go --- CHANGELOG.md | 1175 +++---------------------- docs/core/proto-docs.md | 2 +- proto/lbm/tx/v1/tx.proto | 12 +- testutil/testdata/unknonwnproto.pb.go | 258 +++--- testutil/testdata/unknonwnproto.proto | 7 +- types/tx/tx.pb.go | 191 ++-- types/tx/types.go | 2 +- x/auth/tx/builder.go | 4 +- 8 files changed, 402 insertions(+), 1249 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b0cb8f1ee..fc29a016c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,1070 +1,187 @@ -# Changelog - -## Unreleased - -## [v0.42.9](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.42.9) - 2021-08-04 - -### Bug Fixes - -* [\#9835](https://github.com/cosmos/cosmos-sdk/pull/9835) Moved capability initialization logic to BeginBlocker to fix nondeterminsim issue mentioned in [\#9800](https://github.com/cosmos/cosmos-sdk/issues/9800). Applications must now include the capability module in their BeginBlocker order before any module that uses capabilities gets run. -* [\#9201](https://github.com/cosmos/cosmos-sdk/pull/9201) Fixed ` init --recover` flag. - - -### API Breaking Changes + -## [v0.42.0](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.42.0) - 2021-03-08 - -**IMPORTANT**: This release contains an important security fix for all non Cosmos Hub chains running Stargate version of the Cosmos SDK (>0.40). Non-hub chains should not be using any version of the SDK in the v0.40.x or v0.41.x release series. See [#8461](https://github.com/cosmos/cosmos-sdk/pull/8461) for more details. - -### Improvements - -* (x/ibc) [\#8624](https://github.com/cosmos/cosmos-sdk/pull/8624) Emit full header in IBC UpdateClient message. -* (x/crisis) [\#8621](https://github.com/cosmos/cosmos-sdk/issues/8621) crisis invariants names now print to loggers. - -### Bug fixes - -* (x/evidence) [\#8461](https://github.com/cosmos/cosmos-sdk/pull/8461) Fix bech32 prefix in evidence validator address conversion -* (x/gov) [\#8806](https://github.com/cosmos/cosmos-sdk/issues/8806) Fix q gov proposals command's mishandling of the --status parameter's values. - -## [v0.41.4](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.41.3) - 2021-03-02 - -### Features - -* [\#7787](https://github.com/cosmos/cosmos-sdk/pull/7787) Add multisign-batch command. - -### Bug fixes - -* [\#8730](https://github.com/cosmos/cosmos-sdk/pull/8730) Allow REST endpoint to query txs with multisig addresses. -* [\#8680](https://github.com/cosmos/cosmos-sdk/issues/8680) Fix missing timestamp in GetTxsEvent response [\#8732](https://github.com/cosmos/cosmos-sdk/pull/8732). -* [\#8681](https://github.com/cosmos/cosmos-sdk/issues/8681) Fix missing error message when calling GetTxsEvent [\#8732](https://github.com/cosmos/cosmos-sdk/pull/8732) -* (server) [\#8641](https://github.com/cosmos/cosmos-sdk/pull/8641) Fix Tendermint and application configuration reading from file -* (client/keys) [\#8639] (https://github.com/cosmos/cosmos-sdk/pull/8639) Fix keys migrate for mulitisig, offline, and ledger keys. The migrate command now takes a positional old_home_dir argument. - -### Improvements - -* (store/cachekv), (x/bank/types) [\#8719](https://github.com/cosmos/cosmos-sdk/pull/8719) algorithmically fix pathologically slow code -* [\#8701](https://github.com/cosmos/cosmos-sdk/pull/8701) Upgrade tendermint v0.34.8. -* [\#8714](https://github.com/cosmos/cosmos-sdk/pull/8714) Allow accounts to have a balance of 0 at genesis. - -## [v0.41.3](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.41.3) - 2021-02-18 - -### Bug Fixes - -* [\#8617](https://github.com/cosmos/cosmos-sdk/pull/8617) Fix build failures caused by a small API breakage introduced in tendermint v0.34.7. - -## [v0.41.2](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.41.2) - 2021-02-18 - -### Improvements - -* Bump tendermint dependency to v0.34.7. - -## [v0.41.1](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.41.1) - 2021-02-17 - -### Bug Fixes - -* (grpc) [\#8549](https://github.com/cosmos/cosmos-sdk/pull/8549) Make gRPC requests go through ABCI and disallow concurrency. -* (x/staking) [\#8546](https://github.com/cosmos/cosmos-sdk/pull/8546) Fix caching bug where concurrent calls to GetValidator could cause a node to crash -* (server) [\#8481](https://github.com/cosmos/cosmos-sdk/pull/8481) Don't create files when running `{appd} tendermint show-*` subcommands. -* (client/keys) [\#8436](https://github.com/cosmos/cosmos-sdk/pull/8436) Fix keybase->keyring keys migration. -* (crypto/hd) [\#8607](https://github.com/cosmos/cosmos-sdk/pull/8607) Make DerivePrivateKeyForPath error and not panic on trailing slashes. - -### Improvements - -* (x/ibc) [\#8458](https://github.com/cosmos/cosmos-sdk/pull/8458) Add `packet_connection` attribute to ibc events to enable relayer filtering -* [\#8396](https://github.com/cosmos/cosmos-sdk/pull/8396) Add support for ARM platform -* (x/bank) [\#8479](https://github.com/cosmos/cosmos-sdk/pull/8479) Aditional client denom metadata validation for `base` and `display` denoms. -* (codec/types) [\#8605](https://github.com/cosmos/cosmos-sdk/pull/8605) Avoid unnecessary allocations for NewAnyWithCustomTypeURL on error. - -## [v0.41.0](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.41.0) - 2021-01-26 - -### State Machine Breaking - -* (x/ibc) [\#8266](https://github.com/cosmos/cosmos-sdk/issues/8266) Add amino JSON for IBC messages in order to support Ledger text signing. -* (x/ibc) [\#8404](https://github.com/cosmos/cosmos-sdk/pull/8404) Reorder IBC `ChanOpenAck` and `ChanOpenConfirm` handler execution to perform core handler first, followed by application callbacks. - -### Bug Fixes - -* (simapp) [\#8418](https://github.com/cosmos/cosmos-sdk/pull/8418) Add balance coin to supply when adding a new genesis account -* (x/bank) [\#8417](https://github.com/cosmos/cosmos-sdk/pull/8417) Validate balances and coin denom metadata on genesis -* (x/staking) [\#8546](https://github.com/cosmos/cosmos-sdk/pull/8546) Fix caching bug where concurrent calls to GetValidator could cause a node to crash - -## [v0.40.1](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.40.1) - 2021-01-19 - -### Improvements - -* (x/bank) [\#8302](https://github.com/cosmos/cosmos-sdk/issues/8302) Add gRPC and CLI queries for client denomination metadata. -* (tendermint) Bump Tendermint version to [v0.34.3](https://github.com/tendermint/tendermint/releases/tag/v0.34.3). - -### Bug Fixes - -* [\#8085](https://github.com/cosmos/cosmos-sdk/pull/8058) fix zero time checks -* [\#8280](https://github.com/cosmos/cosmos-sdk/pull/8280) fix GET /upgrade/current query -* (x/auth) [\#8287](https://github.com/cosmos/cosmos-sdk/pull/8287) Fix `tx sign --signature-only` to return correct sequence value in signature. -* (build) [\8300](https://github.com/cosmos/cosmos-sdk/pull/8300), [\8301](https://github.com/cosmos/cosmos-sdk/pull/8301) Fix reproducible builds -* (types/errors) [\#8355][https://github.com/cosmos/cosmos-sdk/pull/8355] Fix errorWrap `Is` method. -* (x/ibc) [\#8341](https://github.com/cosmos/cosmos-sdk/pull/8341) Fix query latest consensus state. -* (proto) [\#8350][https://github.com/cosmos/cosmos-sdk/pull/8350], [\#8361](https://github.com/cosmos/cosmos-sdk/pull/8361) Update gogo proto deps with v1.3.2 security fixes -* (x/ibc) [\#8359](https://github.com/cosmos/cosmos-sdk/pull/8359) Add missing UnpackInterfaces functions to IBC Query Responses. Fixes 'cannot unpack Any' error for IBC types. -* (x/bank) [\#8317](https://github.com/cosmos/cosmos-sdk/pull/8317) Fix panic when querying for a not found client denomination metadata. - - -## [v0.40.0](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.40.0) - 2021-01-08 - -v0.40.0, known as the Stargate release of the Cosmos SDK, is one of the largest releases -of the Cosmos SDK since launch. Please read through this changelog and [release notes](./RELEASE_NOTES.md) to make -sure you are aware of any relevant breaking changes. - -### Client Breaking Changes - -* __Modules__ - -* __CLI__ - * (client/keys) [\#5889](https://github.com/cosmos/cosmos-sdk/pull/5889) remove `keys update` command. - * (x/auth) [\#5844](https://github.com/cosmos/cosmos-sdk/pull/5844) `tx sign` command now returns an error when signing is attempted with offline/multisig keys. - * (x/auth) [\#6108](https://github.com/cosmos/cosmos-sdk/pull/6108) `tx sign` command's `--validate-signatures` flag is migrated into a `tx validate-signatures` standalone command. - * (x/auth) [#7788](https://github.com/cosmos/cosmos-sdk/pull/7788) Remove `tx auth` subcommands, all auth subcommands exist as `tx ` - * (x/genutil) [\#6651](https://github.com/cosmos/cosmos-sdk/pull/6651) The `gentx` command has been improved. No longer are `--from` and `--name` flags required. Instead, a single argument, `name`, is required which refers to the key pair in the Keyring. In addition, an optional - `--moniker` flag can be provided to override the moniker found in `config.toml`. - * (x/upgrade) [#7697](https://github.com/cosmos/cosmos-sdk/pull/7697) Rename flag name "--time" to "--upgrade-time", "--info" to "--upgrade-info", to keep it consistent with help message. -* __REST / Queriers__ - * (api) [\#6426](https://github.com/cosmos/cosmos-sdk/pull/6426) The ability to start an out-of-process API REST server has now been removed. Instead, the API server is now started in-process along with the application and Tendermint. Configuration options have been added to `app.toml` to enable/disable the API server along with additional HTTP server options. - * (client) [\#7246](https://github.com/cosmos/cosmos-sdk/pull/7246) The rest server endpoint `/swagger-ui/` is replaced by `/swagger/`, and contains swagger documentation for gRPC Gateway routes in addition to legacy REST routes. Swagger API is exposed only if set in `app.toml`. - * (x/auth) [\#5702](https://github.com/cosmos/cosmos-sdk/pull/5702) The `x/auth` querier route has changed from `"acc"` to `"auth"`. - * (x/bank) [\#5572](https://github.com/cosmos/cosmos-sdk/pull/5572) The `/bank/balances/{address}` endpoint now returns all account balances or a single balance by denom when the `denom` query parameter is present. - * (x/evidence) [\#5952](https://github.com/cosmos/cosmos-sdk/pull/5952) Remove CLI and REST handlers for querying `x/evidence` parameters. - * (x/gov) [#6295](https://github.com/cosmos/cosmos-sdk/pull/6295) Fix typo in querying governance params. -* __General__ - * (baseapp) [\#6384](https://github.com/cosmos/cosmos-sdk/pull/6384) The `Result.Data` is now a Protocol Buffer encoded binary blob of type `TxData`. The `TxData` contains `Data` which contains a list of Protocol Buffer encoded message data and the corresponding message type. - * (client) [\#5783](https://github.com/cosmos/cosmos-sdk/issues/5783) Unify all coins representations on JSON client requests for governance proposals. - * (crypto) [\#7419](https://github.com/cosmos/cosmos-sdk/pull/7419) The SDK doesn't use Tendermint's `crypto.PubKey` - interface anymore, and uses instead it's own `PubKey` interface, defined in `crypto/types`. Replace all instances of - `crypto.PubKey` by `cryptotypes.Pubkey`. - * (store/rootmulti) [\#6390](https://github.com/cosmos/cosmos-sdk/pull/6390) Proofs of empty stores are no longer supported. - * (store/types) [\#5730](https://github.com/cosmos/cosmos-sdk/pull/5730) store.types.Cp() is removed in favour of types.CopyBytes(). - * (x/auth) [\#6054](https://github.com/cosmos/cosmos-sdk/pull/6054) Remove custom JSON marshaling for base accounts as multsigs cannot be bech32 decoded. - * (x/auth/vesting) [\#6859](https://github.com/cosmos/cosmos-sdk/pull/6859) Custom JSON marshaling of vesting accounts was removed. Vesting accounts are now marshaled using their default proto or amino JSON representation. - * (x/bank) [\#5785](https://github.com/cosmos/cosmos-sdk/issues/5785) In x/bank errors, JSON strings coerced to valid UTF-8 bytes at JSON marshalling time - are now replaced by human-readable expressions. This change can potentially break compatibility with all those client side tools - that parse log messages. - * (x/evidence) [\#7538](https://github.com/cosmos/cosmos-sdk/pull/7538) The ABCI's `Result.Data` field for - `MsgSubmitEvidence` responses does not contain the raw evidence's hash, but the protobuf encoded - `MsgSubmitEvidenceResponse` struct. - * (x/gov) [\#7533](https://github.com/cosmos/cosmos-sdk/pull/7533) The ABCI's `Result.Data` field for - `MsgSubmitProposal` responses does not contain a raw binary encoding of the `proposalID`, but the protobuf encoded - `MsgSubmitSubmitProposalResponse` struct. - * (x/gov) [\#6859](https://github.com/cosmos/cosmos-sdk/pull/6859) `ProposalStatus` and `VoteOption` are now JSON serialized using its protobuf name, so expect names like `PROPOSAL_STATUS_DEPOSIT_PERIOD` as opposed to `DepositPeriod`. - * (x/staking) [\#7499](https://github.com/cosmos/cosmos-sdk/pull/7499) `BondStatus` is now a protobuf `enum` instead - of an `int32`, and JSON serialized using its protobuf name, so expect names like `BOND_STATUS_UNBONDING` as opposed - to `Unbonding`. - * (x/staking) [\#7556](https://github.com/cosmos/cosmos-sdk/pull/7556) The ABCI's `Result.Data` field for - `MsgBeginRedelegate` and `MsgUndelegate` responses does not contain custom binary marshaled `completionTime`, but the - protobuf encoded `MsgBeginRedelegateResponse` and `MsgUndelegateResponse` structs respectively - -### API Breaking Changes - -* __Baseapp / Client__ - * (AppModule) [\#7518](https://github.com/cosmos/cosmos-sdk/pull/7518) [\#7584](https://github.com/cosmos/cosmos-sdk/pull/7584) Rename `AppModule.RegisterQueryServices` to `AppModule.RegisterServices`, as this method now registers multiple services (the gRPC query service and the protobuf Msg service). A `Configurator` struct is used to hold the different services. - * (baseapp) [\#5865](https://github.com/cosmos/cosmos-sdk/pull/5865) The `SimulationResponse` returned from tx simulation is now JSON encoded instead of Amino binary. - * (client) [\#6290](https://github.com/cosmos/cosmos-sdk/pull/6290) `CLIContext` is renamed to `Context`. `Context` and all related methods have been moved from package context to client. - * (client) [\#6525](https://github.com/cosmos/cosmos-sdk/pull/6525) Removed support for `indent` in JSON responses. Clients should consider piping to an external tool such as `jq`. - * (client) [\#8107](https://github.com/cosmos/cosmos-sdk/pull/8107) Renamed `PrintOutput` and `PrintOutputLegacy` - methods of the `context.Client` object to `PrintProto` and `PrintObjectLegacy`. - * (client/flags) [\#6632](https://github.com/cosmos/cosmos-sdk/pull/6632) Remove NewCompletionCmd(), the function is now available in tendermint. - * (client/input) [\#5904](https://github.com/cosmos/cosmos-sdk/pull/5904) Removal of unnecessary `GetCheckPassword`, `PrintPrefixed` functions. - * (client/keys) [\#5889](https://github.com/cosmos/cosmos-sdk/pull/5889) Rename `NewKeyBaseFromDir()` -> `NewLegacyKeyBaseFromDir()`. - * (client/keys) [\#5820](https://github.com/cosmos/cosmos-sdk/pull/5820/) Removed method CloseDB from Keybase interface. - * (client/rpc) [\#6290](https://github.com/cosmos/cosmos-sdk/pull/6290) `client` package and subdirs reorganization. - * (client/lcd) [\#6290](https://github.com/cosmos/cosmos-sdk/pull/6290) `CliCtx` of struct `RestServer` in package client/lcd has been renamed to `ClientCtx`. - * (codec) [\#6330](https://github.com/cosmos/cosmos-sdk/pull/6330) `codec.RegisterCrypto` has been moved to the `crypto/codec` package and the global `codec.Cdc` Amino instance has been deprecated and moved to the `codec/legacy_global` package. - * (codec) [\#8080](https://github.com/cosmos/cosmos-sdk/pull/8080) Updated the `codec.Marshaler` interface - * Moved `MarshalAny` and `UnmarshalAny` helper functions to `codec.Marshaler` and renamed to `MarshalInterface` and - `UnmarshalInterface` respectively. These functions must take interface as a parameter (not a concrete type nor `Any` - object). Underneath they use `Any` wrapping for correct protobuf serialization. - * (crypto) [\#6780](https://github.com/cosmos/cosmos-sdk/issues/6780) Move ledger code to its own package. - * (crypto/types/multisig) [\#6373](https://github.com/cosmos/cosmos-sdk/pull/6373) `multisig.Multisignature` has been renamed to `AminoMultisignature` - * (codec) `*codec.LegacyAmino` is now a wrapper around Amino which provides backwards compatibility with protobuf `Any`. ALL legacy code should use `*codec.LegacyAmino` instead of `*amino.Codec` directly - * (crypto) [\#5880](https://github.com/cosmos/cosmos-sdk/pull/5880) Merge `crypto/keys/mintkey` into `crypto`. - * (crypto/hd) [\#5904](https://github.com/cosmos/cosmos-sdk/pull/5904) `crypto/keys/hd` moved to `crypto/hd`. - * (crypto/keyring): - * [\#5866](https://github.com/cosmos/cosmos-sdk/pull/5866) Rename `crypto/keys/` to `crypto/keyring/`. - * [\#5904](https://github.com/cosmos/cosmos-sdk/pull/5904) `Keybase` -> `Keyring` interfaces migration. `LegacyKeybase` interface is added in order - to guarantee limited backward compatibility with the old Keybase interface for the sole purpose of migrating keys across the new keyring backends. `NewLegacy` - constructor is provided [\#5889](https://github.com/cosmos/cosmos-sdk/pull/5889) to allow for smooth migration of keys from the legacy LevelDB based implementation - to new keyring backends. Plus, the package and the new keyring no longer depends on the sdk.Config singleton. Please consult the [package documentation](https://github.com/cosmos/cosmos-sdk/tree/master/crypto/keyring/doc.go) for more - information on how to implement the new `Keyring` interface. - * [\#5858](https://github.com/cosmos/cosmos-sdk/pull/5858) Make Keyring store keys by name and address's hexbytes representation. - * (export) [\#5952](https://github.com/cosmos/cosmos-sdk/pull/5952) `AppExporter` now returns ABCI consensus parameters to be included in marshaled exported state. These parameters must be returned from the application via the `BaseApp`. - * (simapp) Deprecating and renaming `MakeEncodingConfig` to `MakeTestEncodingConfig` (both in `simapp` and `simapp/params` packages). - * (store) [\#5803](https://github.com/cosmos/cosmos-sdk/pull/5803) The `store.CommitMultiStore` interface now includes the new `snapshots.Snapshotter` interface as well. - * (types) [\#5579](https://github.com/cosmos/cosmos-sdk/pull/5579) The `keepRecent` field has been removed from the `PruningOptions` type. - The `PruningOptions` type now only includes fields `KeepEvery` and `SnapshotEvery`, where `KeepEvery` - determines which committed heights are flushed to disk and `SnapshotEvery` determines which of these - heights are kept after pruning. The `IsValid` method should be called whenever using these options. Methods - `SnapshotVersion` and `FlushVersion` accept a version arugment and determine if the version should be - flushed to disk or kept as a snapshot. Note, `KeepRecent` is automatically inferred from the options - and provided directly the IAVL store. - * (types) [\#5533](https://github.com/cosmos/cosmos-sdk/pull/5533) Refactored `AppModuleBasic` and `AppModuleGenesis` - to now accept a `codec.JSONMarshaler` for modular serialization of genesis state. - * (types/rest) [\#5779](https://github.com/cosmos/cosmos-sdk/pull/5779) Drop unused Parse{Int64OrReturnBadRequest,QueryParamBool}() functions. -* __Modules__ - * (modules) [\#7243](https://github.com/cosmos/cosmos-sdk/pull/7243) Rename `RegisterCodec` to `RegisterLegacyAminoCodec` and `codec.New()` is now renamed to `codec.NewLegacyAmino()` - * (modules) [\#6564](https://github.com/cosmos/cosmos-sdk/pull/6564) Constant `DefaultParamspace` is removed from all modules, use ModuleName instead. - * (modules) [\#5989](https://github.com/cosmos/cosmos-sdk/pull/5989) `AppModuleBasic.GetTxCmd` now takes a single `CLIContext` parameter. - * (modules) [\#5664](https://github.com/cosmos/cosmos-sdk/pull/5664) Remove amino `Codec` from simulation `StoreDecoder`, which now returns a function closure in order to unmarshal the key-value pairs. - * (modules) [\#5555](https://github.com/cosmos/cosmos-sdk/pull/5555) Move `x/auth/client/utils/` types and functions to `x/auth/client/`. - * (modules) [\#5572](https://github.com/cosmos/cosmos-sdk/pull/5572) Move account balance logic and APIs from `x/auth` to `x/bank`. - * (modules) [\#6326](https://github.com/cosmos/cosmos-sdk/pull/6326) `AppModuleBasic.GetQueryCmd` now takes a single `client.Context` parameter. - * (modules) [\#6336](https://github.com/cosmos/cosmos-sdk/pull/6336) `AppModuleBasic.RegisterQueryService` method was added to support gRPC queries, and `QuerierRoute` and `NewQuerierHandler` were deprecated. - * (modules) [\#6311](https://github.com/cosmos/cosmos-sdk/issues/6311) Remove `alias.go` usage - * (modules) [\#6447](https://github.com/cosmos/cosmos-sdk/issues/6447) Rename `blacklistedAddrs` to `blockedAddrs`. - * (modules) [\#6834](https://github.com/cosmos/cosmos-sdk/issues/6834) Add `RegisterInterfaces` method to `AppModuleBasic` to support registration of protobuf interface types. - * (modules) [\#6734](https://github.com/cosmos/cosmos-sdk/issues/6834) Add `TxEncodingConfig` parameter to `AppModuleBasic.ValidateGenesis` command to support JSON tx decoding in `genutil`. - * (modules) [#7764](https://github.com/cosmos/cosmos-sdk/pull/7764) Added module initialization options: - * `server/types.AppExporter` requires extra argument: `AppOptions`. - * `server.AddCommands` requires extra argument: `addStartFlags types.ModuleInitFlags` - * `x/crisis.NewAppModule` has a new attribute: `skipGenesisInvariants`. [PR](https://github.com/cosmos/cosmos-sdk/pull/7764) - * (types) [\#6327](https://github.com/cosmos/cosmos-sdk/pull/6327) `sdk.Msg` now inherits `proto.Message`, as a result all `sdk.Msg` types now use pointer semantics. - * (types) [\#7032](https://github.com/cosmos/cosmos-sdk/pull/7032) All types ending with `ID` (e.g. `ProposalID`) now end with `Id` (e.g. `ProposalId`), to match default Protobuf generated format. Also see [\#7033](https://github.com/cosmos/cosmos-sdk/pull/7033) for more details. - * (x/auth) [\#6029](https://github.com/cosmos/cosmos-sdk/pull/6029) Module accounts have been moved from `x/supply` to `x/auth`. - * (x/auth) [\#6443](https://github.com/cosmos/cosmos-sdk/issues/6443) Move `FeeTx` and `TxWithMemo` interfaces from `x/auth/ante` to `types`. - * (x/auth) [\#7006](https://github.com/cosmos/cosmos-sdk/pull/7006) All `AccountRetriever` methods now take `client.Context` as a parameter instead of as a struct member. - * (x/auth) [\#6270](https://github.com/cosmos/cosmos-sdk/pull/6270) The passphrase argument has been removed from the signature of the following functions and methods: `BuildAndSign`, ` MakeSignature`, ` SignStdTx`, `TxBuilder.BuildAndSign`, `TxBuilder.Sign`, `TxBuilder.SignStdTx` - * (x/auth) [\#6428](https://github.com/cosmos/cosmos-sdk/issues/6428): - * `NewAnteHandler` and `NewSigVerificationDecorator` both now take a `SignModeHandler` parameter. - * `SignatureVerificationGasConsumer` now has the signature: `func(meter sdk.GasMeter, sig signing.SignatureV2, params types.Params) error`. - * The `SigVerifiableTx` interface now has a `GetSignaturesV2() ([]signing.SignatureV2, error)` method and no longer has the `GetSignBytes` method. - * (x/auth/tx) [\#8106](https://github.com/cosmos/cosmos-sdk/pull/8106) change related to missing append functionality in - client transaction signing - + added `overwriteSig` argument to `x/auth/client.SignTx` and `client/tx.Sign` functions. - + removed `x/auth/tx.go:wrapper.GetSignatures`. The `wrapper` provides `TxBuilder` functionality, and it's a private - structure. That function was not used at all and it's not exposed through the `TxBuilder` interface. - * (x/bank) [\#7327](https://github.com/cosmos/cosmos-sdk/pull/7327) AddCoins and SubtractCoins no longer return a resultingValue and will only return an error. - * (x/capability) [#7918](https://github.com/cosmos/cosmos-sdk/pull/7918) Add x/capability safety checks: - * All outward facing APIs will now check that capability is not nil and name is not empty before performing any state-machine changes - * `SetIndex` has been renamed to `InitializeIndex` - * (x/evidence) [\#7251](https://github.com/cosmos/cosmos-sdk/pull/7251) New evidence types and light client evidence handling. The module function names changed. - * (x/evidence) [\#5952](https://github.com/cosmos/cosmos-sdk/pull/5952) Remove APIs for getting and setting `x/evidence` parameters. `BaseApp` now uses a `ParamStore` to manage Tendermint consensus parameters which is managed via the `x/params` `Substore` type. - * (x/gov) [\#6147](https://github.com/cosmos/cosmos-sdk/pull/6147) The `Content` field on `Proposal` and `MsgSubmitProposal` - is now `Any` in concordance with [ADR 019](docs/architecture/adr-019-protobuf-state-encoding.md) and `GetContent` should now - be used to retrieve the actual proposal `Content`. Also the `NewMsgSubmitProposal` constructor now may return an `error` - * (x/ibc) [\#6374](https://github.com/cosmos/cosmos-sdk/pull/6374) `VerifyMembership` and `VerifyNonMembership` now take a `specs []string` argument to specify the proof format used for verification. Most SDK chains can simply use `commitmenttypes.GetSDKSpecs()` for this argument. - * (x/params) [\#5619](https://github.com/cosmos/cosmos-sdk/pull/5619) The `x/params` keeper now accepts a `codec.Marshaller` instead of - a reference to an amino codec. Amino is still used for JSON serialization. - * (x/staking) [\#6451](https://github.com/cosmos/cosmos-sdk/pull/6451) `DefaultParamspace` and `ParamKeyTable` in staking module are moved from keeper to types to enforce consistency. - * (x/staking) [\#7419](https://github.com/cosmos/cosmos-sdk/pull/7419) The `TmConsPubKey` method on ValidatorI has been - removed and replaced instead by `ConsPubKey` (which returns a SDK `cryptotypes.PubKey`) and `TmConsPublicKey` (which - returns a Tendermint proto PublicKey). - * (x/staking/types) [\#7447](https://github.com/cosmos/cosmos-sdk/issues/7447) Remove bech32 PubKey support: - * `ValidatorI` interface update. `GetConsPubKey` renamed to `TmConsPubKey` (consensus public key must be a tendermint key). `TmConsPubKey`, `GetConsAddr` methods return error. - * `Validator` update. Methods changed in `ValidatorI` (as described above) and `ToTmValidator` return error. - * `Validator.ConsensusPubkey` type changed from `string` to `codectypes.Any`. - * `MsgCreateValidator.Pubkey` type changed from `string` to `codectypes.Any`. - * (x/supply) [\#6010](https://github.com/cosmos/cosmos-sdk/pull/6010) All `x/supply` types and APIs have been moved to `x/bank`. - * [\#6409](https://github.com/cosmos/cosmos-sdk/pull/6409) Rename all IsEmpty methods to Empty across the codebase and enforce consistency. - * [\#6231](https://github.com/cosmos/cosmos-sdk/pull/6231) Simplify `AppModule` interface, `Route` and `NewHandler` methods become only `Route` - and returns a new `Route` type. - * (x/slashing) [\#6212](https://github.com/cosmos/cosmos-sdk/pull/6212) Remove `Get*` prefixes from key construction functions - * (server) [\#6079](https://github.com/cosmos/cosmos-sdk/pull/6079) Remove `UpgradeOldPrivValFile` (deprecated in Tendermint Core v0.28). - * [\#5719](https://github.com/cosmos/cosmos-sdk/pull/5719) Bump Go requirement to 1.14+ - - -### State Machine Breaking - -* __General__ - * (client) [\#7268](https://github.com/cosmos/cosmos-sdk/pull/7268) / [\#7147](https://github.com/cosmos/cosmos-sdk/pull/7147) Introduce new protobuf based PubKeys, and migrate PubKey in BaseAccount to use this new protobuf based PubKey format - -* __Modules__ - * (modules) [\#5572](https://github.com/cosmos/cosmos-sdk/pull/5572) Separate balance from accounts per ADR 004. - * Account balances are now persisted and retrieved via the `x/bank` module. - * Vesting account interface has been modified to account for changes. - * Callers to `NewBaseVestingAccount` are responsible for verifying account balance in relation to - the original vesting amount. - * The `SendKeeper` and `ViewKeeper` interfaces in `x/bank` have been modified to account for changes. - * (x/auth) [\#5533](https://github.com/cosmos/cosmos-sdk/pull/5533) Migrate the `x/auth` module to use Protocol Buffers for state - serialization instead of Amino. - * The `BaseAccount.PubKey` field is now represented as a Bech32 string instead of a `crypto.Pubkey`. - * `NewBaseAccountWithAddress` now returns a reference to a `BaseAccount`. - * The `x/auth` module now accepts a `Codec` interface which extends the `codec.Marshaler` interface by - requiring a concrete codec to know how to serialize accounts. - * The `AccountRetriever` type now accepts a `Codec` in its constructor in order to know how to - serialize accounts. - * (x/bank) [\#6518](https://github.com/cosmos/cosmos-sdk/pull/6518) Support for global and per-denomination send enabled flags. - * Existing send_enabled global flag has been moved into a Params structure as `default_send_enabled`. - * An array of: `{denom: string, enabled: bool}` is added to bank Params to support per-denomination override of global default value. - * (x/distribution) [\#5610](https://github.com/cosmos/cosmos-sdk/pull/5610) Migrate the `x/distribution` module to use Protocol Buffers for state - serialization instead of Amino. The exact codec used is `codec.HybridCodec` which utilizes Protobuf for binary encoding and Amino - for JSON encoding. - * `ValidatorHistoricalRewards.ReferenceCount` is now of types `uint32` instead of `uint16`. - * `ValidatorSlashEvents` is now a struct with `slashevents`. - * `ValidatorOutstandingRewards` is now a struct with `rewards`. - * `ValidatorAccumulatedCommission` is now a struct with `commission`. - * The `Keeper` constructor now takes a `codec.Marshaler` instead of a concrete Amino codec. This exact type - provided is specified by `ModuleCdc`. - * (x/evidence) [\#5634](https://github.com/cosmos/cosmos-sdk/pull/5634) Migrate the `x/evidence` module to use Protocol Buffers for state - serialization instead of Amino. - * The `internal` sub-package has been removed in order to expose the types proto file. - * The module now accepts a `Codec` interface which extends the `codec.Marshaler` interface by - requiring a concrete codec to know how to serialize `Evidence` types. - * The `MsgSubmitEvidence` message has been removed in favor of `MsgSubmitEvidenceBase`. The application-level - codec must now define the concrete `MsgSubmitEvidence` type which must implement the module's `MsgSubmitEvidence` - interface. - * (x/evidence) [\#5952](https://github.com/cosmos/cosmos-sdk/pull/5952) Remove parameters from `x/evidence` genesis and module state. The `x/evidence` module now solely uses Tendermint consensus parameters to determine of evidence is valid or not. - * (x/gov) [\#5737](https://github.com/cosmos/cosmos-sdk/pull/5737) Migrate the `x/gov` module to use Protocol - Buffers for state serialization instead of Amino. - * `MsgSubmitProposal` will be removed in favor of the application-level proto-defined `MsgSubmitProposal` which - implements the `MsgSubmitProposalI` interface. Applications should extend the `NewMsgSubmitProposalBase` type - to define their own concrete `MsgSubmitProposal` types. - * The module now accepts a `Codec` interface which extends the `codec.Marshaler` interface by - requiring a concrete codec to know how to serialize `Proposal` types. - * (x/mint) [\#5634](https://github.com/cosmos/cosmos-sdk/pull/5634) Migrate the `x/mint` module to use Protocol Buffers for state - serialization instead of Amino. - * The `internal` sub-package has been removed in order to expose the types proto file. - * (x/slashing) [\#5627](https://github.com/cosmos/cosmos-sdk/pull/5627) Migrate the `x/slashing` module to use Protocol Buffers for state - serialization instead of Amino. The exact codec used is `codec.HybridCodec` which utilizes Protobuf for binary encoding and Amino - for JSON encoding. - * The `Keeper` constructor now takes a `codec.Marshaler` instead of a concrete Amino codec. This exact type - provided is specified by `ModuleCdc`. - * (x/staking) [\#6844](https://github.com/cosmos/cosmos-sdk/pull/6844) Validators are now inserted into the unbonding queue based on their unbonding time and height. The relevant keeper APIs are modified to reflect these changes by now also requiring a height. - * (x/staking) [\#6061](https://github.com/cosmos/cosmos-sdk/pull/6061) Allow a validator to immediately unjail when no signing info is present due to - falling below their minimum self-delegation and never having been bonded. The validator may immediately unjail once they've met their minimum self-delegation. - * (x/staking) [\#5600](https://github.com/cosmos/cosmos-sdk/pull/5600) Migrate the `x/staking` module to use Protocol Buffers for state - serialization instead of Amino. The exact codec used is `codec.HybridCodec` which utilizes Protobuf for binary encoding and Amino - for JSON encoding. - * `BondStatus` is now of type `int32` instead of `byte`. - * Types of `int16` in the `Params` type are now of type `int32`. - * Every reference of `crypto.Pubkey` in context of a `Validator` is now of type string. `GetPubKeyFromBech32` must be used to get the `crypto.Pubkey`. - * The `Keeper` constructor now takes a `codec.Marshaler` instead of a concrete Amino codec. This exact type - provided is specified by `ModuleCdc`. - * (x/staking) [\#7979](https://github.com/cosmos/cosmos-sdk/pull/7979) keeper pubkey storage serialization migration - from bech32 to protobuf. - * (x/supply) [\#6010](https://github.com/cosmos/cosmos-sdk/pull/6010) Removed the `x/supply` module by merging the existing types and APIs into the `x/bank` module. - * (x/supply) [\#5533](https://github.com/cosmos/cosmos-sdk/pull/5533) Migrate the `x/supply` module to use Protocol Buffers for state - serialization instead of Amino. - * The `internal` sub-package has been removed in order to expose the types proto file. - * The `x/supply` module now accepts a `Codec` interface which extends the `codec.Marshaler` interface by - requiring a concrete codec to know how to serialize `SupplyI` types. - * The `SupplyI` interface has been modified to no longer return `SupplyI` on methods. Instead the - concrete type's receiver should modify the type. - * (x/upgrade) [\#5659](https://github.com/cosmos/cosmos-sdk/pull/5659) Migrate the `x/upgrade` module to use Protocol - Buffers for state serialization instead of Amino. - * The `internal` sub-package has been removed in order to expose the types proto file. - * The `x/upgrade` module now accepts a `codec.Marshaler` interface. - -### Features - -* __Baseapp / Client / REST__ - * (x/auth) [\#6213](https://github.com/cosmos/cosmos-sdk/issues/6213) Introduce new protobuf based path for transaction signing, see [ADR020](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-020-protobuf-transaction-encoding.md) for more details - * (x/auth) [\#6350](https://github.com/cosmos/cosmos-sdk/pull/6350) New sign-batch command to sign StdTx batch files. - * (baseapp) [\#5803](https://github.com/cosmos/cosmos-sdk/pull/5803) Added support for taking state snapshots at regular height intervals, via options `snapshot-interval` and `snapshot-keep-recent`. - * (baseapp) [\#7519](https://github.com/cosmos/cosmos-sdk/pull/7519) Add `ServiceMsgRouter` to BaseApp to handle routing of protobuf service `Msg`s. The two new types defined in ADR 031, `sdk.ServiceMsg` and `sdk.MsgRequest` are introduced with this router. - * (client) [\#5921](https://github.com/cosmos/cosmos-sdk/issues/5921) Introduce new gRPC and gRPC Gateway based APIs for querying app & module data. See [ADR021](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-021-protobuf-query-encoding.md) for more details - * (cli) [\#7485](https://github.com/cosmos/cosmos-sdk/pull/7485) Introduce a new optional `--keyring-dir` flag that allows clients to specify a Keyring directory if it does not reside in the directory specified by `--home`. - * (cli) [\#7221](https://github.com/cosmos/cosmos-sdk/pull/7221) Add the option of emitting amino encoded json from the CLI - * (codec) [\#7519](https://github.com/cosmos/cosmos-sdk/pull/7519) `InterfaceRegistry` now inherits `jsonpb.AnyResolver`, and has a `RegisterCustomTypeURL` method to support ADR 031 packing of `Any`s. `AnyResolver` is now a required parameter to `RejectUnknownFields`. - * (coin) [\#6755](https://github.com/cosmos/cosmos-sdk/pull/6755) Add custom regex validation for `Coin` denom by overwriting `CoinDenomRegex` when using `/types/coin.go`. - * (config) [\#7265](https://github.com/cosmos/cosmos-sdk/pull/7265) Support Tendermint block pruning through a new `min-retain-blocks` configuration that can be set in either `app.toml` or via the CLI. This parameter is used in conjunction with other criteria to determine the height at which Tendermint should prune blocks. - * (events) [\#7121](https://github.com/cosmos/cosmos-sdk/pull/7121) The application now derives what events are indexed by Tendermint via the `index-events` configuration in `app.toml`, which is a list of events taking the form `{eventType}.{attributeKey}`. - * (tx) [\#6089](https://github.com/cosmos/cosmos-sdk/pull/6089) Transactions can now have a `TimeoutHeight` set which allows the transaction to be rejected if it's committed at a height greater than the timeout. - * (rest) [\#6167](https://github.com/cosmos/cosmos-sdk/pull/6167) Support `max-body-bytes` CLI flag for the REST service. - * (genesis) [\#7089](https://github.com/cosmos/cosmos-sdk/pull/7089) The `export` command now adds a `initial_height` field in the exported JSON. Baseapp's `CommitMultiStore` now also has a `SetInitialVersion` setter, so it can set the initial store version inside `InitChain` and start a new chain from a given height. -* __General__ - * (crypto/multisig) [\#6241](https://github.com/cosmos/cosmos-sdk/pull/6241) Add Multisig type directly to the repo. Previously this was in tendermint. - * (codec/types) [\#8106](https://github.com/cosmos/cosmos-sdk/pull/8106) Adding `NewAnyWithCustomTypeURL` to correctly - marshal Messages in TxBuilder. - * (tests) [\#6489](https://github.com/cosmos/cosmos-sdk/pull/6489) Introduce package `testutil`, new in-process testing network framework for use in integration and unit tests. - * (tx) Add new auth/tx gRPC & gRPC-Gateway endpoints for basic querying & broadcasting support - * [\#7842](https://github.com/cosmos/cosmos-sdk/pull/7842) Add TxsByEvent gRPC endpoint - * [\#7852](https://github.com/cosmos/cosmos-sdk/pull/7852) Add tx broadcast gRPC endpoint - * (tx) [\#7688](https://github.com/cosmos/cosmos-sdk/pull/7688) Add a new Tx gRPC service with methods `Simulate` and `GetTx` (by hash). - * (store) [\#5803](https://github.com/cosmos/cosmos-sdk/pull/5803) Added `rootmulti.Store` methods for taking and restoring snapshots, based on `iavl.Store` export/import. - * (store) [\#6324](https://github.com/cosmos/cosmos-sdk/pull/6324) IAVL store query proofs now return CommitmentOp which wraps an ics23 CommitmentProof - * (store) [\#6390](https://github.com/cosmos/cosmos-sdk/pull/6390) `RootMulti` store query proofs now return `CommitmentOp` which wraps `CommitmentProofs` - * `store.Query` now only returns chained `ics23.CommitmentProof` wrapped in `merkle.Proof` - * `ProofRuntime` only decodes and verifies `ics23.CommitmentProof` -* __Modules__ - * (modules) [\#5921](https://github.com/cosmos/cosmos-sdk/issues/5921) Introduction of Query gRPC service definitions along with REST annotations for gRPC Gateway for each module - * (modules) [\#7540](https://github.com/cosmos/cosmos-sdk/issues/7540) Protobuf service definitions can now be used for - packing `Msg`s in transactions as defined in [ADR 031](./docs/architecture/adr-031-msg-service.md). All modules now - define a `Msg` protobuf service. - * (x/auth/vesting) [\#7209](https://github.com/cosmos/cosmos-sdk/pull/7209) Create new `MsgCreateVestingAccount` message type along with CLI handler that allows for the creation of delayed and continuous vesting types. - * (x/capability) [\#5828](https://github.com/cosmos/cosmos-sdk/pull/5828) Capability module integration as outlined in [ADR 3 - Dynamic Capability Store](https://github.com/cosmos/tree/master/docs/architecture/adr-003-dynamic-capability-store.md). - * (x/crisis) `x/crisis` has a new function: `AddModuleInitFlags`, which will register optional crisis module flags for the start command. - * (x/ibc) [\#5277](https://github.com/cosmos/cosmos-sdk/pull/5277) `x/ibc` changes from IBC alpha. For more details check the the [`x/ibc/core/spec`](https://github.com/cosmos/cosmos-sdk/tree/master/x/ibc/core/spec) directory, or the ICS specs below: - * [ICS 002 - Client Semantics](https://github.com/cosmos/ics/tree/master/spec/ics-002-client-semantics) subpackage - * [ICS 003 - Connection Semantics](https://github.com/cosmos/ics/blob/master/spec/ics-003-connection-semantics) subpackage - * [ICS 004 - Channel and Packet Semantics](https://github.com/cosmos/ics/blob/master/spec/ics-004-channel-and-packet-semantics) subpackage - * [ICS 005 - Port Allocation](https://github.com/cosmos/ics/blob/master/spec/ics-005-port-allocation) subpackage - * [ICS 006 - Solo Machine Client](https://github.com/cosmos/ics/tree/master/spec/ics-006-solo-machine-client) subpackage - * [ICS 007 - Tendermint Client](https://github.com/cosmos/ics/blob/master/spec/ics-007-tendermint-client) subpackage - * [ICS 009 - Loopback Client](https://github.com/cosmos/ics/tree/master/spec/ics-009-loopback-client) subpackage - * [ICS 020 - Fungible Token Transfer](https://github.com/cosmos/ics/tree/master/spec/ics-020-fungible-token-transfer) subpackage - * [ICS 023 - Vector Commitments](https://github.com/cosmos/ics/tree/master/spec/ics-023-vector-commitments) subpackage - * [ICS 024 - Host State Machine Requirements](https://github.com/cosmos/ics/tree/master/spec/ics-024-host-requirements) subpackage - * (x/ibc) [\#6374](https://github.com/cosmos/cosmos-sdk/pull/6374) ICS-23 Verify functions will now accept and verify ics23 CommitmentProofs exclusively - * (x/params) [\#6005](https://github.com/cosmos/cosmos-sdk/pull/6005) Add new CLI command for querying raw x/params parameters by subspace and key. - -### Bug Fixes - -* __Baseapp / Client / REST__ - * (client) [\#5964](https://github.com/cosmos/cosmos-sdk/issues/5964) `--trust-node` is now false by default - for real. Users must ensure it is set to true if they don't want to enable the verifier. - * (client) [\#6402](https://github.com/cosmos/cosmos-sdk/issues/6402) Fix `keys add` `--algo` flag which only worked for Tendermint's `secp256k1` default key signing algorithm. - * (client) [\#7699](https://github.com/cosmos/cosmos-sdk/pull/7699) Fix panic in context when setting invalid nodeURI. `WithNodeURI` does not set the `Client` in the context. - * (export) [\#6510](https://github.com/cosmos/cosmos-sdk/pull/6510/) Field TimeIotaMs now is included in genesis file while exporting. - * (rest) [\#5906](https://github.com/cosmos/cosmos-sdk/pull/5906) Fix an issue that make some REST calls panic when sending invalid or incomplete requests. - * (crypto) [\#7966](https://github.com/cosmos/cosmos-sdk/issues/7966) `Bip44Params` `String()` function now correctly - returns the absolute HD path by adding the `m/` prefix. - * (crypto/keyring) [\#5844](https://github.com/cosmos/cosmos-sdk/pull/5844) `Keyring.Sign()` methods no longer decode amino signatures when method receivers - are offline/multisig keys. - * (store) [\#7415](https://github.com/cosmos/cosmos-sdk/pull/7415) Allow new stores to be registered during on-chain upgrades. -* __Modules__ - * (modules) [\#5569](https://github.com/cosmos/cosmos-sdk/issues/5569) `InitGenesis`, for the relevant modules, now ensures module accounts exist. - * (x/auth) [\#5892](https://github.com/cosmos/cosmos-sdk/pull/5892) Add `RegisterKeyTypeCodec` to register new - types (eg. keys) to the `auth` module internal amino codec. - * (x/bank) [\#6536](https://github.com/cosmos/cosmos-sdk/pull/6536) Fix bug in `WriteGeneratedTxResponse` function used by multiple - REST endpoints. Now it writes a Tx in StdTx format. - * (x/genutil) [\#5938](https://github.com/cosmos/cosmos-sdk/pull/5938) Fix `InitializeNodeValidatorFiles` error handling. - * (x/gentx) [\#8183](https://github.com/cosmos/cosmos-sdk/pull/8183) change gentx cmd amount to arg from flag - * (x/gov) [#7641](https://github.com/cosmos/cosmos-sdk/pull/7641) Fix tally calculation precision error. - * (x/staking) [\#6529](https://github.com/cosmos/cosmos-sdk/pull/6529) Export validator addresses (previously was empty). - * (x/staking) [\#5949](https://github.com/cosmos/cosmos-sdk/pull/5949) Skip staking `HistoricalInfoKey` in simulations as headers are not exported. - * (x/staking) [\#6061](https://github.com/cosmos/cosmos-sdk/pull/6061) Allow a validator to immediately unjail when no signing info is present due to -falling below their minimum self-delegation and never having been bonded. The validator may immediately unjail once they've met their minimum self-delegation. -* __General__ - * (types) [\#7038](https://github.com/cosmos/cosmos-sdk/issues/7038) Fix infinite looping of `ApproxRoot` by including a hard-coded maximum iterations limit of 100. - * (types) [\#7084](https://github.com/cosmos/cosmos-sdk/pull/7084) Fix panic when calling `BigInt()` on an uninitialized `Int`. - * (simulation) [\#7129](https://github.com/cosmos/cosmos-sdk/issues/7129) Fix support for custom `Account` and key types on auth's simulation. - - -### Improvements -* __Baseapp / Client / REST__ - * (baseapp) [\#6186](https://github.com/cosmos/cosmos-sdk/issues/6186) Support emitting events during `AnteHandler` execution. - * (baseapp) [\#6053](https://github.com/cosmos/cosmos-sdk/pull/6053) Customizable panic recovery handling added for `app.runTx()` method (as proposed in the [ADR 22](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-022-custom-panic-handling.md)). Adds ability for developers to register custom panic handlers extending standard ones. - * (client) [\#5810](https://github.com/cosmos/cosmos-sdk/pull/5810) Added a new `--offline` flag that allows commands to be executed without an - internet connection. Previously, `--generate-only` served this purpose in addition to only allowing txs to be generated. Now, `--generate-only` solely - allows txs to be generated without being broadcasted and disallows Keybase use and `--offline` allows the use of Keybase but does not allow any - functionality that requires an online connection. - * (cli) [#7764](https://github.com/cosmos/cosmos-sdk/pull/7764) Update x/banking and x/crisis InitChain to improve node startup time - * (client) [\#5856](https://github.com/cosmos/cosmos-sdk/pull/5856) Added the possibility to set `--offline` flag with config command. - * (client) [\#5895](https://github.com/cosmos/cosmos-sdk/issues/5895) show config options in the config command's help screen. - * (client/keys) [\#8043](https://github.com/cosmos/cosmos-sdk/pull/8043) Add support for export of unarmored private key - * (client/tx) [\#7801](https://github.com/cosmos/cosmos-sdk/pull/7801) Update sign-batch multisig to work online - * (x/genutil) [\#8099](https://github.com/cosmos/cosmos-sdk/pull/8099) `init` now supports a `--recover` flag to recover - the private validator key from a given mnemonic -* __Modules__ - * (x/auth) [\#5702](https://github.com/cosmos/cosmos-sdk/pull/5702) Add parameter querying support for `x/auth`. - * (x/auth/ante) [\#6040](https://github.com/cosmos/cosmos-sdk/pull/6040) `AccountKeeper` interface used for `NewAnteHandler` and handler's decorators to add support of using custom `AccountKeeper` implementations. - * (x/evidence) [\#5952](https://github.com/cosmos/cosmos-sdk/pull/5952) Tendermint Consensus parameters can now be changed via parameter change proposals through `x/gov`. - * (x/evidence) [\#5961](https://github.com/cosmos/cosmos-sdk/issues/5961) Add `StoreDecoder` simulation for evidence module. - * (x/ibc) [\#5948](https://github.com/cosmos/cosmos-sdk/issues/5948) Add `InitGenesis` and `ExportGenesis` functions for `ibc` module. - * (x/ibc-transfer) [\#6871](https://github.com/cosmos/cosmos-sdk/pull/6871) Implement [ADR 001 - Coin Source Tracing](./docs/architecture/adr-001-coin-source-tracing.md). - * (x/staking) [\#6059](https://github.com/cosmos/cosmos-sdk/pull/6059) Updated `HistoricalEntries` parameter default to 100. - * (x/staking) [\#5584](https://github.com/cosmos/cosmos-sdk/pull/5584) Add util function `ToTmValidator` that converts a `staking.Validator` type to `*tmtypes.Validator`. - * (x/staking) [\#6163](https://github.com/cosmos/cosmos-sdk/pull/6163) CLI and REST call to unbonding delegations and delegations now accept - pagination. - * (x/staking) [\#8178](https://github.com/cosmos/cosmos-sdk/pull/8178) Update default historical header number for stargate -* __General__ - * (crypto) [\#7987](https://github.com/cosmos/cosmos-sdk/pull/7987) Fix the inconsistency of CryptoCdc, only use - `codec/legacy.Cdc`. - * (logging) [\#8072](https://github.com/cosmos/cosmos-sdk/pull/8072) Refactor logging: - * Use [zerolog](https://github.com/rs/zerolog) over Tendermint's go-kit logging wrapper. - * Introduce Tendermint's `--log_format=plain|json` flag. Using format `json` allows for emitting structured JSON - logs which can be consumed by an external logging facility (e.g. Loggly). Both formats log to STDERR. - * The existing `--log_level` flag and it's default value now solely relates to the global logging - level (e.g. `info`, `debug`, etc...) instead of `:`. - * (rest) [#7649](https://github.com/cosmos/cosmos-sdk/pull/7649) Return an unsigned tx in legacy GET /tx endpoint when signature conversion fails - * (simulation) [\#6002](https://github.com/cosmos/cosmos-sdk/pull/6002) Add randomized consensus params into simulation. - * (store) [\#6481](https://github.com/cosmos/cosmos-sdk/pull/6481) Move `SimpleProofsFromMap` from Tendermint into the SDK. - * (store) [\#6719](https://github.com/cosmos/cosmos-sdk/6754) Add validity checks to stores for nil and empty keys. - * (SDK) Updated dependencies - * Updated iavl dependency to v0.15.3 - * Update tendermint to v0.34.1 - * (types) [\#7027](https://github.com/cosmos/cosmos-sdk/pull/7027) `Coin(s)` and `DecCoin(s)` updates: - * Bump denomination max length to 128 - * Allow uppercase letters and numbers in denominations to support [ADR 001](./docs/architecture/adr-001-coin-source-tracing.md) - * Added `Validate` function that returns a descriptive error - * (types) [\#5581](https://github.com/cosmos/cosmos-sdk/pull/5581) Add convenience functions {,Must}Bech32ifyAddressBytes. - * (types/module) [\#5724](https://github.com/cosmos/cosmos-sdk/issues/5724) The `types/module` package does no longer depend on `x/simulation`. - * (types) [\#5585](https://github.com/cosmos/cosmos-sdk/pull/5585) IBC additions: - * `Coin` denomination max lenght has been increased to 32. - * Added `CapabilityKey` alias for `StoreKey` to match IBC spec. - * (types/rest) [\#5900](https://github.com/cosmos/cosmos-sdk/pull/5900) Add Check*Error function family to spare developers from replicating tons of boilerplate code. - * (types) [\#6128](https://github.com/cosmos/cosmos-sdk/pull/6137) Add `String()` method to `GasMeter`. - * (types) [\#6195](https://github.com/cosmos/cosmos-sdk/pull/6195) Add codespace to broadcast(sync/async) response. - * (types) \#6897 Add KV type from tendermint to `types` directory. - * (version) [\#7848](https://github.com/cosmos/cosmos-sdk/pull/7848) [\#7941](https://github.com/cosmos/cosmos-sdk/pull/7941) - `version --long` output now shows the list of build dependencies and replaced build dependencies. - -## [v0.39.1](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.39.1) - 2020-08-11 - -### Client Breaking - -* (x/auth) [\#6861](https://github.com/cosmos/cosmos-sdk/pull/6861) Remove public key Bech32 encoding for all account types for JSON serialization, instead relying on direct Amino encoding. In addition, JSON serialization utilizes Amino instead of the Go stdlib, so integers are treated as strings. - -### Improvements - -* (client) [\#6853](https://github.com/cosmos/cosmos-sdk/pull/6853) Add --unsafe-cors flag. - -## [v0.39.0](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.39.0) - 2020-07-20 - -### Improvements - -* (deps) Bump IAVL version to [v0.14.0](https://github.com/cosmos/iavl/releases/tag/v0.14.0) -* (client) [\#5585](https://github.com/cosmos/cosmos-sdk/pull/5585) `CLIContext` additions: - * Introduce `QueryABCI` that returns the full `abci.ResponseQuery` with inclusion Merkle proofs. - * Added `prove` flag for Merkle proof verification. -* (x/staking) [\#6791)](https://github.com/cosmos/cosmos-sdk/pull/6791) Close {UBDQueue,RedelegationQueu}Iterator once used. - -### API Breaking Changes - -* (baseapp) [\#5837](https://github.com/cosmos/cosmos-sdk/issues/5837) Transaction simulation now returns a `SimulationResponse` which contains the `GasInfo` and `Result` from the execution. - -### Client Breaking Changes - -* (x/auth) [\#6745](https://github.com/cosmos/cosmos-sdk/issues/6745) Remove BaseAccount's custom JSON {,un}marshalling. - -### Bug Fixes - -* (store) [\#6475](https://github.com/cosmos/cosmos-sdk/pull/6475) Revert IAVL pruning functionality introduced in -[v0.13.0](https://github.com/cosmos/iavl/releases/tag/v0.13.0), -where the IAVL no longer keeps states in-memory in which it flushes periodically. IAVL now commits and -flushes every state to disk as it did pre-v0.13.0. The SDK's multi-store will track and ensure the proper -heights are pruned. The operator can set the pruning options via a `pruning` config via the CLI or -through `app.toml`. The `pruning` flag exposes `default|everything|nothing|custom` as options -- -see docs for further details. If the operator chooses `custom`, they may provide granular pruning -options `pruning-keep-recent`, `pruning-keep-every`, and `pruning-interval`. The former two options -dictate how many recent versions are kept on disk and the offset of what versions are kept after that -respectively, and the latter defines the height interval in which versions are deleted in a batch. -**Note, there are some client-facing API breaking changes with regard to IAVL, stores, and pruning settings.** -* (x/distribution) [\#6210](https://github.com/cosmos/cosmos-sdk/pull/6210) Register `MsgFundCommunityPool` in distribution amino codec. -* (types) [\#5741](https://github.com/cosmos/cosmos-sdk/issues/5741) Prevent `ChainAnteDecorators()` from panicking when empty `AnteDecorator` slice is supplied. -* (baseapp) [\#6306](https://github.com/cosmos/cosmos-sdk/issues/6306) Prevent events emitted by the antehandler from being persisted between transactions. -* (client/keys) [\#5091](https://github.com/cosmos/cosmos-sdk/issues/5091) `keys parse` does not honor client app's configuration. -* (x/bank) [\#6674](https://github.com/cosmos/cosmos-sdk/pull/6674) Create account if recipient does not exist on handing `MsgMultiSend`. -* (x/auth) [\#6287](https://github.com/cosmos/cosmos-sdk/pull/6287) Fix nonce stuck when sending multiple transactions from an account in a same block. - -## [v0.38.5] - 2020-07-02 - -### Improvements - -* (tendermint) Bump Tendermint version to [v0.33.6](https://github.com/tendermint/tendermint/releases/tag/v0.33.6). - -## [v0.38.4] - 2020-05-21 - -### Bug Fixes - -* (x/auth) [\#5950](https://github.com/cosmos/cosmos-sdk/pull/5950) Fix `IncrementSequenceDecorator` to use is `IsReCheckTx` instead of `IsCheckTx` to allow account sequence incrementing. - -## [v0.38.3] - 2020-04-09 - -### Improvements - -* (tendermint) Bump Tendermint version to [v0.33.3](https://github.com/tendermint/tendermint/releases/tag/v0.33.3). - -## [v0.38.2] - 2020-03-25 - -### Bug Fixes - -* (baseapp) [\#5718](https://github.com/cosmos/cosmos-sdk/pull/5718) Remove call to `ctx.BlockGasMeter` during failed message validation which resulted in a panic when the tx execution mode was `CheckTx`. -* (x/genutil) [\#5775](https://github.com/cosmos/cosmos-sdk/pull/5775) Fix `ExportGenesis` in `x/genutil` to export default genesis state (`[]`) instead of `null`. -* (client) [\#5618](https://github.com/cosmos/cosmos-sdk/pull/5618) Fix crash on the client when the verifier is not set. -* (crypto/keys/mintkey) [\#5823](https://github.com/cosmos/cosmos-sdk/pull/5823) fix errors handling in `UnarmorPubKeyBytes` (underlying armoring function's return error was not being checked). -* (x/distribution) [\#5620](https://github.com/cosmos/cosmos-sdk/pull/5620) Fix nil pointer deref in distribution tax/reward validation helpers. - -### Improvements - -* (rest) [\#5648](https://github.com/cosmos/cosmos-sdk/pull/5648) Enhance /txs usability: - * Add `tx.minheight` key to filter transaction with an inclusive minimum block height - * Add `tx.maxheight` key to filter transaction with an inclusive maximum block height -* (crypto/keys) [\#5739](https://github.com/cosmos/cosmos-sdk/pull/5739) Print an error message if the password input failed. - -## [v0.38.1] - 2020-02-11 - -### Improvements - -* (modules) [\#5597](https://github.com/cosmos/cosmos-sdk/pull/5597) Add `amount` event attribute to the `complete_unbonding` -and `complete_redelegation` events that reflect the total balances of the completed unbondings and redelegations -respectively. - -### Bug Fixes - -* (types) [\#5579](https://github.com/cosmos/cosmos-sdk/pull/5579) The IAVL `Store#Commit` method has been refactored to -delete a flushed version if it is not a snapshot version. The root multi-store now keeps track of `commitInfo` instead -of `types.CommitID`. During `Commit` of the root multi-store, `lastCommitInfo` is updated from the saved state -and is only flushed to disk if it is a snapshot version. During `Query` of the root multi-store, if the request height -is the latest height, we'll use the store's `lastCommitInfo`. Otherwise, we fetch `commitInfo` from disk. -* (x/bank) [\#5531](https://github.com/cosmos/cosmos-sdk/issues/5531) Added missing amount event to MsgMultiSend, emitted for each output. -* (x/gov) [\#5622](https://github.com/cosmos/cosmos-sdk/pull/5622) Track any events emitted from a proposal's handler upon successful execution. - -## [v0.38.0] - 2020-01-23 - -### State Machine Breaking - -* (genesis) [\#5506](https://github.com/cosmos/cosmos-sdk/pull/5506) The `x/distribution` genesis state - now includes `params` instead of individual parameters. -* (genesis) [\#5017](https://github.com/cosmos/cosmos-sdk/pull/5017) The `x/genaccounts` module has been -deprecated and all components removed except the `legacy/` package. This requires changes to the -genesis state. Namely, `accounts` now exist under `app_state.auth.accounts`. The corresponding migration -logic has been implemented for v0.38 target version. Applications can migrate via: -`$ {appd} migrate v0.38 genesis.json`. -* (modules) [\#5299](https://github.com/cosmos/cosmos-sdk/pull/5299) Handling of `ABCIEvidenceTypeDuplicateVote` - during `BeginBlock` along with the corresponding parameters (`MaxEvidenceAge`) have moved from the - `x/slashing` module to the `x/evidence` module. - -### API Breaking Changes - -* (modules) [\#5506](https://github.com/cosmos/cosmos-sdk/pull/5506) Remove individual setters of `x/distribution` parameters. Instead, follow the module spec in getting parameters, setting new value(s) and finally calling `SetParams`. -* (types) [\#5495](https://github.com/cosmos/cosmos-sdk/pull/5495) Remove redundant `(Must)Bech32ify*` and `(Must)Get*KeyBech32` functions in favor of `(Must)Bech32ifyPubKey` and `(Must)GetPubKeyFromBech32` respectively, both of which take a `Bech32PubKeyType` (string). -* (types) [\#5430](https://github.com/cosmos/cosmos-sdk/pull/5430) `DecCoins#Add` parameter changed from `DecCoins` -to `...DecCoin`, `Coins#Add` parameter changed from `Coins` to `...Coin`. -* (baseapp/types) [\#5421](https://github.com/cosmos/cosmos-sdk/pull/5421) The `Error` interface (`types/errors.go`) -has been removed in favor of the concrete type defined in `types/errors/` which implements the standard `error` interface. - * As a result, the `Handler` and `Querier` implementations now return a standard `error`. - Within `BaseApp`, `runTx` now returns a `(GasInfo, *Result, error)` tuple and `runMsgs` returns a - `(*Result, error)` tuple. A reference to a `Result` is now used to indicate success whereas an error - signals an invalid message or failed message execution. As a result, the fields `Code`, `Codespace`, - `GasWanted`, and `GasUsed` have been removed the `Result` type. The latter two fields are now found - in the `GasInfo` type which is always returned regardless of execution outcome. - * Note to developers: Since all handlers and queriers must now return a standard `error`, the `types/errors/` - package contains all the relevant and pre-registered errors that you typically work with. A typical - error returned will look like `sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "...")`. You can retrieve - relevant ABCI information from the error via `ABCIInfo`. -* (client) [\#5442](https://github.com/cosmos/cosmos-sdk/pull/5442) Remove client/alias.go as it's not necessary and -components can be imported directly from the packages. -* (store) [\#4748](https://github.com/cosmos/cosmos-sdk/pull/4748) The `CommitMultiStore` interface -now requires a `SetInterBlockCache` method. Applications that do not wish to support this can simply -have this method perform a no-op. -* (modules) [\#4665](https://github.com/cosmos/cosmos-sdk/issues/4665) Refactored `x/gov` module structure and dev-UX: - * Prepare for module spec integration - * Update gov keys to use big endian encoding instead of little endian -* (modules) [\#5017](https://github.com/cosmos/cosmos-sdk/pull/5017) The `x/genaccounts` module has been deprecated and all components removed except the `legacy/` package. -* [\#4486](https://github.com/cosmos/cosmos-sdk/issues/4486) Vesting account types decoupled from the `x/auth` module and now live under `x/auth/vesting`. Applications wishing to use vesting account types must be sure to register types via `RegisterCodec` under the new vesting package. -* [\#4486](https://github.com/cosmos/cosmos-sdk/issues/4486) The `NewBaseVestingAccount` constructor returns an error -if the provided arguments are invalid. -* (x/auth) [\#5006](https://github.com/cosmos/cosmos-sdk/pull/5006) Modular `AnteHandler` via composable decorators: - * The `AnteHandler` interface now returns `(newCtx Context, err error)` instead of `(newCtx Context, result sdk.Result, abort bool)` - * The `NewAnteHandler` function returns an `AnteHandler` function that returns the new `AnteHandler` - interface and has been moved into the `auth/ante` directory. - * `ValidateSigCount`, `ValidateMemo`, `ProcessPubKey`, `EnsureSufficientMempoolFee`, and `GetSignBytes` - have all been removed as public functions. - * Invalid Signatures may return `InvalidPubKey` instead of `Unauthorized` error, since the transaction - will first hit `SetPubKeyDecorator` before the `SigVerificationDecorator` runs. - * `StdTx#GetSignatures` will return an array of just signature byte slices `[][]byte` instead of - returning an array of `StdSignature` structs. To replicate the old behavior, use the public field - `StdTx.Signatures` to get back the array of StdSignatures `[]StdSignature`. -* (modules) [\#5299](https://github.com/cosmos/cosmos-sdk/pull/5299) `HandleDoubleSign` along with params `MaxEvidenceAge` and `DoubleSignJailEndTime` have moved from the `x/slashing` module to the `x/evidence` module. -* (keys) [\#4941](https://github.com/cosmos/cosmos-sdk/issues/4941) Keybase concrete types constructors such as `NewKeyBaseFromDir` and `NewInMemory` now accept optional parameters of type `KeybaseOption`. These -optional parameters are also added on the keys sub-commands functions, which are now public, and allows -these options to be set on the commands or ignored to default to previous behavior. -* [\#5547](https://github.com/cosmos/cosmos-sdk/pull/5547) `NewKeyBaseFromHomeFlag` constructor has been removed. -* [\#5439](https://github.com/cosmos/cosmos-sdk/pull/5439) Further modularization was done to the `keybase` -package to make it more suitable for use with different key formats and algorithms: - * The `WithKeygenFunc` function added as a `KeybaseOption` which allows a custom bytes to key - implementation to be defined when keys are created. - * The `WithDeriveFunc` function added as a `KeybaseOption` allows custom logic for deriving a key - from a mnemonic, bip39 password, and HD Path. - * BIP44 is no longer build into `keybase.CreateAccount()`. It is however the default when using - the `client/keys` add command. - * `SupportedAlgos` and `SupportedAlgosLedger` functions return a slice of `SigningAlgo`s that are - supported by the keybase and the ledger integration respectively. -* (simapp) [\#5419](https://github.com/cosmos/cosmos-sdk/pull/5419) The `helpers.GenTx()` now accepts a gas argument. -* (baseapp) [\#5455](https://github.com/cosmos/cosmos-sdk/issues/5455) A `sdk.Context` is now passed into the `router.Route()` function. - -### Client Breaking Changes +# Changelog -* (rest) [\#5270](https://github.com/cosmos/cosmos-sdk/issues/5270) All account types now implement custom JSON serialization. -* (rest) [\#4783](https://github.com/cosmos/cosmos-sdk/issues/4783) The balance field in the DelegationResponse type is now sdk.Coin instead of sdk.Int -* (x/auth) [\#5006](https://github.com/cosmos/cosmos-sdk/pull/5006) The gas required to pass the `AnteHandler` has -increased significantly due to modular `AnteHandler` support. Increase GasLimit accordingly. -* (rest) [\#5336](https://github.com/cosmos/cosmos-sdk/issues/5336) `MsgEditValidator` uses `description` instead of `Description` as a JSON key. -* (keys) [\#5097](https://github.com/cosmos/cosmos-sdk/pull/5097) Due to the keybase -> keyring transition, keys need to be migrated. See `keys migrate` command for more info. -* (x/auth) [\#5424](https://github.com/cosmos/cosmos-sdk/issues/5424) Drop `decode-tx` command from x/auth/client/cli, duplicate of the `decode` command. +## [Unreleased](https://github.com/line/lbm-sdk/compare/v0.44.0-rc...HEAD) ### Features -* (store) [\#5435](https://github.com/cosmos/cosmos-sdk/pull/5435) New iterator for paginated requests. Iterator limits DB reads to the range of the requested page. -* (x/evidence) [\#5240](https://github.com/cosmos/cosmos-sdk/pull/5240) Initial implementation of the `x/evidence` module. -* (cli) [\#5212](https://github.com/cosmos/cosmos-sdk/issues/5212) The `q gov proposals` command now supports pagination. -* (store) [\#4724](https://github.com/cosmos/cosmos-sdk/issues/4724) Multistore supports substore migrations upon load. New `rootmulti.Store.LoadLatestVersionAndUpgrade` method in -`Baseapp` supports `StoreLoader` to enable various upgrade strategies. It no -longer panics if the store to load contains substores that we didn't explicitly mount. -* [\#4972](https://github.com/cosmos/cosmos-sdk/issues/4972) A `TxResponse` with a corresponding code -and tx hash will be returned for specific Tendermint errors: - * `CodeTxInMempoolCache` - * `CodeMempoolIsFull` - * `CodeTxTooLarge` -* [\#3872](https://github.com/cosmos/cosmos-sdk/issues/3872) Implement a RESTful endpoint and cli command to decode transactions. -* (keys) [\#4754](https://github.com/cosmos/cosmos-sdk/pull/4754) Introduce new Keybase implementation that can -leverage operating systems' built-in functionalities to securely store secrets. MacOS users may encounter -the following [issue](https://github.com/keybase/go-keychain/issues/47) with the `go-keychain` library. If -you encounter this issue, you must upgrade your xcode command line tools to version >= `10.2`. You can -upgrade via: `sudo rm -rf /Library/Developer/CommandLineTools; xcode-select --install`. Verify the -correct version via: `pkgutil --pkg-info=com.apple.pkg.CLTools_Executables`. -* [\#5355](https://github.com/cosmos/cosmos-sdk/pull/5355) Client commands accept a new `--keyring-backend` option through which users can specify which backend should be used -by the new key store: - * `os`: use OS default credentials storage (default). - * `file`: use encrypted file-based store. - * `kwallet`: use [KDE Wallet](https://utils.kde.org/projects/kwalletmanager/) service. - * `pass`: use the [pass](https://www.passwordstore.org/) command line password manager. - * `test`: use password-less key store. *For testing purposes only. Use it at your own risk.* -* (keys) [\#5097](https://github.com/cosmos/cosmos-sdk/pull/5097) New `keys migrate` command to assist users migrate their keys -to the new keyring. -* (keys) [\#5366](https://github.com/cosmos/cosmos-sdk/pull/5366) `keys list` now accepts a `--list-names` option to list key names only, whilst the `keys delete` -command can delete multiple keys by passing their names as arguments. The aforementioned commands can then be piped together, e.g. -`appcli keys list -n | xargs appcli keys delete` -* (modules) [\#4233](https://github.com/cosmos/cosmos-sdk/pull/4233) Add upgrade module that coordinates software upgrades of live chains. -* [\#4486](https://github.com/cosmos/cosmos-sdk/issues/4486) Introduce new `PeriodicVestingAccount` vesting account type -that allows for arbitrary vesting periods. -* (baseapp) [\#5196](https://github.com/cosmos/cosmos-sdk/pull/5196) Baseapp has a new `runTxModeReCheck` to allow applications to skip expensive and unnecessary re-checking of transactions. -* (types) [\#5196](https://github.com/cosmos/cosmos-sdk/pull/5196) Context has new `IsRecheckTx() bool` and `WithIsReCheckTx(bool) Context` methods to to be used in the `AnteHandler`. -* (x/auth/ante) [\#5196](https://github.com/cosmos/cosmos-sdk/pull/5196) AnteDecorators have been updated to avoid unnecessary checks when `ctx.IsReCheckTx() == true` -* (x/auth) [\#5006](https://github.com/cosmos/cosmos-sdk/pull/5006) Modular `AnteHandler` via composable decorators: - * The `AnteDecorator` interface has been introduced to allow users to implement modular `AnteHandler` - functionality that can be composed together to create a single `AnteHandler` rather than implementing - a custom `AnteHandler` completely from scratch, where each `AnteDecorator` allows for custom behavior in - tightly defined and logically isolated manner. These custom `AnteDecorator` can then be chained together - with default `AnteDecorator` or third-party `AnteDecorator` to create a modularized `AnteHandler` - which will run each `AnteDecorator` in the order specified in `ChainAnteDecorators`. For details - on the new architecture, refer to the [ADR](docs/architecture/adr-010-modular-antehandler.md). - * `ChainAnteDecorators` function has been introduced to take in a list of `AnteDecorators` and chain - them in sequence and return a single `AnteHandler`: - * `SetUpContextDecorator`: Sets `GasMeter` in context and creates defer clause to recover from any - `OutOfGas` panics in future AnteDecorators and return `OutOfGas` error to `BaseApp`. It MUST be the - first `AnteDecorator` in the chain for any application that uses gas (or another one that sets the gas meter). - * `ValidateBasicDecorator`: Calls tx.ValidateBasic and returns any non-nil error. - * `ValidateMemoDecorator`: Validates tx memo with application parameters and returns any non-nil error. - * `ConsumeGasTxSizeDecorator`: Consumes gas proportional to the tx size based on application parameters. - * `MempoolFeeDecorator`: Checks if fee is above local mempool `minFee` parameter during `CheckTx`. - * `DeductFeeDecorator`: Deducts the `FeeAmount` from first signer of the transaction. - * `SetPubKeyDecorator`: Sets pubkey of account in any account that does not already have pubkey saved in state machine. - * `SigGasConsumeDecorator`: Consume parameter-defined amount of gas for each signature. - * `SigVerificationDecorator`: Verify each signature is valid, return if there is an error. - * `ValidateSigCountDecorator`: Validate the number of signatures in tx based on app-parameters. - * `IncrementSequenceDecorator`: Increments the account sequence for each signer to prevent replay attacks. -* (cli) [\#5223](https://github.com/cosmos/cosmos-sdk/issues/5223) Cosmos Ledger App v2.0.0 is now supported. The changes are backwards compatible and App v1.5.x is still supported. -* (x/staking) [\#5380](https://github.com/cosmos/cosmos-sdk/pull/5380) Introduced ability to store historical info entries in staking keeper, allows applications to introspect specified number of past headers and validator sets - * Introduces new parameter `HistoricalEntries` which allows applications to determine how many recent historical info entries they want to persist in store. Default value is 0. - * Introduces cli commands and rest routes to query historical information at a given height -* (modules) [\#5249](https://github.com/cosmos/cosmos-sdk/pull/5249) Funds are now allowed to be directly sent to the community pool (via the distribution module account). -* (keys) [\#4941](https://github.com/cosmos/cosmos-sdk/issues/4941) Introduce keybase option to allow overriding the default private key implementation of a key generated through the `keys add` cli command. -* (keys) [\#5439](https://github.com/cosmos/cosmos-sdk/pull/5439) Flags `--algo` and `--hd-path` are added to - `keys add` command in order to make use of keybase modularized. By default, it uses (0, 0) bip44 - HD path and secp256k1 keys, so is non-breaking. -* (types) [\#5447](https://github.com/cosmos/cosmos-sdk/pull/5447) Added `ApproxRoot` function to sdk.Decimal type in order to get the nth root for a decimal number, where n is a positive integer. - * An `ApproxSqrt` function was also added for convenience around the common case of n=2. - -### Improvements - -* (iavl) [\#5538](https://github.com/cosmos/cosmos-sdk/pull/5538) Remove manual IAVL pruning in favor of IAVL's internal pruning strategy. -* (server) [\#4215](https://github.com/cosmos/cosmos-sdk/issues/4215) The `--pruning` flag -has been moved to the configuration file, to allow easier node configuration. -* (cli) [\#5116](https://github.com/cosmos/cosmos-sdk/issues/5116) The `CLIContext` now supports multiple verifiers -when connecting to multiple chains. The connecting chain's `CLIContext` will have to have the correct -chain ID and node URI or client set. To use a `CLIContext` with a verifier for another chain: - ```go - // main or parent chain (chain as if you're running without IBC) - mainCtx := context.NewCLIContext() - - // connecting IBC chain - sideCtx := context.NewCLIContext(). - WithChainID(sideChainID). - WithNodeURI(sideChainNodeURI) // or .WithClient(...) - - sideCtx = sideCtx.WithVerifier( - context.CreateVerifier(sideCtx, context.DefaultVerifierCacheSize), - ) - ``` -* (modules) [\#5017](https://github.com/cosmos/cosmos-sdk/pull/5017) The `x/auth` package now supports -generalized genesis accounts through the `GenesisAccount` interface. -* (modules) [\#4762](https://github.com/cosmos/cosmos-sdk/issues/4762) Deprecate remove and add permissions in ModuleAccount. -* (modules) [\#4760](https://github.com/cosmos/cosmos-sdk/issues/4760) update `x/auth` to match module spec. -* (modules) [\#4814](https://github.com/cosmos/cosmos-sdk/issues/4814) Add security contact to Validator description. -* (modules) [\#4875](https://github.com/cosmos/cosmos-sdk/issues/4875) refactor integration tests to use SimApp and separate test package -* (sdk) [\#4566](https://github.com/cosmos/cosmos-sdk/issues/4566) Export simulation's parameters and app state to JSON in order to reproduce bugs and invariants. -* (sdk) [\#4640](https://github.com/cosmos/cosmos-sdk/issues/4640) improve import/export simulation errors by extending `DiffKVStores` to return an array of `KVPairs` that are then compared to check for inconsistencies. -* (sdk) [\#4717](https://github.com/cosmos/cosmos-sdk/issues/4717) refactor `x/slashing` to match the new module spec -* (sdk) [\#4758](https://github.com/cosmos/cosmos-sdk/issues/4758) update `x/genaccounts` to match module spec -* (simulation) [\#4824](https://github.com/cosmos/cosmos-sdk/issues/4824) `PrintAllInvariants` flag will print all failed invariants -* (simulation) [\#4490](https://github.com/cosmos/cosmos-sdk/issues/4490) add `InitialBlockHeight` flag to resume a simulation from a given block - - * Support exporting the simulation stats to a given JSON file -* (simulation) [\#4847](https://github.com/cosmos/cosmos-sdk/issues/4847), [\#4838](https://github.com/cosmos/cosmos-sdk/pull/4838) and [\#4869](https://github.com/cosmos/cosmos-sdk/pull/4869) `SimApp` and simulation refactors: - * Implement `SimulationManager` for executing modules' simulation functionalities in a modularized way - * Add `RegisterStoreDecoders` to the `SimulationManager` for decoding each module's types - * Add `GenerateGenesisStates` to the `SimulationManager` to generate a randomized `GenState` for each module - * Add `RandomizedParams` to the `SimulationManager` that registers each modules' parameters in order to - simulate `ParamChangeProposal`s' `Content`s - * Add `WeightedOperations` to the `SimulationManager` that define simulation operations (modules' `Msg`s) with their - respective weights (i.e chance of being simulated). - * Add `ProposalContents` to the `SimulationManager` to register each module's governance proposal `Content`s. -* (simulation) [\#4893](https://github.com/cosmos/cosmos-sdk/issues/4893) Change `SimApp` keepers to be public and add getter functions for keys and codec -* (simulation) [\#4906](https://github.com/cosmos/cosmos-sdk/issues/4906) Add simulation `Config` struct that wraps simulation flags -* (simulation) [\#4935](https://github.com/cosmos/cosmos-sdk/issues/4935) Update simulation to reflect a proper `ABCI` application without bypassing `BaseApp` semantics -* (simulation) [\#5378](https://github.com/cosmos/cosmos-sdk/pull/5378) Simulation tests refactor: - * Add `App` interface for general SDK-based app's methods. - * Refactor and cleanup simulation tests into util functions to simplify their implementation for other SDK apps. -* (store) [\#4792](https://github.com/cosmos/cosmos-sdk/issues/4792) panic on non-registered store -* (types) [\#4821](https://github.com/cosmos/cosmos-sdk/issues/4821) types/errors package added with support for stacktraces. It is meant as a more feature-rich replacement for sdk.Errors in the mid-term. -* (store) [\#1947](https://github.com/cosmos/cosmos-sdk/issues/1947) Implement inter-block (persistent) -caching through `CommitKVStoreCacheManager`. Any application wishing to utilize an inter-block cache -must set it in their app via a `BaseApp` option. The `BaseApp` docs have been drastically improved -to detail this new feature and how state transitions occur. -* (docs/spec) All module specs moved into their respective module dir in x/ (i.e. docs/spec/staking -->> x/staking/spec) -* (docs/) [\#5379](https://github.com/cosmos/cosmos-sdk/pull/5379) Major documentation refactor, including: - * (docs/intro/) Add and improve introduction material for newcomers. - * (docs/basics/) Add documentation about basic concepts of the cosmos sdk such as the anatomy of an SDK application, the transaction lifecycle or accounts. - * (docs/core/) Add documentation about core conepts of the cosmos sdk such as `baseapp`, `server`, `store`s, `context` and more. - * (docs/building-modules/) Add reference documentation on concepts relevant for module developers (`keeper`, `handler`, `messages`, `queries`,...). - * (docs/interfaces/) Add documentation on building interfaces for the Cosmos SDK. - * Redesigned user interface that features new dynamically generated sidebar, build-time code embedding from GitHub, new homepage as well as many other improvements. -* (types) [\#5428](https://github.com/cosmos/cosmos-sdk/pull/5428) Add `Mod` (modulo) method and `RelativePow` (exponentation) function for `Uint`. -* (modules) [\#5506](https://github.com/cosmos/cosmos-sdk/pull/5506) Remove redundancy in `x/distribution`s use of parameters. There - now exists a single `Params` type with a getter and setter along with a getter for each individual parameter. - -### Bug Fixes - -* (client) [\#5303](https://github.com/cosmos/cosmos-sdk/issues/5303) Fix ignored error in tx generate only mode. -* (cli) [\#4763](https://github.com/cosmos/cosmos-sdk/issues/4763) Fix flag `--min-self-delegation` for staking `EditValidator` -* (keys) Fix ledger custom coin type support bug. -* (x/gov) [\#5107](https://github.com/cosmos/cosmos-sdk/pull/5107) Sum validator operator's all voting power when tally votes -* (rest) [\#5212](https://github.com/cosmos/cosmos-sdk/issues/5212) Fix pagination in the `/gov/proposals` handler. - -## [v0.37.14] - 2020-08-12 - -### Improvements - -* (tendermint) Bump Tendermint version to [v0.32.13](https://github.com/tendermint/tendermint/releases/tag/v0.32.13). - - -## [v0.37.13] - 2020-06-03 - -### Improvements - -* (tendermint) Bump Tendermint version to [v0.32.12](https://github.com/tendermint/tendermint/releases/tag/v0.32.12). -* (cosmos-ledger-go) Bump Cosmos Ledger Wallet library version to [v0.11.1](https://github.com/cosmos/ledger-cosmos-go/releases/tag/v0.11.1). - -## [v0.37.12] - 2020-05-05 - -### Improvements - -* (tendermint) Bump Tendermint version to [v0.32.11](https://github.com/tendermint/tendermint/releases/tag/v0.32.11). - -## [v0.37.11] - 2020-04-22 - -### Bug Fixes - -* (x/staking) [\#6021](https://github.com/cosmos/cosmos-sdk/pull/6021) --trust-node's false default value prevents creation of the genesis transaction. - -## [v0.37.10] - 2020-04-22 - -### Bug Fixes - -* (client/context) [\#5964](https://github.com/cosmos/cosmos-sdk/issues/5964) Fix incorrect instantiation of tmlite verifier when --trust-node is off. - -## [v0.37.9] - 2020-04-09 - -### Improvements - -* (tendermint) Bump Tendermint version to [v0.32.10](https://github.com/tendermint/tendermint/releases/tag/v0.32.10). - -## [v0.37.8] - 2020-03-11 - -### Bug Fixes - -* (rest) [\#5508](https://github.com/cosmos/cosmos-sdk/pull/5508) Fix `x/distribution` endpoints to properly return height in the response. -* (x/genutil) [\#5499](https://github.com/cosmos/cosmos-sdk/pull/) Ensure `DefaultGenesis` returns valid and non-nil default genesis state. -* (x/genutil) [\#5775](https://github.com/cosmos/cosmos-sdk/pull/5775) Fix `ExportGenesis` in `x/genutil` to export default genesis state (`[]`) instead of `null`. -* (genesis) [\#5086](https://github.com/cosmos/cosmos-sdk/issues/5086) Ensure `gentxs` are always an empty array instead of `nil`. - -### Improvements - -* (rest) [\#5648](https://github.com/cosmos/cosmos-sdk/pull/5648) Enhance /txs usability: - * Add `tx.minheight` key to filter transaction with an inclusive minimum block height - * Add `tx.maxheight` key to filter transaction with an inclusive maximum block height - -## [v0.37.7] - 2020-02-10 - ### Improvements -* (modules) [\#5597](https://github.com/cosmos/cosmos-sdk/pull/5597) Add `amount` event attribute to the `complete_unbonding` -and `complete_redelegation` events that reflect the total balances of the completed unbondings and redelegations -respectively. - ### Bug Fixes -* (x/gov) [\#5622](https://github.com/cosmos/cosmos-sdk/pull/5622) Track any events emitted from a proposal's handler upon successful execution. -* (x/bank) [\#5531](https://github.com/cosmos/cosmos-sdk/issues/5531) Added missing amount event to MsgMultiSend, emitted for each output. - -## [v0.37.6] - 2020-01-21 +### Breaking Changes -### Improvements +### Build, CI -* (tendermint) Bump Tendermint version to [v0.32.9](https://github.com/tendermint/tendermint/releases/tag/v0.32.9) +### Document Updates -## [v0.37.5] - 2020-01-07 +## [v0.44.0-rc0](https://github.com/line/lbm-sdk/releases/tag/v0.44.0-rc0) - 2022-02-04 ### Features - -* (types) [\#5360](https://github.com/cosmos/cosmos-sdk/pull/5360) Implement `SortableDecBytes` which - allows the `Dec` type be sortable. +* (feat) [\#352] (https://github.com/line/lbm-sdk/pull/352) iavl, db & disk stats logging +* (x/gov) [\#368](https://github.com/line/lbm-sdk/pull/368) Governance Split Votes, use `MsgWeightedVote` to send a split vote. Sending a regular `MsgVote` will convert the underlying vote option into a weighted vote with weight 1. +* (x/upgrade) [\#377] (https://github.com/line/lbm-sdk/pull/377) To smoothen the update to the latest stable release, the SDK includes vesion map for managing migrations between SDK versions. +* (x/wasm) [\#358] (https://github.com/line/lbm-sdk/pull/358) change wasm metrics method to using prometheus directly +* (x/feegrant) [\#380] (https://github.com/line/lbm-sdk/pull/380) Feegrant module +* (x/wasm) [\#395] (https://github.com/line/lbm-sdk/pull/395) Add the instantiate_permission in the CodeInfoResponse +* (x/consortium) [\#406] (https://github.com/line/lbm-sdk/pull/406) Add CreateValidator access control feature +* (x/bank) [\#400] (https://github.com/line/lbm-sdk/pull/400) add `bankplus` function to restrict to send coin to inactive smart contract. ### Improvements - -* (tendermint) Bump Tendermint version to [v0.32.8](https://github.com/tendermint/tendermint/releases/tag/v0.32.8) -* (cli) [\#5482](https://github.com/cosmos/cosmos-sdk/pull/5482) Remove old "tags" nomenclature from the `q txs` command in - favor of the new events system. Functionality remains unchanged except that `=` is used instead of `:` to be - consistent with the API's use of event queries. +* (slashing) [\#347](https://github.com/line/lbm-sdk/pull/347) Introduce VoterSetCounter +* (auth) [\#348](https://github.com/line/lbm-sdk/pull/348) Increase default valid_sig_block_period ### Bug Fixes +* (x/feegrant) [\#383] (https://github.com/line/lbm-sdk/pull/383) Update allowance inside AllowedMsgAllowance +* (tm-db) [\#388] (https://github.com/line/lbm-sdk/pull/388) Bump up tm-db fixing invalid memory reference +* (swagger) [\#391] (https://github.com/line/lbm-sdk/pull/391) fix swagger's config path for wasm +* (x/wasm) [\#393] (https://github.com/line/lbm-sdk/pull/393) fix bug where `StoreCodeAndInstantiateContract`, `UpdateContractStatus`, `UpdateContractStatusProposal` API does not work +* (x/slashing) [\#407] (https://github.com/line/lbm-sdk/pull/407) Fix query signing infos command -* (iavl) [\#5276](https://github.com/cosmos/cosmos-sdk/issues/5276) Fix potential race condition in `iavlIterator#Close`. -* (baseapp) [\#5350](https://github.com/cosmos/cosmos-sdk/issues/5350) Allow a node to restart successfully - after a `halt-height` or `halt-time` has been triggered. -* (types) [\#5395](https://github.com/cosmos/cosmos-sdk/issues/5395) Fix `Uint#LTE`. -* (types) [\#5408](https://github.com/cosmos/cosmos-sdk/issues/5408) `NewDecCoins` constructor now sorts the coins. - -## [v0.37.4] - 2019-11-04 - -### Improvements +### Breaking Changes +* (x/consortium) [\#411] (https://github.com/line/lbm-sdk/pull/411) Validate validator addresses in update-validator-auths proposal -* (tendermint) Bump Tendermint version to [v0.32.7](https://github.com/tendermint/tendermint/releases/tag/v0.32.7) -* (ledger) [\#4716](https://github.com/cosmos/cosmos-sdk/pull/4716) Fix ledger custom coin type support bug. +### Build, CI +* (ci) [\#350](https://github.com/line/lbm-sdk/pull/350) Reduce sim test time +* (ci) [\#351](https://github.com/line/lbm-sdk/pull/351) Remove diff condition from sim-normal -### Bug Fixes +### Document Updates +* (docs) [\#361](https://github.com/line/lbm-sdk/pull/361) Add sample command docs +* (docs) [\#392](https://github.com/line/lbm-sdk/pull/392) Modify with latest version of swagger REST interface docs. -* (baseapp) [\#5200](https://github.com/cosmos/cosmos-sdk/issues/5200) Remove duplicate events from previous messages. -## [v0.37.3] - 2019-10-10 +## [v0.43.1](https://github.com/line/lbm-sdk/releases/tag/v0.43.1) ### Bug Fixes +* (distribution) [\#364](https://github.com/line/lbm-sdk/pull/364) Force genOrBroadcastFn even when max-msgs != 0 +* (bank) [\#366](https://github.com/line/lbm-sdk/pull/366) Check bech32 address format in bank query -* (genesis) [\#5095](https://github.com/cosmos/cosmos-sdk/issues/5095) Fix genesis file migration from v0.34 to -v0.36/v0.37 not converting validator consensus pubkey to bech32 format. - -### Improvements - -* (tendermint) Bump Tendermint version to [v0.32.6](https://github.com/tendermint/tendermint/releases/tag/v0.32.6) - -## [v0.37.1] - 2019-09-19 +## [v0.43.0](https://github.com/line/lbm-sdk/releases/tag/v0.43.0) ### Features - -### Improvements - -### Bug Fixes +* (global) [\#97](https://github.com/line/lbm-sdk/pull/97) Add codespace to query error +* (config) [\#114](https://github.com/line/lbm-sdk/pull/114) Add idle-timeout to rest server and rpc server config +* (x/wasm) [\#127](https://github.com/line/lbm-sdk/pull/127) Add wasm with Staragate migration completed. +* (x/wasm) [\#151](https://github.com/line/lbm-sdk/pull/151) Add contract access control. +* (x/wasm) [\#194](https://github.com/line/lbm-sdk/pull/194) Replace importing CosmWasm/wasmvm with line/wasmvm. +* (x/auth) [\#176](https://github.com/line/lbm-sdk/pull/176) Add MsgEmpty to auth module +* (metric) [\#184](https://github.com/line/lbm-sdk/pull/184) Add prometheus metrics for caches reverting telemetry metrics +* (grpc) [\#291](https://github.com/line/lbm-sdk/pull/291) Add GRPC API the BlockByHash and BlockResultsByHeight, add prove parameter to GetTxsEvent + +### Improvements +* (bump-up) [\#93](https://github.com/line/lbm-sdk/pull/93) Adopt ostracon, line/tm-db and line/iavl +* (bump-up) [\#107](https://github.com/line/lbm-sdk/pull/107) Bump up tm-db, iavl and ostracon +* (script) [\#110](https://github.com/line/lbm-sdk/pull/110) Add script initializing simd +* (bump-up) [\#118](https://github.com/line/lbm-sdk/pull/118) Bump up tm-db and remove Domain() call +* (test) [\#128](https://github.com/line/lbm-sdk/pull/128) Allow creating new test network without init +* (db) [\#136](https://github.com/line/lbm-sdk/pull/136) Fix DB_BACKEND configuration +* (global) [\#140](https://github.com/line/lbm-sdk/pull/140) Modify default coin type, default address prefix +* (perf) [\#141](https://github.com/line/lbm-sdk/pull/141) Concurrent `checkTx` +* (perf) [\#142](https://github.com/line/lbm-sdk/pull/142) Implement `validateGasWanted()` +* (perf) [\#143](https://github.com/line/lbm-sdk/pull/143) Signature verification cache +* (global) [\#145](https://github.com/line/lbm-sdk/pull/145) Modify key type name +* (perf) [\#155](https://github.com/line/lbm-sdk/pull/155) Concurrent recheckTx +* (global) [\#158](https://github.com/line/lbm-sdk/pull/158) Remove tm-db dependency +* (x/wasm) [\#162](https://github.com/line/lbm-sdk/pull/162) Add missed UpdateContractStatusProposal types +* (perf) [\#164](https://github.com/line/lbm-sdk/pull/164) Sse fastcache +* (build) [\#181](https://github.com/line/lbm-sdk/pull/181) Raise codecov-action version to 1.5.0 +* (build) [\#195](https://github.com/line/lbm-sdk/pull/195) Build properly when using libsecp256k1 +* (perf) [\#198](https://github.com/line/lbm-sdk/pull/198) Caching paramset +* (global) [\#200](https://github.com/line/lbm-sdk/pull/200) Add a env prefix +* (store) [\#202](https://github.com/line/lbm-sdk/pull/202) Param store doesn't use gas kv +* (store) [\#203](https://github.com/line/lbm-sdk/pull/203) Remove transient store that is not used now +* (perf) [\#204](https://github.com/line/lbm-sdk/pull/204) Apply rw mutex to cachekv +* (perf) [\#208](https://github.com/line/lbm-sdk/pull/208) Use easyjson instead of amino when marshal abci logs +* (perf) [\#209](https://github.com/line/lbm-sdk/pull/209) Apply async reactor ostracon +* (proto) [\#212](https://github.com/line/lbm-sdk/pull/212) Reformat proto files and restore proto docs +* (perf) [\#216](https://github.com/line/lbm-sdk/pull/216) Memoize bech32 encoding and decoding +* (perf) [\#218](https://github.com/line/lbm-sdk/pull/218) Rootmulti store parallel commit +* (perf) [\#219](https://github.com/line/lbm-sdk/pull/219) Fix bech32 cache to get bech32 from proper cache +* (bump-up) [\#221](https://github.com/line/lbm-sdk/pull/221) Bump up iavl for parallel processing of batches +* (perf) [\#224](https://github.com/line/lbm-sdk/pull/224) Updated log time to have milliseconds +* (bump-up) [\#228](https://github.com/line/lbm-sdk/pull/228) Bump up ostracon to optimize checking the txs size +* (global) [\#230](https://github.com/line/lbm-sdk/pull/230) Modify module name to lfb-sdk +* (bump-up) [\#246](https://github.com/line/lbm-sdk/pull/246) Bump up ostracon to not flush wal when receive consensus msgs +* (wasm) [\#250](https://github.com/line/lbm-sdk/pull/250) Migrate linkwasmd to the latest commit +* (wasm) [\#253](https://github.com/line/lbm-sdk/pull/253) remove MaxGas const +* (wasm) [\#254](https://github.com/line/lbm-sdk/pull/254) Specify wasm event types +* (x) [\#255](https://github.com/line/lbm-sdk/pull/255) Remove legacy from modules +* (perf) [\#320](https:/github.com/line/lbm-sdk/pull/320) internal objects optimization (BaseAccount, Balance & Supply) +* (auth) [\#344](https://github.com/line/lbm-sdk/pull/344) move SigBlockHeight from TxBody into AuthInfo + +### Bug Fixes +* (test) [\#92](https://github.com/line/lbm-sdk/pull/92) Fix SendToModuleAccountTest +* (store) [\#105](https://github.com/line/lbm-sdk/pull/105) Check `store == nil` +* (test) [\#133](https://github.com/line/lbm-sdk/pull/133) Fix `Test_runImportCmd()` +* (config) [\#138](https://github.com/line/lbm-sdk/pull/138) Fix getting coin type at running cmd +* (race) [\#159](https://github.com/line/lbm-sdk/pull/159) Fix test-race failure +* (test) [\#193](https://github.com/line/lbm-sdk/pull/193) Allow to add new validator in test network +* (client) [\#286](https://github.com/line/lbm-sdk/pull/286) Fix invalid type casting for error +* (test) [\#326](https://github.com/line/lbm-sdk/pull/326) Enable sim test and fix address related bug ### Breaking Changes +* (global) [\#90](https://github.com/line/lbm-sdk/pull/90) Revise module path to `github.com/line/lfb-sdk` +* (rpc) [\#97](https://github.com/line/lbm-sdk/pull/97) Send response with 404 status when quering non-exist account +* (proto) [\#106](https://github.com/line/lbm-sdk/pull/106) Rename package of proto files +* (api) [\#130](https://github.com/line/lbm-sdk/pull/130) Rename rest apis +* (auth) [\#265](https://github.com/line/lbm-sdk/pull/265) Introduce sig block height for the new replay protection +* (global) [\#298](https://github.com/line/lbm-sdk/pull/298) Treat addresses as strings +* (ostracon) [\#317](https://github.com/line/lbm-sdk/pull/317) Integrate Ostracon including vrf election and voter concept +* (global) [\#323](https://github.com/line/lfb-sdk/pull/323) Re-brand lfb-sdk to lbm-sdk +* (proto) [\#338](https://github.com/line/lbm-sdk/pull/338) Upgrade proto buf from v1beta1 to v1 ### Build, CI +* (ci) [\#234](https://github.com/line/lbm-sdk/pull/234) Fix branch name in ci script +* (docker) [\#264](https://github.com/line/lbm-sdk/pull/264) Remove docker publish ### Document Updates +* (docs) [\#205](https://github.com/line/lbm-sdk/pull/205) Renewal docs for open source +* (docs) [\#207](https://github.com/line/lbm-sdk/pull/207) Fix license +* (docs) [\#211](https://github.com/line/lbm-sdk/pull/211) Remove codeowners +* (docs) [\#248](https://github.com/line/lbm-sdk/pull/248) Add PR procedure, apply main branch +* (docs) [\#256](https://github.com/line/lbm-sdk/pull/256) Modify copyright and contributing +* (docs) [\#259](https://github.com/line/lbm-sdk/pull/259) Modify copyright, verified from legal team +* (docs) [\#260](https://github.com/line/lbm-sdk/pull/260) Remove gov, ibc and readme of wasm module +* (docs) [\#262](https://github.com/line/lbm-sdk/pull/262) Fix link urls, remove invalid reference +* (docs) [\#328](https://github.com/line/lbm-sdk/pull/328) Update quick start guide + +## [cosmos-sdk v0.42.1] - 2021-03-15 +Initial lbm-sdk is based on the cosmos-sdk v0.42.1 + +* (cosmos-sdk) [v0.42.0](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.42.1). + +Please refer [CHANGELOG_OF_COSMOS_SDK_v0.42.1](https://github.com/cosmos/cosmos-sdk/blob/v0.42.1/CHANGELOG.md) diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md index 8fb484b248..0319bc6e01 100644 --- a/docs/core/proto-docs.md +++ b/docs/core/proto-docs.md @@ -10168,7 +10168,6 @@ transaction. | ----- | ---- | ----- | ----------- | | `signer_infos` | [SignerInfo](#lbm.tx.v1.SignerInfo) | repeated | signer_infos defines the signing modes for the required signers. The number and order of elements must match the required signers from TxBody's messages. The first element is the primary signer and the one which pays the fee. | | `fee` | [Fee](#lbm.tx.v1.Fee) | | Fee is the fee and gas limit for the transaction. The first signer is the primary signer and the one which pays the fee. The fee can be calculated based on the cost of evaluating the body and doing signature verification of the signers. This can be estimated via simulation. | -| `sig_block_height` | [uint64](#uint64) | | sig block height is available between current block height and current block height - `VALID_SIG_BLOCK_PERIOD` this is used for distinguish signatures instead of account number. this is mandatory. | @@ -10305,6 +10304,7 @@ TxBody is the body of a transaction that all signers sign over. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | `messages` | [google.protobuf.Any](#google.protobuf.Any) | repeated | messages is a list of messages to be executed. The required signers of those messages define the number and order of elements in AuthInfo's signer_infos and Tx's signatures. Each required signer address is added to the list only the first time it occurs. By convention, the first required signer (usually from the first message) is referred to as the primary signer and pays the fee for the whole transaction. | +| `sig_block_height` | [uint64](#uint64) | | sig block height is available between current block height and current block height - `VALID_SIG_BLOCK_PERIOD` this is used for distinguish signatures instead of account number. this is mandatory. | | `memo` | [string](#string) | | memo is any arbitrary memo to be added to the transaction | | `timeout_height` | [uint64](#uint64) | | timeout is the block height after which this transaction will not be processed by the chain | | `extension_options` | [google.protobuf.Any](#google.protobuf.Any) | repeated | extension_options are arbitrary options that can be added by chains when the default options are not sufficient. If any of these are present and can't be handled, the transaction will be rejected | diff --git a/proto/lbm/tx/v1/tx.proto b/proto/lbm/tx/v1/tx.proto index 265151e4fc..597e627951 100644 --- a/proto/lbm/tx/v1/tx.proto +++ b/proto/lbm/tx/v1/tx.proto @@ -71,12 +71,16 @@ message TxBody { // transaction. repeated google.protobuf.Any messages = 1; + // sig block height is available between current block height and current block height - `VALID_SIG_BLOCK_PERIOD` + // this is used for distinguish signatures instead of account number. this is mandatory. + uint64 sig_block_height = 2; + // memo is any arbitrary memo to be added to the transaction - string memo = 2; + string memo = 3; // timeout is the block height after which this transaction will not // be processed by the chain - uint64 timeout_height = 3; + uint64 timeout_height = 4; // extension_options are arbitrary options that can be added by chains // when the default options are not sufficient. If any of these are present @@ -103,10 +107,6 @@ message AuthInfo { // based on the cost of evaluating the body and doing signature verification // of the signers. This can be estimated via simulation. Fee fee = 2; - - // sig block height is available between current block height and current block height - `VALID_SIG_BLOCK_PERIOD` - // this is used for distinguish signatures instead of account number. this is mandatory. - uint64 sig_block_height = 3; } // SignerInfo describes the public key and signing mode of a single top-level diff --git a/testutil/testdata/unknonwnproto.pb.go b/testutil/testdata/unknonwnproto.pb.go index 55b19c3863..01adb35e25 100644 --- a/testutil/testdata/unknonwnproto.pb.go +++ b/testutil/testdata/unknonwnproto.pb.go @@ -2567,9 +2567,10 @@ func (m *TestUpdatedTxRaw) GetNewField_1024() []byte { type TestUpdatedTxBody struct { Messages []*types.Any `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"` - Memo string `protobuf:"bytes,2,opt,name=memo,proto3" json:"memo,omitempty"` - TimeoutHeight int64 `protobuf:"varint,3,opt,name=timeout_height,json=timeoutHeight,proto3" json:"timeout_height,omitempty"` - SomeNewField uint64 `protobuf:"varint,4,opt,name=some_new_field,json=someNewField,proto3" json:"some_new_field,omitempty"` + SigBlockHeight uint64 `protobuf:"varint,2,opt,name=sig_block_height,json=sigBlockHeight,proto3" json:"sig_block_height,omitempty"` + Memo string `protobuf:"bytes,3,opt,name=memo,proto3" json:"memo,omitempty"` + TimeoutHeight int64 `protobuf:"varint,4,opt,name=timeout_height,json=timeoutHeight,proto3" json:"timeout_height,omitempty"` + SomeNewField uint64 `protobuf:"varint,5,opt,name=some_new_field,json=someNewField,proto3" json:"some_new_field,omitempty"` SomeNewFieldNonCriticalField string `protobuf:"bytes,1050,opt,name=some_new_field_non_critical_field,json=someNewFieldNonCriticalField,proto3" json:"some_new_field_non_critical_field,omitempty"` ExtensionOptions []*types.Any `protobuf:"bytes,1023,rep,name=extension_options,json=extensionOptions,proto3" json:"extension_options,omitempty"` NonCriticalExtensionOptions []*types.Any `protobuf:"bytes,2047,rep,name=non_critical_extension_options,json=nonCriticalExtensionOptions,proto3" json:"non_critical_extension_options,omitempty"` @@ -2615,6 +2616,13 @@ func (m *TestUpdatedTxBody) GetMessages() []*types.Any { return nil } +func (m *TestUpdatedTxBody) GetSigBlockHeight() uint64 { + if m != nil { + return m.SigBlockHeight + } + return 0 +} + func (m *TestUpdatedTxBody) GetMemo() string { if m != nil { return m.Memo @@ -2809,110 +2817,111 @@ func init() { func init() { proto.RegisterFile("unknonwnproto.proto", fileDescriptor_448ea787339d1228) } var fileDescriptor_448ea787339d1228 = []byte{ - // 1639 bytes of a gzipped FileDescriptorProto + // 1663 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x58, 0xcd, 0x6f, 0x1b, 0xc7, - 0x15, 0xd7, 0x70, 0x49, 0x89, 0x7c, 0xa2, 0x29, 0x66, 0xac, 0xb6, 0x1b, 0x3a, 0x66, 0x98, 0x85, - 0xea, 0x30, 0x41, 0x43, 0x9a, 0x4b, 0x06, 0x08, 0x72, 0x0a, 0xa9, 0x58, 0x95, 0x00, 0x55, 0x2e, - 0xa6, 0x4e, 0x5a, 0xf8, 0x42, 0x2c, 0xb9, 0x43, 0x72, 0x21, 0x72, 0x46, 0xdd, 0x9d, 0x95, 0xc8, - 0x5b, 0xd1, 0x1e, 0x7a, 0xcd, 0xa5, 0x28, 0xd0, 0xff, 0xa0, 0xa7, 0x22, 0xb7, 0x1e, 0x7b, 0xcc, - 0xa5, 0x80, 0x2f, 0x05, 0x0a, 0x14, 0x08, 0x0a, 0xfb, 0xda, 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8, 0x2c, 0x66, 0xea, 0xae, 0xb3, 0x69, 0xdd, 0xbd, 0x1d, + 0x95, 0x1d, 0xa1, 0xc7, 0x54, 0xb9, 0xfe, 0x89, 0xcf, 0xa4, 0xd0, 0xbf, 0x4f, 0xe1, 0x2c, 0xf2, + 0x37, 0x4f, 0xf4, 0xba, 0xbf, 0xff, 0xf9, 0xb3, 0x1a, 0x7a, 0xfa, 0xac, 0x86, 0xfe, 0xf9, 0xac, + 0x86, 0x7e, 0xf3, 0xbc, 0xb6, 0xf5, 0xf4, 0x79, 0x6d, 0xeb, 0xef, 0xcf, 0x6b, 0x5b, 0x8f, 0xdf, + 0xf1, 0x7c, 0x39, 0x09, 0x87, 0xcd, 0x11, 0x9f, 0xb5, 0xa6, 0x3e, 0xa3, 0xad, 0xe9, 0x70, 0xf6, + 0x9e, 0x70, 0x8f, 0x5a, 0x6a, 0x18, 0x84, 0xd2, 0x9f, 0xb6, 0x92, 0xa9, 0x30, 0xdc, 0xd6, 0x9c, + 0x76, 0xfe, 0x1b, 0x00, 0x00, 0xff, 0xff, 0xe4, 0xdc, 0xff, 0x25, 0xf3, 0x18, 0x00, 0x00, } func (m *Customer1) Marshal() (dAtA []byte, err error) { @@ -5252,19 +5261,24 @@ func (m *TestUpdatedTxBody) MarshalToSizedBuffer(dAtA []byte) (int, error) { if m.SomeNewField != 0 { i = encodeVarintUnknonwnproto(dAtA, i, uint64(m.SomeNewField)) i-- - dAtA[i] = 0x20 + dAtA[i] = 0x28 } if m.TimeoutHeight != 0 { i = encodeVarintUnknonwnproto(dAtA, i, uint64(m.TimeoutHeight)) i-- - dAtA[i] = 0x18 + dAtA[i] = 0x20 } if len(m.Memo) > 0 { i -= len(m.Memo) copy(dAtA[i:], m.Memo) i = encodeVarintUnknonwnproto(dAtA, i, uint64(len(m.Memo))) i-- - dAtA[i] = 0x12 + dAtA[i] = 0x1a + } + if m.SigBlockHeight != 0 { + i = encodeVarintUnknonwnproto(dAtA, i, uint64(m.SigBlockHeight)) + i-- + dAtA[i] = 0x10 } if len(m.Messages) > 0 { for iNdEx := len(m.Messages) - 1; iNdEx >= 0; iNdEx-- { @@ -6416,6 +6430,9 @@ func (m *TestUpdatedTxBody) Size() (n int) { n += 1 + l + sovUnknonwnproto(uint64(l)) } } + if m.SigBlockHeight != 0 { + n += 1 + sovUnknonwnproto(uint64(m.SigBlockHeight)) + } l = len(m.Memo) if l > 0 { n += 1 + l + sovUnknonwnproto(uint64(l)) @@ -12543,6 +12560,25 @@ func (m *TestUpdatedTxBody) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SigBlockHeight", wireType) + } + m.SigBlockHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowUnknonwnproto + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SigBlockHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Memo", wireType) } @@ -12574,7 +12610,7 @@ func (m *TestUpdatedTxBody) Unmarshal(dAtA []byte) error { } m.Memo = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field TimeoutHeight", wireType) } @@ -12593,7 +12629,7 @@ func (m *TestUpdatedTxBody) Unmarshal(dAtA []byte) error { break } } - case 4: + case 5: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field SomeNewField", wireType) } diff --git a/testutil/testdata/unknonwnproto.proto b/testutil/testdata/unknonwnproto.proto index c6c4e6d772..37a453f945 100644 --- a/testutil/testdata/unknonwnproto.proto +++ b/testutil/testdata/unknonwnproto.proto @@ -288,9 +288,10 @@ message TestUpdatedTxRaw { message TestUpdatedTxBody { repeated google.protobuf.Any messages = 1; - string memo = 2; - int64 timeout_height = 3; - uint64 some_new_field = 4; + uint64 sig_block_height = 2; + string memo = 3; + int64 timeout_height = 4; + uint64 some_new_field = 5; string some_new_field_non_critical_field = 1050; repeated google.protobuf.Any extension_options = 1023; repeated google.protobuf.Any non_critical_extension_options = 2047; diff --git a/types/tx/tx.pb.go b/types/tx/tx.pb.go index 9d4bbfaa8e..93182aed0a 100644 --- a/types/tx/tx.pb.go +++ b/types/tx/tx.pb.go @@ -245,11 +245,14 @@ type TxBody struct { // is referred to as the primary signer and pays the fee for the whole // transaction. Messages []*types.Any `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"` + // sig block height is available between current block height and current block height - `VALID_SIG_BLOCK_PERIOD` + // this is used for distinguish signatures instead of account number. this is mandatory. + SigBlockHeight uint64 `protobuf:"varint,2,opt,name=sig_block_height,json=sigBlockHeight,proto3" json:"sig_block_height,omitempty"` // memo is any arbitrary memo to be added to the transaction - Memo string `protobuf:"bytes,2,opt,name=memo,proto3" json:"memo,omitempty"` + Memo string `protobuf:"bytes,3,opt,name=memo,proto3" json:"memo,omitempty"` // timeout is the block height after which this transaction will not // be processed by the chain - TimeoutHeight uint64 `protobuf:"varint,3,opt,name=timeout_height,json=timeoutHeight,proto3" json:"timeout_height,omitempty"` + TimeoutHeight uint64 `protobuf:"varint,4,opt,name=timeout_height,json=timeoutHeight,proto3" json:"timeout_height,omitempty"` // extension_options are arbitrary options that can be added by chains // when the default options are not sufficient. If any of these are present // and can't be handled, the transaction will be rejected @@ -300,6 +303,13 @@ func (m *TxBody) GetMessages() []*types.Any { return nil } +func (m *TxBody) GetSigBlockHeight() uint64 { + if m != nil { + return m.SigBlockHeight + } + return 0 +} + func (m *TxBody) GetMemo() string { if m != nil { return m.Memo @@ -341,9 +351,6 @@ type AuthInfo struct { // based on the cost of evaluating the body and doing signature verification // of the signers. This can be estimated via simulation. Fee *Fee `protobuf:"bytes,2,opt,name=fee,proto3" json:"fee,omitempty"` - // sig block height is available between current block height and current block height - `VALID_SIG_BLOCK_PERIOD` - // this is used for distinguish signatures instead of account number. this is mandatory. - SigBlockHeight uint64 `protobuf:"varint,3,opt,name=sig_block_height,json=sigBlockHeight,proto3" json:"sig_block_height,omitempty"` } func (m *AuthInfo) Reset() { *m = AuthInfo{} } @@ -393,13 +400,6 @@ func (m *AuthInfo) GetFee() *Fee { return nil } -func (m *AuthInfo) GetSigBlockHeight() uint64 { - if m != nil { - return m.SigBlockHeight - } - return 0 -} - // SignerInfo describes the public key and signing mode of a single top-level // signer. type SignerInfo struct { @@ -759,60 +759,59 @@ func init() { func init() { proto.RegisterFile("lbm/tx/v1/tx.proto", fileDescriptor_f80bf4f3a3e5da31) } var fileDescriptor_f80bf4f3a3e5da31 = []byte{ - // 835 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xcd, 0x6e, 0x1c, 0x45, - 0x10, 0xde, 0xd9, 0x3f, 0xef, 0x96, 0x1d, 0x27, 0x69, 0x0c, 0x5a, 0xaf, 0xc5, 0x7a, 0xb5, 0xc8, - 0xb0, 0x12, 0x62, 0x26, 0x76, 0x38, 0x00, 0x37, 0xaf, 0x21, 0x72, 0x04, 0x11, 0xd2, 0xd8, 0xe2, - 0x90, 0xcb, 0xa8, 0x67, 0xb6, 0xdd, 0xdb, 0xf2, 0x4c, 0xf7, 0x32, 0xdd, 0x63, 0x76, 0x0e, 0x48, - 0xbc, 0x01, 0xb9, 0xf0, 0x12, 0x79, 0x02, 0x1e, 0x21, 0xc7, 0x1c, 0x39, 0x01, 0xb2, 0x1f, 0x04, - 0xd4, 0x3f, 0x33, 0x18, 0xb4, 0x31, 0x97, 0xdc, 0xaa, 0xaa, 0xbf, 0xaa, 0xaf, 0xe6, 0x9b, 0xaa, - 0x02, 0x94, 0xc6, 0x59, 0xa0, 0x56, 0xc1, 0xd5, 0x61, 0xa0, 0x56, 0xfe, 0x32, 0x17, 0x4a, 0xa0, - 0x7e, 0x1a, 0x67, 0xbe, 0x5a, 0x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2, 0x23, 0x80, 0x5a, 0x4d, 0xbd, 0x7a, 0xad, 0x37, - 0xc9, 0xd9, 0xaf, 0xe4, 0x94, 0xb3, 0x0e, 0xb4, 0x64, 0x91, 0x4d, 0x5e, 0x7a, 0xd0, 0x7a, 0x42, - 0x08, 0xfa, 0x0e, 0xba, 0x38, 0x13, 0x05, 0x57, 0x6e, 0xa8, 0xec, 0x5d, 0xd3, 0x07, 0xd4, 0x52, - 0x33, 0x3e, 0xfb, 0xf8, 0xd5, 0xef, 0xfb, 0x8d, 0x97, 0x7f, 0xec, 0x7f, 0x40, 0x99, 0x5a, 0x14, - 0xb1, 0x9f, 0x88, 0x2c, 0x48, 0x19, 0x27, 0x41, 0x1a, 0x67, 0x9f, 0xc8, 0xf9, 0x65, 0xa0, 0xca, - 0x25, 0x91, 0x06, 0x2b, 0x43, 0x57, 0x0d, 0xed, 0x41, 0x9f, 0x62, 0x19, 0xa5, 0x2c, 0x63, 0xca, - 0x68, 0xdb, 0x0e, 0x7b, 0x14, 0xcb, 0x6f, 0xb4, 0x8f, 0x76, 0xa0, 0xb3, 0xc4, 0x25, 0xc9, 0xdd, - 0x31, 0xb0, 0x0e, 0x1a, 0xc0, 0x06, 0xcd, 0x31, 0x57, 0x24, 0x1f, 0xb4, 0xed, 0x91, 0x70, 0xee, - 0xec, 0x8b, 0x57, 0xd7, 0x23, 0xef, 0xf5, 0xf5, 0xc8, 0xfb, 0xf3, 0x7a, 0xe4, 0xbd, 0xb8, 0x19, - 0x35, 0x5e, 0xdf, 0x8c, 0x1a, 0xbf, 0xdd, 0x8c, 0x1a, 0xcf, 0xc7, 0x77, 0xf6, 0x14, 0xa8, 0x55, - 0xdc, 0x35, 0xa3, 0xf8, 0xf8, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0x34, 0x82, 0xea, 0x2b, 0x75, - 0x06, 0x00, 0x00, + // 831 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xcd, 0x6e, 0x23, 0x45, + 0x10, 0xf6, 0xf8, 0x2f, 0x76, 0x25, 0x9b, 0xdd, 0x6d, 0x02, 0x72, 0x1c, 0xe1, 0x58, 0x46, 0x01, + 0x4b, 0x88, 0x99, 0x4d, 0x96, 0x03, 0x70, 0x8b, 0x03, 0xab, 0xac, 0x60, 0x85, 0xd4, 0x89, 0x38, + 0xec, 0x65, 0xd4, 0x33, 0x6e, 0xb7, 0x5b, 0x99, 0xe9, 0x36, 0xd3, 0x3d, 0xc1, 0x73, 0x40, 0xe2, + 0x0d, 0xe0, 0x39, 0xf6, 0x09, 0xb8, 0x71, 0xdd, 0xe3, 0x1e, 0x39, 0x01, 0x4a, 0x1e, 0x04, 0xd4, + 0x3d, 0x3d, 0x43, 0x84, 0x92, 0x70, 0xd9, 0x5b, 0x55, 0xf5, 0xf7, 0x55, 0x7d, 0xaa, 0xae, 0x2a, + 0x40, 0x49, 0x94, 0x06, 0x7a, 0x1d, 0x5c, 0x1e, 0x06, 0x7a, 0xed, 0xaf, 0x32, 0xa9, 0x25, 0xea, + 0x27, 0x51, 0xea, 0xeb, 0xb5, 0x7f, 0x79, 0x38, 0xdc, 0x61, 0x92, 0x49, 0x1b, 0x0d, 0x8c, 0x55, + 0x02, 0x86, 0x07, 0x86, 0x14, 0x67, 0xc5, 0x4a, 0xcb, 0x20, 0xcd, 0x13, 0xcd, 0x15, 0x67, 0x26, + 0x43, 0x65, 0x3b, 0xd8, 0x7b, 0x06, 0x16, 0x11, 0x45, 0xcd, 0x5b, 0x2c, 0xb9, 0x70, 0xf1, 0x7d, + 0x57, 0x53, 0x71, 0x26, 0xb8, 0xb0, 0x4c, 0x67, 0x3a, 0xc0, 0x2e, 0x93, 0x92, 0x25, 0x34, 0xb0, + 0x5e, 0x94, 0x2f, 0x02, 0x22, 0x8a, 0xf2, 0x69, 0xf2, 0x23, 0x34, 0xcf, 0xd7, 0xe8, 0x00, 0xda, + 0x91,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, + 0xca, 0x62, 0x15, 0x76, 0xd9, 0xd0, 0x1e, 0xf4, 0x19, 0x51, 0x61, 0xc2, 0x53, 0x5e, 0xad, 0x64, + 0x8f, 0x11, 0xf5, 0x8d, 0xf1, 0xd1, 0x0e, 0x74, 0x56, 0xa4, 0xa0, 0x99, 0xdb, 0xc6, 0xd2, 0x41, + 0x03, 0xd8, 0x60, 0x19, 0x11, 0x9a, 0x66, 0x76, 0x0f, 0xfb, 0xb8, 0x72, 0x67, 0x5f, 0xbc, 0xbe, + 0x1a, 0x79, 0x6f, 0xae, 0x46, 0xde, 0x5f, 0x57, 0x23, 0xef, 0x97, 0xeb, 0x51, 0xe3, 0xcd, 0xf5, + 0xa8, 0xf1, 0xfb, 0xf5, 0xa8, 0xf1, 0x72, 0x7c, 0xaf, 0xa6, 0x40, 0xaf, 0xa3, 0xae, 0x1d, 0xc5, + 0xa7, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0x17, 0xba, 0xa0, 0x41, 0x74, 0x06, 0x00, 0x00, } func (m *Tx) Marshal() (dAtA []byte, err error) { @@ -1016,14 +1015,19 @@ func (m *TxBody) MarshalToSizedBuffer(dAtA []byte) (int, error) { if m.TimeoutHeight != 0 { i = encodeVarintTx(dAtA, i, uint64(m.TimeoutHeight)) i-- - dAtA[i] = 0x18 + dAtA[i] = 0x20 } if len(m.Memo) > 0 { i -= len(m.Memo) copy(dAtA[i:], m.Memo) i = encodeVarintTx(dAtA, i, uint64(len(m.Memo))) i-- - dAtA[i] = 0x12 + dAtA[i] = 0x1a + } + if m.SigBlockHeight != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.SigBlockHeight)) + i-- + dAtA[i] = 0x10 } if len(m.Messages) > 0 { for iNdEx := len(m.Messages) - 1; iNdEx >= 0; iNdEx-- { @@ -1062,11 +1066,6 @@ func (m *AuthInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.SigBlockHeight != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.SigBlockHeight)) - i-- - dAtA[i] = 0x18 - } if m.Fee != nil { { size, err := m.Fee.MarshalToSizedBuffer(dAtA[:i]) @@ -1445,6 +1444,9 @@ func (m *TxBody) Size() (n int) { n += 1 + l + sovTx(uint64(l)) } } + if m.SigBlockHeight != 0 { + n += 1 + sovTx(uint64(m.SigBlockHeight)) + } l = len(m.Memo) if l > 0 { n += 1 + l + sovTx(uint64(l)) @@ -1483,9 +1485,6 @@ func (m *AuthInfo) Size() (n int) { l = m.Fee.Size() n += 1 + l + sovTx(uint64(l)) } - if m.SigBlockHeight != 0 { - n += 1 + sovTx(uint64(m.SigBlockHeight)) - } return n } @@ -2126,6 +2125,25 @@ func (m *TxBody) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SigBlockHeight", wireType) + } + m.SigBlockHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SigBlockHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Memo", wireType) } @@ -2157,7 +2175,7 @@ func (m *TxBody) Unmarshal(dAtA []byte) error { } m.Memo = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field TimeoutHeight", wireType) } @@ -2364,25 +2382,6 @@ func (m *AuthInfo) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SigBlockHeight", wireType) - } - m.SigBlockHeight = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.SigBlockHeight |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) diff --git a/types/tx/types.go b/types/tx/types.go index 57b70e5545..5dcc91b256 100644 --- a/types/tx/types.go +++ b/types/tx/types.go @@ -144,7 +144,7 @@ func (t *Tx) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { } func (t *Tx) GetSigBlockHeight() uint64 { - return t.AuthInfo.SigBlockHeight + return t.Body.SigBlockHeight } // UnpackInterfaces implements the UnpackInterfaceMessages.UnpackInterfaces method diff --git a/x/auth/tx/builder.go b/x/auth/tx/builder.go index 315475038d..2f67639383 100644 --- a/x/auth/tx/builder.go +++ b/x/auth/tx/builder.go @@ -146,7 +146,7 @@ func (w *wrapper) FeeGranter() sdk.AccAddress { } func (w *wrapper) GetSigBlockHeight() uint64 { - return w.tx.AuthInfo.SigBlockHeight + return w.tx.Body.SigBlockHeight } func (w *wrapper) GetMemo() string { @@ -229,7 +229,7 @@ func (w *wrapper) SetMemo(memo string) { } func (w *wrapper) SetSigBlockHeight(sbh uint64) { - w.tx.AuthInfo.SigBlockHeight = sbh + w.tx.Body.SigBlockHeight = sbh } func (w *wrapper) SetGasLimit(limit uint64) { From 684a30b401f3920fdf2b99501cf3d377608b2247 Mon Sep 17 00:00:00 2001 From: zemyblue Date: Sat, 12 Feb 2022 00:23:52 +0900 Subject: [PATCH 2/7] Revert "feat: Introduce sig block height for the new replay protection (#265)" This reverts commit c1c71f11af03c10fb57ddf325c336f0a7abf3225. # Conflicts: # CHANGELOG.md # baseapp/msg_service_router_test.go # client/tx/tx.go # codec/amino_codec_test.go # docs/core/proto-docs.md # proto/lbm/auth/v1/auth.proto # server/grpc/server_test.go # simapp/genesis_account_test.go # simapp/test_helpers.go # testutil/testdata/unknonwnproto.pb.go # types/errors/errors.go # types/grpc/headers.go # types/rest/rest_test.go # types/tx/tx.pb.go # types/tx/types.go # x/auth/ante/ante.go # x/auth/ante/ante_test.go # x/auth/ante/sigverify_test.go # x/auth/ante/testutil_test.go # x/auth/client/cli/cli_test.go # x/auth/keeper/keeper.go # x/auth/legacy/legacytx/amino_signing_test.go # x/auth/signing/handler_map_test.go # x/auth/signing/verify_test.go # x/auth/simulation/decoder.go # x/auth/simulation/genesis.go # x/auth/tx/builder.go # x/auth/tx/direct_test.go # x/auth/tx/legacy_amino_json_test.go # x/auth/types/account.go # x/auth/types/account_retriever.go # x/auth/types/account_test.go # x/auth/types/auth.pb.go # x/auth/types/params.go # x/auth/vesting/types/vesting_account.go # x/auth/vesting/types/vesting_account_test.go # x/evidence/keeper/keeper_test.go # x/ibc/testing/chain.go # x/wasm/keeper/keeper_test.go # x/wasm/keeper/submsg_test.go --- baseapp/accountwgs_test.go | 4 - baseapp/baseapp_test.go | 5 +- baseapp/msg_service_router_test.go | 5 +- client/account_retriever.go | 4 +- client/docs/swagger-ui/swagger.yaml | 18 -- client/flags/flags.go | 4 +- client/test_helpers.go | 18 +- client/tx/factory.go | 14 +- client/tx/legacy.go | 1 - client/tx/legacy_test.go | 2 - client/tx/tx.go | 40 ++- client/tx/tx_test.go | 6 +- client/tx_config.go | 1 - codec/amino_codec_test.go | 2 +- crypto/ledger/ledger_test.go | 9 +- docs/core/proto-docs.md | 4 +- proto/lbm/auth/v1/auth.proto | 4 +- proto/lbm/tx/v1/tx.proto | 11 +- server/mock/tx.go | 4 - simapp/genesis_account_test.go | 6 +- simapp/helpers/test_helpers.go | 8 +- simapp/simd/cmd/genaccounts.go | 2 +- simapp/simd/cmd/testnet.go | 2 +- simapp/test_helpers.go | 4 +- simapp/utils_test.go | 7 + tests/mocks/account_retriever.go | 26 +- testutil/network/network.go | 2 +- testutil/testdata/unknonwnproto.pb.go | 258 ++++++++----------- testutil/testdata/unknonwnproto.proto | 7 +- types/errors/errors.go | 4 - types/rest/rest.go | 46 ++-- types/rest/rest_test.go | 12 +- types/tx/tx.pb.go | 188 +++++++------- types/tx/types.go | 4 - types/tx_msg.go | 3 - x/auth/ante/ante.go | 4 +- x/auth/ante/ante_test.go | 142 +++++----- x/auth/ante/basic.go | 29 --- x/auth/ante/expected_keepers.go | 1 - x/auth/ante/fee.go | 6 +- x/auth/ante/sigverify.go | 29 ++- x/auth/ante/sigverify_test.go | 39 +-- x/auth/ante/testutil_test.go | 14 +- x/auth/client/cli/cli_test.go | 20 +- x/auth/client/cli/tx_multisign.go | 30 +-- x/auth/client/cli/tx_sign.go | 4 +- x/auth/client/cli/validate_sigs.go | 7 +- x/auth/client/rest/rest_test.go | 8 +- x/auth/client/tx.go | 4 +- x/auth/client/tx_test.go | 2 +- x/auth/genesis.go | 3 +- x/auth/keeper/account.go | 9 + x/auth/keeper/keeper.go | 40 ++- x/auth/legacy/legacytx/amino_signing.go | 2 +- x/auth/legacy/legacytx/amino_signing_test.go | 20 +- x/auth/legacy/legacytx/stdsign.go | 30 +-- x/auth/legacy/legacytx/stdsignmsg.go | 16 +- x/auth/legacy/legacytx/stdtx.go | 24 +- x/auth/legacy/legacytx/stdtx_builder.go | 4 - x/auth/legacy/legacytx/stdtx_test.go | 16 +- x/auth/module.go | 2 +- x/auth/signing/handler_map_test.go | 22 +- x/auth/signing/sign_mode_handler.go | 3 + x/auth/signing/verify_test.go | 14 +- x/auth/simulation/decoder.go | 9 + x/auth/simulation/decoder_test.go | 9 + x/auth/simulation/genesis.go | 14 +- x/auth/simulation/genesis_test.go | 1 + x/auth/testutil/suite.go | 10 +- x/auth/tx/builder.go | 8 - x/auth/tx/direct.go | 7 +- x/auth/tx/direct_test.go | 9 +- x/auth/tx/legacy_amino_json.go | 2 +- x/auth/tx/legacy_amino_json_test.go | 10 +- x/auth/types/account.go | 67 +++-- x/auth/types/account_retriever.go | 18 +- x/auth/types/account_retriever_test.go | 3 +- x/auth/types/account_test.go | 12 +- x/auth/types/auth.pb.go | 170 ++++++------ x/auth/types/genesis.go | 2 +- x/auth/types/genesis_test.go | 7 +- x/auth/types/keys.go | 3 + x/auth/types/params.go | 25 +- x/auth/types/params_test.go | 12 +- x/auth/vesting/types/vesting_account.go | 4 + x/auth/vesting/types/vesting_account_test.go | 10 +- x/bank/app_test.go | 34 +-- x/bank/client/cli/tx.go | 9 +- x/bank/client/rest/tx_test.go | 2 +- x/bank/simulation/operations.go | 8 +- x/bank/types/expected_keepers.go | 1 + x/distribution/simulation/operations.go | 8 +- x/evidence/keeper/keeper_test.go | 2 +- x/feegrant/client/testutil/suite.go | 2 +- x/genutil/types/expected_keepers.go | 1 + x/gov/simulation/operations.go | 8 +- x/ibc/testing/chain.go | 5 +- x/simulation/util.go | 2 +- x/slashing/simulation/operations.go | 2 +- x/staking/simulation/operations.go | 10 +- x/wasm/keeper/keeper_test.go | 4 +- x/wasm/types/expected_keepers.go | 2 +- 102 files changed, 865 insertions(+), 926 deletions(-) diff --git a/baseapp/accountwgs_test.go b/baseapp/accountwgs_test.go index 334527e4b3..d2e99d24de 100644 --- a/baseapp/accountwgs_test.go +++ b/baseapp/accountwgs_test.go @@ -77,10 +77,6 @@ func (tx AccountLockTestTx) ValidateBasic() error { return nil } -func (tx AccountLockTestTx) GetSigBlockHeight() uint64 { - return 0 -} - func newTestPrivKeys(num int) []*secp256k1.PrivKey { privs := make([]*secp256k1.PrivKey, 0, num) for i := 0; i < num; i++ { diff --git a/baseapp/baseapp_test.go b/baseapp/baseapp_test.go index 35c21c6f61..259b991753 100644 --- a/baseapp/baseapp_test.go +++ b/baseapp/baseapp_test.go @@ -696,9 +696,8 @@ func (tx *txTest) setFailOnHandler(fail bool) { } // Implements Tx -func (tx txTest) GetMsgs() []sdk.Msg { return tx.Msgs } -func (tx txTest) ValidateBasic() error { return nil } -func (tx txTest) GetSigBlockHeight() uint64 { return 0 } +func (tx txTest) GetMsgs() []sdk.Msg { return tx.Msgs } +func (tx txTest) ValidateBasic() error { return nil } const ( routeMsgCounter = "msgCounter" diff --git a/baseapp/msg_service_router_test.go b/baseapp/msg_service_router_test.go index 3a144ee395..68709f1b1f 100644 --- a/baseapp/msg_service_router_test.go +++ b/baseapp/msg_service_router_test.go @@ -103,8 +103,9 @@ func TestMsgService(t *testing.T) { // Second round: all signer infos are set, so each signer can sign. signerData := authsigning.SignerData{ - ChainID: "test", - Sequence: 0, + ChainID: "test", + AccountNumber: 0, + Sequence: 0, } sigV2, err = tx.SignWithPrivKey( encCfg.TxConfig.SignModeHandler().DefaultMode(), signerData, diff --git a/client/account_retriever.go b/client/account_retriever.go index dbe0d2f259..27d8e0364b 100644 --- a/client/account_retriever.go +++ b/client/account_retriever.go @@ -9,6 +9,7 @@ import ( type Account interface { GetAddress() sdk.AccAddress GetPubKey() cryptotypes.PubKey // can return nil. + GetAccountNumber() uint64 GetSequence() uint64 } @@ -17,8 +18,7 @@ type Account interface { // for signing. type AccountRetriever interface { GetAccount(clientCtx Context, addr sdk.AccAddress) (Account, error) - GetLatestHeight(clientCtx Context) (uint64, error) GetAccountWithHeight(clientCtx Context, addr sdk.AccAddress) (Account, int64, error) EnsureExists(clientCtx Context, addr sdk.AccAddress) error - GetAccountSequence(clientCtx Context, addr sdk.AccAddress) (accSeq uint64, err error) + GetAccountNumberSequence(clientCtx Context, addr sdk.AccAddress) (accNum uint64, accSeq uint64, err error) } diff --git a/client/docs/swagger-ui/swagger.yaml b/client/docs/swagger-ui/swagger.yaml index 22594d81ec..0de11932d2 100644 --- a/client/docs/swagger-ui/swagger.yaml +++ b/client/docs/swagger-ui/swagger.yaml @@ -4926,9 +4926,6 @@ paths: sig_verify_cost_secp256k1: type: string format: uint64 - valid_sig_block_period: - type: string - format: uint64 description: >- QueryParamsResponse is the response type for the Query/Params RPC method. @@ -35180,9 +35177,6 @@ definitions: sig_verify_cost_secp256k1: type: string format: uint64 - valid_sig_block_period: - type: string - format: uint64 description: Params defines the parameters for the auth module. lbm.auth.v1.QueryAccountResponse: type: object @@ -35274,9 +35268,6 @@ definitions: sig_verify_cost_secp256k1: type: string format: uint64 - valid_sig_block_period: - type: string - format: uint64 description: QueryParamsResponse is the response type for the Query/Params RPC method. lbm.bank.v1.DenomUnit: type: object @@ -47143,15 +47134,6 @@ definitions: appropriate fee grant does not exist or the chain does not support fee grants, this will fail - sig_block_height: - type: string - format: uint64 - description: >- - sig block height is available between current block height and current - block height - `VALID_SIG_BLOCK_PERIOD` - - this is used for distinguish signatures instead of account number. - this is mandatory. description: |- AuthInfo describes the fee and signer modes that are used to sign a transaction. diff --git a/client/flags/flags.go b/client/flags/flags.go index ce492181fb..0c66780b9a 100644 --- a/client/flags/flags.go +++ b/client/flags/flags.go @@ -49,7 +49,7 @@ const ( FlagGasAdjustment = "gas-adjustment" FlagFrom = "from" FlagName = "name" - FlagSigBlockHeight = "sig-block-height" + FlagAccountNumber = "account-number" FlagSequence = "sequence" FlagMemo = "memo" FlagFees = "fees" @@ -101,7 +101,7 @@ func AddTxFlagsToCmd(cmd *cobra.Command) { cmd.Flags().StringP(ostcli.OutputFlag, "o", "json", "Output format (text|json)") cmd.Flags().String(FlagKeyringDir, "", "The client Keyring directory; if omitted, the default 'home' directory will be used") cmd.Flags().String(FlagFrom, "", "Name or address of private key with which to sign") - cmd.Flags().Uint64P(FlagSigBlockHeight, "n", 0, "The block height to be included in the tx body to protect from replaying") + cmd.Flags().Uint64P(FlagAccountNumber, "a", 0, "The account number of the signing account (offline mode only)") cmd.Flags().Uint64P(FlagSequence, "s", 0, "The sequence number of the signing account (offline mode only)") cmd.Flags().String(FlagMemo, "", "Memo to send along with transaction") cmd.Flags().String(FlagFees, "", "Fees to pay along with transaction; eg: 10uatom") diff --git a/client/test_helpers.go b/client/test_helpers.go index 3e7b122bb5..f182d89ffc 100644 --- a/client/test_helpers.go +++ b/client/test_helpers.go @@ -15,6 +15,7 @@ var ( // TestAccount represents a client Account that can be used in unit tests type TestAccount struct { Address sdk.AccAddress + Num uint64 Seq uint64 } @@ -28,6 +29,11 @@ func (t TestAccount) GetPubKey() cryptotypes.PubKey { return nil } +// GetAccountNumber implements client Account.GetAccountNumber +func (t TestAccount) GetAccountNumber() uint64 { + return t.Num +} + // GetSequence implements client Account.GetSequence func (t TestAccount) GetSequence() uint64 { return t.Seq @@ -48,10 +54,6 @@ func (t TestAccountRetriever) GetAccount(_ Context, addr sdk.AccAddress) (Accoun return acc, nil } -func (t TestAccountRetriever) GetLatestHeight(_ Context) (uint64, error) { - return 0, nil -} - // GetAccountWithHeight implements AccountRetriever.GetAccountWithHeight func (t TestAccountRetriever) GetAccountWithHeight(clientCtx Context, addr sdk.AccAddress) (Account, int64, error) { acc, err := t.GetAccount(clientCtx, addr) @@ -71,11 +73,11 @@ func (t TestAccountRetriever) EnsureExists(_ Context, addr sdk.AccAddress) error return nil } -// GetAccountSequence implements AccountRetriever.GetAccountSequence -func (t TestAccountRetriever) GetAccountSequence(_ Context, addr sdk.AccAddress) (accSeq uint64, err error) { +// GetAccountNumberSequence implements AccountRetriever.GetAccountNumberSequence +func (t TestAccountRetriever) GetAccountNumberSequence(_ Context, addr sdk.AccAddress) (accNum uint64, accSeq uint64, err error) { acc, ok := t.Accounts[addr.String()] if !ok { - return 0, fmt.Errorf("account %s not found", addr) + return 0, 0, fmt.Errorf("account %s not found", addr) } - return acc.Seq, nil + return acc.Num, acc.Seq, nil } diff --git a/client/tx/factory.go b/client/tx/factory.go index 6c2483b2a9..a35cb50158 100644 --- a/client/tx/factory.go +++ b/client/tx/factory.go @@ -16,7 +16,7 @@ type Factory struct { keybase keyring.Keyring txConfig client.TxConfig accountRetriever client.AccountRetriever - sigBlockHeight uint64 + accountNumber uint64 sequence uint64 gas uint64 timeoutHeight uint64 @@ -41,7 +41,7 @@ func NewFactoryCLI(clientCtx client.Context, flagSet *pflag.FlagSet) Factory { signMode = signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON } - sigBlockHeight, _ := flagSet.GetUint64(flags.FlagSigBlockHeight) + accNum, _ := flagSet.GetUint64(flags.FlagAccountNumber) accSeq, _ := flagSet.GetUint64(flags.FlagSequence) gasAdj, _ := flagSet.GetFloat64(flags.FlagGasAdjustment) memo, _ := flagSet.GetString(flags.FlagMemo) @@ -57,7 +57,7 @@ func NewFactoryCLI(clientCtx client.Context, flagSet *pflag.FlagSet) Factory { chainID: clientCtx.ChainID, gas: gasSetting.Gas, simulateAndExecute: gasSetting.Simulate, - sigBlockHeight: sigBlockHeight, + accountNumber: accNum, sequence: accSeq, timeoutHeight: timeoutHeight, gasAdjustment: gasAdj, @@ -74,7 +74,7 @@ func NewFactoryCLI(clientCtx client.Context, flagSet *pflag.FlagSet) Factory { return f } -func (f Factory) SigBlockHeight() uint64 { return f.sigBlockHeight } +func (f Factory) AccountNumber() uint64 { return f.accountNumber } func (f Factory) Sequence() uint64 { return f.sequence } func (f Factory) Gas() uint64 { return f.gas } func (f Factory) GasAdjustment() float64 { return f.gasAdjustment } @@ -154,9 +154,9 @@ func (f Factory) WithMemo(memo string) Factory { return f } -// WithSigBlockHeight returns a copy of the Factory with an updated sig block height. -func (f Factory) WithSigBlockHeight(sigBlockHeight uint64) Factory { - f.sigBlockHeight = sigBlockHeight +// WithAccountNumber returns a copy of the Factory with an updated account number. +func (f Factory) WithAccountNumber(accnum uint64) Factory { + f.accountNumber = accnum return f } diff --git a/client/tx/legacy.go b/client/tx/legacy.go index 9ad4e4d426..e37d7a7b36 100644 --- a/client/tx/legacy.go +++ b/client/tx/legacy.go @@ -61,7 +61,6 @@ func CopyTx(tx signing.Tx, builder client.TxBuilder, ignoreSignatureError bool) builder.SetMemo(tx.GetMemo()) builder.SetFeeAmount(tx.GetFee()) builder.SetGasLimit(tx.GetGas()) - builder.SetSigBlockHeight(tx.GetSigBlockHeight()) builder.SetTimeoutHeight(tx.GetTimeoutHeight()) return nil diff --git a/client/tx/legacy_test.go b/client/tx/legacy_test.go index 6a4fdb6d04..6363c68120 100644 --- a/client/tx/legacy_test.go +++ b/client/tx/legacy_test.go @@ -23,7 +23,6 @@ import ( const ( memo = "waboom" gas = uint64(10000) - sbh = 1 timeoutHeight = 5 ) @@ -45,7 +44,6 @@ func buildTestTx(t *testing.T, builder client.TxBuilder) { builder.SetMemo(memo) builder.SetGasLimit(gas) builder.SetFeeAmount(fee) - builder.SetSigBlockHeight(sbh) err := builder.SetMsgs(msg) require.NoError(t, err) err = builder.SetSignatures(sig) diff --git a/client/tx/tx.go b/client/tx/tx.go index 841fa5ed30..4f4addc8f8 100644 --- a/client/tx/tx.go +++ b/client/tx/tx.go @@ -156,7 +156,7 @@ func WriteGeneratedTxResponse( } txf := Factory{fees: br.Fees, gasPrices: br.GasPrices}. - WithSigBlockHeight(br.SigBlockHeight). + WithAccountNumber(br.AccountNumber). WithSequence(br.Sequence). WithGas(gasSetting.Gas). WithGasAdjustment(gasAdj). @@ -241,7 +241,6 @@ func BuildUnsignedTx(txf Factory, msgs ...sdk.Msg) (client.TxBuilder, error) { tx.SetMemo(txf.memo) tx.SetFeeAmount(fees) tx.SetGasLimit(txf.gas) - tx.SetSigBlockHeight(txf.sigBlockHeight) tx.SetTimeoutHeight(txf.TimeoutHeight()) return tx, nil @@ -304,36 +303,30 @@ func CalculateGas( return simRes, uint64(txf.GasAdjustment() * float64(simRes.GasInfo.GasUsed)), nil } -// PrepareFactory set sig block height and account sequence to the tx factory. -// It doesn't require that the account should exist. -// If the account does not exist, then it use the zero sequence number. +// PrepareFactory ensures the account defined by ctx.GetFromAddress() exists and +// if the account number and/or the account sequence number are zero (not set), +// they will be queried for and set on the provided Factory. A new Factory with +// the updated fields will be returned. func PrepareFactory(clientCtx client.Context, txf Factory) (Factory, error) { from := clientCtx.GetFromAddress() - sigBlockHeight := txf.sigBlockHeight - if !clientCtx.Offline { - if sigBlockHeight == 0 { - height, err := txf.accountRetriever.GetLatestHeight(clientCtx) - if err != nil { - return txf, err - } - // `ctx.Height` of checkTx may be later by 1 block than consensus block height. - // Some cli integrated test fails because of this(sigBlockHeight = height). - sigBlockHeight = height - 1 - } + if err := txf.accountRetriever.EnsureExists(clientCtx, from); err != nil { + return txf, err } - txf = txf.WithSigBlockHeight(sigBlockHeight) - - initSeq := txf.sequence - if initSeq == 0 && !clientCtx.Offline { - seq, err := txf.accountRetriever.GetAccountSequence(clientCtx, from) + initNum, initSeq := txf.accountNumber, txf.sequence + if initNum == 0 || initSeq == 0 { + num, seq, err := txf.accountRetriever.GetAccountNumberSequence(clientCtx, from) if err != nil { if cliError, ok := err.(*client.Error); !ok || cliError.Code != sdkerrors.ErrKeyNotFound.ABCICode() { return txf, err } } + if initNum == 0 { + txf = txf.WithAccountNumber(num) + } + if initSeq == 0 { txf = txf.WithSequence(seq) } @@ -412,8 +405,9 @@ func Sign(txf Factory, name string, txBuilder client.TxBuilder, overwriteSig boo } pubKey := key.GetPubKey() signerData := authsigning.SignerData{ - ChainID: txf.chainID, - Sequence: txf.sequence, + ChainID: txf.chainID, + AccountNumber: txf.accountNumber, + Sequence: txf.sequence, } // For SIGN_MODE_DIRECT, calling SetSignatures calls setSignerInfos on diff --git a/client/tx/tx_test.go b/client/tx/tx_test.go index 89a292a070..68e02ff897 100644 --- a/client/tx/tx_test.go +++ b/client/tx/tx_test.go @@ -90,7 +90,7 @@ func TestBuildSimTx(t *testing.T) { txf := tx.Factory{}. WithTxConfig(txCfg). - WithSigBlockHeight(1). + WithAccountNumber(50). WithSequence(23). WithFees("50stake"). WithMemo("memo"). @@ -106,7 +106,7 @@ func TestBuildSimTx(t *testing.T) { func TestBuildUnsignedTx(t *testing.T) { txf := tx.Factory{}. WithTxConfig(NewTestTxConfig()). - WithSigBlockHeight(1). + WithAccountNumber(50). WithSequence(23). WithFees("50stake"). WithMemo("memo"). @@ -148,7 +148,7 @@ func TestSign(t *testing.T) { txfNoKeybase := tx.Factory{}. WithTxConfig(NewTestTxConfig()). - WithSigBlockHeight(1). + WithAccountNumber(50). WithSequence(23). WithFees("50stake"). WithMemo("memo"). diff --git a/client/tx_config.go b/client/tx_config.go index 68bc73477d..bfa8f8c9ce 100644 --- a/client/tx_config.go +++ b/client/tx_config.go @@ -39,7 +39,6 @@ type ( SetMsgs(msgs ...sdk.Msg) error SetSignatures(signatures ...signingtypes.SignatureV2) error SetMemo(memo string) - SetSigBlockHeight(sbh uint64) SetFeeAmount(amount sdk.Coins) SetGasLimit(limit uint64) SetTimeoutHeight(height uint64) diff --git a/codec/amino_codec_test.go b/codec/amino_codec_test.go index 9c7274dca9..7df62adf59 100644 --- a/codec/amino_codec_test.go +++ b/codec/amino_codec_test.go @@ -120,7 +120,7 @@ func TestAminoCodecUnpackAnyFails(t *testing.T) { func TestAminoCodecFullDecodeAndEncode(t *testing.T) { // This tx comes from https://github.com/cosmos/cosmos-sdk/issues/8117. - txSigned := `{"type":"lbm-sdk/StdTx","value":{"msg":[{"type":"lbm-sdk/MsgCreateValidator","value":{"description":{"moniker":"fulltest","identity":"satoshi","website":"example.com","details":"example inc"},"commission":{"rate":"0.500000000000000000","max_rate":"1.000000000000000000","max_change_rate":"0.200000000000000000"},"min_self_delegation":"1000000","delegator_address":"link120yvjfy7m2gnu9mvusrs40cxxhpt8nr3qhn8re","validator_address":"linkvaloper120yvjfy7m2gnu9mvusrs40cxxhpt8nr3jr36d2","pubkey":{"type":"ostracon/PubKeyEd25519","value":"CYrOiM3HtS7uv1B1OAkknZnFYSRpQYSYII8AtMMtev0="},"value":{"denom":"umuon","amount":"700000000"}}}],"fee":{"amount":[{"denom":"umuon","amount":"6000"}],"gas":"160000"},"signatures":[{"pub_key":{"type":"ostracon/PubKeySecp256k1","value":"AwAOXeWgNf1FjMaayrSnrOOKz+Fivr6DiI/i0x0sZCHw"},"signature":"RcnfS/u2yl7uIShTrSUlDWvsXo2p2dYu6WJC8VDVHMBLEQZWc8bsINSCjOnlsIVkUNNe1q/WCA9n3Gy1+0zhYA=="}],"sig_block_height":"0","memo":"","timeout_height":"0"}}` + txSigned := `{"type":"lbm-sdk/StdTx","value":{"msg":[{"type":"lbm-sdk/MsgCreateValidator","value":{"description":{"moniker":"fulltest","identity":"satoshi","website":"example.com","details":"example inc"},"commission":{"rate":"0.500000000000000000","max_rate":"1.000000000000000000","max_change_rate":"0.200000000000000000"},"min_self_delegation":"1000000","delegator_address":"link120yvjfy7m2gnu9mvusrs40cxxhpt8nr3qhn8re","validator_address":"linkvaloper120yvjfy7m2gnu9mvusrs40cxxhpt8nr3jr36d2","pubkey":{"type":"ostracon/PubKeyEd25519","value":"CYrOiM3HtS7uv1B1OAkknZnFYSRpQYSYII8AtMMtev0="},"value":{"denom":"umuon","amount":"700000000"}}}],"fee":{"amount":[{"denom":"umuon","amount":"6000"}],"gas":"160000"},"signatures":[{"pub_key":{"type":"ostracon/PubKeySecp256k1","value":"AwAOXeWgNf1FjMaayrSnrOOKz+Fivr6DiI/i0x0sZCHw"},"signature":"RcnfS/u2yl7uIShTrSUlDWvsXo2p2dYu6WJC8VDVHMBLEQZWc8bsINSCjOnlsIVkUNNe1q/WCA9n3Gy1+0zhYA=="}],"memo":"","timeout_height":"0"}}` _, legacyCdc := simapp.MakeCodecs() var tx legacytx.StdTx diff --git a/crypto/ledger/ledger_test.go b/crypto/ledger/ledger_test.go index d08aefaf3d..6cf51553d3 100644 --- a/crypto/ledger/ledger_test.go +++ b/crypto/ledger/ledger_test.go @@ -196,16 +196,17 @@ func TestPublicKeyHDPath(t *testing.T) { } } -func getFakeTx() []byte { +func getFakeTx(accountNumber uint32) []byte { tmp := fmt.Sprintf( - `{"chain_id":"1234","fee":{"amount":[{"amount":"150","denom":"atom"}],"gas":"5000"},"memo":"memo","msgs":[[""]],"sequence":"6"}`) + `{"account_number":"%d","chain_id":"1234","fee":{"amount":[{"amount":"150","denom":"atom"}],"gas":"5000"},"memo":"memo","msgs":[[""]],"sequence":"6"}`, + accountNumber) return []byte(tmp) } func TestSignaturesHD(t *testing.T) { for account := uint32(0); account < 100; account += 30 { - msg := getFakeTx() + msg := getFakeTx(account) path := *hd.NewFundraiserParams(account, sdk.CoinType, account/5) t.Logf("Checking signature at %v --- PLEASE REVIEW AND ACCEPT IN THE DEVICE\n", path) @@ -223,7 +224,7 @@ func TestSignaturesHD(t *testing.T) { } func TestRealDeviceSecp256k1(t *testing.T) { - msg := getFakeTx() + msg := getFakeTx(50) path := *hd.NewFundraiserParams(0, sdk.CoinType, 0) priv, err := NewPrivKeySecp256k1Unsafe(path) require.NoError(t, err) diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md index 0319bc6e01..713b3c476b 100644 --- a/docs/core/proto-docs.md +++ b/docs/core/proto-docs.md @@ -4133,6 +4133,7 @@ type for additional functionality (e.g. vesting). | `ed25519_pub_key` | [lbm.crypto.ed25519.PubKey](#lbm.crypto.ed25519.PubKey) | | | | `secp256k1_pub_key` | [lbm.crypto.secp256k1.PubKey](#lbm.crypto.secp256k1.PubKey) | | | | `multisig_pub_key` | [lbm.crypto.multisig.LegacyAminoPubKey](#lbm.crypto.multisig.LegacyAminoPubKey) | | | +| `account_number` | [uint64](#uint64) | | | | `sequence` | [uint64](#uint64) | | | @@ -4170,7 +4171,6 @@ Params defines the parameters for the auth module. | `tx_size_cost_per_byte` | [uint64](#uint64) | | | | `sig_verify_cost_ed25519` | [uint64](#uint64) | | | | `sig_verify_cost_secp256k1` | [uint64](#uint64) | | | -| `valid_sig_block_period` | [uint64](#uint64) | | | @@ -10254,6 +10254,7 @@ SignDoc is the type used for generating sign bytes for SIGN_MODE_DIRECT. | `body_bytes` | [bytes](#bytes) | | body_bytes is protobuf serialization of a TxBody that matches the representation in TxRaw. | | `auth_info_bytes` | [bytes](#bytes) | | auth_info_bytes is a protobuf serialization of an AuthInfo that matches the representation in TxRaw. | | `chain_id` | [string](#string) | | chain_id is the unique identifier of the chain this transaction targets. It prevents signed transactions from being used on another chain by an attacker | +| `account_number` | [uint64](#uint64) | | account_number is the account number of the account in state | @@ -10304,7 +10305,6 @@ TxBody is the body of a transaction that all signers sign over. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | `messages` | [google.protobuf.Any](#google.protobuf.Any) | repeated | messages is a list of messages to be executed. The required signers of those messages define the number and order of elements in AuthInfo's signer_infos and Tx's signatures. Each required signer address is added to the list only the first time it occurs. By convention, the first required signer (usually from the first message) is referred to as the primary signer and pays the fee for the whole transaction. | -| `sig_block_height` | [uint64](#uint64) | | sig block height is available between current block height and current block height - `VALID_SIG_BLOCK_PERIOD` this is used for distinguish signatures instead of account number. this is mandatory. | | `memo` | [string](#string) | | memo is any arbitrary memo to be added to the transaction | | `timeout_height` | [uint64](#uint64) | | timeout is the block height after which this transaction will not be processed by the chain | | `extension_options` | [google.protobuf.Any](#google.protobuf.Any) | repeated | extension_options are arbitrary options that can be added by chains when the default options are not sufficient. If any of these are present and can't be handled, the transaction will be rejected | diff --git a/proto/lbm/auth/v1/auth.proto b/proto/lbm/auth/v1/auth.proto index 741c532e6d..db693d5e89 100644 --- a/proto/lbm/auth/v1/auth.proto +++ b/proto/lbm/auth/v1/auth.proto @@ -26,7 +26,8 @@ message BaseAccount { [(gogoproto.jsontag) = "secp256k1_public_key,omitempty", (gogoproto.moretags) = "yaml:\"secp256k1_public_key\""]; lbm.crypto.multisig.LegacyAminoPubKey multisig_pub_key = 4 [(gogoproto.jsontag) = "multisig_public_key,omitempty", (gogoproto.moretags) = "yaml:\"multisig_public_key\""]; - uint64 sequence = 5; + uint64 account_number = 5 [(gogoproto.moretags) = "yaml:\"account_number\""]; + uint64 sequence = 6; } // ModuleAccount defines an account for modules that holds coins on a pool. @@ -52,5 +53,4 @@ message Params { [(gogoproto.customname) = "SigVerifyCostED25519", (gogoproto.moretags) = "yaml:\"sig_verify_cost_ed25519\""]; uint64 sig_verify_cost_secp256k1 = 5 [(gogoproto.customname) = "SigVerifyCostSecp256k1", (gogoproto.moretags) = "yaml:\"sig_verify_cost_secp256k1\""]; - uint64 valid_sig_block_period = 6 [(gogoproto.moretags) = "yaml:\"valid_sig_block_period\""]; } diff --git a/proto/lbm/tx/v1/tx.proto b/proto/lbm/tx/v1/tx.proto index 597e627951..f150aaddf0 100644 --- a/proto/lbm/tx/v1/tx.proto +++ b/proto/lbm/tx/v1/tx.proto @@ -58,6 +58,9 @@ message SignDoc { // It prevents signed transactions from being used on another chain by an // attacker string chain_id = 3; + + // account_number is the account number of the account in state + uint64 account_number = 4; } // TxBody is the body of a transaction that all signers sign over. @@ -71,16 +74,12 @@ message TxBody { // transaction. repeated google.protobuf.Any messages = 1; - // sig block height is available between current block height and current block height - `VALID_SIG_BLOCK_PERIOD` - // this is used for distinguish signatures instead of account number. this is mandatory. - uint64 sig_block_height = 2; - // memo is any arbitrary memo to be added to the transaction - string memo = 3; + string memo = 2; // timeout is the block height after which this transaction will not // be processed by the chain - uint64 timeout_height = 4; + uint64 timeout_height = 3; // extension_options are arbitrary options that can be added by chains // when the default options are not sufficient. If any of these are present diff --git a/server/mock/tx.go b/server/mock/tx.go index 0ef966bccc..4fcd86e44b 100644 --- a/server/mock/tx.go +++ b/server/mock/tx.go @@ -53,10 +53,6 @@ func (tx kvstoreTx) GetSignBytes() []byte { return tx.bytes } -func (tx kvstoreTx) GetSigBlockHeight() uint64 { - return 0 -} - // Should the app be calling this? Or only handlers? func (tx kvstoreTx) ValidateBasic() error { return nil diff --git a/simapp/genesis_account_test.go b/simapp/genesis_account_test.go index ed9bb5f4be..b521502724 100644 --- a/simapp/genesis_account_test.go +++ b/simapp/genesis_account_test.go @@ -20,7 +20,7 @@ func TestSimGenesisAccountValidate(t *testing.T) { vestingStart := time.Now().UTC() coins := sdk.NewCoins(sdk.NewInt64Coin("test", 1000)) - baseAcc := authtypes.NewBaseAccount(addr, pubkey, 0) + baseAcc := authtypes.NewBaseAccount(addr, pubkey, 0, 0) testCases := []struct { name string @@ -37,14 +37,14 @@ func TestSimGenesisAccountValidate(t *testing.T) { { "invalid basic account with mismatching address/pubkey", simapp.SimGenesisAccount{ - BaseAccount: authtypes.NewBaseAccount(addr, secp256k1.GenPrivKey().PubKey(), 0), + BaseAccount: authtypes.NewBaseAccount(addr, secp256k1.GenPrivKey().PubKey(), 0, 0), }, true, }, { "valid basic account with module name", simapp.SimGenesisAccount{ - BaseAccount: authtypes.NewBaseAccount(sdk.BytesToAccAddress(crypto.AddressHash([]byte("testmod"))), nil, 0), + BaseAccount: authtypes.NewBaseAccount(sdk.BytesToAccAddress(crypto.AddressHash([]byte("testmod"))), nil, 0, 0), ModuleName: "testmod", }, false, diff --git a/simapp/helpers/test_helpers.go b/simapp/helpers/test_helpers.go index 22f425f03a..4e6352f85a 100644 --- a/simapp/helpers/test_helpers.go +++ b/simapp/helpers/test_helpers.go @@ -19,7 +19,7 @@ const ( ) // GenTx generates a signed mock transaction. -func GenTx(gen client.TxConfig, msgs []sdk.Msg, feeAmt sdk.Coins, gas uint64, chainID string, sbh, accSeqs []uint64, priv ...cryptotypes.PrivKey) (sdk.Tx, error) { +func GenTx(gen client.TxConfig, msgs []sdk.Msg, feeAmt sdk.Coins, gas uint64, chainID string, accNums, accSeqs []uint64, priv ...cryptotypes.PrivKey) (sdk.Tx, error) { sigs := make([]signing.SignatureV2, len(priv)) // create a random length memo @@ -57,10 +57,10 @@ func GenTx(gen client.TxConfig, msgs []sdk.Msg, feeAmt sdk.Coins, gas uint64, ch // 2nd round: once all signer infos are set, every signer can sign. for i, p := range priv { signerData := authsign.SignerData{ - ChainID: chainID, - Sequence: accSeqs[i], + ChainID: chainID, + AccountNumber: accNums[i], + Sequence: accSeqs[i], } - tx.SetSigBlockHeight(sbh[i]) signBytes, err := gen.SignModeHandler().GetSignBytes(signMode, signerData, tx.GetTx()) if err != nil { panic(err) diff --git a/simapp/simd/cmd/genaccounts.go b/simapp/simd/cmd/genaccounts.go index 9597e3c87e..bd7e1b80fc 100644 --- a/simapp/simd/cmd/genaccounts.go +++ b/simapp/simd/cmd/genaccounts.go @@ -86,7 +86,7 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa var genAccount authtypes.GenesisAccount balances := banktypes.Balance{Address: addr.String(), Coins: coins.Sort()} - baseAccount := authtypes.NewBaseAccount(addr, nil, 0) + baseAccount := authtypes.NewBaseAccount(addr, nil, 0, 0) if !vestingAmt.IsZero() { baseVestingAccount := authvesting.NewBaseVestingAccount(baseAccount, vestingAmt.Sort(), vestingEnd) diff --git a/simapp/simd/cmd/testnet.go b/simapp/simd/cmd/testnet.go index a692b6feb5..7016e54ed8 100644 --- a/simapp/simd/cmd/testnet.go +++ b/simapp/simd/cmd/testnet.go @@ -204,7 +204,7 @@ func InitTestnet( } genBalances = append(genBalances, banktypes.Balance{Address: addr.String(), Coins: coins.Sort()}) - genAccounts = append(genAccounts, authtypes.NewBaseAccount(addr, nil, 0)) + genAccounts = append(genAccounts, authtypes.NewBaseAccount(addr, nil, 0, 0)) valTokens := sdk.TokensFromConsensusPower(100) createValMsg, err := stakingtypes.NewMsgCreateValidator( diff --git a/simapp/test_helpers.go b/simapp/test_helpers.go index 02e3c2b1ed..39f2d28781 100644 --- a/simapp/test_helpers.go +++ b/simapp/test_helpers.go @@ -374,7 +374,7 @@ func CheckBalance(t *testing.T, app *SimApp, addr sdk.AccAddress, balances sdk.C // returned. func SignCheckDeliver( t *testing.T, txCfg client.TxConfig, app *bam.BaseApp, header ocproto.Header, msgs []sdk.Msg, - chainID string, sbh, accSeqs []uint64, expSimPass, expPass bool, priv ...cryptotypes.PrivKey, + chainID string, accNums, accSeqs []uint64, expSimPass, expPass bool, priv ...cryptotypes.PrivKey, ) (sdk.GasInfo, *sdk.Result, error) { tx, err := helpers.GenTx( @@ -383,7 +383,7 @@ func SignCheckDeliver( sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 0)}, helpers.DefaultGenTxGas, chainID, - sbh, + accNums, accSeqs, priv..., ) diff --git a/simapp/utils_test.go b/simapp/utils_test.go index b585bfed66..a5f6d446c1 100644 --- a/simapp/utils_test.go +++ b/simapp/utils_test.go @@ -41,6 +41,8 @@ func TestSetup(t *testing.T) { } func TestGetSimulationLog(t *testing.T) { + cdc := makeCodec(ModuleBasics) + decoders := make(sdk.StoreDecoderRegistry) decoders[authtypes.StoreKey] = func(kvAs, kvBs kv.Pair) string { return "10" } @@ -54,6 +56,11 @@ func TestGetSimulationLog(t *testing.T) { []kv.Pair{{}}, "", }, + { + authtypes.StoreKey, + []kv.Pair{{Key: authtypes.GlobalAccountNumberKey, Value: cdc.MustMarshalBinaryBare(uint64(10))}}, + "10", + }, { "OtherStore", []kv.Pair{{Key: []byte("key"), Value: []byte("value")}}, diff --git a/tests/mocks/account_retriever.go b/tests/mocks/account_retriever.go index 9cbf433945..855ea5f930 100644 --- a/tests/mocks/account_retriever.go +++ b/tests/mocks/account_retriever.go @@ -63,6 +63,20 @@ func (mr *MockAccountMockRecorder) GetPubKey() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPubKey", reflect.TypeOf((*MockAccount)(nil).GetPubKey)) } +// GetAccountNumber mocks base method +func (m *MockAccount) GetAccountNumber() uint64 { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetAccountNumber") + ret0, _ := ret[0].(uint64) + return ret0 +} + +// GetAccountNumber indicates an expected call of GetAccountNumber +func (mr *MockAccountMockRecorder) GetAccountNumber() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccountNumber", reflect.TypeOf((*MockAccount)(nil).GetAccountNumber)) +} + // GetSequence mocks base method func (m *MockAccount) GetSequence() uint64 { m.ctrl.T.Helper() @@ -145,18 +159,18 @@ func (mr *MockAccountRetrieverMockRecorder) EnsureExists(clientCtx, addr interfa return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EnsureExists", reflect.TypeOf((*MockAccountRetriever)(nil).EnsureExists), clientCtx, addr) } -// GetAccountSequence mocks base method -func (m *MockAccountRetriever) GetAccountSequence(clientCtx client.Context, addr types0.AccAddress) (uint64, uint64, error) { +// GetAccountNumberSequence mocks base method +func (m *MockAccountRetriever) GetAccountNumberSequence(clientCtx client.Context, addr types0.AccAddress) (uint64, uint64, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetAccountSequence", clientCtx, addr) + ret := m.ctrl.Call(m, "GetAccountNumberSequence", clientCtx, addr) ret0, _ := ret[0].(uint64) ret1, _ := ret[1].(uint64) ret2, _ := ret[2].(error) return ret0, ret1, ret2 } -// GetAccountSequence indicates an expected call of GetAccountSequence -func (mr *MockAccountRetrieverMockRecorder) GetAccountSequence(clientCtx, addr interface{}) *gomock.Call { +// GetAccountNumberSequence indicates an expected call of GetAccountNumberSequence +func (mr *MockAccountRetrieverMockRecorder) GetAccountNumberSequence(clientCtx, addr interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccountSequence", reflect.TypeOf((*MockAccountRetriever)(nil).GetAccountSequence), clientCtx, addr) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccountNumberSequence", reflect.TypeOf((*MockAccountRetriever)(nil).GetAccountNumberSequence), clientCtx, addr) } diff --git a/testutil/network/network.go b/testutil/network/network.go index 379127e0f8..978a832237 100644 --- a/testutil/network/network.go +++ b/testutil/network/network.go @@ -291,7 +291,7 @@ func New(t *testing.T, cfg Config) *Network { genFiles = append(genFiles, tmCfg.GenesisFile()) genBalances = append(genBalances, banktypes.Balance{Address: addr.String(), Coins: balances.Sort()}) - genAccounts = append(genAccounts, authtypes.NewBaseAccount(addr, nil, 0)) + genAccounts = append(genAccounts, authtypes.NewBaseAccount(addr, nil, 0, 0)) commission, err := sdk.NewDecFromStr("0.5") require.NoError(t, err) diff --git a/testutil/testdata/unknonwnproto.pb.go b/testutil/testdata/unknonwnproto.pb.go index 01adb35e25..55b19c3863 100644 --- a/testutil/testdata/unknonwnproto.pb.go +++ b/testutil/testdata/unknonwnproto.pb.go @@ -2567,10 +2567,9 @@ func (m *TestUpdatedTxRaw) GetNewField_1024() []byte { type TestUpdatedTxBody struct { Messages []*types.Any `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"` - SigBlockHeight uint64 `protobuf:"varint,2,opt,name=sig_block_height,json=sigBlockHeight,proto3" json:"sig_block_height,omitempty"` - Memo string `protobuf:"bytes,3,opt,name=memo,proto3" json:"memo,omitempty"` - TimeoutHeight int64 `protobuf:"varint,4,opt,name=timeout_height,json=timeoutHeight,proto3" json:"timeout_height,omitempty"` - SomeNewField uint64 `protobuf:"varint,5,opt,name=some_new_field,json=someNewField,proto3" json:"some_new_field,omitempty"` + Memo string `protobuf:"bytes,2,opt,name=memo,proto3" json:"memo,omitempty"` + TimeoutHeight int64 `protobuf:"varint,3,opt,name=timeout_height,json=timeoutHeight,proto3" json:"timeout_height,omitempty"` + SomeNewField uint64 `protobuf:"varint,4,opt,name=some_new_field,json=someNewField,proto3" json:"some_new_field,omitempty"` SomeNewFieldNonCriticalField string `protobuf:"bytes,1050,opt,name=some_new_field_non_critical_field,json=someNewFieldNonCriticalField,proto3" json:"some_new_field_non_critical_field,omitempty"` ExtensionOptions []*types.Any `protobuf:"bytes,1023,rep,name=extension_options,json=extensionOptions,proto3" json:"extension_options,omitempty"` NonCriticalExtensionOptions []*types.Any `protobuf:"bytes,2047,rep,name=non_critical_extension_options,json=nonCriticalExtensionOptions,proto3" json:"non_critical_extension_options,omitempty"` @@ -2616,13 +2615,6 @@ func (m *TestUpdatedTxBody) GetMessages() []*types.Any { return nil } -func (m *TestUpdatedTxBody) GetSigBlockHeight() uint64 { - if m != nil { - return m.SigBlockHeight - } - return 0 -} - func (m *TestUpdatedTxBody) GetMemo() string { if m != nil { return m.Memo @@ -2817,111 +2809,110 @@ func init() { func init() { proto.RegisterFile("unknonwnproto.proto", fileDescriptor_448ea787339d1228) } var fileDescriptor_448ea787339d1228 = []byte{ - // 1663 bytes of a gzipped FileDescriptorProto + // 1639 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x58, 0xcd, 0x6f, 0x1b, 0xc7, - 0x15, 0xd7, 0x70, 0x49, 0x89, 0x7c, 0xa2, 0x69, 0x66, 0xec, 0xb6, 0x1b, 0x39, 0x66, 0x98, 0x85, - 0xeb, 0x30, 0x41, 0x43, 0x9a, 0x4b, 0x06, 0x08, 0x72, 0x0a, 0xa9, 0x58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f2, 0x32, 0xff, 0xd4, 0x55, 0xb5, 0x13, 0x25, 0xe6, 0x7b, 0xb5, 0x71, 0x6f, 0x52, 0x13, 0xd3, + 0xda, 0x69, 0xa3, 0xf6, 0x33, 0xf5, 0x58, 0x82, 0xc9, 0xa6, 0x17, 0xaf, 0x3d, 0x5c, 0x99, 0x7f, + 0x6b, 0xdb, 0x34, 0x0b, 0x89, 0x03, 0x7b, 0x94, 0x06, 0xdf, 0xde, 0x16, 0xaa, 0xa9, 0xa9, 0xf2, + 0x94, 0xa8, 0xa6, 0xe6, 0xaa, 0xd5, 0xf4, 0x6e, 0x50, 0x4c, 0x84, 0x9e, 0x50, 0xe9, 0xfa, 0x67, + 0x0e, 0x13, 0xaa, 0x34, 0x98, 0x3f, 0x09, 0xfc, 0x4d, 0x13, 0xb5, 0xee, 0xec, 0x7e, 0xf5, 0xbc, + 0x8c, 0x9e, 0x3d, 0x2f, 0xa3, 0x7f, 0x3e, 0x2f, 0xa3, 0x2f, 0x5e, 0x94, 0xd7, 0x9e, 0xbd, 0x28, + 0xaf, 0xfd, 0xfd, 0x45, 0x79, 0xed, 0xe9, 0x7b, 0x43, 0x47, 0x8c, 0xfc, 0x5e, 0xad, 0xcf, 0x27, + 0xf5, 0xb1, 0xc3, 0x68, 0x7d, 0xdc, 0x9b, 0x7c, 0xe0, 0xd9, 0xc7, 0x75, 0xd9, 0xe2, 0xbe, 0x70, + 0xc6, 0xf5, 0xa8, 0xd7, 0x7b, 0xeb, 0x8a, 0xd3, 0xe6, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xc7, + 0x8b, 0xa3, 0xa7, 0xc9, 0x18, 0x00, 0x00, } func (m *Customer1) Marshal() (dAtA []byte, err error) { @@ -5261,24 +5252,19 @@ func (m *TestUpdatedTxBody) MarshalToSizedBuffer(dAtA []byte) (int, error) { if m.SomeNewField != 0 { i = encodeVarintUnknonwnproto(dAtA, i, uint64(m.SomeNewField)) i-- - dAtA[i] = 0x28 + dAtA[i] = 0x20 } if m.TimeoutHeight != 0 { i = encodeVarintUnknonwnproto(dAtA, i, uint64(m.TimeoutHeight)) i-- - dAtA[i] = 0x20 + dAtA[i] = 0x18 } if len(m.Memo) > 0 { i -= len(m.Memo) copy(dAtA[i:], m.Memo) i = encodeVarintUnknonwnproto(dAtA, i, uint64(len(m.Memo))) i-- - dAtA[i] = 0x1a - } - if m.SigBlockHeight != 0 { - i = encodeVarintUnknonwnproto(dAtA, i, uint64(m.SigBlockHeight)) - i-- - dAtA[i] = 0x10 + dAtA[i] = 0x12 } if len(m.Messages) > 0 { for iNdEx := len(m.Messages) - 1; iNdEx >= 0; iNdEx-- { @@ -6430,9 +6416,6 @@ func (m *TestUpdatedTxBody) Size() (n int) { n += 1 + l + sovUnknonwnproto(uint64(l)) } } - if m.SigBlockHeight != 0 { - n += 1 + sovUnknonwnproto(uint64(m.SigBlockHeight)) - } l = len(m.Memo) if l > 0 { n += 1 + l + sovUnknonwnproto(uint64(l)) @@ -12560,25 +12543,6 @@ func (m *TestUpdatedTxBody) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SigBlockHeight", wireType) - } - m.SigBlockHeight = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowUnknonwnproto - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.SigBlockHeight |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Memo", wireType) } @@ -12610,7 +12574,7 @@ func (m *TestUpdatedTxBody) Unmarshal(dAtA []byte) error { } m.Memo = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: + case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field TimeoutHeight", wireType) } @@ -12629,7 +12593,7 @@ func (m *TestUpdatedTxBody) Unmarshal(dAtA []byte) error { break } } - case 5: + case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field SomeNewField", wireType) } diff --git a/testutil/testdata/unknonwnproto.proto b/testutil/testdata/unknonwnproto.proto index 37a453f945..c6c4e6d772 100644 --- a/testutil/testdata/unknonwnproto.proto +++ b/testutil/testdata/unknonwnproto.proto @@ -288,10 +288,9 @@ message TestUpdatedTxRaw { message TestUpdatedTxBody { repeated google.protobuf.Any messages = 1; - uint64 sig_block_height = 2; - string memo = 3; - int64 timeout_height = 4; - uint64 some_new_field = 5; + string memo = 2; + int64 timeout_height = 3; + uint64 some_new_field = 4; string some_new_field_non_critical_field = 1050; repeated google.protobuf.Any extension_options = 1023; repeated google.protobuf.Any non_critical_extension_options = 2047; diff --git a/types/errors/errors.go b/types/errors/errors.go index 9e43917e64..9d880f81a0 100644 --- a/types/errors/errors.go +++ b/types/errors/errors.go @@ -134,10 +134,6 @@ var ( // supported. ErrNotSupported = Register(RootCodespace, 37, "feature not supported") - // ErrInvalidSigBlockHeight is returned when SigBlockHeight of tx is either greater than current block height or - // less than (current block height - ValidSigBlockPeriod) - ErrInvalidSigBlockHeight = Register(RootCodespace, 38, "invalid sig block height") - // ErrNotFound defines an error when requested entity doesn't exist in the state. ErrNotFound = Register(RootCodespace, 39, "not found") diff --git a/types/rest/rest.go b/types/rest/rest.go index 89b868dccd..636bcfcc93 100644 --- a/types/rest/rest.go +++ b/types/rest/rest.go @@ -62,35 +62,35 @@ type GasEstimateResponse struct { // BaseReq defines a structure that can be embedded in other request structures // that all share common "base" fields. type BaseReq struct { - From string `json:"from"` - Memo string `json:"memo"` - ChainID string `json:"chain_id"` - SigBlockHeight uint64 `json:"sig_block_height"` - Sequence uint64 `json:"sequence"` - TimeoutHeight uint64 `json:"timeout_height"` - Fees sdk.Coins `json:"fees"` - GasPrices sdk.DecCoins `json:"gas_prices"` - Gas string `json:"gas"` - GasAdjustment string `json:"gas_adjustment"` - Simulate bool `json:"simulate"` + From string `json:"from"` + Memo string `json:"memo"` + ChainID string `json:"chain_id"` + AccountNumber uint64 `json:"account_number"` + Sequence uint64 `json:"sequence"` + TimeoutHeight uint64 `json:"timeout_height"` + Fees sdk.Coins `json:"fees"` + GasPrices sdk.DecCoins `json:"gas_prices"` + Gas string `json:"gas"` + GasAdjustment string `json:"gas_adjustment"` + Simulate bool `json:"simulate"` } // NewBaseReq creates a new basic request instance and sanitizes its values func NewBaseReq( - from, memo, chainID string, gas, gasAdjustment string, signBlockHeight, seq uint64, + from, memo, chainID string, gas, gasAdjustment string, accNumber, seq uint64, fees sdk.Coins, gasPrices sdk.DecCoins, simulate bool, ) BaseReq { return BaseReq{ - From: strings.TrimSpace(from), - Memo: strings.TrimSpace(memo), - ChainID: strings.TrimSpace(chainID), - Fees: fees, - GasPrices: gasPrices, - Gas: strings.TrimSpace(gas), - GasAdjustment: strings.TrimSpace(gasAdjustment), - SigBlockHeight: signBlockHeight, - Sequence: seq, - Simulate: simulate, + From: strings.TrimSpace(from), + Memo: strings.TrimSpace(memo), + ChainID: strings.TrimSpace(chainID), + Fees: fees, + GasPrices: gasPrices, + Gas: strings.TrimSpace(gas), + GasAdjustment: strings.TrimSpace(gasAdjustment), + AccountNumber: accNumber, + Sequence: seq, + Simulate: simulate, } } @@ -98,7 +98,7 @@ func NewBaseReq( func (br BaseReq) Sanitize() BaseReq { return NewBaseReq( br.From, br.Memo, br.ChainID, br.Gas, br.GasAdjustment, - br.SigBlockHeight, br.Sequence, br.Fees, br.GasPrices, br.Simulate, + br.AccountNumber, br.Sequence, br.Fees, br.GasPrices, br.Simulate, ) } diff --git a/types/rest/rest_test.go b/types/rest/rest_test.go index ef1f379083..3040053f6c 100644 --- a/types/rest/rest_test.go +++ b/types/rest/rest_test.go @@ -180,10 +180,11 @@ func TestProcessPostResponse(t *testing.T) { t.Parallel() type mockAccount struct { - Address types.AccAddress `json:"address"` - Coins types.Coins `json:"coins"` - PubKey cryptotypes.PubKey `json:"public_key"` - Sequence uint64 `json:"sequence"` + Address types.AccAddress `json:"address"` + Coins types.Coins `json:"coins"` + PubKey cryptotypes.PubKey `json:"public_key"` + AccountNumber uint64 `json:"account_number"` + Sequence uint64 `json:"sequence"` } // setup @@ -195,9 +196,10 @@ func TestProcessPostResponse(t *testing.T) { pubKey := privKey.PubKey() addr := types.AccAddress(pubKey.Address()) coins := types.NewCoins(types.NewCoin("atom", types.NewInt(100)), types.NewCoin("tree", types.NewInt(125))) + accNumber := uint64(104) sequence := uint64(32) - acc := mockAccount{addr, coins, pubKey, sequence} + acc := mockAccount{addr, coins, pubKey, accNumber, sequence} cdc := codec.NewLegacyAmino() cryptocodec.RegisterCrypto(cdc) cdc.RegisterConcrete(&mockAccount{}, "lbm-sdk/mockAccount", nil) diff --git a/types/tx/tx.pb.go b/types/tx/tx.pb.go index 93182aed0a..54df318d69 100644 --- a/types/tx/tx.pb.go +++ b/types/tx/tx.pb.go @@ -179,6 +179,8 @@ type SignDoc struct { // It prevents signed transactions from being used on another chain by an // attacker ChainId string `protobuf:"bytes,3,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + // account_number is the account number of the account in state + AccountNumber uint64 `protobuf:"varint,4,opt,name=account_number,json=accountNumber,proto3" json:"account_number,omitempty"` } func (m *SignDoc) Reset() { *m = SignDoc{} } @@ -235,6 +237,13 @@ func (m *SignDoc) GetChainId() string { return "" } +func (m *SignDoc) GetAccountNumber() uint64 { + if m != nil { + return m.AccountNumber + } + return 0 +} + // TxBody is the body of a transaction that all signers sign over. type TxBody struct { // messages is a list of messages to be executed. The required signers of @@ -245,14 +254,11 @@ type TxBody struct { // is referred to as the primary signer and pays the fee for the whole // transaction. Messages []*types.Any `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"` - // sig block height is available between current block height and current block height - `VALID_SIG_BLOCK_PERIOD` - // this is used for distinguish signatures instead of account number. this is mandatory. - SigBlockHeight uint64 `protobuf:"varint,2,opt,name=sig_block_height,json=sigBlockHeight,proto3" json:"sig_block_height,omitempty"` // memo is any arbitrary memo to be added to the transaction - Memo string `protobuf:"bytes,3,opt,name=memo,proto3" json:"memo,omitempty"` + Memo string `protobuf:"bytes,2,opt,name=memo,proto3" json:"memo,omitempty"` // timeout is the block height after which this transaction will not // be processed by the chain - TimeoutHeight uint64 `protobuf:"varint,4,opt,name=timeout_height,json=timeoutHeight,proto3" json:"timeout_height,omitempty"` + TimeoutHeight uint64 `protobuf:"varint,3,opt,name=timeout_height,json=timeoutHeight,proto3" json:"timeout_height,omitempty"` // extension_options are arbitrary options that can be added by chains // when the default options are not sufficient. If any of these are present // and can't be handled, the transaction will be rejected @@ -303,13 +309,6 @@ func (m *TxBody) GetMessages() []*types.Any { return nil } -func (m *TxBody) GetSigBlockHeight() uint64 { - if m != nil { - return m.SigBlockHeight - } - return 0 -} - func (m *TxBody) GetMemo() string { if m != nil { return m.Memo @@ -759,59 +758,60 @@ func init() { func init() { proto.RegisterFile("lbm/tx/v1/tx.proto", fileDescriptor_f80bf4f3a3e5da31) } var fileDescriptor_f80bf4f3a3e5da31 = []byte{ - // 831 bytes of a gzipped FileDescriptorProto + // 833 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xcd, 0x6e, 0x23, 0x45, - 0x10, 0xf6, 0xf8, 0x2f, 0x76, 0x25, 0x9b, 0xdd, 0x6d, 0x02, 0x72, 0x1c, 0xe1, 0x58, 0x46, 0x01, - 0x4b, 0x88, 0x99, 0x4d, 0x96, 0x03, 0x70, 0x8b, 0x03, 0xab, 0xac, 0x60, 0x85, 0xd4, 0x89, 0x38, - 0xec, 0x65, 0xd4, 0x33, 0x6e, 0xb7, 0x5b, 0x99, 0xe9, 0x36, 0xd3, 0x3d, 0xc1, 0x73, 0x40, 0xe2, - 0x0d, 0xe0, 0x39, 0xf6, 0x09, 0xb8, 0x71, 0xdd, 0xe3, 0x1e, 0x39, 0x01, 0x4a, 0x1e, 0x04, 0xd4, - 0x3d, 0x3d, 0x43, 0x84, 0x92, 0x70, 0xd9, 0x5b, 0x55, 0xf5, 0xf7, 0x55, 0x7d, 0xaa, 0xae, 0x2a, - 0x40, 0x49, 0x94, 0x06, 0x7a, 0x1d, 0x5c, 0x1e, 0x06, 0x7a, 0xed, 0xaf, 0x32, 0xa9, 0x25, 0xea, - 0x27, 0x51, 0xea, 0xeb, 0xb5, 0x7f, 0x79, 0x38, 0xdc, 0x61, 0x92, 0x49, 0x1b, 0x0d, 0x8c, 0x55, - 0x02, 0x86, 0x07, 0x86, 0x14, 0x67, 0xc5, 0x4a, 0xcb, 0x20, 0xcd, 0x13, 0xcd, 0x15, 0x67, 0x26, - 0x43, 0x65, 0x3b, 0xd8, 0x7b, 0x06, 0x16, 0x11, 0x45, 0xcd, 0x5b, 0x2c, 0xb9, 0x70, 0xf1, 0x7d, - 0x57, 0x53, 0x71, 0x26, 0xb8, 0xb0, 0x4c, 0x67, 0x3a, 0xc0, 0x2e, 0x93, 0x92, 0x25, 0x34, 0xb0, - 0x5e, 0x94, 0x2f, 0x02, 0x22, 0x8a, 0xf2, 0x69, 0xf2, 0x23, 0x34, 0xcf, 0xd7, 0xe8, 0x00, 0xda, - 0x91, 0x9c, 0x17, 0x03, 0x6f, 0xec, 0x4d, 0x37, 0x8f, 0x1e, 0xfb, 0xb5, 0x60, 0xff, 0x7c, 0x3d, - 0x93, 0xf3, 0x02, 0xdb, 0x67, 0xf4, 0x04, 0xfa, 0x24, 0xd7, 0xcb, 0x90, 0x8b, 0x85, 0x1c, 0x34, - 0x2d, 0xf6, 0x9d, 0x1b, 0xd8, 0xe3, 0x5c, 0x2f, 0x9f, 0x8b, 0x85, 0xc4, 0x3d, 0xe2, 0x2c, 0x34, - 0x02, 0x30, 0x52, 0x88, 0xce, 0x33, 0xaa, 0x06, 0xad, 0x71, 0x6b, 0xba, 0x85, 0x6f, 0x44, 0x26, - 0x02, 0x3a, 0xe7, 0x6b, 0x4c, 0x7e, 0x40, 0xef, 0x03, 0x98, 0x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 0xa6, 0x40, 0xaf, 0xa3, 0xae, 0x1d, 0xc5, - 0xa7, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0x17, 0xba, 0xa0, 0x41, 0x74, 0x06, 0x00, 0x00, + 0x10, 0xf6, 0xf8, 0x2f, 0x9e, 0xca, 0xcf, 0xb2, 0x4d, 0x40, 0x8e, 0x23, 0x1c, 0xcb, 0x28, 0x60, + 0x09, 0x31, 0xb3, 0xc9, 0x72, 0x00, 0x6e, 0x71, 0x60, 0x95, 0x15, 0x2c, 0x48, 0x9d, 0x88, 0xc3, + 0x5e, 0x46, 0x3d, 0xe3, 0xf6, 0xb8, 0xb5, 0xd3, 0xdd, 0x66, 0xba, 0x27, 0xd8, 0x07, 0x24, 0xde, + 0x00, 0x84, 0xc4, 0x4b, 0xec, 0x13, 0xf0, 0x08, 0x7b, 0xdc, 0x23, 0x27, 0x40, 0xc9, 0x83, 0x80, + 0xba, 0xa7, 0x67, 0x88, 0x50, 0x12, 0x2e, 0xdc, 0xea, 0xe7, 0xab, 0xaa, 0x4f, 0xf5, 0x07, 0x28, + 0x8b, 0x79, 0xa8, 0x57, 0xe1, 0xe5, 0x51, 0xa8, 0x57, 0xc1, 0x32, 0x97, 0x5a, 0x22, 0x3f, 0x8b, + 0x79, 0xa0, 0x57, 0xc1, 0xe5, 0xd1, 0x60, 0x37, 0x95, 0xa9, 0xb4, 0xd6, 0xd0, 0x48, 0x25, 0x60, + 0x70, 0x68, 0x82, 0x92, 0x7c, 0xbd, 0xd4, 0x32, 0xe4, 0x45, 0xa6, 0x99, 0x62, 0xa9, 0xc9, 0x50, + 0xc9, 0x0e, 0xf6, 0xb6, 0x81, 0xc5, 0x44, 0x51, 0xe3, 0x4b, 0x24, 0x13, 0xce, 0x7e, 0xe0, 0x6a, + 0x2a, 0x96, 0x0a, 0x26, 0x6c, 0xa4, 0x13, 0x1d, 0x60, 0x2f, 0x95, 0x32, 0xcd, 0x68, 0x68, 0xb5, + 0xb8, 0x98, 0x87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0x8b, 0xf9, 0x87, 0x6a, 0xf6, 0x22, 0xd4, 0xeb, + 0x25, 0x55, 0x16, 0xab, 0xb0, 0xcb, 0x86, 0xf6, 0xc1, 0x4f, 0x89, 0x8a, 0x32, 0xc6, 0x99, 0xb6, + 0xbd, 0x6d, 0xe3, 0x5e, 0x4a, 0xd4, 0x97, 0x46, 0x47, 0xbb, 0xd0, 0x59, 0x92, 0x35, 0xcd, 0xdd, + 0x23, 0x28, 0x15, 0xd4, 0x87, 0x8d, 0x34, 0x27, 0x42, 0xbb, 0xfb, 0xf7, 0x71, 0xa5, 0x4e, 0x3f, + 0x7d, 0x75, 0x35, 0xf4, 0x5e, 0x5f, 0x0d, 0xbd, 0x3f, 0xaf, 0x86, 0xde, 0x4f, 0xd7, 0xc3, 0xc6, + 0xeb, 0xeb, 0x61, 0xe3, 0xb7, 0xeb, 0x61, 0xe3, 0xf9, 0xe8, 0x5e, 0x4e, 0xa1, 0x5e, 0xc5, 0x5d, + 0xbb, 0x8a, 0x8f, 0xff, 0x0e, 0x00, 0x00, 0xff, 0xff, 0x32, 0xb7, 0x97, 0x08, 0x72, 0x06, 0x00, + 0x00, } func (m *Tx) Marshal() (dAtA []byte, err error) { @@ -936,6 +936,11 @@ func (m *SignDoc) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.AccountNumber != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.AccountNumber)) + i-- + dAtA[i] = 0x20 + } if len(m.ChainId) > 0 { i -= len(m.ChainId) copy(dAtA[i:], m.ChainId) @@ -1015,19 +1020,14 @@ func (m *TxBody) MarshalToSizedBuffer(dAtA []byte) (int, error) { if m.TimeoutHeight != 0 { i = encodeVarintTx(dAtA, i, uint64(m.TimeoutHeight)) i-- - dAtA[i] = 0x20 + dAtA[i] = 0x18 } if len(m.Memo) > 0 { i -= len(m.Memo) copy(dAtA[i:], m.Memo) i = encodeVarintTx(dAtA, i, uint64(len(m.Memo))) i-- - dAtA[i] = 0x1a - } - if m.SigBlockHeight != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.SigBlockHeight)) - i-- - dAtA[i] = 0x10 + dAtA[i] = 0x12 } if len(m.Messages) > 0 { for iNdEx := len(m.Messages) - 1; iNdEx >= 0; iNdEx-- { @@ -1429,6 +1429,9 @@ func (m *SignDoc) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } + if m.AccountNumber != 0 { + n += 1 + sovTx(uint64(m.AccountNumber)) + } return n } @@ -1444,9 +1447,6 @@ func (m *TxBody) Size() (n int) { n += 1 + l + sovTx(uint64(l)) } } - if m.SigBlockHeight != 0 { - n += 1 + sovTx(uint64(m.SigBlockHeight)) - } l = len(m.Memo) if l > 0 { n += 1 + l + sovTx(uint64(l)) @@ -2040,6 +2040,25 @@ func (m *SignDoc) Unmarshal(dAtA []byte) error { } m.ChainId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AccountNumber", wireType) + } + m.AccountNumber = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AccountNumber |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -2125,25 +2144,6 @@ func (m *TxBody) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SigBlockHeight", wireType) - } - m.SigBlockHeight = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.SigBlockHeight |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Memo", wireType) } @@ -2175,7 +2175,7 @@ func (m *TxBody) Unmarshal(dAtA []byte) error { } m.Memo = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: + case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field TimeoutHeight", wireType) } diff --git a/types/tx/types.go b/types/tx/types.go index 5dcc91b256..0b48409b12 100644 --- a/types/tx/types.go +++ b/types/tx/types.go @@ -143,10 +143,6 @@ func (t *Tx) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { return nil } -func (t *Tx) GetSigBlockHeight() uint64 { - return t.Body.SigBlockHeight -} - // UnpackInterfaces implements the UnpackInterfaceMessages.UnpackInterfaces method func (m *TxBody) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { for _, any := range m.Messages { diff --git a/types/tx_msg.go b/types/tx_msg.go index ec7af0a725..c52c8d250e 100644 --- a/types/tx_msg.go +++ b/types/tx_msg.go @@ -54,9 +54,6 @@ type ( // ValidateBasic does a simple and lightweight validation check that doesn't // require access to any other information. ValidateBasic() error - - // Gets the sig block height - GetSigBlockHeight() uint64 } // FeeTx defines the interface to be implemented by Tx to use the FeeDecorators diff --git a/x/auth/ante/ante.go b/x/auth/ante/ante.go index 5b69eee2ef..5e89e8c7e2 100644 --- a/x/auth/ante/ante.go +++ b/x/auth/ante/ante.go @@ -10,7 +10,7 @@ import ( ) // NewAnteHandler returns an AnteHandler that checks and increments sequence -// numbers, checks signatures & sig block height, and deducts fees from the first +// numbers, checks signatures & account numbers, and deducts fees from the first // signer. func NewAnteHandler( ak AccountKeeper, bankKeeper types.BankKeeper, feegrantKeeper keeper.Keeper, @@ -22,11 +22,11 @@ func NewAnteHandler( NewRejectExtensionOptionsDecorator(), NewMempoolFeeDecorator(), NewValidateBasicDecorator(), - NewTxSigBlockHeightDecorator(ak), TxTimeoutHeightDecorator{}, NewValidateMemoDecorator(ak), NewConsumeGasForTxSizeDecorator(ak), NewDeductGrantedFeeDecorator(ak.(keeper2.AccountKeeper), bankKeeper.(types2.BankKeeper), feegrantKeeper), + // NewRejectFeeGranterDecorator(), // todo: Please check it when upgrade `feegrant` // The above handlers should not call `GetAccount` or `GetSignerAcc` for signer NewSetPubKeyDecorator(ak), // SetPubKeyDecorator must be called before all signature verification decorators // The handlers below may call `GetAccount` or `GetSignerAcc` for signer diff --git a/x/auth/ante/ante_test.go b/x/auth/ante/ante_test.go index 65db7afb65..5e44c34013 100644 --- a/x/auth/ante/ante_test.go +++ b/x/auth/ante/ante_test.go @@ -36,7 +36,7 @@ func (suite *AnteTestSuite) TestSimulateGasCost() { gasLimit := testdata.NewTestGasLimit() accSeqs := []uint64{0, 0, 0} privs := []cryptotypes.PrivKey{accounts[0].priv, accounts[1].priv, accounts[2].priv} - sbh := []uint64{0, 1, 1} + accNums := []uint64{0, 1, 2} testCases := []TestCase{ { @@ -69,7 +69,7 @@ func (suite *AnteTestSuite) TestSimulateGasCost() { suite.txBuilder = suite.clientCtx.TxConfig.NewTxBuilder() tc.malleate() - suite.RunTestCase(privs, msgs, feeAmount, gasLimit, sbh, accSeqs, suite.ctx.ChainID(), tc) + suite.RunTestCase(privs, msgs, feeAmount, gasLimit, accNums, accSeqs, suite.ctx.ChainID(), tc) }) } } @@ -92,7 +92,7 @@ func (suite *AnteTestSuite) TestAnteHandlerSigErrors() { // Variable data per test case var ( privs []cryptotypes.PrivKey - sbh []uint64 + accNums []uint64 accSeqs []uint64 ) @@ -100,11 +100,11 @@ func (suite *AnteTestSuite) TestAnteHandlerSigErrors() { { "check no signatures fails", func() { - privs, sbh, accSeqs = []cryptotypes.PrivKey{}, []uint64{}, []uint64{} + privs, accNums, accSeqs = []cryptotypes.PrivKey{}, []uint64{}, []uint64{} // Create tx manually to test the tx's signers suite.Require().NoError(suite.txBuilder.SetMsgs(msgs...)) - tx, err := suite.CreateTestTx(privs, sbh, accSeqs, suite.ctx.ChainID()) + tx, err := suite.CreateTestTx(privs, accNums, accSeqs, suite.ctx.ChainID()) suite.Require().NoError(err) // tx.GetSigners returns addresses in correct order: addr1, addr2, addr3 expectedSigners := []sdk.AccAddress{addr0, addr1, addr2} @@ -117,7 +117,7 @@ func (suite *AnteTestSuite) TestAnteHandlerSigErrors() { { "num sigs dont match GetSigners", func() { - privs, sbh, accSeqs = []cryptotypes.PrivKey{priv0}, []uint64{0}, []uint64{0} + privs, accNums, accSeqs = []cryptotypes.PrivKey{priv0}, []uint64{0}, []uint64{0} }, false, false, @@ -126,7 +126,7 @@ func (suite *AnteTestSuite) TestAnteHandlerSigErrors() { { "unrecognized account", func() { - privs, sbh, accSeqs = []cryptotypes.PrivKey{priv0, priv1, priv2}, []uint64{0, 0, 0}, []uint64{0, 0, 0} + privs, accNums, accSeqs = []cryptotypes.PrivKey{priv0, priv1, priv2}, []uint64{0, 1, 2}, []uint64{0, 0, 0} }, false, false, @@ -141,8 +141,8 @@ func (suite *AnteTestSuite) TestAnteHandlerSigErrors() { suite.Require().NoError(err) }, false, - true, - nil, // unknown account may send tx; now they have enough money to pay fee + false, + sdkerrors.ErrUnknownAddress, }, } @@ -151,17 +151,15 @@ func (suite *AnteTestSuite) TestAnteHandlerSigErrors() { suite.txBuilder = suite.clientCtx.TxConfig.NewTxBuilder() tc.malleate() - suite.RunTestCase(privs, msgs, feeAmount, gasLimit, sbh, accSeqs, suite.ctx.ChainID(), tc) + suite.RunTestCase(privs, msgs, feeAmount, gasLimit, accNums, accSeqs, suite.ctx.ChainID(), tc) }) } } -// Test logic around sig block height checking with one signer and many signers. -func (suite *AnteTestSuite) TestAnteHandlerSigBlockHeight() { +// Test logic around account number checking with one signer and many signers. +func (suite *AnteTestSuite) TestAnteHandlerAccountNumbers() { suite.SetupTest(false) // reset - suite.ctx = suite.ctx.WithBlockHeight(5000) // init block height is 5000 - // Same data for every test cases accounts := suite.CreateTestAccounts(2) feeAmount := testdata.NewTestFeeAmount() @@ -169,7 +167,7 @@ func (suite *AnteTestSuite) TestAnteHandlerSigBlockHeight() { // Variable data per test case var ( - sbh []uint64 + accNums []uint64 msgs []sdk.Msg privs []cryptotypes.PrivKey accSeqs []uint64 @@ -182,46 +180,46 @@ func (suite *AnteTestSuite) TestAnteHandlerSigBlockHeight() { msg := testdata.NewTestMsg(accounts[0].acc.GetAddress()) msgs = []sdk.Msg{msg} - privs, sbh, accSeqs = []cryptotypes.PrivKey{accounts[0].priv}, []uint64{3600}, []uint64{0} + privs, accNums, accSeqs = []cryptotypes.PrivKey{accounts[0].priv}, []uint64{0}, []uint64{0} }, false, true, nil, }, { - "new tx from wrong sig block height", + "new tx from wrong account number", func() { - privs, sbh, accSeqs = []cryptotypes.PrivKey{accounts[0].priv}, []uint64{1}, []uint64{1} + privs, accNums, accSeqs = []cryptotypes.PrivKey{accounts[0].priv}, []uint64{1}, []uint64{1} }, false, false, - sdkerrors.ErrInvalidSigBlockHeight, + sdkerrors.ErrUnauthorized, }, { - "new tx from correct sig block height", + "new tx from correct account number", func() { - privs, sbh, accSeqs = []cryptotypes.PrivKey{accounts[0].priv}, []uint64{3600}, []uint64{1} + privs, accNums, accSeqs = []cryptotypes.PrivKey{accounts[0].priv}, []uint64{0}, []uint64{1} }, false, true, nil, }, { - "new tx with another signer and incorrect sig block height", + "new tx with another signer and incorrect account numbers", func() { msg1 := testdata.NewTestMsg(accounts[0].acc.GetAddress(), accounts[1].acc.GetAddress()) msg2 := testdata.NewTestMsg(accounts[1].acc.GetAddress(), accounts[0].acc.GetAddress()) msgs = []sdk.Msg{msg1, msg2} - privs, sbh, accSeqs = []cryptotypes.PrivKey{accounts[0].priv, accounts[1].priv}, []uint64{1, 0}, []uint64{2, 0} + privs, accNums, accSeqs = []cryptotypes.PrivKey{accounts[0].priv, accounts[1].priv}, []uint64{1, 0}, []uint64{2, 0} }, false, false, - sdkerrors.ErrInvalidSigBlockHeight, + sdkerrors.ErrUnauthorized, }, { - "new tx with correct sig block height", + "new tx with correct account numbers", func() { - privs, sbh, accSeqs = []cryptotypes.PrivKey{accounts[0].priv, accounts[1].priv}, []uint64{3600, 3601}, []uint64{2, 0} + privs, accNums, accSeqs = []cryptotypes.PrivKey{accounts[0].priv, accounts[1].priv}, []uint64{0, 1}, []uint64{2, 0} }, false, true, @@ -234,13 +232,13 @@ func (suite *AnteTestSuite) TestAnteHandlerSigBlockHeight() { suite.txBuilder = suite.clientCtx.TxConfig.NewTxBuilder() tc.malleate() - suite.RunTestCase(privs, msgs, feeAmount, gasLimit, sbh, accSeqs, suite.ctx.ChainID(), tc) + suite.RunTestCase(privs, msgs, feeAmount, gasLimit, accNums, accSeqs, suite.ctx.ChainID(), tc) }) } } -// Test logic around sig block height checking with many signers when BlockHeight is 0. -func (suite *AnteTestSuite) TestAnteHandlerSigBlockHeightAtBlockHeightZero() { +// Test logic around account number checking with many signers when BlockHeight is 0. +func (suite *AnteTestSuite) TestAnteHandlerAccountNumbersAtBlockHeightZero() { suite.SetupTest(false) // setup suite.ctx = suite.ctx.WithBlockHeight(0) @@ -271,16 +269,16 @@ func (suite *AnteTestSuite) TestAnteHandlerSigBlockHeightAtBlockHeightZero() { nil, }, { - "new tx from wrong sig block height", + "new tx from wrong account number", func() { privs, accNums, accSeqs = []cryptotypes.PrivKey{accounts[0].priv}, []uint64{1}, []uint64{1} }, false, false, - sdkerrors.ErrInvalidSigBlockHeight, + sdkerrors.ErrUnauthorized, }, { - "new tx from correct sig block height", + "new tx from correct account number", func() { privs, accNums, accSeqs = []cryptotypes.PrivKey{accounts[0].priv}, []uint64{0}, []uint64{1} }, @@ -289,20 +287,20 @@ func (suite *AnteTestSuite) TestAnteHandlerSigBlockHeightAtBlockHeightZero() { nil, }, { - "new tx with another signer and incorrect sig block height", + "new tx with another signer and incorrect account numbers", func() { msg1 := testdata.NewTestMsg(accounts[0].acc.GetAddress(), accounts[1].acc.GetAddress()) msg2 := testdata.NewTestMsg(accounts[1].acc.GetAddress(), accounts[0].acc.GetAddress()) msgs = []sdk.Msg{msg1, msg2} - privs, accNums, accSeqs = []cryptotypes.PrivKey{accounts[0].priv, accounts[1].priv}, []uint64{1, 1}, []uint64{2, 0} + privs, accNums, accSeqs = []cryptotypes.PrivKey{accounts[0].priv, accounts[1].priv}, []uint64{1, 0}, []uint64{2, 0} }, false, false, - sdkerrors.ErrInvalidSigBlockHeight, + sdkerrors.ErrUnauthorized, }, { - "new tx with another signer and correct sig block height", + "new tx with another signer and correct account numbers", func() { // Note that accNums is [0,0] at block 0. privs, accNums, accSeqs = []cryptotypes.PrivKey{accounts[0].priv, accounts[1].priv}, []uint64{0, 0}, []uint64{2, 0} @@ -378,7 +376,7 @@ func (suite *AnteTestSuite) TestAnteHandlerSequences() { msg2 := testdata.NewTestMsg(accounts[2].acc.GetAddress(), accounts[0].acc.GetAddress()) msgs = []sdk.Msg{msg1, msg2} - privs, accNums, accSeqs = []cryptotypes.PrivKey{accounts[0].priv, accounts[1].priv, accounts[2].priv}, []uint64{0, 0, 0}, []uint64{2, 0, 0} + privs, accNums, accSeqs = []cryptotypes.PrivKey{accounts[0].priv, accounts[1].priv, accounts[2].priv}, []uint64{0, 1, 2}, []uint64{2, 0, 0} }, false, true, @@ -396,7 +394,7 @@ func (suite *AnteTestSuite) TestAnteHandlerSequences() { func() { msg := testdata.NewTestMsg(accounts[1].acc.GetAddress()) msgs = []sdk.Msg{msg} - privs, accNums, accSeqs = []cryptotypes.PrivKey{accounts[1].priv}, []uint64{0}, []uint64{0} + privs, accNums, accSeqs = []cryptotypes.PrivKey{accounts[1].priv}, []uint64{1}, []uint64{0} }, false, false, @@ -417,7 +415,7 @@ func (suite *AnteTestSuite) TestAnteHandlerSequences() { msg := testdata.NewTestMsg(accounts[0].acc.GetAddress(), accounts[1].acc.GetAddress()) msgs = []sdk.Msg{msg} - privs, accNums, accSeqs = []cryptotypes.PrivKey{accounts[0].priv, accounts[1].priv}, []uint64{0, 0}, []uint64{3, 2} + privs, accNums, accSeqs = []cryptotypes.PrivKey{accounts[0].priv, accounts[1].priv}, []uint64{0, 1}, []uint64{3, 2} }, false, true, @@ -602,14 +600,13 @@ func (suite *AnteTestSuite) TestAnteHandlerMultiSigner() { accSeqs []uint64 ) - // This test case is no longer meaningful because there is no account number any more. testCases := []TestCase{ { "signers in order", func() { msgs = []sdk.Msg{msg1, msg2, msg3} - privs, accNums, accSeqs = []cryptotypes.PrivKey{accounts[0].priv, accounts[1].priv, accounts[2].priv}, []uint64{1, 1, 1}, []uint64{0, 0, 0} - suite.txBuilder.SetMemo("Check signers are in expected order works") + privs, accNums, accSeqs = []cryptotypes.PrivKey{accounts[0].priv, accounts[1].priv, accounts[2].priv}, []uint64{0, 1, 2}, []uint64{0, 0, 0} + suite.txBuilder.SetMemo("Check signers are in expected order and different account numbers works") }, false, true, @@ -619,7 +616,7 @@ func (suite *AnteTestSuite) TestAnteHandlerMultiSigner() { "change sequence numbers (only accounts 0 and 1 sign)", func() { msgs = []sdk.Msg{msg1} - privs, accNums, accSeqs = []cryptotypes.PrivKey{accounts[0].priv, accounts[1].priv}, []uint64{1, 1}, []uint64{1, 1} + privs, accNums, accSeqs = []cryptotypes.PrivKey{accounts[0].priv, accounts[1].priv}, []uint64{0, 1}, []uint64{1, 1} }, false, true, @@ -629,7 +626,7 @@ func (suite *AnteTestSuite) TestAnteHandlerMultiSigner() { "change sequence numbers (only accounts 1 and 2 sign)", func() { msgs = []sdk.Msg{msg2} - privs, accNums, accSeqs = []cryptotypes.PrivKey{accounts[2].priv, accounts[0].priv}, []uint64{1, 1}, []uint64{1, 2} + privs, accNums, accSeqs = []cryptotypes.PrivKey{accounts[2].priv, accounts[0].priv}, []uint64{2, 0}, []uint64{1, 2} }, false, true, @@ -639,7 +636,7 @@ func (suite *AnteTestSuite) TestAnteHandlerMultiSigner() { "everyone signs again", func() { msgs = []sdk.Msg{msg1, msg2, msg3} - privs, accNums, accSeqs = []cryptotypes.PrivKey{accounts[0].priv, accounts[1].priv, accounts[2].priv}, []uint64{1, 1, 1}, []uint64{3, 2, 2} + privs, accNums, accSeqs = []cryptotypes.PrivKey{accounts[0].priv, accounts[1].priv, accounts[2].priv}, []uint64{0, 1, 2}, []uint64{3, 2, 2} }, false, true, @@ -666,7 +663,7 @@ func (suite *AnteTestSuite) TestAnteHandlerBadSignBytes() { // Variable data per test case var ( - sbh []uint64 + accNums []uint64 chainID string feeAmount sdk.Coins gasLimit uint64 @@ -683,7 +680,7 @@ func (suite *AnteTestSuite) TestAnteHandlerBadSignBytes() { feeAmount = testdata.NewTestFeeAmount() gasLimit = testdata.NewTestGasLimit() msgs = []sdk.Msg{msg0} - privs, sbh, accSeqs = []cryptotypes.PrivKey{accounts[0].priv}, []uint64{0}, []uint64{0} + privs, accNums, accSeqs = []cryptotypes.PrivKey{accounts[0].priv}, []uint64{0}, []uint64{0} }, false, true, @@ -710,19 +707,18 @@ func (suite *AnteTestSuite) TestAnteHandlerBadSignBytes() { sdkerrors.ErrWrongSequence, }, { - "test wrong sig block height", + "test wrong accNums", func() { accSeqs = []uint64{1} // Back to correct accSeqs - sbh = []uint64{2} + accNums = []uint64{1} }, false, false, - sdkerrors.ErrInvalidSigBlockHeight, + sdkerrors.ErrUnauthorized, }, { "test wrong msg", func() { - sbh = []uint64{0} // Back to correct sig block height msgs = []sdk.Msg{testdata.NewTestMsg(accounts[1].acc.GetAddress())} }, false, @@ -730,8 +726,6 @@ func (suite *AnteTestSuite) TestAnteHandlerBadSignBytes() { sdkerrors.ErrInvalidPubKey, }, { - // This test case succeed and this is normal. Different gasLimit does not matter to sign. - // The failure of the past was due to invalid account number "test wrong fee gas", func() { msgs = []sdk.Msg{msg0} // Back to correct msgs @@ -739,30 +733,26 @@ func (suite *AnteTestSuite) TestAnteHandlerBadSignBytes() { gasLimit = testdata.NewTestGasLimit() + 100 }, false, - true, - nil, + false, + sdkerrors.ErrUnauthorized, }, { - // This test case succeed and this is normal. Different feeAmount does not matter to sign. - // The failure of the past was due to invalid account number "test wrong fee amount", func() { - accSeqs = []uint64{2} feeAmount = testdata.NewTestFeeAmount() feeAmount[0].Amount = feeAmount[0].Amount.AddRaw(100) gasLimit = testdata.NewTestGasLimit() }, false, - true, - nil, + false, + sdkerrors.ErrUnauthorized, }, { "test wrong signer if public key exist", func() { - accSeqs = []uint64{3} feeAmount = testdata.NewTestFeeAmount() gasLimit = testdata.NewTestGasLimit() - privs, sbh, accSeqs = []cryptotypes.PrivKey{accounts[1].priv}, []uint64{0}, []uint64{1} + privs, accNums, accSeqs = []cryptotypes.PrivKey{accounts[1].priv}, []uint64{0}, []uint64{1} }, false, false, @@ -772,7 +762,7 @@ func (suite *AnteTestSuite) TestAnteHandlerBadSignBytes() { "test wrong signer if public doesn't exist", func() { msgs = []sdk.Msg{testdata.NewTestMsg(accounts[1].acc.GetAddress())} - privs, sbh, accSeqs = []cryptotypes.PrivKey{accounts[0].priv}, []uint64{0}, []uint64{0} + privs, accNums, accSeqs = []cryptotypes.PrivKey{accounts[0].priv}, []uint64{1}, []uint64{0} }, false, false, @@ -785,7 +775,7 @@ func (suite *AnteTestSuite) TestAnteHandlerBadSignBytes() { suite.txBuilder = suite.clientCtx.TxConfig.NewTxBuilder() tc.malleate() - suite.RunTestCase(privs, msgs, feeAmount, gasLimit, sbh, accSeqs, chainID, tc) + suite.RunTestCase(privs, msgs, feeAmount, gasLimit, accNums, accSeqs, chainID, tc) }) } } @@ -981,7 +971,7 @@ func (suite *AnteTestSuite) TestAnteHandlerSigLimitExceeded() { privs = append(privs, accounts[i].priv) } msgs := []sdk.Msg{testdata.NewTestMsg(addrs...)} - accNums, accSeqs := []uint64{0, 0, 0, 0, 0, 0, 0, 0}, []uint64{0, 0, 0, 0, 0, 0, 0, 0} + accNums, accSeqs := []uint64{0, 1, 2, 3, 4, 5, 6, 7}, []uint64{0, 0, 0, 0, 0, 0, 0, 0} feeAmount := testdata.NewTestFeeAmount() gasLimit := testdata.NewTestGasLimit() @@ -1012,14 +1002,14 @@ func (suite *AnteTestSuite) TestCustomSignatureVerificationGasConsumer() { // setup an ante handler that only accepts PubKeyEd25519 suite.anteHandler = ante.NewAnteHandler(suite.app.AccountKeeper, suite.app.BankKeeper, suite.app.FeeGrantKeeper, func(meter sdk.GasMeter, sig signing.SignatureV2, params types.Params) error { - switch pubkey := sig.PubKey.(type) { - case *ed25519.PubKey: - meter.ConsumeGas(params.SigVerifyCostED25519, "ante verify: ed25519") - return nil - default: - return sdkerrors.Wrapf(sdkerrors.ErrInvalidPubKey, "unrecognized public key type: %T", pubkey) - } - }, suite.clientCtx.TxConfig.SignModeHandler()) + switch pubkey := sig.PubKey.(type) { + case *ed25519.PubKey: + meter.ConsumeGas(params.SigVerifyCostED25519, "ante verify: ed25519") + return nil + default: + return sdkerrors.Wrapf(sdkerrors.ErrInvalidPubKey, "unrecognized public key type: %T", pubkey) + } + }, suite.clientCtx.TxConfig.SignModeHandler()) // Same data for every test cases accounts := suite.CreateTestAccounts(1) @@ -1102,9 +1092,9 @@ func (suite *AnteTestSuite) TestAnteHandlerReCheck() { name string params types.Params }{ - {"memo size check", types.NewParams(1, types.DefaultTxSigLimit, types.DefaultTxSizeCostPerByte, types.DefaultSigVerifyCostED25519, types.DefaultSigVerifyCostSecp256k1, types.DefaultValidSigBlockPeriod)}, - {"txsize check", types.NewParams(types.DefaultMaxMemoCharacters, types.DefaultTxSigLimit, 10000000, types.DefaultSigVerifyCostED25519, types.DefaultSigVerifyCostSecp256k1, types.DefaultValidSigBlockPeriod)}, - {"sig verify cost check", types.NewParams(types.DefaultMaxMemoCharacters, types.DefaultTxSigLimit, types.DefaultTxSizeCostPerByte, types.DefaultSigVerifyCostED25519, 100000000, types.DefaultValidSigBlockPeriod)}, + {"memo size check", types.NewParams(1, types.DefaultTxSigLimit, types.DefaultTxSizeCostPerByte, types.DefaultSigVerifyCostED25519, types.DefaultSigVerifyCostSecp256k1)}, + {"txsize check", types.NewParams(types.DefaultMaxMemoCharacters, types.DefaultTxSigLimit, 10000000, types.DefaultSigVerifyCostED25519, types.DefaultSigVerifyCostSecp256k1)}, + {"sig verify cost check", types.NewParams(types.DefaultMaxMemoCharacters, types.DefaultTxSigLimit, types.DefaultTxSizeCostPerByte, types.DefaultSigVerifyCostED25519, 100000000)}, } for _, tc := range testCases { // set testcase parameters diff --git a/x/auth/ante/basic.go b/x/auth/ante/basic.go index ed08d32720..a060ed14c3 100644 --- a/x/auth/ante/basic.go +++ b/x/auth/ante/basic.go @@ -200,32 +200,3 @@ func (txh TxTimeoutHeightDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simul return next(ctx, tx, simulate) } - -type TxSigBlockHeightDecorator struct { - ak AccountKeeper -} - -func NewTxSigBlockHeightDecorator(ak AccountKeeper) TxSigBlockHeightDecorator { - return TxSigBlockHeightDecorator{ - ak: ak, - } -} - -func (txs TxSigBlockHeightDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error) { - if !simulate { - params := txs.ak.GetParams(ctx) - sbh := tx.GetSigBlockHeight() - current := uint64(ctx.BlockHeight()) - validMin := uint64(0) - if current > params.ValidSigBlockPeriod { - validMin = current - params.ValidSigBlockPeriod - } - if sbh > uint64(ctx.BlockHeight()) || sbh < validMin { - return ctx, sdkerrors.Wrapf( - sdkerrors.ErrInvalidSigBlockHeight, "sig block height: %d, current: %d, valid sig block period: %d", - sbh, ctx.BlockHeight(), params.ValidSigBlockPeriod, - ) - } - } - return next(ctx, tx, simulate) -} diff --git a/x/auth/ante/expected_keepers.go b/x/auth/ante/expected_keepers.go index 08200e18d7..6770b38eb2 100644 --- a/x/auth/ante/expected_keepers.go +++ b/x/auth/ante/expected_keepers.go @@ -8,7 +8,6 @@ import ( // AccountKeeper defines the contract needed for AccountKeeper related APIs. // Interface provides support to use non-sdk AccountKeeper for AnteHandler's decorators. type AccountKeeper interface { - NewAccountWithAddress(ctx sdk.Context, addr sdk.AccAddress) types.AccountI GetParams(ctx sdk.Context) (params types.Params) GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI SetAccount(ctx sdk.Context, acc types.AccountI) diff --git a/x/auth/ante/fee.go b/x/auth/ante/fee.go index 3ca399f1a0..18ab9b2889 100644 --- a/x/auth/ante/fee.go +++ b/x/auth/ante/fee.go @@ -82,7 +82,11 @@ func (dfd DeductFeeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bo } feePayer := feeTx.FeePayer() - feePayerAcc := dfd.ak.NewAccountWithAddress(ctx, feePayer) + feePayerAcc := dfd.ak.GetAccount(ctx, feePayer) + + if feePayerAcc == nil { + return ctx, sdkerrors.Wrapf(sdkerrors.ErrUnknownAddress, "fee payer address: %s does not exist", feePayer) + } // deduct the fees if !feeTx.GetFee().IsZero() { diff --git a/x/auth/ante/sigverify.go b/x/auth/ante/sigverify.go index c4e2ebcdc1..94c1116980 100644 --- a/x/auth/ante/sigverify.go +++ b/x/auth/ante/sigverify.go @@ -80,11 +80,8 @@ func (spkd SetPubKeyDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate b acc, err := GetSignerAcc(ctx, spkd.ak, signers[i]) if err != nil { - // At this point, the signer may not be in account keeper. - // So we make an account with address. - acc = spkd.ak.NewAccountWithAddress(ctx, signers[i]) + return ctx, err } - // account already has pubkey set,no need to reset if acc.GetPubKey() != nil { continue @@ -93,7 +90,7 @@ func (spkd SetPubKeyDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate b if err != nil { return ctx, sdkerrors.Wrap(sdkerrors.ErrInvalidPubKey, err.Error()) } - spkd.ak.SetAccount(ctx, acc) // After here, we can call `GetAccount` or `GetSignerAcc` from other ante handlers + spkd.ak.SetAccount(ctx, acc) } // Also emit the following events, so that txs can be indexed by these @@ -155,7 +152,7 @@ func (sgcd SigGasConsumeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simula return ctx, err } - // stdSigs contains the sequence number, signatures. + // stdSigs contains the sequence number, account number, and signatures. // When simulating, this would just be a 0-length slice. signerAddrs := sigTx.GetSigners() @@ -242,7 +239,7 @@ func (svd *SigVerificationDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simu return ctx, sdkerrors.Wrap(sdkerrors.ErrTxDecode, "invalid transaction type") } - // stdSigs contains the sequence number, signatures. + // stdSigs contains the sequence number, account number, and signatures. // When simulating, this would just be a 0-length slice. sigs, err := sigTx.GetSignaturesV2() if err != nil { @@ -258,7 +255,7 @@ func (svd *SigVerificationDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simu newSigKeys := make([]string, 0, len(sigs)) defer func() { - // remove txHashCache if got an error + // remove txHashCash if got an error if err != nil { for _, sigKey := range newSigKeys { svd.txHashCache.Delete(sigKey) @@ -301,14 +298,18 @@ func (svd *SigVerificationDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simu // retrieve signer data genesis := ctx.BlockHeight() == 0 chainID := ctx.ChainID() + var accNum uint64 + if !genesis { + accNum = acc.GetAccountNumber() + } signerData := authsigning.SignerData{ - ChainID: chainID, - Sequence: acc.GetSequence(), + ChainID: chainID, + AccountNumber: accNum, + Sequence: acc.GetSequence(), } if !genesis { - sigKey := fmt.Sprintf("%s:%d:%d", acc.GetAddress().String(), - tx.GetSigBlockHeight(), signerData.Sequence) + sigKey := fmt.Sprintf("%d:%d", signerData.AccountNumber, signerData.Sequence) // TODO could we use `tx.(*wrapper).getBodyBytes()` instead of `ctx.TxBytes()`? txHash := sha256.Sum256(ctx.TxBytes()) stored := false @@ -327,9 +328,9 @@ func (svd *SigVerificationDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simu if onlyAminoSigners { // If all signers are using SIGN_MODE_LEGACY_AMINO, we rely on VerifySignature to check account sequence number, // and therefore communicate sequence number as a potential cause of error. - errMsg = fmt.Sprintf("signature verification failed; please verify sequence (%d) and chain-id (%s)", acc.GetSequence(), chainID) + errMsg = fmt.Sprintf("signature verification failed; please verify account number (%d), sequence (%d) and chain-id (%s)", accNum, acc.GetSequence(), chainID) } else { - errMsg = fmt.Sprintf("signature verification failed; please verify chain-id (%s)", chainID) + errMsg = fmt.Sprintf("signature verification failed; please verify account number (%d) and chain-id (%s)", accNum, chainID) } return ctx, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, errMsg) } diff --git a/x/auth/ante/sigverify_test.go b/x/auth/ante/sigverify_test.go index 768ea6e68f..36473ebcb5 100644 --- a/x/auth/ante/sigverify_test.go +++ b/x/auth/ante/sigverify_test.go @@ -35,6 +35,7 @@ func (suite *AnteTestSuite) TestSetPubKey() { // set accounts and create msg for each address for i, addr := range addrs { acc := suite.app.AccountKeeper.NewAccountWithAddress(suite.ctx, addr) + suite.Require().NoError(acc.SetAccountNumber(uint64(i))) suite.app.AccountKeeper.SetAccount(suite.ctx, acc) msgs[i] = testdata.NewTestMsg(addr) } @@ -118,7 +119,7 @@ func (suite *AnteTestSuite) TestSigVerification() { suite.SetupTest(true) // setup suite.txBuilder = suite.clientCtx.TxConfig.NewTxBuilder() - // make block height non-zero to ensure sig block height part + // make block height non-zero to ensure account numbers part of signBytes suite.ctx = suite.ctx.WithBlockHeight(1) // keys and addresses @@ -132,6 +133,7 @@ func (suite *AnteTestSuite) TestSigVerification() { // set accounts and create msg for each address for i, addr := range addrs { acc := suite.app.AccountKeeper.NewAccountWithAddress(suite.ctx, addr) + suite.Require().NoError(acc.SetAccountNumber(uint64(i))) suite.app.AccountKeeper.SetAccount(suite.ctx, acc) msgs[i] = testdata.NewTestMsg(addr) } @@ -141,13 +143,12 @@ func (suite *AnteTestSuite) TestSigVerification() { spkd := ante.NewSetPubKeyDecorator(suite.app.AccountKeeper) svd := ante.NewSigVerificationDecorator(suite.app.AccountKeeper, suite.clientCtx.TxConfig.SignModeHandler()) - sbhv := ante.NewTxSigBlockHeightDecorator(suite.app.AccountKeeper) - antehandler := sdk.ChainAnteDecorators(spkd, svd, sbhv) + antehandler := sdk.ChainAnteDecorators(spkd, svd) type testCase struct { name string privs []cryptotypes.PrivKey - sbh []uint64 + accNums []uint64 accSeqs []uint64 recheck bool shouldErr bool @@ -155,10 +156,10 @@ func (suite *AnteTestSuite) TestSigVerification() { testCases := []testCase{ {"no signers", []cryptotypes.PrivKey{}, []uint64{}, []uint64{}, false, true}, {"not enough signers", []cryptotypes.PrivKey{priv1, priv2}, []uint64{0, 1}, []uint64{0, 0}, false, true}, - {"wrong order signers", []cryptotypes.PrivKey{priv3, priv2, priv1}, []uint64{1, 1, 1}, []uint64{0, 0, 0}, false, true}, - {"wrong sig block height", []cryptotypes.PrivKey{priv1, priv2, priv3}, []uint64{2, 2, 2}, []uint64{0, 0, 0}, false, true}, - {"wrong sequences", []cryptotypes.PrivKey{priv1, priv2, priv3}, []uint64{0, 1, 1}, []uint64{3, 4, 5}, false, true}, - {"valid tx", []cryptotypes.PrivKey{priv1, priv2, priv3}, []uint64{1, 1, 1}, []uint64{0, 0, 0}, false, false}, + {"wrong order signers", []cryptotypes.PrivKey{priv3, priv2, priv1}, []uint64{2, 1, 0}, []uint64{0, 0, 0}, false, true}, + {"wrong accnums", []cryptotypes.PrivKey{priv1, priv2, priv3}, []uint64{7, 8, 9}, []uint64{0, 0, 0}, false, true}, + {"wrong sequences", []cryptotypes.PrivKey{priv1, priv2, priv3}, []uint64{0, 1, 2}, []uint64{3, 4, 5}, false, true}, + {"valid tx", []cryptotypes.PrivKey{priv1, priv2, priv3}, []uint64{0, 1, 2}, []uint64{0, 0, 0}, false, false}, {"no err on recheck", []cryptotypes.PrivKey{}, []uint64{}, []uint64{}, true, false}, } for i, tc := range testCases { @@ -169,7 +170,7 @@ func (suite *AnteTestSuite) TestSigVerification() { suite.txBuilder.SetFeeAmount(feeAmount) suite.txBuilder.SetGasLimit(gasLimit) - tx, err := suite.CreateTestTx(tc.privs, tc.sbh, tc.accSeqs, suite.ctx.ChainID()) + tx, err := suite.CreateTestTx(tc.privs, tc.accNums, tc.accSeqs, suite.ctx.ChainID()) suite.Require().NoError(err) _, err = antehandler(suite.ctx, tx, false) @@ -204,7 +205,7 @@ func (suite *AnteTestSuite) TestSigVerification_ExplicitAmino() { suite.txBuilder = suite.clientCtx.TxConfig.NewTxBuilder() - // make block height non-zero to ensure sig block height + // make block height non-zero to ensure account numbers part of signBytes suite.ctx = suite.ctx.WithBlockHeight(1) // keys and addresses @@ -218,6 +219,7 @@ func (suite *AnteTestSuite) TestSigVerification_ExplicitAmino() { // set accounts and create msg for each address for i, addr := range addrs { acc := suite.app.AccountKeeper.NewAccountWithAddress(suite.ctx, addr) + suite.Require().NoError(acc.SetAccountNumber(uint64(i))) suite.app.AccountKeeper.SetAccount(suite.ctx, acc) msgs[i] = testdata.NewTestMsg(addr) } @@ -227,8 +229,7 @@ func (suite *AnteTestSuite) TestSigVerification_ExplicitAmino() { spkd := ante.NewSetPubKeyDecorator(suite.app.AccountKeeper) svd := ante.NewSigVerificationDecorator(suite.app.AccountKeeper, suite.clientCtx.TxConfig.SignModeHandler()) - sbhv := ante.NewTxSigBlockHeightDecorator(suite.app.AccountKeeper) - antehandler := sdk.ChainAnteDecorators(spkd, svd, sbhv) + antehandler := sdk.ChainAnteDecorators(spkd, svd) type testCase struct { name string @@ -241,10 +242,10 @@ func (suite *AnteTestSuite) TestSigVerification_ExplicitAmino() { testCases := []testCase{ {"no signers", []cryptotypes.PrivKey{}, []uint64{}, []uint64{}, false, true}, {"not enough signers", []cryptotypes.PrivKey{priv1, priv2}, []uint64{0, 1}, []uint64{0, 0}, false, true}, - {"wrong order signers", []cryptotypes.PrivKey{priv3, priv2, priv1}, []uint64{1, 1, 1}, []uint64{0, 0, 0}, false, true}, - {"wrong sig block height", []cryptotypes.PrivKey{priv1, priv2, priv3}, []uint64{7, 8, 9}, []uint64{0, 0, 0}, false, true}, - {"wrong sequences", []cryptotypes.PrivKey{priv1, priv2, priv3}, []uint64{0, 1, 1}, []uint64{3, 4, 5}, false, true}, - {"valid tx", []cryptotypes.PrivKey{priv1, priv2, priv3}, []uint64{0, 1, 1}, []uint64{0, 0, 0}, false, false}, + {"wrong order signers", []cryptotypes.PrivKey{priv3, priv2, priv1}, []uint64{2, 1, 0}, []uint64{0, 0, 0}, false, true}, + {"wrong accnums", []cryptotypes.PrivKey{priv1, priv2, priv3}, []uint64{7, 8, 9}, []uint64{0, 0, 0}, false, true}, + {"wrong sequences", []cryptotypes.PrivKey{priv1, priv2, priv3}, []uint64{0, 1, 2}, []uint64{3, 4, 5}, false, true}, + {"valid tx", []cryptotypes.PrivKey{priv1, priv2, priv3}, []uint64{0, 1, 2}, []uint64{0, 0, 0}, false, false}, {"no err on recheck", []cryptotypes.PrivKey{}, []uint64{}, []uint64{}, true, false}, } for i, tc := range testCases { @@ -302,6 +303,7 @@ func (suite *AnteTestSuite) runSigDecorators(params types.Params, _ bool, privs for i, priv := range privs { addr := sdk.BytesToAccAddress(priv.PubKey().Address()) acc := suite.app.AccountKeeper.NewAccountWithAddress(suite.ctx, addr) + suite.Require().NoError(acc.SetAccountNumber(uint64(i))) suite.app.AccountKeeper.SetAccount(suite.ctx, acc) msgs[i] = testdata.NewTestMsg(addr) accNums[i] = uint64(i) @@ -336,19 +338,20 @@ func (suite *AnteTestSuite) TestIncrementSequenceDecorator() { priv, _, addr := testdata.KeyTestPubAddr() acc := suite.app.AccountKeeper.NewAccountWithAddress(suite.ctx, addr) + suite.Require().NoError(acc.SetAccountNumber(uint64(50))) suite.app.AccountKeeper.SetAccount(suite.ctx, acc) msgs := []sdk.Msg{testdata.NewTestMsg(addr)} suite.Require().NoError(suite.txBuilder.SetMsgs(msgs...)) privs := []cryptotypes.PrivKey{priv} - sbh := []uint64{1} + accNums := []uint64{suite.app.AccountKeeper.GetAccount(suite.ctx, addr).GetAccountNumber()} accSeqs := []uint64{suite.app.AccountKeeper.GetAccount(suite.ctx, addr).GetSequence()} feeAmount := testdata.NewTestFeeAmount() gasLimit := testdata.NewTestGasLimit() suite.txBuilder.SetFeeAmount(feeAmount) suite.txBuilder.SetGasLimit(gasLimit) - tx, err := suite.CreateTestTx(privs, sbh, accSeqs, suite.ctx.ChainID()) + tx, err := suite.CreateTestTx(privs, accNums, accSeqs, suite.ctx.ChainID()) suite.Require().NoError(err) isd := ante.NewIncrementSequenceDecorator(suite.app.AccountKeeper, suite.app.BankKeeper) diff --git a/x/auth/ante/testutil_test.go b/x/auth/ante/testutil_test.go index 951f881164..99626ccc8f 100644 --- a/x/auth/ante/testutil_test.go +++ b/x/auth/ante/testutil_test.go @@ -73,6 +73,8 @@ func (suite *AnteTestSuite) CreateTestAccounts(numAccs int) []TestAccount { for i := 0; i < numAccs; i++ { priv, _, addr := testdata.KeyTestPubAddr() acc := suite.app.AccountKeeper.NewAccountWithAddress(suite.ctx, addr) + err := acc.SetAccountNumber(uint64(i)) + suite.Require().NoError(err) suite.app.AccountKeeper.SetAccount(suite.ctx, acc) suite.app.BankKeeper.SetBalances(suite.ctx, addr, sdk.Coins{ sdk.NewInt64Coin("atom", 10000000), @@ -85,12 +87,11 @@ func (suite *AnteTestSuite) CreateTestAccounts(numAccs int) []TestAccount { } // CreateTestTx is a helper function to create a tx given multiple inputs. -func (suite *AnteTestSuite) CreateTestTx(privs []cryptotypes.PrivKey, sbh []uint64, accSeqs []uint64, chainID string) (xauthsigning.Tx, error) { +func (suite *AnteTestSuite) CreateTestTx(privs []cryptotypes.PrivKey, accNums []uint64, accSeqs []uint64, chainID string) (xauthsigning.Tx, error) { // 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 { - suite.txBuilder.SetSigBlockHeight(sbh[i]) sigV2 := signing.SignatureV2{ PubKey: priv.PubKey(), Data: &signing.SingleSignatureData{ @@ -111,8 +112,9 @@ func (suite *AnteTestSuite) CreateTestTx(privs []cryptotypes.PrivKey, sbh []uint sigsV2 = []signing.SignatureV2{} for i, priv := range privs { signerData := xauthsigning.SignerData{ - ChainID: chainID, - Sequence: accSeqs[i], + ChainID: chainID, + AccountNumber: accNums[i], + Sequence: accSeqs[i], } sigV2, err := tx.SignWithPrivKey( suite.clientCtx.TxConfig.SignModeHandler().DefaultMode(), signerData, @@ -141,7 +143,7 @@ type TestCase struct { } // CreateTestTx is a helper function to create a tx given multiple inputs. -func (suite *AnteTestSuite) RunTestCase(privs []cryptotypes.PrivKey, msgs []sdk.Msg, feeAmount sdk.Coins, gasLimit uint64, sbh, accSeqs []uint64, chainID string, tc TestCase) { +func (suite *AnteTestSuite) RunTestCase(privs []cryptotypes.PrivKey, msgs []sdk.Msg, feeAmount sdk.Coins, gasLimit uint64, accNums, accSeqs []uint64, chainID string, tc TestCase) { suite.Run(fmt.Sprintf("Case %s", tc.desc), func() { suite.Require().NoError(suite.txBuilder.SetMsgs(msgs...)) suite.txBuilder.SetFeeAmount(feeAmount) @@ -150,7 +152,7 @@ func (suite *AnteTestSuite) RunTestCase(privs []cryptotypes.PrivKey, msgs []sdk. // Theoretically speaking, ante handler unit tests should only test // ante handlers, but here we sometimes also test the tx creation // process. - tx, txErr := suite.CreateTestTx(privs, sbh, accSeqs, chainID) + tx, txErr := suite.CreateTestTx(privs, accNums, accSeqs, chainID) newCtx, anteErr := suite.anteHandler(suite.ctx, tx, tc.simulate) if tc.expPass { diff --git a/x/auth/client/cli/cli_test.go b/x/auth/client/cli/cli_test.go index 78f1666291..598a1c100a 100644 --- a/x/auth/client/cli/cli_test.go +++ b/x/auth/client/cli/cli_test.go @@ -127,7 +127,7 @@ func (s *IntegrationTestSuite) TestCLISignBatch() { // sign-batch file - offline is set but account-number and sequence are not res, err := authtest.TxSignBatchExec(val.ClientCtx, val.Address, outputFile.Name(), fmt.Sprintf("--%s=%s", flags.FlagChainID, val.ClientCtx.ChainID), "--offline") - s.Require().EqualError(err, "required flag(s) \"sequence\" not set") + s.Require().EqualError(err, "required flag(s) \"account-number\", \"sequence\" not set") // sign-batch file res, err = authtest.TxSignBatchExec(val.ClientCtx, val.Address, outputFile.Name(), fmt.Sprintf("--%s=%s", flags.FlagChainID, val.ClientCtx.ChainID)) @@ -555,11 +555,11 @@ func (s *IntegrationTestSuite) TestCLISendGenerateSignAndBroadcast() { // Does not work in offline mode res, err = authtest.TxSignExec(val1.ClientCtx, val1.Address, unsignedTxFile.Name(), "--offline") - s.Require().EqualError(err, "required flag(s) \"sequence\" not set") + s.Require().EqualError(err, "required flag(s) \"account-number\", \"sequence\" not set") - // But works offline if we set sequence + // But works offline if we set account number and sequence val1.ClientCtx.HomeDir = strings.Replace(val1.ClientCtx.HomeDir, "simd", "simcli", 1) - res, err = authtest.TxSignExec(val1.ClientCtx, val1.Address, unsignedTxFile.Name(), "--offline", "--sequence", "1", "--sig-block-height", "1") + res, err = authtest.TxSignExec(val1.ClientCtx, val1.Address, unsignedTxFile.Name(), "--offline", "--account-number", "1", "--sequence", "1") s.Require().NoError(err) // Sign transaction @@ -878,9 +878,9 @@ func (s *IntegrationTestSuite) TestCLIMultisign() { sign2File := testutil.WriteToNewTempFile(s.T(), account2Signature.String()) - // Offline mode requires --sequence flag + // Does not work in offline mode. _, err = authtest.TxMultiSignExec(val1.ClientCtx, multisigInfo.GetName(), multiGeneratedTxFile.Name(), "--offline", sign1File.Name(), sign2File.Name()) - s.Require().EqualError(err, "required flag(s) \"sequence\" not set") + s.Require().EqualError(err, "couldn't verify signature: unable to verify single signer signature") val1.ClientCtx.Offline = false multiSigWith2Signatures, err := authtest.TxMultiSignExec(val1.ClientCtx, multisigInfo.GetName(), multiGeneratedTxFile.Name(), sign1File.Name(), sign2File.Name()) @@ -1009,14 +1009,14 @@ func (s *IntegrationTestSuite) TestMultisignBatch() { s.Require().NoError(val.ClientCtx.JSONMarshaler.UnmarshalInterfaceJSON(queryResJSON.Bytes(), &account)) // sign-batch file - res, err := authtest.TxSignBatchExec(val.ClientCtx, account1.GetAddress(), filename.Name(), fmt.Sprintf("--%s=%s", flags.FlagChainID, val.ClientCtx.ChainID), "--multisig", multisigInfo.GetAddress().String(), fmt.Sprintf("--%s", flags.FlagOffline), fmt.Sprintf("--%s=%s", flags.FlagSequence, fmt.Sprint(account.GetSequence()))) + res, err := authtest.TxSignBatchExec(val.ClientCtx, account1.GetAddress(), filename.Name(), fmt.Sprintf("--%s=%s", flags.FlagChainID, val.ClientCtx.ChainID), "--multisig", multisigInfo.GetAddress().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()))) 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()) // sign-batch file with account2 - res, err = authtest.TxSignBatchExec(val.ClientCtx, account2.GetAddress(), filename.Name(), fmt.Sprintf("--%s=%s", flags.FlagChainID, val.ClientCtx.ChainID), "--multisig", multisigInfo.GetAddress().String(), fmt.Sprintf("--%s", flags.FlagOffline), fmt.Sprintf("--%s=%s", flags.FlagSequence, fmt.Sprint(account.GetSequence()))) + res, err = authtest.TxSignBatchExec(val.ClientCtx, account2.GetAddress(), filename.Name(), fmt.Sprintf("--%s=%s", flags.FlagChainID, val.ClientCtx.ChainID), "--multisig", multisigInfo.GetAddress().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()))) s.Require().NoError(err) s.Require().Equal(3, len(strings.Split(strings.Trim(res.String(), "\n"), "\n"))) @@ -1252,11 +1252,11 @@ func (s *IntegrationTestSuite) TestSignWithMultiSigners_AminoJSON() { signedByVal0File := testutil.WriteToNewTempFile(s.T(), signedByVal0.String()) // Then let val1 sign the file with signedByVal0. - val1Seq, err := val0.ClientCtx.AccountRetriever.GetAccountSequence(val0.ClientCtx, val1.Address) + val1AccNum, val1Seq, err := val0.ClientCtx.AccountRetriever.GetAccountNumberSequence(val0.ClientCtx, val1.Address) require.NoError(err) signedTx, err := authtest.TxSignExec( val1.ClientCtx, val1.Address, signedByVal0File.Name(), - "--offline", fmt.Sprintf("--sequence=%d", val1Seq), "--sign-mode=amino-json", + "--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()) diff --git a/x/auth/client/cli/tx_multisign.go b/x/auth/client/cli/tx_multisign.go index d8cb504c6d..b9f3263bbf 100644 --- a/x/auth/client/cli/tx_multisign.go +++ b/x/auth/client/cli/tx_multisign.go @@ -50,9 +50,8 @@ The SIGN_MODE_DIRECT sign mode is not supported.' version.AppName, ), ), - PreRun: preMultisignCmd, - RunE: makeMultiSignCmd(), - Args: cobra.MinimumNArgs(3), + RunE: makeMultiSignCmd(), + Args: cobra.MinimumNArgs(3), } cmd.Flags().Bool(flagSigOnly, false, "Print only the generated signature, then exit") @@ -64,13 +63,6 @@ The SIGN_MODE_DIRECT sign mode is not supported.' return cmd } -func preMultisignCmd(cmd *cobra.Command, _ []string) { - // Conditionally mark the account sequence required as no RPC query will be done. - if offline, _ := cmd.Flags().GetBool(flags.FlagOffline); offline { - cmd.MarkFlagRequired(flags.FlagSequence) - } -} - func makeMultiSignCmd() func(cmd *cobra.Command, args []string) (err error) { return func(cmd *cobra.Command, args []string) (err error) { clientCtx, err := client.GetClientTxContext(cmd) @@ -101,12 +93,12 @@ func makeMultiSignCmd() func(cmd *cobra.Command, args []string) (err error) { multisigPub := multisigInfo.GetPubKey().(*kmultisig.LegacyAminoPubKey) multisigSig := multisig.NewMultisig(len(multisigPub.PubKeys)) if !clientCtx.Offline { - seq, err := clientCtx.AccountRetriever.GetAccountSequence(clientCtx, multisigInfo.GetAddress()) + accnum, seq, err := clientCtx.AccountRetriever.GetAccountNumberSequence(clientCtx, multisigInfo.GetAddress()) if err != nil { return err } - txFactory = txFactory.WithSigBlockHeight(uint64(clientCtx.Height)).WithSequence(seq) + txFactory = txFactory.WithAccountNumber(accnum).WithSequence(seq) } // read each signature and add it to the multisig if valid @@ -121,8 +113,9 @@ func makeMultiSignCmd() func(cmd *cobra.Command, args []string) (err error) { } signingData := signing.SignerData{ - ChainID: txFactory.ChainID(), - Sequence: txFactory.Sequence(), + ChainID: txFactory.ChainID(), + AccountNumber: txFactory.AccountNumber(), + Sequence: txFactory.Sequence(), } for _, sig := range sigs { @@ -279,12 +272,12 @@ func makeBatchMultisignCmd() func(cmd *cobra.Command, args []string) error { } if !clientCtx.Offline { - seq, err := clientCtx.AccountRetriever.GetAccountSequence(clientCtx, multisigInfo.GetAddress()) + accnum, seq, err := clientCtx.AccountRetriever.GetAccountNumberSequence(clientCtx, multisigInfo.GetAddress()) if err != nil { return err } - txFactory = txFactory.WithSequence(seq) + txFactory = txFactory.WithAccountNumber(accnum).WithSequence(seq) } // prepare output document @@ -305,8 +298,9 @@ func makeBatchMultisignCmd() func(cmd *cobra.Command, args []string) error { multisigPub := multisigInfo.GetPubKey().(*kmultisig.LegacyAminoPubKey) multisigSig := multisig.NewMultisig(len(multisigPub.PubKeys)) signingData := signing.SignerData{ - ChainID: txFactory.ChainID(), - Sequence: txFactory.Sequence(), + ChainID: txFactory.ChainID(), + AccountNumber: txFactory.AccountNumber(), + Sequence: txFactory.Sequence(), } for _, sig := range signatureBatch { diff --git a/x/auth/client/cli/tx_sign.go b/x/auth/client/cli/tx_sign.go index c274fe9619..79fd2bbc4c 100644 --- a/x/auth/client/cli/tx_sign.go +++ b/x/auth/client/cli/tx_sign.go @@ -188,8 +188,10 @@ be generated via the 'multisign' command. } func preSignCmd(cmd *cobra.Command, _ []string) { - // Conditionally mark the account sequence required as no RPC query will be done. + // Conditionally mark the account and sequence numbers required as no RPC + // query will be done. if offline, _ := cmd.Flags().GetBool(flags.FlagOffline); offline { + cmd.MarkFlagRequired(flags.FlagAccountNumber) cmd.MarkFlagRequired(flags.FlagSequence) } } diff --git a/x/auth/client/cli/validate_sigs.go b/x/auth/client/cli/validate_sigs.go index 6d19057b99..673b60f330 100644 --- a/x/auth/client/cli/validate_sigs.go +++ b/x/auth/client/cli/validate_sigs.go @@ -99,15 +99,16 @@ func printAndValidateSigs( // Validate the actual signature over the transaction bytes since we can // reach out to a full node to query accounts. if !offline && success { - accSeq, err := clientCtx.AccountRetriever.GetAccountSequence(clientCtx, sigAddr) + accNum, accSeq, err := clientCtx.AccountRetriever.GetAccountNumberSequence(clientCtx, sigAddr) if err != nil { cmd.Printf("failed to get account: %s\n", sigAddr) return false } signingData := authsigning.SignerData{ - ChainID: chainID, - Sequence: accSeq, + ChainID: chainID, + AccountNumber: accNum, + Sequence: accSeq, } err = authsigning.VerifySignature(pubKey, signingData, sig.Data, signModeHandler, sigTx) if err != nil { diff --git a/x/auth/client/rest/rest_test.go b/x/auth/client/rest/rest_test.go index 34aad519b4..3ce4f8eb07 100644 --- a/x/auth/client/rest/rest_test.go +++ b/x/auth/client/rest/rest_test.go @@ -366,7 +366,7 @@ func (s *IntegrationTestSuite) TestMultipleSyncBroadcastTxRequests() { } } -func (s *IntegrationTestSuite) createTestStdTx(val *network.Validator, sbh, sequence uint64) legacytx.StdTx { +func (s *IntegrationTestSuite) createTestStdTx(val *network.Validator, accNum, sequence uint64) legacytx.StdTx { txConfig := legacytx.StdTxConfig{Cdc: s.cfg.LegacyAmino} msg := &types.MsgSend{ @@ -390,7 +390,7 @@ func (s *IntegrationTestSuite) createTestStdTx(val *network.Validator, sbh, sequ WithKeybase(val.ClientCtx.Keyring). WithTxConfig(txConfig). WithSignMode(signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON). - WithSigBlockHeight(sbh). + WithAccountNumber(accNum). WithSequence(sequence) // sign Tx (offline mode so we can manually set sequence number) @@ -617,9 +617,9 @@ func (s *IntegrationTestSuite) TestLegacyMultisig() { sign2File := testutil.WriteToNewTempFile(s.T(), account2Signature.String()) - // Offline mode requires --sequence flag. + // Does not work in offline mode. _, err = authtest.TxMultiSignExec(val1.ClientCtx, multisigInfo.GetName(), multiGeneratedTxFile.Name(), "--offline", sign1File.Name(), sign2File.Name()) - s.Require().EqualError(err, fmt.Sprintf("required flag(s) \"sequence\" not set")) + s.Require().EqualError(err, fmt.Sprintf("couldn't verify signature: unable to verify single signer signature")) val1.ClientCtx.Offline = false multiSigWith2Signatures, err := authtest.TxMultiSignExec(val1.ClientCtx, multisigInfo.GetName(), multiGeneratedTxFile.Name(), sign1File.Name(), sign2File.Name()) diff --git a/x/auth/client/tx.go b/x/auth/client/tx.go index 20da15a89a..8e218b7f07 100644 --- a/x/auth/client/tx.go +++ b/x/auth/client/tx.go @@ -158,12 +158,12 @@ func populateAccountFromState( txBldr tx.Factory, clientCtx client.Context, addr sdk.AccAddress, ) (tx.Factory, error) { - seq, err := clientCtx.AccountRetriever.GetAccountSequence(clientCtx, addr) + num, seq, err := clientCtx.AccountRetriever.GetAccountNumberSequence(clientCtx, addr) if err != nil { return txBldr, err } - return txBldr.WithSequence(seq), nil + return txBldr.WithAccountNumber(num).WithSequence(seq), nil } // GetTxEncoder return tx encoder from global sdk configuration if ones is defined. diff --git a/x/auth/client/tx_test.go b/x/auth/client/tx_test.go index da5ce849bb..e496c70d41 100644 --- a/x/auth/client/tx_test.go +++ b/x/auth/client/tx_test.go @@ -139,7 +139,7 @@ func TestBatchScanner_Scan(t *testing.T) { func compareEncoders(t *testing.T, expected sdk.TxEncoder, actual sdk.TxEncoder) { msgs := []sdk.Msg{testdata.NewTestMsg(addr)} - tx := legacytx.NewStdTx(msgs, legacytx.StdFee{}, []legacytx.StdSignature{}, 0, "") + tx := legacytx.NewStdTx(msgs, legacytx.StdFee{}, []legacytx.StdSignature{}, "") defaultEncoderBytes, err := expected(tx) require.NoError(t, err) diff --git a/x/auth/genesis.go b/x/auth/genesis.go index aad3b1e22b..a8e2e24845 100644 --- a/x/auth/genesis.go +++ b/x/auth/genesis.go @@ -20,7 +20,8 @@ func InitGenesis(ctx sdk.Context, ak keeper.AccountKeeper, data types.GenesisSta accounts = types.SanitizeGenesisAccounts(accounts) for _, a := range accounts { - ak.SetAccount(ctx, a) + acc := ak.NewAccount(ctx, a) + ak.SetAccount(ctx, acc) } ak.GetModuleAccount(ctx, types.FeeCollectorName) diff --git a/x/auth/keeper/account.go b/x/auth/keeper/account.go index ccbfc31a5b..427112be82 100644 --- a/x/auth/keeper/account.go +++ b/x/auth/keeper/account.go @@ -13,6 +13,15 @@ func (ak AccountKeeper) NewAccountWithAddress(ctx sdk.Context, addr sdk.AccAddre panic(err) } + return ak.NewAccount(ctx, acc) +} + +// NewAccount sets the next account number to a given account interface +func (ak AccountKeeper) NewAccount(ctx sdk.Context, acc types.AccountI) types.AccountI { + if err := acc.SetAccountNumber(ak.GetNextAccountNumber(ctx)); err != nil { + panic(err) + } + return acc } diff --git a/x/auth/keeper/keeper.go b/x/auth/keeper/keeper.go index 5f1e26f21b..b6de88e597 100644 --- a/x/auth/keeper/keeper.go +++ b/x/auth/keeper/keeper.go @@ -3,6 +3,7 @@ package keeper import ( "fmt" + gogotypes "github.com/gogo/protobuf/types" "github.com/line/ostracon/libs/log" "github.com/line/lbm-sdk/codec" @@ -15,9 +16,12 @@ import ( // AccountKeeperI is the interface contract that x/auth's keeper implements. type AccountKeeperI interface { - // Return a new account with the specified address. Does not save the new account to the store. + // Return a new account with the next account number and the specified address. Does not save the new account to the store. NewAccountWithAddress(sdk.Context, sdk.AccAddress) types.AccountI + // Return a new account with the next account number. Does not save the new account to the store. + NewAccount(sdk.Context, types.AccountI) types.AccountI + // Retrieve an account from the store. GetAccount(sdk.Context, sdk.AccAddress) types.AccountI @@ -38,6 +42,8 @@ type AccountKeeperI interface { // Prefetch an account, i.e. pre-fetch Prefetch(sdk.Context, sdk.AccAddress, bool) + // Fetch the next account number, and increment the internal counter. + GetNextAccountNumber(sdk.Context) uint64 } // AccountKeeper encodes/decodes accounts using the go-amino (binary) @@ -105,6 +111,33 @@ func (ak AccountKeeper) GetSequence(ctx sdk.Context, addr sdk.AccAddress) (uint6 return acc.GetSequence(), nil } +// GetNextAccountNumber returns and increments the global account number counter. +// If the global account number is not set, it initializes it with value 0. +func (ak AccountKeeper) GetNextAccountNumber(ctx sdk.Context) uint64 { + var accNumber uint64 + store := ctx.KVStore(ak.key) + + bz := store.Get(types.GlobalAccountNumberKey) + if bz == nil { + // initialize the account numbers + accNumber = 0 + } else { + val := gogotypes.UInt64Value{} + + err := ak.cdc.UnmarshalBinaryBare(bz, &val) + if err != nil { + panic(err) + } + + accNumber = val.GetValue() + } + + bz = ak.cdc.MustMarshalBinaryBare(&gogotypes.UInt64Value{Value: accNumber + 1}) + store.Set(types.GlobalAccountNumberKey, bz) + + return accNumber +} + // ValidatePermissions validates that the module account has been granted // permissions within its set of allowed permissions. func (ak AccountKeeper) ValidatePermissions(macc types.ModuleAccountI) error { @@ -157,9 +190,10 @@ func (ak AccountKeeper) GetModuleAccountAndPermissions(ctx sdk.Context, moduleNa // create a new module account macc := types.NewEmptyModuleAccount(moduleName, perms...) - ak.SetModuleAccount(ctx, macc) + maccI := (ak.NewAccount(ctx, macc)).(types.ModuleAccountI) // set the account number + ak.SetModuleAccount(ctx, maccI) - return macc, perms + return maccI, perms } // GetModuleAccount gets the module account from the auth account store, if the account does not diff --git a/x/auth/legacy/legacytx/amino_signing.go b/x/auth/legacy/legacytx/amino_signing.go index d9611d5780..2221dba791 100644 --- a/x/auth/legacy/legacytx/amino_signing.go +++ b/x/auth/legacy/legacytx/amino_signing.go @@ -43,7 +43,7 @@ func (stdTxSignModeHandler) GetSignBytes(mode signingtypes.SignMode, data signin } return StdSignBytes( - data.ChainID, stdTx.GetSigBlockHeight(), data.Sequence, stdTx.GetTimeoutHeight(), StdFee{Amount: stdTx.GetFee(), Gas: stdTx.GetGas()}, tx.GetMsgs(), stdTx.GetMemo(), + data.ChainID, data.AccountNumber, data.Sequence, stdTx.GetTimeoutHeight(), StdFee{Amount: stdTx.GetFee(), Gas: stdTx.GetGas()}, tx.GetMsgs(), stdTx.GetMemo(), ), nil } diff --git a/x/auth/legacy/legacytx/amino_signing_test.go b/x/auth/legacy/legacytx/amino_signing_test.go index a2edbdc5ea..d998135f1f 100644 --- a/x/auth/legacy/legacytx/amino_signing_test.go +++ b/x/auth/legacy/legacytx/amino_signing_test.go @@ -31,29 +31,29 @@ func TestLegacyAminoJSONHandler_GetSignBytes(t *testing.T) { var ( chainId = "test-chain" - sbh uint64 = 7 + accNum uint64 = 7 seqNum uint64 = 7 timeoutHeight uint64 = 10 ) tx := StdTx{ - Msgs: msgs, - Fee: fee, - Signatures: nil, - Memo: memo, - SigBlockHeight: sbh, - TimeoutHeight: timeoutHeight, + Msgs: msgs, + Fee: fee, + Signatures: nil, + Memo: memo, + TimeoutHeight: timeoutHeight, } handler := stdTxSignModeHandler{} signingData := signing.SignerData{ - ChainID: chainId, - Sequence: seqNum, + ChainID: chainId, + AccountNumber: accNum, + Sequence: seqNum, } signBz, err := handler.GetSignBytes(signingtypes.SignMode_SIGN_MODE_LEGACY_AMINO_JSON, signingData, tx) require.NoError(t, err) - expectedSignBz := StdSignBytes(chainId, sbh, seqNum, timeoutHeight, fee, msgs, memo) + expectedSignBz := StdSignBytes(chainId, accNum, seqNum, timeoutHeight, fee, msgs, memo) require.Equal(t, expectedSignBz, signBz) diff --git a/x/auth/legacy/legacytx/stdsign.go b/x/auth/legacy/legacytx/stdsign.go index 052e2f6fb3..75ecc34397 100644 --- a/x/auth/legacy/legacytx/stdsign.go +++ b/x/auth/legacy/legacytx/stdsign.go @@ -36,30 +36,30 @@ type LegacyMsg interface { // and the Sequence numbers for each signature (prevent // inchain replay and enforce tx ordering per account). type StdSignDoc struct { - SigBlockHeight uint64 `json:"sig_block_height" yaml:"sig_block_height"` - Sequence uint64 `json:"sequence" yaml:"sequence"` - TimeoutHeight uint64 `json:"timeout_height,omitempty" yaml:"timeout_height"` - ChainID string `json:"chain_id" yaml:"chain_id"` - Memo string `json:"memo" yaml:"memo"` - Fee json.RawMessage `json:"fee" yaml:"fee"` - Msgs []json.RawMessage `json:"msgs" yaml:"msgs"` + AccountNumber uint64 `json:"account_number" yaml:"account_number"` + Sequence uint64 `json:"sequence" yaml:"sequence"` + TimeoutHeight uint64 `json:"timeout_height,omitempty" yaml:"timeout_height"` + ChainID string `json:"chain_id" yaml:"chain_id"` + Memo string `json:"memo" yaml:"memo"` + Fee json.RawMessage `json:"fee" yaml:"fee"` + Msgs []json.RawMessage `json:"msgs" yaml:"msgs"` } // StdSignBytes returns the bytes to sign for a transaction. -func StdSignBytes(chainID string, sbh, sequence, timeout uint64, fee StdFee, msgs []sdk.Msg, memo string) []byte { +func StdSignBytes(chainID string, accnum, sequence, timeout uint64, fee StdFee, msgs []sdk.Msg, memo string) []byte { msgsBytes := make([]json.RawMessage, 0, len(msgs)) for _, msg := range msgs { msgsBytes = append(msgsBytes, json.RawMessage(msg.GetSignBytes())) } bz, err := legacy.Cdc.MarshalJSON(StdSignDoc{ - SigBlockHeight: sbh, - ChainID: chainID, - Fee: json.RawMessage(fee.Bytes()), - Memo: memo, - Msgs: msgsBytes, - Sequence: sequence, - TimeoutHeight: timeout, + AccountNumber: accnum, + ChainID: chainID, + Fee: json.RawMessage(fee.Bytes()), + Memo: memo, + Msgs: msgsBytes, + Sequence: sequence, + TimeoutHeight: timeout, }) if err != nil { panic(err) diff --git a/x/auth/legacy/legacytx/stdsignmsg.go b/x/auth/legacy/legacytx/stdsignmsg.go index f496978194..606564b65a 100644 --- a/x/auth/legacy/legacytx/stdsignmsg.go +++ b/x/auth/legacy/legacytx/stdsignmsg.go @@ -10,18 +10,18 @@ var _ types.UnpackInterfacesMessage = StdSignMsg{} // StdSignMsg is a convenience structure for passing along a Msg with the other // requirements for a StdSignDoc before it is signed. For use in the CLI. type StdSignMsg struct { - ChainID string `json:"chain_id" yaml:"chain_id"` - SigBlockHeight uint64 `json:"sign_block_height" yaml:"sign_block_height"` - Sequence uint64 `json:"sequence" yaml:"sequence"` - TimeoutHeight uint64 `json:"timeout_height" yaml:"timeout_height"` - Fee StdFee `json:"fee" yaml:"fee"` - Msgs []sdk.Msg `json:"msgs" yaml:"msgs"` - Memo string `json:"memo" yaml:"memo"` + ChainID string `json:"chain_id" yaml:"chain_id"` + AccountNumber uint64 `json:"account_number" yaml:"account_number"` + Sequence uint64 `json:"sequence" yaml:"sequence"` + TimeoutHeight uint64 `json:"timeout_height" yaml:"timeout_height"` + Fee StdFee `json:"fee" yaml:"fee"` + Msgs []sdk.Msg `json:"msgs" yaml:"msgs"` + Memo string `json:"memo" yaml:"memo"` } // get message bytes func (msg StdSignMsg) Bytes() []byte { - return StdSignBytes(msg.ChainID, msg.SigBlockHeight, msg.Sequence, msg.TimeoutHeight, msg.Fee, msg.Msgs, msg.Memo) + return StdSignBytes(msg.ChainID, msg.AccountNumber, msg.Sequence, msg.TimeoutHeight, msg.Fee, msg.Msgs, msg.Memo) } func (msg StdSignMsg) UnpackInterfaces(unpacker types.AnyUnpacker) error { diff --git a/x/auth/legacy/legacytx/stdtx.go b/x/auth/legacy/legacytx/stdtx.go index fd706f0c9b..45a88e1b9a 100644 --- a/x/auth/legacy/legacytx/stdtx.go +++ b/x/auth/legacy/legacytx/stdtx.go @@ -128,22 +128,20 @@ func (ss StdSignature) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { // NOTE: the first signature is the fee payer (Signatures must not be nil). // Deprecated type StdTx struct { - Msgs []sdk.Msg `json:"msg" yaml:"msg"` - Fee StdFee `json:"fee" yaml:"fee"` - Signatures []StdSignature `json:"signatures" yaml:"signatures"` - SigBlockHeight uint64 `json:"sig_block_height"` - Memo string `json:"memo" yaml:"memo"` - TimeoutHeight uint64 `json:"timeout_height" yaml:"timeout_height"` + Msgs []sdk.Msg `json:"msg" yaml:"msg"` + Fee StdFee `json:"fee" yaml:"fee"` + Signatures []StdSignature `json:"signatures" yaml:"signatures"` + Memo string `json:"memo" yaml:"memo"` + TimeoutHeight uint64 `json:"timeout_height" yaml:"timeout_height"` } // Deprecated -func NewStdTx(msgs []sdk.Msg, fee StdFee, sigs []StdSignature, sbh uint64, memo string) StdTx { +func NewStdTx(msgs []sdk.Msg, fee StdFee, sigs []StdSignature, memo string) StdTx { return StdTx{ - Msgs: msgs, - Fee: fee, - Signatures: sigs, - SigBlockHeight: sbh, - Memo: memo, + Msgs: msgs, + Fee: fee, + Signatures: sigs, + Memo: memo, } } @@ -258,8 +256,6 @@ func (tx StdTx) GetPubKeys() []cryptotypes.PubKey { return pks } -func (tx StdTx) GetSigBlockHeight() uint64 { return tx.SigBlockHeight } - // GetGas returns the Gas in StdFee func (tx StdTx) GetGas() uint64 { return tx.Fee.Gas } diff --git a/x/auth/legacy/legacytx/stdtx_builder.go b/x/auth/legacy/legacytx/stdtx_builder.go index 09f8e73231..78cf30e448 100644 --- a/x/auth/legacy/legacytx/stdtx_builder.go +++ b/x/auth/legacy/legacytx/stdtx_builder.go @@ -79,10 +79,6 @@ func (s *StdTxBuilder) SetMemo(memo string) { s.Memo = memo } -func (s *StdTxBuilder) SetSigBlockHeight(sbh uint64) { - s.SigBlockHeight = sbh -} - // SetTimeoutHeight sets the transaction's height timeout. func (s *StdTxBuilder) SetTimeoutHeight(height uint64) { s.TimeoutHeight = height diff --git a/x/auth/legacy/legacytx/stdtx_test.go b/x/auth/legacy/legacytx/stdtx_test.go index 195946b2d3..5723269d99 100644 --- a/x/auth/legacy/legacytx/stdtx_test.go +++ b/x/auth/legacy/legacytx/stdtx_test.go @@ -39,10 +39,10 @@ func NewTestStdFee() StdFee { } // Deprecated, use TxBuilder. -func NewTestTx(ctx sdk.Context, msgs []sdk.Msg, privs []cryptotypes.PrivKey, sbh []uint64, seqs []uint64, timeout uint64, fee StdFee) sdk.Tx { +func NewTestTx(ctx sdk.Context, msgs []sdk.Msg, privs []cryptotypes.PrivKey, accNums []uint64, seqs []uint64, timeout uint64, fee StdFee) sdk.Tx { sigs := make([]StdSignature, len(privs)) for i, priv := range privs { - signBytes := StdSignBytes(ctx.ChainID(), sbh[i], seqs[i], timeout, fee, msgs, "") + signBytes := StdSignBytes(ctx.ChainID(), accNums[i], seqs[i], timeout, fee, msgs, "") sig, err := priv.Sign(signBytes) if err != nil { @@ -52,7 +52,7 @@ func NewTestTx(ctx sdk.Context, msgs []sdk.Msg, privs []cryptotypes.PrivKey, sbh sigs[i] = StdSignature{PubKey: priv.PubKey(), Signature: sig} } - tx := NewStdTx(msgs, fee, sigs, 0, "") + tx := NewStdTx(msgs, fee, sigs, "") return tx } @@ -61,7 +61,7 @@ func TestStdTx(t *testing.T) { fee := NewTestStdFee() sigs := []StdSignature{} - tx := NewStdTx(msgs, fee, sigs, 0, "") + tx := NewStdTx(msgs, fee, sigs, "") require.Equal(t, msgs, tx.GetMsgs()) require.Equal(t, sigs, tx.Signatures) @@ -89,11 +89,11 @@ func TestStdSignBytes(t *testing.T) { }{ { args{"1234", 3, 6, 10, defaultFee, []sdk.Msg{testdata.NewTestMsg(addr)}, "memo"}, - fmt.Sprintf("{\"chain_id\":\"1234\",\"fee\":{\"amount\":[{\"amount\":\"150\",\"denom\":\"atom\"}],\"gas\":\"100000\"},\"memo\":\"memo\",\"msgs\":[[\"%s\"]],\"sequence\":\"6\",\"sig_block_height\":\"3\",\"timeout_height\":\"10\"}", addr), + fmt.Sprintf("{\"account_number\":\"3\",\"chain_id\":\"1234\",\"fee\":{\"amount\":[{\"amount\":\"150\",\"denom\":\"atom\"}],\"gas\":\"100000\"},\"memo\":\"memo\",\"msgs\":[[\"%s\"]],\"sequence\":\"6\",\"timeout_height\":\"10\"}", addr), }, { args{"1234", 3, 6, 0, defaultFee, []sdk.Msg{testdata.NewTestMsg(addr)}, "memo"}, - fmt.Sprintf("{\"chain_id\":\"1234\",\"fee\":{\"amount\":[{\"amount\":\"150\",\"denom\":\"atom\"}],\"gas\":\"100000\"},\"memo\":\"memo\",\"msgs\":[[\"%s\"]],\"sequence\":\"6\",\"sig_block_height\":\"3\"}", addr), + fmt.Sprintf("{\"account_number\":\"3\",\"chain_id\":\"1234\",\"fee\":{\"amount\":[{\"amount\":\"150\",\"denom\":\"atom\"}],\"gas\":\"100000\"},\"memo\":\"memo\",\"msgs\":[[\"%s\"]],\"sequence\":\"6\"}", addr), }, } for i, tc := range tests { @@ -171,7 +171,7 @@ func TestDefaultTxEncoder(t *testing.T) { fee := NewTestStdFee() sigs := []StdSignature{} - tx := NewStdTx(msgs, fee, sigs, 0, "") + tx := NewStdTx(msgs, fee, sigs, "") cdcBytes, err := cdc.MarshalBinaryBare(tx) @@ -274,7 +274,7 @@ func TestGetSignaturesV2(t *testing.T) { fee := NewStdFee(50000, sdk.Coins{sdk.NewInt64Coin("atom", 150)}) sig := StdSignature{PubKey: pubKey, Signature: dummy} - stdTx := NewStdTx([]sdk.Msg{testdata.NewTestMsg()}, fee, []StdSignature{sig}, 0, "testsigs") + stdTx := NewStdTx([]sdk.Msg{testdata.NewTestMsg()}, fee, []StdSignature{sig}, "testsigs") sigs, err := stdTx.GetSignaturesV2() require.Nil(t, err) diff --git a/x/auth/module.go b/x/auth/module.go index 707c23e8d5..1c12ebae45 100644 --- a/x/auth/module.go +++ b/x/auth/module.go @@ -72,7 +72,7 @@ func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *r // GetTxCmd returns the root tx command for the auth module. func (AppModuleBasic) GetTxCmd() *cobra.Command { - return cli.NewTxCmd() + return nil } // GetQueryCmd returns the root query command for the auth module. diff --git a/x/auth/signing/handler_map_test.go b/x/auth/signing/handler_map_test.go index 3a5b1ebb8f..307d67187e 100644 --- a/x/auth/signing/handler_map_test.go +++ b/x/auth/signing/handler_map_test.go @@ -43,26 +43,26 @@ func TestHandlerMap_GetSignBytes(t *testing.T) { }, } + tx := legacytx.StdTx{ + Msgs: msgs, + Fee: fee, + Signatures: nil, + Memo: memo, + } + var ( chainId = "test-chain" - sbh uint64 = 7 + accNum uint64 = 7 seqNum uint64 = 7 ) - tx := legacytx.StdTx{ - Msgs: msgs, - Fee: fee, - Signatures: nil, - SigBlockHeight: sbh, - Memo: memo, - } - handler := MakeTestHandlerMap() aminoJSONHandler := legacytx.NewStdTxSignModeHandler() signingData := signing.SignerData{ - ChainID: chainId, - Sequence: seqNum, + ChainID: chainId, + AccountNumber: accNum, + Sequence: seqNum, } signBz, err := handler.GetSignBytes(signingtypes.SignMode_SIGN_MODE_LEGACY_AMINO_JSON, signingData, tx) require.NoError(t, err) diff --git a/x/auth/signing/sign_mode_handler.go b/x/auth/signing/sign_mode_handler.go index 09d3c12ff7..6e70c8c024 100644 --- a/x/auth/signing/sign_mode_handler.go +++ b/x/auth/signing/sign_mode_handler.go @@ -26,6 +26,9 @@ type SignerData struct { // ChainID is the chain that this transaction is targeted ChainID string + // AccountNumber is the account number of the signer + AccountNumber uint64 + // Sequence is the account sequence number of the signer that is used // for replay protection. This field is only useful for Legacy Amino signing, // since in SIGN_MODE_DIRECT the account sequence is already in the signer diff --git a/x/auth/signing/verify_test.go b/x/auth/signing/verify_test.go index 94111b01df..53f4964090 100644 --- a/x/auth/signing/verify_test.go +++ b/x/auth/signing/verify_test.go @@ -45,13 +45,13 @@ func TestVerifySignature(t *testing.T) { require.NoError(t, app.BankKeeper.SetBalances(ctx, addr, balances)) msgs := []sdk.Msg{testdata.NewTestMsg(addr)} - sbh := uint64(1) fee := legacytx.NewStdFee(50000, sdk.Coins{sdk.NewInt64Coin("atom", 150)}) signerData := signing.SignerData{ - ChainID: chainId, - Sequence: acc.GetSequence(), + ChainID: chainId, + AccountNumber: acc.GetAccountNumber(), + Sequence: acc.GetSequence(), } - signBytes := legacytx.StdSignBytes(signerData.ChainID, sbh, signerData.Sequence, 10, fee, msgs, memo) + signBytes := legacytx.StdSignBytes(signerData.ChainID, signerData.AccountNumber, signerData.Sequence, 10, fee, msgs, memo) signature, err := priv.Sign(signBytes) require.NoError(t, err) @@ -60,7 +60,7 @@ func TestVerifySignature(t *testing.T) { require.NoError(t, err) handler := MakeTestHandlerMap() - stdTx := legacytx.NewStdTx(msgs, fee, []legacytx.StdSignature{stdSig}, sbh, memo) + stdTx := legacytx.NewStdTx(msgs, fee, []legacytx.StdSignature{stdSig}, memo) stdTx.TimeoutHeight = 10 err = signing.VerifySignature(pubKey, signerData, sigV2.Data, handler, stdTx) require.NoError(t, err) @@ -69,7 +69,7 @@ func TestVerifySignature(t *testing.T) { multisigKey := kmultisig.NewLegacyAminoPubKey(2, pkSet) multisignature := multisig.NewMultisig(2) msgs = []sdk.Msg{testdata.NewTestMsg(addr, addr1)} - multiSignBytes := legacytx.StdSignBytes(signerData.ChainID, sbh, signerData.Sequence, 10, fee, msgs, memo) + multiSignBytes := legacytx.StdSignBytes(signerData.ChainID, signerData.AccountNumber, signerData.Sequence, 10, fee, msgs, memo) sig1, err := priv.Sign(multiSignBytes) require.NoError(t, err) @@ -88,7 +88,7 @@ func TestVerifySignature(t *testing.T) { err = multisig.AddSignatureFromPubKey(multisignature, sig2V2.Data, pkSet[1], pkSet) require.NoError(t, err) - stdTx = legacytx.NewStdTx(msgs, fee, []legacytx.StdSignature{stdSig1, stdSig2}, sbh, memo) + stdTx = legacytx.NewStdTx(msgs, fee, []legacytx.StdSignature{stdSig1, stdSig2}, memo) stdTx.TimeoutHeight = 10 err = signing.VerifySignature(multisigKey, signerData, multisignature, handler, stdTx) diff --git a/x/auth/simulation/decoder.go b/x/auth/simulation/decoder.go index f12743f385..89c3bc702b 100644 --- a/x/auth/simulation/decoder.go +++ b/x/auth/simulation/decoder.go @@ -4,6 +4,8 @@ import ( "bytes" "fmt" + gogotypes "github.com/gogo/protobuf/types" + "github.com/line/lbm-sdk/codec" "github.com/line/lbm-sdk/types/kv" "github.com/line/lbm-sdk/x/auth/types" @@ -32,6 +34,13 @@ func NewDecodeStore(ak AuthUnmarshaler) func(kvA, kvB kv.Pair) string { return fmt.Sprintf("%v\n%v", accA, accB) + case bytes.Equal(kvA.Key, types.GlobalAccountNumberKey): + var globalAccNumberA, globalAccNumberB gogotypes.UInt64Value + ak.GetCodec().MustUnmarshalBinaryBare(kvA.Value, &globalAccNumberA) + ak.GetCodec().MustUnmarshalBinaryBare(kvB.Value, &globalAccNumberB) + + return fmt.Sprintf("GlobalAccNumberA: %d\nGlobalAccNumberB: %d", globalAccNumberA, globalAccNumberB) + default: panic(fmt.Sprintf("unexpected %s key %X (%s)", types.ModuleName, kvA.Key, kvA.Key)) } diff --git a/x/auth/simulation/decoder_test.go b/x/auth/simulation/decoder_test.go index 8b9dca4fde..823fc0ffb9 100644 --- a/x/auth/simulation/decoder_test.go +++ b/x/auth/simulation/decoder_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + gogotypes "github.com/gogo/protobuf/types" "github.com/stretchr/testify/require" "github.com/line/lbm-sdk/crypto/keys/ed25519" @@ -21,18 +22,25 @@ var ( func TestDecodeStore(t *testing.T) { app := simapp.Setup(false) + cdc, _ := simapp.MakeCodecs() acc := types.NewBaseAccountWithAddress(delAddr1) dec := simulation.NewDecodeStore(app.AccountKeeper) accBz, err := app.AccountKeeper.MarshalAccount(acc) require.NoError(t, err) + globalAccNumber := gogotypes.UInt64Value{Value: 10} + kvPairs := kv.Pairs{ Pairs: []kv.Pair{ { Key: types.AddressStoreKey(delAddr1), Value: accBz, }, + { + Key: types.GlobalAccountNumberKey, + Value: cdc.MustMarshalBinaryBare(&globalAccNumber), + }, { Key: []byte{0x99}, Value: []byte{0x99}, @@ -44,6 +52,7 @@ func TestDecodeStore(t *testing.T) { expectedLog string }{ {"Account", fmt.Sprintf("%v\n%v", acc, acc)}, + {"GlobalAccNumber", fmt.Sprintf("GlobalAccNumberA: %d\nGlobalAccNumberB: %d", globalAccNumber, globalAccNumber)}, {"other", ""}, } diff --git a/x/auth/simulation/genesis.go b/x/auth/simulation/genesis.go index 18c50c557b..cf30fc9bb8 100644 --- a/x/auth/simulation/genesis.go +++ b/x/auth/simulation/genesis.go @@ -19,7 +19,6 @@ const ( TxSizeCostPerByte = "tx_size_cost_per_byte" SigVerifyCostED25519 = "sig_verify_cost_ed25519" SigVerifyCostSECP256K1 = "sig_verify_cost_secp256k1" - ValidSigBlockPeriod = "valid_sig_block_period" ) // RandomGenesisAccounts defines the default RandomGenesisAccountsFn used on the SDK. @@ -88,11 +87,6 @@ func GenSigVerifyCostSECP256K1(r *rand.Rand) uint64 { return uint64(simulation.RandIntBetween(r, 500, 1000)) } -func GenValidSigBlockPeriod(r *rand.Rand) uint64 { - // We use valid sig block period greater than 500 for testing (to include test-sim-multi-seed-long 500 blocks) - return uint64(simulation.RandIntBetween(r, 501, 10000)) -} - // RandomizedGenState generates a random GenesisState for auth func RandomizedGenState(simState *module.SimulationState, randGenAccountsFn types.RandomGenesisAccountsFn) { var maxMemoChars uint64 @@ -125,14 +119,8 @@ func RandomizedGenState(simState *module.SimulationState, randGenAccountsFn type func(r *rand.Rand) { sigVerifyCostSECP256K1 = GenSigVerifyCostSECP256K1(r) }, ) - var validSigBlockPeriod uint64 - simState.AppParams.GetOrGenerate( - simState.Cdc, ValidSigBlockPeriod, &validSigBlockPeriod, simState.Rand, - func(r *rand.Rand) { validSigBlockPeriod = GenValidSigBlockPeriod(r) }, - ) - params := types.NewParams(maxMemoChars, txSigLimit, txSizeCostPerByte, - sigVerifyCostED25519, sigVerifyCostSECP256K1, validSigBlockPeriod) + sigVerifyCostED25519, sigVerifyCostSECP256K1) genesisAccs := randGenAccountsFn(simState) authGenesis := types.NewGenesisState(params, genesisAccs) diff --git a/x/auth/simulation/genesis_test.go b/x/auth/simulation/genesis_test.go index 704021b349..9dca0d2e29 100644 --- a/x/auth/simulation/genesis_test.go +++ b/x/auth/simulation/genesis_test.go @@ -50,5 +50,6 @@ func TestRandomizedGenState(t *testing.T) { require.NoError(t, err) require.Len(t, genAccounts, 3) require.Equal(t, "link1ghekyjucln7y67ntx7cf27m9dpuxxemnqk82wt", genAccounts[2].GetAddress().String()) + require.Equal(t, uint64(0), genAccounts[2].GetAccountNumber()) require.Equal(t, uint64(0), genAccounts[2].GetSequence()) } diff --git a/x/auth/testutil/suite.go b/x/auth/testutil/suite.go index 0c46f6156c..03b4ad335a 100644 --- a/x/auth/testutil/suite.go +++ b/x/auth/testutil/suite.go @@ -128,8 +128,9 @@ func (s *TxConfigTestSuite) TestTxBuilderSetSignatures() { // sign transaction signerData := signing.SignerData{ - ChainID: "test", - Sequence: seq1, + ChainID: "test", + AccountNumber: 1, + Sequence: seq1, } signBytes, err := signModeHandler.GetSignBytes(signModeHandler.DefaultMode(), signerData, sigTx) s.Require().NoError(err) @@ -137,8 +138,9 @@ func (s *TxConfigTestSuite) TestTxBuilderSetSignatures() { s.Require().NoError(err) signerData = signing.SignerData{ - ChainID: "test", - Sequence: mseq, + ChainID: "test", + AccountNumber: 3, + Sequence: mseq, } mSignBytes, err := signModeHandler.GetSignBytes(signModeHandler.DefaultMode(), signerData, sigTx) s.Require().NoError(err) diff --git a/x/auth/tx/builder.go b/x/auth/tx/builder.go index 2f67639383..2efc752e83 100644 --- a/x/auth/tx/builder.go +++ b/x/auth/tx/builder.go @@ -145,10 +145,6 @@ func (w *wrapper) FeeGranter() sdk.AccAddress { return "" } -func (w *wrapper) GetSigBlockHeight() uint64 { - return w.tx.Body.SigBlockHeight -} - func (w *wrapper) GetMemo() string { return w.tx.Body.Memo } @@ -228,10 +224,6 @@ func (w *wrapper) SetMemo(memo string) { w.bodyBz = nil } -func (w *wrapper) SetSigBlockHeight(sbh uint64) { - w.tx.Body.SigBlockHeight = sbh -} - func (w *wrapper) SetGasLimit(limit uint64) { if w.tx.AuthInfo.Fee == nil { w.tx.AuthInfo.Fee = &tx.Fee{} diff --git a/x/auth/tx/direct.go b/x/auth/tx/direct.go index 51fe31734a..7b28ac4f94 100644 --- a/x/auth/tx/direct.go +++ b/x/auth/tx/direct.go @@ -39,16 +39,17 @@ func (signModeDirectHandler) GetSignBytes(mode signingtypes.SignMode, data signi bodyBz := protoTx.getBodyBytes() authInfoBz := protoTx.getAuthInfoBytes() - return DirectSignBytes(bodyBz, authInfoBz, data.ChainID) + return DirectSignBytes(bodyBz, authInfoBz, data.ChainID, data.AccountNumber) } // DirectSignBytes returns the SIGN_MODE_DIRECT sign bytes for the provided TxBody bytes, AuthInfo bytes, chain ID, -// and sequence. -func DirectSignBytes(bodyBytes, authInfoBytes []byte, chainID string) ([]byte, error) { +// account number and sequence. +func DirectSignBytes(bodyBytes, authInfoBytes []byte, chainID string, accnum uint64) ([]byte, error) { signDoc := types.SignDoc{ BodyBytes: bodyBytes, AuthInfoBytes: authInfoBytes, ChainId: chainID, + AccountNumber: accnum, } return signDoc.Marshal() } diff --git a/x/auth/tx/direct_test.go b/x/auth/tx/direct_test.go index d50eac7178..af87bec767 100644 --- a/x/auth/tx/direct_test.go +++ b/x/auth/tx/direct_test.go @@ -69,7 +69,8 @@ func TestDirectModeHandler(t *testing.T) { require.Len(t, modeHandler.Modes(), 1) signingData := signing.SignerData{ - ChainID: "test-chain", + ChainID: "test-chain", + AccountNumber: 1, } signBytes, err := modeHandler.GetSignBytes(signingtypes.SignMode_SIGN_MODE_DIRECT, signingData, txBuilder.GetTx()) @@ -102,6 +103,7 @@ func TestDirectModeHandler(t *testing.T) { t.Log("verify GetSignBytes with generating sign bytes by marshaling SignDoc") signDoc := txtypes.SignDoc{ + AccountNumber: 1, AuthInfoBytes: authInfoBytes, BodyBytes: bodyBytes, ChainId: "test-chain", @@ -147,9 +149,8 @@ func TestDirectModeHandler_nonDIRECT_MODE(t *testing.T) { type nonProtoTx int -func (npt *nonProtoTx) GetMsgs() []sdk.Msg { return nil } -func (npt *nonProtoTx) ValidateBasic() error { return nil } -func (npt *nonProtoTx) GetSigBlockHeight() uint64 { return 0 } +func (npt *nonProtoTx) GetMsgs() []sdk.Msg { return nil } +func (npt *nonProtoTx) ValidateBasic() error { return nil } var _ sdk.Tx = (*nonProtoTx)(nil) diff --git a/x/auth/tx/legacy_amino_json.go b/x/auth/tx/legacy_amino_json.go index c982dba160..5485504ede 100644 --- a/x/auth/tx/legacy_amino_json.go +++ b/x/auth/tx/legacy_amino_json.go @@ -47,7 +47,7 @@ func (s signModeLegacyAminoJSONHandler) GetSignBytes(mode signingtypes.SignMode, } return legacytx.StdSignBytes( - data.ChainID, tx.GetSigBlockHeight(), data.Sequence, protoTx.GetTimeoutHeight(), + data.ChainID, data.AccountNumber, data.Sequence, protoTx.GetTimeoutHeight(), legacytx.StdFee{Amount: protoTx.GetFee(), Gas: protoTx.GetGas()}, tx.GetMsgs(), protoTx.GetMemo(), ), nil diff --git a/x/auth/tx/legacy_amino_json_test.go b/x/auth/tx/legacy_amino_json_test.go index 00482f0a29..9688df85e6 100644 --- a/x/auth/tx/legacy_amino_json_test.go +++ b/x/auth/tx/legacy_amino_json_test.go @@ -21,7 +21,6 @@ var ( gas = uint64(10000) msg = testdata.NewTestMsg(addr1, addr2) memo = "foo" - sbh = uint64(1) timeout = uint64(10) ) @@ -29,7 +28,6 @@ func buildTx(t *testing.T, bldr *wrapper) { bldr.SetFeeAmount(coins) bldr.SetGasLimit(gas) bldr.SetMemo(memo) - bldr.SetSigBlockHeight(sbh) bldr.SetTimeoutHeight(timeout) require.NoError(t, bldr.SetMsgs(msg)) } @@ -41,18 +39,20 @@ func TestLegacyAminoJSONHandler_GetSignBytes(t *testing.T) { var ( chainId = "test-chain" + accNum uint64 = 7 seqNum uint64 = 7 ) handler := signModeLegacyAminoJSONHandler{} signingData := signing.SignerData{ - ChainID: chainId, - Sequence: seqNum, + ChainID: chainId, + AccountNumber: accNum, + Sequence: seqNum, } signBz, err := handler.GetSignBytes(signingtypes.SignMode_SIGN_MODE_LEGACY_AMINO_JSON, signingData, tx) require.NoError(t, err) - expectedSignBz := legacytx.StdSignBytes(chainId, sbh, seqNum, timeout, legacytx.StdFee{ + expectedSignBz := legacytx.StdSignBytes(chainId, accNum, seqNum, timeout, legacytx.StdFee{ Amount: coins, Gas: gas, }, []sdk.Msg{msg}, memo) diff --git a/x/auth/types/account.go b/x/auth/types/account.go index bf071aceda..cd8086eb6a 100644 --- a/x/auth/types/account.go +++ b/x/auth/types/account.go @@ -39,10 +39,11 @@ var ( // NewBaseAccount creates a new BaseAccount object //nolint:interfacer -func NewBaseAccount(address sdk.AccAddress, pubKey cryptotypes.PubKey, sequence uint64) *BaseAccount { +func NewBaseAccount(address sdk.AccAddress, pubKey cryptotypes.PubKey, accountNumber, sequence uint64) *BaseAccount { acc := &BaseAccount{ - Address: address.String(), - Sequence: sequence, + Address: address.String(), + AccountNumber: accountNumber, + Sequence: sequence, } err := acc.SetPubKey(pubKey) @@ -108,6 +109,17 @@ func (acc *BaseAccount) SetPubKey(pubKey cryptotypes.PubKey) error { return nil } +// GetAccountNumber - Implements AccountI +func (acc BaseAccount) GetAccountNumber() uint64 { + return acc.AccountNumber +} + +// SetAccountNumber - Implements AccountI +func (acc *BaseAccount) SetAccountNumber(accNumber uint64) error { + acc.AccountNumber = accNumber + return nil +} + // GetSequence - Implements sdk.AccountI. func (acc BaseAccount) GetSequence() uint64 { return acc.Sequence @@ -256,11 +268,12 @@ func (ma *ModuleAccount) MarshalX() ([]byte, error) { } type moduleAccountPretty struct { - Address sdk.AccAddress `json:"address" yaml:"address"` - PubKey string `json:"public_key" yaml:"public_key"` - Sequence uint64 `json:"sequence" yaml:"sequence"` - Name string `json:"name" yaml:"name"` - Permissions []string `json:"permissions" yaml:"permissions"` + Address sdk.AccAddress `json:"address" yaml:"address"` + PubKey string `json:"public_key" yaml:"public_key"` + AccountNumber uint64 `json:"account_number" yaml:"account_number"` + Sequence uint64 `json:"sequence" yaml:"sequence"` + Name string `json:"name" yaml:"name"` + Permissions []string `json:"permissions" yaml:"permissions"` } func (ma ModuleAccount) String() string { @@ -276,11 +289,12 @@ func (ma ModuleAccount) MarshalYAML() (interface{}, error) { } bs, err := yaml.Marshal(moduleAccountPretty{ - Address: sdk.AccAddress(ma.Address), - PubKey: "", - Sequence: ma.Sequence, - Name: ma.Name, - Permissions: ma.Permissions, + Address: sdk.AccAddress(ma.Address), + PubKey: "", + AccountNumber: ma.AccountNumber, + Sequence: ma.Sequence, + Name: ma.Name, + Permissions: ma.Permissions, }) if err != nil { @@ -298,11 +312,12 @@ func (ma ModuleAccount) MarshalJSON() ([]byte, error) { } return json.Marshal(moduleAccountPretty{ - Address: sdk.AccAddress(ma.Address), - PubKey: "", - Sequence: ma.Sequence, - Name: ma.Name, - Permissions: ma.Permissions, + Address: sdk.AccAddress(ma.Address), + PubKey: "", + AccountNumber: ma.AccountNumber, + Sequence: ma.Sequence, + Name: ma.Name, + Permissions: ma.Permissions, }) } @@ -313,7 +328,7 @@ func (ma *ModuleAccount) UnmarshalJSON(bz []byte) error { return err } - ma.BaseAccount = NewBaseAccount(alias.Address, nil, alias.Sequence) + ma.BaseAccount = NewBaseAccount(alias.Address, nil, alias.AccountNumber, alias.Sequence) ma.Name = alias.Name ma.Permissions = alias.Permissions @@ -322,7 +337,7 @@ func (ma *ModuleAccount) UnmarshalJSON(bz []byte) error { // AccountI is an interface used to store coins at a given address within state. // It presumes a notion of sequence numbers for replay protection, -// a notion of sig block height for replay protection for previously pruned accounts, +// a notion of account numbers for replay protection for previously pruned accounts, // and a pubkey for authentication purposes. // // Many complex conditions can be used in the concrete struct which implements AccountI. @@ -335,6 +350,9 @@ type AccountI interface { GetPubKey() cryptotypes.PubKey // can return nil. SetPubKey(cryptotypes.PubKey) error + GetAccountNumber() uint64 + SetAccountNumber(uint64) error + GetSequence() uint64 SetSequence(uint64) error @@ -416,15 +434,17 @@ type PubKeyJSON struct { Key []byte `json:"key"` } type BaseAccountJSON struct { - Address string `json:"address"` - PubKey PubKeyJSON `json:"pub_key"` - Sequence string `json:"sequence"` + Address string `json:"address"` + PubKey PubKeyJSON `json:"pub_key"` + AccountNumber uint64 `json:"account_number"` + Sequence string `json:"sequence"` } func (acc BaseAccount) MarshalJSONPB(m *jsonpb.Marshaler) ([]byte, error) { var bi BaseAccountJSON bi.Address = acc.GetAddress().String() + bi.AccountNumber = acc.GetAccountNumber() bi.Sequence = strconv.FormatUint(acc.Sequence, 10) var bz []byte var err error @@ -456,6 +476,7 @@ func (acc *BaseAccount) UnmarshalJSONPB(m *jsonpb.Unmarshaler, bz []byte) error } acc.Address = bi.Address + acc.AccountNumber = bi.AccountNumber acc.Sequence, err = strconv.ParseUint(bi.Sequence, 10, 64) if err != nil { return err diff --git a/x/auth/types/account_retriever.go b/x/auth/types/account_retriever.go index cbea4788e3..ab284267bb 100644 --- a/x/auth/types/account_retriever.go +++ b/x/auth/types/account_retriever.go @@ -5,7 +5,6 @@ import ( "fmt" "strconv" - "github.com/line/lbm-sdk/client/grpc/tmservice" grpc "google.golang.org/grpc" "google.golang.org/grpc/metadata" @@ -30,15 +29,6 @@ func (ar AccountRetriever) GetAccount(clientCtx client.Context, addr sdk.AccAddr return account, err } -func (ar AccountRetriever) GetLatestHeight(clientCtx client.Context) (uint64, error) { - queryClient := tmservice.NewServiceClient(clientCtx) - res, err := queryClient.GetLatestBlock(context.Background(), &tmservice.GetLatestBlockRequest{}) - if err != nil { - return 0, err - } - return uint64(res.Block.Header.Height), nil -} - // GetAccountWithHeight queries for an account given an address. Returns the // height of the query with the account. An error is returned if the query // or decoding fails. @@ -78,13 +68,13 @@ func (ar AccountRetriever) EnsureExists(clientCtx client.Context, addr sdk.AccAd return nil } -// GetAccountSequence returns sequence for the given address. +// GetAccountNumberSequence returns sequence and account number for the given address. // It returns an error if the account couldn't be retrieved from the state. -func (ar AccountRetriever) GetAccountSequence(clientCtx client.Context, addr sdk.AccAddress) (uint64, error) { +func (ar AccountRetriever) GetAccountNumberSequence(clientCtx client.Context, addr sdk.AccAddress) (uint64, uint64, error) { acc, err := ar.GetAccount(clientCtx, addr) if err != nil { - return 0, err + return 0, 0, err } - return acc.GetSequence(), nil + return acc.GetAccountNumber(), acc.GetSequence(), nil } diff --git a/x/auth/types/account_retriever_test.go b/x/auth/types/account_retriever_test.go index e013323593..e515d9870e 100644 --- a/x/auth/types/account_retriever_test.go +++ b/x/auth/types/account_retriever_test.go @@ -36,7 +36,8 @@ func TestAccountRetriever(t *testing.T) { require.NoError(t, ar.EnsureExists(clientCtx, val.Address)) - accSeq, err := ar.GetAccountSequence(clientCtx, val.Address) + accNum, accSeq, err := ar.GetAccountNumberSequence(clientCtx, val.Address) require.NoError(t, err) + require.Equal(t, accNum, uint64(0)) require.Equal(t, accSeq, uint64(1)) } diff --git a/x/auth/types/account_test.go b/x/auth/types/account_test.go index 0a2ecd76cd..e497cfc197 100644 --- a/x/auth/types/account_test.go +++ b/x/auth/types/account_test.go @@ -101,7 +101,7 @@ func TestBaseAccountMarshal(t *testing.T) { func TestGenesisAccountValidate(t *testing.T) { pubkey := secp256k1.GenPrivKey().PubKey() addr := sdk.BytesToAccAddress(pubkey.Address()) - baseAcc := types.NewBaseAccount(addr, pubkey, 0) + baseAcc := types.NewBaseAccount(addr, pubkey, 0, 0) tests := []struct { name string @@ -115,7 +115,7 @@ func TestGenesisAccountValidate(t *testing.T) { }, { "invalid base valid account", - types.NewBaseAccount(addr, secp256k1.GenPrivKey().PubKey(), 0), + types.NewBaseAccount(addr, secp256k1.GenPrivKey().PubKey(), 0, 0), true, }, } @@ -135,7 +135,7 @@ func TestModuleAccountMarshalYAML(t *testing.T) { bs, err := yaml.Marshal(moduleAcc) require.NoError(t, err) - want := "|\n address: link1n7rdpqvgf37ktx30a2sv2kkszk3m7ncma6dpv3\n public_key: \"\"\n sequence: 0\n name: test\n permissions:\n - minter\n - burner\n - staking\n" + want := "|\n address: link1n7rdpqvgf37ktx30a2sv2kkszk3m7ncma6dpv3\n public_key: \"\"\n account_number: 0\n sequence: 0\n name: test\n permissions:\n - minter\n - burner\n - staking\n" require.Equal(t, want, string(bs)) } @@ -164,7 +164,7 @@ func TestHasPermissions(t *testing.T) { func TestValidate(t *testing.T) { addr := sdk.BytesToAccAddress(secp256k1.GenPrivKey().PubKey().Address()) - baseAcc := types.NewBaseAccount(addr, nil, 0) + baseAcc := types.NewBaseAccount(addr, nil, 0, 0) tests := []struct { name string acc types.GenesisAccount @@ -198,7 +198,7 @@ func TestValidate(t *testing.T) { func TestModuleAccountJSON(t *testing.T) { pubkey := secp256k1.GenPrivKey().PubKey() addr := sdk.BytesToAccAddress(pubkey.Address()) - baseAcc := types.NewBaseAccount(addr, nil, 50) + baseAcc := types.NewBaseAccount(addr, nil, 10, 50) acc := types.NewModuleAccount(baseAcc, "test", "burner") bz, err := json.Marshal(acc) @@ -216,7 +216,7 @@ func TestModuleAccountJSON(t *testing.T) { func TestGenesisAccountsContains(t *testing.T) { pubkey := secp256k1.GenPrivKey().PubKey() addr := sdk.BytesToAccAddress(pubkey.Address()) - acc := types.NewBaseAccount(addr, secp256k1.GenPrivKey().PubKey(), 0) + acc := types.NewBaseAccount(addr, secp256k1.GenPrivKey().PubKey(), 0, 0) genAccounts := types.GenesisAccounts{} require.False(t, genAccounts.Contains(acc.GetAddress())) diff --git a/x/auth/types/auth.pb.go b/x/auth/types/auth.pb.go index 2635234ab6..878153ddc7 100644 --- a/x/auth/types/auth.pb.go +++ b/x/auth/types/auth.pb.go @@ -35,7 +35,8 @@ type BaseAccount struct { Ed25519PubKey *ed25519.PubKey `protobuf:"bytes,2,opt,name=ed25519_pub_key,json=ed25519PubKey,proto3" json:"ed25519_public_key,omitempty" yaml:"ed25519_public_key"` Secp256K1PubKey *secp256k1.PubKey `protobuf:"bytes,3,opt,name=secp256k1_pub_key,json=secp256k1PubKey,proto3" json:"secp256k1_public_key,omitempty" yaml:"secp256k1_public_key"` MultisigPubKey *multisig.LegacyAminoPubKey `protobuf:"bytes,4,opt,name=multisig_pub_key,json=multisigPubKey,proto3" json:"multisig_public_key,omitempty" yaml:"multisig_public_key"` - Sequence uint64 `protobuf:"varint,5,opt,name=sequence,proto3" json:"sequence,omitempty"` + AccountNumber uint64 `protobuf:"varint,5,opt,name=account_number,json=accountNumber,proto3" json:"account_number,omitempty" yaml:"account_number"` + Sequence uint64 `protobuf:"varint,6,opt,name=sequence,proto3" json:"sequence,omitempty"` } func (m *BaseAccount) Reset() { *m = BaseAccount{} } @@ -116,7 +117,6 @@ type Params struct { TxSizeCostPerByte uint64 `protobuf:"varint,3,opt,name=tx_size_cost_per_byte,json=txSizeCostPerByte,proto3" json:"tx_size_cost_per_byte,omitempty" yaml:"tx_size_cost_per_byte"` SigVerifyCostED25519 uint64 `protobuf:"varint,4,opt,name=sig_verify_cost_ed25519,json=sigVerifyCostEd25519,proto3" json:"sig_verify_cost_ed25519,omitempty" yaml:"sig_verify_cost_ed25519"` SigVerifyCostSecp256k1 uint64 `protobuf:"varint,5,opt,name=sig_verify_cost_secp256k1,json=sigVerifyCostSecp256k1,proto3" json:"sig_verify_cost_secp256k1,omitempty" yaml:"sig_verify_cost_secp256k1"` - ValidSigBlockPeriod uint64 `protobuf:"varint,6,opt,name=valid_sig_block_period,json=validSigBlockPeriod,proto3" json:"valid_sig_block_period,omitempty" yaml:"valid_sig_block_period"` } func (m *Params) Reset() { *m = Params{} } @@ -186,13 +186,6 @@ func (m *Params) GetSigVerifyCostSecp256k1() uint64 { return 0 } -func (m *Params) GetValidSigBlockPeriod() uint64 { - if m != nil { - return m.ValidSigBlockPeriod - } - return 0 -} - func init() { proto.RegisterType((*BaseAccount)(nil), "lbm.auth.v1.BaseAccount") proto.RegisterType((*ModuleAccount)(nil), "lbm.auth.v1.ModuleAccount") @@ -202,57 +195,57 @@ func init() { func init() { proto.RegisterFile("lbm/auth/v1/auth.proto", fileDescriptor_1d85c5e32d5ed883) } var fileDescriptor_1d85c5e32d5ed883 = []byte{ - // 800 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x94, 0xcf, 0x6f, 0xdc, 0x44, - 0x14, 0xc7, 0xd7, 0xc4, 0x84, 0x64, 0xb6, 0x3f, 0x88, 0x13, 0xd2, 0xcd, 0x36, 0xf1, 0x2c, 0x16, - 0x42, 0x39, 0x10, 0x5b, 0x09, 0x0a, 0x52, 0x57, 0xa2, 0x28, 0x2e, 0x1c, 0x2a, 0x5a, 0x14, 0x39, - 0x52, 0x85, 0xb8, 0x58, 0xb6, 0x77, 0x70, 0x46, 0xeb, 0xd9, 0x71, 0x3d, 0xe3, 0x68, 0xdd, 0x1b, - 0xe2, 0x82, 0xc4, 0x05, 0x6e, 0x1c, 0xf3, 0x47, 0x54, 0xe2, 0xc0, 0x3f, 0xc0, 0x31, 0xea, 0x89, - 0x93, 0x85, 0x36, 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17, 0x42, 0x51, 0xb5, 0x7e, 0xf3, 0xb5, 0xa8, 0xcf, 0x4b, 0x68, - 0xd6, 0xe6, 0x6e, 0x1f, 0x60, 0x79, 0x5b, 0x6c, 0xa9, 0x4f, 0xa6, 0x8d, 0x02, 0xec, 0xbc, 0xdb, - 0xd1, 0xdc, 0x03, 0xe9, 0x30, 0xf7, 0xf1, 0xac, 0x84, 0xdb, 0x4b, 0x8b, 0x9e, 0x2d, 0x14, 0xf3, - 0x12, 0x0e, 0xda, 0x97, 0x6d, 0x86, 0x58, 0xde, 0x36, 0x6b, 0xed, 0x35, 0x5e, 0x80, 0xed, 0x8b, - 0x20, 0xc1, 0x23, 0x71, 0xc2, 0x61, 0x42, 0xa3, 0x71, 0x75, 0x3a, 0x98, 0x8e, 0x7a, 0xab, 0x62, - 0xdd, 0x8f, 0xe7, 0x25, 0xdc, 0x93, 0xd3, 0xdb, 0x75, 0x96, 0xb7, 0x29, 0x0a, 0x67, 0x38, 0x76, - 0xab, 0xf4, 0xa9, 0xc8, 0x0e, 0xd7, 0xea, 0x3b, 0xa0, 0xb9, 0x8f, 0xff, 0x9e, 0x99, 0xda, 0xd5, - 0xcc, 0xd4, 0xfe, 0x9d, 0x99, 0xda, 0x6f, 0xd7, 0x66, 0xe7, 0xea, 0xda, 0xec, 0xfc, 0x73, 0x6d, - 0x76, 0x7e, 0xf8, 0x24, 0xc6, 0xfc, 0x3c, 0x0f, 0xed, 0x88, 0x12, 0x27, 0xc1, 0x13, 0xe4, 0x24, - 0x21, 0x39, 0x60, 0xa3, 0xb1, 0x33, 0x95, 0xff, 0x78, 0x5e, 0xa4, 0x88, 0x85, 0xab, 0xe2, 0x27, - 0xfa, 0xf9, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0x25, 0xe6, 0xe9, 0x4f, 0xfc, 0x05, 0x00, 0x00, + // 786 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x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d7, + 0xbd, 0x56, 0xfb, 0xfe, 0xa3, 0x61, 0xc0, 0xce, 0x13, 0xcf, 0xf0, 0x09, 0x36, 0xc3, 0x60, 0x8c, + 0xcc, 0xd0, 0xc3, 0xbb, 0x74, 0x30, 0x32, 0x27, 0xc5, 0xd7, 0x9c, 0xa5, 0x11, 0xa2, 0xde, 0x0a, + 0xff, 0x5c, 0x7e, 0xfa, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xe0, 0x62, 0xc8, 0x44, 0xe6, 0x05, + 0x00, 0x00, } func (this *Params) Equal(that interface{}) bool { @@ -289,9 +282,6 @@ func (this *Params) Equal(that interface{}) bool { if this.SigVerifyCostSecp256k1 != that1.SigVerifyCostSecp256k1 { return false } - if this.ValidSigBlockPeriod != that1.ValidSigBlockPeriod { - return false - } return true } func (m *BaseAccount) Marshal() (dAtA []byte, err error) { @@ -317,6 +307,11 @@ func (m *BaseAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { if m.Sequence != 0 { i = encodeVarintAuth(dAtA, i, uint64(m.Sequence)) i-- + dAtA[i] = 0x30 + } + if m.AccountNumber != 0 { + i = encodeVarintAuth(dAtA, i, uint64(m.AccountNumber)) + i-- dAtA[i] = 0x28 } if m.MultisigPubKey != nil { @@ -436,11 +431,6 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.ValidSigBlockPeriod != 0 { - i = encodeVarintAuth(dAtA, i, uint64(m.ValidSigBlockPeriod)) - i-- - dAtA[i] = 0x30 - } if m.SigVerifyCostSecp256k1 != 0 { i = encodeVarintAuth(dAtA, i, uint64(m.SigVerifyCostSecp256k1)) i-- @@ -502,6 +492,9 @@ func (m *BaseAccount) Size() (n int) { l = m.MultisigPubKey.Size() n += 1 + l + sovAuth(uint64(l)) } + if m.AccountNumber != 0 { + n += 1 + sovAuth(uint64(m.AccountNumber)) + } if m.Sequence != 0 { n += 1 + sovAuth(uint64(m.Sequence)) } @@ -552,9 +545,6 @@ func (m *Params) Size() (n int) { if m.SigVerifyCostSecp256k1 != 0 { n += 1 + sovAuth(uint64(m.SigVerifyCostSecp256k1)) } - if m.ValidSigBlockPeriod != 0 { - n += 1 + sovAuth(uint64(m.ValidSigBlockPeriod)) - } return n } @@ -734,6 +724,25 @@ func (m *BaseAccount) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AccountNumber", wireType) + } + m.AccountNumber = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuth + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AccountNumber |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Sequence", wireType) } @@ -1047,25 +1056,6 @@ func (m *Params) Unmarshal(dAtA []byte) error { break } } - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidSigBlockPeriod", wireType) - } - m.ValidSigBlockPeriod = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuth - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ValidSigBlockPeriod |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } default: iNdEx = preIndex skippy, err := skipAuth(dAtA[iNdEx:]) diff --git a/x/auth/types/genesis.go b/x/auth/types/genesis.go index eeb861d39f..57db523f49 100644 --- a/x/auth/types/genesis.go +++ b/x/auth/types/genesis.go @@ -76,7 +76,7 @@ func ValidateGenesis(data GenesisState) error { // SanitizeGenesisAccounts sorts accounts and coin sets. func SanitizeGenesisAccounts(genAccs GenesisAccounts) GenesisAccounts { sort.Slice(genAccs, func(i, j int) bool { - return genAccs[i].GetAddress().String() < genAccs[j].GetAddress().String() + return genAccs[i].GetAccountNumber() < genAccs[j].GetAccountNumber() }) return genAccs diff --git a/x/auth/types/genesis_test.go b/x/auth/types/genesis_test.go index 5a1f8c9f66..7ffd034e8f 100644 --- a/x/auth/types/genesis_test.go +++ b/x/auth/types/genesis_test.go @@ -16,15 +16,20 @@ import ( func TestSanitize(t *testing.T) { addr1 := sdk.BytesToAccAddress(ed25519.GenPrivKey().PubKey().Address()) authAcc1 := types.NewBaseAccountWithAddress(addr1) + err := authAcc1.SetAccountNumber(1) + require.NoError(t, err) addr2 := sdk.BytesToAccAddress(ed25519.GenPrivKey().PubKey().Address()) authAcc2 := types.NewBaseAccountWithAddress(addr2) genAccs := types.GenesisAccounts{authAcc1, authAcc2} + require.True(t, genAccs[0].GetAccountNumber() > genAccs[1].GetAccountNumber()) + require.Equal(t, genAccs[1].GetAddress(), addr2) genAccs = types.SanitizeGenesisAccounts(genAccs) - require.False(t, genAccs[0].GetAddress().String() > genAccs[1].GetAddress().String()) + require.False(t, genAccs[0].GetAccountNumber() > genAccs[1].GetAccountNumber()) + require.Equal(t, genAccs[1].GetAddress(), addr1) } var ( diff --git a/x/auth/types/keys.go b/x/auth/types/keys.go index 69325ed285..e76505ae80 100644 --- a/x/auth/types/keys.go +++ b/x/auth/types/keys.go @@ -24,6 +24,9 @@ const ( var ( // AddressStoreKeyPrefix prefix for account-by-address store AddressStoreKeyPrefix = []byte{0x01} + + // param key for global account number + GlobalAccountNumberKey = []byte("globalAccountNumber") ) // AddressStoreKey turn an address to key used to get it from the account store diff --git a/x/auth/types/params.go b/x/auth/types/params.go index f02d4181c6..c0403f6f2a 100644 --- a/x/auth/types/params.go +++ b/x/auth/types/params.go @@ -15,7 +15,6 @@ const ( DefaultTxSizeCostPerByte uint64 = 10 DefaultSigVerifyCostED25519 uint64 = 590 DefaultSigVerifyCostSecp256k1 uint64 = 1000 - DefaultValidSigBlockPeriod uint64 = 3600 // 1 hour for 1 second block interval ) // Parameter keys @@ -25,15 +24,13 @@ var ( KeyTxSizeCostPerByte = []byte("TxSizeCostPerByte") KeySigVerifyCostED25519 = []byte("SigVerifyCostED25519") KeySigVerifyCostSecp256k1 = []byte("SigVerifyCostSecp256k1") - KeyValidSigBlockPeriod = []byte("ValidSigBlockPeriod") ) var _ paramtypes.ParamSet = &Params{} // NewParams creates a new Params object func NewParams( - maxMemoCharacters, txSigLimit, txSizeCostPerByte, sigVerifyCostED25519, sigVerifyCostSecp256k1, - validSigBlockPeriod uint64, + maxMemoCharacters, txSigLimit, txSizeCostPerByte, sigVerifyCostED25519, sigVerifyCostSecp256k1 uint64, ) Params { return Params{ MaxMemoCharacters: maxMemoCharacters, @@ -41,7 +38,6 @@ func NewParams( TxSizeCostPerByte: txSizeCostPerByte, SigVerifyCostED25519: sigVerifyCostED25519, SigVerifyCostSecp256k1: sigVerifyCostSecp256k1, - ValidSigBlockPeriod: validSigBlockPeriod, } } @@ -59,7 +55,6 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { paramtypes.NewParamSetPair(KeyTxSizeCostPerByte, &p.TxSizeCostPerByte, validateTxSizeCostPerByte), paramtypes.NewParamSetPair(KeySigVerifyCostED25519, &p.SigVerifyCostED25519, validateSigVerifyCostED25519), paramtypes.NewParamSetPair(KeySigVerifyCostSecp256k1, &p.SigVerifyCostSecp256k1, validateSigVerifyCostSecp256k1), - paramtypes.NewParamSetPair(KeyValidSigBlockPeriod, &p.ValidSigBlockPeriod, validateValidSigBlockPeriod), } } @@ -71,7 +66,6 @@ func DefaultParams() Params { TxSizeCostPerByte: DefaultTxSizeCostPerByte, SigVerifyCostED25519: DefaultSigVerifyCostED25519, SigVerifyCostSecp256k1: DefaultSigVerifyCostSecp256k1, - ValidSigBlockPeriod: DefaultValidSigBlockPeriod, } } @@ -120,19 +114,6 @@ func validateSigVerifyCostSecp256k1(i interface{}) error { return nil } -func validateValidSigBlockPeriod(i interface{}) error { - v, ok := i.(uint64) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - if v == 0 { - return fmt.Errorf("invalid validSigBlockPeriod: %d", v) - } - - return nil -} - func validateMaxMemoCharacters(i interface{}) error { v, ok := i.(uint64) if !ok { @@ -176,8 +157,6 @@ func (p Params) Validate() error { if err := validateTxSizeCostPerByte(p.TxSizeCostPerByte); err != nil { return err } - if err := validateValidSigBlockPeriod(p.ValidSigBlockPeriod); err != nil { - return err - } + return nil } diff --git a/x/auth/types/params_test.go b/x/auth/types/params_test.go index a948bc7c9b..4f2922ecbb 100644 --- a/x/auth/types/params_test.go +++ b/x/auth/types/params_test.go @@ -26,17 +26,15 @@ func TestParams_Validate(t *testing.T) { }{ {"default params", types.DefaultParams(), nil}, {"invalid tx signature limit", types.NewParams(types.DefaultMaxMemoCharacters, 0, types.DefaultTxSizeCostPerByte, - types.DefaultSigVerifyCostED25519, types.DefaultSigVerifyCostSecp256k1, types.DefaultValidSigBlockPeriod), fmt.Errorf("invalid tx signature limit: 0")}, + types.DefaultSigVerifyCostED25519, types.DefaultSigVerifyCostSecp256k1), fmt.Errorf("invalid tx signature limit: 0")}, {"invalid ED25519 signature verification cost", types.NewParams(types.DefaultMaxMemoCharacters, types.DefaultTxSigLimit, types.DefaultTxSizeCostPerByte, - 0, types.DefaultSigVerifyCostSecp256k1, types.DefaultValidSigBlockPeriod), fmt.Errorf("invalid ED25519 signature verification cost: 0")}, + 0, types.DefaultSigVerifyCostSecp256k1), fmt.Errorf("invalid ED25519 signature verification cost: 0")}, {"invalid SECK256k1 signature verification cost", types.NewParams(types.DefaultMaxMemoCharacters, types.DefaultTxSigLimit, types.DefaultTxSizeCostPerByte, - types.DefaultSigVerifyCostED25519, 0, types.DefaultValidSigBlockPeriod), fmt.Errorf("invalid SECK256k1 signature verification cost: 0")}, + types.DefaultSigVerifyCostED25519, 0), fmt.Errorf("invalid SECK256k1 signature verification cost: 0")}, {"invalid max memo characters", types.NewParams(0, types.DefaultTxSigLimit, types.DefaultTxSizeCostPerByte, - types.DefaultSigVerifyCostED25519, types.DefaultSigVerifyCostSecp256k1, types.DefaultValidSigBlockPeriod), fmt.Errorf("invalid max memo characters: 0")}, + types.DefaultSigVerifyCostED25519, types.DefaultSigVerifyCostSecp256k1), fmt.Errorf("invalid max memo characters: 0")}, {"invalid tx size cost per byte", types.NewParams(types.DefaultMaxMemoCharacters, types.DefaultTxSigLimit, 0, - types.DefaultSigVerifyCostED25519, types.DefaultSigVerifyCostSecp256k1, types.DefaultValidSigBlockPeriod), fmt.Errorf("invalid tx size cost per byte: 0")}, - {"invalid valid sig block period", types.NewParams(types.DefaultMaxMemoCharacters, types.DefaultTxSigLimit, types.DefaultTxSizeCostPerByte, - types.DefaultSigVerifyCostED25519, types.DefaultSigVerifyCostSecp256k1, 0), fmt.Errorf("invalid validSigBlockPeriod: 0")}, + types.DefaultSigVerifyCostED25519, types.DefaultSigVerifyCostSecp256k1), fmt.Errorf("invalid tx size cost per byte: 0")}, } for _, tt := range tests { tt := tt diff --git a/x/auth/vesting/types/vesting_account.go b/x/auth/vesting/types/vesting_account.go index 4331c5460b..e58960a1aa 100644 --- a/x/auth/vesting/types/vesting_account.go +++ b/x/auth/vesting/types/vesting_account.go @@ -166,6 +166,7 @@ func (bva BaseVestingAccount) Validate() error { type vestingAccountYAML struct { Address sdk.AccAddress `json:"address" yaml:"address"` PubKey string `json:"public_key" yaml:"public_key"` + AccountNumber uint64 `json:"account_number" yaml:"account_number"` Sequence uint64 `json:"sequence" yaml:"sequence"` OriginalVesting sdk.Coins `json:"original_vesting" yaml:"original_vesting"` DelegatedFree sdk.Coins `json:"delegated_free" yaml:"delegated_free"` @@ -186,6 +187,7 @@ func (bva BaseVestingAccount) String() string { func (bva BaseVestingAccount) MarshalYAML() (interface{}, error) { alias := vestingAccountYAML{ Address: sdk.AccAddress(bva.Address), + AccountNumber: bva.AccountNumber, Sequence: bva.Sequence, OriginalVesting: bva.OriginalVesting, DelegatedFree: bva.DelegatedFree, @@ -356,6 +358,7 @@ func (cva ContinuousVestingAccount) String() string { func (cva ContinuousVestingAccount) MarshalYAML() (interface{}, error) { alias := vestingAccountYAML{ Address: sdk.AccAddress(cva.Address), + AccountNumber: cva.AccountNumber, Sequence: cva.Sequence, OriginalVesting: cva.OriginalVesting, DelegatedFree: cva.DelegatedFree, @@ -547,6 +550,7 @@ func (pva PeriodicVestingAccount) String() string { func (pva PeriodicVestingAccount) MarshalYAML() (interface{}, error) { alias := vestingAccountYAML{ Address: sdk.AccAddress(pva.Address), + AccountNumber: pva.AccountNumber, Sequence: pva.Sequence, OriginalVesting: pva.OriginalVesting, DelegatedFree: pva.DelegatedFree, diff --git a/x/auth/vesting/types/vesting_account_test.go b/x/auth/vesting/types/vesting_account_test.go index e8b3b52446..6d6af07dde 100644 --- a/x/auth/vesting/types/vesting_account_test.go +++ b/x/auth/vesting/types/vesting_account_test.go @@ -581,7 +581,7 @@ func TestTrackUndelegationPeriodicVestingAcc(t *testing.T) { func TestGenesisAccountValidate(t *testing.T) { pubkey := secp256k1.GenPrivKey().PubKey() addr := sdk.BytesToAccAddress(pubkey.Address()) - baseAcc := authtypes.NewBaseAccount(addr, pubkey, 0) + baseAcc := authtypes.NewBaseAccount(addr, pubkey, 0, 0) initialVesting := sdk.NewCoins(sdk.NewInt64Coin(sdk.DefaultBondDenom, 50)) baseVestingWithCoins := types.NewBaseVestingAccount(baseAcc, initialVesting, 100) tests := []struct { @@ -596,7 +596,7 @@ func TestGenesisAccountValidate(t *testing.T) { }, { "invalid base valid account", - authtypes.NewBaseAccount(addr, secp256k1.GenPrivKey().PubKey(), 0), + authtypes.NewBaseAccount(addr, secp256k1.GenPrivKey().PubKey(), 0, 0), true, }, { @@ -648,7 +648,7 @@ func TestContinuousVestingAccountMarshal(t *testing.T) { pubkey := secp256k1.GenPrivKey().PubKey() addr := sdk.BytesToAccAddress(pubkey.Address()) coins := sdk.NewCoins(sdk.NewInt64Coin("test", 5)) - baseAcc := authtypes.NewBaseAccount(addr, pubkey, 50) + baseAcc := authtypes.NewBaseAccount(addr, pubkey, 10, 50) baseVesting := types.NewBaseVestingAccount(baseAcc, coins, time.Now().Unix()) acc := types.NewContinuousVestingAccountRaw(baseVesting, baseVesting.EndTime) @@ -670,7 +670,7 @@ func TestPeriodicVestingAccountMarshal(t *testing.T) { pubkey := secp256k1.GenPrivKey().PubKey() addr := sdk.BytesToAccAddress(pubkey.Address()) coins := sdk.NewCoins(sdk.NewInt64Coin("test", 5)) - baseAcc := authtypes.NewBaseAccount(addr, pubkey, 50) + baseAcc := authtypes.NewBaseAccount(addr, pubkey, 10, 50) acc := types.NewPeriodicVestingAccount(baseAcc, coins, time.Now().Unix(), types.Periods{types.Period{3600, coins}}) @@ -691,7 +691,7 @@ func TestDelayedVestingAccountMarshal(t *testing.T) { pubkey := secp256k1.GenPrivKey().PubKey() addr := sdk.BytesToAccAddress(pubkey.Address()) coins := sdk.NewCoins(sdk.NewInt64Coin("test", 5)) - baseAcc := authtypes.NewBaseAccount(addr, pubkey, 50) + baseAcc := authtypes.NewBaseAccount(addr, pubkey, 10, 50) acc := types.NewDelayedVestingAccount(baseAcc, coins, time.Now().Unix()) diff --git a/x/bank/app_test.go b/x/bank/app_test.go index 6cfba62099..b7dab334d0 100644 --- a/x/bank/app_test.go +++ b/x/bank/app_test.go @@ -25,7 +25,7 @@ type ( expSimPass bool expPass bool msgs []sdk.Msg - sbh []uint64 + accNums []uint64 accSeqs []uint64 privKeys []cryptotypes.PrivKey expectedBalances []expectedBalance @@ -103,12 +103,13 @@ func TestSendNotEnoughBalance(t *testing.T) { require.NotNil(t, res1) require.Equal(t, acc, res1.(*authtypes.BaseAccount)) + origAccNum := res1.GetAccountNumber() origSeq := res1.GetSequence() sendMsg := types.NewMsgSend(addr1, addr2, sdk.Coins{sdk.NewInt64Coin("foocoin", 100)}) header := ocproto.Header{Height: app.LastBlockHeight() + 1} txGen := simapp.MakeTestEncodingConfig().TxConfig - _, _, err = simapp.SignCheckDeliver(t, txGen, app.BaseApp, header, []sdk.Msg{sendMsg}, "", []uint64{0}, []uint64{origSeq}, false, false, priv1) + _, _, err = simapp.SignCheckDeliver(t, txGen, app.BaseApp, header, []sdk.Msg{sendMsg}, "", []uint64{origAccNum}, []uint64{origSeq}, false, false, priv1) require.Error(t, err) simapp.CheckBalance(t, app, addr1, sdk.Coins{sdk.NewInt64Coin("foocoin", 67)}) @@ -116,6 +117,7 @@ func TestSendNotEnoughBalance(t *testing.T) { res2 := app.AccountKeeper.GetAccount(app.NewContext(true, ocproto.Header{}), addr1) require.NotNil(t, res2) + require.Equal(t, res2.GetAccountNumber(), origAccNum) require.Equal(t, res2.GetSequence(), origSeq+1) } @@ -141,7 +143,7 @@ func TestMsgMultiSendWithAccounts(t *testing.T) { { desc: "make a valid tx", msgs: []sdk.Msg{multiSendMsg1}, - sbh: []uint64{0}, + accNums: []uint64{0}, accSeqs: []uint64{0}, expSimPass: true, expPass: true, @@ -152,9 +154,9 @@ func TestMsgMultiSendWithAccounts(t *testing.T) { }, }, { - desc: "wrong sig block height should pass Simulate, but not Deliver", + desc: "wrong accNum should pass Simulate, but not Deliver", msgs: []sdk.Msg{multiSendMsg1, multiSendMsg2}, - sbh: []uint64{5}, // wrong sig block height + accNums: []uint64{1}, // wrong account number accSeqs: []uint64{1}, expSimPass: true, // doesn't check signature expPass: false, @@ -163,7 +165,7 @@ func TestMsgMultiSendWithAccounts(t *testing.T) { { desc: "wrong accSeq should not pass Simulate", msgs: []sdk.Msg{multiSendMsg5}, - sbh: []uint64{0}, + accNums: []uint64{0}, accSeqs: []uint64{0}, // wrong account sequence expSimPass: false, expPass: false, @@ -174,7 +176,7 @@ func TestMsgMultiSendWithAccounts(t *testing.T) { for _, tc := range testCases { header := ocproto.Header{Height: app.LastBlockHeight() + 1} txGen := simapp.MakeTestEncodingConfig().TxConfig - _, _, err := simapp.SignCheckDeliver(t, txGen, app.BaseApp, header, tc.msgs, "", tc.sbh, tc.accSeqs, tc.expSimPass, tc.expPass, tc.privKeys...) + _, _, err := simapp.SignCheckDeliver(t, txGen, app.BaseApp, header, tc.msgs, "", tc.accNums, tc.accSeqs, tc.expSimPass, tc.expPass, tc.privKeys...) if tc.expPass { require.NoError(t, err) } else { @@ -210,7 +212,7 @@ func TestMsgMultiSendMultipleOut(t *testing.T) { testCases := []appTestCase{ { msgs: []sdk.Msg{multiSendMsg2}, - sbh: []uint64{0}, + accNums: []uint64{0}, accSeqs: []uint64{0}, expSimPass: true, expPass: true, @@ -226,7 +228,7 @@ func TestMsgMultiSendMultipleOut(t *testing.T) { for _, tc := range testCases { header := ocproto.Header{Height: app.LastBlockHeight() + 1} txGen := simapp.MakeTestEncodingConfig().TxConfig - _, _, err := simapp.SignCheckDeliver(t, txGen, app.BaseApp, header, tc.msgs, "", tc.sbh, tc.accSeqs, tc.expSimPass, tc.expPass, tc.privKeys...) + _, _, err := simapp.SignCheckDeliver(t, txGen, app.BaseApp, header, tc.msgs, "", tc.accNums, tc.accSeqs, tc.expSimPass, tc.expPass, tc.privKeys...) require.NoError(t, err) for _, eb := range tc.expectedBalances { @@ -264,7 +266,7 @@ func TestMsgMultiSendMultipleInOut(t *testing.T) { testCases := []appTestCase{ { msgs: []sdk.Msg{multiSendMsg3}, - sbh: []uint64{0, 0}, + accNums: []uint64{0, 2}, accSeqs: []uint64{0, 0}, expSimPass: true, expPass: true, @@ -281,7 +283,7 @@ func TestMsgMultiSendMultipleInOut(t *testing.T) { for _, tc := range testCases { header := ocproto.Header{Height: app.LastBlockHeight() + 1} txGen := simapp.MakeTestEncodingConfig().TxConfig - _, _, err := simapp.SignCheckDeliver(t, txGen, app.BaseApp, header, tc.msgs, "", tc.sbh, tc.accSeqs, tc.expSimPass, tc.expPass, tc.privKeys...) + _, _, err := simapp.SignCheckDeliver(t, txGen, app.BaseApp, header, tc.msgs, "", tc.accNums, tc.accSeqs, tc.expSimPass, tc.expPass, tc.privKeys...) require.NoError(t, err) for _, eb := range tc.expectedBalances { @@ -293,12 +295,14 @@ func TestMsgMultiSendMultipleInOut(t *testing.T) { func TestMsgMultiSendDependent(t *testing.T) { acc1 := authtypes.NewBaseAccountWithAddress(addr1) acc2 := authtypes.NewBaseAccountWithAddress(addr2) + err := acc2.SetAccountNumber(1) + require.NoError(t, err) genAccs := []authtypes.GenesisAccount{acc1, acc2} app := simapp.SetupWithGenesisAccounts(genAccs) ctx := app.BaseApp.NewContext(false, ocproto.Header{}) - err := app.BankKeeper.SetBalances(ctx, addr1, sdk.NewCoins(sdk.NewInt64Coin("foocoin", 42))) + err = app.BankKeeper.SetBalances(ctx, addr1, sdk.NewCoins(sdk.NewInt64Coin("foocoin", 42))) require.NoError(t, err) app.Commit() @@ -306,7 +310,7 @@ func TestMsgMultiSendDependent(t *testing.T) { testCases := []appTestCase{ { msgs: []sdk.Msg{multiSendMsg1}, - sbh: []uint64{0}, + accNums: []uint64{0}, accSeqs: []uint64{0}, expSimPass: true, expPass: true, @@ -318,7 +322,7 @@ func TestMsgMultiSendDependent(t *testing.T) { }, { msgs: []sdk.Msg{multiSendMsg4}, - sbh: []uint64{0}, + accNums: []uint64{1}, accSeqs: []uint64{0}, expSimPass: true, expPass: true, @@ -332,7 +336,7 @@ func TestMsgMultiSendDependent(t *testing.T) { for _, tc := range testCases { header := ocproto.Header{Height: app.LastBlockHeight() + 1} txGen := simapp.MakeTestEncodingConfig().TxConfig - _, _, err := simapp.SignCheckDeliver(t, txGen, app.BaseApp, header, tc.msgs, "", tc.sbh, tc.accSeqs, tc.expSimPass, tc.expPass, tc.privKeys...) + _, _, err := simapp.SignCheckDeliver(t, txGen, app.BaseApp, header, tc.msgs, "", tc.accNums, tc.accSeqs, tc.expSimPass, tc.expPass, tc.privKeys...) require.NoError(t, err) for _, eb := range tc.expectedBalances { diff --git a/x/bank/client/cli/tx.go b/x/bank/client/cli/tx.go index 2dc3c432cc..f6e5a12280 100644 --- a/x/bank/client/cli/tx.go +++ b/x/bank/client/cli/tx.go @@ -31,8 +31,7 @@ func NewSendTxCmd() *cobra.Command { Use: "send [from_key_or_address] [to_address] [amount]", Short: `Send funds from one account to another. Note, the'--from' flag is ignored as it is implied from [from_key_or_address].`, - Args: cobra.ExactArgs(3), - PreRun: preSendCmd, + Args: cobra.ExactArgs(3), RunE: func(cmd *cobra.Command, args []string) error { cmd.Flags().Set(flags.FlagFrom, args[0]) clientCtx, err := client.GetClientTxContext(cmd) @@ -59,9 +58,3 @@ ignored as it is implied from [from_key_or_address].`, return cmd } - -func preSendCmd(cmd *cobra.Command, _ []string) { - if offline, _ := cmd.Flags().GetBool(flags.FlagOffline); offline { - cmd.MarkFlagRequired(flags.FlagSequence) - } -} diff --git a/x/bank/client/rest/tx_test.go b/x/bank/client/rest/tx_test.go index 2c7523cc08..0595d4b0b3 100644 --- a/x/bank/client/rest/tx_test.go +++ b/x/bank/client/rest/tx_test.go @@ -75,7 +75,7 @@ func generateSendReq(from authtypes.AccountI, amount types.Coins) bankrest.SendR "some-id", "10000", fmt.Sprintf("%f", 1.0), - 0, + from.GetAccountNumber(), from.GetSequence(), types.NewCoins(), nil, diff --git a/x/bank/simulation/operations.go b/x/bank/simulation/operations.go index d95bb46814..46bfe3789a 100644 --- a/x/bank/simulation/operations.go +++ b/x/bank/simulation/operations.go @@ -110,7 +110,7 @@ func sendMsgSend( fees, helpers.DefaultGenTxGas, chainID, - []uint64{0}, + []uint64{account.GetAccountNumber()}, []uint64{account.GetSequence()}, privkeys..., ) @@ -223,13 +223,13 @@ func sendMsgMultiSend( msg *types.MsgMultiSend, ctx sdk.Context, chainID string, privkeys []cryptotypes.PrivKey, ) error { - sbh := make([]uint64, len(msg.Inputs)) + accountNumbers := make([]uint64, len(msg.Inputs)) sequenceNumbers := make([]uint64, len(msg.Inputs)) for i := 0; i < len(msg.Inputs); i++ { addr := sdk.AccAddress(msg.Inputs[i].Address) acc := ak.GetAccount(ctx, addr) - sbh[i] = 0 + accountNumbers[i] = acc.GetAccountNumber() sequenceNumbers[i] = acc.GetSequence() } @@ -259,7 +259,7 @@ func sendMsgMultiSend( fees, helpers.DefaultGenTxGas, chainID, - sbh, + accountNumbers, sequenceNumbers, privkeys..., ) diff --git a/x/bank/types/expected_keepers.go b/x/bank/types/expected_keepers.go index 8fe5f4a48f..f0ab0f451c 100644 --- a/x/bank/types/expected_keepers.go +++ b/x/bank/types/expected_keepers.go @@ -8,6 +8,7 @@ import ( // AccountKeeper defines the account contract that must be fulfilled when // creating a x/bank keeper. type AccountKeeper interface { + NewAccount(sdk.Context, types.AccountI) types.AccountI NewAccountWithAddress(ctx sdk.Context, addr sdk.AccAddress) types.AccountI GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI diff --git a/x/distribution/simulation/operations.go b/x/distribution/simulation/operations.go index a6f2ee2ab5..5149ea899d 100644 --- a/x/distribution/simulation/operations.go +++ b/x/distribution/simulation/operations.go @@ -107,7 +107,7 @@ func SimulateMsgSetWithdrawAddress(ak types.AccountKeeper, bk types.BankKeeper, fees, helpers.DefaultGenTxGas, chainID, - []uint64{0}, + []uint64{account.GetAccountNumber()}, []uint64{account.GetSequence()}, simAccount.PrivKey, ) @@ -159,7 +159,7 @@ func SimulateMsgWithdrawDelegatorReward(ak types.AccountKeeper, bk types.BankKee fees, helpers.DefaultGenTxGas, chainID, - []uint64{0}, + []uint64{account.GetAccountNumber()}, []uint64{account.GetSequence()}, simAccount.PrivKey, ) @@ -214,7 +214,7 @@ func SimulateMsgWithdrawValidatorCommission(ak types.AccountKeeper, bk types.Ban fees, helpers.DefaultGenTxGas, chainID, - []uint64{0}, + []uint64{account.GetAccountNumber()}, []uint64{account.GetSequence()}, simAccount.PrivKey, ) @@ -269,7 +269,7 @@ func SimulateMsgFundCommunityPool(ak types.AccountKeeper, bk types.BankKeeper, k fees, helpers.DefaultGenTxGas, chainID, - []uint64{0}, + []uint64{account.GetAccountNumber()}, []uint64{account.GetSequence()}, funder.PrivKey, ) diff --git a/x/evidence/keeper/keeper_test.go b/x/evidence/keeper/keeper_test.go index 953bc56060..89969b4e07 100644 --- a/x/evidence/keeper/keeper_test.go +++ b/x/evidence/keeper/keeper_test.go @@ -98,7 +98,7 @@ func (suite *KeeperTestSuite) SetupTest() { for i, addr := range valAddresses { addr := addr.ToAccAddress() - app.AccountKeeper.SetAccount(suite.ctx, authtypes.NewBaseAccount(addr, pubkeys[i], 0)) + app.AccountKeeper.SetAccount(suite.ctx, authtypes.NewBaseAccount(addr, pubkeys[i], uint64(i), 0)) } queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, app.InterfaceRegistry()) diff --git a/x/feegrant/client/testutil/suite.go b/x/feegrant/client/testutil/suite.go index 2be955ef26..4aae0a907a 100644 --- a/x/feegrant/client/testutil/suite.go +++ b/x/feegrant/client/testutil/suite.go @@ -2,6 +2,7 @@ package testutil import ( "fmt" + "github.com/line/lbm-sdk/client" "strings" "testing" "time" @@ -11,7 +12,6 @@ import ( tmcli "github.com/line/ostracon/libs/cli" "github.com/stretchr/testify/suite" - "github.com/line/lbm-sdk/client" "github.com/line/lbm-sdk/client/flags" "github.com/line/lbm-sdk/crypto/hd" "github.com/line/lbm-sdk/crypto/keyring" diff --git a/x/genutil/types/expected_keepers.go b/x/genutil/types/expected_keepers.go index 2ac24b2e12..94f1745fb3 100644 --- a/x/genutil/types/expected_keepers.go +++ b/x/genutil/types/expected_keepers.go @@ -18,6 +18,7 @@ type StakingKeeper interface { // AccountKeeper defines the expected account keeper (noalias) type AccountKeeper interface { + NewAccount(sdk.Context, auth.AccountI) auth.AccountI SetAccount(sdk.Context, auth.AccountI) IterateAccounts(ctx sdk.Context, process func(auth.AccountI) (stop bool)) } diff --git a/x/gov/simulation/operations.go b/x/gov/simulation/operations.go index 933038dc2b..5f73239e91 100644 --- a/x/gov/simulation/operations.go +++ b/x/gov/simulation/operations.go @@ -161,7 +161,7 @@ func SimulateMsgSubmitProposal( fees, helpers.DefaultGenTxGas, chainID, - []uint64{0}, + []uint64{account.GetAccountNumber()}, []uint64{account.GetSequence()}, simAccount.PrivKey, ) @@ -248,7 +248,7 @@ func SimulateMsgDeposit(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Ke fees, helpers.DefaultGenTxGas, chainID, - []uint64{0}, + []uint64{account.GetAccountNumber()}, []uint64{account.GetSequence()}, simAccount.PrivKey, ) @@ -310,7 +310,7 @@ func operationSimulateMsgVote(ak types.AccountKeeper, bk types.BankKeeper, k kee fees, helpers.DefaultGenTxGas, chainID, - []uint64{0}, + []uint64{account.GetAccountNumber()}, []uint64{account.GetSequence()}, simAccount.PrivKey, ) @@ -373,7 +373,7 @@ func operationSimulateMsgVoteWeighted(ak types.AccountKeeper, bk types.BankKeepe fees, helpers.DefaultGenTxGas, ctx.ChainID(), - []uint64{0}, + []uint64{account.GetAccountNumber()}, []uint64{account.GetSequence()}, simAccount.PrivKey, ) diff --git a/x/ibc/testing/chain.go b/x/ibc/testing/chain.go index 485da818a5..7e165a6223 100644 --- a/x/ibc/testing/chain.go +++ b/x/ibc/testing/chain.go @@ -133,8 +133,7 @@ func NewTestChain(t *testing.T, chainID string) *TestChain { // generate genesis account senderPrivKey := secp256k1.GenPrivKey() - acc := authtypes.NewBaseAccount(sdk.BytesToAccAddress(senderPrivKey.PubKey().Address()), - senderPrivKey.PubKey(), 0) + acc := authtypes.NewBaseAccount(sdk.BytesToAccAddress(senderPrivKey.PubKey().Address()), senderPrivKey.PubKey(), 0, 0) balance := banktypes.Balance{ Address: acc.GetAddress().String(), Coins: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100000000000000))), @@ -305,7 +304,7 @@ func (chain *TestChain) SendMsgs(msgs ...sdk.Msg) (*sdk.Result, error) { chain.GetContext().BlockHeader(), msgs, chain.ChainID, - []uint64{0}, + []uint64{chain.SenderAccount.GetAccountNumber()}, []uint64{chain.SenderAccount.GetSequence()}, true, true, chain.senderPrivKey, ) diff --git a/x/simulation/util.go b/x/simulation/util.go index f58f9ff1aa..d276147ee2 100644 --- a/x/simulation/util.go +++ b/x/simulation/util.go @@ -106,7 +106,7 @@ func GenAndDeliverTx(txCtx OperationInput, fees types.Coins) (simtype.OperationM fees, helpers.DefaultGenTxGas, txCtx.Context.ChainID(), - []uint64{0}, + []uint64{account.GetAccountNumber()}, []uint64{account.GetSequence()}, txCtx.SimAccount.PrivKey, ) diff --git a/x/slashing/simulation/operations.go b/x/slashing/simulation/operations.go index bda3d2bf8b..eae6add410 100644 --- a/x/slashing/simulation/operations.go +++ b/x/slashing/simulation/operations.go @@ -95,7 +95,7 @@ func SimulateMsgUnjail(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Kee fees, helpers.DefaultGenTxGas, chainID, - []uint64{0}, + []uint64{account.GetAccountNumber()}, []uint64{account.GetSequence()}, simAccount.PrivKey, ) diff --git a/x/staking/simulation/operations.go b/x/staking/simulation/operations.go index 420911530e..90b88c864f 100644 --- a/x/staking/simulation/operations.go +++ b/x/staking/simulation/operations.go @@ -159,7 +159,7 @@ func SimulateMsgCreateValidator(ak types.AccountKeeper, bk types.BankKeeper, k k fees, helpers.DefaultGenTxGas, chainID, - []uint64{0}, + []uint64{account.GetAccountNumber()}, []uint64{account.GetSequence()}, simAccount.PrivKey, ) @@ -229,7 +229,7 @@ func SimulateMsgEditValidator(ak types.AccountKeeper, bk types.BankKeeper, k kee fees, helpers.DefaultGenTxGas, chainID, - []uint64{0}, + []uint64{account.GetAccountNumber()}, []uint64{account.GetSequence()}, simAccount.PrivKey, ) @@ -301,7 +301,7 @@ func SimulateMsgDelegate(ak types.AccountKeeper, bk types.BankKeeper, k keeper.K fees, helpers.DefaultGenTxGas, chainID, - []uint64{0}, + []uint64{account.GetAccountNumber()}, []uint64{account.GetSequence()}, simAccount.PrivKey, ) @@ -390,7 +390,7 @@ func SimulateMsgUndelegate(ak types.AccountKeeper, bk types.BankKeeper, k keeper fees, helpers.DefaultGenTxGas, chainID, - []uint64{0}, + []uint64{account.GetAccountNumber()}, []uint64{account.GetSequence()}, simAccount.PrivKey, ) @@ -502,7 +502,7 @@ func SimulateMsgBeginRedelegate(ak types.AccountKeeper, bk types.BankKeeper, k k fees, helpers.DefaultGenTxGas, chainID, - []uint64{0}, + []uint64{account.GetAccountNumber()}, []uint64{account.GetSequence()}, simAccount.PrivKey, ) diff --git a/x/wasm/keeper/keeper_test.go b/x/wasm/keeper/keeper_test.go index 3e19a2250c..1303824707 100644 --- a/x/wasm/keeper/keeper_test.go +++ b/x/wasm/keeper/keeper_test.go @@ -287,7 +287,7 @@ func TestInstantiate(t *testing.T) { gasAfter := ctx.GasMeter().GasConsumed() if types.EnableGasVerification { - require.Equal(t, uint64(0x1115c), gasAfter-gasBefore) + require.Equal(t, uint64(0x11d92), gasAfter-gasBefore) } // ensure it is stored properly @@ -521,7 +521,7 @@ func TestExecute(t *testing.T) { // make sure gas is properly deducted from ctx gasAfter := ctx.GasMeter().GasConsumed() if types.EnableGasVerification { - require.Equal(t, uint64(0x107b7), gasAfter-gasBefore) + require.Equal(t, uint64(0x113ff), gasAfter-gasBefore) } // ensure bob now exists and got both payments released bobAcct = accKeeper.GetAccount(ctx, bob) diff --git a/x/wasm/types/expected_keepers.go b/x/wasm/types/expected_keepers.go index af7839cab0..a7bd2b555a 100644 --- a/x/wasm/types/expected_keepers.go +++ b/x/wasm/types/expected_keepers.go @@ -35,7 +35,7 @@ type BankKeeper interface { // AccountKeeper defines a subset of methods implemented by the cosmos-sdk account keeper type AccountKeeper interface { - // Return a new account with the specified address. Does not save the new account to the store. + // Return a new account with the next account number and the specified address. Does not save the new account to the store. NewAccountWithAddress(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI // Retrieve an account from the store. GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI From 79617f1137506c6b6cd4f95444d7cfe4b48bb118 Mon Sep 17 00:00:00 2001 From: zemyblue Date: Sat, 12 Feb 2022 00:57:27 +0900 Subject: [PATCH 3/7] fix: fix lint warning. --- x/feegrant/client/testutil/suite.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/feegrant/client/testutil/suite.go b/x/feegrant/client/testutil/suite.go index 4aae0a907a..2be955ef26 100644 --- a/x/feegrant/client/testutil/suite.go +++ b/x/feegrant/client/testutil/suite.go @@ -2,7 +2,6 @@ package testutil import ( "fmt" - "github.com/line/lbm-sdk/client" "strings" "testing" "time" @@ -12,6 +11,7 @@ import ( tmcli "github.com/line/ostracon/libs/cli" "github.com/stretchr/testify/suite" + "github.com/line/lbm-sdk/client" "github.com/line/lbm-sdk/client/flags" "github.com/line/lbm-sdk/crypto/hd" "github.com/line/lbm-sdk/crypto/keyring" From 6238208d59a72c6417e0fbf738d70ddf1ac91659 Mon Sep 17 00:00:00 2001 From: zemyblue Date: Sat, 12 Feb 2022 01:17:41 +0900 Subject: [PATCH 4/7] chore: add changelog about this pr --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc29a016c7..b107f4b88a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased](https://github.com/line/lbm-sdk/compare/v0.44.0-rc...HEAD) ### Features +* (feat) [\#434] (https://github.com/line/lbm-sdk/pull/434) Revert signature mechanism using `sig_block_height` ### Improvements From 3556ace15b1b7e39283b7eec1b60606264e3501c Mon Sep 17 00:00:00 2001 From: zemyblue Date: Tue, 15 Feb 2022 14:28:54 +0900 Subject: [PATCH 5/7] fix typo --- x/auth/ante/sigverify.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/auth/ante/sigverify.go b/x/auth/ante/sigverify.go index 94c1116980..cb3c064eeb 100644 --- a/x/auth/ante/sigverify.go +++ b/x/auth/ante/sigverify.go @@ -255,7 +255,7 @@ func (svd *SigVerificationDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simu newSigKeys := make([]string, 0, len(sigs)) defer func() { - // remove txHashCash if got an error + // remove txHashCache if got an error if err != nil { for _, sigKey := range newSigKeys { svd.txHashCache.Delete(sigKey) From a194422a4082c71ee08548d4723d2b6016d33b52 Mon Sep 17 00:00:00 2001 From: zemyblue Date: Tue, 15 Feb 2022 14:44:56 +0900 Subject: [PATCH 6/7] chore: fix CHANGELOG.md links display error --- CHANGELOG.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 595c0c5c9d..f69e7e8a07 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,28 +54,28 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [v0.44.0-rc0](https://github.com/line/lbm-sdk/releases/tag/v0.44.0-rc0) - 2022-02-04 ### Features -* (feat) [\#352] (https://github.com/line/lbm-sdk/pull/352) iavl, db & disk stats logging +* (feat) [\#352](https://github.com/line/lbm-sdk/pull/352) iavl, db & disk stats logging * (x/gov) [\#368](https://github.com/line/lbm-sdk/pull/368) Governance Split Votes, use `MsgWeightedVote` to send a split vote. Sending a regular `MsgVote` will convert the underlying vote option into a weighted vote with weight 1. -* (x/upgrade) [\#377] (https://github.com/line/lbm-sdk/pull/377) To smoothen the update to the latest stable release, the SDK includes vesion map for managing migrations between SDK versions. -* (x/wasm) [\#358] (https://github.com/line/lbm-sdk/pull/358) change wasm metrics method to using prometheus directly -* (x/feegrant) [\#380] (https://github.com/line/lbm-sdk/pull/380) Feegrant module -* (x/wasm) [\#395] (https://github.com/line/lbm-sdk/pull/395) Add the instantiate_permission in the CodeInfoResponse -* (x/consortium) [\#406] (https://github.com/line/lbm-sdk/pull/406) Add CreateValidator access control feature -* (x/bank) [\#400] (https://github.com/line/lbm-sdk/pull/400) add `bankplus` function to restrict to send coin to inactive smart contract. +* (x/upgrade) [\#377](https://github.com/line/lbm-sdk/pull/377) To smoothen the update to the latest stable release, the SDK includes vesion map for managing migrations between SDK versions. +* (x/wasm) [\#358](https://github.com/line/lbm-sdk/pull/358) change wasm metrics method to using prometheus directly +* (x/feegrant) [\#380](https://github.com/line/lbm-sdk/pull/380) Feegrant module +* (x/wasm) [\#395](https://github.com/line/lbm-sdk/pull/395) Add the instantiate_permission in the CodeInfoResponse +* (x/consortium) [\#406](https://github.com/line/lbm-sdk/pull/406) Add CreateValidator access control feature +* (x/bank) [\#400](https://github.com/line/lbm-sdk/pull/400) add `bankplus` function to restrict to send coin to inactive smart contract. ### Improvements * (slashing) [\#347](https://github.com/line/lbm-sdk/pull/347) Introduce VoterSetCounter * (auth) [\#348](https://github.com/line/lbm-sdk/pull/348) Increase default valid_sig_block_period ### Bug Fixes -* (x/feegrant) [\#383] (https://github.com/line/lbm-sdk/pull/383) Update allowance inside AllowedMsgAllowance -* (tm-db) [\#388] (https://github.com/line/lbm-sdk/pull/388) Bump up tm-db fixing invalid memory reference -* (swagger) [\#391] (https://github.com/line/lbm-sdk/pull/391) fix swagger's config path for wasm -* (x/wasm) [\#393] (https://github.com/line/lbm-sdk/pull/393) fix bug where `StoreCodeAndInstantiateContract`, `UpdateContractStatus`, `UpdateContractStatusProposal` API does not work -* (x/slashing) [\#407] (https://github.com/line/lbm-sdk/pull/407) Fix query signing infos command +* (x/feegrant) [\#383](https://github.com/line/lbm-sdk/pull/383) Update allowance inside AllowedMsgAllowance +* (tm-db) [\#388](https://github.com/line/lbm-sdk/pull/388) Bump up tm-db fixing invalid memory reference +* (swagger) [\#391](https://github.com/line/lbm-sdk/pull/391) fix swagger's config path for wasm +* (x/wasm) [\#393](https://github.com/line/lbm-sdk/pull/393) fix bug where `StoreCodeAndInstantiateContract`, `UpdateContractStatus`, `UpdateContractStatusProposal` API does not work +* (x/slashing) [\#407](https://github.com/line/lbm-sdk/pull/407) Fix query signing infos command ### Breaking Changes -* (x/consortium) [\#411] (https://github.com/line/lbm-sdk/pull/411) Validate validator addresses in update-validator-auths proposal +* (x/consortium) [\#411](https://github.com/line/lbm-sdk/pull/411) Validate validator addresses in update-validator-auths proposal ### Build, CI * (ci) [\#350](https://github.com/line/lbm-sdk/pull/350) Reduce sim test time From 3bbaa2f9282839690f05e3501b5736b8fbc6bd6e Mon Sep 17 00:00:00 2001 From: zemyblue Date: Tue, 15 Feb 2022 23:19:14 +0900 Subject: [PATCH 7/7] Update x/auth/tx/direct.go fix: wrong comment. Co-authored-by: Sujong Lee --- x/auth/tx/direct.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/auth/tx/direct.go b/x/auth/tx/direct.go index 7b28ac4f94..845d603a59 100644 --- a/x/auth/tx/direct.go +++ b/x/auth/tx/direct.go @@ -43,7 +43,7 @@ func (signModeDirectHandler) GetSignBytes(mode signingtypes.SignMode, data signi } // DirectSignBytes returns the SIGN_MODE_DIRECT sign bytes for the provided TxBody bytes, AuthInfo bytes, chain ID, -// account number and sequence. +// account number. func DirectSignBytes(bodyBytes, authInfoBytes []byte, chainID string, accnum uint64) ([]byte, error) { signDoc := types.SignDoc{ BodyBytes: bodyBytes,