@lodestar/state-transition 1.48.0-dev.9b2790203a → 1.48.0-dev.a4083281b7
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/block/processOperations.d.ts.map +1 -1
- package/lib/block/processOperations.js +2 -18
- package/lib/block/processOperations.js.map +1 -1
- package/lib/block/processParentExecutionPayload.d.ts.map +1 -1
- package/lib/block/processParentExecutionPayload.js +1 -15
- package/lib/block/processParentExecutionPayload.js.map +1 -1
- package/lib/block/processPayloadAttestation.d.ts +1 -1
- package/lib/block/processPayloadAttestation.d.ts.map +1 -1
- package/lib/block/processPayloadAttestation.js +2 -2
- package/lib/block/processPayloadAttestation.js.map +1 -1
- package/package.json +8 -8
- package/src/block/processOperations.ts +2 -29
- package/src/block/processParentExecutionPayload.ts +1 -26
- package/src/block/processPayloadAttestation.ts +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processOperations.d.ts","sourceRoot":"","sources":["../../src/block/processOperations.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"processOperations.d.ts","sourceRoot":"","sources":["../../src/block/processOperations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAC,eAAe,EAAE,IAAI,EAA0B,MAAM,iBAAiB,CAAC;AAC/E,OAAO,EAAC,4BAA4B,EAAC,MAAM,eAAe,CAAC;AAC3D,OAAO,EACL,yBAAyB,EAI1B,MAAM,aAAa,CAAC;AAErB,OAAO,EAAC,mBAAmB,EAAC,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAC,uBAAuB,EAAC,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAC,2BAA2B,EAAC,MAAM,kCAAkC,CAAC;AAC7E,OAAO,EAAC,2BAA2B,EAAC,MAAM,kCAAkC,CAAC;AAC7E,OAAO,EAAC,cAAc,EAAC,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAC,qBAAqB,EAAC,MAAM,4BAA4B,CAAC;AAEjE,OAAO,EAAC,uBAAuB,EAAC,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAC,oBAAoB,EAAC,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAC,wBAAwB,EAAC,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAC,gBAAgB,EAAC,MAAM,YAAY,CAAC;AAE5C,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,mBAAmB,EACnB,cAAc,EACd,oBAAoB,EACpB,wBAAwB,EACxB,2BAA2B,EAC3B,qBAAqB,EACrB,2BAA2B,GAC5B,CAAC;AAEF,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,yBAAyB,EAChC,IAAI,EAAE,eAAe,EACrB,UAAU,EAAE,IAAI,GAAG,IAAI,EACvB,IAAI,GAAE,gBAA2C,EACjD,OAAO,CAAC,EAAE,4BAA4B,GAAG,IAAI,GAC5C,IAAI,CAuDN"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ForkSeq
|
|
1
|
+
import { ForkSeq } from "@lodestar/params";
|
|
2
2
|
import { getEth1DepositCount } from "../util/deposit.js";
|
|
3
3
|
import { processAttestations } from "./processAttestations.js";
|
|
4
4
|
import { processAttesterSlashing } from "./processAttesterSlashing.js";
|
|
@@ -12,9 +12,6 @@ import { processVoluntaryExit } from "./processVoluntaryExit.js";
|
|
|
12
12
|
import { processWithdrawalRequest } from "./processWithdrawalRequest.js";
|
|
13
13
|
export { processProposerSlashing, processAttesterSlashing, processAttestations, processDeposit, processVoluntaryExit, processWithdrawalRequest, processBlsToExecutionChange, processDepositRequest, processConsolidationRequest, };
|
|
14
14
|
export function processOperations(fork, state, body, parentSlot, opts = { verifySignatures: true }, metrics) {
|
|
15
|
-
if (fork >= ForkSeq.gloas) {
|
|
16
|
-
assertGloasOperationLimits(body);
|
|
17
|
-
}
|
|
18
15
|
// verify that outstanding deposits are processed up to the maximum number of deposits.
|
|
19
16
|
// From Fulu the eth1 bridge deposit mechanism was removed, so blocks must not contain any deposits.
|
|
20
17
|
const maxDeposits = fork >= ForkSeq.fulu ? 0 : getEth1DepositCount(state);
|
|
@@ -54,21 +51,8 @@ export function processOperations(fork, state, body, parentSlot, opts = { verify
|
|
|
54
51
|
}
|
|
55
52
|
if (fork >= ForkSeq.gloas) {
|
|
56
53
|
for (const payloadAttestation of body.payloadAttestations) {
|
|
57
|
-
processPayloadAttestation(state, payloadAttestation);
|
|
54
|
+
processPayloadAttestation(state, payloadAttestation, opts.verifySignatures);
|
|
58
55
|
}
|
|
59
56
|
}
|
|
60
57
|
}
|
|
61
|
-
function assertGloasOperationLimits(body) {
|
|
62
|
-
assertMaxLength("proposerSlashings", body.proposerSlashings.length, MAX_PROPOSER_SLASHINGS);
|
|
63
|
-
assertMaxLength("attesterSlashings", body.attesterSlashings.length, MAX_ATTESTER_SLASHINGS_ELECTRA);
|
|
64
|
-
assertMaxLength("attestations", body.attestations.length, MAX_ATTESTATIONS_ELECTRA);
|
|
65
|
-
assertMaxLength("voluntaryExits", body.voluntaryExits.length, MAX_VOLUNTARY_EXITS);
|
|
66
|
-
assertMaxLength("blsToExecutionChanges", body.blsToExecutionChanges.length, MAX_BLS_TO_EXECUTION_CHANGES);
|
|
67
|
-
assertMaxLength("payloadAttestations", body.payloadAttestations.length, MAX_PAYLOAD_ATTESTATIONS);
|
|
68
|
-
}
|
|
69
|
-
function assertMaxLength(name, length, limit) {
|
|
70
|
-
if (length > limit) {
|
|
71
|
-
throw new Error(`Block contains too many ${name}: count=${length} limit=${limit}`);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
58
|
//# sourceMappingURL=processOperations.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processOperations.js","sourceRoot":"","sources":["../../src/block/processOperations.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"processOperations.js","s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WAAW,CAAC,iBAAiB,CAAC,QAAQ,EAAE,CAAC;YACpE,qBAAqB,CAAC,IAAI,EAAE,YAAY,EAAE,cAAc,CAAC,CAAC;QAC5D,CAAC;QAED,KAAK,MAAM,mBAAmB,IAAI,WAAW,CAAC,iBAAiB,CAAC,WAAW,EAAE,CAAC;YAC5E,wBAAwB,CAAC,IAAI,EAAE,YAAY,EAAE,mBAAmB,CAAC,CAAC;QACpE,CAAC;QAED,KAAK,MAAM,sBAAsB,IAAI,WAAW,CAAC,iBAAiB,CAAC,cAAc,EAAE,CAAC;YAClF,2BAA2B,CAAC,YAAY,EAAE,sBAAsB,CAAC,CAAC;QACpE,CAAC;IACH,CAAC;IAED,IAAI,IAAI,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QAC1B,KAAK,MAAM,kBAAkB,IAAK,IAA8B,CAAC,mBAAmB,EAAE,CAAC;YACrF,yBAAyB,CAAC,KAA+B,EAAE,kBAAkB,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACxG,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processParentExecutionPayload.d.ts","sourceRoot":"","sources":["../../src/block/processParentExecutionPayload.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"processParentExecutionPayload.d.ts","sourceRoot":"","sources":["../../src/block/processParentExecutionPayload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAA6C,MAAM,kBAAkB,CAAC;AAC3F,OAAO,EAAC,WAAW,EAAE,KAAK,EAAM,MAAM,iBAAiB,CAAC;AAExD,OAAO,EAAC,sBAAsB,EAAC,MAAM,aAAa,CAAC;AAQnD;;;;GAIG;AACH,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,sBAAsB,EAAE,KAAK,EAAE,WAAW,CAAC,aAAa,CAAC,GAAG,IAAI,CAqBpH;AAED;;;;;;;;GAQG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,sBAAsB,EAAE,QAAQ,EAAE,KAAK,CAAC,iBAAiB,GAAG,IAAI,CAiDlH"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SLOTS_PER_EPOCH, SLOTS_PER_HISTORICAL_ROOT } from "@lodestar/params";
|
|
2
2
|
import { ssz } from "@lodestar/types";
|
|
3
3
|
import { byteArrayEquals, toRootHex } from "@lodestar/utils";
|
|
4
4
|
import { computeEpochAtSlot } from "../util/epoch.js";
|
|
@@ -39,7 +39,6 @@ export function processParentExecutionPayload(state, block) {
|
|
|
39
39
|
* Spec: https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.6/specs/gloas/beacon-chain.md#new-apply_parent_execution_payload
|
|
40
40
|
*/
|
|
41
41
|
export function applyParentExecutionPayload(state, requests) {
|
|
42
|
-
assertExecutionRequestsWithinLimits(requests);
|
|
43
42
|
const fork = state.config.getForkSeq(state.slot);
|
|
44
43
|
const parentBid = state.latestExecutionPayloadBid;
|
|
45
44
|
const parentSlot = state.latestBlockHeader.slot;
|
|
@@ -98,19 +97,6 @@ function settleBuilderPayment(state, paymentIndex) {
|
|
|
98
97
|
}
|
|
99
98
|
state.builderPendingPayments.set(paymentIndex, ssz.gloas.BuilderPendingPayment.defaultViewDU());
|
|
100
99
|
}
|
|
101
|
-
function assertExecutionRequestsWithinLimits(requests) {
|
|
102
|
-
assertMaxLength("withdrawals", requests.withdrawals.length, MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD);
|
|
103
|
-
assertMaxLength("consolidations", requests.consolidations.length, MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD);
|
|
104
|
-
// New in GLOAS:EIP8282
|
|
105
|
-
assertMaxLength("builderDeposits", requests.builderDeposits.length, MAX_BUILDER_DEPOSIT_REQUESTS_PER_PAYLOAD);
|
|
106
|
-
// New in GLOAS:EIP8282
|
|
107
|
-
assertMaxLength("builderExits", requests.builderExits.length, MAX_BUILDER_EXIT_REQUESTS_PER_PAYLOAD);
|
|
108
|
-
}
|
|
109
|
-
function assertMaxLength(name, length, limit) {
|
|
110
|
-
if (length > limit) {
|
|
111
|
-
throw new Error(`Too many parent execution request ${name} count=${length} limit=${limit}`);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
100
|
function assertEmptyExecutionRequests(requests) {
|
|
115
101
|
if (requests.deposits.length !== 0 ||
|
|
116
102
|
requests.withdrawals.length !== 0 ||
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processParentExecutionPayload.js","sourceRoot":"","sources":["../../src/block/processParentExecutionPayload.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"processParentExecutionPayload.js","sourceRoot":"","sources":["../../src/block/processParentExecutionPayload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,eAAe,EAAE,yBAAyB,EAAC,MAAM,kBAAkB,CAAC;AAC3F,OAAO,EAAqB,GAAG,EAAC,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAC,eAAe,EAAE,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAE3D,OAAO,EAAC,kBAAkB,EAAC,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAC,4BAA4B,EAAC,MAAM,mCAAmC,CAAC;AAC/E,OAAO,EAAC,yBAAyB,EAAC,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAC,2BAA2B,EAAC,MAAM,kCAAkC,CAAC;AAC7E,OAAO,EAAC,qBAAqB,EAAC,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAC,wBAAwB,EAAC,MAAM,+BAA+B,CAAC;AAEvE;;;;GAIG;AACH,MAAM,UAAU,6BAA6B,CAAC,KAA6B,EAAE,KAAiC;IAC5G,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,yBAAyB,CAAC,OAAO,CAAC;IACzD,MAAM,SAAS,GAAG,KAAK,CAAC,yBAAyB,CAAC;IAClD,MAAM,QAAQ,GAAG,KAAK,CAA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CAAC;AAC9C,CAAC;AAED;;;;;GAKG;AACH,SAAS,oBAAoB,CAAC,KAA6B,EAAE,YAAoB;IAC/E,IAAI,YAAY,IAAI,KAAK,CAAC,sBAAsB,CAAC,MAAM,EAAE,CAAC;QACxD,MAAM,IAAI,KAAK,CACb,8CAA8C,YAAY,UAAU,KAAK,CAAC,sBAAsB,CAAC,MAAM,EAAE,CAC1G,CAAC;IACJ,CAAC;IACD,MAAM,OAAO,GAAG,KAAK,CAAC,sBAAsB,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,KAAK,EAAE,CAAC;IACvE,IAAI,OAAO,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAClC,KAAK,CAAC,yBAAyB,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAC3D,CAAC;IACD,KAAK,CAAC,sBAAsB,CAAC,GAAG,CAAC,YAAY,EAAE,GAAG,CAAC,KAAK,CAAC,qBAAqB,CAAC,aAAa,EAAE,CAAC,CAAC;AAClG,CAAC;AAED,SAAS,4BAA4B,CAAC,QAAiC;IACrE,IACE,QAAQ,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC;QAC9B,QAAQ,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC;QACjC,QAAQ,CAAC,cAAc,CAAC,MAAM,KAAK,CAAC;QACpC,QAAQ,CAAC,eAAe,CAAC,MAAM,KAAK,CAAC;QACrC,QAAQ,CAAC,YAAY,CAAC,MAAM,KAAK,CAAC,EAClC,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,oEAAoE,CAAC,CAAC;IACxF,CAAC;AACH,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { gloas } from "@lodestar/types";
|
|
2
2
|
import { CachedBeaconStateGloas } from "../types.js";
|
|
3
|
-
export declare function processPayloadAttestation(state: CachedBeaconStateGloas, payloadAttestation: gloas.PayloadAttestation): void;
|
|
3
|
+
export declare function processPayloadAttestation(state: CachedBeaconStateGloas, payloadAttestation: gloas.PayloadAttestation, verifySignature?: boolean): void;
|
|
4
4
|
//# sourceMappingURL=processPayloadAttestation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processPayloadAttestation.d.ts","sourceRoot":"","sources":["../../src/block/processPayloadAttestation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,iBAAiB,CAAC;AAEtC,OAAO,EAAC,sBAAsB,EAAC,MAAM,aAAa,CAAC;AAGnD,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,sBAAsB,EAC7B,kBAAkB,EAAE,KAAK,CAAC,kBAAkB,
|
|
1
|
+
{"version":3,"file":"processPayloadAttestation.d.ts","sourceRoot":"","sources":["../../src/block/processPayloadAttestation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,iBAAiB,CAAC;AAEtC,OAAO,EAAC,sBAAsB,EAAC,MAAM,aAAa,CAAC;AAGnD,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,sBAAsB,EAC7B,kBAAkB,EAAE,KAAK,CAAC,kBAAkB,EAC5C,eAAe,UAAO,GACrB,IAAI,CAgBN"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { byteArrayEquals } from "@lodestar/utils";
|
|
2
2
|
import { isValidIndexedPayloadAttestation } from "./isValidIndexedPayloadAttestation.js";
|
|
3
|
-
export function processPayloadAttestation(state, payloadAttestation) {
|
|
3
|
+
export function processPayloadAttestation(state, payloadAttestation, verifySignature = true) {
|
|
4
4
|
const data = payloadAttestation.data;
|
|
5
5
|
if (!byteArrayEquals(data.beaconBlockRoot, state.latestBlockHeader.parentRoot)) {
|
|
6
6
|
throw Error("Payload attestation is referring to the wrong block");
|
|
@@ -9,7 +9,7 @@ export function processPayloadAttestation(state, payloadAttestation) {
|
|
|
9
9
|
throw Error("Payload attestation is not from previous slot");
|
|
10
10
|
}
|
|
11
11
|
const indexedPayloadAttestation = state.epochCtx.getIndexedPayloadAttestation(data.slot, payloadAttestation);
|
|
12
|
-
if (!isValidIndexedPayloadAttestation(state, indexedPayloadAttestation,
|
|
12
|
+
if (!isValidIndexedPayloadAttestation(state, indexedPayloadAttestation, verifySignature)) {
|
|
13
13
|
throw Error("Invalid payload attestation");
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processPayloadAttestation.js","sourceRoot":"","sources":["../../src/block/processPayloadAttestation.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAC,gCAAgC,EAAC,MAAM,uCAAuC,CAAC;AAEvF,MAAM,UAAU,yBAAyB,CACvC,KAA6B,EAC7B,kBAA4C;
|
|
1
|
+
{"version":3,"file":"processPayloadAttestation.js","sourceRoot":"","sources":["../../src/block/processPayloadAttestation.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAC,gCAAgC,EAAC,MAAM,uCAAuC,CAAC;AAEvF,MAAM,UAAU,yBAAyB,CACvC,KAA6B,EAC7B,kBAA4C,EAC5C,eAAe,GAAG,IAAI;IAEtB,MAAM,IAAI,GAAG,kBAAkB,CAAC,IAAI,CAAC;IAErC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,eAAe,EAAE,KAAK,CAAC,iBAAiB,CAAC,UAAU,CAAC,EAAE,CAAC;QAC/E,MAAM,KAAK,CAAC,qDAAqD,CAAC,CAAC;IACrE,CAAC;IAED,IAAI,IAAI,CAAC,IAAI,GAAG,CAAC,KAAK,KAAK,CAAC,IAAI,EAAE,CAAC;QACjC,MAAM,KAAK,CAAC,+CAA+C,CAAC,CAAC;IAC/D,CAAC;IAED,MAAM,yBAAyB,GAAG,KAAK,CAAC,QAAQ,CAAC,4BAA4B,CAAC,IAAI,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC;IAE7G,IAAI,CAAC,gCAAgC,CAAC,KAAK,EAAE,yBAAyB,EAAE,eAAe,CAAC,EAAE,CAAC;QACzF,MAAM,KAAK,CAAC,6BAA6B,CAAC,CAAC;IAC7C,CAAC;AACH,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.48.0-dev.
|
|
14
|
+
"version": "1.48.0-dev.a4083281b7",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
@@ -68,16 +68,16 @@
|
|
|
68
68
|
"@chainsafe/as-sha256": "^1.2.5",
|
|
69
69
|
"@chainsafe/lodestar-z": "catalog:",
|
|
70
70
|
"@chainsafe/persistent-merkle-tree": "^1.3.1",
|
|
71
|
-
"@chainsafe/ssz": "^1.
|
|
71
|
+
"@chainsafe/ssz": "^1.7.0",
|
|
72
72
|
"@chainsafe/swap-or-not-shuffle": "^1.2.1",
|
|
73
|
-
"@lodestar/config": "^1.48.0-dev.
|
|
74
|
-
"@lodestar/params": "^1.48.0-dev.
|
|
75
|
-
"@lodestar/types": "^1.48.0-dev.
|
|
76
|
-
"@lodestar/utils": "^1.48.0-dev.
|
|
73
|
+
"@lodestar/config": "^1.48.0-dev.a4083281b7",
|
|
74
|
+
"@lodestar/params": "^1.48.0-dev.a4083281b7",
|
|
75
|
+
"@lodestar/types": "^1.48.0-dev.a4083281b7",
|
|
76
|
+
"@lodestar/utils": "^1.48.0-dev.a4083281b7",
|
|
77
77
|
"@vekexasia/bigint-buffer2": "^1.1.1"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
|
-
"@lodestar/api": "^1.48.0-dev.
|
|
80
|
+
"@lodestar/api": "^1.48.0-dev.a4083281b7"
|
|
81
81
|
},
|
|
82
82
|
"keywords": [
|
|
83
83
|
"ethereum",
|
|
@@ -85,5 +85,5 @@
|
|
|
85
85
|
"beacon",
|
|
86
86
|
"blockchain"
|
|
87
87
|
],
|
|
88
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "a8b08b400066ff2c603689bc5a0517f32b0ff11f"
|
|
89
89
|
}
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ForkSeq,
|
|
3
|
-
MAX_ATTESTATIONS_ELECTRA,
|
|
4
|
-
MAX_ATTESTER_SLASHINGS_ELECTRA,
|
|
5
|
-
MAX_BLS_TO_EXECUTION_CHANGES,
|
|
6
|
-
MAX_PAYLOAD_ATTESTATIONS,
|
|
7
|
-
MAX_PROPOSER_SLASHINGS,
|
|
8
|
-
MAX_VOLUNTARY_EXITS,
|
|
9
|
-
} from "@lodestar/params";
|
|
1
|
+
import {ForkSeq} from "@lodestar/params";
|
|
10
2
|
import {BeaconBlockBody, Slot, capella, electra, gloas} from "@lodestar/types";
|
|
11
3
|
import {BeaconStateTransitionMetrics} from "../metrics.js";
|
|
12
4
|
import {
|
|
@@ -48,10 +40,6 @@ export function processOperations(
|
|
|
48
40
|
opts: ProcessBlockOpts = {verifySignatures: true},
|
|
49
41
|
metrics?: BeaconStateTransitionMetrics | null
|
|
50
42
|
): void {
|
|
51
|
-
if (fork >= ForkSeq.gloas) {
|
|
52
|
-
assertGloasOperationLimits(body as gloas.BeaconBlockBody);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
43
|
// verify that outstanding deposits are processed up to the maximum number of deposits.
|
|
56
44
|
// From Fulu the eth1 bridge deposit mechanism was removed, so blocks must not contain any deposits.
|
|
57
45
|
const maxDeposits = fork >= ForkSeq.fulu ? 0 : getEth1DepositCount(state);
|
|
@@ -103,22 +91,7 @@ export function processOperations(
|
|
|
103
91
|
|
|
104
92
|
if (fork >= ForkSeq.gloas) {
|
|
105
93
|
for (const payloadAttestation of (body as gloas.BeaconBlockBody).payloadAttestations) {
|
|
106
|
-
processPayloadAttestation(state as CachedBeaconStateGloas, payloadAttestation);
|
|
94
|
+
processPayloadAttestation(state as CachedBeaconStateGloas, payloadAttestation, opts.verifySignatures);
|
|
107
95
|
}
|
|
108
96
|
}
|
|
109
97
|
}
|
|
110
|
-
|
|
111
|
-
function assertGloasOperationLimits(body: gloas.BeaconBlockBody): void {
|
|
112
|
-
assertMaxLength("proposerSlashings", body.proposerSlashings.length, MAX_PROPOSER_SLASHINGS);
|
|
113
|
-
assertMaxLength("attesterSlashings", body.attesterSlashings.length, MAX_ATTESTER_SLASHINGS_ELECTRA);
|
|
114
|
-
assertMaxLength("attestations", body.attestations.length, MAX_ATTESTATIONS_ELECTRA);
|
|
115
|
-
assertMaxLength("voluntaryExits", body.voluntaryExits.length, MAX_VOLUNTARY_EXITS);
|
|
116
|
-
assertMaxLength("blsToExecutionChanges", body.blsToExecutionChanges.length, MAX_BLS_TO_EXECUTION_CHANGES);
|
|
117
|
-
assertMaxLength("payloadAttestations", body.payloadAttestations.length, MAX_PAYLOAD_ATTESTATIONS);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
function assertMaxLength(name: string, length: number, limit: number): void {
|
|
121
|
-
if (length > limit) {
|
|
122
|
-
throw new Error(`Block contains too many ${name}: count=${length} limit=${limit}`);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ForkPostGloas,
|
|
3
|
-
MAX_BUILDER_DEPOSIT_REQUESTS_PER_PAYLOAD,
|
|
4
|
-
MAX_BUILDER_EXIT_REQUESTS_PER_PAYLOAD,
|
|
5
|
-
MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD,
|
|
6
|
-
MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD,
|
|
7
|
-
SLOTS_PER_EPOCH,
|
|
8
|
-
SLOTS_PER_HISTORICAL_ROOT,
|
|
9
|
-
} from "@lodestar/params";
|
|
1
|
+
import {ForkPostGloas, SLOTS_PER_EPOCH, SLOTS_PER_HISTORICAL_ROOT} from "@lodestar/params";
|
|
10
2
|
import {BeaconBlock, gloas, ssz} from "@lodestar/types";
|
|
11
3
|
import {byteArrayEquals, toRootHex} from "@lodestar/utils";
|
|
12
4
|
import {CachedBeaconStateGloas} from "../types.js";
|
|
@@ -55,8 +47,6 @@ export function processParentExecutionPayload(state: CachedBeaconStateGloas, blo
|
|
|
55
47
|
* Spec: https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.6/specs/gloas/beacon-chain.md#new-apply_parent_execution_payload
|
|
56
48
|
*/
|
|
57
49
|
export function applyParentExecutionPayload(state: CachedBeaconStateGloas, requests: gloas.ExecutionRequests): void {
|
|
58
|
-
assertExecutionRequestsWithinLimits(requests);
|
|
59
|
-
|
|
60
50
|
const fork = state.config.getForkSeq(state.slot);
|
|
61
51
|
const parentBid = state.latestExecutionPayloadBid;
|
|
62
52
|
const parentSlot = state.latestBlockHeader.slot;
|
|
@@ -126,21 +116,6 @@ function settleBuilderPayment(state: CachedBeaconStateGloas, paymentIndex: numbe
|
|
|
126
116
|
state.builderPendingPayments.set(paymentIndex, ssz.gloas.BuilderPendingPayment.defaultViewDU());
|
|
127
117
|
}
|
|
128
118
|
|
|
129
|
-
function assertExecutionRequestsWithinLimits(requests: gloas.ExecutionRequests): void {
|
|
130
|
-
assertMaxLength("withdrawals", requests.withdrawals.length, MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD);
|
|
131
|
-
assertMaxLength("consolidations", requests.consolidations.length, MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD);
|
|
132
|
-
// New in GLOAS:EIP8282
|
|
133
|
-
assertMaxLength("builderDeposits", requests.builderDeposits.length, MAX_BUILDER_DEPOSIT_REQUESTS_PER_PAYLOAD);
|
|
134
|
-
// New in GLOAS:EIP8282
|
|
135
|
-
assertMaxLength("builderExits", requests.builderExits.length, MAX_BUILDER_EXIT_REQUESTS_PER_PAYLOAD);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
function assertMaxLength(name: string, length: number, limit: number): void {
|
|
139
|
-
if (length > limit) {
|
|
140
|
-
throw new Error(`Too many parent execution request ${name} count=${length} limit=${limit}`);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
119
|
function assertEmptyExecutionRequests(requests: gloas.ExecutionRequests): void {
|
|
145
120
|
if (
|
|
146
121
|
requests.deposits.length !== 0 ||
|
|
@@ -5,7 +5,8 @@ import {isValidIndexedPayloadAttestation} from "./isValidIndexedPayloadAttestati
|
|
|
5
5
|
|
|
6
6
|
export function processPayloadAttestation(
|
|
7
7
|
state: CachedBeaconStateGloas,
|
|
8
|
-
payloadAttestation: gloas.PayloadAttestation
|
|
8
|
+
payloadAttestation: gloas.PayloadAttestation,
|
|
9
|
+
verifySignature = true
|
|
9
10
|
): void {
|
|
10
11
|
const data = payloadAttestation.data;
|
|
11
12
|
|
|
@@ -19,7 +20,7 @@ export function processPayloadAttestation(
|
|
|
19
20
|
|
|
20
21
|
const indexedPayloadAttestation = state.epochCtx.getIndexedPayloadAttestation(data.slot, payloadAttestation);
|
|
21
22
|
|
|
22
|
-
if (!isValidIndexedPayloadAttestation(state, indexedPayloadAttestation,
|
|
23
|
+
if (!isValidIndexedPayloadAttestation(state, indexedPayloadAttestation, verifySignature)) {
|
|
23
24
|
throw Error("Invalid payload attestation");
|
|
24
25
|
}
|
|
25
26
|
}
|