Bump nim-evmc: add push raises: [] (#2051)
This commit is contained in:
parent
a02a915039
commit
d830692b72
|
@ -220,8 +220,10 @@ proc collapseLeaf(
|
|||
# the backend.
|
||||
let
|
||||
lfPath = hike.legsTo(hike.legs.len - 2, NibblesSeq) & lf.vtx.lPfx
|
||||
tag = lfPath.pathToTag.valueOr:
|
||||
return err((lf.vid,error))
|
||||
|
||||
lfPath.pathToTag.isOkOr:
|
||||
return err((lf.vid,error))
|
||||
|
||||
return ok()
|
||||
|
||||
of Extension: # (2) or (3)
|
||||
|
@ -242,8 +244,10 @@ proc collapseLeaf(
|
|||
# the backend.
|
||||
let
|
||||
lfPath = hike.legsTo(hike.legs.len - 3, NibblesSeq) & lf.vtx.lPfx
|
||||
tag = lfPath.pathToTag.valueOr:
|
||||
|
||||
lfPath.pathToTag.isOKOr:
|
||||
return err((lf.vid,error))
|
||||
|
||||
return ok()
|
||||
|
||||
# No grandparent, so ^3 is root vertex # (3)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Nimbus
|
||||
# Copyright (c) 2018-2023 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-2024 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
@ -60,6 +60,8 @@ proc execComputation*(c: Computation)
|
|||
c.postExecComputation()
|
||||
|
||||
template execSysCall*(c: Computation) =
|
||||
# A syscall to EVM doesn't require
|
||||
# a pre or post ceremony
|
||||
c.execCallOrCreate()
|
||||
|
||||
# FIXME-duplicatedForAsync
|
||||
|
|
|
@ -224,12 +224,7 @@ when defined(evmc_enabled):
|
|||
callResult.output_size.int))
|
||||
if not callResult.release.isNil:
|
||||
{.gcsafe.}:
|
||||
try:
|
||||
callResult.release(callResult)
|
||||
except Exception as e:
|
||||
{.warning: "Kludge(BareExcept): `evmc_release_fn` in vendor package needs to be updated"}
|
||||
raiseAssert "Ooops evmcExecComputation(): name=" &
|
||||
$e.name & " msg=" & e.msg
|
||||
callResult.release(callResult)
|
||||
|
||||
# FIXME-awkwardFactoring: the factoring out of the pre and
|
||||
# post parts feels awkward to me, but for now I'd really like
|
||||
|
|
|
@ -14,7 +14,7 @@ import
|
|||
evmc/evmc, ../config
|
||||
|
||||
# The built-in Nimbus EVM, via imported C function.
|
||||
proc evmc_create_nimbus_evm(): ptr evmc_vm {.cdecl, importc.}
|
||||
proc evmc_create_nimbus_evm(): ptr evmc_vm {.cdecl, importc, raises: [].}
|
||||
|
||||
# Import this module to link in the definition of `evmc_create_nimbus_evm`.
|
||||
# Nim thinks the module is unused because the function is only called via
|
||||
|
@ -83,21 +83,14 @@ proc evmcLoadVMGetCreateFn(): (evmc_create_vm_name_fn, string) =
|
|||
|
||||
return (cast[evmc_create_vm_name_fn](sym), path)
|
||||
|
||||
proc evmcLoadVMShowDetail(): ptr evmc_vm {.raises: [CatchableError].} =
|
||||
proc evmcLoadVMShowDetail(): ptr evmc_vm {.raises: [].} =
|
||||
let (vmCreate, vmDescription) = evmcLoadVMGetCreateFn()
|
||||
if vmCreate.isNil:
|
||||
return nil
|
||||
|
||||
var vm: ptr evmc_vm
|
||||
try:
|
||||
{.gcsafe.}:
|
||||
vm = vmCreate()
|
||||
except CatchableError as e:
|
||||
raise e
|
||||
except Exception as e:
|
||||
{.warning: "Kludge(BareExcept): `evmc_create_nimbus_evm()` in vendor package needs to be double checked and updated".}
|
||||
raiseAssert "Ooops evmcLoadVMShowDetail(): name=" &
|
||||
$e.name & " msg=" & e.msg
|
||||
{.gcsafe.}:
|
||||
vm = vmCreate()
|
||||
|
||||
if vm.isNil:
|
||||
warn "The loaded EVM did not create a VM when requested",
|
||||
|
|
|
@ -141,16 +141,11 @@ proc evmcExecComputation*(host: TransactionHost): EvmcResult
|
|||
# TODO: But wait: Why does the Nim EVMC test program compile fine without
|
||||
# any `gcsafe`, even with `--threads:on`?
|
||||
{.gcsafe.}:
|
||||
try:
|
||||
result = vm.execute(vm, hostInterface.unsafeAddr, hostContext,
|
||||
result = vm.execute(vm, hostInterface.unsafeAddr, hostContext,
|
||||
evmc_revision(host.vmState.fork.ord), host.msg,
|
||||
if host.code.len > 0: host.code[0].unsafeAddr
|
||||
else: nil,
|
||||
host.code.len.csize_t)
|
||||
except Exception as e:
|
||||
{.warning: "Kludge(BareExcept): `evmc_execute_fn` in vendor package needs to be updated".}
|
||||
raiseAssert "Ooops evmcExecComputation(): name=" &
|
||||
$e.name & " msg=" & e.msg
|
||||
|
||||
host.showCallReturn(result)
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Nimbus - Binary compatibility on the VM side of the EVMC API interface
|
||||
#
|
||||
# Copyright (c) 2019-2021 Status Research & Development GmbH
|
||||
# Copyright (c) 2019-2024 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
|
||||
# * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
|
||||
|
@ -19,7 +19,7 @@ proc evmcExecute(vm: ptr evmc_vm, hostInterface: ptr evmc_host_interface,
|
|||
hostContext: evmc_host_context, rev: evmc_revision,
|
||||
msg: var evmc_message, code: ptr byte,
|
||||
code_size: csize_t): evmc_result
|
||||
{.cdecl, raises: [CatchableError].} =
|
||||
{.cdecl, raises: [].} =
|
||||
# TODO: Obviously we are cheating here at the moment, knowing the caller type.
|
||||
# TODO: This lets the host read extra results needed for tests, but it
|
||||
# means the Nimbus EVM cannot be used by a non-Nimbus host, yet.
|
||||
|
@ -38,10 +38,13 @@ proc evmcExecute(vm: ptr evmc_vm, hostInterface: ptr evmc_host_interface,
|
|||
# host.computation = c
|
||||
|
||||
c.host.init(cast[ptr nimbus_host_interface](hostInterface), hostContext)
|
||||
if c.sysCall:
|
||||
execSysCall(c)
|
||||
else:
|
||||
execComputation(c)
|
||||
try:
|
||||
if c.sysCall:
|
||||
execSysCall(c)
|
||||
else:
|
||||
execComputation(c)
|
||||
except CatchableError as exc:
|
||||
c.setError(exc.msg)
|
||||
|
||||
# When output size is zero, output data pointer may be null.
|
||||
var output_data: ptr byte
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Nimbus
|
||||
# Copyright (c) 2022-2023 Status Research & Development GmbH
|
||||
# Copyright (c) 2022-2024 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
@ -130,7 +130,7 @@ proc runExecution(ctx: var StateContext, conf: StateConf, pre: JsonNode): StateR
|
|||
fork = com.toEVMFork(ctx.header.forkDeterminationInfo)
|
||||
stream = newFileStream(stderr)
|
||||
tracer = if conf.jsonEnabled:
|
||||
newJSonTracer(stream, ctx.tracerFlags, conf.pretty)
|
||||
newJsonTracer(stream, ctx.tracerFlags, conf.pretty)
|
||||
else:
|
||||
JsonTracer(nil)
|
||||
|
||||
|
@ -185,13 +185,13 @@ proc runExecution(ctx: var StateContext, conf: StateConf, pre: JsonNode): StateR
|
|||
echo "FATAL: ", ex.msg
|
||||
quit(QuitFailure)
|
||||
|
||||
proc toTracerFlags(conf: Stateconf): set[TracerFlags] =
|
||||
proc toTracerFlags(conf: StateConf): set[TracerFlags] =
|
||||
result = {
|
||||
TracerFlags.DisableStateDiff
|
||||
}
|
||||
|
||||
if conf.disableMemory : result.incl TracerFlags.DisableMemory
|
||||
if conf.disablestack : result.incl TracerFlags.DisableStack
|
||||
if conf.disableStack : result.incl TracerFlags.DisableStack
|
||||
if conf.disableReturnData: result.incl TracerFlags.DisableReturnData
|
||||
if conf.disableStorage : result.incl TracerFlags.DisableStorage
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Nimbus
|
||||
# Copyright (c) 2022-2023 Status Research & Development GmbH
|
||||
# Copyright (c) 2022-2024 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
@ -163,7 +163,7 @@ proc traceToFileStream(path: string, txIndex: int): Stream =
|
|||
fName = "$1/$2-$3.jsonl" % [file.dir, file.name, $txIndex]
|
||||
newFileStream(fName, fmWrite)
|
||||
|
||||
proc setupTrace(conf: T8NConf, txIndex: int, txHash: Hash256, vmState: BaseVMstate) =
|
||||
proc setupTrace(conf: T8NConf, txIndex: int, txHash: Hash256, vmState: BaseVMState) =
|
||||
var tracerFlags = {
|
||||
TracerFlags.DisableMemory,
|
||||
TracerFlags.DisableStorage,
|
||||
|
@ -187,7 +187,7 @@ proc setupTrace(conf: T8NConf, txIndex: int, txHash: Hash256, vmState: BaseVMsta
|
|||
defaultTraceStream(conf, txIndex, txHash)
|
||||
vmState.tracer = newJsonTracer(stream, tracerFlags, false)
|
||||
|
||||
proc closeTrace(vmState: BaseVMstate) =
|
||||
proc closeTrace(vmState: BaseVMState) =
|
||||
let tracer = JsonTracer(vmState.tracer)
|
||||
if tracer.isNil.not:
|
||||
tracer.close()
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 42cde520d383c7f4613bf710144727d40e9ae4b5
|
||||
Subproject commit 688a248f236c3f2254c79c7c39d7550a0cd8ab68
|
Loading…
Reference in New Issue