e2e tests for Gov2 (#2944)

* Fellowship e2e tests

* fixes

* fixe wrong result

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

* Apply suggestions from code review

Co-authored-by: Squirrel <gilescope@gmail.com>

* fixes

---------

Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
Co-authored-by: Squirrel <gilescope@gmail.com>
This commit is contained in:
Muharem Ismailov
2023-08-01 11:17:47 +02:00
committed by GitHub
parent 082d9e1d6e
commit a15f573e7d
10 changed files with 798 additions and 11 deletions
@@ -6,6 +6,9 @@ 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] }
@@ -13,7 +16,7 @@ settings:
accounts:
alice_signer: &alice_signer //Alice
decodedCalls:
cp_force_xcm_version:
ap_force_xcm_version:
chain: *collectives_parachain
pallet: polkadotXcm
call: forceXcmVersion
@@ -64,7 +67,7 @@ tests:
v3: [ # message
{
UnpaidExecution: {
weightLimit: {
weightLimit: {
limited: {
refTime: 2200000000, # 2_200_000_000
proofSize: 200000, # 200_000
@@ -79,7 +82,7 @@ tests:
refTime: 200000000, # 200_000_000
proofSize: 0,
},
call: $cp_force_xcm_version
call: $ap_force_xcm_version
}
}
]
@@ -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: {} } }
@@ -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:
@@ -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
@@ -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]
@@ -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
@@ -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
@@ -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 }
@@ -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
@@ -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
@@ -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
@@ -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:
@@ -0,0 +1,149 @@
---
settings:
chains:
relay_chain: &relay_chain
wsPort: 9700
assethub_parachain: &assethub_parachain
wsPort: 9810
paraId: &ap_id 1000
variables:
proposal_index: &proposal_index 0
chains:
accounts:
alice_signer: &alice_signer //Alice
bob_signer: &bob_signer //Bob
decodedCalls:
set_candidates_ap:
chain: *assethub_parachain
encode: true
pallet: collatorSelection
call: setDesiredCandidates
args: [
3
]
send_set_candidates_rc:
chain: *relay_chain
encode: false
pallet: xcmPallet
call: send
args: [
{ v3: { parents: 0, interior: { x1: { parachain: *ap_id }}}}, # destination
{
v3: [ #message
{
UnpaidExecution: {
weightLimit: Unlimited
}
},
{
Transact: {
originKind: Xcm,
requireWeightAtMost: {
refTime: 200000000, # 200_000_000
proofSize: 100000, # 100_000
},
call: $set_candidates_ap
}
}
]
}
]
tests:
- name: OpenGov
describes:
- name: Set desired candidates on AssetHub from Relay Chain OpenGov Staking track
its:
- name: Note preimage from xcm send set_desired_candidates call
actions:
- extrinsics:
- chain: *relay_chain
signer: *alice_signer
pallet: preimage
call: notePreimage
args: [
$send_set_candidates_rc
]
events:
- name: preimage.Noted
result: {hash_: $send_set_candidates_rc.hash }
- name: Submit a proposal to set desired candidates
actions:
- extrinsics:
- chain: *relay_chain
signer: *alice_signer
pallet: referenda
call: submit
args: [
{
"Origins": "StakingAdmin",
},
{
"Lookup": {
"hash_": $send_set_candidates_rc.hash,
"len": $send_set_candidates_rc.len,
},
},
{
"After": 1,
},
]
events:
- name: referenda.Submitted
result: {
index: *proposal_index,
proposal: { Lookup: { hash_: $send_set_candidates_rc.hash, len: $send_set_candidates_rc.len }}
}
- name: Alice Vote Aye
actions:
- extrinsics:
- chain: *relay_chain
signer: *alice_signer
pallet: convictionVoting
call: vote
args: [
*proposal_index,
{
"Standard": {
"vote": {
"aye": true,
"conviction": "Locked1x",
},
"balance": 200000000000000,
}
},
] # TODO no event to catch https://github.com/paritytech/substrate/issues/14687
- name: Bob Vote Aye
actions:
- extrinsics:
- chain: *relay_chain
signer: *bob_signer
pallet: convictionVoting
call: vote
args: [
*proposal_index,
{
"Standard": {
"vote": {
"aye": true,
"conviction": "Locked1x",
},
"balance": 200000000000000,
}
},
] # TODO no event to catch https://github.com/paritytech/substrate/issues/14687
- name: Submit the decision deposit
actions:
- extrinsics:
- chain: *relay_chain
signer: *alice_signer
pallet: referenda
call: placeDecisionDeposit
args: [
*proposal_index,
]
events:
- name: referenda.DecisionDepositPlaced
result: { index: *proposal_index }
- name: collatorSelection.NewDesiredCandidates
chain: *assethub_parachain
result: { desiredCandidates: 3 }
@@ -0,0 +1,209 @@
---
settings:
chains:
relay_chain: &relay_chain
wsPort: 9700
collectives_parachain: &collectives_parachain
wsPort: 9710
paraId: &cp_id 1001
variables:
proposal_index: &proposal_index 1
chains:
accounts:
alice_signer: &alice_signer //Alice
bob_signer: &bob_signer //Bob
alice_account32: &acc_alice_acc32 '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d'
alice_ss58: &acc_alice_ss58 '15oF4uVJwmo4TdGW7VfQxNLavjCXviqxT9S1MgbjMNHr6Sp5'
decodedCalls:
fellowship_induct_alice_cp:
chain: *collectives_parachain
encode: true
pallet: fellowshipCore
call: induct
args: [
*acc_alice_acc32
]
fellowship_promote_1_alice_cp:
chain: *collectives_parachain
encode: true
pallet: fellowshipCore
call: promote
args: [
*acc_alice_acc32,
1
]
fellowship_promote_2_alice_cp:
chain: *collectives_parachain
encode: true
pallet: fellowshipCore
call: promote
args: [
*acc_alice_acc32,
2
]
fellowship_promote_3_alice_cp:
chain: *collectives_parachain
encode: true
pallet: fellowshipCore
call: promote
args: [
*acc_alice_acc32,
3
]
send_init_fellowship_rc:
chain: *relay_chain
encode: false
pallet: xcmPallet
call: send
args: [
{ v3: { parents: 0, interior: { x1: { parachain: *cp_id }}}}, # destination
{
v3: [ #message
{
UnpaidExecution: {
weightLimit: Unlimited
}
},
{ # since batch_all not yet allowed over xcm, we have to send multiple `Transact`.
Transact: {
originKind: Xcm,
requireWeightAtMost: {
refTime: 1500000000, # 1_500_000_000
proofSize: 10000, # 10_000
},
call: $fellowship_induct_alice_cp
}
},
{
Transact: {
originKind: Xcm,
requireWeightAtMost: {
refTime: 1500000000, # 1_500_000_000
proofSize: 10000, # 10_000
},
call: $fellowship_promote_1_alice_cp
}
},
{
Transact: {
originKind: Xcm,
requireWeightAtMost: {
refTime: 1500000000, # 1_500_000_000
proofSize: 10000, # 10_000
},
call: $fellowship_promote_2_alice_cp
}
},
{
Transact: {
originKind: Xcm,
requireWeightAtMost: {
refTime: 1500000000, # 1_500_000_000
proofSize: 10000, # 10_000
},
call: $fellowship_promote_3_alice_cp
}
}
]
}
]
tests:
- name: Fellowship
describes:
- name: Init the Fellowship
its:
- name: Note preimage from init fellowship call
actions:
- extrinsics:
- chain: *relay_chain
signer: *alice_signer
pallet: preimage
call: notePreimage
args: [
$send_init_fellowship_rc
]
events:
- name: preimage.Noted
result: { hash_: $send_init_fellowship_rc.hash }
- name: Submit a proposal to init the Fellowship
actions:
- extrinsics:
- chain: *relay_chain
signer: *alice_signer
pallet: referenda
call: submit
args: [
{
"Origins": "FellowshipAdmin",
},
{
"Lookup": {
"hash_": $send_init_fellowship_rc.hash,
"len": $send_init_fellowship_rc.len,
},
},
{
"After": 1,
},
]
events:
- name: referenda.Submitted
result: {
index: *proposal_index,
proposal: { Lookup: { hash_: $send_init_fellowship_rc.hash, len: $send_init_fellowship_rc.len }}
}
- name: Alice Vote Aye
actions:
- extrinsics:
- chain: *relay_chain
signer: *alice_signer
pallet: convictionVoting
call: vote
args: [
*proposal_index,
{
"Standard": {
"vote": {
"aye": true,
"conviction": "Locked1x",
},
"balance": 200000000000000,
}
},
] # TODO no Aye event to catch https://github.com/paritytech/substrate/issues/14687
- name: Bob Vote Aye
actions:
- extrinsics:
- chain: *relay_chain
signer: *bob_signer
pallet: convictionVoting
call: vote
args: [
*proposal_index,
{
"Standard": {
"vote": {
"aye": true,
"conviction": "Locked1x",
},
"balance": 200000000000000,
}
},
] # TODO no Aye event to catch https://github.com/paritytech/substrate/issues/14687
- name: Submit the decision deposit
actions:
- extrinsics:
- chain: *relay_chain
signer: *alice_signer
pallet: referenda
call: placeDecisionDeposit
args: [
*proposal_index,
]
events:
- name: referenda.DecisionDepositPlaced
result: { index: *proposal_index }
- name: fellowshipCollective.MemberAdded
chain: *collectives_parachain
result: { who: *acc_alice_ss58 }
@@ -0,0 +1,146 @@
---
settings:
chains:
relay_chain: &relay_chain
wsPort: 9700
collectives_parachain: &collectives_parachain
wsPort: 9710
paraId: &cp_id 1001
variables:
fellows_proposal_index: &fellows_proposal_index 0
chains:
accounts:
alice_signer: &alice_signer //Alice
decodedCalls:
remark_rc:
chain: *relay_chain
encode: false
pallet: system
call: remark
args: [
"0x10"
]
whitelist_remark_rc:
chain: *relay_chain
encode: true
pallet: whitelist
call: whitelistCall
args: [
$remark_rc.hash
]
send_whitelist_remark_cp:
chain: *collectives_parachain
encode: false
pallet: polkadotXcm
call: send
args: [
{ v3: { parents: 1, interior: { here: true }}}, # destination
{
v3: [ #message
{
UnpaidExecution: {
weightLimit: Unlimited
}
},
{
Transact: {
originKind: Xcm,
requireWeightAtMost: {
refTime: 500000000, # 500_000_000
proofSize: 20000, # 20_000
},
call: $whitelist_remark_rc
}
}
]
}
]
tests:
- name: Fellowship
describes:
- name: The Fellowship white list the call
its:
- name: Note preimage from the whitelist call on the Relay Chain
actions:
- extrinsics:
- chain: *relay_chain
signer: *alice_signer
pallet: preimage
call: notePreimage
args: [
$remark_rc
]
events:
- name: preimage.Noted
result: { hash_: $remark_rc.hash }
- name: Note preimage from the xcm send call to white list the call above
actions:
- extrinsics:
- chain: *collectives_parachain
signer: *alice_signer
pallet: preimage
call: notePreimage
args: [
$send_whitelist_remark_cp,
]
events:
- name: preimage.Noted
result: { hash_: $send_whitelist_remark_cp.hash }
- name: Submit a proposal to while list the call
actions:
- extrinsics:
- chain: *collectives_parachain
signer: *alice_signer
pallet: fellowshipReferenda
call: submit
args: [
{
"FellowshipOrigins": "Fellows",
},
{
"Lookup": {
"hash_": $send_whitelist_remark_cp.hash,
"len": $send_whitelist_remark_cp.len,
},
},
{
"After": 1,
},
]
events:
- name: fellowshipReferenda.Submitted
result: {
index: *fellows_proposal_index,
proposal: { Lookup: { hash_: $send_whitelist_remark_cp.hash, len: $send_whitelist_remark_cp.len}}
}
- name: Vote Aye
actions:
- extrinsics:
- chain: *collectives_parachain
signer: *alice_signer
pallet: fellowshipCollective
call: vote
args: [
*fellows_proposal_index,
true,
]
events:
- name: fellowshipCollective.Voted
result: { poll: *fellows_proposal_index, vote: { Aye: 1 } }
- name: Submit the decision deposit
actions:
- extrinsics:
- chain: *collectives_parachain
signer: *alice_signer
pallet: fellowshipReferenda
call: placeDecisionDeposit
args: [
*fellows_proposal_index,
]
events:
- name: fellowshipReferenda.DecisionDepositPlaced
result: {index: *fellows_proposal_index}
- name: whitelist.CallWhitelisted
chain: *relay_chain
result: { callHash: $remark_rc.hash }
@@ -0,0 +1,126 @@
---
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: &ap_id 1000
variables:
fellows_proposal_index: &fellows_proposal_index 1
chains:
accounts:
alice_signer: &alice_signer //Alice
decodedCalls:
xcmp_resume_execution_ap:
chain: *assethub_parachain
encode: true
pallet: xcmpQueue
call: resumeXcmExecution
args: []
send_xcmp_resume_execution_cp:
chain: *collectives_parachain
encode: false
pallet: polkadotXcm
call: send
args: [
{ v3: { parents: 1, interior: { x1: { parachain: *ap_id }}}}, # destination
{
v3: [ #message
{
UnpaidExecution: {
weightLimit: Unlimited
}
},
{
Transact: {
originKind: Xcm,
requireWeightAtMost: {
refTime: 300000000, # 300_000_000
proofSize: 10000, # 10_000
},
call: $xcmp_resume_execution_ap
}
}
]
}
]
tests:
- name: Fellowship
describes:
- name: The Fellowship resume xcm execution for the xcmp queue on AssetHub
its:
- name: Note preimage from the xcm send call to suspend_xcm_execution
actions:
- extrinsics:
- chain: *collectives_parachain
signer: *alice_signer
pallet: preimage
call: notePreimage
args: [
$send_xcmp_resume_execution_cp
]
events:
- name: preimage.Noted
result: {hash_: $send_xcmp_resume_execution_cp.hash }
- name: Submit a proposal to resume xcm execution on AssetHub
actions:
- extrinsics:
- chain: *collectives_parachain
signer: *alice_signer
pallet: fellowshipReferenda
call: submit
args: [
{
"FellowshipOrigins": "Fellows",
},
{
"Lookup": {
"hash_": $send_xcmp_resume_execution_cp.hash,
"len": $send_xcmp_resume_execution_cp.len,
},
},
{
"After": 1,
},
]
events:
- name: fellowshipReferenda.Submitted
result: {
index: 1,
proposal: {Lookup: {hash_: $send_xcmp_resume_execution_cp.hash, len: $send_xcmp_resume_execution_cp.len}}
}
- name: Vote Aye
actions:
- extrinsics:
- chain: *collectives_parachain
signer: *alice_signer
pallet: fellowshipCollective
call: vote
args: [
*fellows_proposal_index,
true,
]
events:
- name: fellowshipCollective.Voted
result: { poll: *fellows_proposal_index, vote: { Aye: 1 } }
- name: Submit the decision deposit
actions:
- extrinsics:
- chain: *collectives_parachain
signer: *alice_signer
pallet: fellowshipReferenda
call: placeDecisionDeposit
args: [
*fellows_proposal_index,
]
events:
- name: fellowshipReferenda.DecisionDepositPlaced
result: {index: *fellows_proposal_index}
- name: xcmpQueue.Success
chain: *assethub_parachain