Skip to content

fix(rpc): self-describe reads chain name from genesis#567

Merged
github-actions[bot] merged 2 commits into
mainfrom
fix/ops-self-describe-from-genesis
May 10, 2026
Merged

fix(rpc): self-describe reads chain name from genesis#567
github-actions[bot] merged 2 commits into
mainfrom
fix/ops-self-describe-from-genesis

Conversation

@satyakwok
Copy link
Copy Markdown
Member

Summary

Closes the deferred TODO from PR #560 (genesis `[chain].name` + METAMASK doc alignment). The `/` RPC root handler hardcoded `"name": "Sentrix"` on every network — testnet binaries pretended to be mainnet for any caller probing the self-describe endpoint.

What lands

  • New `pub chain_name: String` field on `Blockchain`, sourced from `genesis.chain.name` in `new_with_genesis`. Carries a serde default (`"Sentrix Chain"`) so pre-this-commit state-blob deserialisations keep working.
  • `crates/sentrix-rpc/src/routes/ops.rs` reads `bc.chain_name` instead of the hardcoded literal.

Impact

Mainnet `/` returns `"name": "Sentrix Chain"`; testnet returns `"Sentrix Testnet"`. Matches the canonical chainlist registry submission (ethereum-lists/chains#8266) + the genesis name-string field already aligned in PR #560.

Cosmetic only — wallets / chainid.network use `eth_chainId` (7119/7120) for identity, not the `/` endpoint. But honest self-describe is the right thing for any future tooling that probes it (block-explorer auto-config, dApp-ops dashboards, status pages).

Test plan

  • `cargo build --release -p sentrix-rpc` clean
  • `RUSTFLAGS="-D warnings" cargo check --workspace` clean
  • `cargo test test_mainnet_genesis_block_hash_matches_hardcoded` still passes (chain_name is metadata, not in block-hash invariants)
  • On a fresh testnet boot, `curl https://testnet-rpc.sentrixchain.com/\` returns `"name": "Sentrix Testnet"` (was `"Sentrix"` before)
  • Mainnet `/` returns `"name": "Sentrix Chain"`

Closes the deferred TODO from PR #560 (genesis [chain].name + METAMASK
doc alignment). The /  RPC root handler hardcoded "name": "Sentrix"
on every network — testnet binaries pretended to be mainnet for any
caller probing the self-describe endpoint.

Now Blockchain holds chain_name (sourced from genesis.chain.name in
new_with_genesis) and the route reads it. Mainnet returns "Sentrix
Chain", testnet returns "Sentrix Testnet" — matches the canonical
chainlist registry submission.

The chain_name field carries a serde default ("Sentrix Chain") to
keep pre-this-commit state-blob deserialisations working; real boot
always overwrites via new_with_genesis.

Field impact is purely cosmetic — wallets / chainid registry use
chain_id (eth_chainId) for identity, not the / endpoint. But honest
self-describe is the right thing for any future tooling that probes
it (block-explorer auto-config, dApp-ops dashboards, status pages).
@github-actions github-actions Bot enabled auto-merge (squash) May 10, 2026 22:30
@codecov
Copy link
Copy Markdown

codecov Bot commented May 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@satyakwok satyakwok disabled auto-merge May 10, 2026 22:35
The original commit relied on new_with_genesis to set chain_name,
but that path only runs on a fresh init. Existing chain.dbs (mainnet
+ testnet today) come up via load_blockchain, which deserialises an
old blob without the chain_name field — serde defaults silently
fired and testnet would still self-describe as "Sentrix Chain".

Override from the canonical chain_id mapping right after the blob
deserialises. First save_blockchain after this fix-up persists the
corrected name so subsequent boots find it already right.

Custom chain_ids (third-party deployments) fall through to whatever
genesis set; we only normalise the two we ship.
@github-actions github-actions Bot enabled auto-merge (squash) May 10, 2026 22:38
@github-actions github-actions Bot merged commit bafafb2 into main May 10, 2026
8 checks passed
github-actions Bot pushed a commit that referenced this pull request May 11, 2026
Captures the post-#564 stack as a distinct version label:
- #564 BFT votes over gossipsub (wire SENTRIX_PROTOCOL 2.0.0 -> 2.1.0)
- #565 Fix A: async chain.db save off BFT critical path
- #566 Fix C: speculative pre-build of next proposal
- #567 self-describe chain_name from genesis + load-fixup
- #568 remove inbound-silence watchdog

Multiple distinct binaries shipped under 2.1.91 today during the
mainnet stall recovery cycle. Bumping so the next build maps 1:1 to
a single sha + version label.

Going forward: every chain-touching PR bumps in the same commit set
(see operator memory feedback_bump_version_per_fix.md).
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