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

staking multiple nominations #189

Merged
merged 26 commits into from
Feb 3, 2021
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
1614b9c
rename CandidateState to Validator and redefine to match Exposure
4meta5 Jan 18, 2021
c439d7f
feat multiple nominations
4meta5 Jan 19, 2021
3603658
clean
4meta5 Jan 19, 2021
11da16c
unit test multiple nominations
4meta5 Jan 19, 2021
0cba05e
add stakers as separate field to chainspec with fmt that matches stak…
4meta5 Jan 19, 2021
2144420
verify nominations are returned when validator exits
4meta5 Jan 20, 2021
acb5ef1
Merge branch 'master' into staking-inflation
4meta5 Jan 20, 2021
eca5201
candidate bond more less
4meta5 Jan 21, 2021
e4b3a57
nominator bond more less
4meta5 Jan 21, 2021
1cd65aa
fmt
4meta5 Jan 21, 2021
00d9923
switch nominatiion
4meta5 Jan 24, 2021
59e1341
clean
4meta5 Jan 25, 2021
b2de65a
cannot switch to same nomination
4meta5 Jan 25, 2021
a08d62b
remove BlockNumber generic from ValidatorStatus
4meta5 Jan 25, 2021
1676494
more payout distribution unit tests
4meta5 Jan 26, 2021
4484b30
fmt
4meta5 Jan 26, 2021
30f1d45
pay validators before nominators
4meta5 Jan 27, 2021
a629b82
remove hidden default fee from genesis config and create no fee valid…
4meta5 Jan 27, 2021
ee9bb11
master.into()
4meta5 Jan 27, 2021
a47d0d1
bump impl version to 11
4meta5 Jan 27, 2021
6dc665c
fix genesis config
4meta5 Jan 28, 2021
45bcea2
improve test env naming and organization
4meta5 Feb 3, 2021
10dcedb
master.into
4meta5 Feb 3, 2021
84c7b90
clean
4meta5 Feb 3, 2021
9243e61
fix merge into master
4meta5 Feb 3, 2021
06f7fab
tests cover all decl error variants
4meta5 Feb 3, 2021
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
19 changes: 10 additions & 9 deletions node/parachain/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

use cumulus_primitives::ParaId;
use moonbeam_runtime::{
AccountId, BalancesConfig, EVMConfig, EthereumChainIdConfig, EthereumConfig, GenesisConfig,
ParachainInfoConfig, StakeConfig, SudoConfig, SystemConfig, GLMR, WASM_BINARY,
AccountId, Balance, BalancesConfig, EVMConfig, EthereumChainIdConfig, EthereumConfig,
GenesisConfig, ParachainInfoConfig, StakeConfig, SudoConfig, SystemConfig, GLMR, WASM_BINARY,
};
use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};
use sc_service::ChainType;
Expand Down Expand Up @@ -54,6 +54,12 @@ pub fn get_chain_spec(para_id: ParaId) -> ChainSpec {
move || {
testnet_genesis(
AccountId::from_str("6Be02d1d3665660d22FF9624b7BE0551ee1Ac91b").unwrap(),
// Validator
vec![(
AccountId::from_str("6Be02d1d3665660d22FF9624b7BE0551ee1Ac91b").unwrap(),
None,
100_000 * GLMR,
)],
vec![AccountId::from_str("6Be02d1d3665660d22FF9624b7BE0551ee1Ac91b").unwrap()],
para_id,
1280, //ChainId
Expand All @@ -72,6 +78,7 @@ pub fn get_chain_spec(para_id: ParaId) -> ChainSpec {

fn testnet_genesis(
root_key: AccountId,
stakers: Vec<(AccountId, Option<AccountId>, Balance)>,
endowed_accounts: Vec<AccountId>,
para_id: ParaId,
chain_id: u64,
Expand Down Expand Up @@ -99,12 +106,6 @@ fn testnet_genesis(
accounts: BTreeMap::new(),
}),
pallet_ethereum: Some(EthereumConfig {}),
stake: Some(StakeConfig {
stakers: endowed_accounts
.iter()
.cloned()
.map(|k| (k, None, 100_000 * GLMR))
.collect(),
}),
stake: Some(StakeConfig { stakers }),
}
}
26 changes: 17 additions & 9 deletions node/standalone/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
// along with Moonbeam. If not, see <http://www.gnu.org/licenses/>.

use moonbeam_runtime::{
AccountId, AuraConfig, BalancesConfig, EVMConfig, EthereumChainIdConfig, EthereumConfig,
GenesisConfig, GrandpaConfig, StakeConfig, SudoConfig, SystemConfig, GLMR, WASM_BINARY,
AccountId, AuraConfig, Balance, BalancesConfig, EVMConfig, EthereumChainIdConfig,
EthereumConfig, GenesisConfig, GrandpaConfig, StakeConfig, SudoConfig, SystemConfig, GLMR,
WASM_BINARY,
};
use sc_service::ChainType;
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
Expand Down Expand Up @@ -62,6 +63,12 @@ pub fn development_config() -> Result<ChainSpec, String> {
vec![authority_keys_from_seed("Alice")],
// Sudo account
AccountId::from_str("6Be02d1d3665660d22FF9624b7BE0551ee1Ac91b").unwrap(),
// Validator at genesis
vec![(
AccountId::from_str("6Be02d1d3665660d22FF9624b7BE0551ee1Ac91b").unwrap(),
None,
100_000 * GLMR,
)],
// Pre-funded accounts
vec![AccountId::from_str("6Be02d1d3665660d22FF9624b7BE0551ee1Ac91b").unwrap()],
true,
Expand Down Expand Up @@ -101,6 +108,12 @@ pub fn local_testnet_config() -> Result<ChainSpec, String> {
],
// Sudo account
AccountId::from_str("6Be02d1d3665660d22FF9624b7BE0551ee1Ac91b").unwrap(),
// Validator
vec![(
AccountId::from_str("6Be02d1d3665660d22FF9624b7BE0551ee1Ac91b").unwrap(),
None,
100_000 * GLMR,
)],
// Pre-funded accounts
vec![AccountId::from_str("6Be02d1d3665660d22FF9624b7BE0551ee1Ac91b").unwrap()],
true,
Expand All @@ -125,6 +138,7 @@ fn testnet_genesis(
wasm_binary: &[u8],
initial_authorities: Vec<(AuraId, GrandpaId)>,
root_key: AccountId,
stakers: Vec<(AccountId, Option<AccountId>, Balance)>,
endowed_accounts: Vec<AccountId>,
_enable_println: bool,
chain_id: u64,
Expand Down Expand Up @@ -161,12 +175,6 @@ fn testnet_genesis(
accounts: BTreeMap::new(),
}),
pallet_ethereum: Some(EthereumConfig {}),
stake: Some(StakeConfig {
stakers: endowed_accounts
.iter()
.cloned()
.map(|k| (k, None, 100_000 * GLMR))
.collect(),
}),
stake: Some(StakeConfig { stakers }),
}
}
Loading