Skip to content

Conversation

@tnasu
Copy link
Contributor

@tnasu tnasu commented Feb 19, 2025

Proposed changes

Change the behavior of APIs when "pending" is given as an rpc.BlockNumber parameter.

1. Remove support for pending logs

  • Following single-shot APIs do not accept "pending" as a block number parameters fromBlock nor toBlock.
    • eth_getLogs, kaia_getLogs (src)
    • eth_newFilter, kaia_newFilter (src)
  • Following subscription APIs do not scan pending blocks when requested with "logs" event type (src) (docs)
    • eth_subscribe, kaia_subscribe
  • Users who have been using "pending" must now use "latest" for single-shot APIs for the same result.
  • Note that for ENs and PNs the behavior won't change as they don't mine blocks, thus pending block equals latest block.

2. Add support for pending blocks for feehistory and recover APIs

  • Following APIs, in CN, will now utilize currently mining block when given "pending" as a block argument.
    • eth_feeHistory, kaia_feeHistory (src)
    • kaia_recoverFromTransaction (src)
  • Users can keep using "pending" argument.
  • In EN and PN these APIs will behave the same. Pending block equals latest block.

3. Do not return error from simple query APIs

  • Following APIs no longer return error upon missing data. Instead they return null.
    • eth_getBlockTransactionCountByNumber, kaia_getBlockTransactionCountByNumber
    • eth_getBlockTransactionCountByHash, kaia_getBlockTransactionCountByHash
    • eth_getTransactionByBlockNumberAndIndex, kaia_getTransactionByBlockNumberAndIndex
    • eth_getTransactionByBlockHashAndIndex, kaia_getTransactionByBlockHashAndIndex
    • eth_getRawTransactionByBlockNumberAndIndex, kaia_getRawTransactionByBlockNumberAndIndex
    • eth_getRawTransactionByBlockHashAndIndex, kaia_getRawTransactionByBlockHashAndIndex
  • Users might need to handle the null result.

Types of changes

Please put an x in the boxes related to your change.

  • Bugfix
  • New feature or enhancement
  • Others

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have read the CONTRIBUTING GUIDELINES doc
  • I have read the CLA and signed by comment I have read the CLA Document and I hereby sign the CLA in first time contribute
  • Lint and unit tests pass locally with my changes ($ make test)
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in downstream modules

Related issues

Further comments

@tnasu tnasu self-assigned this Feb 20, 2025
@tnasu tnasu marked this pull request as ready for review February 20, 2025 01:32
@tnasu tnasu requested a review from 2dvorak February 20, 2025 01:32
@blukat29 blukat29 changed the title feat: update "pending" behavior api: Update pending block treatment Feb 20, 2025
@tnasu tnasu merged commit e2880e1 into kaiachain:dev Feb 25, 2025
9 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Feb 25, 2025
@tnasu tnasu deleted the dev-update-pending branch March 3, 2025 06:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants