Skip to content

Commit d880471

Browse files
authored
Merge pull request #96 from paritytech/muharem-opengov-fellowship
Polkadot Opengov tests
2 parents e94e025 + 8655bef commit d880471

11 files changed

Lines changed: 890 additions & 90 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ node_modules
55
!/bin/README.md
66
/logs
77
/*.json
8-
*.log
8+
*.log
9+
._*

examples/collectives-polkadot/0_xcm/0_init.yml

Lines changed: 98 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,16 @@ settings:
66
collectives_parachain: &collectives_parachain
77
wsPort: 9710
88
paraId: &cp_id 1001
9+
assethub_parachain: &assethub_parachain
10+
wsPort: 9810
11+
paraId: &sp_id 1000
912
variables:
10-
xcm_version: &xcm_version 3
11-
weight_threshold: &weight_threshold { refTime: [10, 10], proofSize: [10, 10] }
13+
xcm_version: &xcm_version '3'
1214
chains:
1315
accounts:
1416
alice_signer: &alice_signer //Alice
1517
decodedCalls:
16-
cp_force_xcm_version:
18+
ap_force_xcm_version:
1719
chain: *collectives_parachain
1820
pallet: polkadotXcm
1921
call: forceXcmVersion
@@ -49,9 +51,13 @@ tests:
4951
]
5052
events:
5153
- name: sudo.Sudid
52-
result: { sudoResult: Ok }
54+
attributes:
55+
- type: Result<Null, SpRuntimeDispatchError>
56+
value: Ok
5357
- name: xcmPallet.SupportedVersionChanged
54-
result: [{ parents: 0, interior: { X1: { Parachain: *cp_id }}}, *xcm_version ]
58+
attributes:
59+
- type: u32
60+
value: *xcm_version
5561
- extrinsics: # Collectives Parachain sets supported version for Relay Chain through it
5662
- chain: *relay_chain
5763
signer: *alice_signer
@@ -64,7 +70,7 @@ tests:
6470
v3: [ # message
6571
{
6672
UnpaidExecution: {
67-
weightLimit: {
73+
weightLimit: {
6874
limited: {
6975
refTime: 2200000000, # 2_200_000_000
7076
proofSize: 200000, # 200_000
@@ -76,25 +82,103 @@ tests:
7682
Transact: {
7783
originKind: Superuser,
7884
requireWeightAtMost: {
79-
refTime: 200000000, # 200_000_000
85+
refTime: 200000000, # 200_000_000
8086
proofSize: 0,
8187
},
82-
call: $cp_force_xcm_version
88+
call: $ap_force_xcm_version
8389
}
8490
}
8591
]
8692
}
8793
]
8894
events:
8995
- name: sudo.Sudid
90-
result: { sudoResult: Ok }
96+
attributes:
97+
- type: Result<Null, SpRuntimeDispatchError>
98+
value: Ok
9199
- name: xcmPallet.Sent
100+
- name: polkadotXcm.SupportedVersionChanged
101+
chain: *collectives_parachain
102+
attributes:
103+
- type: u32
104+
value: *xcm_version
92105
- name: dmpQueue.ExecutedDownward
93106
chain: *collectives_parachain
94-
threshold: *weight_threshold
95-
result: {
96-
outcome: { Complete: { refTime: '2,200,000,000', proofSize: 0 }}
107+
attributes:
108+
- type: XcmV3TraitsOutcome
109+
xcmOutcome: Complete
110+
- extrinsics: # Relay Chain sets supported version for AssetHub Parachain
111+
- chain: *relay_chain
112+
sudo: true
113+
signer: *alice_signer
114+
pallet: xcmPallet
115+
call: forceXcmVersion
116+
args: [
117+
{ # location
118+
parents: 0,
119+
interior: {
120+
X1: {
121+
Parachain: *sp_id
122+
}
97123
}
124+
},
125+
*xcm_version
126+
]
127+
events:
128+
- name: sudo.Sudid
129+
attributes:
130+
- type: Result<Null, SpRuntimeDispatchError>
131+
value: Ok
132+
- name: xcmPallet.SupportedVersionChanged
133+
attributes:
134+
- type: u32
135+
value: *xcm_version
136+
- extrinsics: # AssetHub Parachain sets supported version for Relay Chain through it
137+
- chain: *relay_chain
138+
signer: *alice_signer
139+
sudo: true
140+
pallet: xcmPallet
141+
call: send
142+
args: [
143+
{ v3: { 0, interior: { x1: { parachain: *sp_id }}}}, # destination
144+
{
145+
v3: [ # message
146+
{
147+
UnpaidExecution: {
148+
weightLimit: {
149+
limited: {
150+
refTime: 2200000000, # 2_200_000_000
151+
proofSize: 200000, # 200_000
152+
},
153+
}
154+
}
155+
},
156+
{
157+
Transact: {
158+
originKind: Superuser,
159+
requireWeightAtMost: {
160+
refTime: 200000000, # 200_000_000
161+
proofSize: 0,
162+
},
163+
call: $ap_force_xcm_version
164+
}
165+
}
166+
]
167+
}
168+
]
169+
events:
170+
- name: sudo.Sudid
171+
attributes:
172+
- type: Result<Null, SpRuntimeDispatchError>
173+
value: Ok
174+
- name: xcmPallet.Sent
98175
- name: polkadotXcm.SupportedVersionChanged
99-
chain: *collectives_parachain
100-
result: [{ parents: 1, interior: Here }, *xcm_version ]
176+
chain: *assethub_parachain
177+
attributes:
178+
- type: u32
179+
value: *xcm_version
180+
- name: dmpQueue.ExecutedDownward
181+
chain: *assethub_parachain
182+
attributes:
183+
- type: XcmV3TraitsOutcome
184+
xcmOutcome: Complete

examples/collectives-polkadot/0_xcm/1_teleport.yml

Lines changed: 39 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,10 @@ settings:
77
wsPort: 9710
88
paraId: &cp_id 1001
99
variables:
10-
weight_threshold: &weight_threshold { refTime: [10, 10], proofSize: [10, 10] }
1110
accounts:
1211
alice_signer: &acc_alice_signer //Alice
1312
alice_account32: &acc_alice_acc32 '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d'
1413
alice_ss58: &acc_alice_ss58 '15oF4uVJwmo4TdGW7VfQxNLavjCXviqxT9S1MgbjMNHr6Sp5'
15-
checking_account: &checking_account '13UVJyLnbVp9x5XDyJv8g8r3UddNwBrdaH7AADCmw9XQWvYW'
16-
1714

1815
tests:
1916
- name: Teleport assets from Relay Chain to Collectives Parachain successful.
@@ -42,32 +39,33 @@ tests:
4239
args: [
4340
{ v3: { 0, interior: { x1: { parachain: *cp_id }}}}, # destination
4441
{ v3: { parents: 0, interior: { x1: { accountId32: { id: *acc_alice_acc32 }}}}}, # beneficiary
45-
{
46-
v3: [
47-
# {
42+
{
43+
v3: [
44+
# {
4845
# # TODO use a separate Assets to pay a fee, to receive an exact amount of assets on beneficiary account.
4946
# # a call with two assets fails with an error right now.
50-
# id: { concrete: { 0, interior: { here: true }}},
51-
# fun: { fungible: 1000000000000 } # 1_000_000_000_000
47+
# id: { concrete: { 0, interior: { here: true }}},
48+
# fun: { fungible: 1000000000000 } # 1_000_000_000_000
5249
# },
53-
{
54-
id: { concrete: { 0, interior: { here: true }}},
50+
{
51+
id: { concrete: { 0, interior: { here: true }}},
5552
fun: { fungible: 20000000000000 } # 20_000_000_000_000
5653
}
57-
]
54+
]
5855
}, # assets
5956
0, # feeAssetItem
6057
]
6158
events:
6259
- name: xcmPallet.Attempted
63-
threshold: *weight_threshold
64-
result: [{ Complete: { refTime: '3,000,000,000', proofSize: 0 }}]
60+
chain: *relay_chain
61+
attributes:
62+
- type: XcmV3TraitsOutcome
63+
xcmOutcome: Complete
6564
- name: dmpQueue.ExecutedDownward
6665
chain: *collectives_parachain
67-
threshold: *weight_threshold
68-
result: {
69-
outcome: { Complete: { refTime: '4,000,000,000', proofSize: 0 }}
70-
}
66+
attributes:
67+
- type: XcmV3TraitsOutcome
68+
xcmOutcome: Complete
7169
- queries:
7270
balance_rc_alice_2:
7371
chain: *relay_chain
@@ -111,29 +109,41 @@ tests:
111109
args: [
112110
{ v3: { parents: 1, interior: { here: true }}}, # destination
113111
{ v3: { parents: 0, interior: { x1: { accountId32: { id: *acc_alice_acc32 }}}}}, # beneficiary
114-
{
115-
v3: [
116-
{
117-
id: { concrete: { parents: 1, interior: { here: true }}},
112+
{
113+
v3: [
114+
{
115+
id: { concrete: { parents: 1, interior: { here: true }}},
118116
fun: { fungible: 10000000000000 } # 10_000_000_000_000
119117
}
120-
]
118+
]
121119
}, # assets
122120
0, # feeAssetItem
123121
]
124122
events:
125123
- name: balances.Withdraw
126-
result: { who: *acc_alice_ss58, amount: 10000000000000 }
124+
attributes:
125+
- type: AccountId32
126+
key: who
127+
value: *acc_alice_ss58
128+
- type: u128
129+
key: amount
130+
value: 10000000000000
127131
- name: polkadotXcm.Attempted
128-
threshold: *weight_threshold
129-
result: [{ Complete: { refTime: '3,000,000,000', proofSize: 0 }}]
132+
attributes:
133+
- type: XcmV3TraitsOutcome
134+
xcmOutcome: Complete
130135
- name: balances.Withdraw
131136
chain: *relay_chain
132-
result: { who: *checking_account, amount: 10000000000000 } # amount received and withdrawn from registry account
133-
- name: ump.ExecutedUpward
137+
attributes:
138+
- type: u128
139+
key: amount
140+
value: 10000000000000 # amount received and withdrawn from registry account
141+
- name: messageQueue.Processed
134142
chain: *relay_chain
135-
threshold: *weight_threshold
136-
result: [{ Complete: { refTime: '4,000,000,000', proofSize: 0 }}]
143+
attributes:
144+
- type: bool
145+
key: success
146+
value: true
137147
- queries:
138148
balance_rc_alice_3:
139149
chain: *relay_chain

examples/collectives-polkadot/0_xcm/2_reserve.yml

Lines changed: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ settings:
77
wsPort: 9710
88
paraId: &cp_id 1001
99
variables:
10-
weight_threshold: &weight_threshold { refTime: [10, 10], proofSize: [10, 10] }
1110
chains:
1211
accounts:
1312
alice_signer: &alice_signer //Alice
1413
alice_account32: &alice_acc32 '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d'
14+
alice_ss58: &acc_alice_ss58 '15oF4uVJwmo4TdGW7VfQxNLavjCXviqxT9S1MgbjMNHr6Sp5'
1515

1616
tests:
1717
- name: Reserve assets from Relay Chain to Collectives Parachain fails
@@ -26,28 +26,49 @@ tests:
2626
args: [
2727
{ v3: { 0, interior: { x1: { parachain: *cp_id }}}}, # destination
2828
{ v3: { parents: 0, interior: { x1: { accountId32: { id: *alice_acc32 }}}}}, # beneficiary
29-
{
30-
v3: [
31-
{
32-
id: { concrete: { 0, interior: { here: true }}},
29+
{
30+
v3: [
31+
{
32+
id: { concrete: { 0, interior: { here: true }}},
3333
fun: { fungible: 20000000000000 } # 20_000_000_000_000
3434
}
35-
]
35+
]
3636
}, # assets
3737
0, # feeAssetItem
3838
]
3939
events:
4040
- name: xcmPallet.Attempted
41-
threshold: *weight_threshold
42-
result: [{ Complete: { refTime: '2,000,000,000', proofSize: 0 }}]
41+
chain: *relay_chain
42+
attributes:
43+
- type: XcmV3TraitsOutcome
44+
xcmOutcome: Complete
4345
- name: dmpQueue.ExecutedDownward
4446
chain: *collectives_parachain
45-
threshold: *weight_threshold
46-
result: {
47-
outcome: {
48-
Incomplete: [
49-
{ refTime: '1,000,000,000', proofSize: 0 },
50-
UntrustedReserveLocation
51-
]
52-
}
53-
}
47+
attributes:
48+
- type: XcmV3TraitsOutcome
49+
xcmOutcome: Incomplete
50+
51+
# Fails with the message - "RpcError: 1010: Invalid Transaction: Transaction would exhaust the block limits"
52+
# Because of the u64::MAX weight set fot the extrinsic to disable it.
53+
# The test tool does not allow to assert such a fail.
54+
55+
# - name: Reserve assets from Collectives Parachain to Relay Chain fails
56+
# actions:
57+
# - extrinsics:
58+
# - chain: *collectives_parachain
59+
# signer: *alice_signer
60+
# pallet: polkadotXcm
61+
# call: reserveTransferAssets
62+
# args: [
63+
# { v3: { parents: 1, interior: { here: true }}}, # destination
64+
# { v3: { parents: 0, interior: { x1: { accountId32: { id: *alice_acc32 }}}}}, # beneficiary
65+
# {
66+
# v3: [
67+
# {
68+
# id: { concrete: { parents: 1, interior: { here: true }}},
69+
# fun: { fungible: 10000000000000 } # 10_000_000_000_000
70+
# }
71+
# ]
72+
# }, # assets
73+
# 0, # feeAssetItem
74+
# ]

0 commit comments

Comments
 (0)