Test Runtime Upgrades
How to test upgrades depending on a runtime upgrade not yet executed.
Last updated
$ stat -f%z preimage.bin
1567371
$ export PREIMAGE_SIZE=1567371$ b2sum -l 256 preimage.bin | awk '{print "0x"$1}'
0x15165c85152568b7f523e374ce1a5172f2aa148721d5dae0441f86c201c1a77b4
$ export PREIMAGE_HASH=0x15165c85152568b7f523e374ce1a5172f2aa148721d5dae0441f86c201c1a77b4use codec::Encode;
use std::fs::File;
fn main() {
let mut file = File::open("preimage.bin")?;
let mut buf: Vec<u8> = Vec::new();
file.read_to_end(&mut buf)?;
let bytes_encoded = buf.encode();
println!("0x{}", hex::encode(bytes_encoded));
}endpoint: wss://polkadot-rpc.dwellir.com
mock-signature-host: true
block: ${env.POLKADOT_BLOCK_NUMBER}
db: ./polkadot.sqlite
import-storage:
System:
Account:
- - - 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
- providers: 1
data:
free: '10000000000000000000'
ParasDisputes:
$removePrefix: ['disputes'] # those can makes block building super slow
Preimage:
{
PreimageFor:
[[[[PREIMAGE_HASH, PREIMAGE_SIZE]], PREIMAGE_WITH_LENGTH_PREFIX]],
StatusFor:
[[[PREIMAGE_HASH], { Requested: { count: 1, len: PREIMAGE_SIZE } }]],
}endpoint: wss://statemint-rpc.dwellir.com
mock-signature-host: true
block: ${env.POLKADOT_ASSET_HUB_BLOCK_NUMBER}
db: ./assethub.sqlite
import-storage:
System:
Account:
- - - 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
- providers: 1
data:
free: 1000000000000000endpoint: wss://polkadot-bridge-hub-rpc.dwellir.com
mock-signature-host: true
block: ${env.POLKADOT_BRIDGEHUB_BLOCK_NUMBER}
db: ./bridgehub.sqlite
import-storage:
System:
Account:
- - - 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
- providers: 1
data:
free: 1000000000000000yarn start xcm -r polkadot.yml -p polkadot-asset-hub.yml -p polkadot-bridge-hub.ymlconst number = (await api.rpc.chain.getHeader()).number.toNumber()
await api.rpc('dev_setStorage', {
Scheduler: {
Agenda: [
[
[number + 1],
[
{
call: {
Lookup: {
hash: PREIMAGE_HASH,
len: PREIMAGE_SIZE,
},
},
origin: {
system: 'Root',
},
},
],
],
],
},
})
await api.rpc('dev_newBlock', { count: 1 })await api.rpc('dev_newBlock', { count: 2 })await api.rpc('dev_newBlock', { count: 1 })await api.rpc('dev_newBlock', { count: 1 })API-WS: disconnected from wss://polkadot-rpc.dwellir.com: 1006:: Abnormal Closure