Skip to content

cmd/rpctest: fix debug_accountRange bench encoding and start key size#21774

Open
lupin012 wants to merge 4 commits into
mainfrom
lupin012/fix_rpctest_accountrange_encoding
Open

cmd/rpctest: fix debug_accountRange bench encoding and start key size#21774
lupin012 wants to merge 4 commits into
mainfrom
lupin012/fix_rpctest_accountrange_encoding

Conversation

@lupin012

Copy link
Copy Markdown
Contributor

Summary

  • request_generator.go: replace base64.StdEncoding.EncodeToString with hexutil.Encode for the start parameter — the server expects a 0x-prefixed hex string, not base64
  • bench3.go, bench9.go, account_range_verify.go: replace the initial page cursor from common.Hash{}[:] (32 bytes, rejected by the server) to common.Address{}[:] (20 bytes)
  • request_generator_test.go: update test cases to use 20-byte addresses and hex-encoded expected strings

Test plan

  • go test ./cmd/rpctest/rpctest/... -run TestRequestGenerator_accountRange passes
  • go test ./rpc/jsonrpc/... -run TestAccountRange passes
  • make lint clean

bench1/3/9 and account_range_verify were encoding the start key as
base64 (Geth legacy format) and using a 32-byte zero hash as the
initial page cursor. AccountRange now expects a 0x-prefixed hex string
and rejects keys longer than 20 bytes, so both assumptions were wrong.

Switch to hexutil.Encode and initialise the page cursor from a zero
common.Address (20 bytes). Update request_generator_test.go to match.
@lupin012 lupin012 marked this pull request as draft June 12, 2026 19:10
@lupin012 lupin012 marked this pull request as ready for review June 14, 2026 05:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant