The Sequencer should fully commit to transaction_receipts

The problem:

Currently, only the events field in the transaction_receipts section of the block is committed to by the Sequencer. With a centralized and trusted system, this is fine because all nodes sync from the same source. However, with the deprecation of the Sequencer and the rise of P2P, nodes will have no way to confirm if the rest of the receipt they receive from the network is legitimate.

The solution:

We propose that the entire transaction_receipt should be committed to by the Sequencer. This requires computing a commitment for the transaction_receipt and including it in the block hash.

Technical details:

An example of how to commit to the transaction_receipts is given below.

Define the receipt_commitment as:

receipt_commitment = h(receipt_0_hash, receipt_1_hash, …, receipt_n_hash)


receipt_i_hash = h(h(execution_status), h(transaction_index), transaction_hash, l2_to_l1_messages_hash, events_hash, execution_resources_hash, h(actual_fee))

We can compute the l2_to_l1_messages_hash using the same mechanism used to compute the events_hash. Namely, to calculate l2_to_l1_messages_hash :

  1. For each message, calculate the msg_id as msg_id = h(h(from),h(payload),h(to))
  2. Build a Trie using the msg_ids
  3. Calculate the root of the Trie, and assign it to l2_to_l1_messages_hash.

execution_resources_hash can be calculated for example as:

execution_resources_hash=h(h(n_steps), h(pedersen_builtin), h(range_check_builtin),h(n_memory_holes))

or first by concatenating the data before hashing.

Finally, this SNIP will require replacing event_commitment with receipt_commitment in the block hash calculation.