Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Transact from eth to sub #114

Open
wants to merge 50 commits into
base: bridge-next-gen
Choose a base branch
from
Open

Conversation

yrong
Copy link

@yrong yrong commented Feb 14, 2024

No description provided.

Copy link

codecov bot commented Feb 14, 2024

Codecov Report

Attention: Patch coverage is 79.06977% with 9 lines in your changes are missing coverage. Please review.

❗ No coverage uploaded for pull request base (bridge-next-gen@3f495e5). Click here to learn what that means.

❗ Current head 7cc0d59 differs from pull request most recent head ee6bdc5. Consider uploading reports for the commit ee6bdc5 to get more accurate results

Files Patch % Lines
...ridges/snowbridge/pallets/inbound-queue/src/lib.rs 50.00% 5 Missing ⚠️
.../inbound-queue/fixtures/src/send_call_to_penpal.rs 0.00% 3 Missing ⚠️
...es/snowbridge/primitives/router/src/inbound/mod.rs 96.55% 1 Missing ⚠️
Additional details and impacted files
@@                Coverage Diff                 @@
##             bridge-next-gen     #114   +/-   ##
==================================================
  Coverage                   ?   40.92%           
==================================================
  Files                      ?       52           
  Lines                      ?     3372           
  Branches                   ?        0           
==================================================
  Hits                       ?     1380           
  Misses                     ?     1992           
  Partials                   ?        0           
Flag Coverage Δ
rust 40.92% <79.06%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@claravanstaden claravanstaden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! The penpal changes just need to made generic, otherwise awesome!

bridges/snowbridge/primitives/router/src/inbound/mod.rs Outdated Show resolved Hide resolved

parameter_types! {
pub const RelayLocation: Location = Location::parent();
pub const RelayNetwork: Option<NetworkId> = None;
pub const RelayNetwork: NetworkId = Rococo;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We cannot make this change because the polkadot-fellows/runtimes#130 uses this parachain for testing as well. Perhaps we can set the Relay chain more generically?

Copy link
Author

@yrong yrong Apr 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

68abf04

As you may notice, with more bridge features like Transact added to penpal, we do need several configurations Network/Ethereum binding, basically the same as the configuration on AssetHub.

In above commit I've made them as Storage which can be changed for network like Polkadot or Ethereum mainnet, but maybe it's better to be more specific to add separate runtimes for different networks(e.g. penpal-kusama&penpal-polkadot)?

WDYT?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps, yes. But since this code belongs to Parity maybe it would be better to ask someone like @bkontur.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or I can use another template chain for the integration.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

previously we used hack like:

pub storage RelayNetwork: Option<NetworkId> = None;

but there is also new parameters pallet, so I would suggest to go configurable way instead of hard-code Rococo to penpal, because we use it for fellows also

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, Adrian already changed that to storage stuff with default to Rococo: https://github.com/paritytech/polkadot-sdk/pull/3695/files#diff-37d844ab36f3c061d846240105ddb24c0832ca0f7da21a89ea3e051c6d978b3bR64 (will be merged soon)

pub SiblingBridgeHubWithEthereumInboundQueueInstance: Location = Location::new(
1,
[
Parachain(bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, these values need to configurable so that we can set them from any runtime. Here's an example of how the Ethereum network ID was made configurable in Penpal: paritytech#3564

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yrong yrong changed the base branch from snowbridge to bridge-next-gen April 11, 2024 02:20
// Forward message id
SetTopic(message_id.into()),
];
(message.into(), fee.into())

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would return 0 as a fee here. The returned fee is meant to be burnt.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

payload: Vec<u8>,
) -> (Xcm<()>, Balance) {
// Fee in native token of destination chain
let xcm_fee: Asset = (Location::here(), fee).into();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to use native or DOT based on whether its a system parachain or not. But in future we may want to configure this per channel.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5a22972 configure per channel.

WithdrawAsset(xcm_fee.clone().into()),
// Pay for execution.
BuyExecution { fees: xcm_fee, weight_limit: Unlimited },
Transact { origin_kind, require_weight_at_most: weight_at_most, call: payload.into() },

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to RefundSurplus execution left over from the Transact and DepositAsset any left over fees back into the prefunded account.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!
ee6bdc5

claravanstaden pushed a commit that referenced this pull request May 30, 2024
## [0.5.0] - 2023-05-24

This is a small patch release that makes the `FindNode` command a bit
more robst:

- The `FindNode` command now retains the K (replication factor) best
results.
- The `FindNode` command has been updated to handle errors and
unexpected states without panicking.

### Changed

- kad: Refactor FindNode query, keep K best results and add tests
([#114](paritytech/litep2p#114))

---------

Signed-off-by: Alexandru Vasile <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants