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

Commit

Permalink
Update & revamp e2e tests (#2614)
Browse files Browse the repository at this point in the history
* update & revamp e2e tests

* add seeds as comments

* ".git/.scripts/commands/fmt/fmt.sh"

---------

Co-authored-by: command-bot <>
  • Loading branch information
NachoPal authored May 24, 2023
1 parent 06025a6 commit 888b543
Show file tree
Hide file tree
Showing 21 changed files with 392 additions and 532 deletions.
21 changes: 10 additions & 11 deletions client/network/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,13 @@ impl BlockAnnounceData {
///
/// This will not check the signature, for this you should use [`BlockAnnounceData::check_signature`].
fn validate(&self, encoded_header: Vec<u8>) -> Result<(), Validation> {
let candidate_hash = if let CompactStatement::Seconded(h) =
self.statement.unchecked_payload()
{
h
} else {
tracing::debug!(target: LOG_TARGET, "`CompactStatement` isn't the candidate variant!",);
return Err(Validation::Failure { disconnect: true })
};
let candidate_hash =
if let CompactStatement::Seconded(h) = self.statement.unchecked_payload() {
h
} else {
tracing::debug!(target: LOG_TARGET, "`CompactStatement` isn't the candidate variant!",);
return Err(Validation::Failure { disconnect: true })
};

if *candidate_hash != self.receipt.hash() {
tracing::debug!(
Expand Down Expand Up @@ -334,9 +333,9 @@ where
let relay_chain_is_syncing = relay_chain_interface
.is_major_syncing()
.await
.map_err(|e| {
tracing::error!(target: LOG_TARGET, "Unable to determine sync status. {}", e)
})
.map_err(
|e| tracing::error!(target: LOG_TARGET, "Unable to determine sync status. {}", e),
)
.unwrap_or(false);

if relay_chain_is_syncing {
Expand Down
51 changes: 21 additions & 30 deletions parachains/integration-tests/e2e/assets/statemine/0_xcm/0_init.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ settings:
paraId: &pp_id 2000
variables:
common:
xcm_version: &xcm_version '3'
xcm_version: &xcm_version 3
require_weight_at_most: &weight_at_most {refTime: 1000000000, proofSize: 200000}
weight_threshold: &weight_threshold { refTime: [10, 10], proofSize: [10, 10] }
chains:
relay_chain:
signer: &rc_signer //Alice
Expand Down Expand Up @@ -56,13 +57,9 @@ tests:
]
events:
- name: sudo.Sudid
attributes:
- type: Result<Null, SpRuntimeDispatchError>
value: Ok
result: { sudoResult: Ok }
- name: xcmPallet.SupportedVersionChanged
attributes:
- type: u32
value: *xcm_version
result: [{ parents: 0, interior: { X1: { Parachain: *ap_id }}}, *xcm_version ]
- extrinsics: # Relay Chain sets supported version for Penpal Parachain
- chain: *relay_chain
sudo: true
Expand All @@ -82,13 +79,9 @@ tests:
]
events:
- name: sudo.Sudid
attributes:
- type: Result<Null, SpRuntimeDispatchError>
value: Ok
result: { sudoResult: Ok }
- name: xcmPallet.SupportedVersionChanged
attributes:
- type: u32
value: *xcm_version
result: [{ parents: 0, interior: { X1: { Parachain: *pp_id }}}, *xcm_version ]
- extrinsics: # Asset Parachain sets supported version for Relay Chain through it
- chain: *relay_chain
signer: *rc_signer
Expand All @@ -101,11 +94,11 @@ tests:
v3: [ #message
{
UnpaidExecution: {
weightLimit: {
limited: {
refTime: 2200000000,
proofSize: 200000
}
weightLimit: {
limited: {
refTime: 2200000000,
proofSize: 200000
}
}
}
},
Expand All @@ -121,15 +114,17 @@ tests:
]
events:
- name: sudo.Sudid
attributes:
- type: Result<Null, SpRuntimeDispatchError>
value: Ok
result: { sudoResult: Ok }
- name: xcmPallet.Sent
- name: dmpQueue.ExecutedDownward
chain: *assets_parachain
threshold: *weight_threshold
result: {
outcome: { Complete: { refTime: '1,019,210,000', proofSize: '200,000' }}
}
- name: polkadotXcm.SupportedVersionChanged
chain: *assets_parachain
attributes:
- type: u32
value: *xcm_version
result: [{ parents: 1, interior: Here }, *xcm_version ]
- extrinsics: # Penpal Parachain sets supported version for Relay Chain
- chain: *penpal_parachain
signer: *pp_signer
Expand All @@ -145,10 +140,6 @@ tests:
]
events:
- name: sudo.Sudid
attributes:
- type: Result<Null, SpRuntimeDispatchError>
value: Ok
result: { sudoResult: Ok }
- name: polkadotXcm.SupportedVersionChanged
attributes:
- type: u32
value: *xcm_version
result: [{ parents: 1, interior: Here }, *xcm_version ]
78 changes: 39 additions & 39 deletions parachains/integration-tests/e2e/assets/statemine/0_xcm/1_dmp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,23 @@ settings:
wsPort: 9910
paraId: &ap_id 1000
variables:
relay_chain:
signer: &rc_signer //Alice
wallet: &rc_wallet HNZata7iMYWmk5RvZRTiAsSDhV8366zq2YGb3tLH5Upf74F
assets_parachain_destination: &ap_dest { v3: { parents: 0, interior: { x1: { parachain: *ap_id }}}}
assets_parachain_account: &ap_acc '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d'
assets_parachain_beneficiary: &ap_benf {v3: { parents: 0, interior: { x1: { accountId32: { id: *ap_acc }}}}}
ksm: &rc_ksm { concrete: { parents: 0, interior: { here: true }}}
amount: &amount 1000000000000
ksm_fungible: &rc_ksm_fungible { id: *rc_ksm, fun: { fungible: *amount }}
require_weight_at_most: &rc_weight_at_most {refTime: 1000000000, proofSize: 200000}
assets_parachain_account:
wallet: &ap_wallet HNZata7iMYWmk5RvZRTiAsSDhV8366zq2YGb3tLH5Upf74F
asset_id: &asset_id 1
asset_min_balance: &asset_ed 1000
common:
weight_threshold: &weight_threshold { refTime: [10, 10], proofSize: [10, 10] }
chains:
relay_chain:
signer: &rc_signer //Alice
wallet: &rc_wallet HNZata7iMYWmk5RvZRTiAsSDhV8366zq2YGb3tLH5Upf74F
assets_parachain_destination: &ap_dest { v3: { parents: 0, interior: { x1: { parachain: *ap_id }}}}
assets_parachain_account: &ap_acc '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d'
assets_parachain_beneficiary: &ap_benf { v3: { parents: 0, interior: { x1: { accountId32: { id: *ap_acc }}}}}
ksm: &rc_ksm { concrete: { parents: 0, interior: { here: true }}}
amount: &amount 1000000000000
ksm_fungible: &rc_ksm_fungible { id: *rc_ksm, fun: { fungible: *amount }}
require_weight_at_most: &rc_weight_at_most { refTime: 1000000000, proofSize: 200000 }
assets_parachain_account:
wallet: &ap_wallet HNZata7iMYWmk5RvZRTiAsSDhV8366zq2YGb3tLH5Upf74F
asset_id: &asset_id 1
asset_min_balance: &asset_ed 1000
decodedCalls:
force_create_asset:
chain: *assets_parachain
Expand Down Expand Up @@ -69,16 +72,14 @@ tests:
]
events:
- name: xcmPallet.Attempted
attributes:
- type: XcmV3TraitsOutcome
xcmOutcome: Complete
threshold: *weight_threshold
result: [{ Complete: { refTime: '764,772,000', proofSize: 0 }}]
- name: dmpQueue.ExecutedDownward
chain: *assets_parachain
attributes:
- type: XcmV3TraitsOutcome
xcmOutcome: Complete
threshold: [10, 10]
value: {"refTime":"162,379,000","proofSize":"0"}
threshold: *weight_threshold
result: {
outcome: { Complete: { refTime: '166,944,000', proofSize: 0 }}
}
- queries:
balance_rc_sender_after:
chain: *relay_chain
Expand Down Expand Up @@ -151,11 +152,10 @@ tests:
- name: xcmPallet.Sent
- name: dmpQueue.ExecutedDownward
chain: *assets_parachain
attributes:
- type: XcmV3TraitsOutcome
xcmOutcome: Complete
threshold: [10, 10]
value: {"refTime":"1,014,103,000","proofSize":"200,000"}
threshold: *weight_threshold
result: {
outcome: { Complete: { refTime: '1,014,103,000', proofSize: '200,000' }}
}
- queries:
forced_created_asset:
chain: *assets_parachain
Expand Down Expand Up @@ -196,9 +196,7 @@ tests:
]
events:
- name: system.ExtrinsicFailed
attributes:
- type: SpRuntimeDispatchError
value: BadOrigin
result: { dispatchError: BadOrigin }

- name: xcmPallet.limitedReserveTransferAssets
before: *before_get_balances
Expand All @@ -219,17 +217,19 @@ tests:
]
events:
- name: xcmPallet.Attempted
attributes:
- type: XcmV3TraitsOutcome
xcmOutcome: Complete
threshold: [10, 10]
value: {"refTime":"750,645,000","proofSize":"0"}
threshold: *weight_threshold
result: [{ Complete: { refTime: '750,645,000', proofSize: 0 }}]
- name: dmpQueue.ExecutedDownward
chain: *assets_parachain
attributes:
- type: XcmV3TraitsOutcome
xcmOutcome: Incomplete
value: [{"refTime":"1,000,000,000","proofSize":"0"},"UntrustedReserveLocation"]
threshold: *weight_threshold
result: {
outcome: {
Incomplete: [
{ refTime: '1,000,000,000', proofSize: 0 },
UntrustedReserveLocation
]
}
}
- queries:
balance_rc_sender_after:
chain: *relay_chain
Expand Down
73 changes: 30 additions & 43 deletions parachains/integration-tests/e2e/assets/statemine/0_xcm/2_ump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,24 @@ settings:
common:
amount: &amount 1000000000000
require_weight_at_most: &weight_at_most {refTime: 1000000000, proofSize: 0}
relay_chain:
signer: &rc_signer //Alice
wallet: &rc_wallet HNZata7iMYWmk5RvZRTiAsSDhV8366zq2YGb3tLH5Upf74F #Alice
assets_parachain_destination: &ap_dest { v3: { 0, interior: { x1: { parachain: *ap_id }}}}
assets_parachain_account: &ap_acc '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d'
assets_parachain_beneficiary: &ap_benf {v3: { parents: 0, interior: { x1: { accountId32: { id: *ap_acc }}}}}
ksm: &rc_ksm { concrete: { 0, interior: { here: true }}}
ksm_fungible: &rc_ksm_fungible { id: *rc_ksm, fun: { fungible: *amount }}
assets_parachain_account:
signer: &ap_signer //Alice
wallet: &ap_wallet HNZata7iMYWmk5RvZRTiAsSDhV8366zq2YGb3tLH5Upf74F
relay_chain_destination: &rc_dest { v3: { parents: 1, interior: { here: true }}}
assets_parachain_account: &rc_acc '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d' #Alice
relay_chain_beneficiary: &rc_benf {v3: { parents: 0, interior: { x1: { accountId32: { id: *rc_acc }}}}}
ksm: &ap_ksm { concrete: { parents: 1, interior: { here: true }}}
ksm_fungible: &ap_ksm_fungible { id: *ap_ksm, fun: { fungible: *amount }}
weight_threshold: &weight_threshold { refTime: [10, 10], proofSize: [10, 10] }
chains:
relay_chain:
signer: &rc_signer //Alice
wallet: &rc_wallet HNZata7iMYWmk5RvZRTiAsSDhV8366zq2YGb3tLH5Upf74F #Alice
assets_parachain_destination: &ap_dest { v3: { 0, interior: { x1: { parachain: *ap_id }}}}
assets_parachain_account: &ap_acc '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d'
assets_parachain_beneficiary: &ap_benf {v3: { parents: 0, interior: { x1: { accountId32: { id: *ap_acc }}}}}
ksm: &rc_ksm { concrete: { 0, interior: { here: true }}}
ksm_fungible: &rc_ksm_fungible { id: *rc_ksm, fun: { fungible: *amount }}
assets_parachain_account:
signer: &ap_signer //Alice
wallet: &ap_wallet HNZata7iMYWmk5RvZRTiAsSDhV8366zq2YGb3tLH5Upf74F
relay_chain_destination: &rc_dest { v3: { parents: 1, interior: { here: true }}}
assets_parachain_account: &rc_acc '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d' #Alice
relay_chain_beneficiary: &rc_benf {v3: { parents: 0, interior: { x1: { accountId32: { id: *rc_acc }}}}}
ksm: &ap_ksm { concrete: { parents: 1, interior: { here: true }}}
ksm_fungible: &ap_ksm_fungible { id: *ap_ksm, fun: { fungible: *amount }}
decodedCalls:
system_remark:
chain: *relay_chain
Expand Down Expand Up @@ -54,18 +56,14 @@ tests:
]
events:
- name: xcmPallet.Attempted
attributes:
- type: XcmV3TraitsOutcome
xcmOutcome: Complete
threshold: [10, 10]
value: {"refTime":"761,173,000","proofSize":"0"}
threshold: *weight_threshold
result: [{ Complete: { refTime: '761,173,000', proofSize: 0 }}]
- name: dmpQueue.ExecutedDownward
chain: *assets_parachain
attributes:
- type: XcmV3TraitsOutcome
xcmOutcome: Complete
threshold: [10, 10]
value: {"refTime":"162,379,000","proofSize":"0"}
threshold: *weight_threshold
result: {
outcome: { Complete: { refTime: '166,944,000', proofSize: 0 }}
}

- name: Get the balances of the Assets Parachain's sender & Relay Chain's receiver
actions:
Expand Down Expand Up @@ -97,18 +95,12 @@ tests:
]
events:
- name: polkadotXcm.Attempted
attributes:
- type: XcmV3TraitsOutcome
xcmOutcome: Complete
threshold: [10, 10]
value: {"refTime":"539,494,000","proofSize":"7,133"}
threshold: *weight_threshold
result: [{ Complete: { refTime: '539,494,000', proofSize: '7,133' }}]
- name: ump.ExecutedUpward
chain: *relay_chain
attributes:
- type: XcmV3TraitsOutcome
xcmOutcome: Complete
threshold: [10, 10]
value: {"refTime":"298,716,000","proofSize":"0"}
threshold: *weight_threshold
result: [{ Complete: { refTime: '298,716,000', proofSize: 0 }}]
- queries:
balance_ap_sender_after:
chain: *assets_parachain
Expand Down Expand Up @@ -178,9 +170,7 @@ tests:
]
events:
- name: system.ExtrinsicFailed
attributes:
- type: SpRuntimeDispatchError
value: BadOrigin
result: { dispatchError: BadOrigin }

- name: polkadotXcm.limitedReserveTransferAssets
its:
Expand All @@ -200,7 +190,4 @@ tests:
]
events:
- name: polkadotXcm.Attempted
attributes:
- type: XcmV3TraitsOutcome
xcmOutcome: Error
value: Barrier
result: [{ Error: Barrier }]
Loading

0 comments on commit 888b543

Please sign in to comment.