Update Substrate with vesting (#1790)

* Update Substrate with vesting

* Update balances & vesting queries with compat)

* Split base account queries

* Linting, simpler referendum voters

* Fix (some) tests
This commit is contained in:
Jaco Greeff
2020-02-02 08:50:37 +01:00
committed by GitHub
parent f9d569ddd1
commit 9d4b0ea56a
27 changed files with 577 additions and 185 deletions
+18 -2
View File
@@ -7,10 +7,10 @@ import { AccountId, AccountIdOf, AccountIndex, Address, AssetId, Balance, Balanc
import { InclusionHeight, Uncle, UncleEntryItem } from '@polkadot/types/interfaces/authorship';
import { RawAuraPreDigest } from '@polkadot/types/interfaces/aura';
import { BabeAuthorityWeight, BabeBlockWeight, BabeWeight, MaybeVrf, RawBabePreDigest, RawBabePreDigestCompat, RawBabePreDigestPrimary, RawBabePreDigestPrimaryTo159, RawBabePreDigestSecondary, RawBabePreDigestSecondaryTo159, RawBabePreDigestTo159, SlotNumber, VrfData, VrfProof } from '@polkadot/types/interfaces/babe';
import { BalanceLock, VestingSchedule, WithdrawReasons } from '@polkadot/types/interfaces/balances';
import { AccountData, BalanceLock, BalanceLockTo212, Reasons, VestingSchedule, WithdrawReasons } from '@polkadot/types/interfaces/balances';
import { MemberCount, ProposalIndex, Votes } from '@polkadot/types/interfaces/collective';
import { AuthorityId } from '@polkadot/types/interfaces/consensus';
import { AliveContractInfo, CodeHash, ContractCallRequest, ContractExecResult, ContractExecResultSuccess, ContractInfo, ContractStorageKey, Gas, PrefabWasmModule, PrefabWasmModuleReserved, Schedule, SeedOf, TombstoneContractInfo, TrieId } from '@polkadot/types/interfaces/contracts';
import { AliveContractInfo, CodeHash, ContractCallRequest, ContractExecResult, ContractExecResultSuccess, ContractInfo, ContractStorageKey, Gas, PrefabWasmModule, PrefabWasmModuleReserved, Schedule, ScheduleTo212, SeedOf, TombstoneContractInfo, TrieId } from '@polkadot/types/interfaces/contracts';
import { Conviction, PropIndex, Proposal, ReferendumIndex, ReferendumInfo } from '@polkadot/types/interfaces/democracy';
import { AccountInfo, Amount, AssetOf, InherentOfflineReport, LockPeriods, NewAccountOutcome, OpaqueKey, SessionKey } from '@polkadot/types/interfaces/deprecated';
import { ApprovalFlag, SetIndex, Vote, VoteIndex, VoteThreshold, VoterInfo } from '@polkadot/types/interfaces/elections';
@@ -28,6 +28,7 @@ import { DigestOf, DispatchError, DispatchErrorModule, DispatchErrorTo198, Dispa
import { OpenTip, OpenTipFinder, OpenTipTip, TreasuryProposal } from '@polkadot/types/interfaces/treasury';
import { Multiplier } from '@polkadot/types/interfaces/txpayment';
import { Multisig, Timepoint } from '@polkadot/types/interfaces/utility';
import { VestingInfo } from '@polkadot/types/interfaces/vesting';
import { BlockAttestations, IncludedBlocks, MoreAttestations } from '@polkadot/types/interfaces/attestations';
import { EthereumAddress } from '@polkadot/types/interfaces/claims';
import { AttestedCandidate, AuctionIndex, BalanceUpload, Bidder, CandidateReceipt, CollatorId, CollatorSignature, EgressQueueRoot, HeadData, IncomingParachain, IncomingParachainDeploy, IncomingParachainFixed, LeasePeriod, LeasePeriodOf, NewBidder, ParaId, ParaIdOf, ParaInfo, ParaScheduling, ParachainDispatchOrigin, Retriable, SlotRange, SubId, UpwardMessage, ValidatorIndex, ValidityAttestation, ValidityVote, WinningData, WinningDataEntry } from '@polkadot/types/interfaces/parachains';
@@ -393,9 +394,18 @@ export interface InterfaceRegistry {
VrfProof: VrfProof;
'Option<VrfProof>': Option<VrfProof>;
'Vec<VrfProof>': Vec<VrfProof>;
AccountData: AccountData;
'Option<AccountData>': Option<AccountData>;
'Vec<AccountData>': Vec<AccountData>;
BalanceLockTo212: BalanceLockTo212;
'Option<BalanceLockTo212>': Option<BalanceLockTo212>;
'Vec<BalanceLockTo212>': Vec<BalanceLockTo212>;
BalanceLock: BalanceLock;
'Option<BalanceLock>': Option<BalanceLock>;
'Vec<BalanceLock>': Vec<BalanceLock>;
Reasons: Reasons;
'Option<Reasons>': Option<Reasons>;
'Vec<Reasons>': Vec<Reasons>;
VestingSchedule: VestingSchedule;
'Option<VestingSchedule>': Option<VestingSchedule>;
'Vec<VestingSchedule>': Vec<VestingSchedule>;
@@ -447,6 +457,9 @@ export interface InterfaceRegistry {
PrefabWasmModuleReserved: PrefabWasmModuleReserved;
'Option<PrefabWasmModuleReserved>': Option<PrefabWasmModuleReserved>;
'Vec<PrefabWasmModuleReserved>': Vec<PrefabWasmModuleReserved>;
ScheduleTo212: ScheduleTo212;
'Option<ScheduleTo212>': Option<ScheduleTo212>;
'Vec<ScheduleTo212>': Vec<ScheduleTo212>;
Schedule: Schedule;
'Option<Schedule>': Option<Schedule>;
'Vec<Schedule>': Vec<Schedule>;
@@ -824,6 +837,9 @@ export interface InterfaceRegistry {
Multisig: Multisig;
'Option<Multisig>': Option<Multisig>;
'Vec<Multisig>': Vec<Multisig>;
VestingInfo: VestingInfo;
'Option<VestingInfo>': Option<VestingInfo>;
'Vec<VestingInfo>': Vec<VestingInfo>;
BlockAttestations: BlockAttestations;
'Option<BlockAttestations>': Option<BlockAttestations>;
'Vec<BlockAttestations>': Vec<BlockAttestations>;
@@ -4,12 +4,26 @@
export default {
types: {
BalanceLock: {
AccountData: {
free: 'Balance',
reserved: 'Balance',
miscFrozen: 'Balance',
feeFrozen: 'Balance'
},
BalanceLockTo212: {
id: 'LockIdentifier',
amount: 'Balance',
until: 'BlockNumber',
reasons: 'WithdrawReasons'
},
BalanceLock: {
id: 'LockIdentifier',
amount: 'Balance',
reasons: 'Reasons'
},
Reasons: {
_enum: ['Fee', 'Misc', 'All']
},
VestingSchedule: {
offset: 'Balance',
perBlock: 'Balance',
@@ -1,17 +1,39 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable @typescript-eslint/no-empty-interface */
import { Set, Struct } from '@polkadot/types/codec';
import { Enum, Set, Struct } from '@polkadot/types/codec';
import { Balance, BlockNumber, LockIdentifier } from '@polkadot/types/interfaces/runtime';
/** @name AccountData */
export interface AccountData extends Struct {
readonly free: Balance;
readonly reserved: Balance;
readonly miscFrozen: Balance;
readonly feeFrozen: Balance;
}
/** @name BalanceLock */
export interface BalanceLock extends Struct {
readonly id: LockIdentifier;
readonly amount: Balance;
readonly reasons: Reasons;
}
/** @name BalanceLockTo212 */
export interface BalanceLockTo212 extends Struct {
readonly id: LockIdentifier;
readonly amount: Balance;
readonly until: BlockNumber;
readonly reasons: WithdrawReasons;
}
/** @name Reasons */
export interface Reasons extends Enum {
readonly isFee: boolean;
readonly isMisc: boolean;
readonly isAll: boolean;
}
/** @name VestingSchedule */
export interface VestingSchedule extends Struct {
readonly offset: Balance;
@@ -46,7 +46,7 @@ export default {
code: 'Bytes'
},
PrefabWasmModuleReserved: 'Option<Null>',
Schedule: {
ScheduleTo212: {
version: 'u32',
putCodePerByteCost: 'Gas',
growMemCost: 'Gas',
@@ -63,6 +63,24 @@ export default {
enablePrintln: 'bool',
maxSubjectLen: 'u32'
},
Schedule: {
version: 'u32',
putCodePerByteCost: 'Gas',
growMemCost: 'Gas',
regularOpCost: 'Gas',
returnDataPerByteCost: 'Gas',
eventDataPerByteCost: 'Gas',
eventPerTopicCost: 'Gas',
eventBaseCost: 'Gas',
sandboxDataReadCost: 'Gas',
sandboxDataWriteCost: 'Gas',
transferCost: 'Gas',
maxEventTopics: 'u32',
maxStackHeight: 'u32',
maxMemoryPages: 'u32',
enablePrintln: 'bool',
maxSubjectLen: 'u32'
},
SeedOf: 'Hash',
TombstoneContractInfo: 'Hash',
TrieId: 'Bytes'
@@ -69,6 +69,26 @@ export interface PrefabWasmModuleReserved extends Option<Null> {}
/** @name Schedule */
export interface Schedule extends Struct {
readonly version: u32;
readonly putCodePerByteCost: Gas;
readonly growMemCost: Gas;
readonly regularOpCost: Gas;
readonly returnDataPerByteCost: Gas;
readonly eventDataPerByteCost: Gas;
readonly eventPerTopicCost: Gas;
readonly eventBaseCost: Gas;
readonly sandboxDataReadCost: Gas;
readonly sandboxDataWriteCost: Gas;
readonly transferCost: Gas;
readonly maxEventTopics: u32;
readonly maxStackHeight: u32;
readonly maxMemoryPages: u32;
readonly enablePrintln: bool;
readonly maxSubjectLen: u32;
}
/** @name ScheduleTo212 */
export interface ScheduleTo212 extends Struct {
readonly version: u32;
readonly putCodePerByteCost: Gas;
readonly growMemCost: Gas;
@@ -30,6 +30,7 @@ export { default as system } from './system/definitions';
export { default as treasury } from './treasury/definitions';
export { default as txpayment } from './txpayment/definitions';
export { default as utility } from './utility/definitions';
export { default as vesting } from './vesting/definitions';
// polkadot-specific types
export { default as attestations } from './attestations/definitions';
+1
View File
@@ -26,6 +26,7 @@ export * from './system/types';
export * from './treasury/types';
export * from './txpayment/types';
export * from './utility/types';
export * from './vesting/types';
export * from './attestations/types';
export * from './claims/types';
export * from './parachains/types';
@@ -0,0 +1,13 @@
// Copyright 2017-2020 @polkadot/types authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
export default {
types: {
VestingInfo: {
locked: 'Balance',
perBlock: 'Balance',
startingBlock: 'BlockNumber'
}
}
};
@@ -0,0 +1,4 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable @typescript-eslint/no-empty-interface */
export * from './types';
@@ -0,0 +1,12 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable @typescript-eslint/no-empty-interface */
import { Struct } from '@polkadot/types/codec';
import { Balance, BlockNumber } from '@polkadot/types/interfaces/runtime';
/** @name VestingInfo */
export interface VestingInfo extends Struct {
readonly locked: Balance;
readonly perBlock: Balance;
readonly startingBlock: BlockNumber;
}
+3
View File
@@ -38,6 +38,7 @@ const TYPES_KUSAMA_VERSIONED: OverrideVersionedType[] = [
{
minmax: [1019, 1031],
types: {
BalanceLock: 'BalanceLockTo212',
DispatchError: 'DispatchErrorTo198',
Keys: 'SessionKeys5',
SlashingSpans: 'SlashingSpansTo204'
@@ -46,6 +47,7 @@ const TYPES_KUSAMA_VERSIONED: OverrideVersionedType[] = [
{
minmax: [1032, 1042],
types: {
BalanceLock: 'BalanceLockTo212',
Keys: 'SessionKeys5',
SlashingSpans: 'SlashingSpansTo204'
}
@@ -53,6 +55,7 @@ const TYPES_KUSAMA_VERSIONED: OverrideVersionedType[] = [
{
minmax: [1043, undefined],
types: {
BalanceLock: 'BalanceLockTo212',
Keys: 'SessionKeys5'
}
}