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

Added pallet_glutton #588

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
21 changes: 20 additions & 1 deletion Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ frame-system-rpc-runtime-api = { default-features = false, git = "https://github
frame-try-runtime = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-stable2412-1" }
pallet-aura = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-stable2412-1" }
pallet-balances = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-stable2412-1" }
pallet-glutton = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-stable2412-1" }
pallet-grandpa = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-stable2412-1" }
pallet-session = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-stable2412-1" }
pallet-sudo = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-stable2412-1" }
Expand Down
4 changes: 2 additions & 2 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ test:
LET WASM_BUILD_STD=0
DO github.com/earthly/lib:3.0.2+INSTALL_DIND
CACHE --sharing shared --id cargo $CARGO_HOME
RUN cargo test --no-run --locked --profile=$PROFILE --features=$FEATURES,runtime-benchmarks
RUN ls
WITH DOCKER
RUN cargo test --locked --profile=$PROFILE --features=$FEATURES,runtime-benchmarks
RUN ls
END

licenses:
Expand Down
1 change: 1 addition & 0 deletions demo/node/src/staging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ pub fn staging_genesis(
main_chain_scripts: sp_native_token_management::MainChainScripts::read_from_env()?,
..Default::default()
},
glutton: Default::default(),
test_helper_pallet: TestHelperPalletConfig {
participation_data_release_period: 30,
..Default::default()
Expand Down
19 changes: 14 additions & 5 deletions demo/node/src/template_chain_spec.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use crate::chain_spec::*;
use partner_chains_demo_runtime::{
AuraConfig, BalancesConfig, GrandpaConfig, NativeTokenManagementConfig, RuntimeGenesisConfig,
SessionCommitteeManagementConfig, SessionConfig, SidechainConfig, SudoConfig, SystemConfig,
TestHelperPalletConfig,
AccountId, AuraConfig, BalancesConfig, GrandpaConfig, NativeTokenManagementConfig,
RuntimeGenesisConfig, SessionCommitteeManagementConfig, SessionConfig, SidechainConfig,
SudoConfig, SystemConfig, TestHelperPalletConfig,
};
use sc_service::ChainType;
use sp_core::crypto::Ss58Codec;

/// Produces template chain spec for Partner Chains.
/// This code should be run by `partner-chains-node wizards chain-spec`, to produce JSON chain spec file.
Expand All @@ -15,13 +16,20 @@ pub fn chain_spec() -> Result<ChainSpec, envy::Error> {
system: SystemConfig { ..Default::default() },
balances: BalancesConfig {
// Update if any endowed accounts are required.
balances: vec![],
balances: vec![(
AccountId::from_ss58check("5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY")
.unwrap(),
1_000_000_000_000_000_000_000u128,
)],
},
aura: AuraConfig { authorities: vec![] },
grandpa: GrandpaConfig { authorities: vec![], ..Default::default() },
sudo: SudoConfig {
// No sudo account by default, please update with your preferences.
key: None,
key: Some(
AccountId::from_ss58check("5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY")
.unwrap(),
),
},
transaction_payment: Default::default(),
session: SessionConfig {
Expand All @@ -42,6 +50,7 @@ pub fn chain_spec() -> Result<ChainSpec, envy::Error> {
main_chain_scripts: sp_native_token_management::MainChainScripts::read_from_env()?,
..Default::default()
},
glutton: Default::default(),
test_helper_pallet: TestHelperPalletConfig {
participation_data_release_period: 30,
..Default::default()
Expand Down
1 change: 1 addition & 0 deletions demo/node/src/testnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ pub fn testnet_genesis(
main_chain_scripts: sp_native_token_management::MainChainScripts::read_from_env()?,
..Default::default()
},
glutton: Default::default(),
test_helper_pallet: TestHelperPalletConfig {
participation_data_release_period: 30,
..Default::default()
Expand Down
2 changes: 2 additions & 0 deletions demo/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ serde_json = { workspace = true, default-features = false, features = [
pallet-aura = { workspace = true }
pallet-balances = { workspace = true }
frame-support = { workspace = true }
pallet-glutton = { workspace = true }
pallet-grandpa = { workspace = true }
pallet-partner-chains-session = { workspace = true, features = ["pallet-session-compat"] }
pallet-session = { workspace = true }
Expand Down Expand Up @@ -120,6 +121,7 @@ std = [
"pallet-aura/std",
"pallet-balances/std",
"pallet-block-production-log/std",
"pallet-glutton/std",
"pallet-grandpa/std",
"pallet-sudo/std",
"pallet-partner-chains-session/std",
Expand Down
1 change: 1 addition & 0 deletions demo/runtime/src/genesis_config_presets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ fn testnet_genesis(
pallet_session: Default::default(),
session: Default::default(),
native_token_management: Default::default(),
glutton: Default::default(),
};

serde_json::to_value(config).expect("Could not build genesis config.")
Expand Down
12 changes: 10 additions & 2 deletions demo/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use frame_support::{
weights::{constants::WEIGHT_REF_TIME_PER_SECOND, IdentityFee},
BoundedVec,
};
use frame_system::EnsureRoot;
use opaque::SessionKeys;
use pallet_block_producer_metadata;
use pallet_grandpa::AuthorityId as GrandpaId;
Expand Down Expand Up @@ -205,7 +206,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
/// up by `pallet_aura` to implement `fn slot_duration()`.
///
/// Change this to adjust the block time.
pub const MILLISECS_PER_BLOCK: u64 = 6000;
pub const MILLISECS_PER_BLOCK: u64 = 12000;

// NOTE: Currently it is not possible to change the slot duration after the chain has started.
// Attempting to do so will brick block production.
Expand All @@ -221,7 +222,7 @@ const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
/// We allow for 2 seconds of compute with a 6 second average block time.
pub const MAXIMUM_BLOCK_WEIGHT: Weight =
Weight::from_parts(WEIGHT_REF_TIME_PER_SECOND.saturating_mul(2), u64::MAX);
pub const MAXIMUM_BLOCK_LENGTH: u32 = 5 * 1024 * 1024;
pub const MAXIMUM_BLOCK_LENGTH: u32 = 50 * 1024 * 1024;

parameter_types! {
pub const BlockHashCount: BlockNumber = 2400;
Expand Down Expand Up @@ -566,6 +567,12 @@ impl pallet_block_participation::Config for Runtime {
const TARGET_INHERENT_ID: InherentIdentifier = TestHelperPallet::INHERENT_IDENTIFIER;
}

impl pallet_glutton::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type WeightInfo = pallet_glutton::weights::SubstrateWeight<Runtime>;
type AdminOrigin = EnsureRoot<AccountId>;
}

impl crate::test_helper_pallet::Config for Runtime {}

// Create the runtime by composing the FRAME pallets that were previously configured.
Expand Down Expand Up @@ -594,6 +601,7 @@ construct_runtime!(
// The order matters!! pallet_partner_chains_session needs to come last for correct initialization order
Session: pallet_partner_chains_session,
NativeTokenManagement: pallet_native_token_management,
Glutton: pallet_glutton,
TestHelperPallet: crate::test_helper_pallet,
}
);
Expand Down
Loading