From 8770f3a70b2156f5a9c2610a2f3f32c2e08f5e33 Mon Sep 17 00:00:00 2001
From: MrPai <1164934857@qq.com>
Date: Mon, 8 Aug 2022 22:25:08 +0800
Subject: [PATCH] fix: add support for Parallel and Heiko (#1012)
* init heiko and parallel config
* Update calc_bg.wasm
* Revert "Update calc_bg.wasm"
This reverts commit 37e5d647eae07a63962a95fc8a741caeecbc0983.
* Update calc_fee.rs
---
src/chains-config/heikoControllers.ts | 50 ++++++++++++++++++++++++
src/chains-config/index.ts | 4 ++
src/chains-config/parallelControllers.ts | 50 ++++++++++++++++++++++++
3 files changed, 104 insertions(+)
create mode 100644 src/chains-config/heikoControllers.ts
create mode 100644 src/chains-config/parallelControllers.ts
diff --git a/src/chains-config/heikoControllers.ts b/src/chains-config/heikoControllers.ts
new file mode 100644
index 000000000..5545aef18
--- /dev/null
+++ b/src/chains-config/heikoControllers.ts
@@ -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 .
+
+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(),
+ },
+};
diff --git a/src/chains-config/index.ts b/src/chains-config/index.ts
index 56695fc12..95cfa0353 100644
--- a/src/chains-config/index.ts
+++ b/src/chains-config/index.ts
@@ -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';
@@ -67,6 +69,8 @@ const specToControllerMap: { [x: string]: ControllerConfig } = {
manta: mantaControllers,
crust: crustControllers,
bifrost: bifrostControllers,
+ heiko: heikoControllers,
+ parallel: parallelControllers,
};
/**
diff --git a/src/chains-config/parallelControllers.ts b/src/chains-config/parallelControllers.ts
new file mode 100644
index 000000000..3321feeaf
--- /dev/null
+++ b/src/chains-config/parallelControllers.ts
@@ -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 .
+
+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(),
+ },
+};