Companion for substrate#14188 (Add genesis config to Glutton pallet) (#2612)

* sudo + genesis for glutton

* ".git/.scripts/commands/fmt/fmt.sh"

* add AdminOrigin to glutton

* ".git/.scripts/commands/fmt/fmt.sh"

* update Cargo.lock

---------

Co-authored-by: command-bot <>
This commit is contained in:
Ignacio Palacios
2023-05-23 16:55:28 +02:00
committed by GitHub
parent 80ca5eec92
commit e19df87f5f
6 changed files with 238 additions and 238 deletions
Generated
+203 -193
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
@@ -16,6 +16,7 @@ frame-system = { git = "https://github.com/paritytech/substrate", default-featur
frame-system-benchmarking = { git = "https://github.com/paritytech/substrate", optional = true, default-features = false, branch = "master" }
frame-try-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "master" }
pallet-glutton = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "master" }
pallet-sudo = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "master" }
sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
sp-block-builder = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
@@ -59,6 +60,7 @@ std = [
"frame-support/std",
"frame-system/std",
"pallet-glutton/std",
"pallet-sudo/std",
"sp-api/std",
"sp-block-builder/std",
"sp-core/std",
@@ -82,4 +84,5 @@ try-runtime = [
"frame-executive/try-runtime",
"frame-try-runtime/try-runtime",
"pallet-glutton/try-runtime",
"pallet-sudo/try-runtime",
]
@@ -76,7 +76,10 @@ pub use frame_support::{
},
StorageValue,
};
use frame_system::limits::{BlockLength, BlockWeights};
use frame_system::{
limits::{BlockLength, BlockWeights},
EnsureRoot,
};
use parachains_common::{AccountId, Signature};
#[cfg(any(feature = "std", test))]
pub use sp_runtime::BuildStorage;
@@ -187,6 +190,13 @@ impl parachain_info::Config for Runtime {}
impl pallet_glutton::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type WeightInfo = weights::pallet_glutton::WeightInfo<Runtime>;
type AdminOrigin = EnsureRoot<AccountId>;
}
impl pallet_sudo::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
type WeightInfo = ();
}
construct_runtime! {
@@ -205,7 +215,10 @@ construct_runtime! {
CumulusXcm: cumulus_pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin} = 10,
// The main stage.
Glutton: pallet_glutton::{Pallet, Call, Storage, Event} = 20,
Glutton: pallet_glutton::{Pallet, Call, Storage, Event, Config} = 20,
// Sudo.
Sudo: pallet_sudo::{Pallet, Call, Storage, Event<T>, Config<T>} = 255,
}
}
+10 -1
View File
@@ -14,9 +14,10 @@
// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
use crate::chain_spec::Extensions;
use crate::chain_spec::{get_account_id_from_seed, Extensions};
use cumulus_primitives_core::ParaId;
use sc_service::ChainType;
use sp_core::sr25519;
/// Specialized `ChainSpec` for the Glutton parachain runtime.
pub type GluttonChainSpec =
@@ -86,5 +87,13 @@ fn glutton_genesis(parachain_id: ParaId) -> glutton_runtime::GenesisConfig {
},
parachain_info: glutton_runtime::ParachainInfoConfig { parachain_id },
parachain_system: Default::default(),
glutton: glutton_runtime::GluttonConfig {
compute: Default::default(),
storage: Default::default(),
trash_data_count: Default::default(),
},
sudo: glutton_runtime::SudoConfig {
key: Some(get_account_id_from_seed::<sr25519::Public>("Alice")),
},
}
}
+7 -7
View File
@@ -27,7 +27,7 @@ pub use pallet_balances::AccountData;
pub use paste;
pub use sp_arithmetic::traits::Bounded;
pub use sp_core::storage::Storage;
pub use sp_io::TestExternalities;
pub use sp_io;
pub use sp_std::{cell::RefCell, collections::vec_deque::VecDeque, marker::PhantomData};
pub use sp_trie::StorageProof;
@@ -296,12 +296,12 @@ macro_rules! __impl_test_ext_for_relay_chain {
// impl
(@impl $name:ident, $genesis:expr, $on_init:expr, $ext_name:ident) => {
thread_local! {
pub static $ext_name: $crate::RefCell<$crate::TestExternalities>
pub static $ext_name: $crate::RefCell<$crate::sp_io::TestExternalities>
= $crate::RefCell::new(<$name>::build_new_ext($genesis));
}
impl TestExt for $name {
fn build_new_ext(storage: $crate::Storage) -> $crate::TestExternalities {
fn build_new_ext(storage: $crate::Storage) -> $crate::sp_io::TestExternalities {
let mut ext = sp_io::TestExternalities::new(storage);
ext.execute_with(|| {
#[allow(clippy::no_effect)]
@@ -312,7 +312,7 @@ macro_rules! __impl_test_ext_for_relay_chain {
ext
}
fn new_ext() -> $crate::TestExternalities {
fn new_ext() -> $crate::sp_io::TestExternalities {
<$name>::build_new_ext($genesis)
}
@@ -523,12 +523,12 @@ macro_rules! __impl_test_ext_for_parachain {
// impl
(@impl $name:ident, $genesis:expr, $on_init:expr, $ext_name:ident) => {
thread_local! {
pub static $ext_name: $crate::RefCell<$crate::TestExternalities>
pub static $ext_name: $crate::RefCell<$crate::sp_io::TestExternalities>
= $crate::RefCell::new(<$name>::build_new_ext($genesis));
}
impl TestExt for $name {
fn build_new_ext(storage: $crate::Storage) -> $crate::TestExternalities {
fn build_new_ext(storage: $crate::Storage) -> $crate::sp_io::TestExternalities {
let mut ext = sp_io::TestExternalities::new(storage);
ext.execute_with(|| {
#[allow(clippy::no_effect)]
@@ -539,7 +539,7 @@ macro_rules! __impl_test_ext_for_parachain {
ext
}
fn new_ext() -> $crate::TestExternalities {
fn new_ext() -> $crate::sp_io::TestExternalities {
<$name>::build_new_ext($genesis)
}