Repository navigation
Conversation
arkana-ai-bot
left a comment
There was a problem hiding this comment.
Review — lib/setup/fulmine.mjs
The change adds Ark credit-note funding for the delegator (Fulmine) wallet during regtest setup. The approach mirrors the existing solver pattern in lib/setup/solver.mjs and is structurally sound. No protocol-critical paths (VTXO handling, signing, forfeit, round lifecycle, unilateral exit) are touched.
Findings
1. Exit code from dockerExec not checked (fulmine.mjs:51)
const note = dockerExec('arkd', ['arkd', 'note', '--amount', String(noteAmount)], { capture: true }).stdout.trim();
if (!note) { … }If arkd note fails with a non-zero exit but writes something unexpected to stdout, the code proceeds with that content as a note. In practice arkd only writes the note to stdout on success (error goes to stderr), so the !note guard is sufficient — but this is the same gap present in solver.mjs:34. Worth auditing both together if arkd's output contract ever changes. At minimum, consider logging stderr in the warning path so the failure reason surfaces in CI:
const { code, stdout, stderr } = dockerExec('arkd', ['arkd', 'note', '--amount', String(noteAmount)], { capture: true });
const note = stdout.trim();
if (!note || code !== 0) {
warn(`${label}: failed to create credit note (exit ${code}): ${stderr}`);
} else { … }2. timeoutMs: 60000 on note redeem is appropriate — ARK round participation can take up to a full round interval; this is correct.
3. String(noteAmount) is redundant (fulmine.mjs:51) — env() always returns a string; String(…) is a no-op here. Same pattern in solver.mjs:33, so not a new issue, but worth tidying.
4. Early-return on already-initialized wallet skips funding (fulmine.mjs:21-24) — This is intentional and consistent with the rest of the setup: a re-run will not re-fund an existing wallet. Worth a comment in the code if the expectation is that "one-time funding" is by design, so a future reader doesn't add re-funding logic that sends a second note on restart.
5. FULMINE_NOTE_AMOUNT present in .env.defaults ✓ — the default of 100000000 sats is documented and matches the code.
No-issue items
warnimport addition is correct.dockerExecimport follows the same pattern assolver.mjsandlnd.mjs.fetchTextreturn shape ({ ok, status, text }) is correctly used in the redeem error path.timeoutMsoverride on the redeem call does not affect the outerwaitForOrFailloop.
Summary
No blocking issues. Finding 1 is the only one worth acting on before merge (or at least in a follow-up that also fixes solver.mjs). The rest are nits.
Delegator wallet is used by wallet to fund e2e tests