fix: reject unknown network names, normalize IntegerType unlock heights - #1878
Open
jannik-stacks wants to merge 1 commit into
Open
fix: reject unknown network names, normalize IntegerType unlock heights#1878jannik-stacks wants to merge 1 commit into
jannik-stacks wants to merge 1 commit into
Conversation
jannik-stacks
commented
Aug 17, 2026
Collaborator
- reject unknown network names
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR tightens correctness around network selection and lock-proof construction by normalizing IntegerType unlock heights and preventing silent fallback to mainnet when an unknown network name is provided.
Changes:
- Normalize
IntegerTypeunlock heights when building lock proofs. - Reject unrecognized network name strings instead of returning them and falling through to mainnet params.
- Correct
EarnedRewardsunit documentation (sBTC sats vs micro-STX).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/bitcoin-staking/src/types.ts | Fixes EarnedRewards unit documentation to match current semantics. |
| packages/bitcoin-staking/src/proof.ts | Normalizes unlockHeight conversion before placing it in the lock proof object. |
| packages/bitcoin-staking/src/network.ts | Adds explicit validation for supported network name strings and throws on unknowns. |
| .changeset/witty-otters-unlock.md | Announces patch changes for unlock-height normalization + docs fix. |
| .changeset/spotty-planes-refuse.md | Announces patch change for rejecting unrecognized network strings. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| txIndex: input.merkleProof.pos, | ||
| amount, | ||
| unlockBurnHeight: Number(input.unlockHeight), | ||
| unlockBurnHeight: Number(intToBigInt(input.unlockHeight)), |
Comment on lines
+18
to
+31
| if (typeof network === 'string') { | ||
| if ( | ||
| network === 'mainnet' || | ||
| network === 'testnet' || | ||
| network === 'devnet' || | ||
| network === 'mocknet' | ||
| ) { | ||
| return network; | ||
| } | ||
| // An unrecognized name would miss the closed per-network tables downstream | ||
| // and silently fall through to mainnet params (e.g. a mainnet lock address | ||
| // for `'regtest'`), so reject it here. | ||
| throw new Error(`networkNameFrom: unrecognized network name '${network}'`); | ||
| } |
| // An unrecognized name would miss the closed per-network tables downstream | ||
| // and silently fall through to mainnet params (e.g. a mainnet lock address | ||
| // for `'regtest'`), so reject it here. | ||
| throw new Error(`networkNameFrom: unrecognized network name '${network}'`); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.