Rollup node: return outbox messages in L2 block RPC

What

This RPC returns the outbox as part of the response to the RPC /global/block/<block_id>?outbox=true when the query parameter outbox=true is provided. (This field is absent otherwise.)

Example

> GET http://127.0.0.1:58502/global/block/head?outbox=true
{
  "block_hash": "BM4EbtbE58MkPzRZT94UMmyrnRERKwmfBmXgCRtwRHQksxCvqnb",
  "level": 5,
  "predecessor": "BMZUYMWyHfDwvFD8d2ZJnekfkHRRL6Q8TN4KZX8QDiVFqMgPMyq",
  "commitment_hash": null,
  "previous_commitment_hash": "src13yLVQpHLBBH4hERbt9zCmeG6gc5wA3zsm8hZG75v4TdDvV5t8c",
  "context": "SRCo2cQYhNnddQYkMpt94w5tuZAX1Fjd74e7KjGWDJVGR6Y4nsVv4o",
  "inbox_witness": "srib22s9PpqeSy1GvYUrbBBhVEakbXqpVZdjksQaghniizE8s6cVQXj",
  "inbox_hash": "srib12kCQqRh6qSX8tzN1DYxvTkK3jd25aWi7cQeix1mWi3YraaxsBZ",
  "inbox": {
    "level": 5,
    "old_levels_messages": {
      "index": "4",
      "content": {
        "hash": "srib22s9PpqeSy1GvYUrbBBhVEakbXqpVZdjksQaghniizE8s6cVQXj",
        "level": 5
      },
      "back_pointers": [
        "srib13uhbDHZ5TGjrHokx5T9WHBjsurb2kNDijBFEBLfh3ZveLxJrD6",
        "srib13uhbDHZ5TGjrHokx5T9WHBjsurb2kNDijBFEBLfh3ZveLxJrD6"
      ]
    }
  },
  "messages": [
    "0001",
    "00030000000064b4f822f365312802b7c0d926b28c27c6b3ee212921cd4e92011aa59da7099c98af542f",
    "00000a00000024000000001f002501e23f94166aa518a037d11c2af05984c36b08f7cc0000000003617578b8a8b6f6910862bc7f78be2b459ea1e388f41aad0002298c03ed7d454a101eb7022bc95f7e5f41ac7860456fdcdd3fa34617540700c8e2ac135ef47327",
    "0002"
  ],
  "outbox": [
    {
      "message_index": 0,
      "transactions": [
        {
          "destination": "KT1VD4SdQF2ruNNTCE1aTWErmGz9tN4Mg8F5",
          "entrypoint": "aux",
          "parameters": {
            "int": "37"
          }
        }
      ]
    }
  ],
  "initial_tick": "400000000000000",
  "num_ticks": "250000000000000"
}

Why

This RPC allows to see the effect of the PVM execution without having to wait for the block to be cemented, which is required of the RPC to fetch outbox messages.

Manually testing the MR

dune exec tezt/tests/main.exe -- -f sc_rollup.ml  outbox

Merge request reports

Loading