Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
e2e tests for Gov2 (#2944)
Browse files Browse the repository at this point in the history
* Fellowship e2e tests

* fixes

* fixe wrong result

* Update parachains/integration-tests/e2e/collectives/README.md

* Apply suggestions from code review

Co-authored-by: Squirrel <[email protected]>

* fixes

---------

Co-authored-by: joe petrowski <[email protected]>
Co-authored-by: Squirrel <[email protected]>
  • Loading branch information
3 people authored Aug 1, 2023
1 parent b6ff026 commit a74ffe6
Show file tree
Hide file tree
Showing 10 changed files with 798 additions and 11 deletions.
22 changes: 22 additions & 0 deletions parachains/integration-tests/e2e/collectives/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
E2E tests concerning Polkadot Governance and the Collectives Parachain. The tests run by the Parachain Integration Tests [tool](https://github.com/paritytech/parachains-integration-tests/).

## Requirements
The tests require some changes to the regular production runtime builds:

RelayChain runtime:
1. Alice has SUDO
2. Public Referenda `StakingAdmin`, `FellowshipAdmin` tracks settings (see the corresponding keys of the `TRACKS_DATA` constant in the `governance::tracks` module of the Relay Chain runtime crate):
``` yaml
prepare_period: 5 Block,
decision_period: 1 Block,
confirm_period: 1 Block,
min_enactment_period: 1 Block,
```
Collectives runtime:
1. Fellowship Referenda `Fellows` track settings (see the corresponding key of the `TRACKS_DATA` constant in the `fellowship::tracks` module of the Collectives runtime crate):
``` yaml
prepare_period: 5 Block,
decision_period: 1 Block,
confirm_period: 1 Block,
min_enactment_period: 1 Block,
```
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@ settings:
collectives_parachain: &collectives_parachain
wsPort: 9710
paraId: &cp_id 1001
assethub_parachain: &assethub_parachain
wsPort: 9810
paraId: &sp_id 1000
variables:
xcm_version: &xcm_version 3
weight_threshold: &weight_threshold { refTime: [10, 10], proofSize: [10, 10] }
chains:
accounts:
alice_signer: &alice_signer //Alice
decodedCalls:
cp_force_xcm_version:
ap_force_xcm_version:
chain: *collectives_parachain
pallet: polkadotXcm
call: forceXcmVersion
Expand Down Expand Up @@ -64,7 +67,7 @@ tests:
v3: [ # message
{
UnpaidExecution: {
weightLimit: {
weightLimit: {
limited: {
refTime: 2200000000, # 2_200_000_000
proofSize: 200000, # 200_000
Expand All @@ -79,7 +82,7 @@ tests:
refTime: 200000000, # 200_000_000
proofSize: 0,
},
call: $cp_force_xcm_version
call: $ap_force_xcm_version
}
}
]
Expand All @@ -89,10 +92,75 @@ tests:
- name: sudo.Sudid
result: { sudoResult: Ok }
- name: xcmPallet.Sent
- name: polkadotXcm.SupportedVersionChanged
chain: *collectives_parachain
result: { location: { parents: 1, interior: Here }, version: *xcm_version }
- name: dmpQueue.ExecutedDownward
chain: *collectives_parachain
threshold: *weight_threshold
result: { outcome: { Complete: { refTime: '2,200,000,000', proofSize: 0 }}}
- extrinsics: # Relay Chain sets supported version for AssetHub Parachain
- chain: *relay_chain
sudo: true
signer: *alice_signer
pallet: xcmPallet
call: forceXcmVersion
args: [
{ # location
parents: 0,
interior: {
X1: {
Parachain: *sp_id
}
}
},
*xcm_version
]
events:
- name: sudo.Sudid
result: { sudoResult: Ok }
- name: xcmPallet.SupportedVersionChanged
result: { location: { parents: 0, interior: { X1: { Parachain: *sp_id } } }, version: *xcm_version }
- extrinsics: # AssetHub Parachain sets supported version for Relay Chain through it
- chain: *relay_chain
signer: *alice_signer
sudo: true
pallet: xcmPallet
call: send
args: [
{ v3: { 0, interior: { x1: { parachain: *sp_id }}}}, # destination
{
v3: [ # message
{
UnpaidExecution: {
weightLimit: {
limited: {
refTime: 2200000000, # 2_200_000_000
proofSize: 200000, # 200_000
},
}
}
},
{
Transact: {
originKind: Superuser,
requireWeightAtMost: {
refTime: 200000000, # 200_000_000
proofSize: 0,
},
call: $ap_force_xcm_version
}
}
]
}
]
events:
- name: sudo.Sudid
result: { sudoResult: Ok }
- name: xcmPallet.Sent
- name: polkadotXcm.SupportedVersionChanged
chain: *collectives_parachain
chain: *assethub_parachain
result: { location: { parents: 1, interior: Here }, version: *xcm_version }
- name: dmpQueue.ExecutedDownward
chain: *assethub_parachain
result: { outcome: { Complete: {} } }
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ settings:
alice_ss58: &acc_alice_ss58 '15oF4uVJwmo4TdGW7VfQxNLavjCXviqxT9S1MgbjMNHr6Sp5'
checking_account: &checking_account '13UVJyLnbVp9x5XDyJv8g8r3UddNwBrdaH7AADCmw9XQWvYW'


tests:
- name: Teleport assets from Relay Chain to Collectives Parachain successful.
before:
Expand Down Expand Up @@ -131,7 +130,7 @@ tests:
- name: messageQueue.Processed
chain: *relay_chain
threshold: *weight_threshold
result: { origin: { Ump: { Para: '1,001' } }, weightUsed: { refTime: '4,000,000,000', proofSize: '0' }, success: true }
result: { origin: { Ump: { Para: *cp_id } }, weightUsed: { refTime: '4,000,000,000', proofSize: '0' }, success: true }
- queries:
balance_rc_alice_3:
chain: *relay_chain
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
settings:
chains:
relay_chain: &relay_chain
wsPort: 9700
collectives_parachain: &collectives_parachain
wsPort: 9710
paraId: &cp_id 1001
assethub_parachain: &assethub_parachain
wsPort: 9810
paraId: &sp_id 1000
variables:
chains:
accounts:
alice_signer: &alice_signer //Alice
hrmp:
proposed_max_capacity: &hrmp_proposed_max_capacity 8
proposed_max_message_size: &hrmp_proposed_max_message_size 8192
tests:
- name: HRMP
describes:
- name: Force Open HRMP Channel From Collectives Parachain → AssetHub Parachain
its:
- name: Alice calls hrmp.forceOpenHrmpChannel
actions:
- extrinsics:
- chain: *relay_chain
signer: *alice_signer
sudo: true
pallet: hrmp
call: forceOpenHrmpChannel
args: [
*cp_id, # sender
*sp_id, # recipient
*hrmp_proposed_max_capacity, # proposedMaxCapacity
*hrmp_proposed_max_message_size # proposedMaxMessageSize
]
events:
- name: hrmp.HrmpChannelForceOpened
result: [*cp_id, *sp_id, *hrmp_proposed_max_capacity, *hrmp_proposed_max_message_size]
- name: Force Open HRMP Channel From AssetHub Parachain → Collectives Parachain
its:
- name: Alice calls hrmp.forceOpenHrmpChannel
actions:
- extrinsics:
- chain: *relay_chain
signer: *alice_signer
sudo: true
pallet: hrmp
call: forceOpenHrmpChannel
args: [
*sp_id, # sender
*cp_id, # recipient
*hrmp_proposed_max_capacity, # proposedMaxCapacity
*hrmp_proposed_max_message_size # proposedMaxMessageSize
]
events:
- name: hrmp.HrmpChannelForceOpened
result: [*sp_id, *cp_id, *hrmp_proposed_max_capacity, *hrmp_proposed_max_message_size]
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ tests:
- name: sudo.Sudid
result: { sudoResult: Ok }
- name: xcmPallet.Sent
result: { origin: { parents: 0, interior: Here }, destination: { parents: 0, interior: { X1: { Parachain: *coll_para_id }}}}
- name: alliance.MembersInitialized
chain: *collectives_parachain
- name: dmpQueue.ExecutedDownward
Expand Down Expand Up @@ -154,6 +155,7 @@ tests:
- name: sudo.Sudid
result: { sudoResult: Ok }
- name: xcmPallet.Sent
result: { origin: { parents: 0, interior: Here }, destination: { parents: 0, interior: { X1: { Parachain: *coll_para_id }}}}
- name: dmpQueue.ExecutedDownward
chain: *collectives_parachain
threshold: *weight_threshold
Expand Down Expand Up @@ -198,6 +200,7 @@ tests:
- name: sudo.Sudid
result: { sudoResult: Ok }
- name: xcmPallet.Sent
result: { origin: { parents: 0, interior: Here }, destination: { parents: 0, interior: { X1: { Parachain: *coll_para_id }}}}
- name: alliance.AllianceDisbanded
chain: *collectives_parachain
result: { fellowMembers: 6, allyMembers: 1, unreserved: 0 }
Expand Down Expand Up @@ -244,6 +247,7 @@ tests:
- name: sudo.Sudid
result: { sudoResult: Ok }
- name: xcmPallet.Sent
result: { origin: { parents: 0, interior: Here }, destination: { parents: 0, interior: { X1: { Parachain: *coll_para_id }}}}
- name: alliance.MembersInitialized
chain: *collectives_parachain
- name: dmpQueue.ExecutedDownward
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@ tests:
events:
- name: xcmPallet.Attempted
threshold: *weight_threshold
result: [{ Complete: { refTime: '3,000,000,000', proofSize: 0 }}]
result: {
outcome: { Complete: { refTime: '3,000,000,000', proofSize: 0 }}
}
- name: balances.Deposit
chain: *collectives_parachain
result: { who: *acc_alice_ss58 }
result: { who: *acc_alice_ss58 }
- name: dmpQueue.ExecutedDownward
chain: *collectives_parachain
threshold: *weight_threshold
Expand Down Expand Up @@ -78,9 +80,9 @@ tests:
events:
- name: balances.Reserved
chain: *collectives_parachain
result: { who: *acc_alice_ss58, amount: '10,000,000,000,000' }
result: { who: *acc_alice_ss58, amount: 10000000000000 }
- name: alliance.NewAllyJoined
result: { ally: *acc_alice_ss58 }
result: {ally: *acc_alice_ss58, reserved: 10000000000000 }
- queries:
balance_cp_alice_after:
chain: *collectives_parachain
Expand Down Expand Up @@ -139,15 +141,18 @@ tests:
- name: sudo.Sudid
result: { sudoResult: Ok }
- name: xcmPallet.Sent
result: { origin: { parents: 0, interior: Here }, destination: { parents: 0, interior: { X1: { Parachain: *cp_id }}}}
- name: alliance.MemberKicked
chain: *collectives_parachain
result: { member: *acc_alice_ss58 }
result: { member: *acc_alice_ss58, slashed: 10000000000000 }
- name: dmpQueue.ExecutedDownward
chain: *collectives_parachain
threshold: *weight_threshold
result: {
outcome: { Complete: { refTime: '4,000,000,000', proofSize: '1,000,000' }}
}
- name: messageQueue.Processed
result: { origin: { Ump: { Para: *cp_id }}, success: true }

- queries:
balance_rc_treasury_after:
Expand Down
Loading

0 comments on commit a74ffe6

Please sign in to comment.