From a5b7fdfd0ecc2ab7f4579ec73a19ff7fd32c05cb Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Wed, 5 Sep 2018 16:06:36 +0200 Subject: [PATCH] Addition staking storage entries (#144) --- packages/type-storage/src/staking.ts | 33 ++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/packages/type-storage/src/staking.ts b/packages/type-storage/src/staking.ts index 4f456bbb7c..c3df67caeb 100644 --- a/packages/type-storage/src/staking.ts +++ b/packages/type-storage/src/staking.ts @@ -16,12 +16,19 @@ const bondingDuration: CreateItemOptions = { }; const validatorCount: CreateItemOptions = { - description: 'The number of validators', + description: 'The ideal number of staking participants', key: 'sta:vac', params: [], type: 'u32' }; +const minimumValidatorCount: CreateItemOptions = { + description: 'Minimum number of staking participants before emergency conditions are imposed', + key: 'sta:minimum_validator_count', + params: [], + type: 'u32' +}; + const sessionsPerEra: CreateItemOptions = { description: 'The length of a staking era in sessions', key: 'sta:spe', @@ -92,6 +99,13 @@ const earlyEraSlash: CreateItemOptions = { type: 'Balance' }; +const offlineSlashGrace: CreateItemOptions = { + description: 'Number of instances of offline reports before slashing begins for validators', + key: 'sta:offline_slash_grace', + params: [], + type: 'u32' +}; + const currentEra: CreateItemOptions = { description: 'The current era index', key: 'sta:era', @@ -99,6 +113,15 @@ const currentEra: CreateItemOptions = { type: 'BlockNumber' }; +const slashPreferenceOf: CreateItemOptions = { + description: 'How many times the validator should get slashed for being offline and automatically unstaked', + key: 'sta:slash_preference_of', + params: [ + param('who', 'AccountId') + ], + type: 'u32' +}; + const intentions: CreateItemOptions = { description: 'All the accounts with a desire to stake', key: 'sta:wil:', @@ -141,7 +164,7 @@ const nextSessionsPerEra: CreateItemOptions = { }; const lastEraLengthChange: CreateItemOptions = { - description: 'The block number at which the era length last changed', + description: 'The session index at which the era length last changed', key: 'sta:lec', params: [], type: 'BlockNumber' @@ -231,6 +254,8 @@ export default (name: Storage$Sections): Section => createMethod('intentions')(intentions), lastEraLengthChange: createMethod('lastEraLengthChange')(lastEraLengthChange), + minimumValidatorCount: + createMethod('minimumValidatorCount')(minimumValidatorCount), nextEnumSet: createMethod('nextEnumSet')(nextEnumSet), nextSessionsPerEra: @@ -239,8 +264,12 @@ export default (name: Storage$Sections): Section => createMethod('nominating')(nominating), nominatorsFor: createMethod('nominatorsFor')(nominatorsFor), + offlineSlashGrace: + createMethod('offlineSlashGrace')(offlineSlashGrace), reclaimRebate: createMethod('reclaimRebate')(reclaimRebate), + slashPreferenceOf: + createMethod('slashPreferenceOf')(slashPreferenceOf), stakeThreshold: createMethod('stakeThreshold')(stakeThreshold), sessionsPerEra: