@lodestar/era 1.40.0 → 1.41.0-dev.0087e7a664
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/lib/era/reader.d.ts +1 -1
- package/lib/era/util.d.ts +1 -1
- package/lib/util.d.ts.map +1 -1
- package/lib/util.js +2 -9
- package/lib/util.js.map +1 -1
- package/package.json +7 -7
- package/src/e2s.ts +1 -1
- package/src/era/reader.ts +3 -3
- package/src/era/util.ts +2 -2
- package/src/era/writer.ts +3 -3
- package/src/util.ts +2 -12
package/lib/era/reader.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type FileHandle } from "node:fs/promises";
|
|
2
2
|
import { ChainForkConfig } from "@lodestar/config";
|
|
3
3
|
import { BeaconState, SignedBeaconBlock, Slot } from "@lodestar/types";
|
|
4
|
-
import { EraIndices } from "./util.
|
|
4
|
+
import { EraIndices } from "./util.js";
|
|
5
5
|
/**
|
|
6
6
|
* EraReader is responsible for reading and validating ERA files.
|
|
7
7
|
*
|
package/lib/era/util.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { FileHandle } from "node:fs/promises";
|
|
2
2
|
import { ChainForkConfig } from "@lodestar/config";
|
|
3
3
|
import { BeaconState, Slot } from "@lodestar/types";
|
|
4
|
-
import { SlotIndex } from "../e2s.
|
|
4
|
+
import { SlotIndex } from "../e2s.js";
|
|
5
5
|
/**
|
|
6
6
|
* Parsed components of an .era file name.
|
|
7
7
|
* Format: <config-name>-<era-number>-<short-historical-root>.era
|
package/lib/util.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAEA,4DAA4D;AAC5D,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEnE;AAED,8DAA8D;AAC9D,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEpE;AAED,8DAA8D;AAC9D,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEpE;AAED,8DAA8D;AAC9D,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEpE;AAED,yEAAyE;AACzE,wBAAgB,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAE9E;AAED,2EAA2E;AAC3E,wBAAgB,WAAW,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAE/E;AAED,2EAA2E;AAC3E,wBAAgB,WAAW,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAE/E;AAED,qCAAqC;AACrC,wBAAgB,gBAAgB,CAAC,cAAc,EAAE,UAAU,GAAG,UAAU,CAEvE;AAED,yCAAyC;AACzC,wBAAsB,cAAc,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAM1E"}
|
package/lib/util.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { SnappyFramesUncompress, encodeSnappy } from "@lodestar/reqresp/utils";
|
|
1
|
+
import { decodeSnappyFrames, encodeSnappy } from "@lodestar/reqresp/utils";
|
|
3
2
|
/** Read 48-bit signed integer (little-endian) at offset. */
|
|
4
3
|
export function readInt48(bytes, offset) {
|
|
5
4
|
return Buffer.prototype.readIntLE.call(bytes, offset, 6);
|
|
@@ -30,13 +29,7 @@ export function writeUint32(target, offset, v) {
|
|
|
30
29
|
}
|
|
31
30
|
/** Decompress snappy-framed data */
|
|
32
31
|
export function snappyUncompress(compressedData) {
|
|
33
|
-
|
|
34
|
-
const input = new Uint8ArrayList(compressedData);
|
|
35
|
-
const result = decompressor.uncompress(input);
|
|
36
|
-
if (result === null) {
|
|
37
|
-
throw new Error("Snappy decompression failed - no data returned");
|
|
38
|
-
}
|
|
39
|
-
return result.subarray();
|
|
32
|
+
return decodeSnappyFrames(compressedData).subarray();
|
|
40
33
|
}
|
|
41
34
|
/** Compress data using snappy framing */
|
|
42
35
|
export async function snappyCompress(data) {
|
package/lib/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAE,YAAY,EAAC,MAAM,yBAAyB,CAAC;AAEzE,4DAA4D;AAC5D,MAAM,UAAU,SAAS,CAAC,KAAiB,EAAE,MAAc;IACzD,OAAO,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED,8DAA8D;AAC9D,MAAM,UAAU,UAAU,CAAC,KAAiB,EAAE,MAAc;IAC1D,OAAO,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;AAC5D,CAAC;AAED,8DAA8D;AAC9D,MAAM,UAAU,UAAU,CAAC,KAAiB,EAAE,MAAc;IAC1D,OAAO,MAAM,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAC3D,CAAC;AAED,8DAA8D;AAC9D,MAAM,UAAU,UAAU,CAAC,KAAiB,EAAE,MAAc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|
|
|
11
11
|
"bugs": {
|
|
12
12
|
"url": "https://github.com/ChainSafe/lodestar/issues"
|
|
13
13
|
},
|
|
14
|
-
"version": "1.
|
|
14
|
+
"version": "1.41.0-dev.0087e7a664",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
@@ -40,12 +40,12 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@chainsafe/blst": "^2.2.0",
|
|
43
|
-
"@lodestar/config": "^1.
|
|
44
|
-
"@lodestar/params": "^1.
|
|
45
|
-
"@lodestar/reqresp": "^1.
|
|
46
|
-
"@lodestar/types": "^1.
|
|
47
|
-
"@lodestar/utils": "^1.
|
|
43
|
+
"@lodestar/config": "^1.41.0-dev.0087e7a664",
|
|
44
|
+
"@lodestar/params": "^1.41.0-dev.0087e7a664",
|
|
45
|
+
"@lodestar/reqresp": "^1.41.0-dev.0087e7a664",
|
|
46
|
+
"@lodestar/types": "^1.41.0-dev.0087e7a664",
|
|
47
|
+
"@lodestar/utils": "^1.41.0-dev.0087e7a664",
|
|
48
48
|
"uint8arraylist": "^2.4.7"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "c05479d7c03f0e9a68db3ee17c4bf2cd6925080a"
|
|
51
51
|
}
|
package/src/e2s.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type {FileHandle} from "node:fs/promises";
|
|
2
2
|
import {Slot} from "@lodestar/types";
|
|
3
3
|
import {byteArrayEquals} from "@lodestar/utils";
|
|
4
|
-
import {readInt48, readUint16, readUint32, writeInt48, writeUint16, writeUint32} from "./util.
|
|
4
|
+
import {readInt48, readUint16, readUint32, writeInt48, writeUint16, writeUint32} from "./util.js";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Known entry types in an E2Store (.e2s) file along with their exact 2-byte codes.
|
package/src/era/reader.ts
CHANGED
|
@@ -5,15 +5,15 @@ import {ChainForkConfig, createCachedGenesis} from "@lodestar/config";
|
|
|
5
5
|
import {DOMAIN_BEACON_PROPOSER, GENESIS_SLOT, SLOTS_PER_HISTORICAL_ROOT} from "@lodestar/params";
|
|
6
6
|
import {BeaconState, SignedBeaconBlock, Slot, ssz} from "@lodestar/types";
|
|
7
7
|
import {byteArrayEquals} from "@lodestar/utils";
|
|
8
|
-
import {E2STORE_HEADER_SIZE, EntryType, readEntry, readVersion} from "../e2s.
|
|
9
|
-
import {snappyUncompress} from "../util.
|
|
8
|
+
import {E2STORE_HEADER_SIZE, EntryType, readEntry, readVersion} from "../e2s.js";
|
|
9
|
+
import {snappyUncompress} from "../util.js";
|
|
10
10
|
import {
|
|
11
11
|
EraIndices,
|
|
12
12
|
computeEraNumberFromBlockSlot,
|
|
13
13
|
parseEraName,
|
|
14
14
|
readAllEraIndices,
|
|
15
15
|
readSlotFromBeaconStateBytes,
|
|
16
|
-
} from "./util.
|
|
16
|
+
} from "./util.js";
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* EraReader is responsible for reading and validating ERA files.
|
package/src/era/util.ts
CHANGED
|
@@ -2,8 +2,8 @@ import type {FileHandle} from "node:fs/promises";
|
|
|
2
2
|
import {ChainForkConfig} from "@lodestar/config";
|
|
3
3
|
import {SLOTS_PER_HISTORICAL_ROOT, isForkPostCapella} from "@lodestar/params";
|
|
4
4
|
import {BeaconState, Slot, capella, ssz} from "@lodestar/types";
|
|
5
|
-
import {E2STORE_HEADER_SIZE, SlotIndex, readSlotIndex} from "../e2s.
|
|
6
|
-
import {readUint48} from "../util.
|
|
5
|
+
import {E2STORE_HEADER_SIZE, SlotIndex, readSlotIndex} from "../e2s.js";
|
|
6
|
+
import {readUint48} from "../util.js";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Parsed components of an .era file name.
|
package/src/era/writer.ts
CHANGED
|
@@ -3,14 +3,14 @@ import {format, parse} from "node:path";
|
|
|
3
3
|
import {ChainForkConfig} from "@lodestar/config";
|
|
4
4
|
import {SLOTS_PER_HISTORICAL_ROOT} from "@lodestar/params";
|
|
5
5
|
import {BeaconState, SignedBeaconBlock, Slot} from "@lodestar/types";
|
|
6
|
-
import {E2STORE_HEADER_SIZE, EntryType, SlotIndex, serializeSlotIndex, writeEntry} from "../e2s.
|
|
7
|
-
import {snappyCompress} from "../util.
|
|
6
|
+
import {E2STORE_HEADER_SIZE, EntryType, SlotIndex, serializeSlotIndex, writeEntry} from "../e2s.js";
|
|
7
|
+
import {snappyCompress} from "../util.js";
|
|
8
8
|
import {
|
|
9
9
|
computeStartBlockSlotFromEraNumber,
|
|
10
10
|
getShortHistoricalRoot,
|
|
11
11
|
isSlotInRange,
|
|
12
12
|
isValidEraStateSlot,
|
|
13
|
-
} from "./util.
|
|
13
|
+
} from "./util.js";
|
|
14
14
|
|
|
15
15
|
enum WriterStateType {
|
|
16
16
|
InitGroup,
|
package/src/util.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {SnappyFramesUncompress, encodeSnappy} from "@lodestar/reqresp/utils";
|
|
1
|
+
import {decodeSnappyFrames, encodeSnappy} from "@lodestar/reqresp/utils";
|
|
3
2
|
|
|
4
3
|
/** Read 48-bit signed integer (little-endian) at offset. */
|
|
5
4
|
export function readInt48(bytes: Uint8Array, offset: number): number {
|
|
@@ -38,16 +37,7 @@ export function writeUint32(target: Uint8Array, offset: number, v: number): void
|
|
|
38
37
|
|
|
39
38
|
/** Decompress snappy-framed data */
|
|
40
39
|
export function snappyUncompress(compressedData: Uint8Array): Uint8Array {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const input = new Uint8ArrayList(compressedData);
|
|
44
|
-
const result = decompressor.uncompress(input);
|
|
45
|
-
|
|
46
|
-
if (result === null) {
|
|
47
|
-
throw new Error("Snappy decompression failed - no data returned");
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return result.subarray();
|
|
40
|
+
return decodeSnappyFrames(compressedData).subarray();
|
|
51
41
|
}
|
|
52
42
|
|
|
53
43
|
/** Compress data using snappy framing */
|