@chainsafe/lodestar 1.35.0-dev.fcf8d024ea → 1.35.0-dev.fd1dac853d

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/.git-data.json CHANGED
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "branch": "unstable",
3
- "commit": "fcf8d024ea7ad839dd943a2a2db7df47f88b42d5"
3
+ "commit": "fd1dac853d059ce250d706932daa55e77c33310a"
4
4
  }
@@ -1,6 +1,6 @@
1
1
  // MUST import this file first before anything and not import any Lodestar code.
2
+ import { hasher as hashtreeHasher } from "#hashtree-hasher";
2
3
  import { setHasher } from "@chainsafe/persistent-merkle-tree";
3
- import { hasher as hashtreeHasher } from "@chainsafe/persistent-merkle-tree/hasher/hashtree";
4
4
  // Without setting this first, persistent-merkle-tree will use noble instead
5
5
  setHasher(hashtreeHasher);
6
6
  //
@@ -1 +1 @@
1
- {"version":3,"file":"applyPreset.js","sourceRoot":"","sources":["../src/applyPreset.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,OAAO,EAAC,SAAS,EAAC,MAAM,mCAAmC,CAAC;AAC5D,OAAO,EAAC,MAAM,IAAI,cAAc,EAAC,MAAM,mDAAmD,CAAC;AAE3F,4EAA4E;AAC5E,SAAS,CAAC,cAAc,CAAC,CAAC;AAE1B,EAAE;AACF,eAAe;AACf,EAAE;AACF,yGAAyG;AACzG,sDAAsD;AACtD,EAAE;AACF,qGAAqG;AACrG,+DAA+D;AAC/D,kEAAkE;AAClE,kEAAkE;AAClE,EAAE;AACF,4FAA4F;AAC5F,2CAA2C;AAE3C,+FAA+F;AAC/F,OAAO,EAAC,UAAU,EAAE,cAAc,EAAE,eAAe,EAAC,MAAM,4BAA4B,CAAC;AACvF,OAAO,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AAExC,MAAM,OAAO,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;AACtC,MAAM,MAAM,GAAG,UAAU,CAAC,QA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OAAe;IACjC,4BAA4B;IAC5B,0CAA0C;IAE1C,CAAC;QACC,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,OAAO,EAAE,CAAC,CAAC;QACnD,IAAI,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC;YACf,OAAO,OAAO,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;QACvC,CAAC;IACH,CAAC;IAED,4BAA4B;IAC5B,CAAC;QACC,MAAM,MAAM,GAAG,KAAK,OAAO,GAAG,CAAC;QAC/B,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;QAChE,IAAI,IAAI,EAAE,CAAC;YACT,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACnC,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -124,12 +124,12 @@ export const validatorOptions = {
124
124
  },
125
125
  afterBlockDelaySlotFraction: {
126
126
  hidden: true,
127
- description: "Delay before publishing attestations if block comes early, as a fraction of SECONDS_PER_SLOT (value is from 0 inclusive to 1 exclusive)",
127
+ description: "Delay before publishing attestations if block comes early, as a fraction of SLOT_DURATION_MS (value is from 0 inclusive to 1 exclusive)",
128
128
  type: "number",
129
129
  },
130
130
  scAfterBlockDelaySlotFraction: {
131
131
  hidden: true,
132
- description: "Delay before publishing SyncCommitteeSignature if block comes early, as a fraction of SECONDS_PER_SLOT (value is from 0 inclusive to 1 exclusive)",
132
+ description: "Delay before publishing SyncCommitteeSignature if block comes early, as a fraction of SLOT_DURATION_MS (value is from 0 inclusive to 1 exclusive)",
133
133
  type: "number",
134
134
  },
135
135
  proposerSettingsFile: {
@@ -0,0 +1,3 @@
1
+ import { Hasher } from "@chainsafe/persistent-merkle-tree";
2
+ export declare const hasher: Hasher;
3
+ //# sourceMappingURL=hasher_bun.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hasher_bun.d.ts","sourceRoot":"","sources":["../../src/util/hasher_bun.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,MAAM,EAKP,MAAM,mCAAmC,CAAC;AAsB3C,eAAO,MAAM,MAAM,EAAE,MAsEpB,CAAC"}
@@ -0,0 +1,118 @@
1
+ import { byteArrayIntoHashObject } from "@chainsafe/as-sha256";
2
+ import { doDigestNLevel, doMerkleizeBlockArray, doMerkleizeBlocksBytes, } from "@chainsafe/persistent-merkle-tree";
3
+ import { digest2Bytes32, digest2Bytes32Into, hashInto } from "@lodestar/bun";
4
+ /**
5
+ * Best SIMD implementation is in 512 bits = 64 bytes
6
+ * If not, hashtree will make a loop inside
7
+ * Given sha256 operates on a block of 4 bytes, we can hash 16 inputs at once
8
+ * Each input is 64 bytes
9
+ */
10
+ const PARALLEL_FACTOR = 16;
11
+ const MAX_INPUT_SIZE = PARALLEL_FACTOR * 64;
12
+ const uint8Input = new Uint8Array(MAX_INPUT_SIZE);
13
+ const uint32Input = new Uint32Array(uint8Input.buffer);
14
+ const uint8Output = new Uint8Array(PARALLEL_FACTOR * 32);
15
+ // having this will cause more memory to extract uint32
16
+ // const uint32Output = new Uint32Array(uint8Output.buffer);
17
+ // convenient reusable Uint8Array for hash64
18
+ const hash64Input = uint8Input.subarray(0, 64);
19
+ const hash64Output = uint8Output.subarray(0, 32);
20
+ // size input array to 2 HashObject per computation * 32 bytes per object
21
+ const destNodes = new Array(PARALLEL_FACTOR);
22
+ export const hasher = {
23
+ name: "hashtree-bun",
24
+ hashInto,
25
+ digest64(obj1, obj2) {
26
+ return digest2Bytes32(obj1, obj2);
27
+ },
28
+ digest64Into: (obj1, obj2, output) => {
29
+ digest2Bytes32Into(obj1, obj2, output);
30
+ },
31
+ digest64HashObjects(left, right, parent) {
32
+ hashObjectsToUint32Array(left, right, uint32Input);
33
+ hashInto(hash64Input, hash64Output);
34
+ byteArrayIntoHashObject(hash64Output, 0, parent);
35
+ },
36
+ merkleizeBlocksBytes(blocksBytes, padFor, output, offset) {
37
+ doMerkleizeBlocksBytes(blocksBytes, padFor, output, offset, hashInto);
38
+ },
39
+ merkleizeBlockArray(blocks, blockLimit, padFor, output, offset) {
40
+ doMerkleizeBlockArray(blocks, blockLimit, padFor, output, offset, hashInto, uint8Input);
41
+ },
42
+ digestNLevel(data, nLevel) {
43
+ return doDigestNLevel(data, nLevel, hashInto);
44
+ },
45
+ executeHashComputations(hashComputations) {
46
+ for (let level = hashComputations.length - 1; level >= 0; level--) {
47
+ const hcArr = hashComputations[level];
48
+ if (!hcArr) {
49
+ // should not happen
50
+ throw Error(`no hash computations for level ${level}`);
51
+ }
52
+ if (hcArr.length === 0) {
53
+ // nothing to hash
54
+ continue;
55
+ }
56
+ // hash every 16 inputs at once to avoid memory allocation
57
+ let i = 0;
58
+ for (const { src0, src1, dest } of hcArr) {
59
+ if (!src0 || !src1 || !dest) {
60
+ throw new Error(`Invalid HashComputation at index ${i}`);
61
+ }
62
+ const indexInBatch = i % PARALLEL_FACTOR;
63
+ const offset = indexInBatch * 16;
64
+ hashObjectToUint32Array(src0, uint32Input, offset);
65
+ hashObjectToUint32Array(src1, uint32Input, offset + 8);
66
+ destNodes[indexInBatch] = dest;
67
+ if (indexInBatch === PARALLEL_FACTOR - 1) {
68
+ hashInto(uint8Input, uint8Output);
69
+ for (const [j, destNode] of destNodes.entries()) {
70
+ byteArrayIntoHashObject(uint8Output, j * 32, destNode);
71
+ }
72
+ }
73
+ i++;
74
+ }
75
+ const remaining = hcArr.length % PARALLEL_FACTOR;
76
+ // we prepared data in input, now hash the remaining
77
+ if (remaining > 0) {
78
+ const remainingInput = uint8Input.subarray(0, remaining * 64);
79
+ const remainingOutput = uint8Output.subarray(0, remaining * 32);
80
+ hashInto(remainingInput, remainingOutput);
81
+ // destNodes was prepared above
82
+ for (let j = 0; j < remaining; j++) {
83
+ byteArrayIntoHashObject(remainingOutput, j * 32, destNodes[j]);
84
+ }
85
+ }
86
+ }
87
+ },
88
+ };
89
+ function hashObjectToUint32Array(obj, arr, offset) {
90
+ arr[offset] = obj.h0;
91
+ arr[offset + 1] = obj.h1;
92
+ arr[offset + 2] = obj.h2;
93
+ arr[offset + 3] = obj.h3;
94
+ arr[offset + 4] = obj.h4;
95
+ arr[offset + 5] = obj.h5;
96
+ arr[offset + 6] = obj.h6;
97
+ arr[offset + 7] = obj.h7;
98
+ }
99
+ // note that uint32ArrayToHashObject will cause more memory
100
+ function hashObjectsToUint32Array(obj1, obj2, arr) {
101
+ arr[0] = obj1.h0;
102
+ arr[1] = obj1.h1;
103
+ arr[2] = obj1.h2;
104
+ arr[3] = obj1.h3;
105
+ arr[4] = obj1.h4;
106
+ arr[5] = obj1.h5;
107
+ arr[6] = obj1.h6;
108
+ arr[7] = obj1.h7;
109
+ arr[8] = obj2.h0;
110
+ arr[9] = obj2.h1;
111
+ arr[10] = obj2.h2;
112
+ arr[11] = obj2.h3;
113
+ arr[12] = obj2.h4;
114
+ arr[13] = obj2.h5;
115
+ arr[14] = obj2.h6;
116
+ arr[15] = obj2.h7;
117
+ }
118
+ //# sourceMappingURL=hasher_bun.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hasher_bun.js","sourceRoot":"","sources":["../../src/util/hasher_bun.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,uBAAuB,EAAC,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAKL,cAAc,EACd,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAC,cAAc,EAAE,kBAAkB,EAAE,QAAQ,EAAC,MAAM,eAAe,CAAC;AAE3E;;;;;GAKG;AACH,MAAM,eAAe,GAAG,EAAE,CAAC;AAC3B,MAAM,cAAc,GAAG,eAAe,GAAG,EAAE,CAAC;AAC5C,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,cAAc,CAAC,CAAC;AAClD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GAAG,IAAI,CAAC,EAAE,CAAC;IAClB,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;IAClB,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;AACpB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { hasher } from "@chainsafe/persistent-merkle-tree/hasher/hashtree";
2
+ export { hasher };
3
+ //# sourceMappingURL=hasher_nodejs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hasher_nodejs.d.ts","sourceRoot":"","sources":["../../src/util/hasher_nodejs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,mDAAmD,CAAC;AAEzE,OAAO,EAAC,MAAM,EAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { hasher } from "@chainsafe/persistent-merkle-tree/hasher/hashtree";
2
+ export { hasher };
3
+ //# sourceMappingURL=hasher_nodejs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hasher_nodejs.js","sourceRoot":"","sources":["../../src/util/hasher_nodejs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,mDAAmD,CAAC;AAEzE,OAAO,EAAC,MAAM,EAAC,CAAC"}
@@ -26,7 +26,7 @@ export function parseLoggerArgs(args, paths, config, opts) {
26
26
  ? {
27
27
  format: TimestampFormatCode.EpochSlot,
28
28
  genesisTime: args.logFormatGenesisTime,
29
- secondsPerSlot: config.SECONDS_PER_SLOT,
29
+ secondsPerSlot: config.SLOT_DURATION_MS / 1000,
30
30
  slotsPerEpoch: SLOTS_PER_EPOCH,
31
31
  }
32
32
  : {
@@ -1 +1 @@
1
- {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/util/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAY,mBAAmB,EAAE,UAAU,EAAC,MAAM,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OAAO,EAAE,GAAG,eAAe,EAAE,CAAC;QAC9E,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chainsafe/lodestar",
3
- "version": "1.35.0-dev.fcf8d024ea",
3
+ "version": "1.35.0-dev.fd1dac853d",
4
4
  "description": "Command line interface for lodestar",
5
5
  "author": "ChainSafe Systems",
6
6
  "license": "Apache-2.0",
@@ -9,7 +9,18 @@
9
9
  },
10
10
  "homepage": "https://github.com/ChainSafe/lodestar#readme",
11
11
  "type": "module",
12
- "exports": "./lib/index.js",
12
+ "exports": {
13
+ ".": {
14
+ "bun": "./src/index.ts",
15
+ "import": "./lib/index.js"
16
+ }
17
+ },
18
+ "imports": {
19
+ "#hashtree-hasher": {
20
+ "bun": "./src/util/hasher_bun.ts",
21
+ "import": "./lib/util/hasher_nodejs.js"
22
+ }
23
+ },
13
24
  "files": [
14
25
  "src",
15
26
  "lib",
@@ -63,17 +74,18 @@
63
74
  "@libp2p/crypto": "^5.0.15",
64
75
  "@libp2p/interface": "^2.7.0",
65
76
  "@libp2p/peer-id": "^5.1.0",
66
- "@lodestar/api": "1.35.0-dev.fcf8d024ea",
67
- "@lodestar/beacon-node": "1.35.0-dev.fcf8d024ea",
68
- "@lodestar/config": "1.35.0-dev.fcf8d024ea",
69
- "@lodestar/db": "1.35.0-dev.fcf8d024ea",
70
- "@lodestar/light-client": "1.35.0-dev.fcf8d024ea",
71
- "@lodestar/logger": "1.35.0-dev.fcf8d024ea",
72
- "@lodestar/params": "1.35.0-dev.fcf8d024ea",
73
- "@lodestar/state-transition": "1.35.0-dev.fcf8d024ea",
74
- "@lodestar/types": "1.35.0-dev.fcf8d024ea",
75
- "@lodestar/utils": "1.35.0-dev.fcf8d024ea",
76
- "@lodestar/validator": "1.35.0-dev.fcf8d024ea",
77
+ "@lodestar/api": "1.35.0-dev.fd1dac853d",
78
+ "@lodestar/beacon-node": "1.35.0-dev.fd1dac853d",
79
+ "@lodestar/bun": "git+https://github.com/ChainSafe/lodestar-bun.git",
80
+ "@lodestar/config": "1.35.0-dev.fd1dac853d",
81
+ "@lodestar/db": "1.35.0-dev.fd1dac853d",
82
+ "@lodestar/light-client": "1.35.0-dev.fd1dac853d",
83
+ "@lodestar/logger": "1.35.0-dev.fd1dac853d",
84
+ "@lodestar/params": "1.35.0-dev.fd1dac853d",
85
+ "@lodestar/state-transition": "1.35.0-dev.fd1dac853d",
86
+ "@lodestar/types": "1.35.0-dev.fd1dac853d",
87
+ "@lodestar/utils": "1.35.0-dev.fd1dac853d",
88
+ "@lodestar/validator": "1.35.0-dev.fd1dac853d",
77
89
  "@multiformats/multiaddr": "^12.1.3",
78
90
  "deepmerge": "^4.3.1",
79
91
  "ethers": "^6.7.0",
@@ -88,12 +100,12 @@
88
100
  "yargs": "^17.7.1"
89
101
  },
90
102
  "devDependencies": {
91
- "@lodestar/test-utils": "1.35.0-dev.fcf8d024ea",
103
+ "@lodestar/test-utils": "1.35.0-dev.fd1dac853d",
92
104
  "@types/debug": "^4.1.7",
93
105
  "@types/inquirer": "^9.0.3",
94
106
  "@types/proper-lockfile": "^4.1.4",
95
107
  "@types/yargs": "^17.0.24",
96
108
  "fastify": "^5.2.1"
97
109
  },
98
- "gitHead": "d72abda1a1607ce062febfcfc4528b9e9848c288"
110
+ "gitHead": "f06d12a7e66a85186ef97b1f6da57c22536e4a18"
99
111
  }
@@ -1,6 +1,7 @@
1
1
  // MUST import this file first before anything and not import any Lodestar code.
2
+
3
+ import {hasher as hashtreeHasher} from "#hashtree-hasher";
2
4
  import {setHasher} from "@chainsafe/persistent-merkle-tree";
3
- import {hasher as hashtreeHasher} from "@chainsafe/persistent-merkle-tree/hasher/hashtree";
4
5
 
5
6
  // Without setting this first, persistent-merkle-tree will use noble instead
6
7
  setHasher(hashtreeHasher);
@@ -212,14 +212,14 @@ export const validatorOptions: CliCommandOptions<IValidatorCliArgs> = {
212
212
  afterBlockDelaySlotFraction: {
213
213
  hidden: true,
214
214
  description:
215
- "Delay before publishing attestations if block comes early, as a fraction of SECONDS_PER_SLOT (value is from 0 inclusive to 1 exclusive)",
215
+ "Delay before publishing attestations if block comes early, as a fraction of SLOT_DURATION_MS (value is from 0 inclusive to 1 exclusive)",
216
216
  type: "number",
217
217
  },
218
218
 
219
219
  scAfterBlockDelaySlotFraction: {
220
220
  hidden: true,
221
221
  description:
222
- "Delay before publishing SyncCommitteeSignature if block comes early, as a fraction of SECONDS_PER_SLOT (value is from 0 inclusive to 1 exclusive)",
222
+ "Delay before publishing SyncCommitteeSignature if block comes early, as a fraction of SLOT_DURATION_MS (value is from 0 inclusive to 1 exclusive)",
223
223
  type: "number",
224
224
  },
225
225
 
@@ -0,0 +1,133 @@
1
+ import {byteArrayIntoHashObject} from "@chainsafe/as-sha256";
2
+ import {
3
+ HashComputationLevel,
4
+ HashObject,
5
+ Hasher,
6
+ Node,
7
+ doDigestNLevel,
8
+ doMerkleizeBlockArray,
9
+ doMerkleizeBlocksBytes,
10
+ } from "@chainsafe/persistent-merkle-tree";
11
+ import {digest2Bytes32, digest2Bytes32Into, hashInto} from "@lodestar/bun";
12
+
13
+ /**
14
+ * Best SIMD implementation is in 512 bits = 64 bytes
15
+ * If not, hashtree will make a loop inside
16
+ * Given sha256 operates on a block of 4 bytes, we can hash 16 inputs at once
17
+ * Each input is 64 bytes
18
+ */
19
+ const PARALLEL_FACTOR = 16;
20
+ const MAX_INPUT_SIZE = PARALLEL_FACTOR * 64;
21
+ const uint8Input = new Uint8Array(MAX_INPUT_SIZE);
22
+ const uint32Input = new Uint32Array(uint8Input.buffer);
23
+ const uint8Output = new Uint8Array(PARALLEL_FACTOR * 32);
24
+ // having this will cause more memory to extract uint32
25
+ // const uint32Output = new Uint32Array(uint8Output.buffer);
26
+ // convenient reusable Uint8Array for hash64
27
+ const hash64Input = uint8Input.subarray(0, 64);
28
+ const hash64Output = uint8Output.subarray(0, 32);
29
+ // size input array to 2 HashObject per computation * 32 bytes per object
30
+ const destNodes: Node[] = new Array<Node>(PARALLEL_FACTOR);
31
+
32
+ export const hasher: Hasher = {
33
+ name: "hashtree-bun",
34
+ hashInto,
35
+ digest64(obj1: Uint8Array, obj2: Uint8Array): Uint8Array {
36
+ return digest2Bytes32(obj1, obj2);
37
+ },
38
+ digest64Into: (obj1: Uint8Array, obj2: Uint8Array, output: Uint8Array): void => {
39
+ digest2Bytes32Into(obj1, obj2, output);
40
+ },
41
+ digest64HashObjects(left: HashObject, right: HashObject, parent: HashObject): void {
42
+ hashObjectsToUint32Array(left, right, uint32Input);
43
+ hashInto(hash64Input, hash64Output);
44
+ byteArrayIntoHashObject(hash64Output, 0, parent);
45
+ },
46
+ merkleizeBlocksBytes(blocksBytes: Uint8Array, padFor: number, output: Uint8Array, offset: number): void {
47
+ doMerkleizeBlocksBytes(blocksBytes, padFor, output, offset, hashInto);
48
+ },
49
+ merkleizeBlockArray(blocks, blockLimit, padFor, output, offset) {
50
+ doMerkleizeBlockArray(blocks, blockLimit, padFor, output, offset, hashInto, uint8Input);
51
+ },
52
+ digestNLevel(data: Uint8Array, nLevel: number): Uint8Array {
53
+ return doDigestNLevel(data, nLevel, hashInto);
54
+ },
55
+ executeHashComputations(hashComputations: HashComputationLevel[]): void {
56
+ for (let level = hashComputations.length - 1; level >= 0; level--) {
57
+ const hcArr = hashComputations[level];
58
+ if (!hcArr) {
59
+ // should not happen
60
+ throw Error(`no hash computations for level ${level}`);
61
+ }
62
+
63
+ if (hcArr.length === 0) {
64
+ // nothing to hash
65
+ continue;
66
+ }
67
+
68
+ // hash every 16 inputs at once to avoid memory allocation
69
+ let i = 0;
70
+ for (const {src0, src1, dest} of hcArr) {
71
+ if (!src0 || !src1 || !dest) {
72
+ throw new Error(`Invalid HashComputation at index ${i}`);
73
+ }
74
+ const indexInBatch = i % PARALLEL_FACTOR;
75
+ const offset = indexInBatch * 16;
76
+
77
+ hashObjectToUint32Array(src0, uint32Input, offset);
78
+ hashObjectToUint32Array(src1, uint32Input, offset + 8);
79
+ destNodes[indexInBatch] = dest;
80
+ if (indexInBatch === PARALLEL_FACTOR - 1) {
81
+ hashInto(uint8Input, uint8Output);
82
+ for (const [j, destNode] of destNodes.entries()) {
83
+ byteArrayIntoHashObject(uint8Output, j * 32, destNode);
84
+ }
85
+ }
86
+ i++;
87
+ }
88
+
89
+ const remaining = hcArr.length % PARALLEL_FACTOR;
90
+ // we prepared data in input, now hash the remaining
91
+ if (remaining > 0) {
92
+ const remainingInput = uint8Input.subarray(0, remaining * 64);
93
+ const remainingOutput = uint8Output.subarray(0, remaining * 32);
94
+ hashInto(remainingInput, remainingOutput);
95
+ // destNodes was prepared above
96
+ for (let j = 0; j < remaining; j++) {
97
+ byteArrayIntoHashObject(remainingOutput, j * 32, destNodes[j]);
98
+ }
99
+ }
100
+ }
101
+ },
102
+ };
103
+
104
+ function hashObjectToUint32Array(obj: HashObject, arr: Uint32Array, offset: number): void {
105
+ arr[offset] = obj.h0;
106
+ arr[offset + 1] = obj.h1;
107
+ arr[offset + 2] = obj.h2;
108
+ arr[offset + 3] = obj.h3;
109
+ arr[offset + 4] = obj.h4;
110
+ arr[offset + 5] = obj.h5;
111
+ arr[offset + 6] = obj.h6;
112
+ arr[offset + 7] = obj.h7;
113
+ }
114
+
115
+ // note that uint32ArrayToHashObject will cause more memory
116
+ function hashObjectsToUint32Array(obj1: HashObject, obj2: HashObject, arr: Uint32Array): void {
117
+ arr[0] = obj1.h0;
118
+ arr[1] = obj1.h1;
119
+ arr[2] = obj1.h2;
120
+ arr[3] = obj1.h3;
121
+ arr[4] = obj1.h4;
122
+ arr[5] = obj1.h5;
123
+ arr[6] = obj1.h6;
124
+ arr[7] = obj1.h7;
125
+ arr[8] = obj2.h0;
126
+ arr[9] = obj2.h1;
127
+ arr[10] = obj2.h2;
128
+ arr[11] = obj2.h3;
129
+ arr[12] = obj2.h4;
130
+ arr[13] = obj2.h5;
131
+ arr[14] = obj2.h6;
132
+ arr[15] = obj2.h7;
133
+ }
@@ -0,0 +1,3 @@
1
+ import {hasher} from "@chainsafe/persistent-merkle-tree/hasher/hashtree";
2
+
3
+ export {hasher};
@@ -38,7 +38,7 @@ export function parseLoggerArgs(
38
38
  ? {
39
39
  format: TimestampFormatCode.EpochSlot,
40
40
  genesisTime: args.logFormatGenesisTime,
41
- secondsPerSlot: config.SECONDS_PER_SLOT,
41
+ secondsPerSlot: config.SLOT_DURATION_MS / 1000,
42
42
  slotsPerEpoch: SLOTS_PER_EPOCH,
43
43
  }
44
44
  : {