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

fix: update types for Dock #600

Merged
merged 2 commits into from
Jul 9, 2021
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
Binary file modified calc/pkg/calc_bg.wasm
Binary file not shown.
1 change: 0 additions & 1 deletion calc/pkg/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"files": [
"calc_bg.wasm",
"calc.js",
"calc_bg.js",
"calc.d.ts"
],
"main": "calc.js",
Expand Down
3 changes: 2 additions & 1 deletion calc/src/calc_fee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ impl Multiplier {
("westend", v) if 31 <= v => V2(new_u128(inner)),

("dock-main-runtime", _) => V2(new_u128(inner)),
("dock-testnet", _) => V2(new_u128(inner)),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this chain gone from the world forever?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

("dock-pos-main-runtime", _) => V2(new_u128(inner)),
("dock-pos-test-runtime", _) => V2(new_u128(inner)),

_ => {
info!("Unsupported runtime: {}#{}", spec_name, spec_version);
Expand Down
32 changes: 32 additions & 0 deletions src/chains-config/dockPoSMainnetControllers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { ControllerConfig } from '../types/chains-config';
import { getBlockWeight } from './metadata-consts';

/**
* Controllers for Dock's mainnet.
*/
export const dockPoSMainnetControllers: ControllerConfig = {
controllers: [
'AccountsBalanceInfo',
'AccountsStakingInfo',
'AccountsStakingPayouts',
'Blocks',
'BlocksExtrinsics',
'NodeNetwork',
'NodeTransactionPool',
'NodeVersion',
'PalletsStakingProgress',
'PalletsStorage',
'RuntimeCode',
'RuntimeMetadata',
'RuntimeSpec',
'TransactionDryRun',
'TransactionFeeEstimate',
'TransactionMaterial',
'TransactionSubmit',
],
options: {
finalizes: true,
minCalcFeeRuntime: 29,
blockWeightStore: getBlockWeight('dock-pos-main-runtime'),
},
};
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
import { ControllerConfig } from '../types/chains-config';
import { getBlockWeight } from './metadata-consts';

/**
* Controllers for Dock's test network.
*/
export const dockTestnetControllers: ControllerConfig = {
controllers: [
'AccountsBalanceInfo',
'AccountsStakingInfo',
'AccountsStakingPayouts',
'Blocks',
'BlocksExtrinsics',
'NodeNetwork',
'NodeTransactionPool',
'NodeVersion',
'PalletsStakingProgress',
'PalletsStorage',
'RuntimeCode',
'RuntimeMetadata',
Expand All @@ -22,7 +26,7 @@ export const dockTestnetControllers: ControllerConfig = {
],
options: {
finalizes: true,
minCalcFeeRuntime: 1,
blockWeightStore: {},
minCalcFeeRuntime: 26,
blockWeightStore: getBlockWeight('dock-pos-test-runtime'),
},
};
6 changes: 4 additions & 2 deletions src/chains-config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import { controllers } from '../controllers';
import { ControllerConfig } from '../types/chains-config';
import { defaultControllers } from './defaultControllers';
import { dockMainnetControllers } from './dockMainnetControllers';
import { dockTestnetControllers } from './dockTestnetControllers';
import { dockPoSMainnetControllers } from './dockPoSMainnetControllers';
import { dockTestnetControllers } from './dockPoSTestnetControllers';
import { kiltControllers } from './kiltControllers';
import { kulupuControllers } from './kulupuControllers';
import { kusamaControllers } from './kusamaControllers';
Expand All @@ -24,8 +25,9 @@ const specToControllerMap = {
kulupu: kulupuControllers,
kilt: kiltControllers,
mandala: mandalaControllers,
'dock-testnet': dockTestnetControllers,
'dock-main-runtime': dockMainnetControllers,
'dock-pos-main-runtime': dockPoSMainnetControllers,
'dock-pos-test-runtime': dockTestnetControllers,
statemint: statemintControllers,
statemine: statemintControllers,
westmine: statemintControllers,
Expand Down
17 changes: 16 additions & 1 deletion src/chains-config/metadata-consts/dockConsts.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
import { MetadataConsts } from '../../types/chains-config';
import { extrinsicBaseWeight, perClass } from './substrateConsts';

export const dockMainnetDefinitions: MetadataConsts[] = [
{
runtimeVersions: [
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
],
extrinsicBaseWeight: BigInt(125000000),
extrinsicBaseWeight,
},
];

export const dockPoSMainnetDefinitions: MetadataConsts[] = [
{
runtimeVersions: [29],
perClass,
},
];

export const dockPoSTestnetDefinitions: MetadataConsts[] = [
{
runtimeVersions: [26, 27, 28, 29],
perClass,
},
];
10 changes: 9 additions & 1 deletion src/chains-config/metadata-consts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ import {
MetadataConsts,
PerClassValue,
} from '../../types/chains-config';
import { dockMainnetDefinitions } from './dockConsts';
import {
dockMainnetDefinitions,
dockPoSMainnetDefinitions,
dockPoSTestnetDefinitions,
} from './dockConsts';
import { kusamaDefinitions } from './kusamaConsts';
import { polkadotDefinitions } from './polkadotConsts';
import { polymeshDefinitions } from './polymeshConsts';
Expand Down Expand Up @@ -77,6 +81,10 @@ export function getBlockWeight(specName: string): BlockWeightStore {
return generateBlockWeightStore(westendDefinitions);
case 'dock-main-runtime':
return generateBlockWeightStore(dockMainnetDefinitions);
case 'dock-pos-main-runtime':
return generateBlockWeightStore(dockPoSMainnetDefinitions);
case 'dock-pos-test-runtime':
return generateBlockWeightStore(dockPoSTestnetDefinitions);
default:
return {};
}
Expand Down