fix(sdk-coin-sui): wire ValidDuring through Walrus withdraw builder - #9410
Merged
abhijit0943 merged 2 commits intoAug 4, 2026
Merged
Conversation
WalrusWithdrawStakeBuilder and WalrusWithdrawStakeTransaction hardcoded
expiration: { None: null } in buildSuiTransaction / getTxData / toJson,
so a ValidDuring expiration set via txBuilder.expiration(...) was silently
dropped on serialize. StakingBuilder / walrusStakingBuilder already pass
expiration: this._expiration - this brings the withdraw/request-withdraw
path in line with that pattern:
- restore _expiration from decoded txData in initBuilder (skip when None)
- include expiration: this._expiration when building the SuiTransaction
- use tx.expiration ?? { None: null } in toJson/getTxData instead of
always hardcoding None
Wallet-platform calls txBuilder.expiration(ValidDuring) for Walrus
undelegate/withdraw but the published SDK drops it on serialize, so
signed transactions built by consumers cannot include a ValidDuring
expiration for these transaction types.
Ticket: SI-1139
Session-Id: ea36d793-6db6-41ea-a197-79d9cdfe8539
Task-Id: 6a79f435-03d5-48ac-bf4f-74622ff15c3b
Add an assertion that toJson().expiration stays { None: null } when
.expiration() is never called on WalrusWithdrawStakeBuilder, both
before and after a raw round-trip.
Flagged by automated test-adequacy review after the ValidDuring wiring
commit: the new expiration ?? { None: null } fallback path had no
test guarding the default (no-expiration-set) case, so a regression
there would have slipped through silently.
Ticket: SI-1139
Session-Id: ea36d793-6db6-41ea-a197-79d9cdfe8539
Task-Id: 6a79f435-03d5-48ac-bf4f-74622ff15c3b
Contributor
bitgo-ai-agent-dev
Bot
force-pushed
the
si-1139-wire-validduring-through-walruswithdrawstake-builder
branch
from
August 4, 2026 10:38
4d2e8b3 to
ae164b9
Compare
ralph-bitgo
Bot
force-pushed
the
si-1139-wire-validduring-through-walruswithdrawstake-builder
branch
from
August 4, 2026 10:38
ae164b9 to
886a7be
Compare
ashutoshkumar-6
approved these changes
Aug 4, 2026
ashutoshkumar-6
left a comment
Contributor
There was a problem hiding this comment.
Review: wire ValidDuring through Walrus withdraw builder
Verdict: APPROVE
Summary: Correct, minimal fix matching the existing StakingBuilder / WalrusStakingBuilder / WalrusStakingTransaction pattern. buildSuiTransaction now passes this._expiration, initBuilder restores non-None expiration, and toJson/getTxData use tx.expiration ?? { None: null } so BCS serialize (getDataBytes → getTxData) and from(raw) round-trips work. Tests cover ValidDuring for request-withdraw + withdraw, plus the default None regression.
Low
- severity: low
file:modules/sdk-coin-sui/src/lib/unstakingTransaction.ts
line: ~78 / ~365
issue: Native SUIUnstakingTransactionstill hardcodesexpiration: { None: null }(same bug class). Out of SI-1139 scope (Walrus only), but SI-1140 mentions undelegate/withdraw/unstake — confirm whether WP also needs ValidDuring on nativeWithdrawStake.
suggestion: Track as a follow-up if WP applies ValidDuring to SUI unstake rebuilds; otherwise ignore.
abhijit0943
marked this pull request as ready for review
August 4, 2026 11:17
abhijit0943
approved these changes
Aug 4, 2026
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.
What
WalrusWithdrawStakeBuilder.buildSuiTransaction()now includesexpiration: this._expirationin the builtSuiTransaction, instead of omitting the field entirely.WalrusWithdrawStakeBuilder.initBuilder()now restores_expirationfrom the decoded raw transaction'sexpirationfield (skipping theNonedefault), mirroringStakingBuilder/WalrusStakingBuilder.WalrusWithdrawStakeTransaction.toJson()/getTxData()now usetx.expiration ?? { None: null }instead of unconditionally hardcoding{ None: null }.{ None: null }) expiration is preserved when.expiration()is never called.Why
WalrusWithdrawStakeBuilder/WalrusWithdrawStakeTransaction(used by Walrus undelegate + withdraw) hardcodedexpiration: { None: null }, so wallet-platform's calls totxBuilder.expiration(ValidDuring)were silently dropped on serialize in the published@bitgo-beta/sdk-coin-suiSDK.StakingBuilder/WalrusStakingBuilderalready passexpiration: this._expiration— this brings the withdraw/request-withdraw path in line with that pattern so ValidDuring expirations survive build and serialize/deserialize round-trips.Test plan
yarn unit-testinmodules/sdk-coin-sui— all existing + new tests passtoJson().expiration.ValidDuringis set afterbuilder.expiration(ValidDuring)and survivestoBroadcastFormat()→from(raw)→build()round-trip, for bothWalrusRequestWithdrawStakeandWalrusWithdrawStaketransaction types{ None: null }) expiration is unaffected when.expiration()is never calledFollow-up
@bitgo-beta/sdk-coin-suibeta is a separate manualworkflow_dispatchstep (.github/workflows/publish.yml), not included in this PR.Ticket: SI-1139