@acala-network/chopsticks-core 0.13.0-1 → 0.13.1
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.
|
@@ -27,6 +27,7 @@ _export(exports, {
|
|
|
27
27
|
});
|
|
28
28
|
const _block = require("./block.js");
|
|
29
29
|
const _storagelayer = require("./storage-layer.js");
|
|
30
|
+
const _utilcrypto = require("@polkadot/util-crypto");
|
|
30
31
|
const _util = require("@polkadot/util");
|
|
31
32
|
const _index = require("../utils/index.js");
|
|
32
33
|
const _logger = require("../logger.js");
|
|
@@ -345,9 +346,14 @@ const buildBlock = async (head, inherentProviders, params, callbacks)=>{
|
|
|
345
346
|
newBlock.pushStorageLayer().setAll(resp.storageDiff);
|
|
346
347
|
callbacks?.onPhaseApplied?.('finalize', resp);
|
|
347
348
|
}
|
|
348
|
-
const
|
|
349
|
-
|
|
350
|
-
|
|
349
|
+
const allExtrinsics = [
|
|
350
|
+
...inherents,
|
|
351
|
+
...includedExtrinsic
|
|
352
|
+
];
|
|
353
|
+
const mockExtrinsicRoot = (0, _utilcrypto.blake2AsU8a)((0, _util.u8aConcat)(...allExtrinsics), 256);
|
|
354
|
+
const finalHeader = registry.createType('Header', {
|
|
355
|
+
...header.toJSON(),
|
|
356
|
+
extrinsicsRoot: mockExtrinsicRoot
|
|
351
357
|
});
|
|
352
358
|
const storageDiff = await newBlock.storageDiff();
|
|
353
359
|
if (logger.level.toLowerCase() === 'trace') {
|
|
@@ -356,12 +362,9 @@ const buildBlock = async (head, inherentProviders, params, callbacks)=>{
|
|
|
356
362
|
(0, _logger.truncate)(value)
|
|
357
363
|
]), 'Final block');
|
|
358
364
|
}
|
|
359
|
-
const finalBlock = new _block.Block(head.chain, newBlock.number,
|
|
360
|
-
header,
|
|
361
|
-
extrinsics:
|
|
362
|
-
...inherents,
|
|
363
|
-
...includedExtrinsic
|
|
364
|
-
],
|
|
365
|
+
const finalBlock = new _block.Block(head.chain, newBlock.number, finalHeader.hash.toHex(), head, {
|
|
366
|
+
header: finalHeader,
|
|
367
|
+
extrinsics: allExtrinsics,
|
|
365
368
|
storage: head.storage,
|
|
366
369
|
storageDiff
|
|
367
370
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Block } from './block.js';
|
|
2
2
|
import { StorageLayer, StorageValueKind } from './storage-layer.js';
|
|
3
|
+
import { blake2AsU8a } from '@polkadot/util-crypto';
|
|
3
4
|
import { compactAddLength, hexToU8a, stringToHex, u8aConcat } from '@polkadot/util';
|
|
4
5
|
import { compactHex, getCurrentSlot } from '../utils/index.js';
|
|
5
6
|
import { defaultLogger, truncate } from '../logger.js';
|
|
@@ -318,9 +319,14 @@ export const buildBlock = async (head, inherentProviders, params, callbacks)=>{
|
|
|
318
319
|
newBlock.pushStorageLayer().setAll(resp.storageDiff);
|
|
319
320
|
callbacks?.onPhaseApplied?.('finalize', resp);
|
|
320
321
|
}
|
|
321
|
-
const
|
|
322
|
-
|
|
323
|
-
|
|
322
|
+
const allExtrinsics = [
|
|
323
|
+
...inherents,
|
|
324
|
+
...includedExtrinsic
|
|
325
|
+
];
|
|
326
|
+
const mockExtrinsicRoot = blake2AsU8a(u8aConcat(...allExtrinsics), 256);
|
|
327
|
+
const finalHeader = registry.createType('Header', {
|
|
328
|
+
...header.toJSON(),
|
|
329
|
+
extrinsicsRoot: mockExtrinsicRoot
|
|
324
330
|
});
|
|
325
331
|
const storageDiff = await newBlock.storageDiff();
|
|
326
332
|
if (logger.level.toLowerCase() === 'trace') {
|
|
@@ -329,12 +335,9 @@ export const buildBlock = async (head, inherentProviders, params, callbacks)=>{
|
|
|
329
335
|
truncate(value)
|
|
330
336
|
]), 'Final block');
|
|
331
337
|
}
|
|
332
|
-
const finalBlock = new Block(head.chain, newBlock.number,
|
|
333
|
-
header,
|
|
334
|
-
extrinsics:
|
|
335
|
-
...inherents,
|
|
336
|
-
...includedExtrinsic
|
|
337
|
-
],
|
|
338
|
+
const finalBlock = new Block(head.chain, newBlock.number, finalHeader.hash.toHex(), head, {
|
|
339
|
+
header: finalHeader,
|
|
340
|
+
extrinsics: allExtrinsics,
|
|
338
341
|
storage: head.storage,
|
|
339
342
|
storageDiff
|
|
340
343
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@acala-network/chopsticks-core",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.1",
|
|
4
4
|
"author": "Acala Developers <hello@acala.network>",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"depcheck": "npx depcheck"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@acala-network/chopsticks-executor": "0.13.
|
|
14
|
+
"@acala-network/chopsticks-executor": "0.13.1",
|
|
15
15
|
"@polkadot/rpc-provider": "^12.1.1",
|
|
16
16
|
"@polkadot/types": "^12.1.1",
|
|
17
17
|
"@polkadot/types-codec": "^12.1.1",
|