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

[BridgeHub] Add and run Basic unit tests #1672

Closed
2 tasks
Tracked by #1706
EmmanuellNorbertTulbure opened this issue Dec 1, 2022 · 12 comments
Closed
2 tasks
Tracked by #1706

[BridgeHub] Add and run Basic unit tests #1672

EmmanuellNorbertTulbure opened this issue Dec 1, 2022 · 12 comments
Assignees

Comments

@EmmanuellNorbertTulbure
Copy link

EmmanuellNorbertTulbure commented Dec 1, 2022

For Rococo - Wococo

  • add integrity tests to the bridge-hub-rococo runtime (for both sides R->W and W->R)
     fn ensure_bridge_integrity() {
		assert_complete_bridge_types!(
  • ...
@serban300
Copy link
Collaborator

serban300 commented Dec 8, 2022

Attaching the integrity test for Rialto -> Millau as an example:

@serban300
Copy link
Collaborator

Started adding integrity tests for Rococo -> Wococo and Wococo -> Rococo. There are 2 issues so far:

  1. Checking the type of the InboundPayload. The tests expects a FromBridgedChainMessagePayload, but we use XcmAsPlainPayload for BridgeHubRococo and BridgeHubWococo

@bkontur @svyatonik do we plan to use FromBridgedChainMessagePayload here in the future ?

  1. Checking the BlockWeights. For BridgeHubRococo and BridgeHubWococo we expect to find the weights defined in polkadot-core which use the constants defined also in polkadot-core. But instead the runtime uses the same formula, but with other constants defined in cumulus/parachains/common and other BlockExecutionWeight.

@svyatonik
Copy link
Contributor

1 Checking the type of the InboundPayload. The tests expects a FromBridgedChainMessagePayload, but we use XcmAsPlainPayload for BridgeHubRococo and BridgeHubWococo

My guess that we'll be using XcmAsPlainPayload. @bkontur wanted to backport his changed to the parity-bridge-common, so in the end the FromBridgedChainMessagePayload will use the same payload.

  1. Checking the BlockWeights. For BridgeHubRococo and BridgeHubWococo we expect to find the weights defined in polkadot-core which use the constants defined also in polkadot-core. But instead the runtime uses the same formula, but with other constants defined in cumulus/parachains/common and other BlockExecutionWeight.

I've tried to find where we are using those BlockWeights and it seems that they are no longer required. So IMO we need to remove this check - added a comment to the #1638. It needs to be double checked before removal

@serban300
Copy link
Collaborator

Thanks for the answer !

My guess that we'll be using XcmAsPlainPayload. @bkontur wanted to backport his changed to the parity-bridge-common, so in the end the FromBridgedChainMessagePayload will use the same payload.

@bkontur can I help with backporting this change ? Is there an issue for it ?

I've tried to find where we are using those BlockWeights and it seems that they are no longer required. So IMO we need to remove this check - added #1638 (comment) to the #1638. It needs to be double checked before removal

Ok, I can double check this and remove the BlockWeights and the assert.

@serban300
Copy link
Collaborator

I've tried to find where we are using those BlockWeights and it seems that they are no longer required. So IMO we need to remove this check - added #1638 (comment) to the #1638. It needs to be double checked before removal

@svyatonik I checked this and we use the BlockWeights in computing the max_extrinsic_weight(), which is then used in messages relaying here. I guess we still need this if I understand correctly.

@svyatonik
Copy link
Contributor

I've tried to find where we are using those BlockWeights and it seems that they are no longer required. So IMO we need to remove this check - added #1638 (comment) to the #1638. It needs to be double checked before removal

@svyatonik I checked this and we use the BlockWeights in computing the max_extrinsic_weight(), which is then used in messages relaying here. I guess we still need this if I understand correctly.

Yeah, you're right, thank you! Then we need to change weights of our parachains Rococo/Wococo/Polkadot/Kusama bridge hubs to what Cumulus offers. Then it should be fine. Sorry for misleading you :/

@bkontur
Copy link
Contributor

bkontur commented Dec 12, 2022

@serban300
I am waiting for one PR to be merged to the polkadot gav-xcm-v3 and after that I would like to update (polkadot/substrate) deps for parity-bridges-common + cumulus, so after that I would like to backport that

and to the weights, those block_weights in cumulus they are just copy/past from other cumulus runtimes,
what is another issue, related to this weights, we need to add all bridges pallets to the automatic benchmarking here: https://github.com/paritytech/cumulus/blob/master/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs#L463-L470
to be able to regenerate weights in cumulus with bench.bot, you could take this issue, if you want: #391

e.g.:
/cmd queue -c bench-bot $ xcm statemint assets pallet_xcm_benchmarks::fungible

/cmd queue -c bench-bot $ pallet bridge-hub-rococo bridge-hubs pallet_bridges_granda
/cmd queue -c bench-bot $ pallet bridge-hub-rococo bridge-hubs pallet_bridges_parachain
/cmd queue -c bench-bot $ pallet bridge-hub-rococo bridge-hubs pallet_bridges_messages
/cmd queue -c bench-bot $ pallet bridge-hub-rococo bridge-hubs pallet_bridges_rewards

@svyatonik
Copy link
Contributor

@serban300 I am waiting for one PR to be merged to the polkadot gav-xcm-v3 and after that I would like to update (polkadot/substrate) deps for parity-bridges-common + cumulus, so after that I would like to backport that

and to the weights, those block_weights in cumulus they are just copy/past from other cumulus runtimes, what is another issue, related to this weights, we need to add all bridges pallets to the automatic benchmarking here: https://github.com/paritytech/cumulus/blob/master/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs#L463-L470 to be able to regenerate weights in cumulus with bench.bot, you could take this issue, if you want: #391

e.g.:
/cmd queue -c bench-bot $ xcm statemint assets pallet_xcm_benchmarks::fungible

/cmd queue -c bench-bot $ pallet bridge-hub-rococo bridge-hubs pallet_bridges_granda
/cmd queue -c bench-bot $ pallet bridge-hub-rococo bridge-hubs pallet_bridges_parachain
/cmd queue -c bench-bot $ pallet bridge-hub-rococo bridge-hubs pallet_bridges_messages
/cmd queue -c bench-bot $ pallet bridge-hub-rococo bridge-hubs pallet_bridges_rewards

That's a bit different weights - they're weights of calls, not block limits. And we yet need to find a way to deal with these. This should probably be a part of release process (manual) - i.e. we'll be checking that weights in our repo are close to what bridge hubs are using. Let's probably not touch it now

@serban300
Copy link
Collaborator

@bkontur thanks for the answer ! Ok, I'll merge the integrity tests after you finish backporting the change. In the meanwhile I'll just fix the weights for Rococo/Wococo bridge hubs: #1709

@bkontur
Copy link
Contributor

bkontur commented Jan 23, 2023

@serban300
backport is ready, #1813

but I was thinking, if should better change that integrity test, to be more flexible:

assert_type_eq_all!(<$r as MessagesConfig<$i>>::OutboundPayload, FromThisChainMessagePayload);
assert_type_eq_all!(<$r as MessagesConfig<$i>>::InboundPayload, FromBridgedChainMessagePayload<CallOf<ThisChain<$bridge>>>);

for example FromThisChainMessagePayload / FromBridgedChainMessagePayload<CallOf<ThisChain<$bridge>>> could be passed as macro parameter, it will be more flexible and generic, rialto/millau stuff could still use FromBridgedChainMessagePayload and BridgeHubs XcmAsPlainPayload or whatever, wdyt?

@serban300
Copy link
Collaborator

serban300 commented Jan 24, 2023

Thanks! I'm taking a more detailed look on the tests to see what would be the best solution

@serban300
Copy link
Collaborator

Resolved by paritytech/cumulus#1975

svyatonik pushed a commit that referenced this issue Jul 17, 2023
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

No branches or pull requests

4 participants