Substrate Monthly Substrate Technical Newsletter — September Issue

OneBlock+
6 min readOct 13, 2022

--

This monthly newsletter is authored by Substrate Evangelist @AmadeusGB

Substrate Monthly — Substrate Technical Newsletter, produced by OneBlock+, summarizes technical progresses of Substrate framework and updates activities in the Polkadot ecosystem each month to get the community updated. Subjects include critical technical submissions, modifications and releases, design discussions, references, technical community updates and etc.

The following is the September issue. Enjoy~

01.Important Submissions and Releases

1. Add a fast-unstake pallet

  • This is a pallet that does one thing and one thing only: allow you to unstake from the staking system quickly. If you are not exposed (i.e. not in the Exposure of any validator) in any of the last BondingDuration eras. Optionally, this pallet allows one to join a pool on the fly as they unstake.
  • All of these have been discussed in #8436. This PR is probably the most conservative approach in terms of security, yet it is the least efficient for the chain. To be specific, the pallet will schedule background tasks to check the entire exposure table of the stash who wants to unstake over multiple blocks. This is not fast, it does waste chain resources, but it is safe.
  • Add deposite in the fast-unstake pallet

2. Update Weight

1) weight 1.5 Opaque struct This PR is an intermediate step between our current u64 Weight V1, and the upcoming multi-dimensional Weight v2. This PR has a huge number of changes, but none of them should be logically different than before.

  • Change type Weight = u64 into struct Weight { ref_time: u64 }
  • polkadot companion: paritytech/polkadot#5943
  • cumulus companion: paritytech/cumulus#1581
  • Look at the weight_v2.rs file to see the exposed APIs of struct Weight

2) weight 1.5

  • Improve math APIs exposed by Weight.
  • Mul and Div are always scalar over the fields.
  • We do not support Weight * Weight or Weight / Weight which is nonsensical in the context of multi-dimensional weights.
  • Remove Weight::one() which doesn't really make sense with multi-dimensional weights.
  • Remove Weight::new() and use just Weight::zero() instead.
  • Introduce macros to multiply by u8, u16, u32, u64, Percent, PerU16, Permill, Perbill, Perquintill.

3) Create sp-weight crate to store weight primitives The notion of weights reaches far beyond FRAME, and so it should be a crate separate from frame_support or sp-runtime.

4) Add storage size component to weights Add the long-awaited storage size weight component to the Weight structure in sp-weights.

5) Const impls of base arithmetics for weights

3. Fix nomination-pools

This PR makes sure pool metadata is removed from pool dissolve.

4. Add ability to try runtime upgrade hooks to directly pass data

Users should be able to persist with some information to help verify a migration has executed successfully without modifying the runtime state.

5. Remove Ord impl for Weights V2 and add comparison fns

This PR removes the PartialOrd and Ord. derivation for the new Weight struct. The intention here is that normal ordering does not quite make sense for a composite Weight struct, and instead we need to be granular and all constituent weights need to be compared.

6. Update pallet-nft

  • Add multiple approvals Allows the item owner to make approvals to multiple accounts. This feature is added to the pallet-nfts.
  • Fix Auto-Increment We cannot assume that the CollectionId is an integer hence parachains that support XCM will have CollectionId defined as Multilocation. To solve this, in this PR I have added a new trait Incrementable that needs to be implemented for the CollectionId type. This way the incrementing functionality needs to be defined in the runtime so that we don't make any assumptions here on substrate.

7. Update transaction payment pallet

  • NextFeeMultplier support GenesisConfig
  • This allows an initial value for NextFeeMultiplier to be provided at genesis.
  • The current implementation hard-codes the initial value to FixedU128::saturating_from_integer(1) when it is absent. While this can be adjusted arbitrarily with FeeMultiplierUpdate, this doesn't kick in until the end of block 1. This means that block 1 fees are impractical on any runtime for which 1 is not a sane value. This is particularly problematic for testing.
  • Add ConstFeeMultiplier

8. Use array-bytes for All Array/Bytes/Hex Operations

The author of PR is array-bytes. It’s pretty useful and easy to use for array/bytes/hex operation, replacing hex crate and HexDisplay struct.

9. Multisig: Fix tests and re-introduce reserve logic

Remove Calls storage and irrelevant functions.

10. Add chainSpec RPC API

The chainSpec methods include:

  • chainSpec_unstable_chainName - Get the chain name, as present in the chain specification.
  • chainSpec_unstable_genesisHash - Get the chain's genesis hash.
  • chainSpec_unstable_properties - Get the properties of the chain, as present in the chain specification.

11.Add special tag to exclude runtime storage items from benchmarking

We know will be accessed every block, and thus we ignore reads to these items already in our benchmarking. This PR adds a #[pallet::whitelist_storage] attribute macro that can be applied to storage item declarations.

02. Documents and materials

What is Parity’s ink!?

ink! is a programming language for smart contracts — one of several that blockchains built with the Substrate framework can choose from. It’s an opinionated language that we at Parity have built by extending the popular Rust programming language with functionality needed to make it smart contract compatible.

03. Technology Ecosystem and Community

1) 9 Hackathons in Three Years, No Limit to the Development Path of Web3er

“After the Polkadot hackathon, where do they go? “ the second season of interviews invited the founder of the NonceGeek team @DuckGo Lee. He has extensive experience in hackathon competitions, and building multiple Web3 projects from 0 to 1. For him, hackathon competition is a tool in the development process. Afterwards, whether the project can continue to develop is not the only criterion for judging the value. Accumulating the rich experience by hackathon, DuckGo Lee founded NonceGeekDao and became the developer of All in Web3. He showed us a different way of working Web3.

2) Web3 Bootcamp Demo Day Registration is Underway, Inviting You to Witness the Birth of a Star Project!

Web3.0 Bootcamp, launched by Web3 Foundation, Parity, Wanxiang Blockchain Lab and New Chain Space, aims to help teams build the future of Web3.0 through the Substrate technology framework and Polkadot network. The goal of Web3.0 Bootcamp is to provide comprehensive support for Web 3.0 technology-related startups (including technology, products, capital, and ecological cooperation), and to build a clear and sustainable business model, and to help to bring projects to a successful conclusion.

3) Four Outstanding Project Discuss How Substrate Empowers Polkadot Application Layer?

OneBlock held a Substrate Saturday livestream event at on September 17 at 8pm. It’s the perfect place to witness the benefits of using the Substrate technology stack for app development within the Polkadot ecosystem. Roundtable guests for the livestream are all from the Substrate ecosystem. As beneficiaries of Polkadot’s technology, they discussed the current progress of Polkadot’s ecosystem and the future potential of Substrate technology from a developer’s perspective.

4) What applications are most needed for Web3? What will be the advantage of Substrate after the Ethereum merger?

On September 17, 2022, OneBlock held the 13th Substrate Saturday event in YouTube Live Streaming. OneBlock invited Meta Defender CEO & Co-Founder Alvin, Web3Games Chain Leader Henry Liu, Web3Go COO Lemo and OAK Network CEO & Co-Founder Chris Li, to discuss the topic with 760 netizens.

04. Cross-chain Protocol

05. Substrate Course Preview

OneBlock+ and Parity are collaborating on the 10th installment of the “Substrate Blockchain Introductory Course”. This course is perfect for developers who want to get started in Web3. This is still a public service class. You can get a full refund of tuition if you meet the course requirements. In order to ensure the quality of teaching, we plan to have a limited number of enrollments on a first-come, first-served basis, so book your seat now!

🟠 Register and save the seat!

About OneBlock+

OneBlock+ is the first and the largest blockchain developer community in China. At OneBlock+, we provide full support for developers with their substrate studies and further set off their career paths. We host Polkadot Hackathons every season to attract top-notch developers to build and innovate for the prosperity of the ecosystem. As a greater China technology resource integrator, OneBlock+ also partners with developers, communities, business elites, and key media who have business insights and experiences in the blockchain industry to provide educational events, such as technical courses, webinars, AMAs, and offline events for the industry. Want to shape the crypto world together? Come and join us today!

Twitter / Telegram / Discord / YouTube

--

--

OneBlock+
OneBlock+

Written by OneBlock+

Cultivate substrate developer community and redefine the future of open web ecosystem together.

No responses yet