Substrate Technology Monthly Report | 2021.06 - Substrate Technology Update Express

Author: Kaichao

Hi, all developers who are concerned about Substrate technology~

The latest developments in Substrate technology and ecology in June are here. This article is Substrate's ninth technical monthly report (June 2021), enjoy!

 01. Important commits and releases

GRANDPA: Strengthen the restrictions on grandpa gossip -  it can reduce the related news in the current network, and make the gossip mechanism more fair.

Change SelectChain from synchronous to asynchronous interface - so that the information of some subsystems can be read asynchronously in the interface implementation.

APIs such as remove_all of storage items add a limit on the number of deleted elements  - when the number of collection elements is large, data can be deleted in batches by setting this limit. The affected APIs are remove_all, remove_prefix, clear_prefix, kill_prefix.

Increase the memory size limit that can be acquired by wasm bytecode to 32MB  - Substrate has implemented a freeing-bump memory allocator, which can dynamically allocate memory in a certain range, and the latest modification is 32MB to solve the problem of excessive memory usage by the staking module .

Mandatory callable functions in FRAME v2 need to be declared as pub - thus more in line with rust syntax.

Added execute-block subcommand to the try-runtime command provided for compiled binaries  - users can use this command to execute a provided block based on the previous block's runtime state.

Allows the #[pallet::constant] macro to act on associated types that have multiple interface constraints - i.e. the following syntax is supported,

 #[pallet::constant]

 type U: Get<u32> + From<u16>;

The built-in balances module adds a transfer_all callable function - used to transfer all available balances to another account.

Allows to rename the prefix of the storage item - the string literal used by default when the storage item is defined, and the new tag #[pallet::storage_prefix = "CustomName"] can customize the prefix.

A series of interfaces required by NFT are abstracted, and unique pallet implements these interfaces - including the Inspect interface that can read the attribute information of NFT, and the Mutate interface that provides writing operations such as casting, destroying, and setting NFT attributes.

The execution engine of wasm, wasmtime, was upgraded to 0.27 -  the new version of wasmtime uses a new generation of code generation backend, which greatly improves the efficiency and fixes some bugs.

Introduce a new field code_substitute in the chain spec - the value of this field can replace the wasm on the chain, which is usually a temporary solution after the wasm operation on the chain has problems.

The Fast Sync mode is introduced when synchronizing blocks -  it can greatly speed up the speed of block synchronization. Before, each block needs to be downloaded and verified. After using Fast Sync, it is no longer necessary to perform verification of each block, only an additional download is required Proof of the latest on-chain state.

Made pallet::hooks and pallet::call macros optional.

The NamedReservableCurrency interface is defined, and this interface is implemented in the balances module  - the name can be given when the asset is reserved, so as to better distinguish which module is performing the reserve operation on the asset.

Added runtime module transaction-storage to support Storage Chain  - each transaction will be converted into a trie containing 256 bytes, the transaction-storage module saves the root of these tries, and randomly selects a transaction from the previous block The corresponding bytes are verified.

02. Design proposal discussion 

Implemented a new storage API CountedStorageMap - it can record the number of elements in the current map while storing key-value pairs.

Discussion: Use the index sequence to process the prefix of the storage unit - the naming of the storage item is located in the code, but it is closely related to the key stored in the database. At present, it is difficult to change the name of the storage item when the code is refactored, because it will affect the storage of the database. Using indexes can alleviate this problem, but maintaining indexes is also cumbersome, and the current result is introducing custom storage aliases instead of using indexes.

Integrate Wasmer into the Substrate sandbox environment - Currently, Substrate's runtime execution supports wasmi and wasmtime. Wasmtime executes faster, but only supports trusted code, that is, runtime. In view of security, Substrate's ink smart contract still uses wasmi that is interpreted and executed . Wasmer, a compilation and execution tool that is more suitable for the blockchain execution environment, can have more options in the future, and choose a more efficient wasm execution method through actual testing.

 03. Documents and materials 

Transaction Pool technical documentation - covers the role of Substrate transaction pool, design principles and data structure analysis.

Video: Test storage migrations and runtime upgrades with try-runtime.

视频:Substrate for Solidity Developers - An Introduction。

Video: Introduction to WASM Smart Contracts.

Remove the randomness collective flip module in Polkadot runtime - This PR details how to clean up the storage while removing the module.

 04. Technology ecology and community 

Introducing Polkadot Buildathon India.

Web3 Open Grands sponsored the development of the Zeroknowledge plonk module.

Polkadot Hackathon 2nd (Summer) Hackathon competition registration countdown 1 day!

 05. Cross-chain protocol 

Polkadot Development Guide Document: Chain Selection - Summarizes the design principles and implementation descriptions of fork-choice and chain selection.

Implemented the dispute handling subsystem in the Polkadot protocol - when a dispute arises, the verifier is allowed to restore the parachain candidate block data, verify the candidate block, and vote on the dispute.

Add Westmint to Westend as a trusted Teleport parallel chain - When two chains trust each other's runtime logic, they can add each other as a source that allows Teleport, and then assets can be transferred through xcm's TeleportAssets message.

Supongo que te gusta

Origin blog.csdn.net/Web3Explorer/article/details/121226267
Recomendado
Clasificación