The latest version of Substrate (v2.0.0-rc4 - Rhinoceros) was released on June 25. Here is an overview of some of the new capabilities it included. The ones I have chosen to highlight are those that I found particularly interesting in my role as Parity Developer Advocate 🤓
Substrate community member Bryan Chen, better known as @xlc on GitHub and
Riot, added a new RPC endpoint to the
FRAME System module that allows users to dry run an
extrinsic. This means that extrinsics can be verified before being executed and making state changes. Users submit an
extrinsic to this endpoint and receive a response in the form of the
ApplyExtrinsicResult
type,
which indicates whether or not the extrinsic was valid, as well as information about the outcome of the dry run (if the
extrinsic would have succeeded or failed, and why it would have failed if so). Bryan created
a GitHub Issue for this awesome feature and closed it with
a PR of his own design within the span of about a week. Bryan’s day
job is Chief Technology Officer for Laminar, which makes his amazing contributions even more
impressive!
A new FRAME pallet for atomic swaps has been
added to Substrate’s set of core FRAME pallets. This pallet
was inspired by the atomic swap protocol described in the Bitcoin Wiki. With
this pallet, two parties can easily exchange assets without needing to trust each other or a centralized third-party.
Although this pallet’s initial implementation only supported
swapping assets that implemented the
ReservableCurrency
trait, its author, Wei Tang/@sorpaas, quickly followed up with
a second PR that generalizes the atomic swap capability. The
version of this pallet that appears in the v2.0.0-rc4 release allows users to atomically swap any asset type for which
the SwapAction
trait is
implemented, and also includes an
implementation for ReservableCurrency
types. Wei is one of the primary contributors to the
EVM pallet.
Substrate core developer Alexander Theißen authored a PR that introduces
a new with_transaction
function.
Alexander’s PR is a shining example of the hard work that the
Substrate core devs put into the usability of the code they write, and readers are encouraged to refer to the original
PR for a clear and thorough description of the capabilities it introduces. In addition to the excellent PR
documentation, Alex included
some great tests
that demonstrate how storage transactions can be used to delineate a set of storage modifications that will be
guaranteed to succeed or fail as a unit.
Substrate v2.0.0-rc4 included enhancements to improve the experience around
the Contracts pallet. Check them out by
completing the awesome ink!
Smart Contracts Tutorial. You can
also follow the Add the Contracts Pallet Tutorial to
learn how to add the Contracts pallet to a runtime.