Skip to content

cmd/workload: implement checks for history-pruned node #31355

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

Merged
merged 13 commits into from
Mar 13, 2025

Conversation

jwasinger
Copy link
Contributor

No description provided.

@jwasinger jwasinger marked this pull request as draft March 11, 2025 14:51
@jwasinger jwasinger marked this pull request as ready for review March 11, 2025 17:31
@fjl
Copy link
Contributor

fjl commented Mar 11, 2025

It's not supposed to skip these tests, it should still call the function but check that the returned error has the correct error code (4444).

@jwasinger
Copy link
Contributor Author

Yesterday, you said that this could be worked on right now even though we don't currently have the history-truncation rpc error return implemented. I took that to mean that we would just skip affected test cases.

@fjl
Copy link
Contributor

fjl commented Mar 12, 2025

Yeah, so what I mean is, these tests would fail against a pruned node. But that's OK. They already fail now because the node returns an arbitrary error.

@jwasinger
Copy link
Contributor Author

Okay, so afaict this is blocked until we can surface the pruned history error from the relevant rpc calls, which itself requires the dependent components under the hood to properly distinguish it.

@fjl
Copy link
Contributor

fjl commented Mar 12, 2025

No it's not. You can just add a verification for the error code here.

@jwasinger jwasinger force-pushed the workload-skip-premerge branch from aa090ca to 9d5c9f3 Compare March 12, 2025 08:31
@fjl
Copy link
Contributor

fjl commented Mar 12, 2025

Maybe add a helper function for this check

@jwasinger
Copy link
Contributor Author

Yeah agreed, it's a bit verbose.

// code of 4444.
func errIsPrunedHistory(err error) bool {
if err != nil {
if rpcErr := err.(rpc.Error); rpcErr != nil && rpcErr.ErrorCode() == 4444 {
Copy link
Contributor

Choose a reason for hiding this comment

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

rpcErr := err.(rpc.Error) will crash if it doesn't satisfy the interface. You need to capture the second return value to check if it was OK.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oof

@jwasinger
Copy link
Contributor Author

TODO (self): ensure in the tests that if the 4444 code is emitted when the test block (or range) is passed the prune threshold, the tests error.

@fjl fjl changed the title cmd/workload: skip test cases that would access pre-merge history cmd/workload: implement checks for history-pruned node Mar 12, 2025
@MariusVanDerWijden
Copy link
Member

lint is red, also pls add a pr description

@fjl fjl force-pushed the workload-skip-premerge branch from 3bb3667 to b0eaf5f Compare March 13, 2025 11:22
Copy link
Contributor

@fjl fjl left a comment

Choose a reason for hiding this comment

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

It's not pretty, but there isn't really a good way to do this better.

@fjl fjl merged commit 444a6d0 into ethereum:master Mar 13, 2025
3 of 4 checks passed
GrapeBaBa pushed a commit to optimism-java/shisui that referenced this pull request Mar 16, 2025
@rjl493456442 rjl493456442 added this to the 1.15.6 milestone Mar 17, 2025
sivaratrisrinivas pushed a commit to sivaratrisrinivas/go-ethereum that referenced this pull request Apr 21, 2025
Rampex1 pushed a commit to streamingfast/go-ethereum that referenced this pull request May 15, 2025
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.

4 participants