Skip to content

feat(ttx): add versioned envelope for interactive protocol messages - #1700

Merged
adecaro merged 1 commit into
LFDT-Panurus:mainfrom
SuyashAlphaC:ttx-versioning-phase1
May 14, 2026
Merged

feat(ttx): add versioned envelope for interactive protocol messages#1700
adecaro merged 1 commit into
LFDT-Panurus:mainfrom
SuyashAlphaC:ttx-versioning-phase1

Conversation

@SuyashAlphaC

Copy link
Copy Markdown
Contributor

Summary

Implements Phase 1 (Foundation) of the TTX versioning proposal discussed in #1654.
This introduces a session-level Envelope wrapper for all JSON-typed interactive protocol messages, enabling strict version negotiation and message-type discrimination — addressing the silent failure mode when nodes running different
SDK versions exchange messages.

What's included

  • Envelope struct with compact wire fields (v=version, t=type, b=body) in token/services/utils/json/session/envelope.go
  • Strict versioning: receivers reject unversioned messages (ErrMissingVersion) and version mismatches (VersionError with errors.Is(ErrVersionMismatch) support)
  • Mandatory type discriminator with constants for all JSON-typed flows (TypeRecipientRequest, TypeWithdrawalRequest, TypeSpendRequest, etc.)
  • Session helpers: SendTyped, ReceiveTyped, ReceiveTypedWithTimeout for simplified versioned message exchange
  • Metrics instrumentation: EnvelopeMetrics (sent/received counters, error counter, body size histogram) using fabric-smart-client/platform/view/services/metrics
  • VersionCompatibility map and IsCompatible helper for future multi-version support
  • 27 unit tests + 3 benchmarks covering all error paths, concurrent operations, large payloads, and round-trip performance

Design decisions (per #1654 discussion with @adecaro)

Question Decision
Mixed-version policy Strict — reject unversioned
Field naming Terse (v/t/b)
Type discriminator Mandatory (no omitempty)
Coordination with #1622 Proceed independently
Raw-byte flows Out of scope for v1

Test plan

  • go vet ./... passes
  • gofmt clean
  • All 27 unit tests pass (go test -v -count=1 ./token/services/utils/json/session/...)
  • 3 benchmarks run successfully (WrapEnvelope, UnwrapEnvelope, RoundTrip)
  • No regressions in existing json/session tests

Comment thread token/services/utils/json/session/envelope.go Outdated
@adecaro
adecaro self-requested a review May 13, 2026 12:25
@adecaro adecaro self-assigned this May 13, 2026
@adecaro adecaro added enhancement New feature or request ttx labels May 13, 2026
@adecaro adecaro added this to the Q2/26 milestone May 13, 2026
@adecaro

adecaro commented May 13, 2026

Copy link
Copy Markdown
Contributor

Hi @SuyashAlphaC , thanks for starting this 🙏
I left a comment. Please, create also Issues as you go. Thanks 🙏

@SuyashAlphaC
SuyashAlphaC force-pushed the ttx-versioning-phase1 branch from b491443 to fb11975 Compare May 14, 2026 04:23
Implements Phase 1 (Foundation) of the TTX versioning proposal (LFDT-Panurus#1654).
Introduces a session-level Envelope wrapper for all JSON-typed interactive
protocol messages, enabling strict version negotiation and message-type
discrimination.

- Envelope struct with compact wire fields (v/t/b)
- Strict versioning: reject unversioned and mismatched versions
- Mandatory type discriminator with constants for all flows
- Session helpers: SendTyped, ReceiveTyped, ReceiveTypedWithTimeout
- Metrics instrumentation (sent/received/error counters, body size)
- VersionCompatibility map for future multi-version support
- 27 unit tests + 3 benchmarks

Signed-off-by: SuyashAlphaC <suyashagrawal862@gmail.com>
@adecaro
adecaro force-pushed the ttx-versioning-phase1 branch from fb11975 to 79e6403 Compare May 14, 2026 05:11

@adecaro adecaro left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks @SuyashAlphaC , please, attach the Issue to this PR. Thanks 🙏

@adecaro
adecaro merged commit 3a689ac into LFDT-Panurus:main May 14, 2026
94 checks passed
HayimShaul pushed a commit that referenced this pull request May 14, 2026
…1700)

Signed-off-by: SuyashAlphaC <suyashagrawal862@gmail.com>
HayimShaul pushed a commit that referenced this pull request May 14, 2026
…1700)

Signed-off-by: SuyashAlphaC <suyashagrawal862@gmail.com>
HayimShaul pushed a commit that referenced this pull request May 14, 2026
…1700)

Signed-off-by: SuyashAlphaC <suyashagrawal862@gmail.com>
Signed-off-by: Hayim.Shaul@ibm.com <hayimsha@fhe03.vpc.cloud9.ibm.com>
HayimShaul pushed a commit that referenced this pull request May 14, 2026
…1700)

Signed-off-by: SuyashAlphaC <suyashagrawal862@gmail.com>
Signed-off-by: Hayim.Shaul@ibm.com <hayimsha@fhe03.vpc.cloud9.ibm.com>
AkramBitar pushed a commit that referenced this pull request May 20, 2026
Signed-off-by: Shashank <yshashank959@gmail.com>

fix(multisig,boolpolicy): verify spend tx matches approved SpendRequest (#1691)

Signed-off-by: SuyashAlphaC <suyashagrawal862@gmail.com>

fsc v0.11.0 (#1702)

Signed-off-by: Angelo De Caro <adc@zurich.ibm.com>

feat(ttx): add versioned envelope for interactive protocol messages (#1700)

Signed-off-by: SuyashAlphaC <suyashagrawal862@gmail.com>

fix(recovery): unblock queue head by marking NotFound orphans Deleted after grace period (#1708)

Signed-off-by: Evan <evanyan@sign.global>

fix: cachedFetcher.update() no longer blocks token reads during DB refresh (#1535)

Signed-off-by: Nitesh <nitesh@example.com>
Signed-off-by: Nitesh Kumar <niteshkumar121411@gmail.com>
Signed-off-by: NETIZEN-11 <kumarnitesh979875@gmail.com>

perf(bulletproof): optimize IPA prover with batched MSMs (#1719)

Signed-off-by: Ankit Basu <ankitbasu14@gmail.com>

replace mutex with context aware semaphore (#1616)

Signed-off-by: Hayim.Shaul@ibm.com <hayimsha@fhe3.haifa.ibm.com>

refactor(recovery): return RecoveryClaim from ClaimPendingTransactions (#1715)

Signed-off-by: Evan <evanyan@sign.global>

Adding ZKP Benchmarking to test overhead of FSC nodes on TPS

Signed-off-by: Effi-S <effi.szt@gmail.com>
Signed-off-by: AKRAM@il.ibm.com <akram@akramb.vpc.cloud9.ibm.com>

Fix #1635: Prevent audit lock starvation via defer pattern

- Enhanced Audit() documentation requiring immediate defer Release()
- Fixed integration test callers with proper error handling
- Added unit tests for lock acquisition error handling
- Leverages existing semaphore.Weighted for context-aware acquisition (PR #1616)
- Ensures locks always released via defer, preventing DoS attacks

Signed-off-by: AKRAM@il.ibm.com <akram@akramb.vpc.cloud9.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request ttx

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants