Skip to content

fund delegator wallet during setup - #84

Open
bordalix wants to merge 1 commit into
update_intent_solver_0.5.0from
fund_delegator_wallet
Open

bordalix wants to merge 1 commit into
update_intent_solver_0.5.0from
fund_delegator_wallet

Conversation

@bordalix

@bordalix bordalix commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Delegator wallet is used by wallet to fund e2e tests

@arkana-ai-bot arkana-ai-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  • warn import addition is correct.
  • dockerExec import follows the same pattern as solver.mjs and lnd.mjs.
  • fetchText return shape ({ ok, status, text }) is correctly used in the redeem error path.
  • timeoutMs override on the redeem call does not affect the outer waitForOrFail loop.

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.

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