Skip to content

Mempool: Add a new format for pending_operations

Context

This MR adds a new format for pending_operations which is compatible with the previous one. This MR aims to solve in a retro-compatible way one part of #1323 (closed) . In particular, for every category, they are all uniform in the sense all categories are objects where the key is the operation hash.

Questions to the reviewers

  • We could make another RPC instead of using a parameter to filter over the encoding. Would it be better? I wonder what would be the OpenAPI specification for this RPC.

Previously:

{ "applied":
    [ { "hash": "ooiPMJaXw3fmz7ZYFjWuMSBsBMQaAuqkrdXsyZr52HRDt5W7cHB",
        "branch": "BM7V9MhND8P95pES1ZNimwXKoAg7Dm6wiJGKbSVgTs4135UXGyY",
        "contents":
          [ { "kind": "transaction",
              "source": "tz1bNoAXomRwaXPjypBXkBBZehMkLZpsd3W7", "fee": "413",
              "counter": "23371769", "gas_limit": "1500",
              "storage_limit": "0", "amount": "5000000",
              "destination": "tz1RDPx4mipnX6fSSWAQ3QgNfRf3cEdnCXTE" } ],
        "signature":
          "sigmqJz33GPzdWzE2jDyWK9dCZfKCmqjZzo834fjirc825Hrunsgu2r9LFuAfrfxb9e4Re8PxyH4RGMHtgSse7mAmaYrJoWU" }, ... ],
  "refused": [],
  "branch_refused":
    [ [ "onygoFWmj1vXPsPkSjr9zKhGhPrdFDy3KtuyZSnhHgqYZoWyVt6",
        { "protocol": "PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV",
          "branch": "BKnHmBx9rL5cEwBejwxKFHqBmjyEc5YpA6KUD9tQ4bnwuwnWDAx",
          "contents":
            [ { "kind": "transaction",
                "source": "tz1ePteu4aWa6AN4V15jgrsnaDV9FaeZVuGX",
                "fee": "3040", "counter": "24287653", "gas_limit": "27325",
                "storage_limit": "350", "amount": "100000",
                "destination": "KT1HbQepzV1nVGg8QVznG7z4RcHseD5kwqBn",
                "parameters":
                  { "entrypoint": "collect", "value": { "int": "950859" } } } ],
          "signature":
            "siggaUDUEfancwbBannAQ3VanESCi878kMqR13MDNCfzKdJRUQEG2NdufouPm2KcN95TaaAJWsb3Y7egbLbZpAxNezfhxnKA",
          "error":
            [ { "kind": "branch",
                "id": "proto.010-PtGRANAD.contract.counter_in_the_past",
                "contract": "tz1ePteu4aWa6AN4V15jgrsnaDV9FaeZVuGX",
                "expected": "24287654", "found": "24287653" } ] } ] ],
  "branch_delayed": [], "unprocessed": [] }

Now:

{ "applied":
    [ { "hash": "ooiPMJaXw3fmz7ZYFjWuMSBsBMQaAuqkrdXsyZr52HRDt5W7cHB",
        "branch": "BM7V9MhND8P95pES1ZNimwXKoAg7Dm6wiJGKbSVgTs4135UXGyY",
        "contents":
          [ { "kind": "transaction",
              "source": "tz1bNoAXomRwaXPjypBXkBBZehMkLZpsd3W7", "fee": "413",
              "counter": "23371769", "gas_limit": "1500",
              "storage_limit": "0", "amount": "5000000",
              "destination": "tz1RDPx4mipnX6fSSWAQ3QgNfRf3cEdnCXTE" } ],
        "signature":
          "sigmqJz33GPzdWzE2jDyWK9dCZfKCmqjZzo834fjirc825Hrunsgu2r9LFuAfrfxb9e4Re8PxyH4RGMHtgSse7mAmaYrJoWU" }, .. ],
  "refused": [],
  "branch_refused":
    [ { "hash": "onygoFWmj1vXPsPkSjr9zKhGhPrdFDy3KtuyZSnhHgqYZoWyVt6",
        "protocol": "PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV",
        "branch": "BKnHmBx9rL5cEwBejwxKFHqBmjyEc5YpA6KUD9tQ4bnwuwnWDAx",
        "contents":
          [ { "kind": "transaction",
              "source": "tz1ePteu4aWa6AN4V15jgrsnaDV9FaeZVuGX",
              "fee": "3040", "counter": "24287653", "gas_limit": "27325",
              "storage_limit": "350", "amount": "100000",
              "destination": "KT1HbQepzV1nVGg8QVznG7z4RcHseD5kwqBn",
              "parameters":
                { "entrypoint": "collect", "value": { "int": "950859" } } } ],
        "signature":
          "siggaUDUEfancwbBannAQ3VanESCi878kMqR13MDNCfzKdJRUQEG2NdufouPm2KcN95TaaAJWsb3Y7egbLbZpAxNezfhxnKA",
        "error":
          [ { "kind": "branch",
              "id": "proto.010-PtGRANAD.contract.counter_in_the_past",
              "contract": "tz1ePteu4aWa6AN4V15jgrsnaDV9FaeZVuGX",
              "expected": "24287654", "found": "24287653" } ] } ],
  "branch_delayed": [], "unprocessed": [] }

Manually testing the MR

Observe that by default we still have the previous format. And if you call

./tezos-client rpc get /chains/main/mempool/pending_operations?version=1

Then you obtain the new format.

Other versions than 0 or 1 give Not_found a Not_found answer. The version 0 is the one by default.

Checklist

  • Document the interface of any function added or modified (see the coding guidelines)
  • Document any change to the user interface, including configuration parameters (see node configuration)
  • Provide automatic testing (see the testing guide).
  • For new features and bug fixes, add an item in the appropriate changelog (docs/protocols/alpha.rst for the protocol and the environment, the Development Version section of CHANGES.md for everything else).
  • Select suitable reviewers using the Reviewers field below.
  • Select as Assignee the next person who should take action on that MR
Edited by François Thiré

Merge request reports