@lodestar/beacon-node 1.46.0-dev.cdb6b1a0d2 → 1.46.0-dev.d9065a2b16
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/api/impl/config/constants.d.ts +1 -0
- package/lib/api/impl/config/constants.d.ts.map +1 -1
- package/lib/api/impl/config/constants.js +2 -1
- package/lib/api/impl/config/constants.js.map +1 -1
- package/lib/api/impl/lodestar/index.d.ts.map +1 -1
- package/lib/api/impl/lodestar/index.js +2 -3
- package/lib/api/impl/lodestar/index.js.map +1 -1
- package/lib/chain/archiveStore/archiveStore.d.ts.map +1 -1
- package/lib/chain/archiveStore/archiveStore.js +17 -3
- package/lib/chain/archiveStore/archiveStore.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/historicalStateRegen.d.ts.map +1 -1
- package/lib/chain/archiveStore/historicalState/historicalStateRegen.js +0 -1
- package/lib/chain/archiveStore/historicalState/historicalStateRegen.js.map +1 -1
- package/lib/chain/blocks/verifyExecutionPayloadEnvelope.js +1 -1
- package/lib/chain/blocks/verifyExecutionPayloadEnvelope.js.map +1 -1
- package/lib/chain/bls/multithread/index.d.ts.map +1 -1
- package/lib/chain/bls/multithread/index.js +0 -1
- package/lib/chain/bls/multithread/index.js.map +1 -1
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +26 -44
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/opPools/aggregatedAttestationPool.d.ts.map +1 -1
- package/lib/chain/opPools/aggregatedAttestationPool.js +2 -1
- package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.js +1 -1
- package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
- package/lib/chain/validation/blobSidecar.js +1 -1
- package/lib/chain/validation/executionPayloadBid.d.ts +5 -0
- package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -1
- package/lib/chain/validation/executionPayloadBid.js +30 -2
- package/lib/chain/validation/executionPayloadBid.js.map +1 -1
- package/lib/chain/validation/proposerPreferences.js +8 -8
- package/lib/chain/validation/proposerPreferences.js.map +1 -1
- package/lib/chain/validatorMonitor.js +1 -1
- package/lib/chain/validatorMonitor.js.map +1 -1
- package/lib/metrics/nodeJsMetrics.js +1 -1
- package/lib/metrics/nodeJsMetrics.js.map +1 -1
- package/lib/network/core/networkCoreWorkerHandler.d.ts.map +1 -1
- package/lib/network/core/networkCoreWorkerHandler.js +2 -7
- package/lib/network/core/networkCoreWorkerHandler.js.map +1 -1
- package/lib/network/discv5/index.d.ts.map +1 -1
- package/lib/network/discv5/index.js +1 -4
- package/lib/network/discv5/index.js.map +1 -1
- package/lib/network/gossip/topic.d.ts +2 -2
- package/lib/network/libp2p/index.d.ts.map +1 -1
- package/lib/network/libp2p/index.js +2 -9
- package/lib/network/libp2p/index.js.map +1 -1
- package/lib/network/peers/datastore.d.ts +1 -1
- package/lib/network/peers/datastore.d.ts.map +1 -1
- package/lib/network/peers/datastore.js +1 -1
- package/lib/network/peers/datastore.js.map +1 -1
- package/lib/util/profile.d.ts +3 -0
- package/lib/util/profile.d.ts.map +1 -1
- package/lib/util/profile.js +1 -27
- package/lib/util/profile.js.map +1 -1
- package/lib/util/sszBytes.js +1 -1
- package/package.json +25 -36
- package/src/api/impl/config/constants.ts +2 -0
- package/src/api/impl/lodestar/index.ts +2 -3
- package/src/chain/archiveStore/archiveStore.ts +20 -3
- package/src/chain/archiveStore/historicalState/historicalStateRegen.ts +0 -1
- package/src/chain/blocks/verifyExecutionPayloadEnvelope.ts +1 -1
- package/src/chain/bls/multithread/index.ts +0 -1
- package/src/chain/chain.ts +33 -49
- package/src/chain/opPools/aggregatedAttestationPool.ts +3 -1
- package/src/chain/produceBlock/produceBlockBody.ts +1 -1
- package/src/chain/validation/blobSidecar.ts +1 -1
- package/src/chain/validation/executionPayloadBid.ts +32 -2
- package/src/chain/validation/proposerPreferences.ts +8 -8
- package/src/chain/validatorMonitor.ts +1 -1
- package/src/metrics/nodeJsMetrics.ts +1 -1
- package/src/network/core/networkCoreWorkerHandler.ts +2 -6
- package/src/network/discv5/index.ts +1 -4
- package/src/network/libp2p/index.ts +2 -10
- package/src/network/peers/datastore.ts +1 -1
- package/src/util/profile.ts +1 -31
- package/src/util/sszBytes.ts +1 -1
- package/lib/bun-wrappers/prometheus-gc-stats.d.ts +0 -2
- package/lib/bun-wrappers/prometheus-gc-stats.d.ts.map +0 -1
- package/lib/bun-wrappers/prometheus-gc-stats.js +0 -8
- package/lib/bun-wrappers/prometheus-gc-stats.js.map +0 -1
- package/lib/network/peers/datastore_bun.d.ts +0 -3
- package/lib/network/peers/datastore_bun.d.ts.map +0 -1
- package/lib/network/peers/datastore_bun.js +0 -3
- package/lib/network/peers/datastore_bun.js.map +0 -1
- package/src/bun-wrappers/prometheus-gc-stats.ts +0 -7
- package/src/network/peers/datastore_bun.ts +0 -3
package/lib/util/profile.js
CHANGED
|
@@ -8,19 +8,10 @@ var ProfileThread;
|
|
|
8
8
|
ProfileThread["NETWORK"] = "network";
|
|
9
9
|
ProfileThread["DISC5"] = "discv5";
|
|
10
10
|
})(ProfileThread || (ProfileThread = {}));
|
|
11
|
-
/**
|
|
12
|
-
* The time to take a Bun profile.
|
|
13
|
-
* If we increase this time it'll potentiall cause the app to crash.
|
|
14
|
-
* If we decrease this time, profile recorded will be fragmented and hard to analyze.
|
|
15
|
-
*/
|
|
16
|
-
const BUN_PROFILE_MS = 3 * 1000;
|
|
17
|
-
export async function profileThread(thread, durationMs, dirpath) {
|
|
18
|
-
return globalThis.Bun ? profileBun(thread, durationMs) : profileNodeJS(thread, durationMs, dirpath);
|
|
19
|
-
}
|
|
20
11
|
/**
|
|
21
12
|
* Take `durationMs` profile of the current thread and return the persisted file path.
|
|
22
13
|
*/
|
|
23
|
-
async function
|
|
14
|
+
export async function profileThread(thread, durationMs, dirpath) {
|
|
24
15
|
const inspector = await import("node:inspector");
|
|
25
16
|
// due to some typing issues, not able to use promisify here
|
|
26
17
|
const profile = await new Promise((resolve, reject) => {
|
|
@@ -48,23 +39,6 @@ async function profileNodeJS(thread, durationMs, dirpath) {
|
|
|
48
39
|
fs.writeFileSync(filePath, profile);
|
|
49
40
|
return filePath;
|
|
50
41
|
}
|
|
51
|
-
/**
|
|
52
|
-
* Unlike NodeJS, Bun console.profile() api flush data to the inspector,
|
|
53
|
-
* so this api returns ms taken of this profile instead of file path.
|
|
54
|
-
*/
|
|
55
|
-
async function profileBun(thread, durationMs) {
|
|
56
|
-
const start = Date.now();
|
|
57
|
-
let now = Date.now();
|
|
58
|
-
while (now - start < durationMs) {
|
|
59
|
-
// biome-ignore lint/suspicious/noConsole: need to use console api to profile in Bun
|
|
60
|
-
console.profile(String(now));
|
|
61
|
-
await sleep(BUN_PROFILE_MS);
|
|
62
|
-
// biome-ignore lint/suspicious/noConsole: need to use console api to profile in Bun
|
|
63
|
-
console.profileEnd(String(now));
|
|
64
|
-
now = Date.now();
|
|
65
|
-
}
|
|
66
|
-
return `Successfully take Bun ${thread} thread profile in ${now - start}ms. Check your inspector to see the profile.`;
|
|
67
|
-
}
|
|
68
42
|
/**
|
|
69
43
|
* Write heap snapshot of the current thread to the specified file.
|
|
70
44
|
*/
|
package/lib/util/profile.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile.js","sourceRoot":"","sources":["../../src/util/profile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAC,KAAK,EAAC,MAAM,iBAAiB,CAAC;SAE1B,aAAa;AAAzB,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,8BAAa,CAAA;IACb,oCAAmB,CAAA;IACnB,iCAAgB,CAAA;AAAC,CACnB,EAJY,aAAa,KAAb,aAAa,QAIxB;AAED
|
|
1
|
+
{"version":3,"file":"profile.js","sourceRoot":"","sources":["../../src/util/profile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAC,KAAK,EAAC,MAAM,iBAAiB,CAAC;SAE1B,aAAa;AAAzB,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,8BAAa,CAAA;IACb,oCAAmB,CAAA;IACnB,iCAAgB,CAAA;AAAC,CACnB,EAJY,aAAa,KAAb,aAAa,QAIxB;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,MAAqB,EAAE,UAAkB,EAAE,OAAe,EAAmB;IAC/G,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,CAAC;IAEjD,4DAA4D;IAC5D,MAAM,OAAO,GAAG,MAAM,IAAI,OAAO,CAAS,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC;QAC7D,wCAAwC;QACxC,MAAM,OAAO,GAAG,IAAI,SAAS,CAAC,OAAO,EAAE,CAAC;QACxC,OAAO,CAAC,OAAO,EAAE,CAAC;QAElB,OAAO,CAAC,IAAI,CAAC,iBAAiB,EAAE,GAAG,EAAE,CAAC;YACpC,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,KAAK,IAAI,EAAE,CAAC;gBACzC,MAAM,KAAK,CAAC,UAAU,CAAC,CAAC;gBACxB,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,GAAG,EAAE,EAAC,OAAO,EAAC,EAAE,EAAE,CAAC;oBAChD,IAAI,CAAC,GAAG,EAAE,CAAC;wBACT,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;oBACnC,CAAC;yBAAM,CAAC;wBACN,MAAM,CAAC,GAAG,CAAC,CAAC;oBACd,CAAC;oBAED,kDAAkD;oBAClD,OAAO,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;oBACjC,OAAO,CAAC,UAAU,EAAE,CAAC;gBAAA,CACtB,CAAC,CAAC;YAAA,CACJ,CAAC,CAAC;QAAA,CACJ,CAAC,CAAC;IAAA,CACJ,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,MAAM,WAAW,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;IAC/F,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACpC,OAAO,QAAQ,CAAC;AAAA,CACjB;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,MAAc,EAAE,OAAe,EAAmB;IACxF,oCAAoC;IACpC,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,CAAC;IACnC,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,CAAC;IACnC,MAAM,cAAc,GAAG,EAAE,CAAC,eAAe,EAAE,CAAC;IAC5C,MAAM,QAAQ,GAAG,GAAG,OAAO,IAAI,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,eAAe,CAAC;IACjF,MAAM,UAAU,GAAG,EAAE,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAClD,OAAO,IAAI,OAAO,CAAS,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC;QAC9C,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC;YAC9B,MAAM,CAAC,GAAG,CAAC,CAAC;QAAA,CACb,CAAC,CAAC;QAEH,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAChC,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC;YAC7B,OAAO,CAAC,QAAQ,CAAC,CAAC;QAAA,CACnB,CAAC,CAAC;IAAA,CACJ,CAAC,CAAC;AAAA,CACJ"}
|
package/lib/util/sszBytes.js
CHANGED
|
@@ -549,7 +549,7 @@ export function getBlockRootFromPayloadAttestationMessageSerialized(data) {
|
|
|
549
549
|
* blockHash: Bytes32 (32 bytes)
|
|
550
550
|
* prevRandao: Bytes32 (32 bytes)
|
|
551
551
|
* feeRecipient: ExecutionAddress(20 bytes)
|
|
552
|
-
* gasLimit:
|
|
552
|
+
* gasLimit: UintBn64 (8 bytes)
|
|
553
553
|
* builderIndex: BuilderIndex (8 bytes)
|
|
554
554
|
* slot: Slot (8 bytes) ← absolute offset 264
|
|
555
555
|
*/
|
package/package.json
CHANGED
|
@@ -11,75 +11,65 @@
|
|
|
11
11
|
"bugs": {
|
|
12
12
|
"url": "https://github.com/ChainSafe/lodestar/issues"
|
|
13
13
|
},
|
|
14
|
-
"version": "1.46.0-dev.
|
|
14
|
+
"version": "1.46.0-dev.d9065a2b16",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
18
|
-
"
|
|
18
|
+
"typescript": "./src/index.ts",
|
|
19
19
|
"types": "./lib/index.d.ts",
|
|
20
20
|
"import": "./lib/index.js"
|
|
21
21
|
},
|
|
22
22
|
"./api": {
|
|
23
|
-
"
|
|
23
|
+
"typescript": "./src/api/index.ts",
|
|
24
24
|
"types": "./lib/api/index.d.ts",
|
|
25
25
|
"import": "./lib/api/index.js"
|
|
26
26
|
},
|
|
27
27
|
"./chain": {
|
|
28
|
-
"
|
|
28
|
+
"typescript": "./src/chain/index.ts",
|
|
29
29
|
"types": "./lib/chain/index.d.ts",
|
|
30
30
|
"import": "./lib/chain/index.js"
|
|
31
31
|
},
|
|
32
32
|
"./constants": {
|
|
33
|
-
"
|
|
33
|
+
"typescript": "./src/constants/index.ts",
|
|
34
34
|
"types": "./lib/constants/index.d.ts",
|
|
35
35
|
"import": "./lib/constants/index.js"
|
|
36
36
|
},
|
|
37
37
|
"./db": {
|
|
38
|
-
"
|
|
38
|
+
"typescript": "./src/db/index.ts",
|
|
39
39
|
"types": "./lib/db/index.d.ts",
|
|
40
40
|
"import": "./lib/db/index.js"
|
|
41
41
|
},
|
|
42
42
|
"./metrics": {
|
|
43
|
-
"
|
|
43
|
+
"typescript": "./src/metrics/index.ts",
|
|
44
44
|
"types": "./lib/metrics/index.d.ts",
|
|
45
45
|
"import": "./lib/metrics/index.js"
|
|
46
46
|
},
|
|
47
47
|
"./monitoring": {
|
|
48
|
-
"
|
|
48
|
+
"typescript": "./src/monitoring/index.ts",
|
|
49
49
|
"types": "./lib/monitoring/index.d.ts",
|
|
50
50
|
"import": "./lib/monitoring/index.js"
|
|
51
51
|
},
|
|
52
52
|
"./network": {
|
|
53
|
-
"
|
|
53
|
+
"typescript": "./src/network/index.ts",
|
|
54
54
|
"types": "./lib/network/index.d.ts",
|
|
55
55
|
"import": "./lib/network/index.js"
|
|
56
56
|
},
|
|
57
57
|
"./node": {
|
|
58
|
-
"
|
|
58
|
+
"typescript": "./src/node/index.ts",
|
|
59
59
|
"types": "./lib/node/index.d.ts",
|
|
60
60
|
"import": "./lib/node/index.js"
|
|
61
61
|
},
|
|
62
62
|
"./sync": {
|
|
63
|
-
"
|
|
63
|
+
"typescript": "./src/sync/index.ts",
|
|
64
64
|
"types": "./lib/sync/index.d.ts",
|
|
65
65
|
"import": "./lib/sync/index.js"
|
|
66
66
|
},
|
|
67
67
|
"./util": {
|
|
68
|
-
"
|
|
68
|
+
"typescript": "./src/util/index.ts",
|
|
69
69
|
"types": "./lib/util/index.d.ts",
|
|
70
70
|
"import": "./lib/util/index.js"
|
|
71
71
|
}
|
|
72
72
|
},
|
|
73
|
-
"imports": {
|
|
74
|
-
"#prometheus-gc-stats-wrapper": {
|
|
75
|
-
"bun": "./src/bun-wrappers/prometheus-gc-stats.ts",
|
|
76
|
-
"default": "@chainsafe/prometheus-gc-stats"
|
|
77
|
-
},
|
|
78
|
-
"#datastore-wrapper": {
|
|
79
|
-
"bun": "./src/network/peers/datastore_bun.ts",
|
|
80
|
-
"default": "datastore-level"
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
73
|
"files": [
|
|
84
74
|
"src",
|
|
85
75
|
"lib",
|
|
@@ -136,20 +126,19 @@
|
|
|
136
126
|
"@libp2p/peer-id": "^6.0.4",
|
|
137
127
|
"@libp2p/prometheus-metrics": "^5.0.14",
|
|
138
128
|
"@libp2p/tcp": "^11.0.13",
|
|
139
|
-
"@lodestar/api": "^1.46.0-dev.
|
|
140
|
-
"@lodestar/config": "^1.46.0-dev.
|
|
141
|
-
"@lodestar/db": "^1.46.0-dev.
|
|
142
|
-
"@lodestar/fork-choice": "^1.46.0-dev.
|
|
143
|
-
"@lodestar/logger": "^1.46.0-dev.
|
|
144
|
-
"@lodestar/params": "^1.46.0-dev.
|
|
145
|
-
"@lodestar/reqresp": "^1.46.0-dev.
|
|
146
|
-
"@lodestar/state-transition": "^1.46.0-dev.
|
|
147
|
-
"@lodestar/types": "^1.46.0-dev.
|
|
148
|
-
"@lodestar/utils": "^1.46.0-dev.
|
|
149
|
-
"@lodestar/validator": "^1.46.0-dev.
|
|
129
|
+
"@lodestar/api": "^1.46.0-dev.d9065a2b16",
|
|
130
|
+
"@lodestar/config": "^1.46.0-dev.d9065a2b16",
|
|
131
|
+
"@lodestar/db": "^1.46.0-dev.d9065a2b16",
|
|
132
|
+
"@lodestar/fork-choice": "^1.46.0-dev.d9065a2b16",
|
|
133
|
+
"@lodestar/logger": "^1.46.0-dev.d9065a2b16",
|
|
134
|
+
"@lodestar/params": "^1.46.0-dev.d9065a2b16",
|
|
135
|
+
"@lodestar/reqresp": "^1.46.0-dev.d9065a2b16",
|
|
136
|
+
"@lodestar/state-transition": "^1.46.0-dev.d9065a2b16",
|
|
137
|
+
"@lodestar/types": "^1.46.0-dev.d9065a2b16",
|
|
138
|
+
"@lodestar/utils": "^1.46.0-dev.d9065a2b16",
|
|
139
|
+
"@lodestar/validator": "^1.46.0-dev.d9065a2b16",
|
|
150
140
|
"@multiformats/multiaddr": "^13.0.1",
|
|
151
141
|
"datastore-core": "^11.0.2",
|
|
152
|
-
"datastore-fs": "^11.0.2",
|
|
153
142
|
"datastore-level": "^12.0.2",
|
|
154
143
|
"deepmerge": "^4.3.1",
|
|
155
144
|
"fastify": "^5.8.1",
|
|
@@ -169,7 +158,7 @@
|
|
|
169
158
|
"@libp2p/interface-internal": "^3.0.13",
|
|
170
159
|
"@libp2p/logger": "^6.2.2",
|
|
171
160
|
"@libp2p/utils": "^7.0.13",
|
|
172
|
-
"@lodestar/spec-test-util": "^1.46.0-dev.
|
|
161
|
+
"@lodestar/spec-test-util": "^1.46.0-dev.d9065a2b16",
|
|
173
162
|
"@types/js-yaml": "^4.0.5",
|
|
174
163
|
"@types/qs": "^6.9.7",
|
|
175
164
|
"@types/tmp": "^0.2.3",
|
|
@@ -186,5 +175,5 @@
|
|
|
186
175
|
"beacon",
|
|
187
176
|
"blockchain"
|
|
188
177
|
],
|
|
189
|
-
"gitHead": "
|
|
178
|
+
"gitHead": "55c3e57de9c6d35ff864b3f60edbd71ef71129db"
|
|
190
179
|
}
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
BUILDER_PAYMENT_THRESHOLD_DENOMINATOR,
|
|
13
13
|
BUILDER_PAYMENT_THRESHOLD_NUMERATOR,
|
|
14
14
|
BUILDER_WITHDRAWAL_PREFIX,
|
|
15
|
+
BYTES_PER_FIELD_ELEMENT,
|
|
15
16
|
COMPOUNDING_WITHDRAWAL_PREFIX,
|
|
16
17
|
CONSOLIDATION_REQUEST_TYPE,
|
|
17
18
|
DEPOSIT_CONTRACT_TREE_DEPTH,
|
|
@@ -131,6 +132,7 @@ export const specConstants = {
|
|
|
131
132
|
// Deneb types
|
|
132
133
|
BLOB_TX_TYPE: toHexByte(BLOB_TX_TYPE),
|
|
133
134
|
VERSIONED_HASH_VERSION_KZG: toHexByte(VERSIONED_HASH_VERSION_KZG),
|
|
135
|
+
BYTES_PER_FIELD_ELEMENT,
|
|
134
136
|
|
|
135
137
|
// electra
|
|
136
138
|
UNSET_DEPOSIT_REQUESTS_START_INDEX,
|
|
@@ -32,9 +32,8 @@ export function getLodestarApi({
|
|
|
32
32
|
}: Pick<ApiModules, "chain" | "config" | "db" | "network" | "sync">): ApplicationMethods<routes.lodestar.Endpoints> {
|
|
33
33
|
let writingHeapdump = false;
|
|
34
34
|
let writingProfile = false;
|
|
35
|
-
//
|
|
36
|
-
|
|
37
|
-
const defaultProfileMs = globalThis.Bun ? config.SLOT_DURATION_MS : SLOTS_PER_EPOCH * config.SLOT_DURATION_MS;
|
|
35
|
+
// profile the whole epoch by default
|
|
36
|
+
const defaultProfileMs = SLOTS_PER_EPOCH * config.SLOT_DURATION_MS;
|
|
38
37
|
|
|
39
38
|
return {
|
|
40
39
|
async writeHeapdump({thread = "main", dirpath = "."}) {
|
|
@@ -4,6 +4,7 @@ import {Checkpoint} from "@lodestar/types/phase0";
|
|
|
4
4
|
import {callFnWhenAwait} from "@lodestar/utils";
|
|
5
5
|
import {IBeaconDb} from "../../db/index.js";
|
|
6
6
|
import {Metrics} from "../../metrics/metrics.js";
|
|
7
|
+
import {callInNextEventLoop} from "../../util/eventLoop.js";
|
|
7
8
|
import {isOptimisticBlock} from "../../util/forkChoice.js";
|
|
8
9
|
import {JobItemQueue, isQueueErrorAborted} from "../../util/queue/index.js";
|
|
9
10
|
import {ChainEvent} from "../emitter.js";
|
|
@@ -166,9 +167,25 @@ export class ArchiveStore {
|
|
|
166
167
|
// Event handlers
|
|
167
168
|
//-------------------------------------------------------------------------
|
|
168
169
|
private onFinalizedCheckpoint = (finalized: CheckpointWithHex): void => {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
170
|
+
// Decouple finalized-checkpoint processing from block import. This handler runs synchronously
|
|
171
|
+
// inside the `ChainEvent.forkChoiceFinalized` emit from `forkChoice.onBlock()` during
|
|
172
|
+
// `importBlock()`; deferring the work to the next event-loop tick keeps any failure here off the
|
|
173
|
+
// import call stack, so it can't abort `importBlock()` before `regen.processState()` caches the
|
|
174
|
+
// head post-state — the deep-sync wedge this PR fixes (#9716).
|
|
175
|
+
//
|
|
176
|
+
// `jobQueue.push()` can throw synchronously (queue aborted / full) or reject asynchronously;
|
|
177
|
+
// awaiting it inside the deferred callback funnels both failure modes into the one catch.
|
|
178
|
+
callInNextEventLoop(async () => {
|
|
179
|
+
try {
|
|
180
|
+
await this.jobQueue.push(finalized);
|
|
181
|
+
} catch (e) {
|
|
182
|
+
if (!isQueueErrorAborted(e)) {
|
|
183
|
+
this.logger.error(
|
|
184
|
+
"Error queuing finalized checkpoint",
|
|
185
|
+
{epoch: finalized.epoch, rootHex: finalized.rootHex},
|
|
186
|
+
e as Error
|
|
187
|
+
);
|
|
188
|
+
}
|
|
172
189
|
}
|
|
173
190
|
});
|
|
174
191
|
};
|
|
@@ -39,7 +39,6 @@ export class HistoricalStateRegen implements HistoricalStateWorkerApi {
|
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
const worker = new Worker(path.join(WORKER_DIR, "worker.js"), {
|
|
42
|
-
suppressTranspileTS: Boolean(globalThis.Bun),
|
|
43
42
|
workerData,
|
|
44
43
|
} as ConstructorParameters<typeof Worker>[1]);
|
|
45
44
|
|
|
@@ -61,7 +61,7 @@ export function verifyExecutionPayloadEnvelope(
|
|
|
61
61
|
`Prev randao mismatch between bid and payload bid=${toHex(bid.prevRandao)} payload=${toHex(payload.prevRandao)}`
|
|
62
62
|
);
|
|
63
63
|
}
|
|
64
|
-
if (bid.gasLimit !== payload.gasLimit) {
|
|
64
|
+
if (bid.gasLimit !== BigInt(payload.gasLimit)) {
|
|
65
65
|
throw new Error(`Gas limit mismatch between payload and bid payload=${payload.gasLimit} bid=${bid.gasLimit}`);
|
|
66
66
|
}
|
|
67
67
|
if (!byteArrayEquals(bid.blockHash, payload.blockHash)) {
|
|
@@ -267,7 +267,6 @@ export class BlsMultiThreadWorkerPool implements IBlsVerifier {
|
|
|
267
267
|
for (let i = 0; i < poolSize; i++) {
|
|
268
268
|
const workerData: WorkerData = {workerId: i};
|
|
269
269
|
const worker = new Worker(path.join(workerDir, "worker.js"), {
|
|
270
|
-
suppressTranspileTS: Boolean(globalThis.Bun),
|
|
271
270
|
workerData,
|
|
272
271
|
} as ConstructorParameters<typeof Worker>[1]);
|
|
273
272
|
|
package/src/chain/chain.ts
CHANGED
|
@@ -1191,13 +1191,19 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1191
1191
|
const prevHead = this.forkChoice.getHead();
|
|
1192
1192
|
const head = this.forkChoice.updateAndGetHead({mode: UpdateHeadOpt.GetCanonicalHead}).head;
|
|
1193
1193
|
|
|
1194
|
-
|
|
1195
|
-
try {
|
|
1196
|
-
const previousDutyDependentRoot = this.forkChoice.getDependentRoot(head, EpochDifference.previous);
|
|
1197
|
-
const currentDutyDependentRoot = this.forkChoice.getDependentRoot(head, EpochDifference.current);
|
|
1198
|
-
const epochTransition = computeStartSlotAtEpoch(computeEpochAtSlot(head.slot)) === head.slot;
|
|
1199
|
-
const executionOptimistic = isOptimisticBlock(head);
|
|
1194
|
+
const headRootChanged = head.blockRoot !== prevHead.blockRoot;
|
|
1200
1195
|
|
|
1196
|
+
if (!headRootChanged && prevHead.payloadStatus === head.payloadStatus) {
|
|
1197
|
+
return head;
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1200
|
+
try {
|
|
1201
|
+
const previousDutyDependentRoot = this.forkChoice.getDependentRoot(head, EpochDifference.previous);
|
|
1202
|
+
const currentDutyDependentRoot = this.forkChoice.getDependentRoot(head, EpochDifference.current);
|
|
1203
|
+
const epochTransition = computeStartSlotAtEpoch(computeEpochAtSlot(head.slot)) === head.slot;
|
|
1204
|
+
const executionOptimistic = isOptimisticBlock(head);
|
|
1205
|
+
|
|
1206
|
+
if (headRootChanged) {
|
|
1201
1207
|
this.emitter.emit(routes.events.EventType.head, {
|
|
1202
1208
|
block: head.blockRoot,
|
|
1203
1209
|
epochTransition,
|
|
@@ -1207,50 +1213,28 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1207
1213
|
currentDutyDependentRoot,
|
|
1208
1214
|
executionOptimistic,
|
|
1209
1215
|
});
|
|
1210
|
-
|
|
1211
|
-
this.emitter.emit(routes.events.EventType.headV2, {
|
|
1212
|
-
version: this.config.getForkName(head.slot),
|
|
1213
|
-
data: {
|
|
1214
|
-
slot: head.slot,
|
|
1215
|
-
block: head.blockRoot,
|
|
1216
|
-
state: head.stateRoot,
|
|
1217
|
-
payloadStatus: head.payloadStatus === PayloadStatus.FULL ? "full" : "empty",
|
|
1218
|
-
epochTransition,
|
|
1219
|
-
currentEpochDependentRoot: previousDutyDependentRoot,
|
|
1220
|
-
nextEpochDependentRoot: currentDutyDependentRoot,
|
|
1221
|
-
executionOptimistic,
|
|
1222
|
-
},
|
|
1223
|
-
});
|
|
1224
|
-
} catch (e) {
|
|
1225
|
-
// getDependentRoot() may fail with error: "No block for root" as we can see in holesky non-finality issue
|
|
1226
|
-
this.logger.debug("Error emitting head/head_v2 event", {slot: head.slot, root: head.blockRoot}, e as Error);
|
|
1227
|
-
}
|
|
1228
|
-
} else if (
|
|
1229
|
-
(prevHead.payloadStatus !== PayloadStatus.FULL && head.payloadStatus === PayloadStatus.FULL) ||
|
|
1230
|
-
(prevHead.payloadStatus !== PayloadStatus.EMPTY && head.payloadStatus === PayloadStatus.EMPTY)
|
|
1231
|
-
) {
|
|
1232
|
-
// Implies that block root is the same, emits on payload status change empty -> full or full -> empty.
|
|
1233
|
-
try {
|
|
1234
|
-
this.emitter.emit(routes.events.EventType.headV2, {
|
|
1235
|
-
version: this.config.getForkName(head.slot),
|
|
1236
|
-
data: {
|
|
1237
|
-
slot: head.slot,
|
|
1238
|
-
block: head.blockRoot,
|
|
1239
|
-
state: head.stateRoot,
|
|
1240
|
-
payloadStatus: head.payloadStatus === PayloadStatus.EMPTY ? "empty" : "full",
|
|
1241
|
-
epochTransition: computeStartSlotAtEpoch(computeEpochAtSlot(head.slot)) === head.slot,
|
|
1242
|
-
currentEpochDependentRoot: this.forkChoice.getDependentRoot(head, EpochDifference.previous),
|
|
1243
|
-
nextEpochDependentRoot: this.forkChoice.getDependentRoot(head, EpochDifference.current),
|
|
1244
|
-
executionOptimistic: isOptimisticBlock(head),
|
|
1245
|
-
},
|
|
1246
|
-
});
|
|
1247
|
-
} catch (e) {
|
|
1248
|
-
this.logger.debug(
|
|
1249
|
-
"Error emitting head_v2 event on payload status change",
|
|
1250
|
-
{slot: head.slot, root: head.blockRoot},
|
|
1251
|
-
e as Error
|
|
1252
|
-
);
|
|
1253
1216
|
}
|
|
1217
|
+
|
|
1218
|
+
this.emitter.emit(routes.events.EventType.headV2, {
|
|
1219
|
+
version: this.config.getForkName(head.slot),
|
|
1220
|
+
data: {
|
|
1221
|
+
slot: head.slot,
|
|
1222
|
+
block: head.blockRoot,
|
|
1223
|
+
state: head.stateRoot,
|
|
1224
|
+
payloadStatus: head.payloadStatus === PayloadStatus.FULL ? "full" : "empty",
|
|
1225
|
+
epochTransition,
|
|
1226
|
+
currentEpochDependentRoot: previousDutyDependentRoot,
|
|
1227
|
+
nextEpochDependentRoot: currentDutyDependentRoot,
|
|
1228
|
+
executionOptimistic,
|
|
1229
|
+
},
|
|
1230
|
+
});
|
|
1231
|
+
} catch (e) {
|
|
1232
|
+
// getDependentRoot() may fail with error: "No block for root" as we can see in holesky non-finality issue
|
|
1233
|
+
this.logger.debug(
|
|
1234
|
+
"Error emitting head/head_v2 event",
|
|
1235
|
+
{slot: head.slot, root: head.blockRoot, headRootChanged},
|
|
1236
|
+
e as Error
|
|
1237
|
+
);
|
|
1254
1238
|
}
|
|
1255
1239
|
|
|
1256
1240
|
return head;
|
|
@@ -234,6 +234,7 @@ export class AggregatedAttestationPool {
|
|
|
234
234
|
const stateEpoch = state.epoch;
|
|
235
235
|
const statePrevEpoch = stateEpoch - 1;
|
|
236
236
|
const rootCache = new RootCache(state);
|
|
237
|
+
const gloasState = isStatePostGloas(state) ? state : null;
|
|
237
238
|
|
|
238
239
|
const notSeenValidatorsFn = getNotSeenValidatorsFn(this.config, shufflingCache, state);
|
|
239
240
|
const validateAttestationDataFn = getValidateAttestationDataFn(forkChoice, state);
|
|
@@ -361,7 +362,8 @@ export class AggregatedAttestationPool {
|
|
|
361
362
|
inclusionDistance,
|
|
362
363
|
stateEpoch,
|
|
363
364
|
rootCache,
|
|
364
|
-
|
|
365
|
+
gloasState?.executionPayloadAvailability ?? null,
|
|
366
|
+
gloasState?.latestExecutionPayloadBid.slot ?? null
|
|
365
367
|
);
|
|
366
368
|
|
|
367
369
|
const weight =
|
|
@@ -345,7 +345,7 @@ export async function produceBlockBody<T extends BlockType>(
|
|
|
345
345
|
blockHash: executionPayload.blockHash,
|
|
346
346
|
prevRandao: currentState.getRandaoMix(currentState.epoch),
|
|
347
347
|
feeRecipient: executionPayload.feeRecipient,
|
|
348
|
-
gasLimit: executionPayload.gasLimit,
|
|
348
|
+
gasLimit: BigInt(executionPayload.gasLimit),
|
|
349
349
|
builderIndex: BUILDER_INDEX_SELF_BUILD,
|
|
350
350
|
slot: blockSlot,
|
|
351
351
|
value: 0,
|
|
@@ -111,7 +111,7 @@ export async function validateGossipBlobSidecar(
|
|
|
111
111
|
|
|
112
112
|
// [REJECT] The blob is from a higher slot than its parent.
|
|
113
113
|
if (parentBlock.slot >= blobSlot) {
|
|
114
|
-
throw new BlobSidecarGossipError(GossipAction.
|
|
114
|
+
throw new BlobSidecarGossipError(GossipAction.REJECT, {
|
|
115
115
|
code: BlobSidecarErrorCode.NOT_LATER_THAN_PARENT,
|
|
116
116
|
parentSlot: parentBlock.slot,
|
|
117
117
|
slot: blobSlot,
|
|
@@ -15,6 +15,33 @@ import {ExecutionPayloadBidError, ExecutionPayloadBidErrorCode, GossipAction} fr
|
|
|
15
15
|
import {IBeaconChain} from "../index.js";
|
|
16
16
|
import {RegenCaller} from "../regen/index.js";
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Relative increment over the current highest bid required to forward a bid, in basis points.
|
|
20
|
+
* With 3%, laddering from 1 gwei to 1 ETH takes ~256 bids given the floor and cap below, see
|
|
21
|
+
* https://github.com/ethereum/consensus-specs/pull/4792#issuecomment-3714553549.
|
|
22
|
+
*/
|
|
23
|
+
const BID_INCREMENT_BPS = 300;
|
|
24
|
+
/**
|
|
25
|
+
* Minimum absolute increment (0.0001 ETH). Covers low bid values where the relative increment
|
|
26
|
+
* is tiny and provides weak spam protection.
|
|
27
|
+
*/
|
|
28
|
+
const BID_INCREMENT_FLOOR_GWEI = 100_000;
|
|
29
|
+
/**
|
|
30
|
+
* Maximum absolute increment (0.01 ETH). Bounds the barrier for legitimate competition on
|
|
31
|
+
* high value blocks where the relative increment would suppress closely competing bids.
|
|
32
|
+
*/
|
|
33
|
+
const BID_INCREMENT_CAP_GWEI = 10_000_000;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Return the minimum value a new bid must have to be forwarded given the current highest bid.
|
|
37
|
+
* Division before multiplication to stay within safe integer range for max gwei values.
|
|
38
|
+
*/
|
|
39
|
+
export function getMinBidValue(currentHighestBid: number): number {
|
|
40
|
+
const relativeIncrement = Math.floor(currentHighestBid / 10_000) * BID_INCREMENT_BPS;
|
|
41
|
+
const increment = Math.min(Math.max(BID_INCREMENT_FLOOR_GWEI, relativeIncrement), BID_INCREMENT_CAP_GWEI);
|
|
42
|
+
return currentHighestBid + increment;
|
|
43
|
+
}
|
|
44
|
+
|
|
18
45
|
export async function validateApiExecutionPayloadBid(
|
|
19
46
|
chain: IBeaconChain,
|
|
20
47
|
signedExecutionPayloadBid: gloas.SignedExecutionPayloadBid
|
|
@@ -192,7 +219,7 @@ async function validateExecutionPayloadBid(
|
|
|
192
219
|
// [IGNORE] `is_gas_limit_target_compatible(parent_gas_limit, bid.gas_limit, target_gas_limit)`,
|
|
193
220
|
// where `parent_gas_limit` is the `gas_limit` of the parent execution payload and
|
|
194
221
|
// `target_gas_limit` is `proposer_preferences.target_gas_limit`.
|
|
195
|
-
const bidGasLimit = bid.gasLimit;
|
|
222
|
+
const bidGasLimit = Number(bid.gasLimit);
|
|
196
223
|
const parentGasLimit = parentPayloadVariant.executionPayloadGasLimit;
|
|
197
224
|
const targetGasLimit = proposerPreferences.message.targetGasLimit;
|
|
198
225
|
if (!isGasLimitTargetCompatible(parentGasLimit, bidGasLimit, targetGasLimit)) {
|
|
@@ -231,8 +258,11 @@ async function validateExecutionPayloadBid(
|
|
|
231
258
|
|
|
232
259
|
// [IGNORE] this bid is the highest value bid seen for the tuple
|
|
233
260
|
// `(bid.slot, bid.parent_block_hash, bid.parent_block_root)`.
|
|
261
|
+
// As a DoS prevention measure, the bid must also exceed the current highest bid by a minimum
|
|
262
|
+
// increment, see https://github.com/ethereum/consensus-specs/pull/4831. This prevents spam
|
|
263
|
+
// from builders submitting numerous bids with minimal value increments.
|
|
234
264
|
const bestBid = chain.executionPayloadBidPool.getBestBid(bid.slot, parentBlockHashHex, parentBlockRootHex);
|
|
235
|
-
if (bestBid !== null &&
|
|
265
|
+
if (bestBid !== null && bid.value < getMinBidValue(bestBid.message.value)) {
|
|
236
266
|
throw new ExecutionPayloadBidError(GossipAction.IGNORE, {
|
|
237
267
|
code: ExecutionPayloadBidErrorCode.BID_TOO_LOW,
|
|
238
268
|
bidValue: bid.value,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {IForkChoice, ProtoBlock} from "@lodestar/fork-choice";
|
|
2
|
-
import {GENESIS_SLOT, MIN_SEED_LOOKAHEAD, SLOTS_PER_EPOCH} from "@lodestar/params";
|
|
2
|
+
import {GENESIS_EPOCH, GENESIS_SLOT, MIN_SEED_LOOKAHEAD, SLOTS_PER_EPOCH} from "@lodestar/params";
|
|
3
3
|
import {
|
|
4
4
|
computeEpochAtSlot,
|
|
5
5
|
computeStartSlotAtEpoch,
|
|
@@ -24,9 +24,10 @@ export async function validateGossipProposerPreferences(
|
|
|
24
24
|
const dependentRootHex = toRootHex(dependentRoot);
|
|
25
25
|
const proposalEpoch = computeEpochAtSlot(proposalSlot);
|
|
26
26
|
|
|
27
|
-
// [IGNORE] `preferences.proposal_slot` is within the proposer lookahead
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
// [IGNORE] `preferences.proposal_slot` is within the proposer lookahead,
|
|
28
|
+
// allowing for `MAXIMUM_GOSSIP_CLOCK_DISPARITY`.
|
|
29
|
+
const currentEpoch = computeEpochAtSlot(chain.clock.currentSlotWithGossipDisparity);
|
|
30
|
+
if (proposalEpoch > currentEpoch + MIN_SEED_LOOKAHEAD) {
|
|
30
31
|
throw new ProposerPreferencesError(GossipAction.IGNORE, {
|
|
31
32
|
code: ProposerPreferencesErrorCode.INVALID_EPOCH,
|
|
32
33
|
proposalSlot,
|
|
@@ -36,12 +37,11 @@ export async function validateGossipProposerPreferences(
|
|
|
36
37
|
|
|
37
38
|
// [IGNORE] `preferences.proposal_slot` has not already passed, i.e. `proposal_slot > current_slot`,
|
|
38
39
|
// allowing for `MAXIMUM_GOSSIP_CLOCK_DISPARITY`.
|
|
39
|
-
|
|
40
|
-
if (proposalSlot <= currentSlot) {
|
|
40
|
+
if (chain.clock.msFromSlot(proposalSlot) > chain.config.MAXIMUM_GOSSIP_CLOCK_DISPARITY) {
|
|
41
41
|
throw new ProposerPreferencesError(GossipAction.IGNORE, {
|
|
42
42
|
code: ProposerPreferencesErrorCode.PROPOSAL_SLOT_PASSED,
|
|
43
43
|
proposalSlot,
|
|
44
|
-
currentSlot,
|
|
44
|
+
currentSlot: chain.clock.currentSlot,
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
|
|
@@ -55,7 +55,7 @@ export async function validateGossipProposerPreferences(
|
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
const dependentEpoch = proposalEpoch - MIN_SEED_LOOKAHEAD;
|
|
58
|
+
const dependentEpoch = Math.max(GENESIS_EPOCH, proposalEpoch - MIN_SEED_LOOKAHEAD);
|
|
59
59
|
const dependentRootSlot = getDependentRootSlot(dependentEpoch);
|
|
60
60
|
|
|
61
61
|
// [REJECT] The slot of the block with root `preferences.dependent_root` is strictly less than
|
|
@@ -469,7 +469,7 @@ export function createValidatorMonitor(
|
|
|
469
469
|
proposerIndex,
|
|
470
470
|
src,
|
|
471
471
|
builderIndex: bid.builderIndex,
|
|
472
|
-
gasLimit: bid.gasLimit,
|
|
472
|
+
gasLimit: Number(bid.gasLimit),
|
|
473
473
|
value: bid.value.toString(),
|
|
474
474
|
parentBlockRoot: toRootHex(bid.parentBlockRoot),
|
|
475
475
|
parentBlockHash: toRootHex(bid.parentBlockHash),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {Registry, collectDefaultMetrics} from "prom-client";
|
|
2
|
-
import {gcStats} from "
|
|
2
|
+
import {gcStats} from "@chainsafe/prometheus-gc-stats";
|
|
3
3
|
|
|
4
4
|
export function collectNodeJSMetrics(register: Registry, prefix?: string): () => void {
|
|
5
5
|
collectDefaultMetrics({
|
|
@@ -132,10 +132,6 @@ export class WorkerNetworkCore implements INetworkCore {
|
|
|
132
132
|
|
|
133
133
|
const workerOpts: ConstructorParameters<typeof Worker>[1] = {
|
|
134
134
|
workerData,
|
|
135
|
-
};
|
|
136
|
-
if (globalThis.Bun) {
|
|
137
|
-
workerOpts.suppressTranspileTS = true;
|
|
138
|
-
} else {
|
|
139
135
|
/**
|
|
140
136
|
* maxYoungGenerationSizeMb defaults to 152mb through the cli option defaults.
|
|
141
137
|
* That default value was determined via https://github.com/ChainSafe/lodestar/issues/2115 and
|
|
@@ -147,8 +143,8 @@ export class WorkerNetworkCore implements INetworkCore {
|
|
|
147
143
|
* showed that there is a pretty big window of "correct" values but we can always tune as
|
|
148
144
|
* necessary
|
|
149
145
|
*/
|
|
150
|
-
|
|
151
|
-
}
|
|
146
|
+
resourceLimits: {maxYoungGenerationSizeMb: opts.maxYoungGenerationSizeMb},
|
|
147
|
+
};
|
|
152
148
|
|
|
153
149
|
const worker = new Worker(path.join(workerDir, "networkCoreWorker.js"), workerOpts);
|
|
154
150
|
|
|
@@ -51,10 +51,7 @@ export class Discv5Worker extends (EventEmitter as {new (): StrictEventEmitter<E
|
|
|
51
51
|
loggerOpts: opts.logger.toOpts(),
|
|
52
52
|
genesisTime: opts.genesisTime,
|
|
53
53
|
};
|
|
54
|
-
const worker = new Worker("./worker.js", {
|
|
55
|
-
suppressTranspileTS: Boolean(globalThis.Bun),
|
|
56
|
-
workerData,
|
|
57
|
-
} as ConstructorParameters<typeof Worker>[1]);
|
|
54
|
+
const worker = new Worker("./worker.js", {workerData} as ConstructorParameters<typeof Worker>[1]);
|
|
58
55
|
|
|
59
56
|
const workerApi = await spawn<Discv5WorkerApi>(worker, {
|
|
60
57
|
// A Lodestar Node may do very expensive task at start blocking the event loop and causing
|
|
@@ -9,7 +9,7 @@ import {Libp2pInit, createLibp2p} from "libp2p";
|
|
|
9
9
|
import {Registry} from "prom-client";
|
|
10
10
|
import {ENR} from "@chainsafe/enr";
|
|
11
11
|
import {noise} from "@chainsafe/libp2p-noise";
|
|
12
|
-
import {
|
|
12
|
+
import {defaultCrypto} from "@chainsafe/libp2p-noise/crypto";
|
|
13
13
|
import {quic} from "@chainsafe/libp2p-quic";
|
|
14
14
|
import {Libp2p, LodestarComponents} from "../interface.js";
|
|
15
15
|
import {NetworkOptions, defaultNetworkOptions} from "../options.js";
|
|
@@ -111,14 +111,6 @@ export async function createNodeJsLibp2p(
|
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
const noiseCrypto = {
|
|
115
|
-
...defaultCrypto,
|
|
116
|
-
};
|
|
117
|
-
if (globalThis.Bun) {
|
|
118
|
-
noiseCrypto.chaCha20Poly1305Decrypt = asCrypto.chaCha20Poly1305Decrypt;
|
|
119
|
-
noiseCrypto.chaCha20Poly1305Encrypt = asCrypto.chaCha20Poly1305Encrypt;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
114
|
return createLibp2p({
|
|
123
115
|
privateKey,
|
|
124
116
|
nodeInfo: {
|
|
@@ -130,7 +122,7 @@ export async function createNodeJsLibp2p(
|
|
|
130
122
|
listen: localMultiaddrs,
|
|
131
123
|
announce: [],
|
|
132
124
|
},
|
|
133
|
-
connectionEncrypters: [noise({crypto:
|
|
125
|
+
connectionEncrypters: [noise({crypto: defaultCrypto})],
|
|
134
126
|
transports,
|
|
135
127
|
streamMuxers: [mplex({disconnectThreshold})],
|
|
136
128
|
peerDiscovery,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {AbortOptions} from "@libp2p/interface";
|
|
2
2
|
import {BaseDatastore} from "datastore-core";
|
|
3
|
+
import {LevelDatastore} from "datastore-level";
|
|
3
4
|
import {Key, KeyQuery, Pair, Query} from "interface-datastore";
|
|
4
|
-
import {LevelDatastore} from "#datastore-wrapper";
|
|
5
5
|
|
|
6
6
|
type MemoryItem = {
|
|
7
7
|
lastAccessedMs: number;
|