-
Notifications
You must be signed in to change notification settings - Fork 10
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
feat(mainnet): add XCM runtime APIs, config tests, and refactor to API mod [DON'T MERGE] #426
Conversation
Co-authored-by: Daanvdplas <daanvdplas@live.nl> Co-authored-by: Daan van der Plas <93204684+Daanvdplas@users.noreply.github.com>
…nstead of then_some https://github.com/paritytech/polkadot-sdk/pull/6156/files#diff-7ab065c73b2237dff7c6eca18162b7f674e5e7f9e330af668cc5d35de6a597bd https://github.com/paritytech/polkadot-sdk/pull/5919/files#diff-7b805930c8caa346a498254e233963501862a29b4ae5633a00efb96b9c96258a paritytech/polkadot-sdk#5693 paritytech/polkadot-sdk@b76e91a
[sc-2219] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CI is failing
@@ -257,4 +267,71 @@ impl_runtime_apis! { | |||
Default::default() | |||
} | |||
} | |||
|
|||
impl xcm_runtime_apis::fees::XcmPaymentApi<Block> for Runtime { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious to hear whether we want to add them to testnet and devnet as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see why not!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In follow up PRs, I think it would make sense. However, it seems a distraction right now. Our current mainnet runtime will be deployed as its own testnet. Which means our current testnet and devnet don't factor into the initial mainnet launch.
We do need to resolve what will happen to the current testnet and how the two testnets will live together (if at all)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That means that our current testnet becomes our devnet, and testnet should become a copy of mainnet?
Still believe that any feature on mainnet (thus testnet) should be on devnet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider that certain things like spec name cannot be changed and that protocol id should be unique. Deploying the mainnet runtime as-is to Paseo may only make sense if it is going to be removed completely to make way for the Polkadot deployment rather than upgraded in place to become a testnet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine to do it later, my view is that it only creates more work for later and it is a simple add now.
It is still unclear to me what the plan for this new testnet exactly is so getting that done would prevent further confusions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to address this myself in a different PR to get this closed one sorted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall pretty good!
Have left a few comments, but mainly things worth discussing rather than change requests.
@@ -16,6 +16,8 @@ use alloc::{borrow::Cow, vec::Vec}; | |||
use config::xcm::{RelayLocation, XcmOriginToTransactDispatchOrigin}; | |||
use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases; | |||
use cumulus_primitives_core::{AggregateMessageOrigin, ParaId}; | |||
use cumulus_primitives_storage_weight_reclaim::StorageWeightReclaim; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this is being deprecated and substituted by a new implementation.
For para chains
StorageWeightReclaim
incumulus-primitives-storage-weight-reclaim
is deprecated.
A new transaction extensionStorageWeightReclaim
incumulus-pallet-weight-reclaim
is introduced.
StorageWeightReclaim
is meant to be used as a wrapping of the whole transaction extension pipeline, and will take into account all proof size accurately.
Let's see if this change is backported into 2412
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch. Hopefully they release the new release soon.
} | ||
} | ||
|
||
impl xcm_runtime_apis::dry_run::DryRunApi<Block, RuntimeCall, RuntimeEvent, OriginCaller> for Runtime { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These dry_run api are delicate in the sense that if someone has access to a node can make the node work a lot for free.
While there are ways to rate-limit the requests to the node:
- either via integrated middleware: rpc server: add rate limiting middleware paritytech/polkadot-sdk#3301
- or extra deployments: https://github.com/AcalaNetwork/subway
Ideally we should be capable of dropping a dry-run that is bigger than some threshold independently of spam. A weight-rate, instead of a requests one. However I'm not sure how could we do that from the top of my head.
These are very useful apis, that's for sure! Whether we are going to benefit from them from the start or not is questionable. Having native XCM support on ink! is a vote in favor for them.
My take would be keeping them for now and do some extra research on them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would these not be limited to RPCs only? If collators only expose P2P, is you concern then a non-issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly, these apis are only accessible if one can reach out the node.
Codecov ReportAttention: Patch coverage is
@@ Coverage Diff @@
## peterwht/chore-polkadot-2412 #426 +/- ##
================================================================
- Coverage 68.31% 68.03% -0.28%
================================================================
Files 70 71 +1
Lines 11777 11899 +122
Branches 11777 11899 +122
================================================================
+ Hits 8045 8096 +51
- Misses 3480 3551 +71
Partials 252 252
|
029a3a9
to
937ca11
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the changes look great. Happy to proceed once CI is happy too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems the transaction payment pallet is missing from define_benchmarks! along with the inclusion of the new transaction extension benchmarks across the various runtimes.
tokio = { version = "1.36", features = [ "macros", "rt-multi-thread", "time" ] } | ||
tracing-subscriber = { version = "0.3.18", default-features = false } | ||
|
||
# Build | ||
substrate-build-script-utils = "11.0.0" | ||
substrate-wasm-builder = "24.0.1" | ||
substrate-build-script-utils = { git = "https://github.com/r0gue-io/polkadot-sdk", branch = "stable2412" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
substrate-build-script-utils = { git = "https://github.com/r0gue-io/polkadot-sdk", branch = "stable2412" } | |
substrate-build-script-utils = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2412" } |
Suggest a quick find and replace and see if it builds and everything works. Some fixes are already pushed there ahead of the first patch release due next week. Can then get rid of the fork and switch back to the crates.io versions separately with next release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in #425
paseo-runtime-constants = { git = "https://github.com/paseo-network/runtimes/", tag = "v1.3.3", default-features = false } | ||
westend-runtime = { version = "18.0.1", default-features = false } | ||
westend-runtime-constants = { version = "17.0.0", default-features = false } | ||
asset-hub-paseo-runtime = { git = "https://github.com/paseo-network/runtimes", default-features = false, tag = "v1.3.3" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest we remove these other runtimes as a follow up PR. I dont see them being used anytime soon due to the lag between a SDK release and runtime release.
@@ -60,74 +60,9 @@ paseo = [ | |||
"asset-hub-paseo-runtime", | |||
"paseo-runtime", | |||
"paseo-runtime-constants", | |||
"std", | |||
] | |||
runtime-benchmarks = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Justification here is that none of these features are used/required to run integration tests. These were included historically to work around build issues when trying to use a single command to run all tests/benchmarks in the repo. Can be revisited again separately.
}; | ||
use polkadot_primitives::{AssignmentId, Balance, ValidatorId, LOWEST_PUBLIC_ID}; | ||
use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId; | ||
use sp_consensus_babe::AuthorityId as BabeId; | ||
use sp_consensus_beefy::ecdsa_crypto::AuthorityId as BeefyId; | ||
use sp_consensus_beefy::test_utils::Keyring; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No change required, but single usage imports seem unnecessary to me, provided the usage doesnt cause a line wrap. Based on the level of indentation below, I assume this would be the case.
I simply prefer as little code as possible, less to write, less to review.
config.prometheus_registry(), | ||
task_manager.spawn_essential_handle(), | ||
client.clone(), | ||
// TOOD: double check |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can more insight be provided here? Not sure we should be reviewing/approving/merging if there are todos.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved in #425, dependent on this convo: #425 (comment)
@@ -186,15 +187,15 @@ impl_opaque_keys! { | |||
|
|||
#[sp_version::runtime_version] | |||
pub const VERSION: RuntimeVersion = RuntimeVersion { | |||
spec_name: create_runtime_str!("pop"), | |||
impl_name: create_runtime_str!("pop"), | |||
spec_name: Cow::Borrowed("pop"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No action required, but as there is an import for Cow, could have just been Cow::Borrowed imported to avoid the duplication here. I figure you may prefer it having an explicit prefix tho.
@@ -166,6 +169,7 @@ runtime-benchmarks = [ | |||
"pallet-scheduler/runtime-benchmarks", | |||
"pallet-sudo/runtime-benchmarks", | |||
"pallet-timestamp/runtime-benchmarks", | |||
"pallet-transaction-payment/runtime-benchmarks", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont see that this has been added to define_benchmarks in any of the runtimes. Likewise there is no addition of the benchmarks for transaction extensions (frame_system_extensions)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was an intentional decision (should have been documented). Our define_benchmarks!
in all of our runtimes does not include every pallet. I will create an issue to resolve this in a separate PR once the 2412 uplift is merged
@@ -984,7 +988,7 @@ impl_runtime_apis! { | |||
|
|||
fn dispatch_benchmark( | |||
config: frame_benchmarking::BenchmarkConfig | |||
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> { | |||
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, alloc::string::String> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing use frame_system_benchmarking::extensions::Pallet as SystemExtensionsBench;
in the benchmarks trait implementation. Closest I could place the comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved in #447
superseded by #447 |
DO NOT SQUASH MERGE -- REMOVE THIS MESSAGE BEFORE MERGE
Prereq: #425
This PR has various improvements to the mainnet runtime. Please review the individual commits:
test(mainnet): more configuration tests
refactor(mainnet): runtime APIs to apis module
feat(mainnet): add XCM runtime APIs