Bump chronos and other sub modules + related fixes (#1966)

* Bump chronos and additional modules + fixes

* Additional chronos bump + nim-eth bump for utp and discv5 fixes

* Fix the raw Exception errors in async evm

---------

Co-authored-by: jangko <jangko128@gmail.com>
This commit is contained in:
Kim De Mey 2024-01-12 22:06:19 +01:00 committed by GitHub
parent 3f4d3fef25
commit cbf5f59681
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 91 additions and 128 deletions

View File

@ -1,4 +1,4 @@
# Copyright (c) 2018-2023 Status Research & Development GmbH. Licensed under
# Copyright (c) 2018-2024 Status Research & Development GmbH. Licensed under
# either of:
# - Apache License, version 2.0
# - MIT license
@ -115,6 +115,7 @@ GIT_SUBMODULE_UPDATE := git -c submodule."vendor/nimbus-eth2".update=none submod
git submodule update --init vendor/eth2-networks; \
git submodule update --init vendor/holesky; \
git submodule update --init vendor/sepolia; \
git submodule update --init vendor/goerli; \
git submodule update --init vendor/gnosis-chain-configs; \
git submodule update --init --recursive vendor/nim-kzg4844; \
cd ../..

View File

@ -1,5 +1,5 @@
# Nimbus - Portal Network
# Copyright (c) 2022-2023 Status Research & Development GmbH
# Copyright (c) 2022-2024 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
@ -8,6 +8,7 @@
{.push raises: [].}
import
chronicles,
beacon_chain/networking/network_metadata,
beacon_chain/spec/forks,
beacon_chain/spec/datatypes/altair,
@ -38,7 +39,10 @@ proc loadNetworkData*(
except CatchableError as err:
raiseAssert "Invalid baked-in state: " & err.msg
beaconClock = BeaconClock.init(getStateField(genesisState[], genesis_time))
genesisTime = getStateField(genesisState[], genesis_time)
beaconClock = BeaconClock.init(genesisTime).valueOr:
error "Invalid genesis time in state", genesisTime
quit QuitFailure
genesis_validators_root =
getStateField(genesisState[], genesis_validators_root)

View File

@ -1,5 +1,5 @@
# Fluffy
# Copyright (c) 2021-2023 Status Research & Development GmbH
# Copyright (c) 2021-2024 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).

View File

@ -1,5 +1,5 @@
# Nimbus
# Copyright (c) 2023 Status Research & Development GmbH
# Copyright (c) 2023-2024 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
@ -389,7 +389,10 @@ proc run(config: BeaconBridgeConf) {.raises: [CatchableError].} =
except CatchableError as err:
raiseAssert "Invalid baked-in state: " & err.msg
beaconClock = BeaconClock.init(getStateField(genesisState[], genesis_time))
genesisTime = getStateField(genesisState[], genesis_time)
beaconClock = BeaconClock.init(genesisTime).valueOr:
error "Invalid genesis time in state", genesisTime
quit QuitFailure
getBeaconTime = beaconClock.getBeaconTimeFn()

View File

@ -1,5 +1,5 @@
# Nimbus
# Copyright (c) 2023 Status Research & Development GmbH
# Copyright (c) 2023-2024 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
@ -39,8 +39,10 @@ proc getBeaconData*(): (
forkDigests = newClone ForkDigests.init(
metadata.cfg, genesis_validators_root)
beaconClock = BeaconClock.init(getStateField(genesisState[], genesis_time))
genesisTime = getStateField(genesisState[], genesis_time)
beaconClock = BeaconClock.init(genesisTime).valueOr:
error "Invalid genesis time in state", genesisTime
quit QuitFailure
return (metadata.cfg, forkDigests, beaconClock)

View File

@ -1,5 +1,5 @@
# Fluffy
# Copyright (c) 2023 Status Research & Development GmbH
# Copyright (c) 2023-2024 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
@ -62,7 +62,7 @@ proc runBeacon(config: PortalBridgeConf) {.raises: [CatchableError].} =
portalRpcClient = newRpcHttpClient()
restClient = RestClientRef.new(config.restUrl).valueOr:
fatal "Cannot connect to server", error = $error
quit 1
quit QuitFailure
proc backfill(
beaconRestClient: RestClientRef, rpcAddress: string, rpcPort: Port,

View File

@ -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))
# * MIT license ([LICENSE-MIT](LICENSE-MIT))
@ -199,13 +199,13 @@ type
time*: Option[EthTime]
func countTimeFields(): int {.compileTime.} =
var z = Chainconfig()
var z = ChainConfig()
for name, _ in fieldPairs(z[]):
if name.endsWith("Time"):
inc result
func countBlockFields(): int {.compileTime.} =
var z = Chainconfig()
var z = ChainConfig()
for name, _ in fieldPairs(z[]):
if name == "mergeNetsplitBlock":
# skip mergeForkBlock alias
@ -219,7 +219,7 @@ const
blockFieldsCount = countBlockFields()
func collectTimeFields(): array[timeFieldsCount, string] =
var z = Chainconfig()
var z = ChainConfig()
var i = 0
for name, _ in fieldPairs(z[]):
if name.endsWith("Time"):
@ -227,7 +227,7 @@ func collectTimeFields(): array[timeFieldsCount, string] =
inc i
func collectBlockFields(): array[blockFieldsCount, string] =
var z = Chainconfig()
var z = ChainConfig()
var i = 0
for name, _ in fieldPairs(z[]):
if name == "mergeNetsplitBlock":

View File

@ -1,5 +1,5 @@
# Nimbus
# Copyright (c) 2023 Status Research & Development GmbH
# Copyright (c) 2023-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)
@ -17,10 +17,10 @@ import
type
AsyncDataSource* = ref object of RootObj
ifNecessaryGetSlots*: proc(db: CoreDbRef, blockNumber: BlockNumber, stateRoot: Hash256, address: EthAddress, slots: seq[UInt256], newStateRootForSanityChecking: Hash256): Future[void] {.gcsafe.}
ifNecessaryGetCode*: proc(db: CoreDbRef, blockNumber: BlockNumber, stateRoot: Hash256, address: EthAddress, newStateRootForSanityChecking: Hash256): Future[void] {.gcsafe.}
ifNecessaryGetAccount*: proc(db: CoreDbRef, blockNumber: BlockNumber, stateRoot: Hash256, address: EthAddress, newStateRootForSanityChecking: Hash256): Future[void] {.gcsafe.}
ifNecessaryGetBlockHeaderByNumber*: proc(coreDb: CoreDbRef, blockNumber: BlockNumber): Future[void] {.gcsafe.}
ifNecessaryGetSlots*: proc(db: CoreDbRef, blockNumber: BlockNumber, stateRoot: Hash256, address: EthAddress, slots: seq[UInt256], newStateRootForSanityChecking: Hash256): Future[void] {.gcsafe, raises: [].}
ifNecessaryGetCode*: proc(db: CoreDbRef, blockNumber: BlockNumber, stateRoot: Hash256, address: EthAddress, newStateRootForSanityChecking: Hash256): Future[void] {.gcsafe, raises: [].}
ifNecessaryGetAccount*: proc(db: CoreDbRef, blockNumber: BlockNumber, stateRoot: Hash256, address: EthAddress, newStateRootForSanityChecking: Hash256): Future[void] {.gcsafe, raises: [].}
ifNecessaryGetBlockHeaderByNumber*: proc(coreDb: CoreDbRef, blockNumber: BlockNumber): Future[void] {.gcsafe, raises: [].}
# FIXME-Adam: Later.
#fetchNodes*: proc(stateRoot: Hash256, paths: seq[seq[seq[byte]]], nodeHashes: seq[Hash256]): Future[seq[seq[byte]]] {.gcsafe.}
fetchBlockHeaderWithHash*: proc(h: Hash256): Future[BlockHeader] {.gcsafe.}
@ -50,6 +50,7 @@ proc ifNecessaryGetCode*(asyncFactory: AsyncOperationFactory, db: CoreDbRef, blo
if asyncFactory.maybeDataSource.isSome:
await asyncFactory.maybeDataSource.get.ifNecessaryGetCode(db, blockNumber, stateRoot, address, newStateRootForSanityChecking)
proc ifNecessaryGetAccount*(asyncFactory: AsyncOperationFactory, db: CoreDbRef, blockNumber: BlockNumber, stateRoot: Hash256, address: EthAddress, newStateRootForSanityChecking: Hash256): Future[void] {.async.} =
if asyncFactory.maybeDataSource.isSome:
await asyncFactory.maybeDataSource.get.ifNecessaryGetAccount(db, blockNumber, stateRoot, address, newStateRootForSanityChecking)

View File

@ -1,5 +1,5 @@
# Nimbus
# Copyright (c) 2023 Status Research & Development GmbH
# Copyright (c) 2023-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)
@ -186,7 +186,7 @@ proc fetchUsingGetNodeData(peer: Peer, nodeHashes: seq[common.Hash256]): Future[
# AARDVARK whatever
return @[]
proc findPeersAndMakeSomeCalls[R](peerPool: PeerPool, protocolName: string, protocolType: typedesc, initiateAttempt: (proc(p: Peer): Future[R] {.gcsafe.})): Future[seq[Future[R]]] {.async.} =
proc findPeersAndMakeSomeCalls[R](peerPool: PeerPool, protocolName: string, protocolType: typedesc, initiateAttempt: (proc(p: Peer): Future[R] {.gcsafe, raises: [].})): Future[seq[Future[R]]] {.async.} =
var attempts: seq[Future[R]]
while true:
#info("AARDVARK: findPeersAndMakeSomeCalls about to loop through the peer pool", count=peerPool.connectedNodes.len)

View File

@ -1,5 +1,5 @@
# nim-graphql
# Copyright (c) 2021 Status Research & Development GmbH
# Copyright (c) 2021-2024 Status Research & Development GmbH
# Licensed under either of
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
# * MIT license ([LICENSE-MIT](LICENSE-MIT))
@ -74,15 +74,14 @@ type
ethNode: EthereumNode
txPool: TxPoolRef
when (NimMajor, NimMinor, NimPatch) >= (1, 6, 0):
{.push hint[XCannotRaiseY]: off.}
else:
{.push hint[XDeclaredButNotUsed]: off.}
{.push gcsafe, raises: [].}
{.pragma: apiRaises, raises: [].}
{.pragma: apiPragma, cdecl, gcsafe, apiRaises, locks:0.}
proc toHash(n: Node): Hash256 =
proc toHash(n: Node): Hash256 {.gcsafe, raises: [ValueError].} =
result.data = hexToByteArray[32](n.stringVal)
proc toBlockNumber(n: Node): BlockNumber =
proc toBlockNumber(n: Node): BlockNumber {.gcsafe, raises: [ValueError].} =
if n.kind == nkInt:
result = parse(n.intVal, UInt256, radix = 10)
elif n.kind == nkString:
@ -331,10 +330,10 @@ proc getTxAt(ctx: GraphqlContextRef, header: BlockHeader, index: int): RespResul
ok(txn)
else:
ok(respNull())
except CatchableError as e:
err("can't get transaction by index '$1': $2" % [$index, e.msg])
except RlpError as em:
err("can't get transaction by index '$1': $2" % [$index, em.msg])
except CatchableError as exc:
err("can't get transaction by index '" & $index & "': " & exc.msg)
except RlpError as exc:
err("can't get transaction by index '" & $index & "': " & exc.msg)
proc getTxByHash(ctx: GraphqlContextRef, hash: Hash256): RespResult =
try:
@ -342,7 +341,7 @@ proc getTxByHash(ctx: GraphqlContextRef, hash: Hash256): RespResult =
let header = getBlockHeader(ctx.chainDB, blockNumber)
getTxAt(ctx, header, index)
except CatchableError as e:
err("can't get transaction by hash '$1': $2" % [hash.data.toHex, e.msg])
err("can't get transaction by hash '" & hash.data.toHex & "': $2" & e.msg)
proc accountNode(ctx: GraphqlContextRef, header: BlockHeader, address: EthAddress): RespResult =
try:
@ -377,16 +376,12 @@ proc parseU64(node: Node): uint64 =
for c in node.intVal:
result = result * 10 + (c.uint64 - '0'.uint64)
{.pragma: apiRaises, raises: [].}
{.pragma: apiPragma, cdecl, gcsafe, apiRaises, locks:0.}
{.push hint[XDeclaredButNotUsed]: off.}
proc validateHex(x: Node, minLen = 0): NodeResult =
if x.stringVal.len < 2:
return err("hex is too short")
if x.stringVal.len != 2 + minLen * 2 and minLen != 0:
return err("expect hex with len '$1', got '$2'" % [$(2 * minLen + 2), $x.stringVal.len])
return err("expect hex with len '" &
$(2 * minLen + 2) & "', got '" & $x.stringVal.len & "'")
if x.stringVal.len mod 2 != 0:
return err("hex must have even number of nibbles")
if x.stringVal[0] != '0' or x.stringVal[1] != 'x':
@ -419,51 +414,54 @@ proc validateFixedLenHex(x: Node, minLen: int, kind: string, padding = false): N
if x.stringVal.len < 2:
return err(kind & " hex is too short")
var prefixLen = 0
if x.stringVal[0] == '0' and x.stringVal[1] == 'x':
prefixLen = 2
try:
var prefixLen = 0
if x.stringVal[0] == '0' and x.stringVal[1] == 'x':
prefixLen = 2
let expectedLen = minLen * 2 + prefixLen
if x.stringVal.len < expectedLen:
if not padding:
return err("$1 len is too short: expect $2 got $3" %
let expectedLen = minLen * 2 + prefixLen
if x.stringVal.len < expectedLen:
if not padding:
return err("$1 len is too short: expect $2 got $3" %
[kind, $expectedLen, $x.stringVal.len])
else:
padBytes(x, prefixLen, minLen * 2)
elif x.stringVal.len > expectedLen:
return err("$1 len is too long: expect $2 got $3" %
[kind, $expectedLen, $x.stringVal.len])
else:
padBytes(x, prefixLen, minLen * 2)
elif x.stringVal.len > expectedLen:
return err("$1 len is too long: expect $2 got $3" %
[kind, $expectedLen, $x.stringVal.len])
for i in prefixLen..<x.stringVal.len:
if x.stringVal[i] notin HexDigits:
return err("invalid chars in $1 hex" % [kind])
for i in prefixLen..<x.stringVal.len:
if x.stringVal[i] notin HexDigits:
return err("invalid chars in $1 hex" % [kind])
ok(x)
ok(x)
except ValueError as exc:
err(exc.msg)
proc scalarBytes32(ctx: GraphqlRef, typeNode, node: Node): NodeResult {.cdecl, gcsafe, noSideEffect.} =
proc scalarBytes32(ctx: GraphqlRef, typeNode, node: Node): NodeResult {.cdecl, gcsafe, noSideEffect, raises:[].} =
## Bytes32 is a 32 byte binary string,
## represented as 0x-prefixed hexadecimal.
if node.kind != nkString:
return err("expect hex string, but got '$1'" % [$node.kind])
return err("expect hex string, but got '" & $node.kind & "'")
validateFixedLenHex(node, 32, "Bytes32", padding = true)
proc scalarAddress(ctx: GraphqlRef, typeNode, node: Node): NodeResult {.cdecl, gcsafe, noSideEffect.} =
proc scalarAddress(ctx: GraphqlRef, typeNode, node: Node): NodeResult {.cdecl, gcsafe, noSideEffect, raises:[].} =
## Address is a 20 byte Ethereum address,
## represented as 0x-prefixed hexadecimal.
if node.kind != nkString:
return err("expect hex string, but got '$1'" % [$node.kind])
return err("expect hex string, but got '" & $node.kind & "'")
validateFixedLenHex(node, 20, "Address")
proc scalarBytes(ctx: GraphqlRef, typeNode, node: Node): NodeResult {.cdecl, gcsafe, noSideEffect.} =
proc scalarBytes(ctx: GraphqlRef, typeNode, node: Node): NodeResult {.cdecl, gcsafe, noSideEffect, raises:[].} =
## Bytes is an arbitrary length binary string,
## represented as 0x-prefixed hexadecimal.
## An empty byte string is represented as '0x'.
## Byte strings must have an even number of hexadecimal nybbles.
if node.kind != nkString:
return err("expect hex string, but got '$1'" % [$node.kind])
return err("expect hex string, but got '" & $node.kind & "'")
validateHex(node)
proc scalarBigInt(ctx: GraphqlRef, typeNode, node: Node): NodeResult {.cdecl, gcsafe, noSideEffect.} =
proc scalarBigInt(ctx: GraphqlRef, typeNode, node: Node): NodeResult {.cdecl, gcsafe, noSideEffect, raises:[].} =
## BigInt is a large integer. Input is accepted as
## either a JSON number or as a string.
## Strings may be either decimal or 0x-prefixed hexadecimal.
@ -498,7 +496,7 @@ proc scalarBigInt(ctx: GraphqlRef, typeNode, node: Node): NodeResult {.cdecl, gc
node.stringVal = "0x" & val.toHex
ok(node)
else:
return err("expect hex/dec string or int, but got '$1'" % [$node.kind])
return err("expect hex/dec string or int, but got '" & $node.kind & "'")
except CatchableError as e:
err("scalar BigInt error: " & e.msg)
@ -524,27 +522,23 @@ proc scalarLong(ctx: GraphqlRef, typeNode, node: Node): NodeResult {.cdecl, gcsa
return err("long value overflow")
ok(Node(kind: nkString, pos: node.pos, stringVal: "0x" & val.toHex))
else:
err("expect int, but got '$1'" % [$node.kind])
err("expect int, but got '" & $node.kind & "'")
except CatchableError as e:
err("scalar Long error: " & e.msg)
proc accountAddress(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
let acc = AccountNode(parent)
resp(acc.address)
proc accountBalance(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
let acc = AccountNode(parent)
bigIntNode(acc.account.balance)
proc accountTxCount(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
let acc = AccountNode(parent)
longNode(acc.account.nonce)
proc accountCode(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
let acc = AccountNode(parent)
try:
let code = acc.db.getCode(acc.address)
@ -553,7 +547,6 @@ proc accountCode(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragm
err(ex.msg)
proc accountStorage(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
let acc = AccountNode(parent)
try:
let slot = parse(params[0].val.stringVal, UInt256, radix = 16)
@ -575,7 +568,6 @@ const accountProcs = {
}
proc logIndex(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
let log = LogNode(parent)
ok(resp(log.index))
@ -591,7 +583,6 @@ proc logAccount(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma
ctx.accountNode(h.header, log.log.address)
proc logTopics(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
let log = LogNode(parent)
var list = respList()
for n in log.log.topics:
@ -599,12 +590,10 @@ proc logTopics(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.
ok(list)
proc logData(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
let log = LogNode(parent)
resp(log.log.data)
proc logTransaction(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
let log = LogNode(parent)
ok(cast[Node](log.tx))
@ -623,12 +612,10 @@ proc txHash(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
resp(txHash)
proc txNonce(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
let tx = TxNode(parent)
longNode(tx.tx.nonce)
proc txIndex(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
let tx = TxNode(parent)
ok(resp(tx.index))
@ -668,7 +655,6 @@ proc txTo(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
ctx.accountNode(h.header, tx.tx.to.get())
proc txValue(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
let tx = TxNode(parent)
bigIntNode(tx.tx.value)
@ -715,12 +701,10 @@ proc txChainId(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.
longNode(tx.tx.chainId.uint64)
proc txGas(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
let tx = TxNode(parent)
longNode(tx.tx.gasLimit)
proc txInputData(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
let tx = TxNode(parent)
resp(tx.tx.payload)
@ -730,7 +714,6 @@ proc txBlock(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.}
ctx.getBlockByNumber(tx.blockNumber)
proc txStatus(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
let tx = TxNode(parent)
if tx.receipt.hasStatus:
longNode(tx.receipt.status.uint64)
@ -738,12 +721,10 @@ proc txStatus(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.}
ok(respNull())
proc txGasUsed(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
let tx = TxNode(parent)
longNode(tx.gasUsed)
proc txCumulativeGasUsed(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
let tx = TxNode(parent)
longNode(tx.receipt.cumulativeGasUsed)
@ -761,7 +742,6 @@ proc txCreatedContract(ud: RootRef, params: Args, parent: Node): RespResult {.ap
if hres.isErr:
return hres
let h = HeaderNode(hres.get())
let db = getStateDB(ctx.com, h.header)
let contractAddress = generateAddress(sender, tx.tx.nonce)
ctx.accountNode(h.header, contractAddress)
@ -802,7 +782,6 @@ proc txAccessList(ud: RootRef, params: Args, parent: Node): RespResult {.apiPrag
ok(list)
proc txMaxFeePerBlobGas(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
let tx = TxNode(parent)
if tx.tx.txType < TxEIP4844:
ok(respNull())
@ -810,7 +789,6 @@ proc txMaxFeePerBlobGas(ud: RootRef, params: Args, parent: Node): RespResult {.a
longNode(tx.tx.maxFeePerBlobGas)
proc txVersionedHashes(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
let tx = TxNode(parent)
if tx.tx.txType < TxEIP4844:
ok(respNull())
@ -904,12 +882,10 @@ const wdProcs = {
}
proc blockNumberImpl(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
let h = HeaderNode(parent)
longNode(h.header.blockNumber)
proc blockHashImpl(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
let h = HeaderNode(parent)
let hash = blockHash(h.header)
resp(hash)
@ -920,12 +896,10 @@ proc blockParent(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragm
getBlockByHash(ctx, h.header.parentHash)
proc blockNonce(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
let h = HeaderNode(parent)
ok(resp("0x" & h.header.nonce.toHex))
proc blockTransactionsRoot(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
let h = HeaderNode(parent)
resp(h.header.txRoot)
@ -935,12 +909,10 @@ proc blockTransactionCount(ud: RootRef, params: Args, parent: Node): RespResult
ctx.getTxCount(h.header.txRoot)
proc blockStateRoot(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
let h = HeaderNode(parent)
resp(h.header.stateRoot)
proc blockReceiptsRoot(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
let h = HeaderNode(parent)
resp(h.header.receiptRoot)
@ -950,37 +922,30 @@ proc blockMiner(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma
ctx.accountNode(h.header, h.header.coinbase)
proc blockExtraData(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
let h = HeaderNode(parent)
resp(h.header.extraData)
proc blockGasLimit(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
let h = HeaderNode(parent)
longNode(h.header.gasLimit)
proc blockGasUsed(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
let h = HeaderNode(parent)
longNode(h.header.gasUsed)
proc blockTimestamp(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
let h = HeaderNode(parent)
bigIntNode(h.header.timestamp.uint64)
proc blockLogsBloom(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
let h = HeaderNode(parent)
resp(h.header.bloom)
proc blockMixHash(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
let h = HeaderNode(parent)
resp(h.header.mixDigest)
proc blockDifficulty(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
let h = HeaderNode(parent)
bigIntNode(h.header.difficulty)
@ -1007,7 +972,6 @@ proc blockOmmerAt(ud: RootRef, params: Args, parent: Node): RespResult {.apiPrag
getOmmerAt(ctx, h.header.ommersHash, index.int)
proc blockOmmerHash(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
let h = HeaderNode(parent)
resp(h.header.ommersHash)
@ -1028,7 +992,6 @@ proc blockTransactionAt(ud: RootRef, params: Args, parent: Node): RespResult {.a
err(ex.msg)
proc blockLogs(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
# TODO: stub, missing impl
err("not implemented")
@ -1082,7 +1045,7 @@ template optionalBytes(dstField: untyped, n: Node, field: int) =
if isSome(n, field):
dstField = hexToSeqByte(fieldString(n, field))
proc toCallData(n: Node): RpcCallData =
proc toCallData(n: Node): RpcCallData {.gcsafe, raises: [ValueError].} =
optionalAddress(result.source, n, fFrom)
optionalAddress(result.to, n, fTo)
optionalGasInt(result.gasLimit, n, fGasLimit)
@ -1093,7 +1056,7 @@ proc toCallData(n: Node): RpcCallData =
optionalBytes(result.data, n, fData)
proc makeCall(ctx: GraphqlContextRef, callData: RpcCallData,
header: BlockHeader): RespResult =
header: BlockHeader): RespResult {.gcsafe, raises: [CatchableError].} =
let res = rpcCallEvm(callData, header, ctx.com)
var map = respMap(ctx.ids[ethCallResult])
map["data"] = resp("0x" & res.output.toHex)
@ -1203,15 +1166,12 @@ const blockProcs = {
}
proc callResultData(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
ok(parent.map[0].val)
proc callResultGasUsed(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
ok(parent.map[1].val)
proc callResultStatus(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
ok(parent.map[2].val)
const callResultProcs = {
@ -1234,12 +1194,10 @@ proc syncStateHighestBlock(ud: RootRef, params: Args, parent: Node): RespResult
proc syncStatePulledStates(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
# TODO: what is this ?
let ctx = GraphqlContextRef(ud)
ok(respNull())
proc syncStateKnownStates(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
# TODO: what is this ?
let ctx = GraphqlContextRef(ud)
ok(respNull())
const syncStateProcs = {
@ -1251,27 +1209,22 @@ const syncStateProcs = {
}
proc pendingTransactionCount(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
# TODO: stub, missing impl
err("not implemented")
proc pendingTransactions(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
# TODO: stub, missing impl
err("not implemented")
proc pendingAccount(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
# TODO: stub, missing impl
err("not implemented")
proc pendingCall(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
# TODO: stub, missing impl
err("not implemented")
proc pendingEstimateGas(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
# TODO: stub, missing impl
err("not implemented")
@ -1349,7 +1302,6 @@ proc queryBlocks(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragm
ok(list)
proc queryPending(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
# TODO: stub, missing impl
err("not implemented")
@ -1363,7 +1315,6 @@ proc queryTransaction(ud: RootRef, params: Args, parent: Node): RespResult {.api
err(ex.msg)
proc queryLogs(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
# TODO: stub, missing impl
err("not implemented")
@ -1431,8 +1382,6 @@ const mutationProcs = {
"sendRawTransaction": sendRawTransaction
}
{.pop.}
const
ethSchema = staticRead("ethapi.ql")

View File

@ -1,5 +1,5 @@
# nimbus_verified_proxy
# Copyright (c) 2022-2023 Status Research & Development GmbH
# Copyright (c) 2022-2024 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
@ -66,7 +66,10 @@ proc run(config: VerifiedProxyConf) {.raises: [CatchableError].} =
except CatchableError as err:
raiseAssert "Invalid baked-in state: " & err.msg
beaconClock = BeaconClock.init(getStateField(genesisState[], genesis_time))
genesistime = getStateField(genesisState[], genesis_time)
beaconClock = BeaconClock.init(genesisTime).valueOr:
error "Invalid genesis time in state", genesisTime
quit QuitFailure
getBeaconTime = beaconClock.getBeaconTimeFn()

2
vendor/nim-chronos vendored

@ -1 +1 @@
Subproject commit 253bc3cfc079de35f9b96b9934ce702605400a51
Subproject commit 92acf68b04070dfe8eb65bab71fbf63804979a16

2
vendor/nim-eth vendored

@ -1 +1 @@
Subproject commit e5c2b1784ec7badc6162325e37daee2229f53d8b
Subproject commit cbcd1fd307fe997189a3ee5580641955356856bf

2
vendor/nim-graphql vendored

@ -1 +1 @@
Subproject commit 07f238bd05f966a3ca4aa5c16c108fc7ecd07ed0
Subproject commit b517fdc433d1e082f866e8f9ac2f2852f5cedf5d

@ -1 +1 @@
Subproject commit 87b7cbf032c90b9e6b446081f4a647e950362cec
Subproject commit 77a59297ad635d91a6352ef48ee09c6bde0c5d86

2
vendor/nim-libp2p vendored

@ -1 +1 @@
Subproject commit 60f953629d725c061f4c0c7ffe79f506efaad7be
Subproject commit e3c967ad1939fb33b8e13759037d193734acd202

2
vendor/nim-results vendored

@ -1 +1 @@
Subproject commit f3c666a272c69d70cb41e7245e7f6844797303ad
Subproject commit 113d433f48894ee8e7da3e340c8fe19ad7b9db4d

2
vendor/nim-stew vendored

@ -1 +1 @@
Subproject commit 422b6e1435d1a668f2a2bb1ac98ccfaedd0bafd5
Subproject commit 2c2544aec13536304438be045bfdd22452741466

2
vendor/nim-web3 vendored

@ -1 +1 @@
Subproject commit df0af1aca64f6a1a9a76c92776ce2b2ee0c6bfec
Subproject commit be1bb307dc40afb329e559eda601b74f9ab476d5

2
vendor/nimbus-eth2 vendored

@ -1 +1 @@
Subproject commit 7b6ba48dd98dfc1644b101cc85e0592fa7f16d80
Subproject commit d2d1a9393658c9ea5b56b81335f3d2bf34822591