The following document provides information on how to batch governance calls using Polkadot.js and can be used for proposals, council motions, and external proposals.
The information can be used for creating proposals on the Turing Network, Turing Staging, and OAK Network. Though the methods will also work on other parachains.
Allowing multiple calls to be executed in a single dispatch can be useful for a variety of reasons within the governance system. For example:
Combining proposals for blockchain runtime upgrade such as
set_codewith the corresponding
Updating multiple members for the Council or Technical Committee in the same instance.
Completing multiple treasury payouts with a singular signature verification.
Parallel & Sequential
If you want to include multiple actions under a singular governance pre-image, first you must determine if the actions of the request can be run in parallel or will need to be run sequentially. In most cases, we recommend you to use the sequential method to construct the actions in order. For more information about the process of starting a proposal, check out our documentation for creating a proposal on the Turing network here.
Parallel - All actions will happen simultaneously.
Sequentially - The actions will take place one after the other.
Next, we will walk you through the steps for creating a proposal or motion which uses the Batch functionality.
Head to the Governance tab on Polkadot.js and click to submit a preimage or council motion in the same method as usual for when creating a proposal.
In the proposal select the utility branch of calls from the drop down menu on the left hand side.
For actions that can be completed parallel (simultaneously) select the batch call. For sequential actions use the batchAll call as the calls will then be atomically executed.
Note: If any of the calls fail through a batch call or batchAll, the whole transaction will roll back.
In this demo, we use batch() call for a parallel execution because the three operations can happen at the same time.
More information about each call can be found here.
Add the items required for the proposal with the add item button.
Note: The number of calls must not exceed the
batched_calls_limit which can be found in the constant metadata.
Note: The batched calls must be from the same origin.
Call 1 -
Call 2 -
Call 3 -
If unsure of the origin type check the pallet information in the link below or search for the correct pallet at the top of the page.
Review each action to ensure the details are correct and then submit the proposal/motion in the standard manner. The actions will be batched and only a singular authorization is required for the proposal.
Note: Be sure to save the call hash
Once your proposal or motion is submitted you can add information for the public about the purpose of your proposal on Polkassembly and Subsquare. We also recommend visiting our community Discord and putting a post in our #Governance channel.
An example of a successful batch is displayed below.
To review the entire example on Subsquare click the link here.
To review the example on Polkassembly click the link here.