-
Notifications
You must be signed in to change notification settings - Fork 9
/
migrate-identity-compare.py
46 lines (35 loc) · 1.17 KB
/
migrate-identity-compare.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
"""
SPDX-License-Identifier: GPL-3.0-only
Compare that the Kusama identity pallet's storage `IdentityOf` is the
same as on the Kusama Collectives chain.
"""
import json
import os
from substrateinterface import SubstrateInterface, Keypair
from substrateinterface.exceptions import SubstrateRequestException
chain = SubstrateInterface(
url="wss://kusama-rpc.polkadot.io"
)
print(f"Connected to {chain.name}: {chain.chain} v{chain.version}")
ksm = {}
query = chain.query_map('Identity', 'IdentityOf')
for acc, i in query:
ksm[acc.value] = i.value
chain = SubstrateInterface(
url="wss://kusama-rpc.dwellir.com"
)
print(f"Connected to {chain.name}: {chain.chain} v{chain.version}")
collectives = {}
query = chain.query_map('Identity', 'IdentityOf')
for acc, i in query:
collectives[acc.value] = i.value
# Sort and compare
ksm = dict(sorted(ksm.items()))
collectives = dict(sorted(collectives.items()))
with open("ksm.json", "w") as f:
json.dump(ksm, f)
with open("collectives.json", "w") as f:
json.dump(collectives, f)
print("Wrote Kusama and collectives identity pallets to files.")
if ksm != collectives:
raise Exception("Kusama and collectives identity pallets are different.")