Flextesa: New Image, User-Activated-Upgrades, Tenderbake

Seb Mondet
The Aleph
Published in
3 min readNov 29, 2021

With the new image tqtezos/flextesa:20211119, other than the reduced size, a couple of things are worth noting:

  • The user-activated-upgrades, a.k.a. UAUs or “hard-forks”, are easier to make happen.
  • The Alpha protocol of the bundled Octez distribution contains Tenderbake.
  • The client in the container is pre-configured to work with the *box scripts.

See also the documentation.

A “hard” fork.

Granada → Hangzhou UAU

Easy with --hard-fork:

$ image=tqtezos/flextesa:20211119
$ docker run --rm --name g2h --detach -p 20000:20000 \
-e block_time=3 \
"$image" granabox start --hard-fork 20:Hangzhou:

→ creates a Granada sandbox that will switch to Hangzhou at level 20.

Note that the default cycle length in the sandboxes is 8 blocks and switching protocols before the end of the first cycle is not supported by Octez.

Let’s use the pre-configured client in the container:

$ alias tcli='docker exec g2h tezos-client'
$ tcli get balance for alice
2000000 ꜩ

With this and jq you can keep checking the head block until you observe the protocol change:

$ tcli rpc get /chains/main/blocks/head/metadata \
| jq '{level: .level_info.level, protocol: .protocol}'
{
"level": 14,
"protocol": "PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV"
}
… … …
$ tcli rpc get /chains/main/blocks/head/metadata \
| jq '{level: .level_info.level, protocol: .protocol}'
{
"level": 22,
"protocol": "PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx"
}

This is a good opportunity to inspect the transition block(s), for instance, level 20 is made with Granada but the node is prepared for Hangzhou:

$ tcli rpc get /chains/main/blocks/20/metadata | head -n 2
{ "protocol": "PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV",
"next_protocol": "PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx",

→ the node already handles Hangzhou RPCs to be able to prepare its first block (21). For instance the new cache RPCs are available from 20 on:

$ tcli rpc get /chains/main/blocks/19/context/cache/contracts/size
Error:
Did not find service: GET http://localhost:20000/describe/chains/main/blocks/19/context/cache/contracts/size?recurse=no
$ tcli rpc get /chains/main/blocks/20/context/cache/contracts/size
0
$ tcli rpc get /chains/main/blocks/21/context/cache/contracts/size
293821

or the RPC .../endorsing_power is already removed:

$ tcli rpc schema post /chains/main/blocks/20/endorsing_power
Error:
Did not find service: GET http://localhost:20000/describe/chains/main/blocks/20/endorsing_power?recurse=no

Level 21 is then the first block made by the Hangzhou baker:

$ tcli rpc get /chains/main/blocks/21/metadata | head -n 2
{ "protocol": "PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx",
"next_protocol": "PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx",

We can also see that the context migration took a few more seconds (on my laptop!) than the specified block time:

$ for l in $(seq 19 23) ; do tcli rpc get /chains/main/blocks/$l/header | jq .level,.timestamp ; done
19
"2021-11-23T15:30:45Z"
20
"2021-11-23T15:30:48Z"
21
"2021-11-23T15:30:54Z"
22
"2021-11-23T15:30:57Z"
23
"2021-11-23T15:31:00Z"

“Tenderboxes”

There is of course also a hangzbox script, and it can hard-fork to Alpha, but the included version of Tenderbake will switch to mainnet block-times (a.k.a. 30 seconds) instead of inheriting the current values (cf. the fix tezos/tezos!3850 not included in this Docker image).

So let’s start it fresh (block-time is not configurable at all yet):

$ docker kill g2h
$ image=tqtezos/flextesa:20211119
$ docker run --rm --name croissant --detach -p 20000:20000 \
"$image" tenderbox start
$ alias tcli='docker exec croissant tezos-client'

we can see that now blocks have a baker and a proposer:

$ tcli rpc get /chains/main/blocks/head/metadata \
| jq .proposer,.baker
"tz1YPSCGWXwBdTncK2aCctSZAXWvGsGwVJqU"
"tz1YPSCGWXwBdTncK2aCctSZAXWvGsGwVJqU"

More improvements coming up soon!

--

--