Skip to content

[codex] Add Spark Name v2 registration payload support - #10

Merged
reubenyap merged 7 commits into
mainfrom
codex/firo-spark-name-format
Jul 23, 2026
Merged

reubenyap merged 7 commits into
mainfrom
codex/firo-spark-name-format

Conversation

@reubenyap

@reubenyap reubenyap commented Jul 3, 2026

Copy link
Copy Markdown
Member

What changed

  • Bumps CSparkNameTxData::CURRENT_VERSION from 1 to 2.
  • Adds the v2 operationType byte, defaulting to registration (0).
  • Rejects transaction-data versions other than the explicitly supported v1 and v2 layouts.
  • Extends the Spark Name tests to cover v2 serialization and unsupported-version rejection.
  • Avoids ODR-using the header-only CURRENT_VERSION constant in that test.

Why / scope

This aligns Spark Mobile with the existing Spark Name v2 payload format. The operationType field predates the recent v2.1 hard fork and is not the fix for registrations remaining unconfirmed; Firo Core still accepts v1 registration payloads after v2 activation.

The recent v2.1 requirement relevant to the failure is a tagged registration-fee output. The caller constructs that output and must include its extra bytes in the miner-fee estimate, so the confirmation fix is in Stack Wallet PR #1413.

The mobile serializer has no later consensus-validation step, so accepting every nVersion >= 2 could silently encode or decode an unknown future layout as v2. It now fails immediately unless the version is exactly 1 or 2.

Related

Review notes

This intentionally remains registration-only. Transfer fields can be added if mobile begins creating Spark Name transfers.

Validation

  • git diff --check passes locally, with only Windows CRLF warnings.
  • Both modified Boost test sources compile successfully.
  • A standalone check confirms version 3 throws during both serialization and deserialization.
  • The same Spark Name source compiled successfully through firoorg/flutter_libsparkmobile's Windows CMake build and linked libflutter_libsparkmobile.dll.
  • The standalone spark_name_tests build remains blocked in the available Windows environment by its existing POSIX endian.h assumption; no build-system workaround is included in this PR.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 30c698b5dc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tests/spark_name_test.cpp Outdated
@codeant-ai

codeant-ai Bot commented Jul 16, 2026

Copy link
Copy Markdown

CodeAnt AI is reviewing your PR.

@codeant-ai codeant-ai Bot added the size:XS This PR changes 0-9 lines, ignoring generated files label Jul 16, 2026
@codeant-ai

codeant-ai Bot commented Jul 16, 2026

Copy link
Copy Markdown

User description

What changed

  • Bumps CSparkNameTxData::CURRENT_VERSION from 1 to 2.
  • Adds the v2 operationType byte, defaulting to 0 for registration.
  • Extends the Spark Name unit test to assert v2 registration serialization.

Why

Firo's Spark Name registration format now serializes registration data as v2 and includes an operation type. Stack Wallet only creates registrations, so this intentionally keeps transfer fields out of the mobile library.

Review notes

This is the smallest native change needed for registration compatibility. Transfer support can be added later if mobile starts creating Spark Name transfers.

Validation

  • git diff --check passes locally, with only Windows CRLF warnings.
  • Attempted spark_name_tests from a temp clone with MSYS2/UCRT; secp256k1 built, then the standalone compile stopped on missing endian.h because this repo's bare test target assumes POSIX/Linux headers.
  • Attempted MSYS compile-only, but mixing the MSYS compiler with UCRT Boost/OpenSSL headers caused target-header conflicts; I stopped there rather than patching build files for a local-only setup.
  • The same Spark Name source compiled successfully through firoorg/flutter_libsparkmobile's Windows CMake build and linked libflutter_libsparkmobile.dll.

CodeAnt-AI Description

Update Spark Name registrations to the new v2 format

What Changed

  • Spark Name registration data now uses version 2 instead of version 1
  • Registration payloads now include the new operation type field, set to 0 for normal registrations
  • The Spark Name test now checks that generated registrations use the new version and include the expected operation type

Impact

✅ Spark Name registrations stay compatible with the current format
✅ Clearer support for future Spark Name transfer data
✅ Fewer Spark Name serialization mismatches

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

@reubenyap reubenyap changed the title [codex] Update Spark Name registration payload format [codex] Add Spark Name v2 registration payload support Jul 16, 2026
@codeant-ai

codeant-ai Bot commented Jul 16, 2026

Copy link
Copy Markdown

CodeAnt AI finished reviewing your PR.

@codeant-ai

codeant-ai Bot commented Jul 23, 2026

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Incremental review completed 94eda37 Jul 23, 2026 · 13:09 13:10

Updated in place by CodeAnt AI · last 5 reviews

@codeant-ai codeant-ai Bot added size:M This PR changes 30-99 lines, ignoring generated files and removed size:XS This PR changes 0-9 lines, ignoring generated files labels Jul 23, 2026
@codeant-ai

codeant-ai Bot commented Jul 23, 2026

Copy link
Copy Markdown

User description

What changed

  • Bumps CSparkNameTxData::CURRENT_VERSION from 1 to 2.
  • Adds the v2 operationType byte, defaulting to registration (0).
  • Rejects transaction-data versions other than the explicitly supported v1 and v2 layouts.
  • Extends the Spark Name tests to cover v2 serialization and unsupported-version rejection.
  • Avoids ODR-using the header-only CURRENT_VERSION constant in that test.

Why / scope

This aligns Spark Mobile with the existing Spark Name v2 payload format. The operationType field predates the recent v2.1 hard fork and is not the fix for registrations remaining unconfirmed; Firo Core still accepts v1 registration payloads after v2 activation.

The recent v2.1 requirement relevant to the failure is a tagged registration-fee output. The caller constructs that output and must include its extra bytes in the miner-fee estimate, so the confirmation fix is in Stack Wallet PR #1413.

The mobile serializer has no later consensus-validation step, so accepting every nVersion >= 2 could silently encode or decode an unknown future layout as v2. It now fails immediately unless the version is exactly 1 or 2.

Related

Review notes

This intentionally remains registration-only. Transfer fields can be added if mobile begins creating Spark Name transfers.

Validation

  • git diff --check passes locally, with only Windows CRLF warnings.
  • Both modified Boost test sources compile successfully.
  • A standalone check confirms version 3 throws during both serialization and deserialization.
  • The same Spark Name source compiled successfully through firoorg/flutter_libsparkmobile's Windows CMake build and linked libflutter_libsparkmobile.dll.
  • The standalone spark_name_tests build remains blocked in the available Windows environment by its existing POSIX endian.h assumption; no build-system workaround is included in this PR.

CodeAnt-AI Description

Support Spark Name registration payload version 2 and reject invalid layouts

What Changed

  • Spark Name registration data now uses version 2 and includes the new operation type byte for registrations.
  • The app now rejects Spark Name payloads with unsupported versions instead of accepting unknown formats.
  • Spark Name data now fails immediately if the operation type is anything other than registration.
  • Tests now check that version 2 data is written and read correctly, and that unsupported versions or operations are rejected.

Impact

✅ Fewer Spark Name decode failures
✅ Clearer errors for invalid Spark Name payloads
✅ Safer Spark Name registration handling

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

@reubenyap
reubenyap merged commit 2bb6122 into main Jul 23, 2026
@reubenyap
reubenyap deleted the codex/firo-spark-name-format branch July 23, 2026 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant