Skip to content

Commit

Permalink
Progress 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Dinonard committed Jul 13, 2023
1 parent 71e2dd6 commit 17c28dd
Show file tree
Hide file tree
Showing 29 changed files with 157 additions and 197 deletions.
3 changes: 0 additions & 3 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 @@ -174,7 +174,6 @@ pallet-preimage = { git = "https://github.com/paritytech/substrate", branch = "p
pallet-scheduler = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false }
pallet-treasury = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false }
pallet-grandpa = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false }
pallet-state-trie-migration = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false }

# EVM & Ethereum
# (wasm)
Expand Down
22 changes: 5 additions & 17 deletions bin/collator/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -962,14 +962,10 @@ impl DefaultConfigurationValues for RelayChainCli {
30334
}

fn rpc_ws_listen_port() -> u16 {
fn rpc_listen_port() -> u16 {
9945
}

fn rpc_http_listen_port() -> u16 {
9934
}

fn prometheus_listen_port() -> u16 {
9616
}
Expand Down Expand Up @@ -999,16 +995,8 @@ impl CliConfiguration<Self> for RelayChainCli {
.or_else(|| self.base_path.clone().map(Into::into)))
}

fn rpc_http(&self, default_listen_port: u16) -> Result<Option<SocketAddr>> {
self.base.base.rpc_http(default_listen_port)
}

fn rpc_ipc(&self) -> Result<Option<String>> {
self.base.base.rpc_ipc()
}

fn rpc_ws(&self, default_listen_port: u16) -> Result<Option<SocketAddr>> {
self.base.base.rpc_ws(default_listen_port)
fn rpc_addr(&self, default_listen_port: u16) -> Result<Option<SocketAddr>> {
self.base.base.rpc_addr(default_listen_port)
}

fn prometheus_config(
Expand Down Expand Up @@ -1060,8 +1048,8 @@ impl CliConfiguration<Self> for RelayChainCli {
self.base.base.rpc_methods()
}

fn rpc_ws_max_connections(&self) -> Result<Option<usize>> {
self.base.base.rpc_ws_max_connections()
fn rpc_max_connections(&self) -> Result<u32> {
self.base.base.rpc_max_connections()
}

fn rpc_cors(&self, is_dev: bool) -> Result<Option<Vec<String>>> {
Expand Down
15 changes: 15 additions & 0 deletions bin/collator/src/local/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,28 @@ pub fn new_partial(
Ok((worker, telemetry))
})
.transpose()?;

let executor = sc_executor::NativeElseWasmExecutor::<Executor>::new(
config.wasm_method,
config.default_heap_pages,
config.max_runtime_instances,
config.runtime_cache_size,
);

let heap_pages = config
.default_heap_pages
.map_or(DEFAULT_HEAP_ALLOC_STRATEGY, |h| HeapAllocStrategy::Static {
extra_pages: h as _,
});

let executor = sc_executor::WasmExecutor::<HostFunctions>::builder()
.with_execution_method(config.wasm_method)
.with_max_runtime_instances(config.max_runtime_instances)
.with_runtime_cache_size(config.runtime_cache_size)
.with_onchain_heap_alloc_strategy(heap_pages)
.with_offchain_heap_alloc_strategy(heap_pages)
.build();

let (client, backend, keystore_container, task_manager) =
sc_service::new_full_parts::<Block, RuntimeApi, _>(
config,
Expand Down
8 changes: 6 additions & 2 deletions bin/collator/src/parachain/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ where
&task_manager,
relay_chain_interface.clone(),
transaction_pool,
sync_service,
sync_service.clone(),
params.keystore_container.keystore(),
force_authoring,
)?;
Expand All @@ -576,6 +576,7 @@ where
collator_key: collator_key.expect("Command line arguments do not allow this. qed"),
relay_chain_slot_duration,
recovery_handle: Box::new(overseer_handle),
sync_service,
};

start_collator(params).await?;
Expand All @@ -589,6 +590,7 @@ where
relay_chain_slot_duration,
import_queue: import_queue_service,
recovery_handle: Box::new(overseer_handle),
sync_service,
};

start_full_node(params)?;
Expand Down Expand Up @@ -903,7 +905,7 @@ where
&task_manager,
relay_chain_interface.clone(),
transaction_pool,
sync_service,
sync_service.clone(),
params.keystore_container.keystore(),
force_authoring,
)?;
Expand All @@ -923,6 +925,7 @@ where
collator_key: collator_key.expect("Command line arguments do not allow this. qed"),
relay_chain_slot_duration,
recovery_handle: Box::new(overseer_handle),
sync_service,
};

start_collator(params).await?;
Expand All @@ -936,6 +939,7 @@ where
relay_chain_slot_duration,
import_queue: import_queue_service,
recovery_handle: Box::new(overseer_handle),
sync_service,
};

start_full_node(params)?;
Expand Down
6 changes: 3 additions & 3 deletions pallets/block-reward/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ impl pallet_balances::Config for TestRuntime {
type AccountStore = System;
type WeightInfo = ();
type HoldIdentifier = ();
type FreezeIdentifier = ();
type MaxHolds = ();
type MaxFreezes = ();
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}

parameter_types! {
Expand Down
4 changes: 4 additions & 0 deletions pallets/collator-selection/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ impl pallet_balances::Config for Test {
type MaxLocks = ();
type MaxReserves = MaxReserves;
type ReserveIdentifier = [u8; 8];
type HoldIdentifier = ();
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}

pub struct Author4;
Expand Down
6 changes: 3 additions & 3 deletions pallets/custom-signatures/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ impl pallet_balances::Config for Runtime {
type MaxReserves = ();
type ReserveIdentifier = ();
type HoldIdentifier = ();
type FreezeIdentifier = ();
type MaxHolds = ();
type MaxFreezes = ();
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}

const MAGIC_NUMBER: u16 = 0xff50;
Expand Down
7 changes: 3 additions & 4 deletions pallets/dapps-staking/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,10 @@ impl pallet_balances::Config for TestRuntime {
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System;
type WeightInfo = ();
// TODO: modify this properly, will need some freeze identifier
type HoldIdentifier = ();
type FreezeIdentifier = ();
type MaxHolds = ();
type MaxFreezes = ();
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}

parameter_types! {
Expand Down
6 changes: 3 additions & 3 deletions pallets/ethereum-checked/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ impl pallet_balances::Config for TestRuntime {
type AccountStore = System;
type WeightInfo = ();
type HoldIdentifier = ();
type FreezeIdentifier = ();
type MaxHolds = ();
type MaxFreezes = ();
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}

impl pallet_timestamp::Config for TestRuntime {
Expand Down
46 changes: 23 additions & 23 deletions pallets/pallet-xcm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ use frame_system::pallet_prelude::*;
pub use pallet::*;
use xcm_executor::{
traits::{
ClaimAssets, DropAssets, MatchesFungible, OnResponse, VersionChangeNotifier, WeightBounds, CheckSuspension,
CheckSuspension, ClaimAssets, DropAssets, MatchesFungible, OnResponse,
VersionChangeNotifier, WeightBounds,
},
Assets,
};
Expand Down Expand Up @@ -116,8 +117,8 @@ impl WeightInfo for TestWeightInfo {
}

fn force_suspension() -> Weight {
Weight::from_parts(100_000_000, 0)
}
Weight::from_parts(100_000_000, 0)
}

fn migrate_supported_version() -> Weight {
Weight::from_parts(100_000_000, 0)
Expand Down Expand Up @@ -265,7 +266,6 @@ pub mod pallet {

/// The origin that is allowed to call privileged operations on the XCM pallet
type AdminOrigin: EnsureOrigin<<Self as SysConfig>::RuntimeOrigin>;

}

#[pallet::event]
Expand Down Expand Up @@ -1131,17 +1131,17 @@ pub mod pallet {
)
}

/// Set or unset the global suspension state of the XCM executor.
///
/// - `origin`: Must be an origin specified by AdminOrigin.
/// - `suspended`: `true` to suspend, `false` to resume.
#[pallet::call_index(10)]
#[pallet::weight(T::WeightInfo::force_suspension())]
pub fn force_suspension(origin: OriginFor<T>, suspended: bool) -> DispatchResult {
T::AdminOrigin::ensure_origin(origin)?;
XcmExecutionSuspended::<T>::set(suspended);
Ok(())
}
/// Set or unset the global suspension state of the XCM executor.
///
/// - `origin`: Must be an origin specified by AdminOrigin.
/// - `suspended`: `true` to suspend, `false` to resume.
#[pallet::call_index(10)]
#[pallet::weight(T::WeightInfo::force_suspension())]
pub fn force_suspension(origin: OriginFor<T>, suspended: bool) -> DispatchResult {
T::AdminOrigin::ensure_origin(origin)?;
XcmExecutionSuspended::<T>::set(suspended);
Ok(())
}

/// Transfer some assets from sovereign account to reserve holder chain and
/// forward a notification XCM.
Expand Down Expand Up @@ -2390,14 +2390,14 @@ impl<T: Config> OnResponse for Pallet<T> {
}

impl<T: Config> CheckSuspension for Pallet<T> {
fn is_suspended<Call>(
_origin: &MultiLocation,
_instructions: &mut [Instruction<Call>],
_max_weight: Weight,
_weight_credit: &mut Weight,
) -> bool {
XcmExecutionSuspended::<T>::get()
}
fn is_suspended<Call>(
_origin: &MultiLocation,
_instructions: &mut [Instruction<Call>],
_max_weight: Weight,
_weight_credit: &mut Weight,
) -> bool {
XcmExecutionSuspended::<T>::get()
}
}

/// Ensure that the origin `o` represents an XCM (`Transact`) origin.
Expand Down
6 changes: 3 additions & 3 deletions pallets/pallet-xcm/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,9 @@ impl pallet_balances::Config for Test {
type MaxReserves = MaxReserves;
type ReserveIdentifier = [u8; 8];
type HoldIdentifier = ();
type FreezeIdentifier = ();
type MaxHolds = ();
type MaxFreezes = ();
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}

parameter_types! {
Expand Down
6 changes: 3 additions & 3 deletions pallets/xc-asset-config/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ impl pallet_balances::Config for Test {
type AccountStore = System;
type WeightInfo = ();
type HoldIdentifier = ();
type FreezeIdentifier = ();
type MaxHolds = ();
type MaxFreezes = ();
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}

type AssetId = u128;
Expand Down
6 changes: 3 additions & 3 deletions precompiles/assets-erc20/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,9 @@ impl pallet_balances::Config for Runtime {
type AccountStore = System;
type WeightInfo = ();
type HoldIdentifier = ();
type FreezeIdentifier = ();
type MaxHolds = ();
type MaxFreezes = ();
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}

parameter_types! {
Expand Down
7 changes: 3 additions & 4 deletions precompiles/dapps-staking/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,10 @@ impl pallet_balances::Config for TestRuntime {
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System;
type WeightInfo = ();
// TODO: set this properly
type HoldIdentifier = ();
type FreezeIdentifier = ();
type MaxHolds = ();
type MaxFreezes = ();
type FreezeIdentifier = ();
type MaxHolds = ();
type MaxFreezes = ();
}

pub fn precompile_address() -> H160 {
Expand Down
6 changes: 3 additions & 3 deletions precompiles/sr25519/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,9 @@ impl pallet_balances::Config for Runtime {
type AccountStore = System;
type WeightInfo = ();
type HoldIdentifier = ();
type FreezeIdentifier = ();
type MaxHolds = ();
type MaxFreezes = ();
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}

parameter_types! {
Expand Down
6 changes: 3 additions & 3 deletions precompiles/substrate-ecdsa/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,9 @@ impl pallet_balances::Config for Runtime {
type AccountStore = System;
type WeightInfo = ();
type HoldIdentifier = ();
type FreezeIdentifier = ();
type MaxHolds = ();
type MaxFreezes = ();
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}

parameter_types! {
Expand Down
6 changes: 3 additions & 3 deletions precompiles/xcm/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,9 @@ impl pallet_balances::Config for Runtime {
type AccountStore = System;
type WeightInfo = ();
type HoldIdentifier = ();
type FreezeIdentifier = ();
type MaxHolds = ();
type MaxFreezes = ();
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
}

// These parameters dont matter much as this will only be called by root with the forced arguments
Expand Down
Loading

0 comments on commit 17c28dd

Please sign in to comment.