Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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.
3 changes: 3 additions & 0 deletions calc/src/calc_fee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ impl Multiplier {

("bifrost", _v) => V2(new_u128(inner)),

("heiko", _v) => V2(new_u128(inner)),
("parallel", _v) => V2(new_u128(inner)),

@Imod7 Imod7 Aug 6, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@MrPai Thank you for your PR!
As already mentioned, if you would like this PR to be merged ASAP you can do the following :

  1. Revert/remove this change in calc_fee and
  2. Revert change in calc/pkg/calc_bg.wasm
  3. Change the title of the PR to something that it reflects the change in the chains config, e.g. "fix: add support (controllers) for Parallel and Heiko" (just an example).

Regarding the fee calculation, adding anything to calc_fee will not have any impact since we do not use it anymore. Please check the related comments here and here by Tarik and James.

Having said that, for fees we are advising to use the ?feeByEvent=true query param found in the /blocksrelated endpoints. Please check also the endpoints docs where it mentions more details on feeByEvent :

When set to true, extrinsics will have their fees retrieved by their events. This query param will use a fee estimation via rpc::payment::query_info to accurately identify which event has the corresponding fee information that is closest to the value provided by query_info.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@Imod7 thanks for your information, I have done what you mentioned, please take a look.

_ => {
info!("Unsupported runtime: {}#{}", spec_name, spec_version);
return None;
Expand Down
50 changes: 50 additions & 0 deletions src/chains-config/heikoControllers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// Copyright 2017-2022 Parity Technologies (UK) Ltd.
// This file is part of Substrate API Sidecar.
//
// Substrate API Sidecar is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

import { ControllerConfig } from '../types/chains-config';
import { initLRUCache } from './cache/lruCache';

/**
* Controllers for Heiko collator
*/
export const heikoControllers: ControllerConfig = {
controllers: [
'AccountsAssets',
'AccountsBalanceInfo',
'AccountsValidate',
'AccountsVestingInfo',
'Blocks',
'BlocksExtrinsics',
'NodeNetwork',
'NodeTransactionPool',
'NodeVersion',
'PalletsAssets',
'PalletsStorage',
'Paras',
'RuntimeCode',
'RuntimeMetadata',
'RuntimeSpec',
'TransactionDryRun',
'TransactionFeeEstimate',
'TransactionMaterial',
'TransactionSubmit',
],
options: {
finalizes: true,
minCalcFeeRuntime: 1,
blockStore: initLRUCache(),
},
};
4 changes: 4 additions & 0 deletions src/chains-config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ import { defaultControllers } from './defaultControllers';
import { dockMainnetControllers } from './dockMainnetControllers';
import { dockPoSMainnetControllers } from './dockPoSMainnetControllers';
import { dockTestnetControllers } from './dockPoSTestnetControllers';
import { heikoControllers } from './heikoControllers';
import { karuraControllers } from './karuraControllers';
import { kiltControllers } from './kiltControllers';
import { kulupuControllers } from './kulupuControllers';
import { kusamaControllers } from './kusamaControllers';
import { mandalaControllers } from './mandalaControllers';
import { mantaControllers } from './mantaControllers';
import { parallelControllers } from './parallelControllers';
import { polkadotControllers } from './polkadotControllers';
import { polymeshControllers } from './polymeshControllers';
import { shidenControllers } from './shidenControllers';
Expand Down Expand Up @@ -67,6 +69,8 @@ const specToControllerMap: { [x: string]: ControllerConfig } = {
manta: mantaControllers,
crust: crustControllers,
bifrost: bifrostControllers,
heiko: heikoControllers,
parallel: parallelControllers,
};

/**
Expand Down
50 changes: 50 additions & 0 deletions src/chains-config/parallelControllers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// Copyright 2017-2022 Parity Technologies (UK) Ltd.
// This file is part of Substrate API Sidecar.
//
// Substrate API Sidecar is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

import { ControllerConfig } from '../types/chains-config';
import { initLRUCache } from './cache/lruCache';

/**
* Controllers for Parallel collator
*/
export const parallelControllers: ControllerConfig = {
controllers: [
'AccountsAssets',
'AccountsBalanceInfo',
'AccountsValidate',
'AccountsVestingInfo',
'Blocks',
'BlocksExtrinsics',
'NodeNetwork',
'NodeTransactionPool',
'NodeVersion',
'PalletsAssets',
'PalletsStorage',
'Paras',
'RuntimeCode',
'RuntimeMetadata',
'RuntimeSpec',
'TransactionDryRun',
'TransactionFeeEstimate',
'TransactionMaterial',
'TransactionSubmit',
],
options: {
finalizes: true,
minCalcFeeRuntime: 1,
blockStore: initLRUCache(),
},
};