← Back to Pull requests

feat(pot): pay only with a Rada-signed trigger; one Atram approver (ENG-1774) #5

Open
unknown opened this pull request with 650 lines diff across 8 files
View on GitHub
unknown unknown commented on Oct 25, 2026 13:17 UTC
Author

Closes ENG-1774: Pot pays only with a Rada-signed trigger.

Built on top of PR 4 (pot read API), which isn't merged yet. Merge PR 4 first; its commits then drop out of this diff.

What this changes

Every payout now needs three independent signatures, all checked on-chain:

| Who | Signs | Where |
|---|---|---|
| Rada (simulated) | the trigger: this pot, this FSP wallet, this amount, this proposal | Lydia's simulated drought signal (ENG-1759, Michael) |
| Atram | the payout (now 1 approver, was 2) | the signer |
| The FSP (Contactar) | the payout to its own wallet | the signer (testnet only) |

  • Contract: stores Rada's ed25519 public key; release takes rada_signature and traps unless Rada signed exactly this pot, wallet, amount and trigger ID. A signed trigger can't be replayed on another pot, redirected or resized. Cap, window, FSP list and one-payout-per-trigger are unchanged.

  • Signer: forwards Lydia's rada_signature and maps a bad one to bad_trigger_signature. It never holds Rada's key (that's Lydia's side). signer/src/rada.js is the reference implementation of the message; the CLI signs with RADA_TEST_SECRET for local test payouts.

  • Docs: docs/release-interface.md (link works once merged) has the byte layout, a worked example, and a PHP version for Lydia. The example is checked in both the contract tests (the_documented_trigger_example_verifies) and the signer tests, and the PHP snippet was run against it.

  • Deploy script: Atram approvers and threshold are settings (default one), and the pot stores the rada-mock public key.
  • Live on testnet

    New red pot: 1 Atram approver, rada-mock key, cap 5,000, 20 USDC deposited, open until 1 Nov.

  • DEMO-201: 1 USDC paid with a Rada-signed trigger.

  • DEMO-202 with a forged signature: refused, bad_trigger_signature, nothing moved. (Earlier, on the interim pot: a signature made for 1 USDC used for 2 was refused the same way.)

  • The two replaced pots were emptied back to admin and are listed under retired in deployments/testnet.json.
  • Tests

  • Contract: 19 passing. New: valid Rada signature pays; wrong key, changed amount, changed wallet each refused; the documented example verifies. Removing the check makes the three refusal tests fail.

  • Signer: 37 passing. New: message layout, signature round-trip, the documented example, request validation, the named error.
  • 🤖 Generated with Claude Code

    <!-- greptile_comment -->

    <!-- greptile_summary -->

    <h2><a href="https://app.greptile.com/api/retrigger?id=87649737"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/RetriggerDark.svg?v=2"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"><img alt="Retrigger" src="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2" align="right"></picture></a><a href="https://app.greptile.com/atram/github/Atram-Inc/lydia-hackmeridian/-/pull/5"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptileDark.svg?v=2"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2"><img alt="View in Greptile" src="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2" align="right"></picture></a>Confidence Score: 4/5</h2>

    <!-- greptile-risk -->

    The PR appears safe to merge, with non-blocking improvements to dashboard reads and signature tests.

    <h2><a href="https://app.greptile.com/api/ide/codex?prompt=IMPORTANT%3A%20Work%20in%20the%20repository%20%22atram-inc%2Flydia-hackmeridian%22%20on%20the%20existing%20branch%20%22feat%2Frada-signed-trigger%22.%20Checkout%20that%20branch%20%E2%80%94%20do%20NOT%20create%20a%20new%20branch%20or%20open%20a%20new%20PR.%20Push%20your%20changes%20to%20%22feat%2Frada-signed-trigger%22.%0A%0A%23%23%23%20Issue%201%0Asigner%2Fsrc%2Fserver.js%3A29-35%0A%60potReader%60%20caches%20the%20result%20only%20after%20%60readPot%60%20finishes.%20Several%20dashboard%20requests%20arriving%20on%20an%20empty%20or%20expired%20cache%20each%20start%20the%20same%20contract%2C%20event%20and%20wallet%20reads.%20Larger%20histories%20make%20these%20polling%20bursts%20slower%20and%20more%20likely%20to%20hit%20upstream%20request%20limits.%20Cache%20the%20pending%20promise%20per%20label%2C%20and%20remove%20it%20if%20the%20read%20fails.%0A%0A%23%23%23%20Issue%202%0Acontracts%2Fpot%2Fsrc%2Ftest.rs%3A308-317%0AThe%20new%20refusal%20tests%20cover%20a%20wrong%20key%2C%20changed%20amount%20and%20changed%20wallet%2C%20but%20not%20a%20changed%20pot%20or%20%60reason%60.%20Those%20two%20fields%20stop%20a%20signature%20from%20being%20reused%20on%20another%20pot%20or%20under%20a%20new%20proposal%20ID.%20The%20worked%20example%20checks%20only%20a%20valid%20signature.%20Add%20refusal%20tests%20that%20keep%20the%20signature%20unchanged%20while%20changing%20only%20the%20pot%20or%20only%20%60reason%60%2C%20and%20check%20that%20no%20funds%20move.%0A%0ANote%3A%20If%20this%20suggestion%20doesn't%20match%20your%20team's%20coding%20style%2C%20reply%20to%20this%20and%20let%20me%20know.%20I'll%20remember%20it%20for%20next%20time!%0A%0A---%0A%0AFor%20each%20issue%20above%2C%20determine%20whether%20it%20is%20valid%20and%20should%20be%20fixed.%20If%20so%2C%20fix%20it%20directly.&repo=atram-inc%2Flydia-hackmeridian&pr=5&platform=github"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInCodexDark.svg?v=7"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInCodex.svg?v=7"><img alt="Fix All in Codex" src="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInCodex.svg?v=7" align="right"></picture></a>Findings</h2>

    1. <img alt="P2" src="https://greptile-static-assets.s3.amazonaws.com/badges/p2.svg?v=9" align="top">&nbsp;Dashboard requests repeat expensive reads <a href="https://github.com/Atram-Inc/lydia-hackmeridian/pull/5#discussion_r4370984176">▶</a>
    2. <img alt="P2" src="https://greptile-static-assets.s3.amazonaws.com/badges/p2.svg?v=9" align="top">&nbsp;Replay checks lack focused tests <a href="https://github.com/Atram-Inc/lydia-hackmeridian/pull/5#discussion_r4370984179">▶</a>

    <details><summary><h3>Summary</h3></summary>

    Adds Rada's signature to every payout and changes the deployment default to one Atram approver.

  • Pot payouts now need Rada's signature for the exact trigger.

  • The signer now gives dashboards a public view of each pot.
  • Intentional change acknowledged by jazzmin95: the deployment now uses one Atram approver, as stated in the PR description.
    </details>

    <details open><summary><h3>Diagram</h3></summary>

    sequenceDiagram
      participant Lydia
      participant Signer
      participant Pot
      participant FSP
      Lydia->>Lydia: Sign pot, wallet, amount and proposal with Rada key
      Lydia->>Signer: Request payout with Rada signature
      Signer->>Pot: Submit release with Atram and FSP approvals
      Pot->>Pot: Check Rada signature, approvals, window, cap and unused reason
      Pot->>FSP: Transfer USDC
    

    </details>

    <!-- greptile_confidence_score:4 -->

    <sub>Reviews (1) · Last reviewed commit: "feat(signer): forward Lydia&#39;s Rada-signe..." · Reviewed by Greptile</sub>

    <!-- /greptile_comment -->

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: greptile-apps[bot] Review duration: 11m
    All Vouch review confidence checks passed
    Residual risk 0.47 = Change Risk (0.75) × (1 − Review Confidence (0.38)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.75 · 650 lines diff across 8 files
    0.75
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 73% · Reviewer familiarity: 35%
    37%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.344
    Sensitive Paths sensitive_paths
    0.075
    Real PR Conversation Timeline
    1 comments
    "Review active on #5"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: medium confidence: 37.5% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 75.2% (HIGH) · Higher = larger blast radius
    75.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 37.5% · Lower = rushed or shallow review
    37.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 47.0% · Moderate risk
    47.0%