feat(sdk): [BBND-1775] resolveLatestConfigVersion + reject configVersion < 1#1191
Merged
Merged
Conversation
14 tasks
bbafa19 to
f25fdd4
Compare
50e0756 to
177d376
Compare
f25fdd4 to
da9de75
Compare
177d376 to
6587f6c
Compare
da9de75 to
c09d0e5
Compare
9e5425d to
247ad15
Compare
jaime-iobermudez
requested changes
May 25, 2026
247ad15 to
6def63b
Compare
c09d0e5 to
cf4d8bf
Compare
Base automatically changed from
feat/BBND-1775-contracts-explicit-version
to
development
May 25, 2026 12:54
jaime-iobermudez
approved these changes
May 25, 2026
Introduces `Management.resolveLatestConfigVersion({ resolverAddress,
configurationId })` so SDK consumers can resolve the latest
registered configuration version explicitly before pinning it on a
write call.
The query reads `DiamondCutManager.getLatestVersionByConfiguration`
on the supplied resolver via a new
`RPCQueryAdapter.getLatestVersionByConfiguration(resolverAddress,
configurationId)`. Wiring follows the existing CQRS plumbing:
`ResolveLatestConfigVersionRequest` (port-in) →
`ResolveLatestConfigVersionQuery` → handler decorated with
`@QueryHandler`. The handler is registered alongside the existing
ones in `QUERY_HANDLERS_RESOLVER`.
This pairs with the contract-side `VersionZero` revert from PR 1:
callers can no longer rely on `version == 0` to mean "latest"; they
must resolve the explicit number first.
Signed-off-by: Miguel_LZPF <miguel.carpena@io.builders>
Tightens validation on every request that carries a `configVersion`
and on every create-flow command handler so 0 (and any other
sub-1 value) is rejected at the SDK boundary instead of leaking
through to the chain.
Introduces a shared `MIN_CONFIG_VERSION = 1` constant in
`@core/Constants`, paired with the on-chain `VersionZero` revert.
`CreateEquityRequest`, `CreateBondRequest`,
`CreateBondFixedRateRequest`, `UpdateConfigVersionRequest`,
`UpdateConfigRequest`, and `UpdateResolverRequest` all use
`FormatValidation.checkNumber({ min: MIN_CONFIG_VERSION })`.
`CreateEquity` / `CreateBond` / `CreateBondFixedRate` /
`CreateBondKpiLinkedRate` command handlers extend the existing
`undefined` guard to also reject sub-1 values, with the new error
message pointing callers at `Management.resolveLatestConfigVersion`
when they need the latest version.
Signed-off-by: Miguel_LZPF <miguel.carpena@io.builders>
Brings the SDK test suite in line with the rejection rules:
- `Management.unit.test.ts`: new `resolveLatestConfigVersion`
describe block (happy path, query-bus failure, invalid
resolverAddress, non-bytes32 configurationId). Adds explicit
"configVersion is zero" cases to the existing
updateConfigVersion / updateConfig / updateResolver blocks.
- `Create{Equity,Bond,BondFixedRate,BondKpiLinkedRate}CommandHandler.unit.test.ts`:
update the legacy "Config Version not found" assertions to
match the new "Config Version must be >= 1" message and add a
parallel `configVersion: 0` case.
- `ResolveLatestConfigVersionQueryHandler.unit.test.ts`: new file
covering the happy path and error wrapping into
`ResolveLatestConfigVersionQueryError`.
- `__tests__/port/in/{Bond,Coupon}.test.ts` and
`__tests__/port/out/{AWSKMS,DFNS,Fireblocks}TransactionAdapter.test.ts`:
promote the shared `const configVersion = 0` fixture to `1`
so the deeper flows exercising request validation no longer
trip the new guard.
Adds a changeset capturing the new query, the
`MIN_CONFIG_VERSION` constant, and the tightened request /
handler validation.
Signed-off-by: Miguel_LZPF <miguel.carpena@io.builders>
6def63b to
24ee150
Compare
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
PR 2 of the BBND-1775 series (contracts → SDK → web). Aligns the SDK with the
contract-side
VersionZero(configurationId)revert introduced in PR 1(#1188).
Management.resolveLatestConfigVersion({ resolverAddress, configurationId })port-in method, backed by
ResolveLatestConfigVersionQuery+ handler and anew
RPCQueryAdapter.getLatestVersionByConfigurationcall that talks toDiamondCutManagerdirectly. Callers that previously relied onconfigVersion: 0to track "latest" now resolve the explicit number withthis query and pin it.
configVersion(
CreateEquityRequest,CreateBondRequest,CreateBondFixedRateRequest,UpdateConfigVersionRequest,UpdateConfigRequest,UpdateResolverRequest)via a shared
MIN_CONFIG_VERSION = 1constant in@core/Constants.CreateEquity/CreateBond/CreateBondFixedRate/CreateBondKpiLinkedRatecommand handlers to extend the existingundefinedguard to also reject sub-1 values, with a message pointingcallers at the new query.
This PR is stacked on #1188; merge order is contracts first, then SDK.
Refs: BBND-1775
Type of change
Testing
The 26 failures live in 5 custodial-adapter suites
(`Kyc.test.ts`, `Security.test.ts`, `AWSKMSTransactionAdapter.test.ts`,
`DFNSTransactionAdapter.test.ts`, `FireblocksTransactionAdapter.test.ts`)
and match the documented `.env`-dependent baseline. All
Management / Equity / Bond / Coupon suites pass; the
`Management.resolveLatestConfigVersion` describe block and the new
configVersion = 0 cases on the create-flow handlers all pass.
New tests added:
query-bus failure, invalid resolverAddress, non-bytes32 configurationId,
and explicit "configVersion is zero" cases for the
updateConfigVersion / updateConfig / updateResolver blocks.
and error wrapping into `ResolveLatestConfigVersionQueryError`.
`CreateBondKpiLinkedRate` command-handler unit tests → message
alignment + `configVersion: 0` rejection.
Test Results (if any)
`npm run ats:sdk:test` → 1902 passing / 1928 total / 26 baseline
custodial-adapter failures (no .env locally).
Node version:
Checklist