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

R4R: add batch query methods #115

Merged
merged 5 commits into from
Mar 19, 2021
Merged

Conversation

abelliumnt
Copy link
Contributor

@abelliumnt abelliumnt commented Mar 17, 2021

Description

add batch query method: eth_getTransactionsByBlockNumber, eth_getTransactionReceiptsByBlockNumber and eth_getTransactionDataAndReceipt

Rationale

Accelerate exeplorer indexer service.

Example

Request:

{
	"jsonrpc":"2.0",
	"method":"eth_getTransactionsByBlockNumber",
	"params":["0x539492"],
	"id":1
}

Response:

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": [
        {
            "blockHash": "0x784377071f7d880e9862b4e77edf20b08a5d20f9efbda989d05c132c1bc9350c",
            "blockNumber": "0x539492",
            "from": "0x3f529523984f91908c551b4ac9432e1049888fd0",
            "gas": "0x2b070",
            "gasPrice": "0x2e90edd000",
            "hash": "0x516a2ab1506b020e7f49d0d0ddbc471065624d1a603087262cebf4ca114ff588",
            "input": "0x38ed173900000000000000000000000000000000000000000000000ad03d8174f6463702000000000000000000000000000000000000000000000020905687f7c6b8752b00000000000000000000000000000000000000000000000000000000000000a00000000000000000000000003f529523984f91908c551b4ac9432e1049888fd00000000000000000000000000000000000000000000000000000000060450d4c0000000000000000000000000000000000000000000000000000000000000003000000000000000000000000896ede222d3f7f3414e136a2791bdb08aaa25ce0000000000000000000000000bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c000000000000000000000000e9e7cea3dedca5984780bafc599bd69add087d56",
            "nonce": "0x48b",
            "to": "0x05ff2b0db69458a0750badebc4f9e13add608c7f",
            "transactionIndex": "0x0",
            "value": "0x0",
            "v": "0x93",
            "r": "0x40a23113f63c17db8921a6da76b8ce06918e3b307477ebfef362b19fb44d3ba3",
            "s": "0x489f906a51aa440901ba5fda46eccc8054dad92b6a87c4fd479137beb5e62f5f"
        },
        {
            "blockHash": "0x784377071f7d880e9862b4e77edf20b08a5d20f9efbda989d05c132c1bc9350c",
            "blockNumber": "0x539492",
            "from": "0x9a11b508a0b30808eb3b5741749915a6704fbcce",
            "gas": "0xf4240",
            "gasPrice": "0x4a817c800",
            "hash": "0xa0d2074bd511fd4c5cc74881ca307685e60df208b388037d05ba9e00c02f3ff5",
            "input": "0x5d616c5b00000000000000000000000000000000000000000000000002328df044f59000000000000000000000000000000000000000000000000000002f6b53c9ae6a4000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000009a11b508a0b30808eb3b5741749915a6704fbcce0000000000000000000000000000000000000000000000000000000060450d590000000000000000000000000000000000000000000000000000000000000002000000000000000000000000cf6bb5389c92bdda8a3747ddb454cb7a64626c63000000000000000000000000bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c",
            "nonce": "0xc",
            "to": "0xbd67d157502a23309db761c41965600c2ec788b2",
            "transactionIndex": "0x1",
            "value": "0x0",
            "v": "0x94",
            "r": "0x8e7d1879c90b6f6476893e59ccb0ba1d64eb4cf3236649212301a7ffa6a2fa26",
            "s": "0xbd0c29c40dab2788484b1fa13b691ee5102c46ce9c400132191c4dce01ff0a6"
        },
        {
            "blockHash": "0x784377071f7d880e9862b4e77edf20b08a5d20f9efbda989d05c132c1bc9350c",
            "blockNumber": "0x539492",
            "from": "0x0000e51b05a1dceb8840ae51764e9ff9190bcc5a",
            "gas": "0x75300",
            "gasPrice": "0x282e92e30",
            "hash": "0xd3aa9cffbd0f659d5a5451e8370ed7c65d699e7cdaa75e4c7ec696f6b10b3e19",
            "input": "0x711e5fc60000000000000000000000000000000000000000000000000049e6342d4d42fe000000000000000000000000000000000000000000000000005139e239ed8cfe00000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000000000000000000000000000000000000000000004000000000000000000000000bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c000000000000000000000000e9e7cea3dedca5984780bafc599bd69add087d56000000000000000000000000c66e4de0d9b4f3cb3f271c37991fe62f154471eb000000000000000000000000bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c00000000000000000000000000000000000000000000000000000000000000030000000000000000000000001b96b92314c44b159149f7e0303511fb2fc4774f00000000000000000000000058bcb3d7bc69b4f3d0d1eca1c7dcf7b4b2f1ebd400000000000000000000000051509ef5ed3fa020b6011ab10e0383e089fd48230000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000003",
            "nonce": "0xe131",
            "to": "0x00000000349127893432f2aa590d286d0640d97b",
            "transactionIndex": "0x2",
            "value": "0x0",
            "v": "0x93",
            "r": "0xf406787857c214368860117b7ce1bc8e7e200916c29c414504e3e8973a6b48f7",
            "s": "0x3dff0ca75ccfc626d91a63fd145eedc28360e770e826d13a5efa42e5710c6152"
        }]
}

Request:

{
	"jsonrpc":"2.0",
	"method":"eth_getTransactionReceiptsByBlockNumber",
	"params":["0x539492"],
	"id":1
}

Response:

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": [
        {
            "blockHash": "0x784377071f7d880e9862b4e77edf20b08a5d20f9efbda989d05c132c1bc9350c",
            "blockNumber": "0x539492",
            "contractAddress": null,
            "cumulativeGasUsed": "0x2ad85",
            "from": "0x3f529523984f91908c551b4ac9432e1049888fd0",
            "gasUsed": "0x2ad85",
            "logs": [],
            "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
            "status": "0x0",
            "to": "0x05ff2b0db69458a0750badebc4f9e13add608c7f",
            "transactionHash": "0x516a2ab1506b020e7f49d0d0ddbc471065624d1a603087262cebf4ca114ff588",
            "transactionIndex": "0x0"
        },
        {
            "blockHash": "0x784377071f7d880e9862b4e77edf20b08a5d20f9efbda989d05c132c1bc9350c",
            "blockNumber": "0x539492",
            "contractAddress": null,
            "cumulativeGasUsed": "0x8d0d5",
            "from": "0x80a02dca0ea2b5a07f6aae552e0949929259c32e",
            "gasUsed": "0x572c",
            "logs": [
                {
                    "address": "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c",
                    "topics": [
                        "0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65",
                        "0x00000000000000000000000080a02dca0ea2b5a07f6aae552e0949929259c32e"
                    ],
                    "data": "0x00000000000000000000000000000000000000000000000000a9f1227bf3baab",
                    "blockNumber": "0x539492",
                    "transactionHash": "0xbf0194b0b587b169591f31ed456892aa80a488bb78b253dc6163ed4a8a7ee2e1",
                    "transactionIndex": "0x3",
                    "blockHash": "0x784377071f7d880e9862b4e77edf20b08a5d20f9efbda989d05c132c1bc9350c",
                    "logIndex": "0x10",
                    "removed": false
                }
            ],
            "logsBloom": "0x00000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000400000000000000000000000000000000000000000000000000000000040000000000000000000000000000040000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000002000080000000000000000000000000000000000000000000000000000000000000000000",
            "status": "0x1",
            "to": "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c",
            "transactionHash": "0xbf0194b0b587b169591f31ed456892aa80a488bb78b253dc6163ed4a8a7ee2e1",
            "transactionIndex": "0x3"
        },
        {
            "blockHash": "0x784377071f7d880e9862b4e77edf20b08a5d20f9efbda989d05c132c1bc9350c",
            "blockNumber": "0x539492",
            "contractAddress": null,
            "cumulativeGasUsed": "0xa3bc1",
            "from": "0xfa65c3a056c96e1c9765605fade90d5f7b2c827d",
            "gasUsed": "0x16aec",
            "logs": [
                {
                    "address": "0x5a41f637c3f7553dba6ddc2d3ca92641096577ea",
                    "topics": [
                        "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
                        "0x0000000000000000000000000647bb38cc2eb93b6a482e308cf264806f209bc7",
                        "0x000000000000000000000000fa65c3a056c96e1c9765605fade90d5f7b2c827d"
                    ],
                    "data": "0x000000000000000000000000000000000000000000000002aa7fa190c4d4614e",
                    "blockNumber": "0x539492",
                    "transactionHash": "0x2f4ba967993b770a0d4bbd7d68d6b7ea06ffceb4b175c64e2c5659be25d77537",
                    "transactionIndex": "0x4",
                    "blockHash": "0x784377071f7d880e9862b4e77edf20b08a5d20f9efbda989d05c132c1bc9350c",
                    "logIndex": "0x11",
                    "removed": false
                },
                {
                    "address": "0x0647bb38cc2eb93b6a482e308cf264806f209bc7",
                    "topics": [
                        "0xe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e0486",
                        "0x000000000000000000000000fa65c3a056c96e1c9765605fade90d5f7b2c827d"
                    ],
                    "data": "0x000000000000000000000000000000000000000000000002aa7fa190c4d4614e",
                    "blockNumber": "0x539492",
                    "transactionHash": "0x2f4ba967993b770a0d4bbd7d68d6b7ea06ffceb4b175c64e2c5659be25d77537",
                    "transactionIndex": "0x4",
                    "blockHash": "0x784377071f7d880e9862b4e77edf20b08a5d20f9efbda989d05c132c1bc9350c",
                    "logIndex": "0x12",
                    "removed": false
                }
            ],
            "logsBloom": "0x00000000000000000000000000000000000000008000000000000400000000000000000000000000000000000000200008000000000000000201000000000000000000000000000000000048000000000000000000001000000000000000000000000000000000200000000000000000000000000000004000000010000000000000000100000000080000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000002000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
            "status": "0x1",
            "to": "0x0647bb38cc2eb93b6a482e308cf264806f209bc7",
            "transactionHash": "0x2f4ba967993b770a0d4bbd7d68d6b7ea06ffceb4b175c64e2c5659be25d77537",
            "transactionIndex": "0x4"
        }]
}

Request:

{
	"jsonrpc":"2.0",
	"method":"eth_getTransactionDataAndReceipt",
	"params":["0x516a2ab1506b020e7f49d0d0ddbc471065624d1a603087262cebf4ca114ff588"],
	"id":1
}

Response

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "receipt": {
            "blockHash": "0x784377071f7d880e9862b4e77edf20b08a5d20f9efbda989d05c132c1bc9350c",
            "blockNumber": "0x539492",
            "contractAddress": null,
            "cumulativeGasUsed": "0x2ad85",
            "from": "0x3f529523984f91908c551b4ac9432e1049888fd0",
            "gasUsed": "0x2ad85",
            "logs": [],
            "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
            "status": "0x0",
            "to": "0x05ff2b0db69458a0750badebc4f9e13add608c7f",
            "transactionHash": "0x516a2ab1506b020e7f49d0d0ddbc471065624d1a603087262cebf4ca114ff588",
            "transactionIndex": "0x0"
        },
        "txData": {
            "blockHash": "0x784377071f7d880e9862b4e77edf20b08a5d20f9efbda989d05c132c1bc9350c",
            "blockNumber": "0x539492",
            "from": "0x3f529523984f91908c551B4ac9432e1049888Fd0",
            "gas": "0x2b070",
            "gasPrice": "0x2e90edd000",
            "hash": "0x516a2ab1506b020e7f49d0d0ddbc471065624d1a603087262cebf4ca114ff588",
            "input": "0x38ed173900000000000000000000000000000000000000000000000ad03d8174f6463702000000000000000000000000000000000000000000000020905687f7c6b8752b00000000000000000000000000000000000000000000000000000000000000a00000000000000000000000003f529523984f91908c551b4ac9432e1049888fd00000000000000000000000000000000000000000000000000000000060450d4c0000000000000000000000000000000000000000000000000000000000000003000000000000000000000000896ede222d3f7f3414e136a2791bdb08aaa25ce0000000000000000000000000bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c000000000000000000000000e9e7cea3dedca5984780bafc599bd69add087d56",
            "nonce": "0x48b",
            "r": "0x40a23113f63c17db8921a6da76b8ce06918e3b307477ebfef362b19fb44d3ba3",
            "s": "0x489f906a51aa440901ba5fda46eccc8054dad92b6a87c4fd479137beb5e62f5f",
            "to": "0x05fF2B0DB69458A0750badebc4f9e13aDd608C7F",
            "transactionIndex": "0x0",
            "v": "0x93",
            "value": "0x0"
        }
    }
}

Changes

Notable changes:

  • add each change in a bullet point here
  • ...

Preflight checks

  • build passed (make build)
  • tests passed (make test)
  • manual transaction test passed

Already reviewed by

...

Related issues

... reference related issue #'s here ...

@abelliumnt abelliumnt force-pushed the batch-transaction-recipients branch 4 times, most recently from a6e1053 to 791a622 Compare March 17, 2021 11:11
@abelliumnt abelliumnt changed the title WIP: add batch query method: eth_getTransactionsByBlockNumber and eth_getTransactionReceiptsByBlockNumber R4R: add batch query methods Mar 17, 2021
@unclezoro unclezoro changed the base branch from master to develop March 18, 2021 07:34
@unclezoro unclezoro merged commit 0e2c471 into develop Mar 19, 2021
@unclezoro unclezoro mentioned this pull request Mar 23, 2021
3 tasks
@unclezoro unclezoro deleted the batch-transaction-recipients branch March 23, 2021 07:18
@unclezoro unclezoro mentioned this pull request Apr 5, 2021
unclezoro added a commit to unclezoro/bsc that referenced this pull request Apr 13, 2021
add consensus engine Parlia implement

add async write rotate log handler

add precompile light client contracts

prepare for release 1.0.0-alpha.0 for Rialto network #1

Signed-off-by: fudongbai <[email protected]>

add key features to the readme

update 'running a node' part of readme (#2)

more strick condition for system transaction

add gov init transaction

fix validator failed to sync a block produced by itself

update stale depth

add gas limit check in parlia implement

remove redundant gaslimit check

fix debug_traceTransaction crashed issue (bnb-chain#13)

add bep2p tokens for faucet (#5)

add cross chain contract to system contract

allow slash failed (bnb-chain#15)

update metaversion to beta.0

add changelog for v1.0.0-beta.0

add chain id into sign bytes to avoid replay attack (bnb-chain#18)

reestimate the gas consumption for system tx when there is 41 validators (bnb-chain#19)

prepare for 1.0.0-beta.1 (bnb-chain#20)

resolve best practice advice

enforce backoff time for out-turn validator (bnb-chain#23)

framework for upgrade system contract

improve upgrade config

refactor upgrade config

add beforeUpgrade and afterUpgrade

add multiple upgrade config

resolve comment

add upgrade height for rialto

fix deplay check

fix hex code of new smart contract

fix index out of range

fix not return error when blockTimeVerifyForRamanujanFork failed

update chapel ramanujan fork

prepare for release 1.0.1-beta

add niels fork

eth/tracers: revert reason in call_tracer + error for failed internal calls (#21387)

* tests: add testdata of call tracer

* eth/tracers: return revert reason in call_tracer

* eth/tracers: regenerate assets

* eth/tracers: add error message even if no exec occurrs, fixes #21438

Co-authored-by: Martin Holst Swende <[email protected]>

remove disclaim

prepare for release 1.0.2

R4R: add max gas allwance calculation (bnb-chain#36)

* calculate max gas allwance

* return error for missing from

prepare release 1.0.3

use fixed gas price since bsc network is idle

upgrade to golang1.15.5

Disable noisy log from consensus engine

Hide some smart contract tracing logs from parlia consensus engine

Create PULL_REQUEST_TEMPLATE

add change log for release v1.0.4

add curl in docker image

les: fix GetProofsV2 bug (#21896)

fix potential deadlock of pub/sub module

add rpc method request gauge

add x-forward-for message in log

support fork id in header; elegant upgrade

avoid false warn log

consensus/ethash: use 64bit indexes for the DAG generation (#21793)

* Bit boundary fix for the DAG generation routine

* Fix unnecessary conversion warnings

Co-authored-by: Sergey Pavlov <[email protected]>

signer/storage: fix a badly ordered error check (#21379)

core: fix txpool off-by-one error (#21683)

internal/ethapi: fix nil deref + fix estimateGas console bindings (#21601)

* tried to fix

* fix for js api

* fix for nil pointer ex

* rev space

* rev space

* input call formatter

rpc: fix issue with null JSON-RPC messages (#21497)

accounts/abi: fix a bug in getTypeSize method (#21501)

* accounts/abi: fix a bug in getTypeSize method

e.g. for "Tuple[2]" type, the element of the array is a tuple type and the size of the tuple may not be 32.

* accounts/abi: add unit test of getTypeSize method

p2p/enode: avoid crashing for invalid IP (#21981)

The database panicked for invalid IPs. This is usually no problem
because all code paths leading to node DB access verify the IP, but it's
dangerous because improper validation can turn this panic into a DoS
vulnerability. The quick fix here is to just turn database accesses
using invalid IP into a noop. This isn't great, but I'm planning to
remove the node DB for discv5 long-term, so it should be fine to have
this quick fix for half a year.

Fixes #21849

p2p/discover: fix deadlock in discv5 message dispatch (#21858)

This fixes a deadlock that could occur when a response packet arrived
after a call had already received enough responses and was about to
signal completion to the dispatch loop.

Co-authored-by: Felix Lange <[email protected]>

R4R: apply mirror sync upgrade (bnb-chain#56)

* apply mirror sync upgrade

remove 0x

update rialto genesis hash

update tokenhub code

* update tokenhub code

* update relayer incentive contract code

* update upgrade height and remove mainnet upgrade

prepare for release v1.0.5 (bnb-chain#64)

[R4R]appay mirror/sync fork to main-net; release for 1.0.6 (bnb-chain#68)

* appay mirror/sync fork to main-net; release for 1.0.6

* fix upgrade do not work

change the fork waring to debug to avoid confusion (bnb-chain#73)

add jq to docker file (bnb-chain#84)

add tini for docker image (bnb-chain#90)

Co-authored-by: swift.du <[email protected]>

add directbroadcast flag (bnb-chain#99)

limit range get log

R4R: add batch query methods (bnb-chain#115)

* add batch query method

* GetTransactionDataAndReceipt

* add new rpc to goclient

* fix web3 console

* rename tx_data to txData

[R4R]apply max commit tx time for miner worker (bnb-chain#112)

* apply max commit tx time for miner worker

* update to 200 ms

validator only write database state when enough distance (bnb-chain#116)

add health check endpoint (bnb-chain#120)

prepare for release v1.0.7

update receiptsCacheLimit to 10000
vietthang207 pushed a commit to KyberNetwork/bsc that referenced this pull request May 11, 2021
* add batch query method

* GetTransactionDataAndReceipt

* add new rpc to goclient

* fix web3 console

* rename tx_data to txData
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants