Baker: check node version
What
Add a check of the node version when the baker is run.
It can be by-passed, using the flag --node-version-check-bypass.
To be able to do this check a function to compare 2 versions when it make sens is added.
The MR includes some test of these contributions.
Fix #7359 (closed).
Future related MRs:
- backport of this MR in older protocols
- add a flag to the baker to accept a specific version of the node
Why
How
Manually testing the MR
In the first shell terminal:
- get latest release version of
octez-node, - get this MR version of
octez-node, - then run the latest release version of
octez-node:
git checkout latest-release
# uncomment the line below if needed
# make build-dev-deps
make
cp ./octez-node ./octez-node-rc
git checkout vivien@baker_check-node-version
# uncomment the line below if needed
# make build-dev-deps
make
./octez-node-rc run --data-dir ./data-dir --rpc-addr localhost
In another terminal:
- run the baker
- check that there is an error
- run the baker with the
--node-version-check-bypassflag
- check the warning log and that the baker run normally:
./octez-baker-alpha run with local node ./data-dir --liquidity-baking-toggle-vote pass
# The baker should fail with an error
./octez-baker-alpha run with local node ./data-dir --liquidity-baking-toggle-vote pass --node-version-check-bypass
# The baker should emit a warning log and run normally
Stop the baker and the node. In the first terimal, run this MR version node:
./octez-node run --data-dir ./data-dir --rpc-addr localhost
In the other terminal, run the bake without the flag:
./octez-baker-alpha run with local node ./data-dir --liquidity-baking-toggle-vote pass
It should run normally.
To run the unit and end-to-end tests:
dune exec src/lib_version/test/main.exe -- --file test_octez_node_version.ml
dune exec tezt/tests/main.exe -- --file baker_test.ml --test "Alpha: baker node version check bypass test"
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.rstfor the protocol and the environment,CHANGES.rstat the root of the repository for everything else). -
Select suitable reviewers using the Reviewersfield below. -
Select as Assigneethe next person who should take action on that MR
Edited by Vivien Pelletier