Skip to content

Commit c71fc2c

Browse files
authored
Oracle decorator (#2130)
* add oracle decorator * update deps * lock file * Fix nix hash * lint * lint
1 parent 2d00b8a commit c71fc2c

File tree

5 files changed

+36
-20
lines changed

5 files changed

+36
-20
lines changed

flake-module.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
...
99
}: let
1010
# this change on each change of dependencies, unfortunately this hash not yet automatically updated from SRI of package.lock
11-
npmDepsHash = "sha256-8F5k8aYqMY+pIuPVz2z9yhtrZKScldYCMFvZNzRtmPw=";
11+
npmDepsHash = "sha256-89qVp+925h/XXhAFPTN9CsvREBrZ5JkHoakrU0jqSHs=";
1212
####
1313

1414
# there is officia polkadot on nixpkgs, but it has no local rococo wasm to run

javascript/package-lock.json

Lines changed: 1 addition & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

javascript/packages/orchestrator/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"@polkadot/api": "^14.0.1",
4141
"@polkadot/keyring": "^13.1.1",
4242
"@polkadot/util-crypto": "^13.5.7",
43-
"@zombienet/utils": "^0.0.29",
43+
"@zombienet/utils": "^0.0.30",
4444
"chai": "^4.3.10",
4545
"debug": "^4.4.3",
4646
"execa": "^5.1.1",

javascript/packages/orchestrator/src/chain-decorators/index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ enum CHAIN {
1313
LocalV = "local_v",
1414
MainnetLocalV = "mainnet_local_v",
1515
Aventus = "aventus",
16+
Oracle = "oracle",
1617
}
1718

1819
interface Decorator {
@@ -33,6 +34,7 @@ import moonbeam from "./moonbeam";
3334
import oak from "./oak";
3435
import generic_evm from "./generic-evm";
3536
import aventus from "./aventus";
37+
import oracle from "./oracle";
3638

3739
function whichChain(chain_name: string, force_decorator?: string): CHAIN {
3840
const chain = force_decorator ? force_decorator : chain_name;
@@ -50,6 +52,7 @@ function whichChain(chain_name: string, force_decorator?: string): CHAIN {
5052
if (/mainnet-local-v/.test(chain)) return CHAIN.MainnetLocalV;
5153
if (/generic-evm/.test(chain)) return CHAIN.GenericEvm;
5254
if (/vow-net|avn-chain/.test(chain)) return CHAIN.Aventus;
55+
if (/oracle/.test(chain)) return CHAIN.Oracle;
5356

5457
return CHAIN.Generic;
5558
}
@@ -122,6 +125,11 @@ const aventusDecorators: Decorator = Object.keys(aventus).reduce((memo, fn) => {
122125
return memo;
123126
}, Object.create({}));
124127

128+
const oracleDecorators: Decorator = Object.keys(oracle).reduce((memo, fn) => {
129+
memo[fn] = (oracle as Decorator)[fn];
130+
return memo;
131+
}, Object.create({}));
132+
125133
const GenericEvmDecorators: Decorator = Object.keys(generic_evm).reduce(
126134
(memo, fn) => {
127135
memo[fn] = (generic_evm as Decorator)[fn];
@@ -143,6 +151,7 @@ const decorators: { [para in CHAIN]: { [fn: string]: Function } } = {
143151
local_v: localVDecorators,
144152
mainnet_local_v: MainnetLocalVDecorators,
145153
aventus: aventusDecorators,
154+
oracle: oracleDecorators,
146155
generic: {},
147156
generic_evm: GenericEvmDecorators,
148157
};
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { Node } from "../sharedTypes";
2+
3+
export type GenesisNodeKey = [string, string, { [key: string]: string }];
4+
5+
export function getNodeKey(node: Node): GenesisNodeKey {
6+
const { sr_account } = node.accounts;
7+
8+
const address = sr_account.address;
9+
10+
const key: GenesisNodeKey = [
11+
address,
12+
address,
13+
{
14+
aura: address,
15+
oracle: address,
16+
},
17+
];
18+
19+
return key;
20+
}
21+
22+
export default {
23+
getNodeKey,
24+
};

0 commit comments

Comments
 (0)