What Got Merged: Part VI
Most shamefully, this post takes the name of the “editor of the beast”. However, I have maintained the high ground by writing it in Emacs, a program which I am able to exit. The same cannot be said for the users of the other editor.
Now that half of the audience has decided that sharpening their pitchforks is preferable to continuing to read this post, onto the merge requests!
Data_encoding: add support for Zarith
This MR adds a better method of serializing Zarith numbers. Here’s the challenge that this MR solves: these integers can be arbitrarily long, but most won’t be. Before getting into the new serialization format, I’m going to try to explain why Tezos is using these integers.
If you think about the range of integers that you deal with in your normal life, almost all fit within a 64 bit integer (numbers between -9,223,372,036,854,775,808 and 9,223,372,036,854,775,807). However, this is not good enough for formal verification. When you formally verify something, you are making a statement about all possible inputs, which can exceed these limits. Additionally, there are times that intermediate results can overflow, where the final answer fits comfortably within the limits. For example there are values for x for which x * 4 / 8 would overflow and the (equivalent in standard mathematics) x / 2 would not.
The fact that most numbers are going to be small means that simply writing the byte sequence with a size before it imposes an overhead of 1.5–2x for most numbers. Instead, this MR uses the first bit of each byte to state whether it is the last byte in the Zarith number.
1xxxxxxx- last byte, stop reading0xxxxxxx- not last byte, continue reading
The first byte uses the second bit to encode sign information (1 if less than zero and 0 otherwise).
10xxxxxx- Single byte positive number11xxxxxx- Single byte negative number
The remaining seven bits (six for the first byte) of the byte encode the number itself.
The Tezos node now correctly handles CORS requests!
Client: improve printing of logged requests
This MR fixes some minor issues with the printing when logging the JSON from the HTTP requests.
MBytes: implement with `bigstring`
The MBytes module now uses the bigstring library! This library is well tested and eliminates most of the custom code in this module, which simplifies the codebase overall.
Do not forfeit bond when seed are not revealed by bakers
This MR makes a slight tweak to the way bakers are penalized if they do not reveal the random seed. Instead of losing their deposit, now they lose only the fees and block rewards that were associated with baking that block.
Docker: proper cleanup on chain reset
This MR cleans up how the chain is reset. Now the previous chain’s data is deleted from the docker container.
Alpha: fail on early revelations
This MR enforces that nonces are revealed exactly once, in the correct cycle. It registers three errors for the three (time related) ways that nonce reveals can be invalid and adds logic to report them.
Alpha: exclude signature from the minimal stamp of PoW.
Each Tezos block contains a small proof of work stamp, which is used to prevent spamming. This MR tweaks how that stamp is checked so that it no longer includes the signature itself. As the stamp needs to be signed as part of the block header, this causes many signatures to be needed in order to bake a single block. This MR corrects this bug and simplifies/speeds up the baking process.





