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 inbound queue #750

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Add inbound queue #750

wants to merge 8 commits into from

Conversation

ParthDesai
Copy link
Contributor

@ParthDesai ParthDesai commented Nov 18, 2024

Description

This PR adds inbound queue to starlight and include tests for the same.

It adds message processor called SymbioticMessageProcessor which upon receiving new validators, calls ExternalValidators pallet to set the validators.

What is remaining?

  • Benchmarking

Note

The base of the PR is at tomasz-generic-aggregate-message-origin since this PR is dependent upon code introduced there.
Base changed to master after PR merge.

Copy link
Contributor

github-actions bot commented Nov 18, 2024

WASM runtime size check:

Compared to target branch

dancebox runtime: 1424 KB (no changes) ✅

flashbox runtime: 820 KB (no changes) ✅

dancelight runtime: 2104 KB (+2104 KB) ⚠️

container chain template simple runtime: 1124 KB (-4296 KB) ✅

container chain template frontier runtime: 1400 KB (-5152 KB) ✅

@ParthDesai ParthDesai changed the title [WIP] Add inbound queue + tests [WIP] Add inbound queue Nov 18, 2024
Copy link
Contributor

github-actions bot commented Nov 20, 2024

Coverage Report

(master)

@@                 Coverage Diff                  @@
##           master   add-inbound-queue     +/-   ##
====================================================
  Coverage   64.57%              64.57%   0.00%     
+ Files         317                 320      +3     
+ Lines       55357               55407     +50     
====================================================
+ Hits        35745               35777     +32     
+ Misses      19612               19630     +18     
Files Changed Coverage
/solo-chains/runtime/dancelight/src/lib.rs 66.21% (+0.02%)

Coverage generated Tue Nov 26 13:23:17 UTC 2024

@ParthDesai ParthDesai force-pushed the add-inbound-queue branch 4 times, most recently from fff9fdc to 3eba4a5 Compare November 25, 2024 15:14
@ParthDesai ParthDesai changed the title [WIP] Add inbound queue Add inbound queue Nov 25, 2024
@ParthDesai ParthDesai force-pushed the add-inbound-queue branch 2 times, most recently from d2b0917 to 33b0d32 Compare November 26, 2024 11:28
Base automatically changed from tomasz-generic-aggregate-message-origin to master November 26, 2024 12:20
@ParthDesai ParthDesai marked this pull request as ready for review November 26, 2024 12:27
};

// Ethereum Bridge
parameter_types! {
pub storage EthereumGatewayAddress: H160 = H160(hex_literal::hex!("EDa338E4dC46038493b885327842fD3E301CaB39"));
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this storage modifier? It means that this is stored in storage and can be modified by root?

Copy link
Collaborator

Choose a reason for hiding this comment

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

it's the first time that I see it too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The storage modifier means following:

  1. From name of the variable a key is derived. Formula for derivation is: twox_128(":" ++ NAME ++ ":")
  2. If there is a value under the key, it is returned in response to get()
  3. If not, value specified in the assignment H160(hex_literal::hex!("EDa338E4dC46038493b885327842fD3E301CaB39")) is returned.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also, yes since only root can write to arbitrary key, this is modified by root.

}

#[derive(Encode, Decode)]
pub enum Message<T>
Copy link
Contributor

Choose a reason for hiding this comment

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

Add docs that this is the message that comes from ethereum

Cargo.toml Outdated
@@ -259,12 +259,18 @@ xcm-runtime-apis = { git = "https://github.com/moondance-labs/polkadot-sdk", bra


# Bridges (wasm)
alloy-primitives = { version = "0.4.2", default-features = false }
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
alloy-primitives = { version = "0.4.2", default-features = false }

I believe this is unused

let message = if let Ok(payload) = decode_result {
payload.message
} else {
return Err(DispatchError::Other("unable to parse the payload"));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
return Err(DispatchError::Other("unable to parse the payload"));
return Err(DispatchError::Other("unable to parse the envelope payload"));

}

#[derive(Encode, Decode)]
pub enum Command<T>
Copy link
Collaborator

Choose a reason for hiding this comment

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

shal we call this InboundCommand? reason is we have a different est of outbound commands right?

@@ -140,16 +153,23 @@ impl snowbridge_pallet_system::Config for Runtime {
#[cfg(feature = "runtime-benchmarks")]
type Helper = benchmark_helper::EthSystemBenchHelper;
type DefaultPricingParameters = Parameters;
type InboundDeliveryCost = ();
//type InboundDeliveryCost = EthereumInboundQueue;
type InboundDeliveryCost = EthereumInboundQueue;
Copy link
Collaborator

Choose a reason for hiding this comment

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

what are the implicatrions of this? are we going to charge for the validators payload?

Copy link
Collaborator

Choose a reason for hiding this comment

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

from what I can see it is the price that we can communicate to the SC, so I think its correct, but plz confirm

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. And we only communicate in case root calls the extrinsic on system pallet. So, I think it is okay.

Copy link
Collaborator

@girazoki girazoki left a comment

Choose a reason for hiding this comment

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

Approved but I have an important question and minor comments. Specially in the inbound delivery cost

@girazoki girazoki added B7-runtimenoteworthy Changes should be noted in any runtime-upgrade release notes D9-needsaudit👮 PR contains changes to fund-managing logic that should be properly reviewed and externally audited labels Nov 26, 2024
@ParthDesai ParthDesai added the breaking Needs to be mentioned in breaking changes label Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B7-runtimenoteworthy Changes should be noted in any runtime-upgrade release notes breaking Needs to be mentioned in breaking changes D9-needsaudit👮 PR contains changes to fund-managing logic that should be properly reviewed and externally audited
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants