chore: bump the SDK to 31.0.0 - #43
Open
prashantasdeveloper wants to merge 16 commits into
Open
Conversation
The SDK narrowed SUPPORTED_SPEC_VERSION_RANGE to 8.x in 31.0.0-beta.1 and throws when connecting to a v7 node, so the suite is now v8 only and every v7 branch in it is unreachable. These changes have to land together: the bump does not compile until the removed APIs are gone, and the v7 gates cannot be dropped before the bump makes them dead. context.isV7 no longer exists, so isChainV7 silently returned undefined and quietly disabled the code it guarded. Remove it along with the branches it fed. withPendingInstructionBlock now shares getPendingInstructionEndBlock rather than keeping a v7 escape hatch, and that helper always resolves a block, so its return type loses the undefined. The ChildIdentity entity and every child identity API were removed from the SDK, so their example and (already skipped) suite go with them. Two suites were gated to v7 only and now run on v8: - The off chain settlement leg of tradeAssets. 30.1.1-beta.3 corrected the v8 receipt expiry and encoding, which is what kept it on v7. - createSto. The on chain funded parts pass on v8. Its off chain funding section is extracted into enableOffChainFunding and investWithOffChainFunding, and the invest is pinned as a known SDK defect: the chain's FundraiserReceiptDetails carries an expiresAt that offChainFundingReceiptDetailsToMeshReceiptDetails never sets, so it encodes as 0 and every off chain funded investment is rejected with sto.ReceiptExpired. generateOffChainFundingReceipt has no parameter to supply one either. The equivalent fix landed for settlement receipts in 30.1.1-beta.3 but not for STO funding receipts. relayer.removePayingKey was the v7 spelling of relayer.removeSubsidy, so the subsidy suite asserts the v8 tag directly.
BondPolyxParams.controller and SetStakingControllerParams were removed in 31.0.0-beta.1, and Staking.setController is now a no args procedure: a stash can only make itself its own controller. A stash is already bonded as its own controller on v8, so setController rejects with staking.AlreadyPaired. Assert that rather than a success, since the call only has an effect for legacy stashes that still have a separate controller. The separate controller account the suite used to bond through is gone; the stash signs bondExtra, unbond and withdraw itself. The remaining tests were gated to v7 and never ran on v8. They pass once they sign as the stash, so drop the gates. Also cover two behaviours the bump changed: - staking.getPayee returns null for an Account that has never bonded rather than throwing (31.0.0-beta.1). - Bonded POLYX shows up in the new reserved field on the Account balance (30.1.1-beta.2).
Covers Assets.getTickerRegistrationConfig and the ticker length validation it backs, both added in 30.2.0-beta.1. A ticker over the chain's maxTickerLength is now rejected by reserveTicker and createAsset before submission, and one exactly at the limit is accepted.
Covers BaseAsset.getIssuedInFundingRound, added in 30.2.0-beta.1. Asserts the initial supply lands against the round the Asset was created with, that further issuance accumulates into the current round, that each round is tracked separately across a modify, and that an unknown round reports zero.
30.1.1-beta.2 corrected how a POLYX balance is derived and exposed the raw chain values. free is now what the Account can actually spend, and reserved and frozen are surfaced alongside it. Pins the shape and the invariants that relate the components, and checks accountManagement.getAccountBalance agrees with Account.getBalance.
31.0.0-beta.1 corrected the protocol fee mapping against the v8 runtime, where fees for priced operations were silently reported as zero. Asserts a fee comes back for every requested tag, that priced operations report a non zero fee, and that the quoted fee matches what a prepared transaction reports through getTotalFees.
31.0.0-beta.1 and beta.2 rebuilt the transaction groups from the chain's own permission model, which changes what a permission UI built from TX_GROUP_TO_TAGS_MAP produces. Pins the mapping so a regression in the constants is caught without a chain round trip: RelayerManagement is gone, DidRegistration and InstructionMediation are new, MultiSigManagement is down to the one permission checked call, tags for extrinsics no longer on chain are absent, and nft.CreateNftCollection is reachable through an agent grantable group. Then grants the two new groups to a secondary key end to end, since they are newly grantable rather than relocated and no existing grant covers them.
30.2.0-beta.4 added pre-approval at the Portfolio level alongside the existing Identity level one, alongside Portfolio.preApprovedAssets. Covers preApproveAsset, isAssetPreApproved, preApprovedAssets and removeAssetPreApproval, and asserts the two levels stay independent: removing the Identity approval leaves the Portfolio one in place.
30.2.0-beta.5 added the registerDid procedure and 31.0.0-beta.1 renamed Identity.isCddProvider to isDidRegistrar, deprecated registerIdentity and reduced issuing a CDD claim to the DID Registrar role. Covers the happy path signed by a registrar, the rejections for an Account that already has an Identity and for a signer without the role, and both sides of the CDD claim role check.
31.0.0-beta.1 aligned TransferError with the errors the chain actually reports, removed the TransferStatus enum, dropped the CDD and investor uniqueness members, and added InvalidReceiverIdentity. canTransfer reports failures in its breakdown rather than throwing. Pins the enum membership and covers the breakdown for a valid transfer, an insufficient balance and frozen transfers. Two cases are asserted as they actually behave rather than as the names suggest. A transfer within one Identity is not a SelfTransfer on v8, since an Identity may move funds between its own holders. And a decimal amount for an indivisible Asset never reaches the chain to produce InvalidGranularity, because the SDK rejects it while encoding the call.
31.0.0-beta.5 changed Assets.transferFunds from void to Instruction | undefined and allowed transfers between asset holders on different Identities. Covers all three outcomes the return type encodes: undefined when the transfer settles immediately within one Identity, undefined when it settles immediately because the receiver auto affirms or has pre-approved the asset, and a resolved pending Instruction when the receiver has opted in to mandatory affirmation and has yet to affirm. Also covers the NFT leg, reworked in beta.5 and beta.7.
30.2.0-beta.2 added unlockInstruction, completing the lock/relock cycle for a SettleAfterLock instruction, and 30.2.0-beta.3 added getters for leg status and venue signer count. Walks the cycle as a mediator: lock for execution, read the lock info, read each leg's status, unlock back to pending, and read the relock cooldown the unlock starts. Then asserts a relock inside that cooldown is refused, which happens while the transaction is prepared rather than on submission. A receiver that has not opted in to mandatory affirmation is affirmed when the instruction is created, so the helper only affirms the receiving side when it is still pending. Venue.getSignerCount is asserted against getAllowedSigners in createVenue, where the off chain suites already exercise a venue with signers.
Covers Checkpoints.Schedules.getNextCheckpoint, added in 31.0.0-beta.3. With one active Schedule the aggregate should agree with that Schedule's own details, so the example asserts the date, the pending total and the Schedule attribution against it. The documented null case is split in two because only one half holds. An Asset that never had a Schedule reports null. An Asset whose Schedules have all been removed throws, and is pinned as a known SDK defect: the chain keeps cachedNextCheckpoints populated with a nextAt sentinel of u64::MAX, which momentToDate cannot convert.
Covers CorporateActionBase.getDocuments, added in 31.0.0-beta.4. Asserts a new Corporate Action starts with no linked documents, then links one through the Asset it was registered against and reads it back with its on-chain ID.
31.0.0-beta.8 fixes both SDK defects that were pinned as known-broken while the suite was on beta.7: - getNextCheckpoint now returns null once every Schedule has been removed, instead of throwing on the chain's u64::MAX nextAt sentinel. The checkpoint test asserts the documented null behaviour directly. - offChainFundingReceiptDetailsToMeshReceiptDetails now encodes expiresAt, so an off chain funded STO investment settles instead of being rejected as sto.ReceiptExpired. createSto asserts the investment succeeds instead of asserting it fails. This release also makes expiresAt required (previously optional) on generateOffChainAffirmationReceipt/generateOffChainFundingReceipt and their receipt types, part of the same fix. Both call sites in this suite already passed it, so no other change was needed.
31.0.0 is now published to the latest dist-tag with the same content as 31.0.0-beta.8 (its changelog is the squashed history of every 31.0.0-beta.* commit plus the beta.8 fix), so no other change is needed.
Collaborator
Author
|
I ran test against this branch - https://github.com/PolymeshAssociation/polymesh-dev-env/actions/runs/32014958375. All green ✅ |
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.
Description
Bumps
@polymeshassociation/polymesh-sdkfrom30.1.0to31.0.0dand updatesthe integration suite for every breaking and behavioral change in between, with new
coverage for each feature the SDK gained along the way.
SDK v31 drops chain v7 support (
SUPPORTED_SPEC_VERSION_RANGEnarrowed to8.x,throws on connect otherwise), so this suite is now v8-only.
isChainV7and every branchit fed are removed, along with the
ChildIdentityentity/example (removed from the SDK).envs/7.2can no longer be used with this suite — noted in the README.New coverage, one commit per area, matching each SDK release note between 30.1.0 and
31.0.0:
BaseAsset.getIssuedInFundingRoundfree/locked/reserved/frozen)(
InstructionMediation,DidRegistrationadded;RelayerManagementgone;MultiSigManagementreduced)registerDid,isDidRegistrar)TransferErrorenum andcanTransferreporting failures instead ofthrowing
Assets.transferFunds's newInstruction | undefinedreturn type across all foursettlement paths (same-Identity, auto-affirm, pending affirmation, NFT)
getLegStatus,Venue.getSignerCountCheckpoints.Schedules.getNextCheckpointCorporateActionBase.getDocumentsFixed along the way: two SDK defects were caught by this new coverage and pinned as
known-broken while the suite was on beta.7 —
getNextCheckpointthrowing instead ofreturning
nullonce every Schedule is removed, and STO off-chain funding receipts beingrejected as
sto.ReceiptExpiredbecauseexpiresAtwas never encoded. Both shipped fixedin
31.0.0-beta.8(which also makesexpiresAtrequired, not optional, on both receiptgenerators); the pins are flipped to assert the correct behavior in the final commit.
Also un-gates two suites that were v7-only and now pass on v8: the off-chain leg of
tradeAssets(receipt encoding fixed in30.1.1-beta.3) andcreateSto's off-chainfunding path.
Breaking Changes
None for this repo's own consumers — internal to the test suite. Note for anyone bumping
alongside this: SDK v31 requires chain v8+, and
expiresAtis now a required argument togenerateOffChainAffirmationReceipt/generateOffChainFundingReceipt.JIRA Link
Checklist