Supersig -> Statemine

Decentration has been preparing to bring Supersig (pallet and UI) into Statemine parachain so the Kusama ecosystem can benefit from creating persisting decentralised orgs.

Ramsey Ajram (Decentration)
3 min readApr 26, 2023
Supersig in the process of being onboarded to Statemine parachain

Summary

Decentration is a team within the polkadot ecosystem aiming to contribute to system level chains. Our approach is well timed, as it aligns with Parity handing over custodianship of key repos to the community, namely, the Polkadot Fellowhsip. This transition is a planned approach to further distribute decision making power from a single organisation and reduce individual gatekeepers from system repositories.

We have been coordinating with Statemine “product owner”/lead engineer, Joe Petrowski to prepare for the pallet to be pulled into the kusama assets hub in the new polkadot-fellows github. In order for pallet supersig to be merged into Statemine, it will go through a discussion thread with the fellowship.

There are a few steps we are taking in order to merge into statemine.

Step 1 (complete) ✔️

  1. Coordinate with statemine developer/product-owner to check if any further minor features need to be added to our pallet version.
  2. Make sure the page-supersig web app in our forked polkadot-js/apps user interface can yarn build so that it can be easily merged upstream.

Step 2 (ongoing)

  1. Begin discussion and PR with the fellowship. This times well with the handover of system chains and parachain from the custodianship of Parity to the community’s fellowship.
  2. We are also building a custom UI for supersig that is separate from polkadot-js.

For STEP 1, 1) The main goal is to make sure safety is air tight. So we added two new traits to the pallet: a limit on the size of the call data per call; and a limit on the number of proposals each supersig org can make at a given time. The chain who is using the pallet can decide on the value which suits their level of precaution.

Limit on Call Data Size

Users will be prevented from submitting call data exceeding this limit.
Introduce a maximum call data size limit in the configuration trait. This limit can be set to a reasonable default value, which can be changed as required.

Type:

#[pallet::config]
pub trait Config: frame_system::Config {
// ...
/// The maximum size of call data allowed (in bytes).
#[pallet::constant]
type MaxCallDataSize: Get<u32>;
// ...
}

Error:

#[pallet::error]
pub enum Error<T> {
//...
/// The call data size exceeds the maximum allowed limit.
CallDataTooLarge,
//...
}

Logic:

pub fn propose_call(
//...
DispatchResult {
//...
ensure!(
data.len() <= T::MaxCallDataSize::get() as usize,
Error::<T>::CallDataTooLarge
);
//..
}

Test(s):

Max Calls Per Organisation

Limit the number of Calls (aka Proposals) an Organisation can make at a given time. This will de-incentivise organisations for leaving proposal call data for sitting in storage for too long. Once a call is approved the call_data is removed from storage.

Type:

#[pallet::constant]
type MaxCallsPerAccount: Get<u32>;

New storage item:

#[pallet::storage]
#[pallet::getter(fn active_proposals)]
pub type ActiveProposals<T: Config> = StorageMap<_, Twox64Concat, SupersigId, u32, ValueQuery>;

Error:

#[pallet::error]
pub enum Error<T> {
//...
/// Too many active proposals for the given supersig. Proposal voting needs to be completed before another can be proposed.
TooManyActiveProposals,
}

Logic:

pub fn propose_call(
//...
DispatchResult {
//...

// Modify the propose_call extrinsic to check the number of active proposals before allowing a new one
let current_active_proposals = Self::active_proposals(supersig_id);
ensure!(current_active_proposals <= T::MaxCallsPerAccount::get(), Error::<T>::TooManyActiveProposals);
// Increment the number of active proposals for the Supersig account when a new proposal is submitted
ActiveProposals::<T>::mutate(supersig_id, |active_proposals| *active_proposals += 1);

//...
}

Tests:

Step 1, 2) page-supersig-UI

complete ✔️

We have made some minor facelift changes, and made sure that errors pass so that page-supersig within the polkadot-js/apps repo passes.

Step 2, 2) Fellowship and Custom UI

  • Discussion thread will be started… (ToDo priority)
  • Custom UI will be started… (ToDo priority)

Any external blockers?

Statemine parachain is moving home from parity-tech to polkadot-fellows so therefore there are a few natural blockers that may slow down the process of supersig aiming to be merged into the statemine runtime.

--

--

Ramsey Ajram (Decentration)

Decentralising the web. Stewarding new paradigms. Engineering and product.