Allow the baker to fetch mempools from a remote server
Context
This MR rework the tezos-client bake for
's --mempool option allowing it to fetch a remote mempool from a server. This option has also been added to the tezos-*-baker
which will request and include operations from the remotely fetched mempool via a HTTP request. These requests happen on each new slot prior to the node fetching the node's mempool. Custom HTTP headers may also be provided using the environment variable TEZOS_REMOTE_MEMPOOL_HTTP_HEADERS
when running the baker similarly as the tezos-signer
. tezos-client bake for
also have a new option --no-mempool
to prevent the node from requesting the mempool from the node which was previously the case when the --mempool
option would be provided. This is no longer the case.
This MR also add a client's command to compute the hash of a byte-encoded operation which is useful to forge mempools.
Manually testing the MR
- Start a sandbox that maintains its
data-dir
: e.g.DATA_DIR="/tmp/mydatadir" ./src/bin_node/tezos-sandboxed-node.sh 1 --connections 0
- Bake a few blocks and prepare a mempool by injecting operations without including them in a block;
- Query the mempool using the
/chains/main/mempool/pending_operations
RPC and put the result in a file; - Shutdown and restart the sandbox node to clear out its mempool but not its state;
- Host the mempool file on a HTTP(s) server;
- Run
tezos-client bake for bootstrap1 --mempool <remote_mempool_uri>
(and withtezos-alpha-baker
); - Check that the expected operations to be included are indeed present in the new block.