Skip to content

Commit

Permalink
Part.5
Browse files Browse the repository at this point in the history
  • Loading branch information
AurevoirXavier committed Oct 18, 2024
1 parent 9a39661 commit 1f64c62
Show file tree
Hide file tree
Showing 36 changed files with 159 additions and 1,381 deletions.
23 changes: 0 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ darwinia-common-runtime = { path = "runtime/common", default-features
darwinia-deposit = { path = "pallet/deposit", default-features = false }
darwinia-ethtx-forwarder = { path = "pallet/ethtx-forwarder", default-features = false }
darwinia-precompile-assets = { path = "precompile/assets", default-features = false }
darwinia-precompile-deposit = { path = "precompile/deposit", default-features = false }
darwinia-precompile-staking = { path = "precompile/staking", default-features = false }
darwinia-precompile-state-storage = { path = "precompile/state-storage", default-features = false }
darwinia-runtime = { path = "runtime/darwinia" }
Expand Down
2 changes: 1 addition & 1 deletion Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ args = ["fmt"]
[tasks.clippy]
env = { "SKIP_WASM_BUILD" = "1" }
command = "cargo"
args = ["clippy"]
args = ["clippy", "--all-features"]

[tasks.c]
alias = "clippy"
Expand Down
28 changes: 16 additions & 12 deletions node/src/service/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,12 +398,14 @@ where
);

// Create a mocked parachain inherent data provider to pass all validations in the
// parachain system. Without this, the pending functionality will fail.
let mut state_proof_builder =
cumulus_test_relay_sproof_builder::RelayStateSproofBuilder::default();
state_proof_builder.para_id = para_id;
state_proof_builder.current_slot = relay_chain_slot;
state_proof_builder.included_para_head = Some(polkadot_primitives::HeadData(vec![]));
// parachain system.
// Without this, the pending functionality will fail.
let state_proof_builder = cumulus_test_relay_sproof_builder::RelayStateSproofBuilder {
para_id,
current_slot: relay_chain_slot,
included_para_head: Some(polkadot_primitives::HeadData(vec![])),
..Default::default()
};
let (relay_parent_storage_root, relay_chain_state) =
state_proof_builder.into_state_root_and_proof();
let parachain_inherent_data =
Expand Down Expand Up @@ -924,12 +926,14 @@ where
SlotDuration::from_millis(RELAY_CHAIN_SLOT_DURATION_MILLIS as u64),
);
// Create a mocked parachain inherent data provider to pass all validations in the
// parachain system. Without this, the pending functionality will fail.
let mut state_proof_builder =
cumulus_test_relay_sproof_builder::RelayStateSproofBuilder::default();
state_proof_builder.para_id = para_id;
state_proof_builder.current_slot = relay_chain_slot;
state_proof_builder.included_para_head = Some(polkadot_primitives::HeadData(vec![]));
// parachain system.
// Without this, the pending functionality will fail.
let state_proof_builder = cumulus_test_relay_sproof_builder::RelayStateSproofBuilder {
para_id,
current_slot: relay_chain_slot,
included_para_head: Some(polkadot_primitives::HeadData(vec![])),
..Default::default()
};
let (relay_parent_storage_root, relay_chain_state) =
state_proof_builder.into_state_root_and_proof();
let parachain_inherent_data =
Expand Down
8 changes: 2 additions & 6 deletions pallet/account-migration/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,14 @@ mod benchmarks {
expired_time: Default::default(),
in_use: Default::default(),
};
<T as darwinia_deposit::Config>::MaxDeposits::get() as usize
512
],
);
<Ledgers<T>>::insert(
from,
OldLedger {
staked_ring: 1,
staked_deposits: BoundedVec::truncate_from(vec![
Default::default();
<T as darwinia_deposit::Config>::MaxDeposits::get()
as usize
]),
staked_deposits: BoundedVec::truncate_from(vec![Default::default(); 512]),
unstaking_ring: BoundedVec::truncate_from(vec![
(
Default::default(),
Expand Down
5 changes: 1 addition & 4 deletions pallet/account-migration/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,7 @@ pub mod pallet {
> + pallet_assets::Config<Balance = Balance, AssetId = AssetId>
+ pallet_balances::Config<Balance = Balance>
+ darwinia_deposit::Config
+ darwinia_staking::Config<
Deposit = darwinia_deposit::Pallet<Self>,
MaxDeposits = ConstU32<512>,
>
+ darwinia_staking::Config
{
/// Override the [`frame_system::Config::RuntimeEvent`].
type RuntimeEvent: From<Event> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
Expand Down
2 changes: 1 addition & 1 deletion pallet/deposit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ pub mod pallet {
}
}

T::Ring::transfer(&account_id(), &who, to_claim.0, AllowDeath)?;
T::Ring::transfer(&account_id(), who, to_claim.0, AllowDeath)?;
T::Ring::transfer(&account_id(), &T::Treasury::get(), to_migrate.0, AllowDeath)?;
T::DepositMigrator::migrate(who.clone(), to_migrate.0, to_migrate.2)?;

Expand Down
5 changes: 1 addition & 4 deletions pallet/staking/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

// darwinia
use crate::*;
use dc_types::UNIT;
// polkadot-sdk
use frame_benchmarking::v2;
use frame_system::RawOrigin;
Expand All @@ -28,12 +27,10 @@ use sp_std::prelude::*;
mod benchmarks {
// darwinia
use super::*;
// polkadot-sdk
use frame_support::traits::Currency;

#[benchmark]
fn unstake_all_for() {
let a = frame_benchmarking::whitelisted_caller();
let a = frame_benchmarking::whitelisted_caller::<T::AccountId>();
let a_cloned = a.clone();

// Worst-case scenario:
Expand Down
59 changes: 0 additions & 59 deletions precompile/deposit/Cargo.toml

This file was deleted.

93 changes: 0 additions & 93 deletions precompile/deposit/src/lib.rs

This file was deleted.

Loading

0 comments on commit 1f64c62

Please sign in to comment.