Update metadata (Babe updates) (#1410)

* Update metadata (Babe updates)

* Bump with latest master

* Use genesisSlot as opposed to epochStartSlot (wrongly)

* Calculate session from genesis start

* Re-create after master merge

* Kusama CC1 chain type overrides
This commit is contained in:
Jaco Greeff
2019-09-24 16:47:04 +02:00
committed by GitHub
parent 539b26ed87
commit 8de45cb09e
8 changed files with 231 additions and 115 deletions
+13 -6
View File
@@ -15,7 +15,7 @@ import { drr } from '../util/drr';
import { bestNumber } from '../chain';
type Result0to94 = [BlockNumber, [SessionIndex, Option<BlockNumber>, BN, BN, SessionIndex]];
type Result = [[u64, SessionIndex], [u64, u64, u64], [SessionIndex, EraIndex]];
type Result = [[boolean, boolean, u64, SessionIndex], [u64, u64, u64], [SessionIndex, EraIndex]];
const ZERO = new BN(0);
const ONE = new BN(1);
@@ -49,21 +49,24 @@ function createDerived0to94 ([bestNumber, [currentIndex, _lastLengthChange, sess
} as unknown as DerivedSessionInfo;
}
function createDerived ([[epochDuration, sessionsPerEra], [currentSlot, epochIndex, epochStartSlot], [currentIndex, currentEra]]: Result): DerivedSessionInfo {
function createDerived ([[hasBabe, isGenesisSlot, epochDuration, sessionsPerEra], [currentSlot, epochIndex, epochOrGenesisStartSlot], [currentIndex, currentEra]]: Result): DerivedSessionInfo {
const epochStartSlot = isGenesisSlot
? epochIndex
.mul(epochDuration)
.add(epochOrGenesisStartSlot)
: epochOrGenesisStartSlot;
const sessionProgress = currentSlot.sub(epochStartSlot);
const eraProgress = epochIndex
.mod(sessionsPerEra)
.mul(epochDuration)
.add(sessionProgress);
// FIXME This alwasy assumes Babe, as per the substrate defaults - at least for
// aura the `isEpoch` should be false
return {
currentEra,
currentIndex,
eraLength: sessionsPerEra.mul(epochDuration),
eraProgress,
isEpoch: true,
isEpoch: hasBabe,
lastEraLengthChange: ZERO,
lastLengthChange: epochStartSlot,
sessionLength: epochDuration,
@@ -104,6 +107,8 @@ export function info (api: ApiInterfaceRx): () => Observable<DerivedSessionInfo>
// substrate spec_version >= 94 : get from parameter_types exposed as api.consts
// https://github.com/paritytech/substrate/pull/2802/files#diff-5e5e1c3aec9ddfde0a9054d062ab3db9R156
of([
hasBabe,
!!api.query.babe.genesisSlot,
hasBabe
? api.consts.babe.epochDuration
: ONE,
@@ -113,7 +118,9 @@ export function info (api: ApiInterfaceRx): () => Observable<DerivedSessionInfo>
? api.queryMulti([
api.query.babe.currentSlot,
api.query.babe.epochIndex,
api.query.babe.epochStartSlot
api.query.babe.genesisSlot
? api.query.babe.genesisSlot
: api.query.babe.epochStartSlot
])
: of([ONE, ONE, ONE]),
api.queryMulti([
+12 -2
View File
@@ -38,7 +38,15 @@ const TYPES_SUBSTRATE_1 = {
ValidatorPrefs: 'ValidatorPrefs0to145'
};
// Type overrides for specific spec types as given in runtimeVersion
// Type overrides based on specific nodes
const TYPES_CHAIN: Record<string, Record<string, string>> = {
// TODO Remove this once it is not needed, i.e. upgraded
'Kusama CC1': {
RawBabePreDigest: 'RawBabePreDigest0to159'
}
};
// Type overrides for specific spec types as given in runtimeVersion
const TYPES_SPEC: Record<string, Record<string, string>> = {
kusama: TYPES_FOR_POLKADOT,
polkadot: TYPES_FOR_POLKADOT
@@ -100,12 +108,14 @@ export default abstract class Init<ApiType> extends Decorate<ApiType> {
this._rpcCore.system.properties().toPromise()
]);
const specName = runtimeVersion.specName.toString();
const chainName = chain.toString();
// based on the node spec & chain, inject specific type overrides
this.registerTypes({
...(TYPES_SPEC[specName] || {}),
...(TYPES_CHAIN[chainName] || {}),
...(typesSpec[specName] || {}),
...(typesChain[chain.toString()] || {})
...(typesChain[chainName] || {})
});
// filter the RPC methods (this does an rpc-methods call)
+4 -5
View File
@@ -6,7 +6,7 @@ import { Option, U8a, Vec } from '@polkadot/types/codec';
import { Bytes, Null, bool, i8, u32, u64 } from '@polkadot/types';
import { AccountId, AccountIndex, Balance, BalanceOf, BlockNumber, Hash, Index, KeyTypeId, Moment, Perbill, ValidatorId, Weight, WeightMultiplier } from '@polkadot/types/interfaces/runtime';
import { UncleEntryItem } from '@polkadot/types/interfaces/authorship';
import { BabeAuthorityWeight } from '@polkadot/types/interfaces/babe';
import { BabeAuthorityWeight, MaybeVrf } from '@polkadot/types/interfaces/babe';
import { BalanceLock, VestingSchedule } from '@polkadot/types/interfaces/balances';
import { ProposalIndex, Votes } from '@polkadot/types/interfaces/collective';
import { AuthorityId } from '@polkadot/types/interfaces/consensus';
@@ -46,15 +46,13 @@ declare module './types' {
[index: string]: QueryableStorageEntry<ApiType>;
epochIndex: StorageEntryExact<ApiType, () => Observable<u64>> & QueryableStorageEntry<ApiType>;
authorities: StorageEntryExact<ApiType, () => Observable<Vec<ITuple<[AuthorityId, BabeAuthorityWeight]>>>> & QueryableStorageEntry<ApiType>;
epochStartSlot: StorageEntryExact<ApiType, () => Observable<u64>> & QueryableStorageEntry<ApiType>;
genesisSlot: StorageEntryExact<ApiType, () => Observable<u64>> & QueryableStorageEntry<ApiType>;
currentSlot: StorageEntryExact<ApiType, () => Observable<u64>> & QueryableStorageEntry<ApiType>;
secondarySlots: StorageEntryExact<ApiType, () => Observable<ITuple<[bool, bool]>>> & QueryableStorageEntry<ApiType>;
pendingSecondarySlotsChange: StorageEntryExact<ApiType, () => Observable<bool>> & QueryableStorageEntry<ApiType>;
randomness: StorageEntryExact<ApiType, () => Observable<U8a>> & QueryableStorageEntry<ApiType>;
nextRandomness: StorageEntryExact<ApiType, () => Observable<U8a>> & QueryableStorageEntry<ApiType>;
segmentIndex: StorageEntryExact<ApiType, () => Observable<u32>> & QueryableStorageEntry<ApiType>;
underConstruction: StorageEntryExact<ApiType, (arg: u32 | Uint8Array | number | string) => Observable<Vec<U8a>>> & QueryableStorageEntry<ApiType>;
initialized: StorageEntryExact<ApiType, () => Observable<bool>> & QueryableStorageEntry<ApiType>;
initialized: StorageEntryExact<ApiType, () => Observable<MaybeVrf>> & QueryableStorageEntry<ApiType>;
};
timestamp: {
[index: string]: QueryableStorageEntry<ApiType>;
@@ -108,6 +106,7 @@ declare module './types' {
currentIndex: StorageEntryExact<ApiType, () => Observable<SessionIndex>> & QueryableStorageEntry<ApiType>;
queuedChanged: StorageEntryExact<ApiType, () => Observable<bool>> & QueryableStorageEntry<ApiType>;
queuedKeys: StorageEntryExact<ApiType, () => Observable<Vec<ITuple<[ValidatorId, Keys]>>>> & QueryableStorageEntry<ApiType>;
disabledValidators: StorageEntryExact<ApiType, () => Observable<Vec<u32>>> & QueryableStorageEntry<ApiType>;
nextKeys: StorageEntryExact<ApiType, (key1: Bytes | Uint8Array | string, key2: ValidatorId | Uint8Array | string) => Observable<Keys>> & QueryableStorageEntry<ApiType>;
keyOwner: StorageEntryExact<ApiType, (key1: Bytes | Uint8Array | string, key2: ITuple<[KeyTypeId, Bytes]>) => Observable<ValidatorId>> & QueryableStorageEntry<ApiType>;
};
@@ -327,16 +327,15 @@
]
},
{
"name": "EpochStartSlot",
"name": "GenesisSlot",
"modifier": 1,
"type": {
"Type": "u64"
},
"fallback": "0x0000000000000000",
"documentation": [
" Slot at which the current epoch started. It is possible that no",
" block was authored at the given slot and the epoch change was",
" signalled later than this."
" The slot at which the first epoch actually started. This is 0",
" until the first block of the chain."
]
},
{
@@ -350,30 +349,6 @@
" Current slot number."
]
},
{
"name": "SecondarySlots",
"modifier": 1,
"type": {
"Type": "(bool,bool)"
},
"fallback": "0x0101",
"documentation": [
" Whether secondary slots are enabled in case the VRF-based slot is",
" empty for the current epoch and the next epoch, respectively."
]
},
{
"name": "PendingSecondarySlotsChange",
"modifier": 0,
"type": {
"Type": "bool"
},
"fallback": "0x00",
"documentation": [
" Pending change to enable/disable secondary slots which will be",
" triggered at `current_epoch + 2`."
]
},
{
"name": "Randomness",
"modifier": 1,
@@ -442,32 +417,17 @@
"name": "Initialized",
"modifier": 0,
"type": {
"Type": "bool"
"Type": "MaybeVrf"
},
"fallback": "0x00",
"documentation": [
" Temporary value (cleared at block finalization) which is true",
" Temporary value (cleared at block finalization) which is `Some`",
" if per-block initialization has already been called for current block."
]
}
]
},
"calls": [
{
"name": "set_pending_secondary_slots_change",
"args": [
{
"name": "change",
"type": "Option<bool>"
}
],
"documentation": [
" Sets a pending change to enable / disable secondary slot assignment.",
" The pending change will be set at the end of the current epoch and",
" will be enacted at `current_epoch + 2`."
]
}
],
"calls": [],
"events": null,
"constants": [
{
@@ -1569,6 +1529,19 @@
" will be used to determine the validator's session keys."
]
},
{
"name": "DisabledValidators",
"modifier": 1,
"type": {
"Type": "Vec<u32>"
},
"fallback": "0x00",
"documentation": [
" Indices of disabled validators.",
"",
" The set is cleared when `on_session_ending` returns a new set of identities."
]
},
{
"name": "NextKeys",
"modifier": 0,
@@ -2789,10 +2762,10 @@
},
"fallback": "0x00",
"documentation": [
" The current membership. When there's a vote going on, this should still be used for executive",
" matters. The block number (second element in the tuple) is the block that their position is",
" active until (calculated by the sum of the block number when the member was elected",
" and their term duration)."
" The current membership. When there's a vote going on, this should still be used for",
" executive matters. The block number (second element in the tuple) is the block that",
" their position is active until (calculated by the sum of the block number when the",
" member was elected and their term duration)."
]
},
{
@@ -2818,13 +2791,7 @@
}
},
"fallback": "0x00",
"documentation": [
" A list of votes for each voter. The votes are stored as numeric values and parsed in a bit-wise manner.",
"",
" In order to get a human-readable representation (`Vec<bool>`), use [`all_approvals_of`].",
"",
" Furthermore, each vector of scalars is chunked with the cap of `APPROVAL_SET_SIZE`."
]
"documentation": []
},
{
"name": "RegisterInfoOf",
@@ -2839,8 +2806,8 @@
},
"fallback": "0x00",
"documentation": [
" The vote index and list slot that the candidate `who` was registered or `None` if they are not",
" currently registered."
" The vote index and list slot that the candidate `who` was registered or `None` if they",
" are not currently registered."
]
},
{
@@ -2938,8 +2905,9 @@
},
"fallback": "0x00",
"documentation": [
" Get the leaderboard if we're in the presentation phase. The first element is the weight of each entry;",
" It may be the direct summed approval stakes, or a weighted version of it."
" Get the leaderboard if we're in the presentation phase. The first element is the weight",
" of each entry; It may be the direct summed approval stakes, or a weighted version of it.",
" Sorted from low to high."
]
},
{
@@ -2976,27 +2944,31 @@
{
"name": "hint",
"type": "SetIndex"
},
{
"name": "value",
"type": "BalanceOf"
}
],
"documentation": [
" Set candidate approvals. Approval slots stay valid as long as candidates in those slots",
" are registered.",
"",
" Locks the total balance of caller indefinitely.",
" Only [`retract_voter`] or [`reap_inactive_voter`] can unlock the balance.",
" Locks `value` from the balance of `origin` indefinitely. Only [`retract_voter`] or",
" [`reap_inactive_voter`] can unlock the balance.",
"",
" `hint` argument is interpreted differently based on:",
" - if `origin` is setting approvals for the first time: The index will be checked",
" for being a valid _hole_ in the voter list.",
" - if `origin` is setting approvals for the first time: The index will be checked for",
" being a valid _hole_ in the voter list.",
" - if the hint is correctly pointing to a hole, no fee is deducted from `origin`.",
" - Otherwise, the call will succeed but the index is ignored and simply a push to the last chunk",
" with free space happens. If the new push causes a new chunk to be created, a fee indicated by",
" [`VotingFee`] is deducted.",
" - Otherwise, the call will succeed but the index is ignored and simply a push to the",
" last chunk with free space happens. If the new push causes a new chunk to be",
" created, a fee indicated by [`VotingFee`] is deducted.",
" - if `origin` is already a voter: the index __must__ be valid and point to the correct",
" position of the `origin` in the current voters list.",
" position of the `origin` in the current voters list.",
"",
" Note that any trailing `false` votes in `votes` is ignored; In approval voting, not voting for a candidate",
" and voting false, are equal.",
" Note that any trailing `false` votes in `votes` is ignored; In approval voting, not",
" voting for a candidate and voting false, are equal.",
"",
" # <weight>",
" - O(1).",
@@ -3019,11 +2991,15 @@
{
"name": "hint",
"type": "SetIndex"
},
{
"name": "value",
"type": "BalanceOf"
}
],
"documentation": [
" Set candidate approvals from a proxy. Approval slots stay valid as long as candidates in those slots",
" are registered.",
" Set candidate approvals from a proxy. Approval slots stay valid as long as candidates in",
" those slots are registered.",
"",
" # <weight>",
" - Same as `set_approvals` with one additional storage read.",
@@ -3052,8 +3028,8 @@
],
"documentation": [
" Remove a voter. For it not to be a bond-consuming no-op, all approved candidate indices",
" must now be either unregistered or registered to a candidate that registered the slot after",
" the voter gave their last approval set.",
" must now be either unregistered or registered to a candidate that registered the slot",
" after the voter gave their last approval set.",
"",
" Both indices must be provided as explained in [`voter_at`] function.",
"",
@@ -3127,9 +3103,10 @@
}
],
"documentation": [
" Claim that `signed` is one of the top Self::carry_count() + current_vote().1 candidates.",
" Only works if the `block_number >= current_vote().0` and `< current_vote().0 + presentation_duration()`",
" `signed` should have at least",
" Claim that `candidate` is one of the top `carry_count + desired_seats` candidates. Only",
" works iff the presentation period is active. `candidate` should have at least collected",
" some non-zero `total` votes and `origin` must have enough funds to pay for a potential",
" slash.",
"",
" # <weight>",
" - O(voters) compute.",
@@ -3297,6 +3274,14 @@
" is 1000."
]
},
{
"name": "MinimumVotingLock",
"type": "BalanceOf",
"value": "0x00407a10f35a00000000000000000000",
"documentation": [
" Minimum about that can be used as the locked value for voting."
]
},
{
"name": "DecayRatio",
"type": "u32",
@@ -3973,7 +3958,7 @@
]
},
{
"name": "create",
"name": "instantiate",
"args": [
{
"name": "endowment",
@@ -3993,9 +3978,9 @@
}
],
"documentation": [
" Creates a new contract from the `codehash` generated by `put_code`, optionally transferring some balance.",
" Instantiates a new contract from the `codehash` generated by `put_code`, optionally transferring some balance.",
"",
" Creation is executed as follows:",
" Instantiation is executed as follows:",
"",
" - The destination address is computed based on the sender and hash of the code.",
" - The smart-contract account is created at the computed address.",
@@ -4035,7 +4020,7 @@
"Balance"
],
"documentation": [
" Transfer happened `from` to `to` with given `value` as part of a `call` or `create`."
" Transfer happened `from` to `to` with given `value` as part of a `call` or `instantiate`."
]
},
{
@@ -4113,8 +4098,8 @@
"type": "u32",
"value": "0x08000000",
"documentation": [
" Size of a contract at the time of creation. This is a simple way to ensure",
" that empty contracts eventually gets deleted."
" Size of a contract at the time of instantiaion. This is a simple way to ensure that",
" empty contracts eventually gets deleted."
]
},
{
@@ -4185,7 +4170,7 @@
"type": "BalanceOf",
"value": "0x0010a5d4e80000000000000000000000",
"documentation": [
" The fee required to create a contract instance. A reasonable default value",
" The fee required to instantiate a contract instance. A reasonable default value",
" is 21."
]
},
@@ -4199,11 +4184,11 @@
]
},
{
"name": "CreateBaseFee",
"name": "InstantiateBaseFee",
"type": "Gas",
"value": "0xe803000000000000",
"documentation": [
" The base fee charged for creating a contract. A reasonable default value",
" The base fee charged for instantiating a contract. A reasonable default value",
" is 175."
]
},
@@ -4212,7 +4197,7 @@
"type": "u32",
"value": "0x00040000",
"documentation": [
" The maximum nesting level of a call/create stack. A reasonable default",
" The maximum nesting level of a call/instantiate stack. A reasonable default",
" value is 100."
]
},
@@ -4270,7 +4255,8 @@
" # <weight>",
" - O(1).",
" - Limited storage reads.",
" - No DB writes.",
" - One DB write (event).",
" - Unknown weight of derivative `proposal` execution.",
" # </weight>"
]
},
@@ -4293,6 +4279,32 @@
" - One DB change.",
" # </weight>"
]
},
{
"name": "sudo_as",
"args": [
{
"name": "who",
"type": "Address"
},
{
"name": "proposal",
"type": "Proposal"
}
],
"documentation": [
" Authenticates the sudo key and dispatches a function call with `Signed` origin from",
" a given account.",
"",
" The dispatch origin for this call must be _Signed_.",
"",
" # <weight>",
" - O(1).",
" - Limited storage reads.",
" - One DB write (event).",
" - Unknown weight of derivative `proposal` execution.",
" # </weight>"
]
}
],
"events": [
@@ -4313,6 +4325,15 @@
"documentation": [
" The sudoer just switched identity; the old key is supplied."
]
},
{
"name": "SudoAsDone",
"args": [
"bool"
],
"documentation": [
" A sudo just took place."
]
}
],
"constants": []
File diff suppressed because one or more lines are too long
+19 -1
View File
@@ -6,7 +6,7 @@ import { Bytes, Data, Fixed64, H160, H256, H512, Null, StorageData, StorageHashe
import { AccountId, AccountIdOf, AccountIndex, Address, AssetId, Balance, BalanceOf, Block, BlockNumber, Call, Consensus, ConsensusEngineId, Digest, DigestItem, Ed25519Signature, Extrinsic, ExtrinsicEra, ExtrinsicPayload, ExtrinsicPayloadUnknown, ExtrinsicPayloadV1, ExtrinsicPayloadV2, ExtrinsicPayloadV3, ExtrinsicUnknown, ExtrinsicV1, ExtrinsicV2, ExtrinsicV3, Hash, Header, ImmortalEra, Index, Justification, KeyTypeId, KeyValue, LockIdentifier, Moment, MortalEra, Origin, Perbill, Permill, Phantom, PhantomData, PreRuntime, Seal, SealV0, Signature, SignedBlock, SignerPayload, Sr25519Signature, ValidatorId, Weight, WeightMultiplier } from './interfaces/runtime';
import { InclusionHeight, Uncle, UncleEntryItem } from './interfaces/authorship';
import { RawAuraPreDigest } from './interfaces/aura';
import { BabeAuthorityWeight, BabeBlockWeight, BabeWeight, RawBabePreDigest, RawBabePreDigestPrimary, RawBabePreDigestSecondary, SlotNumber } from './interfaces/babe';
import { BabeAuthorityWeight, BabeBlockWeight, BabeWeight, MaybeVrf, RawBabePreDigest, RawBabePreDigest0to159, RawBabePreDigestPrimary, RawBabePreDigestPrimary0to159, RawBabePreDigestSecondary, RawBabePreDigestSecondary0to159, SlotNumber, VrfData, VrfProof } from './interfaces/babe';
import { BalanceLock, VestingSchedule, WithdrawReasons } from './interfaces/balances';
import { MemberCount, ProposalIndex, Votes } from './interfaces/collective';
import { AuthorityId } from './interfaces/consensus';
@@ -298,6 +298,9 @@ export interface InterfaceRegistry {
'Compact<BabeBlockWeight>': Compact<BabeBlockWeight>;
'Option<BabeBlockWeight>': Option<BabeBlockWeight>;
'Vec<BabeBlockWeight>': Vec<BabeBlockWeight>;
MaybeVrf: MaybeVrf;
'Option<MaybeVrf>': Option<MaybeVrf>;
'Vec<MaybeVrf>': Vec<MaybeVrf>;
BabeWeight: BabeWeight;
'Compact<BabeWeight>': Compact<BabeWeight>;
'Option<BabeWeight>': Option<BabeWeight>;
@@ -311,10 +314,25 @@ export interface InterfaceRegistry {
RawBabePreDigestSecondary: RawBabePreDigestSecondary;
'Option<RawBabePreDigestSecondary>': Option<RawBabePreDigestSecondary>;
'Vec<RawBabePreDigestSecondary>': Vec<RawBabePreDigestSecondary>;
RawBabePreDigest0to159: RawBabePreDigest0to159;
'Option<RawBabePreDigest0to159>': Option<RawBabePreDigest0to159>;
'Vec<RawBabePreDigest0to159>': Vec<RawBabePreDigest0to159>;
RawBabePreDigestPrimary0to159: RawBabePreDigestPrimary0to159;
'Option<RawBabePreDigestPrimary0to159>': Option<RawBabePreDigestPrimary0to159>;
'Vec<RawBabePreDigestPrimary0to159>': Vec<RawBabePreDigestPrimary0to159>;
RawBabePreDigestSecondary0to159: RawBabePreDigestSecondary0to159;
'Option<RawBabePreDigestSecondary0to159>': Option<RawBabePreDigestSecondary0to159>;
'Vec<RawBabePreDigestSecondary0to159>': Vec<RawBabePreDigestSecondary0to159>;
SlotNumber: SlotNumber;
'Compact<SlotNumber>': Compact<SlotNumber>;
'Option<SlotNumber>': Option<SlotNumber>;
'Vec<SlotNumber>': Vec<SlotNumber>;
VrfData: VrfData;
'Option<VrfData>': Option<VrfData>;
'Vec<VrfData>': Vec<VrfData>;
VrfProof: VrfProof;
'Option<VrfProof>': Option<VrfProof>;
'Vec<VrfProof>': Vec<VrfProof>;
BalanceLock: BalanceLock;
'Option<BalanceLock>': Option<BalanceLock>;
'Vec<BalanceLock>': Vec<BalanceLock>;
@@ -6,6 +6,7 @@ export default {
types: {
BabeAuthorityWeight: 'u64',
BabeBlockWeight: 'u32',
MaybeVrf: 'Option<VrfData>',
// TODO Remove as soon as merged and metadata static updated
BabeWeight: 'u64',
RawBabePreDigest: {
@@ -15,17 +16,35 @@ export default {
}
},
RawBabePreDigestPrimary: {
vrfOutput: 'VrfData',
vrfProof: 'VrfProof',
authorityIndex: 'u32', // AuthorityIndex (also in aura)
slotNumber: 'SlotNumber',
weight: 'BabeBlockWeight',
vrfOutput: 'H256', // should be '[u8; 32]' (generator support lacking here)
vrfProof: 'H256' // should be '[u8; 32]'
slotNumber: 'SlotNumber'
},
RawBabePreDigestSecondary: {
authorityIndex: 'u32', // AuthorityIndex (also in aura)
slotNumber: 'SlotNumber'
},
RawBabePreDigest0to159: {
_enum: {
Primary: 'RawBabePreDigestPrimary0to159',
Secondary: 'RawBabePreDigestSecondary0to159'
}
},
RawBabePreDigestPrimary0to159: {
authorityIndex: 'u32',
slotNumber: 'SlotNumber',
weight: 'BabeBlockWeight',
vrfOutput: 'VrfData',
vrfProof: 'VrfProof'
},
RawBabePreDigestSecondary0to159: {
authorityIndex: 'u32',
slotNumber: 'SlotNumber',
weight: 'BabeBlockWeight'
},
SlotNumber: 'u64'
SlotNumber: 'u64',
VrfData: '[u8; 32]',
VrfProof: '[u8; 64]'
}
};
+48 -6
View File
@@ -1,8 +1,9 @@
// Auto-generated via `yarn build:interfaces`, do not edit
/* eslint-disable @typescript-eslint/no-empty-interface */
import { Enum, Struct } from '../../codec';
import { H256, u32, u64 } from '../../primitive';
import { Codec } from '../../types';
import { Enum, Option, Struct } from '../../codec';
import { u32, u64 } from '../../primitive';
/** u64 */
export interface BabeAuthorityWeight extends u64 {}
@@ -13,6 +14,9 @@ export interface BabeBlockWeight extends u32 {}
/** u64 */
export interface BabeWeight extends u64 {}
/** Option<VrfData> */
export interface MaybeVrf extends Option<VrfData> {}
/** Enum */
export interface RawBabePreDigest extends Enum {
/** 0:: Primary(RawBabePreDigestPrimary) */
@@ -25,18 +29,42 @@ export interface RawBabePreDigest extends Enum {
readonly asSecondary: RawBabePreDigestSecondary;
}
/** Enum */
export interface RawBabePreDigest0to159 extends Enum {
/** 0:: Primary(RawBabePreDigestPrimary0to159) */
readonly isPrimary: boolean;
/** RawBabePreDigestPrimary0to159 */
readonly asPrimary: RawBabePreDigestPrimary0to159;
/** 1:: Secondary(RawBabePreDigestSecondary0to159) */
readonly isSecondary: boolean;
/** RawBabePreDigestSecondary0to159 */
readonly asSecondary: RawBabePreDigestSecondary0to159;
}
/** Struct */
export interface RawBabePreDigestPrimary extends Struct {
/** VrfData */
readonly vrfOutput: VrfData;
/** VrfProof */
readonly vrfProof: VrfProof;
/** u32 */
readonly authorityIndex: u32;
/** SlotNumber */
readonly slotNumber: SlotNumber;
}
/** Struct */
export interface RawBabePreDigestPrimary0to159 extends Struct {
/** u32 */
readonly authorityIndex: u32;
/** SlotNumber */
readonly slotNumber: SlotNumber;
/** BabeBlockWeight */
readonly weight: BabeBlockWeight;
/** H256 */
readonly vrfOutput: H256;
/** H256 */
readonly vrfProof: H256;
/** VrfData */
readonly vrfOutput: VrfData;
/** VrfProof */
readonly vrfProof: VrfProof;
}
/** Struct */
@@ -45,9 +73,23 @@ export interface RawBabePreDigestSecondary extends Struct {
readonly authorityIndex: u32;
/** SlotNumber */
readonly slotNumber: SlotNumber;
}
/** Struct */
export interface RawBabePreDigestSecondary0to159 extends Struct {
/** u32 */
readonly authorityIndex: u32;
/** SlotNumber */
readonly slotNumber: SlotNumber;
/** BabeBlockWeight */
readonly weight: BabeBlockWeight;
}
/** u64 */
export interface SlotNumber extends u64 {}
/** Uint8Array, Codec */
export interface VrfData extends Uint8Array, Codec {}
/** Uint8Array, Codec */
export interface VrfProof extends Uint8Array, Codec {}