Skip to content

feat(statics): add constantAddressPrefix for Hedera account IDs (WCN-4586) - #10173

Open
noegutierrez5 wants to merge 1 commit into
masterfrom
noegutierrez/wcn-4586-bitgojs-express-hbar-constant-account
Open

noegutierrez5 wants to merge 1 commit into
masterfrom
noegutierrez/wcn-4586-bitgojs-express-hbar-constant-account

Conversation

@noegutierrez5

Copy link
Copy Markdown
Contributor

Summary

  • Adds an optional constantAddressPrefix?: string to the AccountNetwork interface in modules/statics/src/networks.ts — additive, non-breaking; no other network record changes.
  • Sets constantAddressPrefix = '0.0.' on the Hedera (mainnet) and HederaTestnet network records: every account ID on the public Hedera networks is 0.0.<num> (shard 0, realm 0; non-zero realms exist only on private networks and non-zero shards are not active on any network).
  • Deliberately a NEW field, not a reuse of addressPrefix: that field is documented as a bech32 HRP and is consumed as one by the cosmos-family coin modules, so it must not be repurposed for a literal, non-checksummed prefix.

Context

Ticket: WCN-4586

Consumers that need "the constant literal part of every address on this network" (as opposed to a bech32 HRP or a chainId) currently have no statics field to read it from, so they must either hardcode per-coin knowledge or fall back to comparing raw addresses. Hedera is the first such network; the field is generic so future networks can set it without further interface changes.

Value table

Network constantAddressPrefix
main.hedera 0.0.
test.hedera 0.0.

Both values verified independently (mainnet and testnet public mirror-node account IDs are all 0.0.<num>; not copy-pasted between the two records).

How Has This Been Tested?

  • modules/statics/test/unit/networks.ts: per-network assertions that constantAddressPrefix is '0.0.' and that the bech32 addressPrefix stays unset (4 new tests, following the Cosmos-family addressPrefix table pattern from feat(statics): expose bech32 HRP via AccountNetwork.addressPrefix (WCN-606) #8848).
  • Statics unit specs (12 standalone spec files): 3,443 passing including the new tests.
  • test/unit/coins.ts (38,534 assertions) passes with and without this change — run with its single out-of-package import (sdk-coin-evm, used only in an instanceof guard in that spec) stubbed, outside a sparse checkout; CI runs it for real.
  • tsc --noEmit on the statics project: clean; negative control (mistyped field value) produces TS2345, so the check bites.
  • prettier --check with the repo config: clean.
  • No CHANGELOG edit: release tooling generates it from the conventional commit.

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • My code compiles correctly for both Node and Browser environments
  • I have commented my code, particularly in hard-to-understand areas
  • My commits follow Conventional Commits (feat(statics): …, footer Ticket: WCN-4586)
  • The ticket was included in the commit message as a reference
  • I have added tests that prove my feature works
  • New and existing unit tests pass locally with my changes (statics module; full monorepo build left to CI)

Optional literal prefix shared by every address on a network, with no checksum or
encoding. Set to '0.0.' on the Hedera mainnet and testnet network records: every
account ID on the public Hedera networks is 0.0.<num> (shard 0, realm 0). Kept
separate from addressPrefix, which is documented as a bech32 HRP and consumed as
one by the cosmos-family coin modules. Additive and non-breaking; no other
network record changes. No CHANGELOG edit: release tooling generates it from
the conventional commit.

Ticket: WCN-4586
@noegutierrez5
noegutierrez5 requested a review from a team as a code owner November 12, 2026 11:47

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

@linear-code

linear-code Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

WCN-4586

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Compatibility checks are failing on Node.js 27-nightly (experimental, non-blocking). This does not block merge, but it signals an incompatibility to fix before this release becomes supported.

View run

Copy link
Copy Markdown
Contributor Author

@claude review and git approval rating

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @noegutierrez5's task in 20s —— View job


Review of #10173: constantAddressPrefix for Hedera

  • Read the diff and the surrounding code
  • Post review

Verdict: looks good to merge (LGTM), with a few optional nits. I can't submit a formal GitHub approval, so a human reviewer still needs to approve. I reviewed the diff only and didn't run the tests myself. The branch has no merge base with origin/master in this checkout, so I read the single commit (git show HEAD) instead.

What I checked

  • modules/statics/src/networks.ts
    • The new constantAddressPrefix?: string on AccountNetwork is optional and readonly. The change is additive and doesn't break existing consumers.
    • Giving it a separate field from addressPrefix is the right call. Cosmos-family modules read addressPrefix as a bech32 HRP, so reusing it for a literal prefix would be risky. The comment on the interface explains this.
    • Hedera and HederaTestnet both set '0.0.'. Both classes already implement AccountNetwork, so the types line up.
  • modules/statics/test/unit/networks.ts
    • The new tests check the value on both networks. They also check that addressPrefix stays unset, so a later change can't mix the two fields up.
    • The tests follow the existing Cosmos addressPrefix table pattern.
  • Commit: it follows conventional commits (feat(statics): ...) and has the Ticket: WCN-4586 footer that commitlint requires.

Nits (non-blocking)

  1. Naming. Hedera account IDs are shard.realm.num, so 0.0. is really a shard/realm prefix. The name constantAddressPrefix works because the field is generic, and the doc comment already says this.
  2. Private networks. The PR description notes that non-zero realms exist on private Hedera networks. Anyone using this field for validation should treat it as "public networks only". Adding that to the interface comment would help future consumers.
  3. Scope. There is no consumer yet. The PR description says the work is for the express/HBAR ticket, so I assume the consumer comes in a follow-up PR.

CI

The only failing check is the experimental Node 27-nightly job, which is non-blocking. The diff doesn't touch anything Node-version-specific, so it's unlikely to be related to this PR.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code review found no issues

No high-confidence issues detected in this change.

This branch has not been deployed

No deployments
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