Skip to content

Commit

Permalink
feat: add GenSignedMockTx (cosmos#13557)
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrbrt authored and JeancarloBarrios committed Sep 28, 2024
1 parent 12641f0 commit 6c9b574
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 40 deletions.
72 changes: 39 additions & 33 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,22 @@ Ref: https://keepachangelog.com/en/1.0.0/

## [Unreleased]

### Features

* [#13557](https://github.com/cosmos/cosmos-sdk/pull/#13557) - Add `GenSignedMockTx`. This can be used as workaround for #12437 revertion. `v0.46+` contains as well a `GenSignedMockTx` that behaves the same way.

## v0.45.9 - 2022-10-14

ATTENTION:

This is a security release for the
[Dragonberry security advisory](https://forum.cosmos.network/t/ibc-security-advisory-dragonberry/7702).
This is a security release for the [Dragonberry security advisory](https://forum.cosmos.network/t/ibc-security-advisory-dragonberry/7702).

All users should upgrade immediately.

Users *must* add a replace directive in their go.mod for the
new `ics23` package in the SDK:

```
replace (
github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23
)
Users *must* add a replace directive in their go.mod for thenew `ics23` package in the SDK:

```go
replace github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23/go v0.8.0
```

### Features
Expand All @@ -67,18 +66,22 @@ replace (
* [#13323](https://github.com/cosmos/cosmos-sdk/pull/13323) Ensure `withdraw_rewards` rewards are emitted from all actions that result in rewards being withdrawn.
* [#13321](https://github.com/cosmos/cosmos-sdk/pull/13321) Add flag to disable fast node migration and usage.
* (store) [#13326](https://github.com/cosmos/cosmos-sdk/pull/13326) Implementation of ADR-038 file StreamingService, backport #8664.
* (store) [#13540](https://github.com/cosmos/cosmos-sdk/pull/13540) Default fastnode migration to false to prevent suprises. Operators must enable it, unless they have it enabled already.
* (store) [#13540](https://github.com/cosmos/cosmos-sdk/pull/13540) Default fastnode migration to false to prevent suprises. Operators must enable it, unless they have it enabled already.

### API Breaking Changes

* (cli) [#13089](https://github.com/cosmos/cosmos-sdk/pull/13089) Fix rollback command don't actually delete multistore versions, added method `RollbackToVersion` to interface `CommitMultiStore` and added method `CommitMultiStore` to `Application` interface.

### Bug Fixes

* [#...](https://github.com/cosmos/cosmos-sdk/pull/) Implement dragonberry security patch.
* For applying the patch please refer to the [RELEASE NOTES](./RELEASE_NOTES.md)
* Implement dragonberry security patch.
* For applying the patch please refer to the [RELEASE NOTES](./RELEASE_NOTES.md)
* (store) [#13459](https://github.com/cosmos/cosmos-sdk/pull/13459) Don't let state listener observe the uncommitted writes.

### Notes

Reverted #12437 due to API breaking changes.

## v0.45.8 - 2022-08-25

### Improvements
Expand Down Expand Up @@ -113,6 +116,9 @@ replace (
### Bug Fixes

* (x/mint) [#12384](https://github.com/cosmos/cosmos-sdk/pull/12384) Ensure `GoalBonded` must be positive when performing `x/mint` parameter validation.
* (simapp) [#12437](https://github.com/cosmos/cosmos-sdk/pull/12437) fix the non-determinstic behavior in simulations caused by `GenTx` and check
empty coins slice before it is used to create `banktype.MsgSend`.
* (x/capability) [#12818](https://github.com/cosmos/cosmos-sdk/pull/12818) Use fixed length hex for pointer at FwdCapabilityKey.

## [v0.45.6](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.45.6) - 2022-06-28

Expand Down Expand Up @@ -279,7 +285,7 @@ replace (

### Improvements

* (types) [\#10630](https://github.com/cosmos/cosmos-sdk/pull/10630) Add an `Events` field to the `TxResponse` type that captures _all_ events emitted by a transaction, unlike `Logs` which only contains events emitted during message execution.
* (types) [\#10630](https://github.com/cosmos/cosmos-sdk/pull/10630) Add an `Events` field to the `TxResponse` type that captures *all* events emitted by a transaction, unlike `Logs` which only contains events emitted during message execution.
* (x/upgrade) [\#10532](https://github.com/cosmos/cosmos-sdk/pull/10532) Add `keeper.DumpUpgradeInfoWithInfoToDisk` to include `Plan.Info` in the upgrade-info file.
* (store) [\#10544](https://github.com/cosmos/cosmos-sdk/pull/10544) Use the new IAVL iterator structure which significantly improves iterator performance.

Expand Down Expand Up @@ -1921,7 +1927,7 @@ by the new key store:
* `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._
* `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`
Expand Down Expand Up @@ -3817,7 +3823,7 @@ BUG FIXES

## 0.25.0

_October 24th, 2018_
*October 24th, 2018*

BREAKING CHANGES

Expand Down Expand Up @@ -4064,7 +4070,7 @@ BUG FIXES

## 0.24.2

_August 22nd, 2018_
*August 22nd, 2018*

BUG FIXES

Expand All @@ -4073,7 +4079,7 @@ BUG FIXES

## 0.24.1

_August 21st, 2018_
*August 21st, 2018*

BUG FIXES

Expand All @@ -4082,7 +4088,7 @@ BUG FIXES

## 0.24.0

_August 13th, 2018_
*August 13th, 2018*

BREAKING CHANGES

Expand Down Expand Up @@ -4198,7 +4204,7 @@ BUG FIXES

## 0.23.1

_July 27th, 2018_
*July 27th, 2018*

BUG FIXES

Expand All @@ -4208,7 +4214,7 @@ BUG FIXES

## 0.23.0

_July 25th, 2018_
*July 25th, 2018*

BREAKING CHANGES

Expand All @@ -4231,7 +4237,7 @@ BUG FIXES

## 0.22.0

_July 16th, 2018_
*July 16th, 2018*

BREAKING CHANGES

Expand All @@ -4250,7 +4256,7 @@ BUG FIXES

## 0.21.1

_July 14th, 2018_
*July 14th, 2018*

BUG FIXES

Expand All @@ -4259,7 +4265,7 @@ BUG FIXES

## 0.21.0

_July 13th, 2018_
*July 13th, 2018*

BREAKING CHANGES

Expand Down Expand Up @@ -4290,7 +4296,7 @@ BUG FIXES

## 0.20.0

_July 10th, 2018_
*July 10th, 2018*

BREAKING CHANGES

Expand Down Expand Up @@ -4433,7 +4439,7 @@ BUG FIXES

## 0.19.0

_June 13, 2018_
*June 13, 2018*

BREAKING CHANGES

Expand Down Expand Up @@ -4473,7 +4479,7 @@ FEATURES

## 0.18.0

_June 9, 2018_
*June 9, 2018*

BREAKING CHANGES

Expand Down Expand Up @@ -4527,7 +4533,7 @@ BUG FIXES

## 0.17.5

_June 5, 2018_
*June 5, 2018*

* (std/codec) [/#10595](https://github.com/cosmos/cosmos-sdk/pull/10595) Add evidence to std/codec to be able to decode evidence in client interactions.
* (types) [#9627](https://github.com/cosmos/cosmos-sdk/pull/9627) Fix nil pointer panic on `NewBigIntFromInt`.
Expand All @@ -4537,32 +4543,32 @@ _June 5, 2018_

## [v0.44.8](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.44.8) - 2022-04-12

_May 31, 2018_
*May 31, 2018*

* [#11563](https://github.com/cosmos/cosmos-sdk/pull/11563) Updated Tendermint to v0.34.19; `unsafe-reset-all` command has been moved to the `tendermint` sub-command.

## [v0.44.7](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.44.7) - 2022-04-04

_May 29, 2018_
*May 29, 2018*

* (x/bank) [#10771](https://github.com/cosmos/cosmos-sdk/pull/10771) Add safety check on bank module perms to allow module-specific mint restrictions (e.g. only minting a certain denom).
* (x/bank) [#10771](https://github.com/cosmos/cosmos-sdk/pull/10771) Add `bank.BankKeeper.WithMintCoinsRestriction` function to restrict use of bank `MintCoins` usage. This function is not on the bank `Keeper` interface, so it's not API-breaking, but only additive on the keeper implementation.

### Bug Fixes

_June 5, 2018_
*June 5, 2018*

### Improvements

* [#9576](https://github.com/cosmos/cosmos-sdk/pull/9576) Add debug error message to query result when enabled

_May 31, 2018_
*May 31, 2018*

### Features

* [#11124](https://github.com/cosmos/cosmos-sdk/pull/11124) Add `GetAllVersions` to application store

_May 29, 2018_
*May 29, 2018*

* (grpc) [#10985](https://github.com/cosmos/cosmos-sdk/pull/10992) The `/cosmos/tx/v1beta1/txs/{hash}` endpoint returns a 404 when a tx does not exist.
* (std/codec) [/#10595](https://github.com/cosmos/cosmos-sdk/pull/10595) Add evidence to std/codec to be able to decode evidence in client interactions.
Expand All @@ -4571,7 +4577,7 @@ _May 29, 2018_

### Improvements

* [#10823](https://github.com/cosmos/cosmos-sdk/pull/10823) updated ambiguous cli description for creating feegrant.
*May 20, 2018*

## [v0.44.5-patch](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.44.5-patch) - 2021-10-14

Expand Down
5 changes: 2 additions & 3 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
# Cosmos SDK v0.45.9 Release Notes

This is a security release for the
[Dragonberry security advisory](https://forum.cosmos.network/t/ibc-security-advisory-dragonberry/7702).
This is a security release for the [Dragonberry security advisory](https://forum.cosmos.network/t/ibc-security-advisory-dragonberry/7702).
Please upgrade ASAP.

Next to this, we have also included a few minor bugfixes.

Chains must add the following to their go.mod for the application:

```go
replace github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23
replace github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23 v0.8.0
```

Bumping the SDK version should be smooth, however, feel free to tag core devs to review your upgrading PR:
Expand Down
7 changes: 5 additions & 2 deletions simapp/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package simapp
import (
"encoding/json"
"fmt"
"math/rand"
"strconv"
"testing"

Expand Down Expand Up @@ -254,7 +255,8 @@ func SignCheckDeliver(
t *testing.T, txCfg client.TxConfig, app *bam.BaseApp, header tmproto.Header, msgs []sdk.Msg,
chainID string, accNums, accSeqs []uint64, expSimPass, expPass bool, priv ...cryptotypes.PrivKey,
) (sdk.GasInfo, *sdk.Result, error) {
tx, err := helpers.GenTx(
tx, err := helpers.GenSignedMockTx(
rand.New(rand.NewSource(time.Now().UnixNano())),
txCfg,
msgs,
sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 0)},
Expand Down Expand Up @@ -303,7 +305,8 @@ func GenSequenceOfTxs(txGen client.TxConfig, msgs []sdk.Msg, accNums []uint64, i
txs := make([]sdk.Tx, numToGenerate)
var err error
for i := 0; i < numToGenerate; i++ {
txs[i], err = helpers.GenTx(
txs[i], err = helpers.GenSignedMockTx(
rand.New(rand.NewSource(time.Now().UnixNano())),
txGen,
msgs,
sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 0)},
Expand Down
5 changes: 4 additions & 1 deletion x/genutil/gentx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import (
"encoding/json"
"errors"
"fmt"
"math/rand"
"testing"
"time"

"github.com/golang/mock/gomock"
"github.com/stretchr/testify/suite"
Expand Down Expand Up @@ -270,7 +272,8 @@ func (suite *GenTxTestSuite) TestDeliverGenTxs() {
_ = suite.setAccountBalance(addr2, 1)

msg := banktypes.NewMsgSend(addr1, addr2, sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 1)})
tx, err := helpers.GenTx(
tx, err := helpers.GenSignedMockTx(
rand.New(rand.NewSource(time.Now().UnixNano())),
suite.encodingConfig.TxConfig,
[]sdk.Msg{msg},
sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 10)},
Expand Down
3 changes: 2 additions & 1 deletion x/simulation/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ func GenAndDeliverTxWithRandFees(txCtx OperationInput) (simtypes.OperationMsg, [
// GenAndDeliverTx generates a transactions and delivers it.
func GenAndDeliverTx(txCtx OperationInput, fees sdk.Coins) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
account := txCtx.AccountKeeper.GetAccount(txCtx.Context, txCtx.SimAccount.Address)
tx, err := helpers.GenTx(
tx, err := helpers.GenSignedMockTx(
txCtx.R,
txCtx.TxGen,
[]sdk.Msg{txCtx.Msg},
fees,
Expand Down

0 comments on commit 6c9b574

Please sign in to comment.