Skip to content

fix: use overlay prefix and correct depth for rchash command#675

Open
crtahlin wants to merge 1 commit intoethersphere:masterfrom
crtahlin:fix/rchash-anchor-prefix
Open

fix: use overlay prefix and correct depth for rchash command#675
crtahlin wants to merge 1 commit intoethersphere:masterfrom
crtahlin:fix/rchash-anchor-prefix

Conversation

@crtahlin
Copy link

Summary

Fixes #673

  • Truncate overlay to a short even-length hex prefix for the anchor parameter instead of passing the full 64-char overlay address, which caused 400 Bad Request or 500 Internal Server Error from the Bee API
  • Use committedDepth from node status as the default depth instead of topology.depth, which is the Kademlia routing depth and unrelated to the redistribution game
  • Add --depth option to allow overriding the sampling depth (range 0-32), useful for benchmarking at different depths (e.g. storageRadius vs committedDepth)
  • Add integration test for the utility rchash command

Details

The rchash command benchmarks the reserve commitment hash calculation that nodes perform during the Schelling game (storage incentives lottery). The previous implementation had two issues:

  1. The full overlay address was passed as the anchor, but the Bee API expects a short hex prefix (enough bytes to cover the depth bits). This caused API errors.
  2. topology.depth (Kademlia neighborhood depth) was used instead of committedDepth (the actual depth the node commits to the redistribution contract). These are different values — committedDepth = storageRadius + capacityDoubling.

The --depth flag allows operators to benchmark at specific depths, which is useful since sampling time varies significantly with depth (the node iterates through more reserve chunks at lower depths).

Test plan

  • npm run build succeeds
  • npm run check passes
  • npm run lint:check passes
  • New integration test test/command/utility.spec.ts passes
  • Full test suite shows no regressions
  • Verified against running Bee cluster (local dev and full node)

The rchash command was passing the full 64-char overlay address as anchor
and using topology.depth instead of the correct depth from node status.
This caused API errors and did not reflect the actual sampling parameters.

Changes:
- Truncate overlay to a short even-length hex prefix for the anchor
- Use committedDepth from node status as the default depth
- Add optional --depth flag to override the sampling depth
- Add integration test for the rchash command

Co-authored-by: AI
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.

utility rchash passes full overlay address as anchor instead of prefix — causes BeeResponseError / ECONNRESET

1 participant