Skip to content

Commit 3f60249

Browse files
committed
Reset finitestate with less session duration and init auth nodes
1 parent 80e3dff commit 3f60249

File tree

4 files changed

+224
-131
lines changed

4 files changed

+224
-131
lines changed

assets/chain_spec_finitestate.json

Lines changed: 95 additions & 95 deletions
Large diffs are not rendered by default.

node/src/chain_spec.rs

Lines changed: 96 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ pub fn staging_testnet_config() -> Result<ChainSpec, String> {
441441
))
442442
}
443443

444-
#[cfg(any(feature = "contextfree", feature = "finitestate"))]
444+
#[cfg(feature = "contextfree")]
445445
fn contextfree_genesis_accounts() -> (
446446
Vec<(AccountId, u128)>,
447447
Vec<(
@@ -570,6 +570,99 @@ fn contextfree_genesis_accounts() -> (
570570
(endowed_accounts, initial_authorities, root_key)
571571
}
572572

573+
#[cfg(feature = "finitestate")]
574+
fn finitestate_genesis_accounts() -> (
575+
Vec<(AccountId, u128)>,
576+
Vec<(
577+
AccountId,
578+
AccountId,
579+
GrandpaId,
580+
BabeId,
581+
ImOnlineId,
582+
AuthorityDiscoveryId,
583+
)>,
584+
AccountId,
585+
) {
586+
let endowed_accounts: Vec<(AccountId, u128)> = vec![
587+
//Chainbridge pallet account
588+
(
589+
AccountId::from_ss58check("a7Qbi6onJLQu6h37oLDRCoYbYcQ7B49Tz4gxNsPP5UT5bMy4B").unwrap(),
590+
300700000 * DOLLARS,
591+
),
592+
//Team account
593+
(
594+
AccountId::from_ss58check("a7SvNLeY4LLRvUzmgEEBQwmdMExW5ZpPqBEvDDuB65nHF9hTk").unwrap(),
595+
150000000 * DOLLARS,
596+
),
597+
//Advisor account
598+
(
599+
AccountId::from_ss58check("a7QJhiA62xQR4HsCtCyEgJDVQ6eLnsQFAMXpHeYUQtoict1Zy").unwrap(),
600+
50000000 * DOLLARS,
601+
),
602+
//Eco & Dev community account
603+
(
604+
AccountId::from_ss58check("a7RFMEiomBwYPRfjDJKHKKwK1a2fdwsmB9w1bZgCyDXwMrCUa").unwrap(),
605+
220000000 * DOLLARS,
606+
),
607+
//Protocol Reserve account
608+
(
609+
AccountId::from_ss58check("a7RSYT4AXr668NGpMC3vv7h5Jqb4HYNr4cqNt9M5H4nRrjz3b").unwrap(),
610+
279270000 * DOLLARS,
611+
),
612+
];
613+
614+
let initial_authorities: Vec<(
615+
AccountId,
616+
AccountId,
617+
GrandpaId,
618+
BabeId,
619+
ImOnlineId,
620+
AuthorityDiscoveryId,
621+
)> = vec![
622+
(
623+
// a7PJf9QzaZpBxcZc1xwxCtXmexowt4i15zKDRmS3dr6cAmbjf
624+
hex!["34320a13ec8008a9b735f9acc991a1c54c399c377696f38661aa3c5fcb86f714"].into(),
625+
// a7SiPCDWkTpvmw7iWRyxpL9YKZnnHLFoYFvECBRzNFnkGsUzS
626+
hex!["cafeee6712174eb1aca3a417917e2ec2c48ac95dd2f1e86d362d801fbe2d2b65"].into(),
627+
// a7TjXAbsJ8H7hjjDr9CTiEhQqYfzbQEFkBMceDpjcHDDz6M2A
628+
hex!["f8193f2ed5a172117e517da0847f1056c0dc10b3df8695f78d91bc03c2a7a0f9"]
629+
.unchecked_into(),
630+
// a7SM7m8VQEudoEscP8antLbabujSmSRPM56JMDDgN9WPJxnCK
631+
hex!["bac6d3c69e0b13082363c93b6b440469a9066fb9dd720203d1c32e1b2fc9dc41"]
632+
.unchecked_into(),
633+
// a7SM7m8VQEudoEscP8antLbabujSmSRPM56JMDDgN9WPJxnCK
634+
hex!["bac6d3c69e0b13082363c93b6b440469a9066fb9dd720203d1c32e1b2fc9dc41"]
635+
.unchecked_into(),
636+
// a7SM7m8VQEudoEscP8antLbabujSmSRPM56JMDDgN9WPJxnCK
637+
hex!["bac6d3c69e0b13082363c93b6b440469a9066fb9dd720203d1c32e1b2fc9dc41"]
638+
.unchecked_into(),
639+
),
640+
(
641+
// a7TXW1KoxRsDwZoGKY9jhFKFLvp1VB2mSony3mftp1P6F1txD
642+
hex!["eeee65b0e5fd2a934353083cf31e0737ebd161a27cf9312be07177ad4ee0fb7e"].into(),
643+
// a7RLS2NBBmYkT3PFdjxwRSVkVGJJaANJqCCHyouBwxcwyMenA
644+
hex!["8e04d37a3692c00496060e068dd0b3933a5e98ab6abca77488637972b4ab0421"].into(),
645+
// a7NJ1SZmHcBhDRboxU4XxaumwTB8Twmi3Qwnuqd2GbnrvY1PE
646+
hex!["0776e1c83d2bcfe140e5a50aaf96d19d68f22fda9b6e14c84d4a0d15e4e6ad6a"]
647+
.unchecked_into(),
648+
// a7PTUVStVQg5n5VRmTaB9LLSEEdLKJdNGqLVzX6zYTMuabyXQ
649+
hex!["3aeb61a30ffbe647e0dd6812ff0cf48a89239b693a824eeaa7c8bcc2ae81c11e"]
650+
.unchecked_into(),
651+
// a7PTUVStVQg5n5VRmTaB9LLSEEdLKJdNGqLVzX6zYTMuabyXQ
652+
hex!["3aeb61a30ffbe647e0dd6812ff0cf48a89239b693a824eeaa7c8bcc2ae81c11e"]
653+
.unchecked_into(),
654+
// a7PTUVStVQg5n5VRmTaB9LLSEEdLKJdNGqLVzX6zYTMuabyXQ
655+
hex!["3aeb61a30ffbe647e0dd6812ff0cf48a89239b693a824eeaa7c8bcc2ae81c11e"]
656+
.unchecked_into(),
657+
),
658+
];
659+
660+
let root_key: AccountId =
661+
AccountId::from_ss58check("a7PywYxBDEBYTAfYPFGWEghzCFcTmp6fMvDR51sMMf2sotgAX").unwrap();
662+
663+
(endowed_accounts, initial_authorities, root_key)
664+
}
665+
573666
//TODO: we need to update contextfree spec when we want to launch it officially
574667
#[cfg(feature = "contextfree")]
575668
fn contextfree_config_genesis(wasm_binary: &[u8]) -> contextfree::GenesisConfig {
@@ -605,7 +698,7 @@ fn contextfree_config_genesis(wasm_binary: &[u8]) -> contextfree::GenesisConfig
605698
authorities: vec![],
606699
},
607700
staking: contextfree::StakingConfig {
608-
validator_count: 4,
701+
validator_count: 2,
609702
minimum_validator_count: 2,
610703
stakers: vec![],
611704
invulnerables: initial_authorities.iter().map(|x| x.0.clone()).collect(),
@@ -656,7 +749,7 @@ fn contextfree_config_genesis(wasm_binary: &[u8]) -> contextfree::GenesisConfig
656749

657750
#[cfg(feature = "finitestate")]
658751
fn finitestate_config_genesis(wasm_binary: &[u8]) -> finitestate::GenesisConfig {
659-
let (mut endowed_accounts, initial_authorities, root_key) = contextfree_genesis_accounts();
752+
let (mut endowed_accounts, initial_authorities, root_key) = finitestate_genesis_accounts();
660753
endowed_accounts.push((root_key.clone(), 10000 * DOLLARS));
661754

662755
initial_authorities.iter().for_each(|x| {

runtime/finitestate/src/constants.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub mod time {
2020
pub const MILLISECS_PER_BLOCK: u64 = 6000;
2121
pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK;
2222

23-
pub const EPOCH_DURATION_IN_SLOTS: BlockNumber = 4 * HOURS;
23+
pub const EPOCH_DURATION_IN_SLOTS: BlockNumber = 5 * MINUTES;
2424

2525
// Time is measured by number of blocks.
2626
pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber);

runtime/finitestate/src/lib.rs

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
125125
// `spec_version`, and `authoring_version` are the same between Wasm and native.
126126
// This value is set to 100 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use
127127
// the compatible custom types.
128-
spec_version: 1004,
128+
spec_version: 1000,
129129
impl_version: 1,
130130
apis: RUNTIME_API_VERSIONS,
131131
transaction_version: 1,
@@ -173,22 +173,22 @@ impl Contains<Call> for CallFilter {
173173
| Call::Babe(_)
174174
| Call::Sudo(_)
175175
| Call::Timestamp(_)
176-
| Call::Staking(_)
177-
| Call::Session(_)
178-
| Call::BridgeTransfer(_)
179-
| Call::ChainBridge(_)
180-
| Call::Utility(_)
181-
| Call::ElectionProviderMultiPhase(_)
182-
| Call::Balances(_) => true,
183-
184-
// These modules are not allowed to be called by transactions:
185-
// Call::Staking(_)
176+
// | Call::Staking(_)
186177
// | Call::Session(_)
187-
// Call::ElectionProviderMultiPhase(_)
188178
// | Call::BridgeTransfer(_)
189179
// | Call::ChainBridge(_)
190-
Call::Vesting(_)
191180
// | Call::Utility(_)
181+
// | Call::ElectionProviderMultiPhase(_)
182+
| Call::Balances(_) => true,
183+
184+
// These modules are not allowed to be called by transactions:
185+
Call::Staking(_)
186+
| Call::Session(_)
187+
| Call::ElectionProviderMultiPhase(_)
188+
| Call::BridgeTransfer(_)
189+
| Call::ChainBridge(_)
190+
| Call::Vesting(_)
191+
| Call::Utility(_)
192192
| Call::Democracy(_)
193193
| Call::Council(_)
194194
| Call::TechnicalCommittee(_)
@@ -378,26 +378,26 @@ impl pallet_election_provider_multi_phase::Config for Runtime {
378378
type WeightInfo = pallet_election_provider_multi_phase::weights::SubstrateWeight<Runtime>;
379379
}
380380

381-
pallet_staking_reward_curve::build! {
382-
// 4.5% min, 27.5% max, 50% ideal stake
383-
const REWARD_CURVE: PiecewiseLinear<'static> = curve!(
384-
min_inflation: 0_025_000,
385-
max_inflation: 0_100_000,
386-
ideal_stake: 0_500_000,
387-
falloff: 0_050_000,
388-
max_piece_count: 40,
389-
test_precision: 0_005_500,
390-
);
391-
}
381+
// pallet_staking_reward_curve::build! {
382+
// // 4.5% min, 27.5% max, 50% ideal stake
383+
// const REWARD_CURVE: PiecewiseLinear<'static> = curve!(
384+
// min_inflation: 0_025_000,
385+
// max_inflation: 0_100_000,
386+
// ideal_stake: 0_500_000,
387+
// falloff: 0_050_000,
388+
// max_piece_count: 40,
389+
// test_precision: 0_005_500,
390+
// );
391+
// }
392392

393-
// const REWARD_CURVE: PiecewiseLinear<'static> = PiecewiseLinear {
394-
// points: &[
395-
// (Perbill::from_parts(0), Perbill::from_parts(0)),
396-
// (Perbill::from_parts(0_500_000_000), Perbill::from_parts(0)),
397-
// (Perbill::from_parts(1_000_000_000), Perbill::from_parts(0)),
398-
// ],
399-
// maximum: Perbill::from_parts(0),
400-
// };
393+
const REWARD_CURVE: PiecewiseLinear<'static> = PiecewiseLinear {
394+
points: &[
395+
(Perbill::from_parts(0), Perbill::from_parts(0)),
396+
(Perbill::from_parts(0_500_000_000), Perbill::from_parts(0)),
397+
(Perbill::from_parts(1_000_000_000), Perbill::from_parts(0)),
398+
],
399+
maximum: Perbill::from_parts(0),
400+
};
401401

402402
parameter_types! {
403403
pub const SessionsPerEra: sp_staking::SessionIndex = 6;

0 commit comments

Comments
 (0)