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

DispatchInfo paysFee to Pays enum #2266

Merged
merged 2 commits into from
May 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# 1.14.0-beta.x

- **Important** `DispatchInfo` changed `paysFee` to an enum, if using an older version use, `DispatchInfo: 'DispatchInfoTo244'`
- Align imOnline `Heartbeat` with Substrate (Thanks to https://github.com/arjanz)
- Add `derive.democracy.locks` to return extended lock info based on votes
- Ensure metadata is only requested once upon startup (bypass on upgrade subscriptions)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@babel/core": "^7.9.6",
"@babel/register": "^7.9.0",
"@babel/runtime": "^7.9.6",
"@polkadot/dev": "^0.52.18",
"@polkadot/dev": "^0.52.19",
"@polkadot/ts": "^0.3.21",
"@polkadot/typegen": "workspace:packages/typegen",
"@types/jest": "^25.2.1",
Expand Down
18 changes: 15 additions & 3 deletions packages/types-known/src/spec/kusama.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const versioned: OverrideVersionedType[] = [
Address: 'GenericAddress',
BalanceLock: 'BalanceLockTo212',
DispatchError: 'DispatchErrorTo198',
DispatchInfo: 'DispatchInfoTo244',
Keys: 'SessionKeys5',
LookupSource: 'Address',
ReferendumInfo: 'ReferendumInfoTo239',
Expand All @@ -26,6 +27,7 @@ const versioned: OverrideVersionedType[] = [
types: {
Address: 'GenericAddress',
BalanceLock: 'BalanceLockTo212',
DispatchInfo: 'DispatchInfoTo244',
Keys: 'SessionKeys5',
LookupSource: 'Address',
ReferendumInfo: 'ReferendumInfoTo239',
Expand All @@ -41,6 +43,7 @@ const versioned: OverrideVersionedType[] = [
types: {
Address: 'GenericAddress',
BalanceLock: 'BalanceLockTo212',
DispatchInfo: 'DispatchInfoTo244',
Keys: 'SessionKeys5',
LookupSource: 'Address',
ReferendumInfo: 'ReferendumInfoTo239',
Expand All @@ -50,11 +53,11 @@ const versioned: OverrideVersionedType[] = [
}
},
{
// actual at 1050 (1046-1049 is dev)
minmax: [1046, 1054],
types: {
// Indices optional, not in transaction
Address: 'AccountId',
DispatchInfo: 'DispatchInfoTo244',
Keys: 'SessionKeys5',
LookupSource: 'AccountId',
ReferendumInfo: 'ReferendumInfoTo239',
Expand All @@ -66,15 +69,24 @@ const versioned: OverrideVersionedType[] = [
minmax: [1055, 1056],
types: {
Address: 'AccountId',
DispatchInfo: 'DispatchInfoTo244',
Keys: 'SessionKeys5',
LookupSource: 'AccountId',
StakingLedger: 'StakingLedgerTo240',
Weight: 'u32'
}
},
{
// actual upgrade at 1058
minmax: [1057, undefined],
minmax: [1057, 1061],
types: {
Address: 'AccountId',
DispatchInfo: 'DispatchInfoTo244',
Keys: 'SessionKeys5',
LookupSource: 'AccountId'
}
},
{
minmax: [1062, undefined],
types: {
Address: 'AccountId',
Keys: 'SessionKeys5',
Expand Down
8 changes: 7 additions & 1 deletion packages/types/src/augment/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { AttestedCandidate, AuctionIndex, Bidder, CandidateReceipt, CollatorId,
import { RuntimeDispatchInfo } from '@polkadot/types/interfaces/payment';
import { ActiveRecovery, RecoveryConfig } from '@polkadot/types/interfaces/recovery';
import { RpcMethods } from '@polkadot/types/interfaces/rpc';
import { AccountId, AccountIdOf, AccountIndex, Address, AssetId, Balance, BalanceOf, Block, BlockNumber, Call, ChangesTrieConfiguration, Consensus, ConsensusEngineId, Digest, DigestItem, DispatchClass, DispatchInfo, DispatchInfoTo190, Fixed128, Fixed64, H160, H256, H512, Hash, Header, Index, Justification, KeyTypeId, KeyValue, LockIdentifier, LookupSource, LookupTarget, ModuleId, Moment, Origin, Perbill, Percent, Permill, Perquintill, Phantom, PhantomData, PreRuntime, RuntimeDbWeight, Seal, SealV0, SignedBlock, StorageData, ValidatorId, Weight, WeightMultiplier } from '@polkadot/types/interfaces/runtime';
import { AccountId, AccountIdOf, AccountIndex, Address, AssetId, Balance, BalanceOf, Block, BlockNumber, Call, ChangesTrieConfiguration, Consensus, ConsensusEngineId, Digest, DigestItem, DispatchClass, DispatchInfo, DispatchInfoTo190, DispatchInfoTo244, Fixed128, Fixed64, H160, H256, H512, Hash, Header, Index, Justification, KeyTypeId, KeyValue, LockIdentifier, LookupSource, LookupTarget, ModuleId, Moment, Origin, Pays, Perbill, Percent, Permill, Perquintill, Phantom, PhantomData, PreRuntime, RuntimeDbWeight, Seal, SealV0, SignedBlock, StorageData, ValidatorId, Weight, WeightMultiplier } from '@polkadot/types/interfaces/runtime';
import { SchedulePeriod, SchedulePriority, Scheduled, TaskAddress } from '@polkadot/types/interfaces/scheduler';
import { FullIdentification, IdentificationTuple, Keys, MembershipProof, SessionIndex, SessionKeys1, SessionKeys2, SessionKeys3, SessionKeys4, SessionKeys5, SessionKeys6, ValidatorCount } from '@polkadot/types/interfaces/session';
import { Bid, BidKind, SocietyJudgement, SocietyVote, StrikeCount, VouchingStatus } from '@polkadot/types/interfaces/society';
Expand Down Expand Up @@ -179,6 +179,9 @@ declare module '@polkadot/types/types/registry' {
DispatchInfoTo190: DispatchInfoTo190;
'Option<DispatchInfoTo190>': Option<DispatchInfoTo190>;
'Vec<DispatchInfoTo190>': Vec<DispatchInfoTo190>;
DispatchInfoTo244: DispatchInfoTo244;
'Option<DispatchInfoTo244>': Option<DispatchInfoTo244>;
'Vec<DispatchInfoTo244>': Vec<DispatchInfoTo244>;
Fixed64: Fixed64;
'Option<Fixed64>': Option<Fixed64>;
'Vec<Fixed64>': Vec<Fixed64>;
Expand Down Expand Up @@ -233,6 +236,9 @@ declare module '@polkadot/types/types/registry' {
Origin: Origin;
'Option<Origin>': Option<Origin>;
'Vec<Origin>': Vec<Origin>;
Pays: Pays;
'Option<Pays>': Option<Pays>;
'Vec<Pays>': Vec<Pays>;
Perbill: Perbill;
'Compact<Perbill>': Compact<Perbill>;
'Option<Perbill>': Option<Perbill>;
Expand Down
10 changes: 9 additions & 1 deletion packages/types/src/interfaces/runtime/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,17 @@ export default {
DispatchInfo: {
weight: 'Weight',
class: 'DispatchClass',
paysFee: 'bool'
paysFee: 'Pays'
},
DispatchInfoTo190: {
weight: 'Weight',
class: 'DispatchClass'
},
DispatchInfoTo244: {
weight: 'Weight',
class: 'DispatchClass',
paysFee: 'bool'
},
Fixed64: 'Int<64, Fixed64>',
Fixed128: 'Int<128, Fixed128>',
H160: '[u8; 20; H160]',
Expand All @@ -74,6 +79,9 @@ export default {
ModuleId: 'LockIdentifier',
Moment: 'u64',
Origin: 'DoNotConstruct<Origin>',
Pays: {
_enum: ['Yes', 'No']
},
Perbill: 'u32',
Percent: 'u8',
Permill: 'u32',
Expand Down
15 changes: 14 additions & 1 deletion packages/types/src/interfaces/runtime/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export interface DispatchClass extends Enum {
export interface DispatchInfo extends Struct {
readonly weight: Weight;
readonly class: DispatchClass;
readonly paysFee: bool;
readonly paysFee: Pays;
}

/** @name DispatchInfoTo190 */
Expand All @@ -93,6 +93,13 @@ export interface DispatchInfoTo190 extends Struct {
readonly class: DispatchClass;
}

/** @name DispatchInfoTo244 */
export interface DispatchInfoTo244 extends Struct {
readonly weight: Weight;
readonly class: DispatchClass;
readonly paysFee: bool;
}

/** @name Fixed128 */
export interface Fixed128 extends Int {}

Expand Down Expand Up @@ -150,6 +157,12 @@ export interface Moment extends u64 {}
/** @name Origin */
export interface Origin extends DoNotConstruct {}

/** @name Pays */
export interface Pays extends Enum {
readonly isYes: boolean;
readonly isNo: boolean;
}

/** @name Perbill */
export interface Perbill extends u32 {}

Expand Down
Loading