chore: scrub internal session-log narrative from code comments

Wide sweep across the codebase to remove leftover artifacts of internal
development sessions, internal entity naming, and audit-code references
that point at non-public docs. The technical reasoning for each piece
of code stays; the "Caught 2026-05-XX while debugging XYZ at preprod"
narrative goes.

Categories scrubbed:
- Dated session-log comments ("Caught/Surfaced/Discovered 2026-05-XX")
  → rewritten as neutral technical reasoning.
- Internal audit codes (AUDIT-H2, AUDIT-C2, AUDIT-M2, AUDIT-H5, etc.)
  referencing a non-public audit doc → labels stripped, fix reasoning
  kept.
- Internal-entity names in code comments (Sulkta-specific, Sulkta runs
  X, Terrapin/TRP as gov-token names) → generic phrasing.
- Test fixture helper `sulkta_cfg` → `test_dao_cfg`; test DAO name
  string `"sulkta"` → `"test-dao"`. On-chain addresses in test fixtures
  kept (they're real-world wire-byte test data on public chain).
- Cross-references to memory files / non-public audit docs
  (`internal notes`, `aiken-escrow/README.md`)
  → reasoning inlined or removed.
- Test names renamed: `decodes_sulkta_live_governor_datum` →
  `decodes_live_governor_datum`, `decodes_sulkta_live_proposal_zero` →
  `decodes_live_finished_proposal`, etc.

Kept (legitimate):
- Cross-references to in-repo audit docs (aiken-escrow/README.md, aiken-escrow/README.md) — they ARE the
  public artifacts being referenced.
- HIGH-1/HIGH-2/MED-2/LOW labels on escrow fixes — these correspond to
  findings in the in-repo audit doc.
- TODO markers — legitimate work-still-to-do.
This commit is contained in:
Sulkta 2026-05-10 21:29:40 -07:00
parent 93f0d2ebde
commit 564ba3ccb5
28 changed files with 258 additions and 296 deletions

View file

@ -38,11 +38,9 @@ struct AddressesBody<'a> {
}
/// Same as [`AddressesBody`] but with the `_extended` flag set.
/// Koios's `/address_utxos` returns `asset_list: null` (or empty)
/// without it; with it, the per-utxo asset bundles come through
/// reliably. Discovered preprod 2026-05-04 — without this flag the
/// wallet sees its own asset-bearing UTXOs as ada-only and refuses
/// to construct a multi-asset send.
/// Without `_extended`, Koios's `/address_utxos` returns
/// `asset_list: null` (or empty), causing asset-bearing UTXOs to
/// look ada-only — multi-asset sends then fail to build.
#[derive(Serialize)]
struct AddressesExtendedBody<'a> {
#[serde(rename = "_addresses")]
@ -69,8 +67,7 @@ struct KoiosUtxo {
/// `Option<Vec<...>>` because Koios's `/address_utxos` returns
/// `asset_list: null` for ADA-only UTXOs (vs `/address_info`
/// which returns `[]`). `Vec<T>` rejects `null`; `Option<Vec<T>>`
/// accepts both. Found at integration time on live preprod
/// 2026-05-04 — our hand-crafted test fixtures all used `[]`.
/// accepts both.
#[serde(default)]
asset_list: Option<Vec<KoiosAsset>>,
}
@ -92,8 +89,8 @@ struct TxHashesBody<'a> {
/// Response shape from Koios `/api/v1/tx_status`. Tiny — only a
/// confirmations counter per requested tx — vs `/tx_info` which
/// streams the full tx body (multi-MB for complex confirmed txs).
/// AUDIT4-1: switching to `/tx_status` resolves the 120s+ hang on
/// confirmed-tx queries surfaced 2026-05-04.
/// Prefer this for status polling to avoid the multi-second hang
/// when fetching large confirmed-tx bodies.
#[derive(Deserialize)]
struct KoiosTxStatusResp {
#[allow(dead_code)]
@ -308,11 +305,10 @@ impl ChainBackend for KoiosClient {
.send()
.await
.map_err(|e| ChainError::Network(e.to_string()))?;
// Capture status + body BEFORE bubbling up — koios's chain-rule
// rejection messages live in the response body and are
// otherwise eaten by `.error_for_status()`. Discovered during
// preprod cip-68 mint debugging 2026-05-04: a 400 with no
// surfaced body left us guessing at why the chain rejected the tx.
// Capture status + body BEFORE bubbling up — Koios's chain-rule
// rejection messages live in the response body and are otherwise
// eaten by `.error_for_status()`, leaving callers with no signal
// beyond an HTTP 400.
let status = response.status();
let body = response
.text()
@ -327,9 +323,8 @@ impl ChainBackend for KoiosClient {
}
// Koios returns the tx hash as a quoted JSON string. Strip the
// surrounding quotes if present, then validate the result is
// exactly 64 hex chars.
// M-4 audit fix: previously a quoted error message would
// round-trip as a fake tx_hash.
// exactly 64 hex chars — guards against a quoted error message
// round-tripping as a fake tx_hash.
let hash = body.trim().trim_matches('"').to_string();
if !is_hex_64(&hash) {
return Err(ChainError::Decode(format!(
@ -414,8 +409,7 @@ mod tests {
/// Real Koios `/address_utxos` returns `asset_list: null` for
/// ada-only utxos (vs `/address_info` which returns `[]`).
/// Regression test — caught at preprod integration time
/// 2026-05-04 after our hand-crafted fixtures all used `[]`.
/// Regression test for the null-vs-empty-array deserialisation.
#[test]
fn deserializes_utxo_with_null_asset_list() {
const SAMPLE: &str = r#"[
@ -556,8 +550,7 @@ mod tests {
assert!(json.contains("\"status\":\"not_found\""));
}
/// AUDIT4-1 regression: parse the three live Koios `/tx_status`
/// shapes we observed during the 2026-05-04 preprod test —
/// Regression: parse the three live Koios `/tx_status` shapes —
/// confirmed-with-count, known-but-no-confs (mempool), and
/// nothing-to-report (truly unknown).
#[test]