Skip to content

Commit

Permalink
fix rpc_sim receipt unmarshalling
Browse files Browse the repository at this point in the history
  • Loading branch information
jangko committed Jun 25, 2023
1 parent 39402ea commit f8c1a7f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
16 changes: 15 additions & 1 deletion hive_integration/nodocker/rpc/client.nim
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,20 @@ proc nonceAt*(client: RpcClient, address: EthAddress): Future[AccountNonce] {.as
let hex = await client.eth_getTransactionCount(ethAddressStr(address), "latest")
result = parseHexInt(hex.string).AccountNonce

func toTopics(list: openArray[Hash256]): seq[Topic] =
result = newSeqOfCap[Topic](list.len)
for x in list:
result.add x.data

func toLogs(list: openArray[FilterLog]): seq[Log] =
result = newSeqOfCap[Log](list.len)
for x in list:
result.add Log(
address: x.address,
data: x.data,
topics: toTopics(x.topics)
)

proc txReceipt*(client: RpcClient, txHash: Hash256): Future[Option[Receipt]] {.async.} =
let rr = await client.eth_getTransactionReceipt(txHash)
if rr.isNone:
Expand All @@ -59,7 +73,7 @@ proc txReceipt*(client: RpcClient, txHash: Hash256): Future[Option[Receipt]] {.a
hash : rc.root.get(Hash256()),
cumulativeGasUsed: parseHexInt(rc.cumulativeGasUsed.string).GasInt,
bloom : BloomFilter(rc.logsBloom),
logs : rc.logs
logs : toLogs(rc.logs)
)
result = some(rec)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_tools_build.nim
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import
../premix/regress,
./tracerTestGen,
./persistBlockTestGen,
../hive_integration/nodocker/consensus/extract_consensus_data,
../hive_integration/nodocker/rpc/rpc_sim,
../hive_integration/nodocker/consensus/consensus_sim,
../hive_integration/nodocker/graphql/graphql_sim,
../hive_integration/nodocker/engine/engine_sim,
Expand Down

0 comments on commit f8c1a7f

Please sign in to comment.