From bd910084629903110d5eb5301f4b3f3065394a9f Mon Sep 17 00:00:00 2001 From: frrist Date: Fri, 28 Feb 2020 15:18:37 -0800 Subject: [PATCH] clean up validation config --- chain/validation/config.go | 19 +++++++++++++------ chain/validation/factories.go | 10 +++++----- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/chain/validation/config.go b/chain/validation/config.go index ef6b018f2..2a8667da1 100644 --- a/chain/validation/config.go +++ b/chain/validation/config.go @@ -1,24 +1,31 @@ package validation // -// ValidationConfig +// Config // -type ValidationConfig struct { +type Config struct { trackGas bool checkExitCode bool checkReturnValue bool } -func (v ValidationConfig) ValidateGas() bool { +func NewConfig(gas, exit, ret bool) *Config { + return &Config{ + trackGas: gas, + checkExitCode: exit, + checkReturnValue: ret, + } +} + +func (v Config) ValidateGas() bool { return v.trackGas } -func (v ValidationConfig) ValidateExitCode() bool { +func (v Config) ValidateExitCode() bool { return v.checkExitCode } -func (v ValidationConfig) ValidateReturnValue() bool { +func (v Config) ValidateReturnValue() bool { return v.checkReturnValue } - diff --git a/chain/validation/factories.go b/chain/validation/factories.go index 86a016e2a..71713c7bc 100644 --- a/chain/validation/factories.go +++ b/chain/validation/factories.go @@ -39,9 +39,9 @@ func (f *Factories) NewRandomnessSource() vstate.RandomnessSource { } func (f *Factories) NewValidationConfig() vstate.ValidationConfig { - return &ValidationConfig{ - trackGas: false, - checkExitCode: true, - checkReturnValue: false, - } + trackGas := false + checkExit := true + checkRet := false + // ignore gas and return value assertions + return NewConfig(trackGas, checkExit, checkRet) }