bump submodules and accompanying fixes

This commit is contained in:
jangko 2023-04-17 15:22:51 +07:00
parent 0a3bc102eb
commit b378e19892
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9
17 changed files with 80 additions and 49 deletions

View File

@ -14,11 +14,13 @@ import
eth/p2p/rlpx,
eth/p2p/private/p2p_types,
../../../sync/protocol,
../../../sync/protocol/eth66 as proto_eth66,
../../../db/[db_chain, distinct_tries, incomplete_db, storage_types],
../data_sources
from ../../../sync/protocol/eth66 import getNodeData
when defined(legacy_eth66_enabled):
import
../../../sync/protocol/eth66 as proto_eth66
from ../../../sync/protocol/eth66 import getNodeData
from ../../../rpc/rpc_utils import toHash
from web3 import Web3, BlockHash, BlockObject, FixedBytes, Address, ProofResponse, StorageProof, newWeb3, fromJson, fromHex, eth_getBlockByHash, eth_getBlockByNumber, eth_getCode, eth_getProof, blockId, `%`

View File

@ -305,7 +305,7 @@ proc getTxAt(ctx: GraphqlContextRef, header: BlockHeader, index: int): RespResul
ok(respNull())
except CatchableError as e:
err("can't get transaction by index '$1': $2" % [$index, e.msg])
except Exception as em:
except RlpError as em:
err("can't get transaction by index '$1': $2" % [$index, em.msg])
proc getTxByHash(ctx: GraphqlContextRef, hash: Hash256): RespResult =
@ -319,6 +319,7 @@ proc getTxByHash(ctx: GraphqlContextRef, hash: Hash256): RespResult =
err("can't get transaction by hash '$1': $2" % [hash.data.toHex, em.msg])
proc accountNode(ctx: GraphqlContextRef, header: BlockHeader, address: EthAddress): RespResult =
try:
let db = getStateDB(ctx.com, header)
when false:
# EIP 1767 unclear about non existent account
@ -327,12 +328,19 @@ proc accountNode(ctx: GraphqlContextRef, header: BlockHeader, address: EthAddres
return ok(respNull())
let acc = db.getAccount(address)
ok(accountNode(ctx, acc, address, db))
except RlpError as ex:
err(ex.msg)
proc parseU64(node: Node): uint64 =
for c in node.intVal:
result = result * 10 + uint64(c.int - '0'.int)
{.pragma: apiPragma, cdecl, gcsafe, raises: [Defect, CatchableError], locks:0.}
when (NimMajor, NimMinor) < (1, 6):
{.pragma: apiRaises, raises: [Defect, CatchableError].}
else:
{.pragma: apiRaises, raises: [].}
{.pragma: apiPragma, cdecl, gcsafe, apiRaises, locks:0.}
{.push hint[XDeclaredButNotUsed]: off.}
proc validateHex(x: Node, minLen = 0): NodeResult =
@ -499,15 +507,23 @@ proc accountTxCount(ud: RootRef, params: Args, parent: Node): RespResult {.apiPr
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)
resp(code)
except RlpError as ex:
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)
let (val, _) = acc.db.getStorage(acc.address, slot)
byte32Node(val)
except RlpError as ex:
err(ex.msg)
except ValueError as ex:
err(ex.msg)
const accountProcs = {
# Note: Need to define it as ResolverProc else a proc with noSideEffect is
@ -899,8 +915,11 @@ proc blockTransactions(ud: RootRef, params: Args, parent: Node): RespResult {.ap
proc blockTransactionAt(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
let h = HeaderNode(parent)
try:
let index = parseU64(params[0].val)
getTxAt(ctx, h.header, index.int)
except ValueError as ex:
err(ex.msg)
proc blockLogs(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
@ -910,8 +929,11 @@ proc blockLogs(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.
proc blockAccount(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
let h = HeaderNode(parent)
try:
let address = hexToByteArray[20](params[0].val.stringVal)
ctx.accountNode(h.header, address)
except ValueError as ex:
err(ex.msg)
const
fFrom = 0
@ -1122,6 +1144,7 @@ proc pickBlockNumber(ctx: GraphqlContextRef, number: Node): BlockNumber =
proc queryAccount(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
try:
let address = hexToByteArray[20](params[0].val.stringVal)
let blockNumber = pickBlockNumber(ctx, params[1].val)
let hres = getBlockByNumber(ctx, blockNumber)
@ -1129,6 +1152,8 @@ proc queryAccount(ud: RootRef, params: Args, parent: Node): RespResult {.apiPrag
return hres
let h = HeaderNode(hres.get())
accountNode(ctx, h.header, address)
except ValueError as ex:
err(ex.msg)
proc queryBlock(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
@ -1151,7 +1176,8 @@ proc queryBlocks(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragm
let toNumber = pickBlockNumber(ctx, to)
if fromNumber > toNumber:
return err("from($1) is bigger than to($2)" % [fromNumber.toString, toNumber.toString])
return err("from(" & fromNumber.toString &
") is bigger than to(" & toNumber.toString & ")")
# TODO: what is the maximum number here?
if toNumber - fromNumber > 32.toBlockNumber:
@ -1176,8 +1202,11 @@ proc queryPending(ud: RootRef, params: Args, parent: Node): RespResult {.apiPrag
proc queryTransaction(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
try:
let hash = toHash(params[0].val)
getTxByHash(ctx, hash)
except ValueError as ex:
err(ex.msg)
proc queryLogs(ud: RootRef, params: Args, parent: Node): RespResult {.apiPragma.} =
let ctx = GraphqlContextRef(ud)
@ -1257,7 +1286,7 @@ type
names: array[QcNames, Name]
proc calcQC(qc: QueryComplexity, field: FieldRef): int {.cdecl,
gcsafe, raises: [Defect, CatchableError].} =
gcsafe, apiRaises.} =
let qc = EthQueryComplexity(qc)
if field.parentType.sym.name == qc.names[qcType] and
field.field.name.name == qc.names[qcFields]:

2
vendor/nim-blscurve vendored

@ -1 +1 @@
Subproject commit 5bd4a085923d6c3be8ee095d06d1ec8473ebb6aa
Subproject commit d3920425c5c02b0a7766045c064c888cd5b83e72

@ -1 +1 @@
Subproject commit 14e8537e4aefda832996a187c4acfef8eadb2aeb
Subproject commit 1e6350870855541b381d77d4659688bc0d2c4227

2
vendor/nim-chronos vendored

@ -1 +1 @@
Subproject commit f7835a192b45c37e97614d865141f21eea8c156e
Subproject commit e05d2f8e9648e17b9a71bf5e909a79241c067c8b

@ -1 +1 @@
Subproject commit 38dfeaaabdc6792d0f4d701621cbe34001978456
Subproject commit 6c6ff76cb38a3d4fa369a2757769220f2ecf4e64

2
vendor/nim-eth vendored

@ -1 +1 @@
Subproject commit ffc3ef3a7cc622166ce578e9ce0346fc0916bfe3
Subproject commit ea3c164a0018bd62232f27d1554a91e9bdb93840

@ -1 +1 @@
Subproject commit 49e2c52eb5dda46b1c9c10d079abe7bffe6cea89
Subproject commit 3576a15f131367d8a36ffb5627b84bb59728b339

2
vendor/nim-graphql vendored

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

@ -1 +1 @@
Subproject commit e88e231dfcef4585fe3b2fbd9b664dbd28a88040
Subproject commit aad684d3758a74c1b327df93da2e956458410b48

@ -1 +1 @@
Subproject commit e5b18fb710c3d0167ec79f3b892f5a7a1bc6d1a4
Subproject commit f64d55f7ff480ed13eca9c97c15450a2c4106078

@ -1 +1 @@
Subproject commit 4c41c5029ffc73b732233f06018cd52f3ed47dce
Subproject commit 708a739d35f3fb595a83dc6e6cb9edb4c3e5361e

@ -1 +1 @@
Subproject commit 257e2e02ebe2efbe86beb05c62a739fc9c3d10e7
Subproject commit bc46b4c1c1730cc25bf5fb5f3d64bd708a6ad89e

@ -1 +1 @@
Subproject commit 3a6c350f515829af327a4238ba60a384f7a02520
Subproject commit 3f8946ab2de304a9130aa80874bc2e4025d62303

2
vendor/nim-stew vendored

@ -1 +1 @@
Subproject commit c52569abd5a7753c1892bf9fc85c71f0c9b6ac45
Subproject commit 67fdc87e2521f7e021fd521c41d3228810a183d0

2
vendor/nim-stint vendored

@ -1 +1 @@
Subproject commit eb1f32c6752478e18dff9256ea45538ab3312cd3
Subproject commit 94fc521ee0f1e113d09ceeaa3568d4d7a6c0b67d

@ -1 +1 @@
Subproject commit 2c46429b822347aa2db04e04671988de734d2b78
Subproject commit bad61aa6db4fd7aa0007c99b07276da55cc097da