Skip to content

Commit 3266d01

Browse files
MrishoLukambarphmeier
authored andcommitted
removed option value in Genesis Config
1 parent 230f226 commit 3266d01

File tree

2 files changed

+18
-20
lines changed
  • sugondat/chain
    • node/src/chain_spec
    • pallets/length-fee-adjustment/src

2 files changed

+18
-20
lines changed

sugondat/chain/node/src/chain_spec/mod.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};
33
use sc_service::ChainType;
44
use serde::{Deserialize, Serialize};
55
use sp_core::{sr25519, Pair, Public};
6-
use sp_runtime::{traits::{IdentifyAccount, Verify}, Perquintill};
6+
use sp_runtime::{traits::{IdentifyAccount, Verify}, FixedPointNumber, Perquintill};
77
use sugondat_kusama_runtime::Runtime;
88
use sugondat_primitives::{AccountId, AuraId, Signature};
99
use sugondat_test_runtime::{Runtime as TestRuntime,Multiplier, EXISTENTIAL_DEPOSIT as TEST_EXISTENTIAL_DEPOSIT};
@@ -123,8 +123,8 @@ pub fn development_config() -> TestRuntimeChainSpec {
123123
],
124124
get_account_id_from_seed::<sr25519::Public>("Alice"),
125125
1000.into(),
126-
None,
127-
None
126+
Multiplier::saturating_from_integer(1),
127+
Perquintill::from_percent(16)
128128
))
129129
.build()
130130
}
@@ -167,8 +167,8 @@ pub fn kusama_staging_config() -> KusamaRuntimeChainSpec {
167167
vec![], // no endowed accounts - must teleport.
168168
get_account_id_from_seed::<sr25519::Public>("Alice"),
169169
KUSAMA_PARA_ID.into(),
170-
None,
171-
None
170+
Multiplier::saturating_from_integer(1),
171+
Perquintill::from_percent(16)
172172
))
173173
.build()
174174
}
@@ -221,8 +221,8 @@ pub fn local_testnet_config() -> TestRuntimeChainSpec {
221221
],
222222
get_account_id_from_seed::<sr25519::Public>("Alice"),
223223
1000.into(),
224-
None,
225-
None
224+
Multiplier::saturating_from_integer(1),
225+
Perquintill::from_percent(16)
226226
))
227227
.build()
228228
}
@@ -232,8 +232,8 @@ fn test_runtime_genesis_patch(
232232
endowed_accounts: Vec<AccountId>,
233233
root: AccountId,
234234
id: ParaId,
235-
next_len_mult: Option<Multiplier>,
236-
target_block_size: Option<Perquintill>
235+
next_len_mult: Multiplier,
236+
target_block_size: Perquintill
237237
) -> serde_json::Value {
238238
serde_json::json! ({
239239
"balances": {
@@ -274,8 +274,8 @@ fn kusama_runtime_genesis_patch(
274274
endowed_accounts: Vec<AccountId>,
275275
root: AccountId,
276276
id: ParaId,
277-
next_len_mult: Option<Multiplier>,
278-
target_block_size: Option<Perquintill>
277+
next_len_mult: Multiplier,
278+
target_block_size: Perquintill
279279
) -> serde_json::Value {
280280
serde_json::json! ({
281281
"balances": {

sugondat/chain/pallets/length-fee-adjustment/src/lib.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -141,26 +141,24 @@ pub mod pallet {
141141
StorageValue<_, Perquintill, ValueQuery, TargetBlockSizeDefault>;
142142

143143
/// Genesis config for setting up `NextLengthMultiplier` and `TargetBlockSize` storage values.
144-
/// Set None if the default values `NextLengthMultiplierDefault` & `TargetBlockSizeDefault` are to be used.
145144
#[pallet::genesis_config]
146145
#[derive(frame_support::DefaultNoBound)]
147146
pub struct GenesisConfig<T: Config> {
148147
/// Genesis set up for next length multiplier storage item
149-
pub next_length_multiplier: Option<Multiplier>,
148+
pub next_length_multiplier: Multiplier,
150149
/// Genesis set up for target_block_size storage item
151-
pub target_block_size: Option<Perquintill>,
150+
pub target_block_size: Perquintill,
152151
_phantom: PhantomData<T>,
153152
}
154153

155154
#[pallet::genesis_build]
156155
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
157156
fn build(&self) {
158-
if let Some(next_len_mult) = self.next_length_multiplier {
159-
NextLengthMultiplier::<T>::put(next_len_mult)
160-
}
161-
if let Some(target_block_size) = self.target_block_size {
162-
TargetBlockSize::<T>::put(target_block_size)
163-
}
157+
158+
NextLengthMultiplier::<T>::put(self.next_length_multiplier);
159+
160+
TargetBlockSize::<T>::put(self.target_block_size)
161+
164162
}
165163
}
166164

0 commit comments

Comments
 (0)