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

Support non-standard RPC methods for indexing services #123

Closed

Conversation

rahul10puchd
Copy link
Contributor

@rahul10puchd rahul10puchd commented Nov 11, 2021

Description

This PR covers the following RPC methods: eth_getTransactionsByBlockNumber and eth_getTransactionReceiptsByBlockNumber

Rational

The main reason for this PR is that our partners requested us to support these RPC methods.

Example

Examples are mocked up because we don't have a multiple transactions in the same block.

  • eth_getTransactionReceiptsByBlockNumber Request:
http post localhost:8545  jsonrpc=2.0 id=1 method=eth_getTransactionReceiptsByBlockNumber params:='["0x484be53"]'

Response:

{
    "id": "1",
    "jsonrpc": "2.0",
    "result": [
        {
            "blockHash": "0xf8d8f47ffc179ad75991aa98052db8b39216009a761062f1d7ea821e9fb08c08",
            "blockNumber": "0x483a621",
            "contractAddress": null,
            "cumulativeGasUsed": "0x0",
            "from": "0xecee8507d92b9ab9da0afbf794f1e6e137170899",
            "gasUsed": "0x7f0c",
            "logs": [],
            "logsBloom": "0x5c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c303030",
            "nearReceiptHash": null,
            "nearTransactionHash": null,
            "status": "0x1",
            "to": "0x230182ad3e21144cc091514b3ac0f5e94b8925a7",
            "transactionHash": "0x5be7cf824629122669d3aa8153abf84faf4bd58dc9726f6ac7ea84915c60e5c2",
            "transactionIndex": "0x0"
        },
        {
            "blockHash": "0xf8d8f47ffc179ad75991aa98052db8b39216009a761062f1d7ea821e9fb08c08",
            "blockNumber": "0x483a621",
            "contractAddress": null,
            "cumulativeGasUsed": "0x0",
            "from": "0xecee8507d92b9ab9da0afbf794f1e6e137170899",
            "gasUsed": "0x7f0c",
            "logs": [],
            "logsBloom": "0x5c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c3030305c303030",
            "nearReceiptHash": null,
            "nearTransactionHash": null,
            "status": "0x1",
            "to": "0x230182ad3e21144cc091514b3ac0f5e94b8925a7",
            "transactionHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
            "transactionIndex": "0x1"
        }
    ]
}
  • eth_getTransactionsByBlockNumber Request:
http post localhost:8545  jsonrpc=2.0 id=1 method=eth_getTransactionsByBlockNumber params:='["0x484be53"]'

Response:

{
    "id": "1",
    "jsonrpc": "2.0",
    "result": [
        {
            "blockHash": "0xf8d8f47ffc179ad75991aa98052db8b39216009a761062f1d7ea821e9fb08c08",
            "blockNumber": "0x483a621",
            "from": "0xecee8507d92b9ab9da0afbf794f1e6e137170899",
            "gas": "0xf4515",
            "gasPrice": "0x0",
            "hash": "0x5be7cf824629122669d3aa8153abf84faf4bd58dc9726f6ac7ea84915c60e5c2",
            "input": "0x7898e0c2000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000431b4421e750000000000000000000000000000000000000000000000000000000061c0c21900000000000000000000000000000000000000000000000000000000000000074254432f55534400000000000000000000000000000000000000000000000000",
            "nonce": "0x110b",
            "r": "0xc85926d9a08b5e0635db6a50e86ac3a2ca271cbd47f68aad2a8ed54403c5c8d9",
            "s": "0x6b5f4ffcdde56b53c2b85b6f76bebc01e5dd86778496845c3fdc328adbb8f686",
            "to": "0x230182ad3e21144cc091514b3ac0f5e94b8925a7",
            "transactionIndex": "0x0",
            "v": "0x9c8a82ca",
            "value": "0x0"
        },
        {
            "blockHash": "0xf8d8f47ffc179ad75991aa98052db8b39216009a761062f1d7ea821e9fb08c08",
            "blockNumber": "0x483a621",
            "from": "0xecee8507d92b9ab9da0afbf794f1e6e137170899",
            "gas": "0xf4515",
            "gasPrice": "0x0",
            "hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
            "input": "0x7898e0c2000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000431b4421e750000000000000000000000000000000000000000000000000000000061c0c21900000000000000000000000000000000000000000000000000000000000000074254432f55534400000000000000000000000000000000000000000000000000",
            "nonce": "0x110b",
            "r": "0xc85926d9a08b5e0635db6a50e86ac3a2ca271cbd47f68aad2a8ed54403c5c8d9",
            "s": "0x6b5f4ffcdde56b53c2b85b6f76bebc01e5dd86778496845c3fdc328adbb8f686",
            "to": "0x230182ad3e21144cc091514b3ac0f5e94b8925a7",
            "transactionIndex": "0x1",
            "v": "0x9c8a82ca",
            "value": "0x0"
        }
    ]
}

Ref: binance-chain#115

@rahul10puchd rahul10puchd requested a review from 0x3bfc as a code owner November 11, 2021 15:41
@rahul10puchd rahul10puchd marked this pull request as draft November 11, 2021 15:43
Copy link
Contributor

@0x3bfc 0x3bfc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

etc/methods.yaml Outdated Show resolved Hide resolved
etc/methods.yaml Outdated Show resolved Hide resolved
etc/methods.yaml Outdated Show resolved Hide resolved
src/servers/database.ts Outdated Show resolved Hide resolved
src/servers/database.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@0x3bfc 0x3bfc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check out my comments

src/servers/database.ts Outdated Show resolved Hide resolved
src/servers/database.ts Outdated Show resolved Hide resolved
src/servers/database.ts Outdated Show resolved Hide resolved
src/servers/database.ts Outdated Show resolved Hide resolved
0x3bfc
0x3bfc previously approved these changes Nov 19, 2021
Copy link
Contributor

@0x3bfc 0x3bfc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@0x3bfc 0x3bfc marked this pull request as ready for review November 19, 2021 17:07
@0x3bfc 0x3bfc requested a review from artob November 19, 2021 17:07
@artob artob added the enhancement New feature or request label Dec 1, 2021
Copy link
Contributor

@artob artob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rahul10-pu This PR includes no rationale for why it should be implemented and merged; further, it does not document these methods as nonstandard, it implements these methods inline in JS code instead of as stored procedures, and does not adhere to the code formatting standards.

@artob artob changed the title Covalent methods Add useful nonstandard covalent methods Dec 1, 2021
@artob artob changed the title Add useful nonstandard covalent methods Add useful nonstandard methods Dec 1, 2021
Copy link
Contributor

@artob artob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous feedback was only partially addressed. These are still not documented as nonstandard methods, and contextual & defined coding conventions are not honored. What's worse, the new methods have not been tested with real data and are incorrect by construction.

etc/methods.yaml Outdated Show resolved Hide resolved
etc/methods.yaml Outdated Show resolved Hide resolved
etc/schema.sql Outdated Show resolved Hide resolved
src/web3.ts Outdated Show resolved Hide resolved
src/servers/skeleton.ts Outdated Show resolved Hide resolved
src/servers/database.ts Outdated Show resolved Hide resolved
etc/methods.yaml Outdated Show resolved Hide resolved
src/web3.ts Outdated Show resolved Hide resolved
@artob artob assigned 0x3bfc and unassigned rahul10puchd Dec 10, 2021
@artob artob marked this pull request as draft December 12, 2021 20:45
@0x3bfc 0x3bfc changed the title Add useful nonstandard methods Support nonstandard RPC methods for partners Dec 20, 2021
@0x3bfc 0x3bfc changed the title Support nonstandard RPC methods for partners Support non-standard RPC methods for partners Dec 20, 2021
@0x3bfc 0x3bfc changed the title Support non-standard RPC methods for partners Support non-standard RPC methods for indexing services Dec 20, 2021
@0x3bfc 0x3bfc marked this pull request as ready for review December 21, 2021 08:19
@0x3bfc 0x3bfc requested a review from artob December 21, 2021 08:25
@0x3bfc
Copy link
Contributor

0x3bfc commented May 26, 2022

I am closing this PR as it outdated with the new updates of the relayer codebase. Please feel free to reopen it, if it is needed in the future.

@0x3bfc 0x3bfc closed this May 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants