Skip to content

Commit

Permalink
Dwedul/merge 1.8.x after rc10 (#714)
Browse files Browse the repository at this point in the history
* add java distribution (#625) (#628)

* add java distribution

* update changelog

* Backport scope/attributes, gov deposit, and java distribution changes (#636)

* add java distribution (#625)

* add java distribution

* update changelog

* Update gov module deposit requirements and add msg fee (#633)

* add deposit and msg fee updates for gov in upgrade

* changelog

* Allow attributes to be associated with scopes. (#634)

* [631]: Update NewAttribute to take in a string instead of an AccAddress.

* [631]: Update Attribute.ValidateBasic() to allow the address to be a scope metadata address.

* [631]: Update NewMsgAddAttributeRequest to take in a string for the account instead of an AccAddress in order to allow for scope metadata addresses.

* [631]: Update NewMsgUpdateAttributeRequest to take in a string for the account instead of an AccAddress in order to allow for scope metadata addresses.

* [631]: Update the attribute keeper methods to treat the Address as a string instead of AccAddress to allow it to be a scope metadata address.

* [631]: Update the attribute keys methods to not rely on the address being an account address.

* [631]: Lint fixes.

* [631]: Lint fixes in main that make lint is complaining about.

* [631]: Add changelog entry.

* [631]: Add some stuff that was missed like the delete messages and some extra context on returned errors.

* Fix message breaking unit test

Co-authored-by: Derek Adams <dadams@figure.com>
Co-authored-by: Derek Adams <derek.adams@sitewhere.com>
Co-authored-by: Ira Miller <72319+iramiller@users.noreply.github.com>

Co-authored-by: Ergels Gaxhaj <87285445+egaxhaj-figure@users.noreply.github.com>
Co-authored-by: Daniel Wedul <72031080+dwedul-figure@users.noreply.github.com>
Co-authored-by: Derek Adams <dadams@figure.com>
Co-authored-by: Derek Adams <derek.adams@sitewhere.com>

* Add msgfees module to added store upgrades (#638)

* Add msgfees to store added upgrades

* Add changelog entry

* 614 proto binding support with buf build (#630) (#641)

* 614 proto binding support with buf build (#630)

* initial attemp at using buf.build

* buf.build stuff

* buf workflow

* trigger on PR for testing

* fix breaking for third_party

* use existing workflow

* updated proto steps

* changelog entry

* fix bug with proto-all

* update proto script and protos

* update proto-all task

* fix typo

* fix bug with proto binding release version & combine workflows

* add protoBinding build step to release.yml workflow

* missed in git add on last commit

* fix lint errors

* fix buf braking

* fix for incorrect line endings (#644)

* add needs: build_init (#646) (#647)

* Add base denom to nhash, Add change log (#649)

* Fix maven publish release version reference (#652)

* fix release version reference

* update changelog

* Bump cosmwasm from v1.0.0-beta5 to v1.0.0-beta6 (#656)

* Bump cosmwasm from v1.0.0-beta5 to v1.0.0-beta6, Add change log entry

* Add dockerfile cosmoswasm v1.0.0-beta5 direct download and validation

* Revert dockerfile changes

* Port iterator fix to v1.8 (#660)

* Add iterator as a feature to wasm

* new upgrade handler hazel. (#661)

* remove v from artifact version (#654) (#657)

* remove v from artifact version

* update changelog

* Fix contract address length support (#663)

* Change go.mod to use wasmd fork to support old address length

* Linked issue

* adding upgrade handler indigo. (#665)

* adding upgrade handler indigo.

* Go lint fixes (#698)

Upgrade golangci-lint and fix lint errors

* backport tx gas limits #681 (#704)

* backport: In release 1.8(not yet in mainnet), floor gas price should … (#705)

* backport: In release 1.8(not yet in mainnet), floor gas price should be checked for all Tx's ( currently only being checked for Tx which have additional Msg Fee),closes: #684

* fix owner array initialization size when creating scope mutation message from wasm contracts

* Simulation tests for smart contracts (#673)

* simulation tests are running

* fixed record issue

* Add smart contract to github actions testing

* fixed determinism test

* cleanup

* make format

* cleanup

* make format

* lint changes

* more lint fixes

* fix tests

* reordered sims tests

* working on import tests

* fixed tests

* cleanup

* add changelog

* fix test name

* make format

* update linter

* lint error

* fix append errors

* lint fixes

* update lint version

* print line numbers

* use verbose output

* use work around for linter

* reverted name change

* more clenaup

* nolint comments

* more nolint comments

* updated linter for kErr

* update golint version

* nolint for gosec

* make format

* remove unused consts

* nolint cleanups

* make format

* update action version

* revert action change

* Add jasmine upgrade handler (#713)

* Skip max gas fees if tx contains MsgSubmitProposal msg (#711)

* Add jasmine upgrade handler

* fix lint errors and run make format.

* Adjustments for v1.8.0 release (#717)

* pre rc10 (new handler, gas fee 15/blk, ante reorder)

Co-authored-by: arnabmitra <arnabmitra.mitra@gmail.com>

* Add some underscores to a couple large numbers.

Co-authored-by: Ergels Gaxhaj <87285445+egaxhaj-figure@users.noreply.github.com>
Co-authored-by: Ira Miller <72319+iramiller@users.noreply.github.com>
Co-authored-by: Derek Adams <dadams@figure.com>
Co-authored-by: Derek Adams <derek.adams@sitewhere.com>
Co-authored-by: Carlton Hanna <73041609+channa-figure@users.noreply.github.com>
Co-authored-by: fkneeland-figure <86616427+fkneeland-figure@users.noreply.github.com>
Co-authored-by: Arnab Mitra <arnabmitra.mitra@gmail.com>
Co-authored-by: Ken Talley <ktalley@figure.com>
Co-authored-by: Ken Talley <76671864+ktalley-figure@users.noreply.github.com>
  • Loading branch information
10 people committed Mar 16, 2022
1 parent 31e5d74 commit cb3d987
Show file tree
Hide file tree
Showing 24 changed files with 530 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -234,4 +234,4 @@ jobs:
-Psigning.keyId=B7D30ABE \
-Psigning.password="${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}" \
-Psigning.secretKeyRingFile=$GITHUB_WORKSPACE/release.gpg \
--info
--info
28 changes: 28 additions & 0 deletions .github/workflows/sims.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,34 @@ jobs:
path: ~/go/bin
key: ${{ runner.os }}-go-runsim-binary

test-sim-simple:
runs-on: ubuntu-latest
needs: [ build, install-runsim ]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2.1.5
with:
go-version: 1.17
- name: Display go version
run: go version
- uses: technote-space/get-diff-action@v6.0.1
with:
PATTERNS: |
**/**.go
go.mod
go.sum
SET_ENV_NAME_INSERTIONS: 1
SET_ENV_NAME_LINES: 1
- uses: actions/cache@v2.1.7
with:
path: ~/go/bin
key: ${{ runner.os }}-go-runsim-binary
if: env.GIT_DIFF
- name: test-sim-simple
run: |
make test-sim-simple
if: env.GIT_DIFF

test-sim-nondeterminism:
runs-on: ubuntu-latest
needs: [build, install-runsim]
Expand Down
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* Allow attributes to be associated with scopes [#631](https://github.com/provenance-io/provenance/issues/631)
* Add `add-genesis-msg-fee` command to add msg fees to genesis.json and update Makefile to have pre-defined msg fees [#667](https://github.com/provenance-io/provenance/issues/667)
* Add msgfees summary event to be emitted when there are txs that have fees [#678](https://github.com/provenance-io/provenance/issues/678)

### Improvements

* Add `bank` and `authz` module query `proto` files required by `grpcurl` [#482](https://github.com/provenance-io/provenance/issues/482)
Expand All @@ -70,8 +71,9 @@ Ref: https://keepachangelog.com/en/1.0.0/
* `provenance.metadata.v1.MsgWriteScopeRequest` 10 hash (10,000,000,000 nhash)
* `provenance.metadata.v1.MsgP8eMemorializeContractRequest` 10 hash (10,000,000,000 nhash)
* When the `start` command encounters an error, it no longer outputs command usage [#670](https://github.com/provenance-io/provenance/issues/670)
* Add integration tests for smart contracts [#392](https://github.com/provenance-io/provenance/issues/392)
* Change max length on marker unresticted denom from 64 to 83 [#719](https://github.com/provenance-io/provenance/issues/719)

### Client Breaking

* Enforce a maximum gas limit on individual transactions so that at least 20 can fit in any given block. [#681](https://github.com/provenance-io/provenance/issues/681)
Expand All @@ -89,9 +91,13 @@ Ref: https://keepachangelog.com/en/1.0.0/
* Add migration to re-index the metadata indexes involving addresses [#541](https://github.com/provenance-io/provenance/issues/541)
* Add migration to delete empty sessions [#480](https://github.com/provenance-io/provenance/issues/480)
* Add Java distribution tag to workflow [#624](https://github.com/provenance-io/provenance/issues/624)
* Add `msgfees` module to added store upgrades [#640](https://github.com/provenance-io/provenance/issues/640)
* Use `nhash` for base denom in gov proposal upgrade [#648](https://github.com/provenance-io/provenance/issues/648)
* Bump `cosmowasm` from `v1.0.0-beta5` to `v1.0.0-beta6` [#655](https://github.com/provenance-io/provenance/issues/655)
* Fix maven publish release version number reference [#650](https://github.com/provenance-io/provenance/issues/650)
* String "v" from Jar artifact version number [#653](https://github.com/provenance-io/provenance/issues/653)
* Add `iterator` as feature for wasm [#658](https://github.com/provenance-io/provenance/issues/658)
* String "v" from Jar artifact version number [#653](https://github.com/provenance-io/provenance/issues/653)
* Fix `wasm` contract migration failure to find contract history [#662](https://github.com/provenance-io/provenance/issues/662)

## [v1.7.6](https://github.com/provenance-io/provenance/releases/tag/v1.7.6) - 2021-12-15

Expand Down
2 changes: 1 addition & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ func New(
name.NewAppModule(appCodec, app.NameKeeper, app.AccountKeeper, app.BankKeeper),
attribute.NewAppModule(appCodec, app.AttributeKeeper, app.AccountKeeper, app.BankKeeper, app.NameKeeper),
msgfeesmodule.NewAppModule(appCodec, app.MsgFeesKeeper, app.interfaceRegistry),
wasm.NewAppModule(appCodec, &app.WasmKeeper, app.StakingKeeper),
provwasm.NewWrapper(appCodec, &app.WasmKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.NameKeeper),

ibc.NewAppModule(app.IBCKeeper),
transferModule,
Expand Down
Binary file added app/sim_contracts/tutorial.wasm
Binary file not shown.
32 changes: 32 additions & 0 deletions app/sim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,38 @@ func TestFullAppSimulation(t *testing.T) {
}
}

func TestSimple(t *testing.T) {
config, db, dir, logger, skip, err := sdksim.SetupSimulation("leveldb-app-sim", "Simulation")
if skip {
t.Skip("skipping provenance application simulation")
}
require.NoError(t, err, "provenance simulation setup failed")

defer func() {
db.Close()
require.NoError(t, os.RemoveAll(dir))
}()

app := New(logger, db, nil, true, map[int64]bool{}, DefaultNodeHome, sdksim.FlagPeriodValue, MakeEncodingConfig(), sdksim.EmptyAppOptions{}, fauxMerkleModeOpt)
require.Equal(t, "provenanced", app.Name())

// run randomized simulation
_, _, simErr := simulation.SimulateFromSeed(
t,
os.Stdout,
app.BaseApp,
sdksim.AppStateFn(app.AppCodec(), app.SimulationManager()),
simtypes.RandomAccounts, // Replace with own random account function if using keys other than secp256k1
sdksim.SimulationOperations(app, app.AppCodec(), config),
app.ModuleAccountAddrs(),
config,
app.AppCodec(),
)

require.NoError(t, simErr)
sdksim.PrintStats(db)
}

// Profile with:
// /usr/local/go/bin/go test -benchmem -run=^$ github.com/provenance-io/provenance -bench ^BenchmarkFullAppSimulation$ -Commit=true -cpuprofile cpu.out
func TestAppImportExport(t *testing.T) {
Expand Down
17 changes: 16 additions & 1 deletion app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ var handlers = map[string]appUpgrade{
// set governance deposit requirement to 50,000HASH
govParams := app.GovKeeper.GetDepositParams(ctx)
beforeDeposit := govParams.MinDeposit
govParams.MinDeposit = sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(50_000_000_000_000)))
govParams.MinDeposit = sdk.NewCoins(sdk.NewCoin(DefaultBondDenom, sdk.NewInt(50_000_000_000_000)))
app.GovKeeper.SetDepositParams(ctx, govParams)
ctx.Logger().Info(fmt.Sprintf("Updated governance module minimum deposit from %s to %s", beforeDeposit, govParams.MinDeposit))

Expand All @@ -80,7 +80,22 @@ var handlers = map[string]appUpgrade{
return resultVM, AddMsgBasedFees(app, ctx)

},
Added: []string{msgfeestypes.ModuleName},
},
"hazel": {},
"indigo": {}, // upgrade for pio-testnet-1 from v1.8.0-rc7 to v1.8.0-rc8
"jasmine": {
Handler: func(app *App, ctx sdk.Context, plan upgradetypes.Plan) (module.VersionMap, error) {
// Ensure consensus params are correct and match mainnet/testnet. Max Block Sizes: 60M gas, 5MB
params := app.GetConsensusParams(ctx)
params.Block.MaxBytes = 1024 * 1024 * 5 // 5MB
params.Block.MaxGas = 60_000_000 // With ante tx gas limit this will yield 3M gas max per tx.
app.StoreConsensusParams(ctx, params)
versionMap := app.UpgradeKeeper.GetModuleVersionMap(ctx)
return versionMap, nil
}, // upgrade for pio-testnet-1 from v1.8.0-rc8 to v1.8.0-rc9
},
"kahlua": {}, // upgrade for pio-testnet-1 from v1.8.0-rc9 to v1.8.0
// TODO - Add new upgrade definitions here.
}

Expand Down
3 changes: 2 additions & 1 deletion cmd/provenanced/cmd/simulate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package cmd_test

import (
"fmt"
"github.com/provenance-io/provenance/internal/antewrapper"
"os"
"path/filepath"
"testing"

"github.com/provenance-io/provenance/internal/antewrapper"

"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli"
Expand Down
11 changes: 10 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,19 @@ replace google.golang.org/grpc => google.golang.org/grpc v1.33.2

replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1

replace github.com/cosmos/cosmos-sdk => github.com/provenance-io/cosmos-sdk v0.45.0-pio-1
replace github.com/cosmos/cosmos-sdk => github.com/provenance-io/cosmos-sdk v0.45.0-pio-2

replace github.com/99designs/keyring => github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76

// Fix upstream GHSA-h395-qcrw-5vmq vulnerability.
// TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409
replace github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.7.0

// Fixes chain panic. Should be removed once cosmwasm has fixed their release
// Dockerfile also needs a reference that will need removing
// TODO Remove it: https://github.com/CosmWasm/cosmwasm/pull/1223
replace github.com/CosmWasm/wasmvm => github.com/CosmWasm/wasmvm v1.0.0-beta6

// Fixes address length issue to support contract address of length 20 (pre v1.8.0) with current length 22
// TODO Remove it when fixed upstream
replace github.com/CosmWasm/wasmd => github.com/provenance-io/wasmd v0.22.0-pio-address-fix
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,8 @@ github.com/BurntSushi/toml v0.4.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbi
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg=
github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4=
github.com/CosmWasm/wasmd v0.22.0 h1:6Bn2DDjHvLwZJkYXL+/PRQ9bSll0ReX2IZqRt/BQkhg=
github.com/CosmWasm/wasmd v0.22.0/go.mod h1:kNDnMAQDJyVek9k6SxCNijMCzOROzzUGBRT8r/vr7oY=
github.com/CosmWasm/wasmvm v1.0.0-beta5 h1:38M8z89LB5cFMYB5vfjewMzz9Pr8TB1QBHdjnrWnkas=
github.com/CosmWasm/wasmvm v1.0.0-beta5/go.mod h1:mtwKxbmsko1zdwpaKiRkRwxijMmIAtnLaX5/UT2nPFk=
github.com/CosmWasm/wasmvm v1.0.0-beta6 h1:JYh9Z7qF6h9a2sOOx9hZRwCVS4aFdd+aiwrIXznLn8k=
github.com/CosmWasm/wasmvm v1.0.0-beta6/go.mod h1:mtwKxbmsko1zdwpaKiRkRwxijMmIAtnLaX5/UT2nPFk=
github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo=
Expand Down Expand Up @@ -915,8 +913,10 @@ github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0
github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
github.com/prometheus/tsdb v0.6.2-0.20190402121629-4f204dcbc150/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
github.com/provenance-io/cosmos-sdk v0.45.0-pio-1 h1:b3m1PVb9CvcD0xiKNvK1gDSfAPtdd3qYKntrJF1eQ24=
github.com/provenance-io/cosmos-sdk v0.45.0-pio-1/go.mod h1:XXS/asyCqWNWkx2rW6pSuen+EVcpAFxq6khrhnZgHaQ=
github.com/provenance-io/cosmos-sdk v0.45.0-pio-2 h1:se3UWMt0pQjYr+8Zi5o0tHaYr8W6FIwRZ6288+lodwc=
github.com/provenance-io/cosmos-sdk v0.45.0-pio-2/go.mod h1:APQJszmf9+rA/3YVNoAbJKVehN4oANbbhoapB0ywCQY=
github.com/provenance-io/wasmd v0.22.0-pio-address-fix h1:oMgJkRT3nq1l58VcP56G39fLsKSQ1Nq44D9fafbdIh4=
github.com/provenance-io/wasmd v0.22.0-pio-address-fix/go.mod h1:kNDnMAQDJyVek9k6SxCNijMCzOROzzUGBRT8r/vr7oY=
github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ=
github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Unghqrcc=
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
Expand Down
2 changes: 1 addition & 1 deletion internal/antewrapper/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
// outermost AnteDecorator. SetUpContext must be called first
NewFeeMeterContextDecorator(), // NOTE : fee gas meter also has the functionality of GasTracerContextDecorator in previous versions
cosmosante.NewRejectExtensionOptionsDecorator(),
cosmosante.NewMempoolFeeDecorator(),
NewTxGasLimitDecorator(),
cosmosante.NewMempoolFeeDecorator(),
// Fee Decorator works to augment NewMempoolFeeDecorator and also check that enough fees are paid
NewMsgFeesDecorator(options.BankKeeper, options.AccountKeeper, options.FeegrantKeeper, options.MsgFeesKeeper),
cosmosante.NewValidateBasicDecorator(),
Expand Down
8 changes: 5 additions & 3 deletions internal/antewrapper/msg_fees_decorator.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package antewrapper
import (
"fmt"

"github.com/cosmos/cosmos-sdk/simapp/helpers"

sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
cosmosante "github.com/cosmos/cosmos-sdk/x/auth/ante"
Expand Down Expand Up @@ -68,7 +70,7 @@ func (afd MsgFeesDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool
}
// floor gas price should be checked for all Tx's ( i.e nodes cannot set min-gas-price < floor gas price)
// the chain id check is exclusively for not breaking all existing sim tests which freak out when denom is anything other than stake.
if ctx.IsCheckTx() && !simulate && shouldIgnoreFloorGasPriceCheck(ctx) && (additionalFees.IsZero() || additionalFees == nil) {
if ctx.IsCheckTx() && !simulate && shouldIgnoreChecksForTests(ctx) && (additionalFees.IsZero() || additionalFees == nil) {
err = checkFloorGasFees(gas, feeCoins, additionalFees, afd.msgFeeKeeper.GetFloorGasPrice(ctx))
if err != nil {
return ctx, err
Expand Down Expand Up @@ -120,8 +122,8 @@ func (afd MsgFeesDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool
// This check for chain-id is exclusively for not breaking all existing sim tests which freak out when denom is anything other than stake.
// and some network tests won't work without a chain id being set(but they also setup everything with stake denom) so `simapp-unit-testing` chain id is skipped also.
// This only needs to work to pio-testnet and pio-mainnet, so this is safe.
func shouldIgnoreFloorGasPriceCheck(ctx sdk.Context) bool {
return len(ctx.ChainID()) != 0 && ctx.ChainID() != SimAppChainID
func shouldIgnoreChecksForTests(ctx sdk.Context) bool {
return len(ctx.ChainID()) != 0 && ctx.ChainID() != SimAppChainID && ctx.ChainID() != helpers.SimAppChainID
}

// getFeeGranterIfExists checks if fee granter exists and returns account to deduct fees from
Expand Down
1 change: 0 additions & 1 deletion internal/antewrapper/msg_fees_decorator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ func (suite *AnteTestSuite) TestEnsureMempoolAndMsgFeesNoAdditionalFeesLowGas()
suite.Require().Contains(err.Error(), "not enough fees based on floor gas price: \"1905nhash\"; required base fees >=\"190500000nhash\": Supplied fee was \"100000nhash\": insufficient fee", "got wrong message")
}


// checkTx true, high min gas price irrespective of additional fees
func (suite *AnteTestSuite) TestEnsureMempoolHighMinGasPrice() {
err, antehandler := setUpApp(suite, true, "atom", 100)
Expand Down
10 changes: 2 additions & 8 deletions internal/antewrapper/tx_gas_limit_decorator.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ import (
// CONTRACT: Tx must implement FeeTx to use TxGasLimitDecorator
type TxGasLimitDecorator struct{}

// MinTxPerBlock is used to determine the maximum amount of gas that any given transaction can use based on the block gas limit.
const MinTxPerBlock = 20

func NewTxGasLimitDecorator() TxGasLimitDecorator {
return TxGasLimitDecorator{}
}
Expand All @@ -27,10 +24,7 @@ func (mfd TxGasLimitDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate b
}
// Ensure that the requested gas does not exceed the configured block maximum
gas := feeTx.GetGas()
gasTxLimit := uint64(0)
if ctx.BlockGasMeter() != nil {
gasTxLimit = ctx.BlockGasMeter().Limit() / MinTxPerBlock
}
gasTxLimit := uint64(4_000_000)

// Skip gas limit check for txs with MsgSubmitProposal
hasSubmitPropMsg := false
Expand All @@ -43,7 +37,7 @@ func (mfd TxGasLimitDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate b
}

// TODO - remove "gasTxLimit > 0" with SDK 0.46 which fixes the infinite gas meter to use max int vs zero for the limit.
if gasTxLimit > 0 && gas > gasTxLimit && !hasSubmitPropMsg {
if shouldIgnoreChecksForTests(ctx) && gasTxLimit > 0 && gas > gasTxLimit && !hasSubmitPropMsg {
return ctx, sdkerrors.Wrapf(sdkerrors.ErrTxTooLarge, "transaction gas exceeds maximum allowed; got: %d max allowed: %d", gas, gasTxLimit)
}
return next(ctx, tx, simulate)
Expand Down
Loading

0 comments on commit cb3d987

Please sign in to comment.