From 07379eb387cb423cb25a2c3a8fee6139fe21da51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Tue, 12 Dec 2017 15:53:13 +0100 Subject: [PATCH] evmjit: Add REVERT and Byzantium rev --- core/vm/evmjit.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/vm/evmjit.go b/core/vm/evmjit.go index 2767a343d0..3271a86b52 100644 --- a/core/vm/evmjit.go +++ b/core/vm/evmjit.go @@ -423,6 +423,9 @@ func ptr(bytes []byte) *C.uint8_t { func getRevision(env *EVM) C.enum_evm_revision { n := env.BlockNumber + if env.ChainConfig().IsByzantium(n) { + return C.EVM_BYZANTIUM + } if env.ChainConfig().IsEIP158(n) { return C.EVM_SPURIOUS_DRAGON } @@ -482,7 +485,9 @@ func (evm *EVMJIT) Run(snapshot int, contract *Contract, input []byte) (ret []by // fmt.Printf("Gas left: %d\n", contract.Gas) output := C.GoBytes(unsafe.Pointer(r.output_data), C.int(r.output_size)) - if r.status_code != 0 { + if r.status_code == C.EVM_REVERT { + evm.env.StateDB.RevertToSnapshot(snapshot) + } else if r.status_code != C.EVM_SUCCESS { // EVMJIT does not informs about the kind of the EVM expection. err = ErrOutOfGas }