The Cosmos SDK had an overhaul to enter the IBC world. This is the story of the architecture and engineering approach to this overhaul.
The
As you may be aware, Regen Network took responsibility for maintaining the
Let’s begin with the big picture. The Stargate v0.40 release of the Cosmos SDK resulted from many teams working in collaboration for almost 10 months.
This release took time due to the intersection of three large pieces creating the interconnected software:
Combining
A major design principle around the architecture of the refactored Cosmos SDK is in service to long-running, interoperable distributed systems. Defining stable interfaces for long-running distributed systems must be effectively executed before interesting features can be built and adopted and see large-scale usage.
There are two main ways we accomplish this goal of resisting breaking changes for client developers. One is simple good hygiene and refraining from arbitrary renaming of fields. The other is the use of tools that check for breaking changes in order to ensure architecture and engineering is done in a way that avoids these breaking changes whenever possible.
Here is a quick example of what an evolutionary schema approach to software engineering looks like. You will quickly see why it is so important for our goal of stability for client interfaces in service to a long-running, interoperable distributed system.
Proto messages have field numbers. This makes it possible to add new fields to a schema and delete unused fields without causing breaking changes for downstream clients. When depreciation occurs, we simply deprecate the whole field and its number, and add a new field with a new number for new functionality. This ensures that clients do not arbitrarily break.
For instance, if you were to build a form with the following fields: 1- Name, 2- Date of Birth, 3 — Country, using amino it would be very easy to simply replace 2 — Date of birth with 2- Birthday. This breaks all downstream clients because computers just do what you tell them to. Protobuf makes it easy to check for these sorts of breaking changes and easy to deprecate field 2 if you no longer want to collect Date of Birth information. Instead of clobbering field 2 via renaming, instead, you create a new field 4 — “Account Balance,’’ to add new functionality in a way that downstream clients don’t break, but the update is reflected. This is an essential attribute in creating a stable interface for long-running distributed systems, and Protobuf has the tooling to make developing in this paradigm easy for developers.
The tooling for checking and returning an error if changes are breaking is called
It is important to note that in the evolution of the Cosmos SDK, or any other software, breaking changes will still have to be made. However, we want to reserve breaking changes for very important upgrades, while working hard at the client level to avoid breaking changes whenever possible.
We now have the concept of evolutionary schema design under our belts, and understand why it is important for long-running distributed systems like the Cosmos Hub, and other blockchains running on the Cosmos SDK. Let’s explore the concept of Semantic Versioning and it’s importance and relationship to evolutionary schema-based engineering.
This combination of Semantic versioning for the state machine, and evolutionary schema design for the client interface, is what will make the Cosmos SDK the right mix of stable, customizable, modular, and extensible. These are the attributes needed by developers to ensure that sovereignty AND interoperability, the two core concepts of Cosmos’s blockchain paradigm, are both achieved.
0.40 proto files were released with a beta tag, which means that we may still make some breaking changes, as needed. This is in service to ensure a stable long-running distributed system as the outcome as we march as a community towards SDK 1.0. Regen Network will do everything we can to avoid breaking change, but we are also aware that the battle testing happening in testnets and main nets around the ecosystem could uncover issues that need to be addressed with a schema-breaking change.
In short, Protobuf was adopted by the Cosmos Community because it makes it easier to do a better job of something that is already very hard and important: striving to provide stable clients interfaces for as long as possible.
Protobuf also brings large performance upgrades due to its use of code generation. This allows more transactions per second using the Tendermint Consensus engine, increasing the performance of a Cosmos SDK.
The Stargate upgrade is finally around the corner for every project that uses the Cosmos SDK. Let’s examine how the upgrade will take part.
In order to use the IBC module, be up-to-date with the latest Cosmos SDK version, and benefit from the latest feature it is recommended to upgrade to the newest version. As stated above, the most notable upgrades are ProtoBufs, Light Clients, IBC, State synchronization, and relayers.
We have prepared a range of documents and specifications that you can dive deeper in order to understand the changes coming to the Cosmos SDK. On February 18th, 6 am UTC the Cosmoshub-3 will halt and all full node operators and validators are required to upgrade. Please see the following documents on how this will take effect, how you can prepare, and what to do when the day arrives.
You might want to update your applications for the Stargate upgrade. The following tutorial should guide you on how to set up a local development environment to work with and test your application functionality.
If you have a working blockchain that uses the Cosmos SDK, @lukeitsbrian
has created an example case on how to upgrade your module from a previous Cosmos SDK module to the next generation Tendermint v0.41.0
If you want to start a new application with the stargate version, check the blog tutorial on how to create a blockchain application in minutes with starport.
Written with the support of Aaron Craelius and the Tendermint Team.
Previously publishedhere