From 66eacf574944fa8f2b727b40017d432ec3ae7a57 Mon Sep 17 00:00:00 2001 From: Kayos Date: Thu, 7 May 2026 17:12:10 -0700 Subject: [PATCH] fix(dao): clamp proposal-create validity range to per-DAO max_width VALIDITY_RANGE_SLOTS const was hardcoded to 1799 (Sulkta's 30min budget minus 1 slot). For tiny test DAOs (preprod_test: 30s) this overshoots the governor's create_proposal_time_range_max_width and the validator rejects with CekError on submit. Now: derive max width from GovernorDatum.create_proposal_time_range_max_width / 1000 - 1, capped at VALIDITY_RANGE_SLOTS for safety. --- crates/aldabra-dao/src/builder/proposal_create.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/crates/aldabra-dao/src/builder/proposal_create.rs b/crates/aldabra-dao/src/builder/proposal_create.rs index 3a5ebe0..4af700b 100644 --- a/crates/aldabra-dao/src/builder/proposal_create.rs +++ b/crates/aldabra-dao/src/builder/proposal_create.rs @@ -574,8 +574,16 @@ pub fn build_unsigned_proposal_create( // pauthorizedBy on the stake checks proposer's pkh appears in // txInfoSignatories — we disclose it explicitly so pallas-txbuilder // knows to require + emit the corresponding witness. + // Range width must be ≤ governor.create_proposal_time_range_max_width + // (in ms; slot length on every Shelley+ network is 1 second). For + // Sulkta-shape governors with 30min windows, the legacy 1799-slot + // const fits. For tiny test DAOs (preprod_test: 30s) it must shrink + // to the per-DAO budget. Subtract 1 slot for safety against round-up. + let max_width_slots = ((args.governor.datum.create_proposal_time_range_max_width / 1_000) as u64) + .saturating_sub(1) + .min(VALIDITY_RANGE_SLOTS); staging = staging.valid_from_slot(args.tip_slot); - staging = staging.invalid_from_slot(args.tip_slot + VALIDITY_RANGE_SLOTS); + staging = staging.invalid_from_slot(args.tip_slot + max_width_slots); let proposer_pkh_arr: [u8; 28] = args .proposer_pkh