@lodestar/reqresp 1.19.0-dev.f4f570f2bf → 1.19.0-rc.0
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 +1 -1
- package/lib/encoders/responseEncode.js +2 -1
- package/lib/encoders/responseEncode.js.map +1 -1
- package/lib/encodingStrategies/sszSnappy/encode.js +2 -1
- package/lib/encodingStrategies/sszSnappy/encode.js.map +1 -1
- package/lib/utils/errorMessage.js +3 -3
- package/lib/utils/errorMessage.js.map +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[](https://discord.gg/aMxzVcr)
|
|
4
4
|
[](https://github.com/ethereum/beacon-APIs/releases/tag/v2.1.0)
|
|
5
5
|

|
|
6
|
-

|
|
7
7
|
|
|
8
8
|
> This package is part of [ChainSafe's Lodestar](https://lodestar.chainsafe.io) project
|
|
9
9
|
|
|
@@ -2,6 +2,7 @@ import { writeEncodedPayload } from "../encodingStrategies/index.js";
|
|
|
2
2
|
import { encodeErrorMessage } from "../utils/index.js";
|
|
3
3
|
import { ContextBytesType } from "../types.js";
|
|
4
4
|
import { RespStatus } from "../interface.js";
|
|
5
|
+
const SUCCESS_BUFFER = Buffer.from([RespStatus.SUCCESS]);
|
|
5
6
|
/**
|
|
6
7
|
* Yields byte chunks for a `<response>` with a zero response code `<result>`
|
|
7
8
|
* ```bnf
|
|
@@ -18,7 +19,7 @@ export function responseEncodeSuccess(protocol, cbs) {
|
|
|
18
19
|
// Postfix increment, return 0 as first chunk
|
|
19
20
|
cbs.onChunk(chunkIndex++);
|
|
20
21
|
// <result>
|
|
21
|
-
yield
|
|
22
|
+
yield SUCCESS_BUFFER;
|
|
22
23
|
// <context-bytes> - from altair
|
|
23
24
|
const contextBytes = getContextBytes(protocol.contextBytes, chunk);
|
|
24
25
|
if (contextBytes) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"responseEncode.js","sourceRoot":"","sources":["../../src/encoders/responseEncode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAC,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAC,gBAAgB,EAAiE,MAAM,aAAa,CAAC;AAC7G,OAAO,EAAC,UAAU,EAAyB,MAAM,iBAAiB,CAAC;AAEnE;;;;;;;;GAQG;AACH,MAAM,UAAU,qBAAqB,CACnC,QAAkB,EAClB,GAA4C;IAE5C,OAAO,KAAK,SAAS,CAAC,CAAC,8BAA8B,CAAC,MAAM;QAC1D,IAAI,UAAU,GAAG,CAAC,CAAC;QAEnB,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YACjC,6CAA6C;YAC7C,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;YAE1B,WAAW;YACX,MAAM,
|
|
1
|
+
{"version":3,"file":"responseEncode.js","sourceRoot":"","sources":["../../src/encoders/responseEncode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAC,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAC,gBAAgB,EAAiE,MAAM,aAAa,CAAC;AAC7G,OAAO,EAAC,UAAU,EAAyB,MAAM,iBAAiB,CAAC;AAEnE,MAAM,cAAc,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;AAEzD;;;;;;;;GAQG;AACH,MAAM,UAAU,qBAAqB,CACnC,QAAkB,EAClB,GAA4C;IAE5C,OAAO,KAAK,SAAS,CAAC,CAAC,8BAA8B,CAAC,MAAM;QAC1D,IAAI,UAAU,GAAG,CAAC,CAAC;QAEnB,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YACjC,6CAA6C;YAC7C,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;YAE1B,WAAW;YACX,MAAM,cAAc,CAAC;YAErB,gCAAgC;YAChC,MAAM,YAAY,GAAG,eAAe,CAAC,QAAQ,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;YACnE,IAAI,YAAY,EAAE,CAAC;gBACjB,MAAM,YAAsB,CAAC;YAC/B,CAAC;YAED,kDAAkD;YAClD,KAAK,CAAC,CAAC,mBAAmB,CAAC,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAC5D,CAAC;IACH,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,SAAS,CAAC,CAAC,mBAAmB,CACxC,QAAyC,EACzC,MAA8B,EAC9B,YAAoB;IAEpB,WAAW;IACX,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;IAE5B,+BAA+B;IAC/B,IAAI,YAAY,EAAE,CAAC;QACjB,KAAK,CAAC,CAAC,kBAAkB,CAAC,YAAY,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC7D,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,SAAS,eAAe,CAAC,YAAiC,EAAE,KAAuB;IACjF,QAAQ,YAAY,CAAC,IAAI,EAAE,CAAC;QAC1B,gBAAgB;QAChB,KAAK,gBAAgB,CAAC,KAAK;YACzB,OAAO,IAAI,CAAC;QAEd,4DAA4D;QAC5D,KAAK,gBAAgB,CAAC,UAAU;YAC9B,OAAO,YAAY,CAAC,iBAAiB,CAAC,mBAAmB,CAAC,KAAK,CAAC,IAAI,CAAW,CAAC;IACpF,CAAC;AACH,CAAC"}
|
|
@@ -13,7 +13,8 @@ export const writeSszSnappyPayload = encodeSszSnappy;
|
|
|
13
13
|
*/
|
|
14
14
|
export async function* encodeSszSnappy(bytes) {
|
|
15
15
|
// MUST encode the length of the raw SSZ bytes, encoded as an unsigned protobuf varint
|
|
16
|
-
|
|
16
|
+
const varint = varintEncode(bytes.length);
|
|
17
|
+
yield Buffer.from(varint.buffer, varint.byteOffset, varint.byteLength);
|
|
17
18
|
// By first computing and writing the SSZ byte length, the SSZ encoder can then directly
|
|
18
19
|
// write the chunk contents to the stream. Snappy writer compresses frame by frame
|
|
19
20
|
yield* encodeSnappy(bytes);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encode.js","sourceRoot":"","sources":["../../../src/encodingStrategies/sszSnappy/encode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,IAAI,YAAY,EAAC,MAAM,cAAc,CAAC;AACpD,OAAO,EAAC,YAAY,EAAC,MAAM,4BAA4B,CAAC;AAExD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,eAAgE,CAAC;AAEtG;;GAEG;AACH,MAAM,CAAC,KAAK,SAAS,CAAC,CAAC,eAAe,CAAC,KAAa;IAClD,sFAAsF;IACtF,MAAM,MAAM,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"encode.js","sourceRoot":"","sources":["../../../src/encodingStrategies/sszSnappy/encode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,IAAI,YAAY,EAAC,MAAM,cAAc,CAAC;AACpD,OAAO,EAAC,YAAY,EAAC,MAAM,4BAA4B,CAAC;AAExD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,eAAgE,CAAC;AAEtG;;GAEG;AACH,MAAM,CAAC,KAAK,SAAS,CAAC,CAAC,eAAe,CAAC,KAAa;IAClD,sFAAsF;IACtF,MAAM,MAAM,GAAG,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1C,MAAM,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC;IAEvE,wFAAwF;IACxF,kFAAkF;IAClF,KAAK,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { writeSszSnappyPayload } from "../encodingStrategies/sszSnappy/encode.js";
|
|
2
2
|
import { Encoding } from "../types.js";
|
|
3
3
|
// ErrorMessage schema:
|
|
4
4
|
//
|
|
@@ -15,10 +15,10 @@ import { Encoding } from "../types.js";
|
|
|
15
15
|
*/
|
|
16
16
|
export async function* encodeErrorMessage(errorMessage, encoding) {
|
|
17
17
|
const encoder = new TextEncoder();
|
|
18
|
-
const bytes =
|
|
18
|
+
const bytes = encoder.encode(errorMessage).slice(0, 256);
|
|
19
19
|
switch (encoding) {
|
|
20
20
|
case Encoding.SSZ_SNAPPY:
|
|
21
|
-
yield*
|
|
21
|
+
yield* writeSszSnappyPayload(bytes);
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errorMessage.js","sourceRoot":"","sources":["../../src/utils/errorMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"errorMessage.js","sourceRoot":"","sources":["../../src/utils/errorMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,qBAAqB,EAAC,MAAM,2CAA2C,CAAC;AAChF,OAAO,EAAC,QAAQ,EAAC,MAAM,aAAa,CAAC;AAErC,uBAAuB;AACvB,EAAE;AACF,IAAI;AACJ,mCAAmC;AACnC,IAAI;AACJ,EAAE;AACF,uFAAuF;AACvF,wFAAwF;AACxF,EAAE;AACF,sHAAsH;AAEtH;;GAEG;AACH,MAAM,CAAC,KAAK,SAAS,CAAC,CAAC,kBAAkB,CAAC,YAAoB,EAAE,QAAkB;IAChF,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;IAClC,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAEzD,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,QAAQ,CAAC,UAAU;YACtB,KAAK,CAAC,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC;IACxC,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,YAAwB;IACzD,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;IAClC,0CAA0C;IAC1C,OAAO,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;AACjF,CAAC"}
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"bugs": {
|
|
12
12
|
"url": "https://github.com/ChainSafe/lodestar/issues"
|
|
13
13
|
},
|
|
14
|
-
"version": "1.19.0-
|
|
14
|
+
"version": "1.19.0-rc.0",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
@@ -54,9 +54,9 @@
|
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@chainsafe/fast-crc32c": "^4.1.1",
|
|
56
56
|
"@libp2p/interface": "^1.3.0",
|
|
57
|
-
"@lodestar/config": "1.19.0-
|
|
58
|
-
"@lodestar/params": "1.19.0-
|
|
59
|
-
"@lodestar/utils": "1.19.0-
|
|
57
|
+
"@lodestar/config": "1.19.0-rc.0",
|
|
58
|
+
"@lodestar/params": "1.19.0-rc.0",
|
|
59
|
+
"@lodestar/utils": "1.19.0-rc.0",
|
|
60
60
|
"it-all": "^3.0.4",
|
|
61
61
|
"it-pipe": "^3.0.1",
|
|
62
62
|
"snappy": "^7.2.2",
|
|
@@ -65,8 +65,8 @@
|
|
|
65
65
|
"uint8arraylist": "^2.4.7"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@lodestar/logger": "1.19.0-
|
|
69
|
-
"@lodestar/types": "1.19.0-
|
|
68
|
+
"@lodestar/logger": "1.19.0-rc.0",
|
|
69
|
+
"@lodestar/types": "1.19.0-rc.0",
|
|
70
70
|
"libp2p": "1.4.3"
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
"reqresp",
|
|
81
81
|
"blockchain"
|
|
82
82
|
],
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "696ad4c02f63b6ea27a77c552ce7b366d75c8ae8"
|
|
84
84
|
}
|