Skip to content

Conversation

@nicolasLuduena
Copy link
Contributor

This pull request introduces the concept of a "declared index" for transaction outputs and Cardano publish directives, ensuring their original order is preserved throughout parsing, lowering, compilation, and serialization. The declared index is now tracked in the AST, IR, and final output structures, and is included in all relevant test fixtures and example files. This change enables deterministic ordering of outputs, which is critical for correct transaction construction and downstream processing.

Core logic and data model changes:

  • Added a declared_index field to OutputBlock and CardanoPublishBlock in the AST, and ensured it is set during parsing to reflect the order in which outputs and directives are declared.
  • Updated the compilation pipeline to use the declared_index for sorting outputs, ensuring the final transaction outputs are in the correct order.

Parsing and lowering enhancements:

  • Modified the AST parsing logic for outputs and Cardano-specific blocks to assign and increment declared_index as each output or directive is encountered.

  • Ensured that the lowering phase includes the declared_index in the IR representations.
    Test and example updates:

  • Updated all relevant test cases and example files to include the new declared_index field, ensuring consistency and coverage for the new behavior.

These changes collectively ensure that output and directive ordering is explicit and robust throughout the transaction lifecycle.

@nicolasLuduena nicolasLuduena linked an issue Jan 20, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Keep order of chain specific outputs

2 participants