@acala-network/chopsticks 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -2
- package/dist/blockchain/block-builder.d.ts +7 -3
- package/dist/blockchain/block-builder.js +136 -15
- package/dist/blockchain/block.d.ts +1 -1
- package/dist/blockchain/index.d.ts +11 -1
- package/dist/blockchain/index.js +22 -0
- package/dist/blockchain/inherent/index.d.ts +2 -0
- package/dist/blockchain/inherent/index.js +5 -1
- package/dist/blockchain/inherent/parachain/babe-randomness.d.ts +7 -0
- package/dist/blockchain/inherent/parachain/babe-randomness.js +15 -0
- package/dist/blockchain/inherent/parachain/nimbus-author-inherent.d.ts +7 -0
- package/dist/blockchain/inherent/parachain/nimbus-author-inherent.js +15 -0
- package/dist/blockchain/txpool.js +1 -62
- package/dist/dry-run.d.ts +2 -0
- package/dist/dry-run.js +35 -0
- package/dist/executor.js +3 -3
- package/dist/index.js +51 -4
- package/dist/logger.d.ts +1 -3
- package/dist/logger.js +19 -13
- package/dist/rpc/dev.js +44 -2
- package/dist/rpc/substrate/system.js +4 -0
- package/dist/run-block.d.ts +1 -1
- package/dist/run-block.js +16 -5
- package/dist/setup.js +9 -2
- package/dist/utils/decoder.d.ts +17 -0
- package/dist/utils/decoder.js +105 -0
- package/dist/utils/generate-html-diff.d.ts +4 -0
- package/dist/utils/generate-html-diff.js +20 -0
- package/dist/utils/open-html.d.ts +1 -0
- package/dist/utils/open-html.js +9 -0
- package/dist/xcm/downward.d.ts +2 -0
- package/dist/xcm/downward.js +27 -0
- package/dist/xcm/horizontal.d.ts +2 -0
- package/dist/xcm/horizontal.js +36 -0
- package/dist/xcm/index.d.ts +7 -1
- package/dist/xcm/index.js +13 -55
- package/dist/xcm/upward.d.ts +2 -0
- package/dist/xcm/upward.js +39 -0
- package/package.json +6 -3
- package/dist/decode-key.d.ts +0 -2
- package/dist/decode-key.js +0 -24
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.connectUpward = void 0;
|
|
4
|
+
const util_1 = require("@polkadot/util");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
const _1 = require(".");
|
|
7
|
+
const set_storage_1 = require("../utils/set-storage");
|
|
8
|
+
const connectUpward = async (parachain, relaychain) => {
|
|
9
|
+
const meta = await parachain.head.meta;
|
|
10
|
+
const paraId = await (0, utils_1.getParaId)(parachain);
|
|
11
|
+
const upwardMessagesKey = (0, utils_1.compactHex)(meta.query.parachainSystem.upwardMessages());
|
|
12
|
+
await parachain.headState.subscribeStorage([upwardMessagesKey], async (head, pairs) => {
|
|
13
|
+
const value = pairs[0][1];
|
|
14
|
+
if (!value)
|
|
15
|
+
return;
|
|
16
|
+
const parachainMeta = await parachain.head.meta;
|
|
17
|
+
const upwardMessagesKey = (0, utils_1.compactHex)(parachainMeta.query.parachainSystem.upwardMessages());
|
|
18
|
+
// clear parachain message queue
|
|
19
|
+
await (0, set_storage_1.setStorage)(parachain, [[upwardMessagesKey, null]], head.hash);
|
|
20
|
+
const relaychainMeta = await relaychain.head.meta;
|
|
21
|
+
const upwardMessages = parachainMeta.registry.createType('Vec<Bytes>', (0, util_1.hexToU8a)(value));
|
|
22
|
+
const queueSize = parachainMeta.registry.createType('(u32, u32)', [
|
|
23
|
+
upwardMessages.length,
|
|
24
|
+
upwardMessages.map((x) => x.byteLength).reduce((s, i) => s + i, 0),
|
|
25
|
+
]);
|
|
26
|
+
const needsDispatch = parachainMeta.registry.createType('Vec<u32>', [paraId]);
|
|
27
|
+
_1.logger.debug({ [paraId.toNumber()]: upwardMessages.toJSON(), queueSize: queueSize.toJSON() }, 'upward_message');
|
|
28
|
+
// TODO: make sure we append instead of replace
|
|
29
|
+
relaychain.head.pushStorageLayer().set((0, utils_1.compactHex)(relaychainMeta.query.ump.needsDispatch()), needsDispatch.toHex());
|
|
30
|
+
relaychain.head
|
|
31
|
+
.pushStorageLayer()
|
|
32
|
+
.set((0, utils_1.compactHex)(relaychainMeta.query.ump.relayDispatchQueues(paraId)), upwardMessages.toHex());
|
|
33
|
+
relaychain.head
|
|
34
|
+
.pushStorageLayer()
|
|
35
|
+
.set((0, utils_1.compactHex)(relaychainMeta.query.ump.relayDispatchQueueSize(paraId)), queueSize.toHex());
|
|
36
|
+
await relaychain.newBlock();
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
exports.connectUpward = connectUpward;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@acala-network/chopsticks",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"author": "Bryan Chen <xlchen1291@gmail.com>",
|
|
@@ -24,10 +24,12 @@
|
|
|
24
24
|
"test:dev": "LOG_LEVEL=trace vitest --inspect",
|
|
25
25
|
"dev": "LOG_LEVEL=trace ts-node-dev --transpile-only --inspect --notify=false src/index.ts -- dev --config=configs/dev.yml",
|
|
26
26
|
"dev:karura": "ts-node-dev --transpile-only --inspect --notify=false src/index.ts -- dev --config=configs/karura.yml",
|
|
27
|
-
"dev:acala": "ts-node-dev --transpile-only --inspect --notify=false src/index.ts -- dev --config=configs/acala.yml"
|
|
27
|
+
"dev:acala": "ts-node-dev --transpile-only --inspect --notify=false src/index.ts -- dev --config=configs/acala.yml",
|
|
28
|
+
"dev:moonriver": "ts-node-dev --transpile-only --inspect --notify=false src/index.ts -- dev --config=configs/moonriver.yml",
|
|
29
|
+
"dev:moonbeam": "ts-node-dev --transpile-only --inspect --notify=false src/index.ts -- dev --config=configs/moonbeam.yml"
|
|
28
30
|
},
|
|
29
31
|
"dependencies": {
|
|
30
|
-
"@acala-network/chopsticks-executor": "0.
|
|
32
|
+
"@acala-network/chopsticks-executor": "0.3.0",
|
|
31
33
|
"@polkadot/api": "^9.10.1",
|
|
32
34
|
"@polkadot/rpc-provider": "^9.10.1",
|
|
33
35
|
"@polkadot/types": "^9.10.1",
|
|
@@ -37,6 +39,7 @@
|
|
|
37
39
|
"@polkadot/util-crypto": "^10.2.1",
|
|
38
40
|
"axios": "^1.2.2",
|
|
39
41
|
"js-yaml": "^4.1.0",
|
|
42
|
+
"jsondiffpatch": "^0.4.1",
|
|
40
43
|
"lodash": "^4.17.21",
|
|
41
44
|
"pino": "^8.7.0",
|
|
42
45
|
"pino-pretty": "^9.1.1",
|
package/dist/decode-key.d.ts
DELETED
package/dist/decode-key.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.decodeKey = void 0;
|
|
4
|
-
require("@polkadot/types-codec");
|
|
5
|
-
const util_1 = require("@polkadot/util");
|
|
6
|
-
const setup_1 = require("./setup");
|
|
7
|
-
const decodeKey = async (argv) => {
|
|
8
|
-
const context = await (0, setup_1.setup)(argv);
|
|
9
|
-
const key = argv.key;
|
|
10
|
-
const meta = await context.chain.head.meta;
|
|
11
|
-
outer: for (const module of Object.values(meta.query)) {
|
|
12
|
-
for (const storage of Object.values(module)) {
|
|
13
|
-
const keyPrefix = (0, util_1.u8aToHex)(storage.keyPrefix());
|
|
14
|
-
if (key.startsWith(keyPrefix)) {
|
|
15
|
-
const decodedKey = meta.registry.createType('StorageKey', key);
|
|
16
|
-
decodedKey.setMeta(storage.meta);
|
|
17
|
-
console.log(`${storage.section}.${storage.method}`, decodedKey.args.map((x) => JSON.stringify(x.toHuman())).join(', '));
|
|
18
|
-
break outer;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
setTimeout(() => process.exit(0), 50);
|
|
23
|
-
};
|
|
24
|
-
exports.decodeKey = decodeKey;
|