It’s been too long since the last post in this series. I will try to be more regular in the future.

The Tezos Developer Community Mailing List

In case I haven’t reached you on other platforms, there’s now a mailing list for members of the Tezos community who are actively working on projects in the space. Feel free to add yourself to the mailing list. For now, we are restricting posting permissions to people actively working on projects, but anyone is free to watch the conversation. If you are currently working on a Tezos-related project, add yourself to the list and send me a message via Reddit, Email, or smoke signal with your email and a description of your project and I will give you the ability to post.

The MRs

Split data encoding

The Tezos Data_encoding library became larger and larger until it ended up being more than 2000 lines of code. This had started to become unmanageable and overly monolithic. This MR splits the functionality into several submodules that exist in separate files. This new API is much cleaner and easier to understand for newcomers. The description of this MR is very detailed and if you would like to understand the changes in more detail, you should definitely read it.

Vendors/blake2b: use bigstring

Many OCaml projects that make use of bytes do so via the Cstruct library. This library allows for a mapping of OCaml arrays to C-like structures. This MR replaces the Cstruct library with Bigstrings. This new API should be more direct and result in fewer errors. This MR performs the change for the Blake2b library, which has been vendored in.

Vendors/tweetnacl: use bigstring

As you may remember directly from the last MR described in this post, Cstruct is out and Bigstring is in. This MR performs the change for the libcrypto library, which is based on tweetnacl.

Data_encoding: better documentation of `int`

This MR makes some documentation changes to the Data_encoding module. They clarify how the ranged_int constructor operates and that it is restricted to an OCaml integer, sized for a 32 bit platform.

Stdlib/MBytes: avoid double raise

There was a minor bug in the MBytes module which caused an exception to be raised from a function designed to create the message to be later raised in an exception. In practice, this bug didn’t matter because the correct exception was raised with the right message, but the new code is cleaner and more correct.

Fixes for secp256k1

This MR applies a number of fixes/improvements to the Secp256k1 bindings we are using. These include removing hard coded constants, using more expressive types, adding more documentation, and using the Alcotest library for the tests.

Improve bootstrap pipeline

When a node connects to the Tezos network, it has to synchronize with the other nodes around it. This is the bootstrapping process. By tweaking logging practices, increasing the parallelism in the process, and tweaking the time between requests, this MR decreases idle CPU time and improves performance throughout the entire bootstrapping process. This will be increasingly important as the chain grows, simply because the bootstrap process will take longer.

Node: Use native TLS instead of OpenSSL

This MR switches Tezos to a pure OCaml version of TLS. This gets rid of an external dependency and ensures memory-safety for the TLS implementation.

ocplib-json-typed

This MR vendors in OCPlib-json-typed, a typesafe JSON serialization library. This library has been used inside Tezos since the start. Because its often painful to have people upgrade dependencies that have been modified as well as to build the Tezos codebase against these sorts of dependencies, the decision was made to vendor in this library.

Rebased banned peers branch

Unfortunately, blockchains run in an adversarial environment. This means that some nodes may attempt to spam others or cheat in other ways. These bad-actors in the system may have malicious intentions and, for reasons of efficiency, it is best not to let them spam your node. This MR creates a greylist, which temporarily stops you from interacting with bad peers. This greylist is based around a fantastic Patricia tree implementation (I know the article is about Radix trees, but Patricia trees are simply a special case of Radix trees). I personally learned a lot from reading this MR and, if you’re looking to become better at using some advanced OCaml features, I highly suggest you do the same.