Skip to content

Commit

Permalink
fix: support manta parachain fee calculations (#767)
Browse files Browse the repository at this point in the history
  • Loading branch information
grenade committed Nov 17, 2021
1 parent 2041c18 commit 3f68052
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 0 deletions.
4 changes: 4 additions & 0 deletions calc/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ else
echo "Fee debugging enabled"
wasm-pack build --debug --target nodejs --scope substrate "$SCRIPT_DIR" -- --features debug
fi
# append a newline to pkg/package.json if it isn't there
if [ "$(tail -c1 "$SCRIPT_DIR/pkg/package.json"; echo x)" != $'\nx' ]; then
echo "" >>"$SCRIPT_DIR/pkg/package.json"
fi
Binary file modified calc/pkg/calc_bg.wasm
Binary file not shown.
1 change: 1 addition & 0 deletions calc/src/calc_fee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ impl Multiplier {
("dock-pos-test-runtime", _v) => V2(new_u128(inner)),

("calamari", _v) => V2(new_u128(inner)),
("manta", _v) => V2(new_u128(inner)),

("karura", _v) => V2(new_u128(inner)),
("acala", _v) => V2(new_u128(inner)),
Expand Down
2 changes: 2 additions & 0 deletions src/chains-config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { kiltControllers } from './kiltControllers';
import { kulupuControllers } from './kulupuControllers';
import { kusamaControllers } from './kusamaControllers';
import { mandalaControllers } from './mandalaControllers';
import { mantaControllers } from './mantaControllers';
import { polkadotControllers } from './polkadotControllers';
import { polymeshControllers } from './polymeshControllers';
import { shidenControllers } from './shidenControllers';
Expand Down Expand Up @@ -43,6 +44,7 @@ const specToControllerMap = {
calamari: calamariControllers,
karura: karuraControllers,
acala: acalaControllers,
manta: mantaControllers,
};

/**
Expand Down
37 changes: 37 additions & 0 deletions src/chains-config/mantaControllers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { ControllerConfig } from '../types/chains-config';
import { initLRUCache } from './cache/lruCache';
import { getBlockWeight } from './metadata-consts';

/**
* Controllers for manta collator
*/
export const mantaControllers: ControllerConfig = {
controllers: [
'AccountsBalanceInfo',
'AccountsStakingInfo',
'AccountsStakingPayouts',
'AccountsValidate',
'AccountsVestingInfo',
'Blocks',
'BlocksExtrinsics',
'NodeNetwork',
'NodeTransactionPool',
'NodeVersion',
'PalletsStakingProgress',
'PalletsStorage',
'Paras',
'RuntimeCode',
'RuntimeMetadata',
'RuntimeSpec',
'TransactionDryRun',
'TransactionFeeEstimate',
'TransactionMaterial',
'TransactionSubmit',
],
options: {
finalizes: true,
minCalcFeeRuntime: 1,
blockWeightStore: getBlockWeight('manta'),
blockStore: initLRUCache(),
},
};
3 changes: 3 additions & 0 deletions src/chains-config/metadata-consts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
} from './dockConsts';
import { karuraDefinitions } from './karuraConsts';
import { kusamaDefinitions } from './kusamaConsts';
import { mantaDefinitions } from './mantaConsts';
import { polkadotDefinitions } from './polkadotConsts';
import { polymeshDefinitions } from './polymeshConsts';
import { shidenDefinitions } from './shidenConsts';
Expand Down Expand Up @@ -97,6 +98,8 @@ export function getBlockWeight(specName: string): BlockWeightStore {
return generateBlockWeightStore(karuraDefinitions);
case 'acala':
return generateBlockWeightStore(acalaDefinitions);
case 'manta':
return generateBlockWeightStore(mantaDefinitions);
default:
return {};
}
Expand Down
9 changes: 9 additions & 0 deletions src/chains-config/metadata-consts/mantaConsts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { MetadataConsts } from '../../types/chains-config';
import { extrinsicBaseWeight } from './substrateConsts';

export const mantaDefinitions: MetadataConsts[] = [
{
runtimeVersions: [3090],
extrinsicBaseWeight,
},
];

0 comments on commit 3f68052

Please sign in to comment.