## Testing invulnerable referenda July 2024 Referenda were posted on Kusama and Polkadot to correct some community invulnerables and change the number of permissionless slots. [Polkadot referendum](https://polkadot.subsquare.io/referenda/1008) [Kusama referendum](https://kusama.subsquare.io/referenda/421) Let's test them using Chopsticks. Taking Polkadot first we see it's on the staking admin track and can inspect the call to see what it involves: ![Screenshot 2024-07-19 at 16.38.31](https://hackmd.io/_uploads/rJ4j_-_OC.png) So it's an XCM to the people chain (1004). We can fire up chopsticks in a terminal in XCM mode with polkadot relay and polkadot people chain: Currently chopsticks has no config for polkadot-people, but I've made a PR to add it. Soon you'll be able to run the bottom without creating your own file. Create the following as ./polkadot-people.yml: ``` endpoint: wss://polkadot-people-rpc.polkadot.io mock-signature-host: true block: ${env.POLKADOT_PEOPLE_BLOCK_NUMBER} db: ./db.sqlite import-storage: System: Account: - - - 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY - providers: 1 data: free: 1000000000000000 ``` Now we can fork the network in xcm mode - this gives us both the polkadot relay and polkadot people chain to play around with: ``` npx @acala-network/chopsticks@latest xcm -r polkadot -p ./polkadot-people.yml ``` We can use PJS apps with these two chains at ports 8000 and 8001 (relay is always last unless you manually specify port number) [Polkadot Relay](https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A8001%2F#/explorer) [Polkadot People Chain](https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A8000%2F#/explorer) We get the preimage hash and length from subscan (linked on subsquare/polkassembly referendum page): https://polkadot.subscan.io/block/21714510?tab=event&event=21714510-51 From here we see: ![Screenshot 2024-07-19 at 16.37.27](https://hackmd.io/_uploads/HkVSdWOdC.png) Now we can go to the [JS tab](https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A8001%2F#/js) of the relay and enact the preimage with the staking admin origin. This runs the referendum's exact preimage in our forked network: ```javascript // Grab the block number of the current head // api is already imported, no need to add anything but the following. const number = (await api.rpc.chain.getHeader()).number.toNumber() // use chopsticks dev_setStorage to inject the call into the scheduler state for the next block. The value of `Lookup` is just the preimage hash and its length. Crucially with this call we can set the origin to `StakingAdmin` await api.rpc('dev_setStorage', { scheduler: { agenda: [ [ [number + 1], [ { call: { Lookup: { hash: '0x7b69697edc70cac0681a4210c6176a63c7b0ca20b88211fa62b6421bdecd88c3', len: 53 } }, origin: { Origins: 'StakingAdmin' } } ] ] ] } }) // Make a block to include the extrinsic await api.rpc('dev_newBlock', { count: 1 }) ``` In the terminal you'll see a new relay block being made, then the people chain making a block when it spots the XCM waiting for it. We can check the events and chain state to make sure it has done what we want: ![Screenshot 2024-07-19 at 17.10.00](https://hackmd.io/_uploads/SJD1gfOOA.png) So we see that an event has been emitted to show the new values of candidates (7) and desired candidacy bond (1000 EXP10) and since dot has 10 decimals, this looks correct. The test for the kusama call is exactly analagous and is left the the reader 🙂