mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 09:23:48 +00:00
evmjit: Add REVERT and Byzantium rev
This commit is contained in:
parent
6a0df901d1
commit
07379eb387
1 changed files with 6 additions and 1 deletions
|
|
@ -423,6 +423,9 @@ func ptr(bytes []byte) *C.uint8_t {
|
||||||
|
|
||||||
func getRevision(env *EVM) C.enum_evm_revision {
|
func getRevision(env *EVM) C.enum_evm_revision {
|
||||||
n := env.BlockNumber
|
n := env.BlockNumber
|
||||||
|
if env.ChainConfig().IsByzantium(n) {
|
||||||
|
return C.EVM_BYZANTIUM
|
||||||
|
}
|
||||||
if env.ChainConfig().IsEIP158(n) {
|
if env.ChainConfig().IsEIP158(n) {
|
||||||
return C.EVM_SPURIOUS_DRAGON
|
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)
|
// fmt.Printf("Gas left: %d\n", contract.Gas)
|
||||||
output := C.GoBytes(unsafe.Pointer(r.output_data), C.int(r.output_size))
|
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.
|
// EVMJIT does not informs about the kind of the EVM expection.
|
||||||
err = ErrOutOfGas
|
err = ErrOutOfGas
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue