Skip to content

EIP-4444: Add RPC errors for pruned blocks. Take 2#8521

Merged
brbrr merged 20 commits into
masterfrom
add/eip-4444-rpc-error-2
Apr 22, 2025
Merged

EIP-4444: Add RPC errors for pruned blocks. Take 2#8521
brbrr merged 20 commits into
masterfrom
add/eip-4444-rpc-error-2

Conversation

@brbrr

@brbrr brbrr commented Apr 14, 2025

Copy link
Copy Markdown
Contributor

Resolves #8493

This is a second take on (first: #8501) that with the scope limited to RPC without any changes to BlockTree etc

Affected RPC:

  • eth_getBlockByHash
  • eth_getBlockByNumber
  • eth_getBlockTransactionCountByHash
  • eth_getBlockTransactionCountByNumber
  • eth_getUncleCountByBlockHash
  • eth_getUncleCountByBlockNumber
  • eth_getBlockReceipts
  • eth_getTransactionByBlockHashAndIndex
  • eth_getTransactionByBlockNumberAndIndex
  • eth_getTransactionReceipt

Changes

  • Exposed syncConfig in EthRpcModule for checking the ancient barriers
  • Updated relevant handler to check if block is missing and is below ancient barrier
  • Added tests for access of pruned blocks

Types of changes

What types of changes does your code introduce?

  • Bugfix (a non-breaking change that fixes an issue)
  • New feature (a non-breaking change that adds functionality)
  • Breaking change (a change that causes existing functionality not to work as expected)
  • Optimization
  • Refactoring
  • Documentation update
  • Build-related changes
  • Other: Description

Testing

Requires testing

  • Yes
  • No

If yes, did you write tests?

  • Yes
  • No

Notes on testing

Optional. Remove if not applicable.

Documentation

Requires documentation update

  • Yes
  • No

If yes, link the PR to the docs update or the issue with the details labeled docs. Remove if not applicable.

Requires explanation in Release Notes

  • Yes
  • No

If yes, fill in the details here. Remove if not applicable.

Remarks

Optional. Remove if not applicable.

@brbrr brbrr self-assigned this Apr 14, 2025
Comment thread src/Nethermind/Nethermind.JsonRpc/Modules/Eth/EthRpcModule.cs Outdated
Comment thread src/Nethermind/Nethermind.JsonRpc/Modules/Eth/EthRpcModule.cs Outdated
Comment thread src/Nethermind/Nethermind.JsonRpc/Modules/Eth/EthRpcModule.cs Outdated
Comment on lines -996 to -1002
[Test]
public async Task Eth_get_transaction_receipt_returns_null_on_missing_receipt()
{
using Context ctx = await Context.Create();
string serialized = await ctx.Test.TestEthRpc("eth_getTransactionReceipt", TestItem.KeccakA.ToString());
Assert.That(serialized, Is.EqualTo("{\"jsonrpc\":\"2.0\",\"result\":null,\"id\":67}"));
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I removed this test, as it feels kinda useless now - Now, when the receipt is missing, we return "History pruned" error instead. I'm not sure if there is a point in retaining previous functionality tho

@LukaszRozmej LukaszRozmej left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Few very minor things

Comment thread src/Nethermind/Nethermind.JsonRpc/Modules/BlockFinderExtensions.cs Outdated
Comment thread src/Nethermind/Nethermind.JsonRpc/Modules/BlockFinderExtensions.cs Outdated
Comment thread src/Nethermind/Nethermind.JsonRpc/Modules/Eth/EthRpcModule.cs Outdated
Comment thread src/Nethermind/Nethermind.JsonRpc/Modules/Eth/EthRpcModule.cs Outdated
@brbrr brbrr merged commit af0b049 into master Apr 22, 2025
@brbrr brbrr deleted the add/eip-4444-rpc-error-2 branch April 22, 2025 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Adjust RPC errors for 4444

3 participants