Skip to content

Commit ba4adb4

Browse files
committed
add check sim
1 parent d5a82ff commit ba4adb4

File tree

7 files changed

+17
-15
lines changed

7 files changed

+17
-15
lines changed

app/ante.go

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ import (
1414
wasmTypes "github.com/CosmWasm/wasmd/x/wasm/types"
1515
)
1616

17+
var (
18+
DefaultIsAppSimulation = false
19+
)
20+
21+
func updateAppSimulationFlag(flag bool) {
22+
DefaultIsAppSimulation = flag
23+
}
24+
1725
// HandlerOptions extends the SDK's AnteHandler options by requiring the IBC
1826
// channel keeper.
1927
type HandlerOptions struct {
@@ -23,23 +31,21 @@ type HandlerOptions struct {
2331
TxCounterStoreKey sdk.StoreKey
2432
WasmConfig wasmTypes.WasmConfig
2533
Cdc codec.BinaryCodec
26-
IsSims bool
2734
}
2835

2936
type MinCommissionDecorator struct {
30-
cdc codec.BinaryCodec
31-
isSims bool
37+
cdc codec.BinaryCodec
3238
}
3339

34-
func NewMinCommissionDecorator(cdc codec.BinaryCodec, isSims bool) MinCommissionDecorator {
35-
return MinCommissionDecorator{cdc, isSims}
40+
func NewMinCommissionDecorator(cdc codec.BinaryCodec) MinCommissionDecorator {
41+
return MinCommissionDecorator{cdc}
3642
}
3743

3844
func (min MinCommissionDecorator) AnteHandle(
3945
ctx sdk.Context, tx sdk.Tx,
4046
simulate bool, next sdk.AnteHandler,
4147
) (newCtx sdk.Context, err error) {
42-
if min.isSims {
48+
if DefaultIsAppSimulation {
4349
return next(ctx, tx, simulate)
4450
}
4551

@@ -127,7 +133,7 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
127133

128134
anteDecorators := []sdk.AnteDecorator{
129135
ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first
130-
NewMinCommissionDecorator(options.Cdc, options.IsSims),
136+
NewMinCommissionDecorator(options.Cdc),
131137
wasmkeeper.NewLimitSimulationGasDecorator(options.WasmConfig.SimulationGasLimit),
132138
wasmkeeper.NewCountTXDecorator(options.TxCounterStoreKey),
133139
ante.NewRejectExtensionOptionsDecorator(),

app/app.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,6 @@ func New(
313313
traceStore io.Writer,
314314
loadLatest bool,
315315
skipUpgradeHeights map[int64]bool,
316-
isSims bool,
317316
homePath string,
318317
invCheckPeriod uint,
319318
encodingConfig encparams.EncodingConfig,
@@ -666,7 +665,6 @@ func New(
666665
TxCounterStoreKey: keys[wasm.StoreKey],
667666
WasmConfig: wasmConfig,
668667
Cdc: appCodec,
669-
IsSims: isSims,
670668
},
671669
)
672670
if err != nil {

app/sim_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ func TestFullAppSimulation(t *testing.T) {
9494
require.NoError(t, os.RemoveAll(dir))
9595
}()
9696
encConf := MakeEncodingConfig()
97-
app := New(logger, db, nil, true, map[int64]bool{}, true, t.TempDir(), simapp.FlagPeriodValue, encConf,
97+
updateAppSimulationFlag(true)
98+
app := New(logger, db, nil, true, map[int64]bool{}, t.TempDir(), simapp.FlagPeriodValue, encConf,
9899
wasm.EnableAllProposals, simapp.EmptyAppOptions{}, nil, fauxMerkleModeOpt)
99100
require.Equal(t, "juno", app.Name())
100101

app/test_helpers.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ func setup(withGenesis bool, invCheckPeriod uint) (*App, GenesisState) {
128128
nil,
129129
true,
130130
map[int64]bool{},
131-
false,
132131
DefaultNodeHome,
133132
invCheckPeriod,
134133
encCdc,

cmd/junod/root.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ func (ac appCreator) newApp(
220220
wasmOpts = append(wasmOpts, wasmkeeper.WithVMCacheMetrics(prometheus.DefaultRegisterer))
221221
}
222222

223-
return app.New(logger, db, traceStore, true, skipUpgradeHeights, false,
223+
return app.New(logger, db, traceStore, true, skipUpgradeHeights,
224224
cast.ToString(appOpts.Get(flags.FlagHome)),
225225
cast.ToUint(appOpts.Get(server.FlagInvCheckPeriod)),
226226
ac.encCfg,
@@ -266,7 +266,6 @@ func (ac appCreator) appExport(
266266
traceStore,
267267
loadLatest,
268268
map[int64]bool{},
269-
false,
270269
homePath,
271270
cast.ToUint(appOpts.Get(server.FlagInvCheckPeriod)),
272271
ac.encCfg,

x/mint/keeper/integration_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ func genApp(withGenesis bool, invCheckPeriod uint) (*junoapp.App, junoapp.Genesi
5757
nil,
5858
true,
5959
map[int64]bool{},
60-
false,
6160
simapp.DefaultNodeHome,
6261
invCheckPeriod,
6362
encCdc,

x/mint/simulation/params_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func TestParamChangest(t *testing.T) {
1919
simValue string
2020
subspace string
2121
}{
22-
{"mint/BlocksPerYear", "BlocksPerYear", "\"6311520.000000000000000000\"", "mint"},
22+
{"mint/BlocksPerYear", "BlocksPerYear", "\"6311520\"", "mint"},
2323
}
2424

2525
paramChanges := simulation.ParamChanges(r)

0 commit comments

Comments
 (0)