Skip to content

[codex] Fix Firo Spark Name v2.1 registration#1413

Open
reubenyap wants to merge 5 commits into
cypherstack:stagingfrom
reubenyap:codex/firo-spark-name-format
Open

[codex] Fix Firo Spark Name v2.1 registration#1413
reubenyap wants to merge 5 commits into
cypherstack:stagingfrom
reubenyap:codex/firo-spark-name-format

Conversation

@reubenyap

@reubenyap reubenyap commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

What changed

  • Builds the v2.1 fee output as P2PKH + OP_SPARKNAMEID <name> OP_DROP <sparkAddress> OP_DROP.
  • Adds the measured tagged-script byte difference to Spark Mobile's existing additionalTxSize input.
  • Pins flutter_libsparkmobile@53db5a06a7b7f3df68fe6263f1453f77513bec06, whose shared validator rejects underscores before transaction construction.
  • Prevents exact-balance registration from subtracting the miner fee from the mandatory name payment.
  • Adds focused validation, script-size, and fee-subtraction checks.

Root causes

NAME_FOR_TESTING was rejected because Firo Core accepts only alphanumeric characters, -, and . in a Spark Name. The wrapper incorrectly allowed _, so Stack created a transaction that Core rejected as an invalid name.

The v2.1 tagged fee output also adds bytes that Spark Mobile's standard 34-byte transparent-output model does not include. A confirmed namefortesting registration demonstrates the exact calculation:

base Spark model                         3,083
Spark Name metadata + existing margin     355
without tagged-script delta              3,438
actual serialized transaction            3,473
shortfall                                   35
measured tagged-script delta                164
final fee                                3,602

At Firo Core's default block minimum of 1,000 atomic units/kB, the 3,438-atom form is below the 3,473-byte transaction size and can remain unconfirmed. Measuring taggedScript.length - baseScript.length restores the estimator's existing 129-byte safety margin without hard-coding the tag layout.

The exact-balance path separately attempted to subtract the miner fee from the mandatory name payment. Registration now requires enough balance for both values.

Related

Validation

  • git diff --check passes locally.
  • NAME-FOR.TESTING passes the corrected pattern; NAME_FOR_TESTING fails.
  • The fee-script regression checks the measured 155-byte delta for alice and the required opcode structure.
  • The send-all regression confirms registration never subtracts from the mandatory payment.
  • Updated PR workflow passed, including dependency resolution, formatting, and tests: https://github.com/cypherstack/stack_wallet/actions/runs/29501131862/job/87630038975

@reubenyap
reubenyap marked this pull request as ready for review July 8, 2026 15:41
@reubenyap reubenyap changed the title [codex] Fix Firo Spark Name registration format [codex] Fix Firo Spark Name v2.1 registration fees Jul 16, 2026
@reubenyap reubenyap changed the title [codex] Fix Firo Spark Name v2.1 registration fees [codex] Fix Firo Spark Name v2.1 registration Jul 16, 2026
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.

1 participant