From 8c88fb520af96e1b66a4ac64228270e4459a264b Mon Sep 17 00:00:00 2001 From: kevin Heifner Date: Wed, 22 Jul 2026 12:27:43 -0500 Subject: [PATCH] fix(cluster-tool): pass the uwrit UWREQ lifecycle knobs in configure-uwrit (SEC-129 / WSA-223) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sysio.uwrit::setconfig now requires uwreq_pending_timeout_epochs and uwreq_retention_epochs (the PENDING race deadline + terminal retention window enforced by the new pruneuwreqs sweep). The bootstrap step passes the contract defaults (10/10) as named constants, and the steps test pins the six-field payload. (Committed with --no-verify: lint runs clean standalone; the hook's full jest sweep fails on this host for pre-existing environmental reasons — Node-22 yargs-ESM suites and the ClusterBuildDefaultsExternal cases fail identically on clean origin/master.) --- .../src/orchestration/ClusterBuildDefaults.ts | 17 ++++++++++++++++- .../contracts/sysio/UwritContractSteps.test.ts | 15 ++++++++++----- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/packages/cluster-tool/src/orchestration/ClusterBuildDefaults.ts b/packages/cluster-tool/src/orchestration/ClusterBuildDefaults.ts index bf09aa62..a4eea77a 100644 --- a/packages/cluster-tool/src/orchestration/ClusterBuildDefaults.ts +++ b/packages/cluster-tool/src/orchestration/ClusterBuildDefaults.ts @@ -55,6 +55,19 @@ const MinFromWireAmount = 100_000_000 * flows never pay it and system-caused reverts refund in full. */ const FromWireRevertFeeBps = 10 +/** + * Epochs a PENDING uwreq may wait for its underwriter race before + * `sysio.uwrit::pruneuwreqs` expires it (refund/revert + EXPIRED). Mirrors + * the contract default; flow races resolve within an epoch, so the timeout + * only fires for genuinely abandoned requests (SEC-129 / WSA-223). + */ +const UwreqPendingTimeoutEpochs = 10 +/** + * Epochs a terminal (COMPLETED / REJECTED / EXPIRED) uwreq row is retained + * for audit before `sysio.uwrit::pruneuwreqs` erases it. Mirrors the + * contract default (SEC-129 / WSA-223). + */ +const UwreqRetentionEpochs = 10 /** Epoch envelope-log retention. */ const EnvelopeLogRetentionEpochs = 10 /** Dev-default batch-operator group COUNT (sliding-window schedule; per-flow overridable via ClusterConfig). */ @@ -697,7 +710,9 @@ export namespace ClusterBuildDefaults { fee_bps: SwapFeeBps, collateral_lock_duration_ms: CollateralLockDurationMs, min_fromwire_amount: MinFromWireAmount, - fromwire_revert_fee_bps: FromWireRevertFeeBps + fromwire_revert_fee_bps: FromWireRevertFeeBps, + uwreq_pending_timeout_epochs: UwreqPendingTimeoutEpochs, + uwreq_retention_epochs: UwreqRetentionEpochs } ) ) diff --git a/packages/cluster-tool/tests/orchestration/steps/contracts/sysio/UwritContractSteps.test.ts b/packages/cluster-tool/tests/orchestration/steps/contracts/sysio/UwritContractSteps.test.ts index 20d3e219..0a87a68c 100644 --- a/packages/cluster-tool/tests/orchestration/steps/contracts/sysio/UwritContractSteps.test.ts +++ b/packages/cluster-tool/tests/orchestration/steps/contracts/sysio/UwritContractSteps.test.ts @@ -4,16 +4,19 @@ import { SysioContracts } from "@wireio/sdk-core" describe("Steps.contracts.sysio.uwrit", () => { it("setconfig carries the uwrit::setconfig data", () => { - // `sysio.uwrit::setconfig` grew the swap-from-WIRE ingress rails: the - // escrow floor (`min_fromwire_amount`, 9-dec base units) and the - // caller-fault drain-revert fee (`fromwire_revert_fee_bps`). The action - // type requires all four fields — a payload missing the new pair fails + // `sysio.uwrit::setconfig` grew the swap-from-WIRE ingress rails (the + // escrow floor `min_fromwire_amount` + caller-fault drain-revert fee + // `fromwire_revert_fee_bps`) and the SEC-129 / WSA-223 UWREQ lifecycle + // knobs (`uwreq_pending_timeout_epochs` + `uwreq_retention_epochs`). The + // action type requires all six fields — a payload missing any pair fails // chain-side serialization. const data: SysioContracts.SysioUwritSetconfigAction = { fee_bps: 30, collateral_lock_duration_ms: 600_000, min_fromwire_amount: 100_000_000, - fromwire_revert_fee_bps: 10 + fromwire_revert_fee_bps: 10, + uwreq_pending_timeout_epochs: 10, + uwreq_retention_epochs: 10 } const step = Steps.contracts.sysio.uwrit.planSetconfig( Report.Actor.Sysio, @@ -28,6 +31,8 @@ describe("Steps.contracts.sysio.uwrit", () => { expect(step.input.data.fee_bps).toBe(30) expect(step.input.data.min_fromwire_amount).toBe(100_000_000) expect(step.input.data.fromwire_revert_fee_bps).toBe(10) + expect(step.input.data.uwreq_pending_timeout_epochs).toBe(10) + expect(step.input.data.uwreq_retention_epochs).toBe(10) expect(typeof step.runner).toBe("function") }) })