[go: up one dir, main page]

EVM/Node: check a preimage is not corrupted during download

What

Adds a simple check to the download root hash command to ensure the preimage has been correctly downloaded and redownloads it otherwise.

Why

There is a high suspicion that the last Etherlink upgrade failed due to a corrupted preimage. This is a first step to download them once the node receives the upgrade event and checks for consistency.

How

Preimages are hashed with Blake2B, the download simply recomputes the hash of the preimage and checks it returns the same hash.

Manually testing the MR

First try to download the latest preimage

./octez-evm-node download kernel with root hash 00e73f6c608055e61332eb4818ffc6c5a2f4b5505ba45f068b3c598799b3444ecc --data-dir test_preimages/.octez-evm-node --preimages-endpoint https://snapshots.eu.tzinit.org/etherlink-ghostnet/wasm_2_0_0

then alter one of the files, for example

echo "OUPS" >> working_dir/.octez-evm-node/wasm_2_0_0/00028855f4426e9a3e3d5fc41531f0479c657f86f4d6003380687b336a737e9a70

If you run the command again with --retry 0, it will not try to redownload it and simply fail:

./octez-evm-node download kernel with root hash 00e73f6c608055e61332eb4818ffc6c5a2f4b5505ba45f068b3c598799b3444ecc --data-dir working_dir/.octez-evm-node --preimages-endpoint https://snapshots.eu.tzinit.org/etherlink-ghostnet/wasm_2_0_0 --retry 0
Error:
  The preimage received for 00028855f4426e9a3e3d5fc41531f0479c657f86f4d6003380687b336a737e9a70 doesn't return the same hash

Now, run the command again with --retry 1, the command will succeed and the preimage will have been redownloaded.

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, CHANGES.rst at the root of the repository 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 Pierrick Couderc

Merge request reports

Loading