Skip to content

Commit

Permalink
update simulation test
Browse files Browse the repository at this point in the history
  • Loading branch information
avery committed Dec 19, 2024
1 parent 8ebfe3c commit f2c606d
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 16 deletions.
2 changes: 0 additions & 2 deletions app/ante/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ func NewAnteHandler(options HandlerOptions) sdk.AnteHandler {

defer ethante.Recover(ctx.Logger(), &err)

sim = options.Simulation

txWithExtensions, ok := tx.(authante.HasExtensionOptionsTx)
if ok {
opts := txWithExtensions.GetExtensionOptions()
Expand Down
12 changes: 8 additions & 4 deletions app/ante/decorators.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,15 @@ func (vtd ValidateTokenDecorator) AnteHandle(
}

// ValidateServiceDecorator is responsible for checking the permission to execute MsgCallService
type ValidateServiceDecorator struct{}
type ValidateServiceDecorator struct {
SimulateTest bool
}

// NewValidateServiceDecorator returns an instance of ServiceAuthDecorator
func NewValidateServiceDecorator() ValidateServiceDecorator {
return ValidateServiceDecorator{}
func NewValidateServiceDecorator(simulateTest bool) ValidateServiceDecorator {
return ValidateServiceDecorator{
SimulateTest: simulateTest,
}
}

// AnteHandle checks the transaction
Expand All @@ -77,7 +81,7 @@ func (vsd ValidateServiceDecorator) AnteHandle(
simulate bool,
next sdk.AnteHandler,
) (sdk.Context, error) {
if simulate {
if vsd.SimulateTest {
return next(ctx, tx, simulate)
}

Expand Down
4 changes: 2 additions & 2 deletions app/ante/handler_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type HandlerOptions struct {
FeeMarketKeeper ethante.FeeMarketKeeper
BypassMinFeeMsgTypes []string
MaxTxGasWanted uint64
Simulation bool
SimulationTest bool
}

// newCosmosAnteHandler creates the default ante handler for Ethereum transactions
Expand Down Expand Up @@ -86,7 +86,7 @@ func newCosmosAnteHandler(options HandlerOptions) sdk.AnteHandler {
NewValidateTokenDecorator(options.TokenKeeper),
tokenkeeper.NewValidateTokenFeeDecorator(options.TokenKeeper, options.BankKeeper),
oraclekeeper.NewValidateOracleAuthDecorator(options.OracleKeeper, options.GuardianKeeper),
NewValidateServiceDecorator(),
NewValidateServiceDecorator(options.SimulationTest),
ante.NewIncrementSequenceDecorator(options.AccountKeeper),
ibcante.NewRedundantRelayDecorator(options.IBCKeeper),
)
Expand Down
8 changes: 4 additions & 4 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,10 @@ func NewIrisApp(

maxGasWanted := cast.ToUint64(appOpts.Get(srvflags.EVMMaxTxGasWanted))

simulation := false
opt = appOpts.Get(params.Simulation)
simulationTest := false
opt = appOpts.Get(params.SimulationTest)
if opt, ok := opt.(bool); ok {
simulation = opt
simulationTest = opt
}

anteHandler := irishubante.NewAnteHandler(
Expand All @@ -202,7 +202,7 @@ func NewIrisApp(
FeeMarketKeeper: app.FeeMarketKeeper,
BypassMinFeeMsgTypes: []string{},
MaxTxGasWanted: maxGasWanted,
Simulation: simulation,
SimulationTest: simulationTest,
},
)

Expand Down
2 changes: 1 addition & 1 deletion app/params/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ package params
const (
StakePerAccount = "stake_per_account"
InitiallyBondedValidators = "initially_bonded_validators"
Simulation = "simulation"
SimulationTest = "simulation_test"
)
4 changes: 2 additions & 2 deletions app/sim_bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func BenchmarkFullAppSimulation(b *testing.B) {
true,
encfg,
SimTestAppOptions{
options: map[string]interface{}{params.Simulation: true},
options: map[string]interface{}{params.SimulationTest: true},
},
interBlockCacheOpt(),
)
Expand Down Expand Up @@ -123,7 +123,7 @@ func BenchmarkInvariants(b *testing.B) {
true,
encfg,
SimTestAppOptions{
options: map[string]interface{}{params.Simulation: true},
options: map[string]interface{}{params.SimulationTest: true},
},
interBlockCacheOpt(),
)
Expand Down
2 changes: 1 addition & 1 deletion app/sim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ func createApp(
true,
encodingConfig,
SimTestAppOptions{
options: map[string]interface{}{params.Simulation: true},
options: map[string]interface{}{params.SimulationTest: true},
},
baseAppOptions...,
)
Expand Down

0 comments on commit f2c606d

Please sign in to comment.