Skip to content

Update migration for Ithaca

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

Context

Ithaca proposal has been injected - we can start doing stitching to Alpha from Ithaca rather than Hangzhou.

This MR includes the following changes:

  • update definition of previous protocol constants to a copy of Ithaca constants,
  • initialise constants in migration as a copy of previous constants, plus defaults for TORU and SCORU flags,
  • reset first Tenderbake level in migration to avoid the need for endorsements for the migration block - Ithaca baker is not injecting endorsements for migration block at the moment (see here for details) which will fixed separately,
  • fallback forging of migration block in Ithaca baker to the node,
  • include current protocol hash in the context in mockup simulator (required due to the fallback),
  • don't reset round for a block produced by previous protocol,
  • initialise stake storage only in migration from Genesis,
  • remove migration code related to transition from Emmy to Tenderbake (no longer needed),
  • update tests to do migration from Ithaca to Alpha (instead of Hangzhou to Alpha).

TODO:

  • port Ithaca baker changes to Alpha,
  • make Flextesa test daemons_upgrade_alpha less flaky,
  • fix endorsements for migration block.

Many thanks @eugenz for the help debugging and fixing Tenderbake issues! 🙏

Manually testing the MR

Import snapshot of mainnet data (Hangzhou), migrate to Ithaca, then to Alpha, and try to bake a few blocks.

  1. Download and import snapshot.
$ wget https://mainnet.xtz-shots.io/tezos-mainnet-2021290.rolling

$ ./tezos-node snapshot import tezos-mainnet-2021290.rolling --block BM7wvkrfMDtXHXCh4zGsYiLPVJ9u1ox7QY2k7pt7cRDxe2UxtpV
  1. Create "yes wallet", patch node to accept fake signatures.
$ dune exec scripts/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 Ithaca 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 8f765b050a..7055ea6ae4 100644
--- a/src/bin_node/node_config_file.ml
+++ b/src/bin_node/node_config_file.ml
@@ -87,0 +88,2 @@ let mainnet_user_activated_upgrades =
+    (2021291l, "PsiThaCaT47Zboaw71QWScM8sXeMM7bbQFncK9FLqYc6EKdpjVP");
+    (2021292l, "ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK");
EOF
  1. Build with $ make.

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

$ ./tezos-node run --synchronisation-threshold 0 --connections 0 --rpc-addr localhost |& tee tezos-node.log


$ ./tezos-client -d /tmp/yes-wallet bake for foundation3 --minimal-timestamp |& tee tezos-client.log.1

Observe activation of Ithaca protocol in the Tezos node logs.

Jan 12 11:48:46.447 - validation: initializing protocol PsiThaCaT47Z...
Jan 12 11:48:46.460 - validator.block: block at level 2021291 successfully pre-applied
Jan 12 11:48:46.460 - validator.block: Request pushed on 2022-01-12T11:48:10.887-00:00, treated in 18.500us, completed in 35.572s 
Jan 12 11:48:47.083 - validator.block: block BMUVJLSsnNUSuWKS4YpNpoM9TErpj5srRWDDEnsYzX2SEinbod2 successfully validated
Jan 12 11:48:47.083 - validator.block: Request pushed on 2022-01-12T11:48:46.685-00:00, treated in 16.900us, completed in 397ms 
Jan 12 11:48:47.088 - node.store: the protocol table was updated: protocol PsiThaCaT47Z (level 12) was
Jan 12 11:48:47.088 - node.store:   activated on block BMUVJLSsnNUSuWKS4YpNpoM9TErpj5srRWDDEnsYzX2SEinbod2
Jan 12 11:48:47.088 - node.store:   (level 2021291)
Jan 12 11:48:47.129 - validator.chain: Update current head to BMUVJLSsnNUSuWKS4YpNpoM9TErpj5srRWDDEnsYzX2SEinbod2 (level 2021291, timestamp 2022-01-11T07:54:38-00:00, fitness 01::000000000014d7ab), same branch
Jan 12 11:48:47.129 - validator.chain: Request pushed on 2022-01-12T11:48:47.083-00:00, treated in 147us, completed in 45.527ms
  1. Bake migration block for Alpha with tezos client (note use of "bake for" without account).
$ ./tezos-client -d /tmp/yes-wallet bake for --minimal-timestamp |& tee tezos-client.log.2

Observe activation of Ithaca protocol in the Tezos node logs.

Jan 12 11:50:09.669 - validation: initializing protocol ProtoALphaAL...
Jan 12 11:50:09.680 - validator.block: block at level 2021292 successfully pre-applied
Jan 12 11:50:09.680 - validator.block: Request pushed on 2022-01-12T11:50:09.529-00:00, treated in 24.700us, completed in 150ms 
Jan 12 11:50:11.796 - validator.block: block BKpZn8tYKeUmcpHHacqMXv2etN2vLEcGz9MUgS9Bbv7ZxDRDnWf successfully validated
Jan 12 11:50:11.796 - validator.block: Request pushed on 2022-01-12T11:50:11.752-00:00, treated in 17.600us, completed in 43.122ms 
Jan 12 11:50:11.798 - node.store: the protocol table was updated: protocol ProtoALphaAL (level 13) was
Jan 12 11:50:11.798 - node.store:   activated on block BKpZn8tYKeUmcpHHacqMXv2etN2vLEcGz9MUgS9Bbv7ZxDRDnWf
Jan 12 11:50:11.798 - node.store:   (level 2021292)
Jan 12 11:50:11.829 - validator.chain: Update current head to BKpZn8tYKeUmcpHHacqMXv2etN2vLEcGz9MUgS9Bbv7ZxDRDnWf (level 2021292, timestamp 2022-01-11T07:55:08-00:00, fitness 02::001ed7ac::::ffffffff::00000000), same branch
Jan 12 11:50:11.829 - validator.chain: Request pushed on 2022-01-12T11:50:11.795-00:00, treated in 134us, completed in 32.839ms 
  1. Bake a few more blocks with the same command - just in case. Each block takes ~30 seconds.

Checklist

  • N/A Document the interface of any function added or modified (see the coding guidelines)
  • N/A Document any change to the user interface, including configuration parameters (see node configuration)
  • Provide automatic testing (see the testing guide).
  • N/A 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 Fedor Sheremetyev

Merge request reports