paritytech / polkadot-sdk

The Parity Polkadot Blockchain SDK
https://polkadot.network/
1.82k stars 662 forks source link

[FRAME Core] remove unnecessary overrides while using `derive_impl` for `frame_system` #3237

Closed gupnik closed 7 months ago

gupnik commented 8 months ago

https://github.com/paritytech/polkadot-sdk/pull/2409 moved all test runtimes to use derive_impl for frame_system by simply adding an attribute to all impls like so:

+#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
impl frame_system::Config for Runtime {
..
}

This enabled the introduction of new features like RuntimeTask without the need to update the configs everywhere.

However, the existing impls still continue to override the defaults for a number of types that are essentially the same as the ones provided by default config.

https://github.com/paritytech/polkadot-sdk/pull/1790 provides a sample of how the overridden defaults could simply be removed. This issue tracks the same for all pallets:

Here's a tracking list:

Gilt0 commented 8 months ago

Hi @gupnik , I would be curious to help on this issue, however, I have to admit that I am a complete and absolute beginner on this repo. So I may take more time to complete... Would you be keen to help me fix the issues? Best wishes, Gilt0

gupnik commented 8 months ago

Hi @gupnik , I would be curious to help on this issue, however, I have to admit that I am a complete and absolute beginner on this repo. So I may take more time to complete... Would you be keen to help me fix the issues? Best wishes, Gilt0

Sure, assigned it to you.

Gilt0 commented 8 months ago

Great thank you.

Gilt0 commented 7 months ago

hi @gupnik ,

I created pull request: Gilt0:issue-3237.

Also:

Best wishes, Gilt0

gupnik commented 7 months ago

hi @gupnik ,

I created pull request: Gilt0:issue-3237.

Also:

  • I have not figured out how to add the PR to the Security Audit (PRs) - SRLabs.
  • I did not squash so that you'd see all the steps (maybe naming of commits was a little short sighted - apologies).
  • for some reason the actions fail at Review Bot and I am not sure what I need to do to fix it. EDIT: it seems that the bot actually communicates with me and it has to do with clippy.

Best wishes, Gilt0

Great @Gilt0.

  1. I have added the labels.
  2. Works.
  3. CI points to unused imports as the reason. https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/5209825
Screenshot 2024-02-14 at 2 27 28 PM
Gilt0 commented 7 months ago

Thank you for your reply @gupnik Currently fixing the actions error (mainly unused imports that escaped my vigilance).

Gilt0 commented 7 months ago

Hey @gupnik

I am stalling a little. There is an error I don't understand. I tried reverting changes on identity pallet, but it did not do anything (shooting blind as I don't really understand what is going on).

Would you have any pointers on what could be happening?

[2024-02-14T22:59:57Z INFO  runtime::frame-support] 🩺 Running "Beefy" try-state checks
[2024-02-14T22:59:57Z INFO  runtime::frame-support] 🩺 Running "Mmr" try-state checks
[2024-02-14T22:59:57Z INFO  runtime::frame-support] 🩺 Running "BeefyMmrLeaf" try-state checks
[2024-02-14T22:59:57Z INFO  runtime::frame-support] 🩺 Running "IdentityMigrator" try-state checks
[2024-02-14T22:59:57Z ERROR runtime] panicked at /builds/parity/mirrors/polkadot-sdk/polkadot/runtime/westend/src/lib.rs:2227:65:
    called `Result::unwrap()` on an `Err` value: Other("Detected errors while executing try_state checks. See logs for more info.")
thread 'main' panicked at cli/main.rs:325:6:
called `Result::unwrap()` on an `Err` value: Input("failed to execute TryRuntime_on_runtime_upgrade: Execution aborted due to trap: wasm trap: wasm `unreachable` instruction executed\nWASM backtrace:\nerror while executing at wasm backtrace:\n    0: 0x73d60 - <unknown>!rust_begin_unwind\n    1: 0x11dbf - <unknown>!core::panicking::panic_fmt::he07f4fcfc0e8e78f\n    2: 0xfdb0 - <unknown>!core::result::unwrap_failed::h601a124147f65f04\n    3: 0x116ace - <unknown>!<westend_runtime::Runtime as frame_try_runtime::runtime_decl_for_try_runtime::TryRuntimeV1<sp_runtime::generic::block::Block<sp_runtime::generic::header::Header<u32,sp_runtime::traits::BlakeTwo256>,sp_runtime::generic::unchecked_extrinsic::UncheckedExtrinsic<sp_runtime::multiaddress::MultiAddress<<<sp_runtime::MultiSignature as sp_runtime::traits::Verify>::Signer as sp_runtime::traits::IdentifyAccount>::AccountId,()>,westend_runtime::RuntimeCall,sp_runtime::MultiSignature,(frame_system::extensions::check_non_zero_sender::CheckNonZeroSender<westend_runtime::Runtime>,frame_system::extensions::check_spec_version::CheckSpecVersion<westend_runtime::Runtime>,frame_system::extensions::check_tx_version::CheckTxVersion<westend_runtime::Runtime>,frame_system::extensions::check_genesis::CheckGenesis<westend_runtime::Runtime>,frame_system::extensions::check_mortality::CheckMortality<westend_runtime::Runtime>,frame_system::extensions::check_nonce::CheckNonce<westend_runtime::Runtime>,frame_system::extensions::check_weight::CheckWeight<westend_runtime::Runtime>,pallet_transaction_payment::ChargeTransactionPayment<westend_runtime::Runtime>)>>>>::on_runtime_upgrade::h3d77c7b947511727\n    4: 0x20ff92 - <unknown>!TryRuntime_on_runtime_upgrade")
stack backtrace:
   0: rust_begin_unwind
             at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:597:5
   1: core::panicking::panic_fmt
             at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/panicking.rs:72:14
   2: core::result::unwrap_failed
             at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/result.rs:1652:5
   3: tokio::runtime::park::CachedParkThread::block_on
   4: try_runtime::main
gupnik commented 7 months ago

Commented on the PR @Gilt0

Gilt0 commented 7 months ago

@gupnik Ah great thank you.