Repository navigation
Conversation
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.
Summary
Fixes #9 for the codec layer:
encodeErgoAddressstored only the content bytes of any address that passedfrom_base58, anddecodeErgoAddressalways rebuilds a mainnet P2PK address from those bytes. Two kinds of input therefore passed validation and encoding, then produced a stuck or silently rerouted transfer:parseRosenDatawhen decoded (the extractor then returns nothing and the locked funds sit with no event) or are misread as a public key.Change
encodeErgoAddressandvalidateErgoAddressnow share one parse step that refuses addresses the stored format cannot represent, throwing the existingUnsupportedAddressError(with a reason) for:Address.from_mainnet_str), andaddress_type_prefix() !== P2Pk).The stored format and
decodeErgoAddressare unchanged: every mainnet P2PK address encodes byte-for-byte as before, and all previously stored values decode exactly as before. Watchers and extractors usingvalidateAddress/encodeAddressnow fail at admission — with an error a user can act on — instead of accepting a target the bridge cannot pay.Deliberate scope limits, flagged for maintainers:
rosen-bridge/ui(networks/base/src/validateAddress.ts, linked from Ergo Address Codec Accepts Testnet and P2S, Then Decodes as Mainnet P2PK #9) has its own copy of the permissive validation and should get the same restriction; it does not consume this package's validator.Verification
dev, pass with the fix. Package suite 10/10.@rosen-bridge/address-codec3/3,@rosen-bridge/address-manager4/4,@rosen-bridge/rosen-extractor228/228 — no existing test anywhere in this repo used a testnet or non-P2PK Ergo target.tsc --noEmit, eslint, and prettier clean on the changed files.Changeset included (
@rosen-bridge/address-codec-ergo: patch).