mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
core/vm: cleanup
This commit is contained in:
parent
ac29f81f80
commit
ccec71b3ff
3 changed files with 5 additions and 3 deletions
|
|
@ -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)
|
||||
}
|
||||
start := time.Now()
|
||||
|
||||
ret, err := run(evm, contract, nil, false)
|
||||
|
||||
/* The new contract needs to be metered after it has executed the constructor */
|
||||
|
|
|
|||
|
|
@ -162,7 +162,6 @@ func (in *InterpreterEWASM) CanRun(file []byte) bool {
|
|||
}
|
||||
|
||||
|
||||
|
||||
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
|
||||
// be committed to disk.
|
||||
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 {
|
||||
code, _, err := sentinel(in, code)
|
||||
if len(code) < 5 || err != nil {
|
||||
|
|
|
|||
|
|
@ -791,6 +791,7 @@ func sentinel(in *InterpreterEWASM, input []byte) ([]byte, uint64, error) {
|
|||
if err == nil {
|
||||
asBytes = meteredCode.([]byte)
|
||||
}
|
||||
|
||||
return asBytes, savedContract.Gas - in.contract.Gas, err
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue