Skip to content

Commit 3c45794

Browse files
Add ElectionResult type override (#6067)
1 parent 157b312 commit 3c45794

File tree

4 files changed

+26
-2
lines changed

4 files changed

+26
-2
lines changed

packages/types-augment/src/registry/interfaces.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ import type { Si0Field, Si0LookupTypeId, Si0Path, Si0Type, Si0TypeDef, Si0TypeDe
6363
import type { Period, Priority, SchedulePeriod, SchedulePriority, Scheduled, ScheduledTo254, TaskAddress } from '@polkadot/types/interfaces/scheduler';
6464
import type { BeefyKey, FullIdentification, IdentificationTuple, Keys, MembershipProof, SessionIndex, SessionKeys1, SessionKeys10, SessionKeys10B, SessionKeys2, SessionKeys3, SessionKeys4, SessionKeys5, SessionKeys6, SessionKeys6B, SessionKeys7, SessionKeys7B, SessionKeys8, SessionKeys8B, SessionKeys9, SessionKeys9B, ValidatorCount } from '@polkadot/types/interfaces/session';
6565
import type { Bid, BidKind, SocietyJudgement, SocietyVote, StrikeCount, VouchingStatus } from '@polkadot/types/interfaces/society';
66-
import type { ActiveEraInfo, CompactAssignments, CompactAssignmentsTo257, CompactAssignmentsTo265, CompactAssignmentsWith16, CompactAssignmentsWith24, CompactScore, CompactScoreCompact, ElectionCompute, ElectionPhase, ElectionResult, ElectionScore, ElectionSize, ElectionStatus, EraIndex, EraPoints, EraRewardPoints, EraRewards, Exposure, ExtendedBalance, Forcing, IndividualExposure, KeyType, MomentOf, Nominations, NominatorIndex, NominatorIndexCompact, OffchainAccuracy, OffchainAccuracyCompact, PhragmenScore, Points, RawSolution, RawSolutionTo265, RawSolutionWith16, RawSolutionWith24, ReadySolution, RewardDestination, RewardPoint, RoundSnapshot, SeatHolder, SignedSubmission, SignedSubmissionOf, SignedSubmissionTo276, SlashJournalEntry, SlashingSpans, SlashingSpansTo204, SolutionOrSnapshotSize, SolutionSupport, SolutionSupports, SpanIndex, SpanRecord, StakingLedger, StakingLedgerTo223, StakingLedgerTo240, SubmissionIndicesOf, Supports, UnappliedSlash, UnappliedSlashOther, UnlockChunk, ValidatorIndex, ValidatorIndexCompact, ValidatorPrefs, ValidatorPrefsTo145, ValidatorPrefsTo196, ValidatorPrefsWithBlocked, ValidatorPrefsWithCommission, VoteWeight, Voter } from '@polkadot/types/interfaces/staking';
66+
import type { ActiveEraInfo, CompactAssignments, CompactAssignmentsTo257, CompactAssignmentsTo265, CompactAssignmentsWith16, CompactAssignmentsWith24, CompactScore, CompactScoreCompact, ElectionCompute, ElectionPhase, ElectionResult, ElectionResultToSpec10, ElectionScore, ElectionSize, ElectionStatus, EraIndex, EraPoints, EraRewardPoints, EraRewards, Exposure, ExtendedBalance, Forcing, IndividualExposure, KeyType, MomentOf, Nominations, NominatorIndex, NominatorIndexCompact, OffchainAccuracy, OffchainAccuracyCompact, PhragmenScore, Points, RawSolution, RawSolutionTo265, RawSolutionWith16, RawSolutionWith24, ReadySolution, RewardDestination, RewardPoint, RoundSnapshot, SeatHolder, SignedSubmission, SignedSubmissionOf, SignedSubmissionTo276, SlashJournalEntry, SlashingSpans, SlashingSpansTo204, SolutionOrSnapshotSize, SolutionSupport, SolutionSupports, SpanIndex, SpanRecord, StakingLedger, StakingLedgerTo223, StakingLedgerTo240, SubmissionIndicesOf, Supports, UnappliedSlash, UnappliedSlashOther, UnlockChunk, ValidatorIndex, ValidatorIndexCompact, ValidatorPrefs, ValidatorPrefsTo145, ValidatorPrefsTo196, ValidatorPrefsWithBlocked, ValidatorPrefsWithCommission, VoteWeight, Voter } from '@polkadot/types/interfaces/staking';
6767
import type { ApiId, BlockTrace, BlockTraceEvent, BlockTraceEventData, BlockTraceSpan, KeyValueOption, MigrationStatusResult, ReadProof, RuntimeVersion, RuntimeVersionApi, RuntimeVersionPartial, RuntimeVersionPre3, RuntimeVersionPre4, SpecVersion, StorageChangeSet, TraceBlockResponse, TraceError } from '@polkadot/types/interfaces/state';
6868
import type { StatementStoreInvalidStatement, StatementStoreStatementSource, StatementStoreValidStatement } from '@polkadot/types/interfaces/statement';
6969
import type { WeightToFeeCoefficient } from '@polkadot/types/interfaces/support';
@@ -402,6 +402,7 @@ declare module '@polkadot/types/types/registry' {
402402
ElectionCompute: ElectionCompute;
403403
ElectionPhase: ElectionPhase;
404404
ElectionResult: ElectionResult;
405+
ElectionResultToSpec10: ElectionResultToSpec10;
405406
ElectionScore: ElectionScore;
406407
ElectionSize: ElectionSize;
407408
ElectionStatus: ElectionStatus;

packages/types-known/src/spec/polkadot.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,18 @@ const addrAccountIdTypes = {
3737
// these are override types for Polkadot
3838
export const versioned: OverrideVersionedType[] = [
3939
{
40-
minmax: [0, 12],
40+
minmax: [0, 10],
41+
types: {
42+
...sharedTypes,
43+
...addrAccountIdTypes,
44+
CompactAssignments: 'CompactAssignmentsTo257',
45+
OpenTip: 'OpenTipTo225',
46+
RefCount: 'RefCountTo259',
47+
ElectionResult: 'ElectionResultToSpec10'
48+
}
49+
},
50+
{
51+
minmax: [11, 12],
4152
types: {
4253
...sharedTypes,
4354
...addrAccountIdTypes,

packages/types/src/interfaces/staking/definitions.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ const phragmen = {
102102
electedStashes: 'Vec<AccountId>',
103103
exposures: 'Vec<(AccountId, Exposure)>'
104104
},
105+
ElectionResultToSpec10: {
106+
electedStashes: 'Vec<AccountId>',
107+
exposures: 'Vec<(AccountId, Exposure<AccountId, Balance>)>',
108+
compute: 'ElectionCompute'
109+
},
105110
ElectionScore: '[u128; 3]',
106111
ElectionSize: {
107112
validators: 'Compact<ValidatorIndex>',

packages/types/src/interfaces/staking/types.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,13 @@ export interface ElectionResult extends Struct {
117117
readonly exposures: Vec<ITuple<[AccountId, Exposure]>>;
118118
}
119119

120+
/** @name ElectionResultToSpec10 */
121+
export interface ElectionResultToSpec10 extends Struct {
122+
readonly electedStashes: Vec<AccountId>;
123+
readonly exposures: Vec<ITuple<[AccountId, Exposure]>>;
124+
readonly compute: ElectionCompute;
125+
}
126+
120127
/** @name ElectionScore */
121128
export interface ElectionScore extends Vec<u128> {}
122129

0 commit comments

Comments
 (0)