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

Enhance node service and update parachain configurations #830

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
3ac960b
compile contract and script to deploy
magecnion Sep 12, 2024
a4dd464
check estimate gas
magecnion Sep 23, 2024
c618a68
add logs
magecnion Sep 23, 2024
3d45a9b
Merge remote-tracking branch 'origin/main' into fix/deploy-contract-u…
magecnion Sep 23, 2024
ed16ada
Merge remote-tracking branch 'origin/main' into fix/deploy-contract-u…
magecnion Sep 26, 2024
3d06b5d
WIP use moonbeam impl
magecnion Oct 1, 2024
311b158
add download_polkadot.sh
magecnion Oct 1, 2024
1e91b20
use script in ci
magecnion Oct 1, 2024
4e6e169
Merge remote-tracking branch 'origin/feature/upgrade-zombienet-relayc…
magecnion Oct 1, 2024
1b4c019
add rest of the async back config
magecnion Oct 2, 2024
22909d3
remove Balances contract tests
magecnion Oct 2, 2024
9a1cce7
remove logs from zombienet
magecnion Oct 2, 2024
f2c7f75
fm
magecnion Oct 2, 2024
90df877
fmt
magecnion Oct 3, 2024
0ec2898
Merge remote-tracking branch 'origin/main' into fix/deploy-contract-u…
magecnion Oct 3, 2024
b416bdc
remove async backing config
magecnion Oct 3, 2024
89c5806
fmt
magecnion Oct 3, 2024
2944ff3
try darwinia patch
magecnion Oct 9, 2024
ed1d087
Merge branch 'main' into fix/missing-parachain-inherent-data
asiniscalchi Oct 22, 2024
cf65f38
uninclude segmnet capacity to 1
asiniscalchi Oct 22, 2024
9babb14
cumulus parachain system set for async backing
asiniscalchi Oct 22, 2024
637d4c4
compiling
asiniscalchi Oct 22, 2024
5e5e3a1
pallet weight
asiniscalchi Oct 22, 2024
efbc937
set timestamp
asiniscalchi Oct 22, 2024
528aeb0
fix compilation
asiniscalchi Oct 22, 2024
c845dec
fix clippy
asiniscalchi Oct 22, 2024
fd13011
fmt
asiniscalchi Oct 22, 2024
6b0b60a
update tests
asiniscalchi Oct 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions Cargo.lock

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

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ cumulus-pallet-session-benchmarking = { git = "https://github.com/paritytech/pol
cumulus-primitives-core = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false }
cumulus-primitives-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false }
cumulus-primitives-utility = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false }
cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false }
cumulus-test-relay-sproof-builder = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false }
parachain-info = { package = "staging-parachain-info", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false }
parachains-common = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false }

Expand All @@ -191,6 +193,7 @@ cumulus-client-cli = { git = "https://github.com/paritytech/polkadot-sdk", branc
cumulus-client-collator = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0" }
cumulus-client-consensus-aura = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0" }
cumulus-client-consensus-common = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0" }
cumulus-client-consensus-relay-chain = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0" }
cumulus-client-network = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0" }
cumulus-client-consensus-proposer = {git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0"}
cumulus-client-service = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0" }
Expand Down
3 changes: 3 additions & 0 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,11 @@ cumulus-client-collator = { workspace = true }
cumulus-client-consensus-aura = { workspace = true }
cumulus-client-consensus-common = { workspace = true }
cumulus-client-consensus-proposer = { workspace = true }
cumulus-client-consensus-relay-chain = { workspace = true }
cumulus-client-service = { workspace = true }
cumulus-primitives-core = { workspace = true }
cumulus-primitives-parachain-inherent = { workspace = true }
cumulus-test-relay-sproof-builder = { workspace = true }
cumulus-relay-chain-interface = { workspace = true }

# Frontier
Expand Down
38 changes: 28 additions & 10 deletions node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ use sc_network_sync::SyncingService;
use sc_service::{Configuration, PartialComponents, TFullBackend, TFullClient, TaskManager};
use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle};
use sc_transaction_pool_api::OffchainTransactionPoolFactory;
use sp_consensus_aura::{Slot, SlotDuration};
use sp_core::U256;
use sp_keystore::KeystorePtr;
use substrate_prometheus_endpoint::Registry;

// Frontier
use crate::eth::{
db_config_dir, new_frontier_partial, spawn_frontier_tasks, BackendType, EthConfiguration,
Expand Down Expand Up @@ -310,8 +312,6 @@ async fn start_node_impl(
fc_mapping_sync::EthereumBlockNotification<Block>,
> = Default::default();
let pubsub_notification_sinks = Arc::new(pubsub_notification_sinks);
let slot_duration = sc_consensus_aura::slot_duration(&*client)?;
let target_gas_price = eth_config.target_gas_price;

// for ethereum-compatibility rpc.
parachain_config.rpc_id_provider = Some(Box::new(fc_rpc::EthereumSubIdProvider));
Expand Down Expand Up @@ -344,15 +344,33 @@ async fn start_node_impl(
execute_gas_limit_multiplier: eth_config.execute_gas_limit_multiplier,
forced_parent_hashes: None,
pending_create_inherent_data_providers: move |_, ()| async move {
let current = sp_timestamp::InherentDataProvider::from_system_time();
let next_slot = current.timestamp().as_millis() + slot_duration.as_millis();
let timestamp = sp_timestamp::InherentDataProvider::new(next_slot.into());
let slot = sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_slot_duration(
*timestamp,
slot_duration,
// Patch from https://github.com/darwinia-network/darwinia/pull/1608
let timestamp = sp_timestamp::InherentDataProvider::from_system_time();
let relay_chain_slot = Slot::from_timestamp(
timestamp.timestamp(),
SlotDuration::from_millis(6000_u64), // RELAY_CHAIN_SLOT_DURATION_MILLIS
);
let dynamic_fee = fp_dynamic_fee::InherentDataProvider(U256::from(target_gas_price));
Ok((slot, timestamp, dynamic_fee))

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 =
cumulus_primitives_parachain_inherent::ParachainInherentData {
validation_data: cumulus_primitives_core::PersistedValidationData {
relay_parent_number: u32::MAX,
relay_parent_storage_root,
..Default::default()
},
relay_chain_state,
downward_messages: Default::default(),
horizontal_messages: Default::default(),
};
Ok((timestamp, parachain_inherent_data))
},
};

Expand Down
22 changes: 14 additions & 8 deletions primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,18 @@
#![warn(missing_docs)]
#![cfg_attr(not(feature = "std"), no_std)]

use frame_support::weights::IdentityFee;
use frame_support::weights::{constants::WEIGHT_REF_TIME_PER_SECOND, IdentityFee, Weight};
use frame_system::limits;
pub use parachains_common::{MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO};
pub use parachains_common::NORMAL_DISPATCH_RATIO;
use sp_core::Hasher as HasherT;
use sp_runtime::traits::{BlakeTwo256, IdentifyAccount, Verify};

/// We allow for 2 seconds of compute with a 6 second average block.
pub const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts(
WEIGHT_REF_TIME_PER_SECOND.saturating_mul(2),
cumulus_primitives_core::relay_chain::MAX_POV_SIZE as u64,
);

/// Authority ID used in parachain.
pub type AuraId = sp_consensus_aura::sr25519::AuthorityId;

Expand Down Expand Up @@ -78,12 +84,12 @@ mod tests {
let weights = RuntimeBlockWeights::get();

assert_eq!(weights.base_block, Weight::from_parts(453383000, 0));
assert_eq!(weights.max_block, Weight::from_parts(500000000000, 5242880));
assert_eq!(weights.max_block, Weight::from_parts(2000000000000, 5242880));

let normal = weights.per_class.get(DispatchClass::Normal);
assert_eq!(normal.base_extrinsic, Weight::from_parts(107074000, 0));
assert_eq!(normal.max_extrinsic, Some(Weight::from_parts(324892926000, 3407872)));
assert_eq!(normal.max_total, Some(Weight::from_parts(375000000000, 3932160)));
assert_eq!(normal.max_extrinsic, Some(Weight::from_parts(1299892926000, 3407872)));
assert_eq!(normal.max_total, Some(Weight::from_parts(1500000000000, 3932160)));
assert_eq!(normal.reserved, Some(Weight::from_parts(0, 0)));

let mandatory = weights.per_class.get(DispatchClass::Mandatory);
Expand All @@ -94,8 +100,8 @@ mod tests {

let operational = weights.per_class.get(DispatchClass::Operational);
assert_eq!(operational.base_extrinsic, Weight::from_parts(107074000, 0));
assert_eq!(operational.max_extrinsic, Some(Weight::from_parts(449892926000, 4718592)));
assert_eq!(operational.max_total, Some(Weight::from_parts(500000000000, 5242880)));
assert_eq!(operational.reserved, Some(Weight::from_parts(125000000000, 1310720)));
assert_eq!(operational.max_extrinsic, Some(Weight::from_parts(1799892926000, 4718592)));
assert_eq!(operational.max_total, Some(Weight::from_parts(2000000000000, 5242880)));
assert_eq!(operational.reserved, Some(Weight::from_parts(500000000000, 1310720)));
}
}
2 changes: 1 addition & 1 deletion runtime/laos/src/configs/aura.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use sp_core::ConstU64;

parameter_types! {
pub const MaxAuthorities : u32 = 100_000;
pub const AllowMultipleBlocksPerSlot: bool = false;
pub const AllowMultipleBlocksPerSlot: bool = true;
}

impl pallet_aura::Config for Runtime {
Expand Down
3 changes: 2 additions & 1 deletion runtime/laos/src/configs/cumulus_parachain_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ impl cumulus_pallet_parachain_system::Config for Runtime {
type ReservedDmpWeight = ReservedDmpWeight;
type XcmpMessageHandler = XcmpQueue;
type ReservedXcmpWeight = ReservedXcmpWeight;
type CheckAssociatedRelayNumber = cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases;
type CheckAssociatedRelayNumber =
cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases;
type ConsensusHook = ConsensusHook;
type DmpQueue = frame_support::traits::EnqueueWithOrigin<MessageQueue, RelayOrigin>;
type WeightInfo = weights::cumulus_pallet_parachain_system::WeightInfo<Runtime>;
Expand Down
4 changes: 2 additions & 2 deletions runtime/laos/src/configs/timestamp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
// You should have received a copy of the GNU General Public License
// along with LAOS. If not, see <http://www.gnu.org/licenses/>.

use crate::{weights, Aura, Runtime, MILLISECS_PER_BLOCK};
use crate::{weights, Aura, Runtime};
use frame_support::parameter_types;

parameter_types! {
pub const MinimumPeriod: u64 = MILLISECS_PER_BLOCK / 2;
pub const MinimumPeriod: u64 = 0;
}

impl pallet_timestamp::Config for Runtime {
Expand Down
2 changes: 1 addition & 1 deletion runtime/laos/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ impl_opaque_keys! {
}

/// This determines the average expected block time that we are targeting.
pub const MILLISECS_PER_BLOCK: u64 = 12000;
pub const MILLISECS_PER_BLOCK: u64 = 6000;

/// Version of the runtime
#[sp_version::runtime_version]
Expand Down
2 changes: 1 addition & 1 deletion zombienet/download_polkadot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Default version and download directory
VERSION=${1:-"v1.11.0"}
DOWNLOAD_DIR=${2:-"./tmp"} # Default is the current directory
DOWNLOAD_DIR=${2:-"./tmp"} # Default is tmp

BASE_URL="https://github.com/paritytech/polkadot-sdk/releases/download/polkadot-$VERSION"

Expand Down
Loading