iroha icon indicating copy to clipboard operation
iroha copied to clipboard

feat(transactions)!: integrate trigger executions into the transaction model

Open s8sato opened this issue 6 months ago • 0 comments

This PR is built on top of #5467. Please review #5467 first.

Overview

This PR overhauls the core transaction definition by treating the initial entrypoint and its subsequent data-trigger executions as a single transactional unit. In concrete terms:

  • Redefined CommittedTransaction to carry both:
    • The original TransactionEntrypoint (external or time-triggered)
    • The resulting TransactionResult (data-trigger sequence or rejection reason)
  • Integrated Merkle inclusion proofs for both entrypoint and result, enabling clients to verify that the entrypoint and the result match the trusted block header
    • However, see the Limitations section.
  • Extended the query API (FindTransactions) to return these proofs alongside the transaction data
  • Added fault-injection tests to simulate and detect maliciously tampered entrypoints or results
    • See tx_history::client_verifies_transaction_entrypoint_and_result_proofs
timeline
    title Transaction redefined, vertically and horizontally
    section External Transactions
      Entrypoint : Data Trigger : Data Trigger
      Entrypoint : Data Trigger : Data Trigger : Data Trigger
      Entrypoint : Data Trigger
    section Time-triggered Transactions
      Entrypoint : Data Trigger : Data Trigger : Data Trigger
      Entrypoint : Data Trigger : Data Trigger

A column is a transaction, comprising an entrypoint and its data-trigger sequence:

block-beta
  columns 2
  block
    columns 1
      a["entrypoint"] c["sequence"]
  end
  block
    columns 1
      b["entrypoint"] d["sequence"]
  end

External (user-requested) transactions precede time-triggered transactions in execution order:

block-beta
  columns 2
  block
    columns 1
      a["external"] c[" "]
  end
  block
    columns 1
      b["time-triggered"] d[" "]
  end

Only external entrypoints are in block payloads. Others are recorded outside payloads but inside blocks as secondary state:

block-beta
  columns 2
  block
    columns 1
      a["source"] c[" "]
  end
  block
    columns 1
      b[" "] d[" "]
  end

As a query result, a committed transaction consists of the entrypoint and the result (data-trigger sequence on success, or rejection reason on failure):

block-beta
  columns 2
  block
    columns 1
      a["entrypoint"] c["result"]
  end
  block
    columns 1
      b["entrypoint"] d["result"]
  end

Breaking Changes

  • CommittedTransaction has been updated with new fields; existing consumers must be updated accordingly.
  • BlockHeader now includes a result_merkle_root field. This may be consolidated back into a single root in a future PR.
  • SignedBlockV1 now has a result: BlockResult field instead of an errors field.
  • TransactionEntrypoint enum now combines SignedTransaction and TimeTriggerEntrypoint as its variants.

Related Issues

  • Builds on PR #5467
  • Closes #4968
  • Opens #5473

Limitations

  • Merkle proofs require header verification to be effective, which is out of scope for this PR.

  • Actual result verification requires additional measures—see issue #5473.

  • Does not support ExecuteTrigger and Executable::Wasm, pending refactoring:

    // FIXME: remove ExecuteTrigger entirely in #5147. // FIXME: include actual instructions -- requires #5358 refactoring.

s8sato avatar Jun 17 '25 07:06 s8sato