core/vm: cleanup

This commit is contained in:
Guillaume Ballet 2018-11-24 00:04:09 +01:00
parent ac29f81f80
commit ccec71b3ff
3 changed files with 5 additions and 3 deletions

View file

@ -412,7 +412,6 @@ func (evm *EVM) create(caller ContractRef, codeAndHash *codeAndHash, gas uint64,
evm.vmConfig.Tracer.CaptureStart(caller.Address(), address, true, codeAndHash.code, gas, value) evm.vmConfig.Tracer.CaptureStart(caller.Address(), address, true, codeAndHash.code, gas, value)
} }
start := time.Now() start := time.Now()
ret, err := run(evm, contract, nil, false) ret, err := run(evm, contract, nil, false)
/* The new contract needs to be metered after it has executed the constructor */ /* The new contract needs to be metered after it has executed the constructor */

View file

@ -162,7 +162,6 @@ func (in *InterpreterEWASM) CanRun(file []byte) bool {
} }
return true return true
} }
@ -242,7 +241,10 @@ func validateModule(m *wasm.Module) (int, error) {
// been run. It also validates the module's format before it is to // been run. It also validates the module's format before it is to
// be committed to disk. // be committed to disk.
func (in *InterpreterEWASM) PostContractCreation(code []byte) ([]byte, error) { func (in *InterpreterEWASM) PostContractCreation(code []byte) ([]byte, error) {
if in.CanRun(code) { // If a REVERT has been encountered, then return the code and
if in.terminationType == TerminateRevert {
return nil, errExecutionReverted
}
if in.metering { if in.metering {
code, _, err := sentinel(in, code) code, _, err := sentinel(in, code)
if len(code) < 5 || err != nil { if len(code) < 5 || err != nil {

View file

@ -791,6 +791,7 @@ func sentinel(in *InterpreterEWASM, input []byte) ([]byte, uint64, error) {
if err == nil { if err == nil {
asBytes = meteredCode.([]byte) asBytes = meteredCode.([]byte)
} }
return asBytes, savedContract.Gas - in.contract.Gas, err return asBytes, savedContract.Gas - in.contract.Gas, err
} }