Skip to content

test: support debug_getRaw* RPCs#257

Closed
JonathanOppenheimer wants to merge 10 commits intomainfrom
JonathanOppenheimer/test-debug-raw-rpcs
Closed

test: support debug_getRaw* RPCs#257
JonathanOppenheimer wants to merge 10 commits intomainfrom
JonathanOppenheimer/test-debug-raw-rpcs

Conversation

@JonathanOppenheimer
Copy link
Copy Markdown
Contributor

@JonathanOppenheimer JonathanOppenheimer commented Mar 3, 2026

This PR adds test coverage for the remaining debug_getRaw* RPC methods, now that BlockByNumberOrHash and GetReceipts have been implemented. I also added coverage for debug_printBlock as it seems this was mistakenly added to the list without being tested.

@JonathanOppenheimer JonathanOppenheimer self-assigned this Mar 3, 2026
@JonathanOppenheimer JonathanOppenheimer added the testing Related to testing efforts label Mar 3, 2026
@JonathanOppenheimer JonathanOppenheimer changed the title test: support debug_getRaw* RPCs test: support debug_getRaw* RPCs Mar 3, 2026
@JonathanOppenheimer JonathanOppenheimer marked this pull request as ready for review March 3, 2026 20:01
Copy link
Copy Markdown
Contributor

@StephenButtolph StephenButtolph left a comment

Choose a reason for hiding this comment

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

Related comment from a prior PR: #154 (comment)

@JonathanOppenheimer
Copy link
Copy Markdown
Contributor Author

Related comment from a prior PR: #154 (comment)

Addressed.

Copy link
Copy Markdown
Contributor

@alarso16 alarso16 left a comment

Choose a reason for hiding this comment

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

Seems ok, more test coverage can't be bad

@JonathanOppenheimer JonathanOppenheimer force-pushed the JonathanOppenheimer/test-debug-raw-rpcs branch from 4dda5c0 to 33aa6fa Compare March 13, 2026 16:43
@JonathanOppenheimer JonathanOppenheimer force-pushed the JonathanOppenheimer/test-debug-raw-rpcs branch from 33aa6fa to 7260f32 Compare March 13, 2026 16:45
@JonathanOppenheimer
Copy link
Copy Markdown
Contributor Author

JonathanOppenheimer commented Mar 13, 2026

Note that #280 did introduce another behavior change -- notFoundIsNil() swallows ErrFutureBlockNotResolved (since it wraps ErrNotFound), so debug_getRawBlock and debug_getRawHeader return nil for unknown block numbers instead of an error as it did previously.

Copy link
Copy Markdown
Contributor

@powerslider powerslider left a comment

Choose a reason for hiding this comment

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

LGTM! I just created this PR with some more test cases for TestGetReceipts if you want to optionally enhance the test coverage.

powerslider and others added 3 commits March 16, 2026 14:13
In `TestGetReceipts` - new entries in the test table covering previously
untested lookup paths:
- `debug_getRawReceipts` (and `eth_getBlockReceipts`) by explicit block
number for on-disk, settled, and unsettled blocks - previously only
tested by hash.
- `debug_getRawReceipts` (and `eth_getBlockReceipts`) for
`SafeBlockNumber` and `FinalizedBlockNumber` - previously only
`LatestBlockNumber` was covered.

Signed-off-by: Tsvetan Dimitrov (tsvetan.dimitrov@avalabs.org)
Comment thread sae/rpc_test.go Outdated
Comment thread sae/rpc_test.go Outdated
Comment thread sae/rpc_test.go
want: hexutil.Bytes(marshaled),
},
{
method: "debug_getRawTransaction",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What's the difference between this call and the one above?? To be clear, out of curiosity - these seem like the same API but with different names

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.

Geth weirdness I think. eth_getRawTransactionByHash is an undocumented API while debug_getRawTransaction is documented, but would only be available here when EnableDBInspecting is enabled.

They both end up calling GetTransaction -> rawdb.ReadTransaction. 🤷

@JonathanOppenheimer
Copy link
Copy Markdown
Contributor Author

Superseded by ava-labs/avalanchego#5284.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testing Related to testing efforts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants