Skip to content

Commit

Permalink
fix: add blockWeightStore and fee calc support for common good parach…
Browse files Browse the repository at this point in the history
…ains
  • Loading branch information
TarikGul committed Dec 20, 2021
1 parent d30c517 commit 1059c1a
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 1 deletion.
22 changes: 22 additions & 0 deletions src/chains-config/metadata-consts/commonParachainsConsts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* WEIGHT NOTES (STATEMINE | STATEMINT)
*
* The following weights are used for common good parachains such as statemine, and
* statemint. Both are using the same fee calculation currently and share the same
* integer values.
*
*/

import { IPerClass } from 'src/types/chains-config';

export const perClassCommonParachains: IPerClass = {
normal: {
baseExtrinsic: BigInt(125000000),
},
operational: {
baseExtrinsic: BigInt(125000000),
},
mandatory: {
baseExtrinsic: BigInt(125000000),
},
};
6 changes: 6 additions & 0 deletions src/chains-config/metadata-consts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import { mantaDefinitions } from './mantaConsts';
import { polkadotDefinitions } from './polkadotConsts';
import { polymeshDefinitions } from './polymeshConsts';
import { shidenDefinitions } from './shidenConsts';
import { statemineDefinitions } from './statemineConsts';
import { statemintDefinitions } from './statemintConsts';
import { westendDefinitions } from './westendConsts';

/**
Expand Down Expand Up @@ -84,6 +86,10 @@ export function getBlockWeight(specName: string): BlockWeightStore {
return generateBlockWeightStore(kusamaDefinitions);
case 'westend':
return generateBlockWeightStore(westendDefinitions);
case 'statemint':
return generateBlockWeightStore(statemintDefinitions);
case 'statemine':
return generateBlockWeightStore(statemineDefinitions);
case 'dock-main-runtime':
return generateBlockWeightStore(dockMainnetDefinitions);
case 'dock-pos-main-runtime':
Expand Down
19 changes: 19 additions & 0 deletions src/chains-config/metadata-consts/statemineConsts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { MetadataConsts } from '../../types/chains-config';
import { perClassCommonParachains } from './commonParachainsConsts';
import { perClass } from './substrateConsts';

/**
* Statemine before runtime version 601 uses the same weight fees as
* substrateConsts `perClass`, therefore both objects within the statemine
* definitions will have the `perClass` key, but their values will differ.
*/
export const statemineDefinitions: MetadataConsts[] = [
{
runtimeVersions: [601],
perClass: perClassCommonParachains,
},
{
runtimeVersions: [1, 2, 3, 4, 5],
perClass,
},
];
9 changes: 9 additions & 0 deletions src/chains-config/metadata-consts/statemintConsts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { MetadataConsts } from '../../types/chains-config';
import { perClassCommonParachains } from './commonParachainsConsts';

export const statemintDefinitions: MetadataConsts[] = [
{
runtimeVersions: [2, 601],
perClass: perClassCommonParachains,
},
];
2 changes: 1 addition & 1 deletion src/chains-config/statemintControllers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const statemintControllers: ControllerConfig = {
],
options: {
finalizes: true,
minCalcFeeRuntime: 0,
minCalcFeeRuntime: 2,
blockWeightStore: {},
blockStore: initLRUCache(),
},
Expand Down

0 comments on commit 1059c1a

Please sign in to comment.