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
@@ -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