Skip to content

fix(SEV-046): bump deploy SOL floor 5→20 (empirical 12.5 SOL needed)#393

Merged
alrimarleskovar merged 1 commit into
mainfrom
claude/implement-roundfi-desktop-SRV6l
May 18, 2026
Merged

fix(SEV-046): bump deploy SOL floor 5→20 (empirical 12.5 SOL needed)#393
alrimarleskovar merged 1 commit into
mainfrom
claude/implement-roundfi-desktop-SRV6l

Conversation

@alrimarleskovar
Copy link
Copy Markdown
Owner

TL;DR

Rehearsal-1f finally got past every workflow bug (PRs #389, #390, #391, #392) and surfaced the real cost: anchor deploy of 4 programs needs ~12.5 SOL, not the ~3-4 SOL my original docs claimed. Bumps the workflow floor 5 → 20 SOL.

What rehearsal-1f surfaced

$ anchor deploy --provider.cluster devnet
Deploying program "roundfi_core"...
Program path: /home/runner/.../target/deploy/roundfi_core.so...
Error: Account 5ZpFtJePb2hGKhG9RJ6Fdwmo5y8wuwKXZZcKttoN1Jgo has
       insufficient funds for spend (6.13730712 SOL) + fee (0.00438 SOL)

Two important facts here:

  1. anchor deploy actually invoked — keypair found, build successful, balance check passed. All previous PRs' fixes work.
  2. The deploy needs more SOL than the workflow's 5 SOL floor lets through (the check passed at exactly 5 SOL, then ran out mid-deploy of the first program).

Empirical per-program cost

Program Bytecode 2× rent-exempt
roundfi_core ~880KB ~6.14 SOL
roundfi_reputation ~370KB ~2.6 SOL
roundfi_yield_kamino ~294KB ~2.0 SOL
roundfi_yield_mock ~254KB ~1.8 SOL
TOTAL ~1.8MB ~12.5 SOL + tx fees

Fix

  • .github/workflows/devnet-deploy.yml + mainnet-deploy.yml — balance check floor 5 → 20 SOL (1.6× empirical for priority-fee spikes + multi-program buffer-account temporaries during deploy).
  • Comment in each step's header documents the per-program breakdown so future devs don't have to re-derive empirically.
  • docs/operations/cd-pipeline.md — all 5 refs to "5 SOL" updated to "20 SOL" with cost rationale inline.

Recovery note for operator

Rehearsal-1f's failed deploy left a buffer account AqUsc5qqMG7bk5W6kZZzbhsfbWeuEMbEzuVpLkwr4PSH with escrowed lamports. Recoverable via:

solana program close AqUsc5qqMG7bk5W6kZZzbhsfbWeuEMbEzuVpLkwr4PSH \
  --recipient 5ZpFtJePb2hGKhG9RJ6Fdwmo5y8wuwKXZZcKttoN1Jgo \
  --url devnet

Optional — devnet SOL is free, faster to just request more airdrops. Important for mainnet: the same lock-up pattern would happen there too if balance is insufficient. Mainnet floor at 20 SOL is critical.

Rehearsal chronology (full saga)

Rehearsal PR Surfaced bug
1a (pre-secret-setup) secret restore failed (expected; no secret yet)
1b #389 solana balance --output json | jq returns null
1c #390 anchor build (no --no-idl) hits IDL gen error
1d #391 anchor deploy ignores ANCHOR_WALLET env
1e #392 anchor deploy ignores solana config, reads Anchor.toml
1f this PR Real cost is 12.5 SOL, not 3-4 SOL
1g (next) Should actually complete successfully

After this merges + operator funds wallet to 25+ SOL: rehearsal-1g either succeeds or the next failure is RPC/Solana-side, not workflow.

Test plan

  • Lint green
  • CI all standard lanes stay green
  • Empirical: operator pushes devnet-deploy-v$(date +%Y%m%d)-rehearsal-1g after wallet topped to 25+ SOL — should complete anchor deploy successfully and upload artifact

Freeze status

Permitted (SEV-046 follow-up). 3 files, ~37 lines net.

Recommended merge method

Squash.

https://claude.ai/code/session_01YapZy1Z5gzbV5EammBkSQm


Generated by Claude Code

Rehearsal-1f finally got past every workflow bug and surfaced the
real cost: anchor deploy of 4 programs needs ~12.5 SOL, not the
~3-4 SOL my original docs claimed. Run failed mid-deploy with:

  Error: Account 5ZpFtJePb2hGKhG9RJ6Fdwmo5y8wuwKXZZcKttoN1Jgo has
  insufficient funds for spend (6.13730712 SOL) + fee (0.00438 SOL)

Per-program rent-exempt minimum is 2× bytecode size:
  roundfi_core         ~880KB → ~6.14 SOL
  roundfi_reputation   ~370KB → ~2.6 SOL
  roundfi_yield_kamino ~294KB → ~2.0 SOL
  roundfi_yield_mock   ~254KB → ~1.8 SOL
                       TOTAL  ≈ 12.5 SOL + ~0.05 tx fees

Fixes:
- devnet-deploy.yml + mainnet-deploy.yml balance floor 5 → 20 SOL
  (20 = 1.6× empirical for priority-fee spikes + temporary buffer
  accounts during multi-program deploys)
- Header comment updated with per-program breakdown so future devs
  don't have to re-derive empirically.
- docs/operations/cd-pipeline.md: all 5 refs to "5 SOL" updated
  to "20 SOL" with the cost rationale inline.

This is the LAST plausible workflow change for SEV-046 execution.
Next failure mode (if any) is a Solana-side RPC issue, not a
workflow bug — the workflow itself is now demonstrably correct
through `anchor deploy` invocation.

Note for operator on rehearsal-1f's burned SOL: the buffer account
AqUsc5qqMG7bk5W6kZZzbhsfbWeuEMbEzuVpLkwr4PSH has the lamports
escrowed. Recoverable via:
  solana program close AqUsc5qqMG7bk5W6kZZzbhsfbWeuEMbEzuVpLkwr4PSH \
    --recipient 5ZpFtJePb2hGKhG9RJ6Fdwmo5y8wuwKXZZcKttoN1Jgo \
    --url devnet
Optional — devnet SOL is free; faster to just airdrop more.

https://claude.ai/code/session_01YapZy1Z5gzbV5EammBkSQm
@alrimarleskovar alrimarleskovar merged commit e58ca1c into main May 18, 2026
8 checks passed
alrimarleskovar pushed a commit that referenced this pull request May 18, 2026
Companion to docs/operations/cd-pipeline.md (architecture spec).
This is the empirical lessons-learned counterpart documenting why
SEV-046's "clean" PR #388 took 5 follow-up PRs (#389-#393) before
a single anchor deploy actually completed.

Contents:
- Headline: 5 bugs, each one-line, none catchable by lint/typecheck
- Per-rehearsal chronology (1a → 1g)
- Per-bug root cause analysis (JSON parse trap, anchor-syn IDL,
  anchor wallet resolution chain, empirical SOL cost)
- What would have prevented it: localnet smoke-test workflow that
  exercises the full deploy path against solana-test-validator
- Mainnet-deploy mitigation summary (all 5 fixes already in)
- Outstanding operator-side work tracker

Filed as follow-up: the localnet smoke-test workflow design is
sketched but not implemented in scope of SEV-046. Tracking for
post-canary cleanup.

Generalized lesson burned in: workflow code is untestable except by
running it. The CI lanes pass; the workflow still doesn't work.

https://claude.ai/code/session_01YapZy1Z5gzbV5EammBkSQm
alrimarleskovar added a commit that referenced this pull request May 19, 2026
#395)

Documents the 5-PR chain (#389-#393) that the SEV-046 CD scaffolding
(PR #388) needed before a single anchor deploy actually ran end-to-end.

Companion to docs/operations/cd-pipeline.md (architecture spec) — this
is the empirical lessons-learned counterpart.

Generalized lesson: workflow code is untestable except by running it.
CI lanes can be green while the workflow itself is broken in ways
that only surface against real runner conditions.

https://claude.ai/code/session_01YapZy1Z5gzbV5EammBkSQm
alrimarleskovar pushed a commit that referenced this pull request May 19, 2026
…closed

First green end-to-end CD devnet deploy after the 5-PR bug chain
(#389#393). Run 26086314957 deployed all 4 RoundFi programs on a
clean ubuntu-latest runner, artifact captured, keypair scrubbed.

Changes:
- docs/operations/rehearsal-logs/2026-05-19-SEV-046-rehearsal-1g-success.md
  — full run record with program IDs, Solscan links, cost breakdown,
  next-rehearsal plan.
- docs/operations/rehearsal-logs/2026-05-18-SEV-046-rehearsal-saga.md
  — row 1g flipped from "pending" to ✓ green + headline update note.
- docs/operations/mainnet-canary-plan.md §3.3 — CD pipeline checkbox
  flipped [x] with link to the 1g success log. Stretch goal of 3×
  clean still at 1/3.
- docs/security/internal-audit-findings.md — SEV-046 tracker row
  updated with PR chain breadcrumb (#388 + #389#393 + #395) +
  empirical close status.
- CHANGELOG.md — new [Unreleased] entry summarizing the rehearsal 1g
  outcome above the existing #272 scaffolding entry.

§3.3 strict "at least once" criterion: ✓ satisfied.
3× clean reproducibility (cd-pipeline.md §"Rehearsal protocol"): 1/3.
Operator can now disparar rehearsals 2 + 3 with no expected code changes.

https://claude.ai/code/session_01YapZy1Z5gzbV5EammBkSQm
alrimarleskovar added a commit that referenced this pull request May 19, 2026
…tag (#398)

SEV-046 rehearsal 2 abort log + 1g tag correction.

Operator disparou rehearsal-2 post-1g merge; workflow correctly aborted at the 20 SOL balance gate (deployer wallet was at 12.38 SOL post-1g — 1g consumed the ~12.5 SOL PR #393 predicted). Floor working as designed, not a code bug. Recorded across saga doc + 1g success doc + canary-plan §3.3 checkbox. Side fix: 1g doc Tag field corrected from 20260518 → 20260519 to match actual git tag.

§3.3 strict "at least once" criterion remains satisfied by 1g; 3× stretch goal still at 1/3, NOT a mainnet blocker.
alrimarleskovar added a commit that referenced this pull request May 19, 2026
Second green CD devnet deploy via run 26115425088 — 4 programs deployed with fresh keypairs, 12.62 SOL consumed (within 1% of PR #393 prediction). Recorded full run + 1g-vs-2b reproducibility table (8/8 properties match or within 1%) + saga continuation row + canary plan §3.3 checkbox 1/3 → 2/3 + CHANGELOG.

Reproducibility empirically demonstrated: the 5-PR bug chain in 1b–1f (PRs #389#393) has no siblings. Remaining gap is operator-side SOL availability for rehearsal-3 (post-2b balance is 9.76 SOL; needs top-up to clear 20 SOL floor).

§3.3 strict criterion ("at least once") remains satisfied since 1g. 3× stretch goal is NOT a mainnet blocker.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants