refactor(sdk): deprecate the context-alias helpers and drop the ring stubs - #294
Open
Imod7 wants to merge 5 commits into
Open
refactor(sdk): deprecate the context-alias helpers and drop the ring stubs#294Imod7 wants to merge 5 commits into
Imod7 wants to merge 5 commits into
Conversation
📦 Bundle size impactComparing
Thresholds — warn: ≥10% or ≥5.0 KB · fail: ≥20% or ≥15.0 KB (bundled). Percentage only applies once the baseline is ≥ 10 KB. |
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.
Part of #286
Refs #287, which stays open for the personhood read layer.
Description
@parity/product-sdk/identityexported five alias functions. Three raised an error on everycall, whatever you passed in. This PR deletes those three, so calling code now fails to build
instead of failing at runtime.
The other two work, but return an address that can receive funds and can never send them: the key
is a blake2b hash of the parent public key, and a hash has no matching private key, so nothing can
ever sign for it. Both are now deprecated, name the release that removes them (0.23.0), and list
what to use instead. Their output is unchanged, so no caller changes behaviour.
Changes
packages/sdk/src/identity/product-account.tsderiveAnonymousAlias,createRingProof,verifyRingProof. DeprecatedderiveContextAlias,verifyContextAliaspackages/sdk/src/identity/types.tsAnonymousAliasInfoandRingLocation. DeprecatedContextAliasInfoRingLocationshaped{ringIndex, memberIndex}, the opposite of the protocol type{chainId, junctions}packages/sdk/src/identity/index.tspackages/sdk/src/identity/product-account.test.tspackages/signer/src/providers/host.tsRingLocationshape. That was the opposite shape, and this PR deletes itpending-changesets/deprecate-context-alias.md@parity/product-sdkminor,@parity/product-sdk-signerpatchDotNS is untouched.
resolveDotNs,reverseDotNs,resolvePeopleUsernameOwnerand the namehelpers work as before, and the subpath itself is not deprecated.
Why these changes
Funds sent to a
deriveContextAliasaddress are unrecoverable, and nothing surfaces until valuearrives, because the address validates like any other. The old docs made it worse by printing the
address in an example with no warning. This is the first time the SDK says so.
The three deleted functions could never work, so deleting them turns a guaranteed runtime error
into a compile error. A
@deprecatedtag adds nothing to a function that already throws.The two working helpers are deprecated instead, because a caller may be using the value as a
plain identifier where the address property is irrelevant. Those callers are not broken and get a
release to move. For the same reason the output is left alone: the same function returning
different bytes would break them silently, with no compile error. Removal at a minor is in
policy, since
RELEASES.mdmakes any pre-1.0 breaking change a minor.The signer change follows from deleting identity's
RingLocation, which a comment there pointedat. It takes a patch because that comment ships in the published
.d.ts, and that patch cascadesa version bump to five dependent packages containing no change, which is expected.
Testing
From
product-sdk/:@parity/product-sdk@parity/product-sdk-signerRelated issues
#287 is a sub-issue of the #286 tracker and this PR does half of it. The substantive reason is that the three deleted functions are stubs for what #289 builds for real:
deriveAnonymousAliaswas a placeholder for ring VRF aliases, and identity'sRingLocationwas a wrong-shaped duplicate of the protocol type #289 uses. Leaving them in place would mean two same-named types of opposite shape once that lands. NeitherPart ofnorRefsis a closing keyword, so nothing auto-closes here.