Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test cases to Cumulus which simulates real e2e message delivery #2078

Closed
3 tasks
bkontur opened this issue Apr 26, 2023 · 2 comments · Fixed by paritytech/cumulus#2578
Closed
3 tasks
Assignees

Comments

@bkontur
Copy link
Contributor

bkontur commented Apr 26, 2023

Pseudocode:

fn bridge_hub_rococo_dispatch_works() {
	<initialize-externalities>::execute_with(|| {	
		let bridge_message = BridgeMessage {
			universal_dest: V3(X2(GlobalConsensus(...), Parachain(1234))),
			xcm: Xcm(...)
		};

		assert_ok!(pallet_bridge_grandpa::Pallet::<Runtime, BridgeGrandpaWococoInstance>::submit_finality_proof(...));
		assert_ok!(pallet_bridge_parachains::Pallet::<Runtime, BridgeParachainWococoInstance>::submit_parachain_heads(...));
		assert_ok!(pallet_bridge_messages::Pallet::<Runtime, WithBridgeHubWococoMessagesInstance>::receive_messages_proof(..., bridge_message, ...));
		
		// get message from `XcmpQueue::take_outbound_messages` for 1234
		let dispatched_xcm = RuntimeHelper::<HrmpChannelSource>::take_xcm(1234);
		asset_eq!(xcm, dispatched_xcm);
	})
}
  • I will prepare everything around, but will need help with submit_finality_proof/submit_parachain_heads/receive_messages_proof proofs (lots of this helper code is in benchmarking stuff e.g.: prepare_messages_storage_proof ...)
  • add test for DeliveryConfirmationPayments when receive_messages_delivery_proof
  • check economics in tests (hit delivery rewards constants)
    pub storage DeliveryRewardInBalance: u64 = 1_000_000;
    pub storage RequiredStakeForStakeAndSlash: Balance = 1_000_000;
    
@acatangiu
Copy link
Collaborator

AFAICT, receive_single_message_proof_with_dispatch benchmark implements and verifies this e2e message delivery:

It doesn't explicitly verify that the final XcmpQueue::take_outbound_messages() equals the original xcm payload (vec![ClearOrigin; n]), but we can enhance it to do that too as a nice to have.

@acatangiu
Copy link
Collaborator

acatangiu commented May 3, 2023

But above only verifies incoming (over bridge) message (xcm) dispatch, not complete flow. We want a runtime test that fully verifies side-effects of a relayer submitting batch(grandpa_finality, parachain_heads, message_proof), including relayer slash/reward.

@acatangiu acatangiu self-assigned this May 3, 2023
svyatonik pushed a commit that referenced this issue Jul 17, 2023
* Minor update to Readme - Statemint section

Common good -> System

* update parchains readme

* Update parachains/README.md

Co-authored-by: Bastian Köcher <[email protected]>

Co-authored-by: joe petrowski <[email protected]>
Co-authored-by: Bastian Köcher <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants