Proto: update migration for Lima

Fedor Sheremetyev requested to merge shrmtv@update-migration into master

Context

Lima proposal has been injected, we can start doing stitching to Alpha from Lima protocol rather than Kathmandu.

This MR includes the following changes:

  • update definition of previous protocol constants to a copy of Lima constants,
  • initialise constants in migration as a copy of previous constants,
  • remove migration code related to transition from Kathmandu to Alpha (no longer needed),
  • update tests to do migration from Lima to Alpha (instead of Kathmandu to Alpha).

Manually testing the MR

Import snapshot of mainnet (Kathmandu), migrate to Lima, then to Alpha and bake a few blocks.

  1. Download and import snapshot.
$ wget https://mainnet-v14.xtz-shots.io/mainnet-2738883.rolling
$ ./tezos-node snapshot import mainnet-2738883.rolling --block BKzSQpRiqHUdXoYtCQZXFVDT9ygry5tpoS84DhAZV7Xo9VjSdDn
  1. Create "yes wallet", patch node to accept fake signatures.
$ dune exec devtools/yes_wallet/yes_wallet.exe -- create from context ~/.tezos-node in /tmp/yes-wallet --active-bakers-only
$ patch -p1 < scripts/yes-node.patch
  1. Configure protocol override for Lima in the next level, and for Alpha in the level after that.
$ patch -p1 <<EOF
diff --git a/src/bin_node/node_config_file.ml b/src/bin_node/node_config_file.ml
index c7d77d8a08..9492c6e936 100644
--- a/src/bin_node/node_config_file.ml
+++ b/src/bin_node/node_config_file.ml
@@ -89,0 +90,2 @@ let mainnet_user_activated_upgrades =
+    (2738884l, "PtLimaPt5HZrSMR4TB1qM7Ed8riGUqozU7qcbZNbpZgMPuVUweD");
+    (2738885l, "ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK");
EOF
  1. Build with $ make.

  2. Run tezos node in one terminal, bake migration block for Lima with tezos client in another terminal.

$ ./tezos-node run --synchronisation-threshold 0 --connections 0 --rpc-addr localhost

$ ./tezos-client -d /tmp/yes-wallet bake for --minimal-timestamp

Observe activation of Lima protocol in the tezos node logs.

Oct  5 23:05:04.752 - node.protocol: 015-PtLimaPt: Patching KT1SL6CGhjPUyLypDbFv9bXsNF2sHG7Fy3j9... 
Oct  5 23:05:04.753 - node.protocol: 015-PtLimaPt: Contract KT1SL6CGhjPUyLypDbFv9bXsNF2sHG7Fy3j9 successfully patched
Oct  5 23:05:04.753 - validation: initializing protocol PtLimaPt5HZr...
Oct  5 23:05:04.795 - validator.block: block at level 2738884 successfully pre-applied:
Oct  5 23:05:04.795 - validator.block:   Request pushed on 2022-10-05T23:05:02.064-00:00, treated in 23.750us, completed in 2.731s
Oct  5 23:05:05.121 - validator.block: prechecked block BLz4jphvLUGLVR85wHyHxfcZ6qeLSqVTD5u29eVPZezB2Yf4Q5S
Oct  5 23:05:05.254 - validator.block: block BLz4jphvLUGLVR85wHyHxfcZ6qeLSqVTD5u29eVPZezB2Yf4Q5S validated
Oct  5 23:05:05.254 - validator.block:   Request pushed on 2022-10-05T23:05:05.034-00:00, treated in 17.792us, completed in 219ms
Oct  5 23:05:05.257 - node.store: the protocol table was updated: protocol PtLimaPt5HZr (level 15) was
Oct  5 23:05:05.257 - node.store:   activated on block BLz4jphvLUGLVR85wHyHxfcZ6qeLSqVTD5u29eVPZezB2Yf4Q5S
Oct  5 23:05:05.257 - node.store:   (level 2738884)
Oct  5 23:05:05.285 - validator.chain: Update current head to BLz4jphvLUGLVR85wHyHxfcZ6qeLSqVTD5u29eVPZezB2Yf4Q5S
Oct  5 23:05:05.285 - validator.chain:   (level 2738884, timestamp 2022-09-24T20:21:44-00:00, fitness
Oct  5 23:05:05.285 - validator.chain:   02::0029cac4::::ffffffff::00000000), same branch
  1. Bake migration block for Alpha with tezos client.
$ ./tezos-client -d /tmp/yes-wallet bake for --minimal-timestamp

Observe activation of Alpha protocol in the Tezos node logs.

Oct  5 23:05:12.210 - validation: initializing protocol ProtoALphaAL...
Oct  5 23:05:12.211 - validator.block: block at level 2738885 successfully pre-applied:
Oct  5 23:05:12.211 - validator.block:   Request pushed on 2022-10-05T23:05:11.925-00:00, treated in 19.500us, completed in 286ms
Oct  5 23:05:12.377 - validator.block: prechecked block BLgM2tkmaHXeMDut8MSUm5Ky4ya62kDuerGYGrtzHkKjfqDjiMJ
Oct  5 23:05:12.379 - validator.block: block BLgM2tkmaHXeMDut8MSUm5Ky4ya62kDuerGYGrtzHkKjfqDjiMJ validated
Oct  5 23:05:12.379 - validator.block:   Request pushed on 2022-10-05T23:05:12.318-00:00, treated in 4.166us, completed in 60.862ms
Oct  5 23:05:12.381 - node.store: the protocol table was updated: protocol ProtoALphaAL (level 16) was
Oct  5 23:05:12.381 - node.store:   activated on block BLgM2tkmaHXeMDut8MSUm5Ky4ya62kDuerGYGrtzHkKjfqDjiMJ
Oct  5 23:05:12.381 - node.store:   (level 2738885)
Oct  5 23:05:12.424 - validator.chain: Update current head to BLgM2tkmaHXeMDut8MSUm5Ky4ya62kDuerGYGrtzHkKjfqDjiMJ
Oct  5 23:05:12.424 - validator.chain:   (level 2738885, timestamp 2022-09-24T20:22:14-00:00, fitness
Oct  5 23:05:12.424 - validator.chain:   02::0029cac5::::ffffffff::00000000), same branch
  1. Bake a few more blocks with the same tezos-client command - just in case.
Edited by Fedor Sheremetyev

Merge request reports