Skip to content

feat(rpc): implement getGenesisHash RPC method#1205

Open
ajw221 wants to merge 5 commits intomainfrom
adamw/implement-getGenesisHash-in-rpc
Open

feat(rpc): implement getGenesisHash RPC method#1205
ajw221 wants to merge 5 commits intomainfrom
adamw/implement-getGenesisHash-in-rpc

Conversation

@ajw221
Copy link
Contributor

@ajw221 ajw221 commented Feb 3, 2026

Intent

  • Implement getGenesisHash RPC method

Implementation

  • Updated GenesisConfig to store its precomputed hash
  • Updated Hooks.set to be able to take a pointer to a value
  • Created StaticHookContext for implementing any future RPC methods containing static data

Ramifications

  • The approach to storing genesis_hash on StaticHookContext currently only works if a pointer to the rpc hook is given, otherwise if an owned value for the rpc hook is given, an integer overflow will occur on method call due to the passed in value becoming a dangling slice. Because the lifetime of the value lives for the entire runtime of the RPC server this shouldn't be an issue.

Tests

  • Added asserts to GenesisConfig unit tests around ensuring each precomputed hash matches agave's values.

@ajw221 ajw221 self-assigned this Feb 3, 2026
@ajw221 ajw221 requested review from dnut, ultd and yewman as code owners February 3, 2026 21:02
@github-project-automation github-project-automation bot moved this to 🏗 In progress in Sig Feb 3, 2026
@codecov
Copy link

codecov bot commented Feb 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
src/core/genesis_config.zig 100.00% <100.00%> (ø)
src/rpc/hooks.zig 97.36% <ø> (ø)
src/rpc/methods.zig 82.35% <100.00%> (+2.69%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-project-automation github-project-automation bot moved this from 🏗 In progress to 👀 In review in Sig Feb 4, 2026
@ajw221 ajw221 requested a review from Rexicon226 February 4, 2026 21:37
yewman
yewman previously approved these changes Feb 11, 2026
- Add StaticHookContext to provide genesis hash to RPC handlers
- Support pointer types in Hooks.set for context registration
- Compute genesis config hash from file bytes during deserialization
- Add hash verification to genesis config tests for testnet, devnet, and mainnet
- Use readFromSlice instead of fixedBufferStream + reader
- Add explicit 100 MB max file size limit
- Change genesis_hash from Base58String to Hash type
- Add custom jsonStringify to GetGenesisHash.Response for base58 output
- Simplify getGenesisHash method to return wrapped Hash
@ajw221 ajw221 force-pushed the adamw/implement-getGenesisHash-in-rpc branch from 6f9125b to 4fcb236 Compare February 12, 2026 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 👀 In review

Development

Successfully merging this pull request may close these issues.

3 participants