Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add newPayload template for engine_newPayloadV4 and restore eth_getBlockReceipts callsig #182

Merged
merged 1 commit into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions tests/test_execution_api.nim
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,20 @@ suite "Test eth api":
check res.isSome
waitFor client.close()

test "eth_getBlockReceipts with Quantity param":
let client = newRpcHttpClient()
waitFor client.connect("http://" & $srv.localAddress()[0])
let res = waitFor client.eth_getBlockReceipts(blockId(0))
check res.isSome
waitFor client.close()

test "eth_getBlockReceipts with string param":
let client = newRpcHttpClient()
waitFor client.connect("http://" & $srv.localAddress()[0])
let res = waitFor client.eth_getBlockReceipts("latest")
check res.isSome
waitFor client.close()

waitFor srv.stop()
waitFor srv.closeWait()

Expand Down
13 changes: 1 addition & 12 deletions web3/eth_api.nim
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,7 @@ createRpcSigsFromNim(RpcClient):
proc eth_getTransactionCount(data: Address, blockId: BlockIdentifier): Quantity
proc eth_getBlockTransactionCountByHash(data: Hash32): Quantity
proc eth_getBlockTransactionCountByNumber(blockId: BlockIdentifier): Quantity

# TODO: Investigate why nim v2 cannot instantiate generic functions
# with oneof params `blockId: BlockIdentifier` and and return type
# Opt[seq[ReceiptObject]], this is a regression after all
# https://github.com/nim-lang/Nim/issues/23310
when false:
proc eth_getBlockReceipts(blockId: BlockIdentifier): Opt[seq[ReceiptObject]]

proc eth_getBlockReceipts(blockId: string): Opt[seq[ReceiptObject]]
proc eth_getBlockReceipts(blockId: Quantity): Opt[seq[ReceiptObject]]
proc eth_getBlockReceipts(blockId: RtBlockIdentifier): Opt[seq[ReceiptObject]]

proc eth_getBlockReceipts(blockId: BlockIdentifier): Opt[seq[ReceiptObject]]
proc eth_getUncleCountByBlockHash(data: Hash32): Quantity
proc eth_getUncleCountByBlockNumber(blockId: BlockIdentifier): Quantity
proc eth_getCode(data: Address, blockId: BlockIdentifier): seq[byte]
Expand Down