From a565a7ec6ae49a28bd2e8117fc252c301b3ceb6d Mon Sep 17 00:00:00 2001 From: jsvisa Date: Tue, 11 Jul 2023 22:41:59 +0800 Subject: [PATCH 1/4] eth: add eth_getBlockReceipts Signed-off-by: jsvisa Signed-off-by: jsvisa --- src/eth/block.yaml | 11 +++++++++++ src/schemas/receipt.yaml | 6 ++++++ 2 files changed, 17 insertions(+) diff --git a/src/eth/block.yaml b/src/eth/block.yaml index bae5519b..9e54ca85 100644 --- a/src/eth/block.yaml +++ b/src/eth/block.yaml @@ -86,3 +86,14 @@ - $ref: '#/components/schemas/notFound' - title: Uncle count $ref: '#/components/schemas/uint' +- name: eth_getBlockReceipts + summary: Returns the receipts of a block by number or hash. + params: + - name: Block + required: true + schema: + $ref: '#/components/schemas/BlockNumberOrTagOrHash' + result: + name: Receipts information + schema: + $ref: '#/components/schemas/ReceiptsInfo' diff --git a/src/schemas/receipt.yaml b/src/schemas/receipt.yaml index aeb192c9..f35e7c7b 100644 --- a/src/schemas/receipt.yaml +++ b/src/schemas/receipt.yaml @@ -111,3 +111,9 @@ ReceiptInfo: title: effective gas price description: The actual value per gas deducted from the senders account. Before EIP-1559, this is equal to the transaction's gas price. After, it is equal to baseFeePerGas + min(maxFeePerGas - baseFeePerGas, maxPriorityFeePerGas). $ref: '#/components/schemas/uint' + +ReceiptsInfo: + type: array + title: Receipts info + items: + $ref: '#/components/schemas/ReceiptInfo' From 9fc4e49e6217cf44702acaac8cc67a54a8c59b0b Mon Sep 17 00:00:00 2001 From: jsvisa Date: Wed, 12 Jul 2023 10:13:54 +0800 Subject: [PATCH 2/4] eth: blockReceipts Signed-off-by: jsvisa --- src/eth/block.yaml | 5 +++-- src/schemas/receipt.yaml | 6 ------ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/eth/block.yaml b/src/eth/block.yaml index 9e54ca85..b5a1eb2b 100644 --- a/src/eth/block.yaml +++ b/src/eth/block.yaml @@ -95,5 +95,6 @@ $ref: '#/components/schemas/BlockNumberOrTagOrHash' result: name: Receipts information - schema: - $ref: '#/components/schemas/ReceiptsInfo' + type: array + items: + $ref: '#/components/schemas/ReceiptInfo' diff --git a/src/schemas/receipt.yaml b/src/schemas/receipt.yaml index f35e7c7b..aeb192c9 100644 --- a/src/schemas/receipt.yaml +++ b/src/schemas/receipt.yaml @@ -111,9 +111,3 @@ ReceiptInfo: title: effective gas price description: The actual value per gas deducted from the senders account. Before EIP-1559, this is equal to the transaction's gas price. After, it is equal to baseFeePerGas + min(maxFeePerGas - baseFeePerGas, maxPriorityFeePerGas). $ref: '#/components/schemas/uint' - -ReceiptsInfo: - type: array - title: Receipts info - items: - $ref: '#/components/schemas/ReceiptInfo' From 5fc744c48ba3264511da175c58a4bdd39d80bd34 Mon Sep 17 00:00:00 2001 From: jsvisa Date: Fri, 21 Jul 2023 17:19:42 +0800 Subject: [PATCH 3/4] getBlockReceipts maybe null Signed-off-by: jsvisa --- src/eth/block.yaml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/eth/block.yaml b/src/eth/block.yaml index b5a1eb2b..64e95fb7 100644 --- a/src/eth/block.yaml +++ b/src/eth/block.yaml @@ -95,6 +95,10 @@ $ref: '#/components/schemas/BlockNumberOrTagOrHash' result: name: Receipts information - type: array - items: - $ref: '#/components/schemas/ReceiptInfo' + schema: + oneOf: + - $ref: '#/components/schemas/notFound' + - title: Receipts information + type: array + items: + $ref: '#/components/schemas/ReceiptInfo' From 9339446609fac24323f51ad0c677edebf8038c59 Mon Sep 17 00:00:00 2001 From: jsvisa Date: Thu, 10 Aug 2023 21:44:41 +0800 Subject: [PATCH 4/4] tests: add eth_getBlockReceipts Signed-off-by: jsvisa --- tests/eth_getBlockReceipts/get-block-receipts-0.io | 2 ++ tests/eth_getBlockReceipts/get-block-receipts-by-hash.io | 2 ++ tests/eth_getBlockReceipts/get-block-receipts-earliest.io | 2 ++ tests/eth_getBlockReceipts/get-block-receipts-empty.io | 2 ++ tests/eth_getBlockReceipts/get-block-receipts-future.io | 2 ++ tests/eth_getBlockReceipts/get-block-receipts-latest.io | 2 ++ tests/eth_getBlockReceipts/get-block-receipts-n.io | 2 ++ tests/eth_getBlockReceipts/get-block-receipts-not-found.io | 2 ++ 8 files changed, 16 insertions(+) create mode 100644 tests/eth_getBlockReceipts/get-block-receipts-0.io create mode 100644 tests/eth_getBlockReceipts/get-block-receipts-by-hash.io create mode 100644 tests/eth_getBlockReceipts/get-block-receipts-earliest.io create mode 100644 tests/eth_getBlockReceipts/get-block-receipts-empty.io create mode 100644 tests/eth_getBlockReceipts/get-block-receipts-future.io create mode 100644 tests/eth_getBlockReceipts/get-block-receipts-latest.io create mode 100644 tests/eth_getBlockReceipts/get-block-receipts-n.io create mode 100644 tests/eth_getBlockReceipts/get-block-receipts-not-found.io diff --git a/tests/eth_getBlockReceipts/get-block-receipts-0.io b/tests/eth_getBlockReceipts/get-block-receipts-0.io new file mode 100644 index 00000000..7d16f546 --- /dev/null +++ b/tests/eth_getBlockReceipts/get-block-receipts-0.io @@ -0,0 +1,2 @@ +>> {"jsonrpc":"2.0","id":1,"method":"eth_getBlockReceipts","params":["0x0"]} +<< {"jsonrpc":"2.0","id":1,"result":[]} diff --git a/tests/eth_getBlockReceipts/get-block-receipts-by-hash.io b/tests/eth_getBlockReceipts/get-block-receipts-by-hash.io new file mode 100644 index 00000000..f6af0580 --- /dev/null +++ b/tests/eth_getBlockReceipts/get-block-receipts-by-hash.io @@ -0,0 +1,2 @@ +>> {"jsonrpc":"2.0","id":1,"method":"eth_getBlockReceipts","params":["0x7a6c6683eb052de1d9debcb78905d427464566c7a305a39d10e6fd309b797845"]} +<< {"jsonrpc":"2.0","id":1,"result":[{"blockHash":"0x7a6c6683eb052de1d9debcb78905d427464566c7a305a39d10e6fd309b797845","blockNumber":"0x5","contractAddress":null,"cumulativeGasUsed":"0x538d","effectiveGasPrice":"0x1ec7cd47","from":"0x658bdf435d810c91414ec09147daa6db62406379","gasUsed":"0x538d","logs":[],"logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","status":"0x0","to":"0x0000000000000000000000000000000000031ec7","transactionHash":"0x54b25c11650dca0253ef7b91b5415680eea8dac54b029863e12db48908ad386c","transactionIndex":"0x0","type":"0x2"}]} diff --git a/tests/eth_getBlockReceipts/get-block-receipts-earliest.io b/tests/eth_getBlockReceipts/get-block-receipts-earliest.io new file mode 100644 index 00000000..71a9d802 --- /dev/null +++ b/tests/eth_getBlockReceipts/get-block-receipts-earliest.io @@ -0,0 +1,2 @@ +>> {"jsonrpc":"2.0","id":1,"method":"eth_getBlockReceipts","params":["earliest"]} +<< {"jsonrpc":"2.0","id":1,"result":[]} diff --git a/tests/eth_getBlockReceipts/get-block-receipts-empty.io b/tests/eth_getBlockReceipts/get-block-receipts-empty.io new file mode 100644 index 00000000..70eba3f8 --- /dev/null +++ b/tests/eth_getBlockReceipts/get-block-receipts-empty.io @@ -0,0 +1,2 @@ +>> {"jsonrpc":"2.0","id":1,"method":"eth_getBlockReceipts","params":["0x0000000000000000000000000000000000000000000000000000000000000000"]} +<< {"jsonrpc":"2.0","id":1,"result":null} diff --git a/tests/eth_getBlockReceipts/get-block-receipts-future.io b/tests/eth_getBlockReceipts/get-block-receipts-future.io new file mode 100644 index 00000000..4a3b3bab --- /dev/null +++ b/tests/eth_getBlockReceipts/get-block-receipts-future.io @@ -0,0 +1,2 @@ +>> {"jsonrpc":"2.0","id":1,"method":"eth_getBlockReceipts","params":["0xa"]} +<< {"jsonrpc":"2.0","id":1,"result":null} diff --git a/tests/eth_getBlockReceipts/get-block-receipts-latest.io b/tests/eth_getBlockReceipts/get-block-receipts-latest.io new file mode 100644 index 00000000..8406e360 --- /dev/null +++ b/tests/eth_getBlockReceipts/get-block-receipts-latest.io @@ -0,0 +1,2 @@ +>> {"jsonrpc":"2.0","id":1,"method":"eth_getBlockReceipts","params":["latest"]} +<< {"jsonrpc":"2.0","id":1,"result":[{"blockHash":"0x9032fd0afc97b3c5b28fe887051ecb2cc3a3475c102b0aeeaadaebd87d8e1cd3","blockNumber":"0x9","contractAddress":null,"cumulativeGasUsed":"0x5208","effectiveGasPrice":"0x122af098","from":"0x658bdf435d810c91414ec09147daa6db62406379","gasUsed":"0x5208","logs":[],"logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","status":"0x1","to":"0x658bdf435d810c91414ec09147daa6db62406379","transactionHash":"0xfc00d60c731c8dae864f0e7c8475037068347d178c177f82d9761759b9b00d11","transactionIndex":"0x0","type":"0x0"}]} diff --git a/tests/eth_getBlockReceipts/get-block-receipts-n.io b/tests/eth_getBlockReceipts/get-block-receipts-n.io new file mode 100644 index 00000000..6ca35ff9 --- /dev/null +++ b/tests/eth_getBlockReceipts/get-block-receipts-n.io @@ -0,0 +1,2 @@ +>> {"jsonrpc":"2.0","id":1,"method":"eth_getBlockReceipts","params":["0x3"]} +<< {"jsonrpc":"2.0","id":1,"result":[{"blockHash":"0x97bf0c1e120092367636515ad0fff9b03a76c1d200edc6cbd2268e46413e7679","blockNumber":"0x3","contractAddress":"0xdcdf1e30e221ceb2ed862994fdf18b52588094da","cumulativeGasUsed":"0xcf50","effectiveGasPrice":"0x2806be9d","from":"0x658bdf435d810c91414ec09147daa6db62406379","gasUsed":"0xcf50","logs":[],"logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","status":"0x1","to":null,"transactionHash":"0xc864b642dab0258a7a671f172fa438b29d35cec47ce30d9e16720a07e1c588b9","transactionIndex":"0x0","type":"0x0"}]} diff --git a/tests/eth_getBlockReceipts/get-block-receipts-not-found.io b/tests/eth_getBlockReceipts/get-block-receipts-not-found.io new file mode 100644 index 00000000..39e2a919 --- /dev/null +++ b/tests/eth_getBlockReceipts/get-block-receipts-not-found.io @@ -0,0 +1,2 @@ +>> {"jsonrpc":"2.0","id":1,"method":"eth_getBlockReceipts","params":["0x00000000000000000000000000000000000000000000000000000000deadbeef"]} +<< {"jsonrpc":"2.0","id":1,"result":null}