@lodestar/state-transition 1.43.0-dev.ca1fc40294 → 1.43.0-dev.d166e3b6f7

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.
Files changed (38) hide show
  1. package/lib/block/index.d.ts +2 -2
  2. package/lib/block/index.d.ts.map +1 -1
  3. package/lib/block/index.js +11 -4
  4. package/lib/block/index.js.map +1 -1
  5. package/lib/block/processParentExecutionPayload.d.ts +20 -0
  6. package/lib/block/processParentExecutionPayload.d.ts.map +1 -0
  7. package/lib/block/processParentExecutionPayload.js +100 -0
  8. package/lib/block/processParentExecutionPayload.js.map +1 -0
  9. package/lib/block/processWithdrawals.d.ts.map +1 -1
  10. package/lib/block/processWithdrawals.js +12 -4
  11. package/lib/block/processWithdrawals.js.map +1 -1
  12. package/lib/slot/upgradeStateToGloas.d.ts.map +1 -1
  13. package/lib/slot/upgradeStateToGloas.js +1 -0
  14. package/lib/slot/upgradeStateToGloas.js.map +1 -1
  15. package/lib/stateView/beaconStateView.d.ts +4 -2
  16. package/lib/stateView/beaconStateView.d.ts.map +1 -1
  17. package/lib/stateView/beaconStateView.js +15 -9
  18. package/lib/stateView/beaconStateView.js.map +1 -1
  19. package/lib/stateView/interface.d.ts +6 -2
  20. package/lib/stateView/interface.d.ts.map +1 -1
  21. package/lib/stateView/interface.js.map +1 -1
  22. package/lib/util/computeAnchorCheckpoint.d.ts +1 -1
  23. package/lib/util/computeAnchorCheckpoint.d.ts.map +1 -1
  24. package/lib/util/computeAnchorCheckpoint.js +6 -19
  25. package/lib/util/computeAnchorCheckpoint.js.map +1 -1
  26. package/package.json +7 -7
  27. package/src/block/index.ts +12 -4
  28. package/src/block/processParentExecutionPayload.ts +116 -0
  29. package/src/block/processWithdrawals.ts +12 -4
  30. package/src/slot/upgradeStateToGloas.ts +3 -0
  31. package/src/stateView/beaconStateView.ts +15 -16
  32. package/src/stateView/interface.ts +6 -5
  33. package/src/util/computeAnchorCheckpoint.ts +6 -19
  34. package/lib/block/processExecutionPayloadEnvelope.d.ts +0 -9
  35. package/lib/block/processExecutionPayloadEnvelope.d.ts.map +0 -1
  36. package/lib/block/processExecutionPayloadEnvelope.js +0 -103
  37. package/lib/block/processExecutionPayloadEnvelope.js.map +0 -1
  38. package/src/block/processExecutionPayloadEnvelope.ts +0 -169
@@ -1 +1 @@
1
- {"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../src/stateView/interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAC,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAC,QAAQ,EAAE,SAAS,EAAC,MAAM,gBAAgB,CAAC;AACnD,OAAO,EACL,QAAQ,EACR,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,eAAe,EACf,YAAY,EACZ,aAAa,EAQd,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,WAAW,EACX,WAAW,EACX,kBAAkB,EAClB,YAAY,EACZ,OAAO,EACP,KAAK,EACL,mBAAmB,EACnB,sBAAsB,EACtB,IAAI,EACJ,OAAO,EACP,iBAAiB,EACjB,wBAAwB,EACxB,IAAI,EACJ,cAAc,EACd,MAAM,EACN,OAAO,EACP,OAAO,EACP,IAAI,EACJ,KAAK,EACL,MAAM,EACN,OAAO,EACR,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAC,UAAU,EAAE,IAAI,EAAC,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAC,mCAAmC,EAAC,MAAM,6CAA6C,CAAC;AAChG,OAAO,EAAC,qBAAqB,EAAC,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAC,0BAA0B,EAAC,MAAM,wCAAwC,CAAC;AAClF,OAAO,EAAC,wBAAwB,EAAC,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAC,WAAW,EAAC,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAC,kBAAkB,EAAC,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAC,oBAAo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AAM,UAAU,gBAAgB,CAAC,KAAuB,EAAkC;IACxF,OAAO,eAAe,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAAA,CACxC"}
1
+ {"version":3,"file":"interface.js","sourceRoot":"","sources":["../../src/stateView/interface.ts"],"names":[],"mappings":"AAEA,OAAO,EASL,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAmQ1B,MAAM,UAAU,iBAAiB,CAAC,KAAuB,EAAmC;IAC1F,OAAO,gBAAgB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAAA,CACzC;AAED,MAAM,UAAU,oBAAoB,CAAC,KAAuB,EAAsC;IAChG,OAAO,mBAAmB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAAA,CAC5C;AAED,MAAM,UAAU,kBAAkB,CAAC,KAAuB,EAAoC;IAC5F,OAAO,iBAAiB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAAA,CAC1C;AAED,MAAM,UAAU,gBAAgB,CAAC,KAAuB,EAAkC;IACxF,OAAO,eAAe,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAAA,CACxC;AAED,MAAM,UAAU,kBAAkB,CAAC,KAAuB,EAAoC;IAC5F,OAAO,iBAAiB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAAA,CAC1C;AAED,MAAM,UAAU,eAAe,CAAC,KAAuB,EAAiC;IACtF,OAAO,cAAc,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAAA,CACvC;AAED,MAAM,UAAU,gBAAgB,CAAC,KAAuB,EAAkC;IACxF,OAAO,eAAe,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAAA,CACxC"}
@@ -1,7 +1,7 @@
1
1
  import { ChainForkConfig } from "@lodestar/config";
2
2
  import { phase0 } from "@lodestar/types";
3
3
  import { BeaconStateAllForks } from "../types.js";
4
- export declare function computeAnchorCheckpoint(config: ChainForkConfig, anchorState: BeaconStateAllForks): {
4
+ export declare function computeAnchorCheckpoint(_config: ChainForkConfig, anchorState: BeaconStateAllForks): {
5
5
  checkpoint: phase0.Checkpoint;
6
6
  blockHeader: phase0.BeaconBlockHeader;
7
7
  };
@@ -1 +1 @@
1
- {"version":3,"file":"computeAnchorCheckpoint.d.ts","sourceRoot":"","sources":["../../src/util/computeAnchorCheckpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAC,MAAM,EAAM,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAC,mBAAmB,EAAC,MAAM,aAAa,CAAC;AAIhD,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,eAAe,EACvB,WAAW,EAAE,mBAAmB,GAC/B;IAAC,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC,iBAAiB,CAAA;CAAC,CA2BxE"}
1
+ {"version":3,"file":"computeAnchorCheckpoint.d.ts","sourceRoot":"","sources":["../../src/util/computeAnchorCheckpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAC,MAAM,EAAM,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAC,mBAAmB,EAAC,MAAM,aAAa,CAAC;AAGhD,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,eAAe,EACxB,WAAW,EAAE,mBAAmB,GAC/B;IAAC,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC,iBAAiB,CAAA;CAAC,CAexE"}
@@ -1,27 +1,14 @@
1
- import { GENESIS_SLOT, ZERO_HASH } from "@lodestar/params";
1
+ import { ZERO_HASH } from "@lodestar/params";
2
2
  import { ssz } from "@lodestar/types";
3
- import { blockToHeader } from "./blockRoot.js";
4
3
  import { computeCheckpointEpochAtStateSlot } from "./epoch.js";
5
- export function computeAnchorCheckpoint(config, anchorState) {
6
- let blockHeader;
7
- let root;
8
- const blockTypes = config.getForkTypes(anchorState.latestBlockHeader.slot);
9
- if (anchorState.latestBlockHeader.slot === GENESIS_SLOT) {
10
- const block = blockTypes.BeaconBlock.defaultValue();
11
- block.stateRoot = anchorState.hashTreeRoot();
12
- blockHeader = blockToHeader(config, block);
13
- root = ssz.phase0.BeaconBlockHeader.hashTreeRoot(blockHeader);
14
- }
15
- else {
16
- blockHeader = ssz.phase0.BeaconBlockHeader.clone(anchorState.latestBlockHeader);
17
- if (ssz.Root.equals(blockHeader.stateRoot, ZERO_HASH)) {
18
- blockHeader.stateRoot = anchorState.hashTreeRoot();
19
- }
20
- root = ssz.phase0.BeaconBlockHeader.hashTreeRoot(blockHeader);
4
+ export function computeAnchorCheckpoint(_config, anchorState) {
5
+ const blockHeader = ssz.phase0.BeaconBlockHeader.clone(anchorState.latestBlockHeader);
6
+ if (ssz.Root.equals(blockHeader.stateRoot, ZERO_HASH)) {
7
+ blockHeader.stateRoot = anchorState.hashTreeRoot();
21
8
  }
22
9
  return {
23
10
  checkpoint: {
24
- root,
11
+ root: ssz.phase0.BeaconBlockHeader.hashTreeRoot(blockHeader),
25
12
  // the checkpoint epoch = computeEpochAtSlot(anchorState.slot) + 1 if slot is not at epoch boundary
26
13
  // this is similar to a process_slots() call
27
14
  epoch: computeCheckpointEpochAtStateSlot(anchorState.slot),
@@ -1 +1 @@
1
- {"version":3,"file":"computeAnchorCheckpoint.js","sourceRoot":"","sources":["../../src/util/computeAnchorCheckpoint.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAE,SAAS,EAAC,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAS,GAAG,EAAC,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAC,aAAa,EAAC,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAC,iCAAiC,EAAC,MAAM,YAAY,CAAC;AAE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BAAkB,CAAC;AAC3C,OAAO,EAAS,GAAG,EAAC,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAC,iCAAiC,EAAC,MAAM,YAAY,CAAC;AAE7D,MAAM,UAAU,uBAAuB,CACrC,OAAwB,EACxB,WAAgC,EACwC;IACxE,MAAM,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,iBAAiB,CAAC,KAAK,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC;IACtF,IAAI,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,SAAS,EAAE,SAAS,CAAC,EAAE,CAAC;QACtD,WAAW,CAAC,SAAS,GAAG,WAAW,CAAC,YAAY,EAAE,CAAC;IACrD,CAAC;IAED,OAAO;QACL,UAAU,EAAE;YACV,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,iBAAiB,CAAC,YAAY,CAAC,WAAW,CAAC;YAC5D,mGAAmG;YACnG,4CAA4C;YAC5C,KAAK,EAAE,iCAAiC,CAAC,WAAW,CAAC,IAAI,CAAC;SAC3D;QACD,WAAW;KACZ,CAAC;AAAA,CACH"}
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.43.0-dev.ca1fc40294",
14
+ "version": "1.43.0-dev.d166e3b6f7",
15
15
  "type": "module",
16
16
  "exports": {
17
17
  ".": {
@@ -67,14 +67,14 @@
67
67
  "@chainsafe/pubkey-index-map": "^3.0.0",
68
68
  "@chainsafe/ssz": "^1.4.0",
69
69
  "@chainsafe/swap-or-not-shuffle": "^1.2.1",
70
- "@lodestar/config": "^1.43.0-dev.ca1fc40294",
71
- "@lodestar/params": "^1.43.0-dev.ca1fc40294",
72
- "@lodestar/types": "^1.43.0-dev.ca1fc40294",
73
- "@lodestar/utils": "^1.43.0-dev.ca1fc40294",
70
+ "@lodestar/config": "^1.43.0-dev.d166e3b6f7",
71
+ "@lodestar/params": "^1.43.0-dev.d166e3b6f7",
72
+ "@lodestar/types": "^1.43.0-dev.d166e3b6f7",
73
+ "@lodestar/utils": "^1.43.0-dev.d166e3b6f7",
74
74
  "@vekexasia/bigint-buffer2": "^1.1.1"
75
75
  },
76
76
  "devDependencies": {
77
- "@lodestar/api": "^1.43.0-dev.ca1fc40294"
77
+ "@lodestar/api": "^1.43.0-dev.d166e3b6f7"
78
78
  },
79
79
  "keywords": [
80
80
  "ethereum",
@@ -82,5 +82,5 @@
82
82
  "beacon",
83
83
  "blockchain"
84
84
  ],
85
- "gitHead": "b9b4b6a67243378ab112c8d86a5681931be9bcc9"
85
+ "gitHead": "d66d8c5f6a57c9b358cf85a6fb113ca519705b29"
86
86
  }
@@ -14,8 +14,8 @@ import {processBlockHeader} from "./processBlockHeader.js";
14
14
  import {processEth1Data} from "./processEth1Data.js";
15
15
  import {processExecutionPayload} from "./processExecutionPayload.js";
16
16
  import {processExecutionPayloadBid} from "./processExecutionPayloadBid.js";
17
- import {processExecutionPayloadEnvelope} from "./processExecutionPayloadEnvelope.js";
18
17
  import {processOperations} from "./processOperations.js";
18
+ import {processParentExecutionPayload} from "./processParentExecutionPayload.js";
19
19
  import {processPayloadAttestation} from "./processPayloadAttestation.js";
20
20
  import {processRandao} from "./processRandao.js";
21
21
  import {processSyncAggregate} from "./processSyncCommittee.js";
@@ -32,7 +32,7 @@ export {
32
32
  processWithdrawals,
33
33
  processExecutionPayloadBid,
34
34
  processPayloadAttestation,
35
- processExecutionPayloadEnvelope,
35
+ processParentExecutionPayload,
36
36
  };
37
37
 
38
38
  export * from "./externalData.js";
@@ -51,10 +51,16 @@ export function processBlock(
51
51
  ): void {
52
52
  const {verifySignatures = true} = opts ?? {};
53
53
 
54
+ // Apply the parent's deferred payload effects before everything else. Must run before
55
+ // processBlockHeader and processExecutionPayloadBid so subsequent steps see the updated state.
56
+ if (fork >= ForkSeq.gloas) {
57
+ processParentExecutionPayload(state as CachedBeaconStateGloas, block as BeaconBlock<ForkPostGloas>);
58
+ }
59
+
54
60
  processBlockHeader(state, block);
55
61
 
56
62
  if (fork >= ForkSeq.gloas) {
57
- // After gloas, processWithdrawals does not take a payload parameter
63
+ // Parent payload's execution requests were already applied by processParentExecutionPayload above
58
64
  processWithdrawals(fork, state as CachedBeaconStateGloas);
59
65
  } else if (fork >= ForkSeq.capella) {
60
66
  const fullOrBlindedPayload = getFullOrBlindedPayload(block);
@@ -67,7 +73,9 @@ export function processBlock(
67
73
 
68
74
  // The call to the process_execution_payload must happen before the call to the process_randao as the former depends
69
75
  // on the randao_mix computed with the reveal of the previous block.
70
- // TODO GLOAS: We call processExecutionPayload somewhere else post-gloas
76
+ // Post-gloas: process_execution_payload is not part of block processing. The parent's payload
77
+ // effects are applied earlier via processParentExecutionPayload, and each execution payload is
78
+ // verified out-of-band via verifyExecutionPayloadEnvelope when it arrives.
71
79
  if (
72
80
  fork < ForkSeq.gloas &&
73
81
  fork >= ForkSeq.bellatrix &&
@@ -0,0 +1,116 @@
1
+ import {ForkPostGloas, SLOTS_PER_EPOCH, SLOTS_PER_HISTORICAL_ROOT} from "@lodestar/params";
2
+ import {BeaconBlock, electra, ssz} from "@lodestar/types";
3
+ import {byteArrayEquals, toRootHex} from "@lodestar/utils";
4
+ import {CachedBeaconStateGloas} from "../types.js";
5
+ import {computeEpochAtSlot} from "../util/epoch.js";
6
+ import {processConsolidationRequest} from "./processConsolidationRequest.js";
7
+ import {getPendingValidatorPubkeys, processDepositRequest} from "./processDepositRequest.js";
8
+ import {processWithdrawalRequest} from "./processWithdrawalRequest.js";
9
+
10
+ /**
11
+ * Process parent execution payload effects as the first step of processBlock.
12
+ *
13
+ * Spec: https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.5/specs/gloas/beacon-chain.md#new-process_parent_execution_payload
14
+ */
15
+ export function processParentExecutionPayload(state: CachedBeaconStateGloas, block: BeaconBlock<ForkPostGloas>): void {
16
+ const bid = block.body.signedExecutionPayloadBid.message;
17
+ const parentBid = state.latestExecutionPayloadBid;
18
+ const requests = block.body.parentExecutionRequests;
19
+
20
+ const isParentBlockFull = byteArrayEquals(bid.parentBlockHash, parentBid.blockHash);
21
+ if (!isParentBlockFull) {
22
+ // Parent was EMPTY -- no execution requests expected
23
+ assertEmptyExecutionRequests(requests);
24
+ return;
25
+ }
26
+
27
+ // Parent was FULL -- verify the bid commitment and apply the payload
28
+ const requestsRoot = ssz.electra.ExecutionRequests.hashTreeRoot(requests);
29
+ if (!byteArrayEquals(requestsRoot, parentBid.executionRequestsRoot)) {
30
+ throw new Error(
31
+ `Parent execution requests root mismatch actual=${toRootHex(requestsRoot)} expected=${toRootHex(parentBid.executionRequestsRoot)}`
32
+ );
33
+ }
34
+
35
+ applyParentExecutionPayload(state, requests);
36
+ }
37
+
38
+ /**
39
+ * Process the parent's execution requests, queue the builder payment, update payload availability,
40
+ * and update the latest block hash.
41
+ *
42
+ * Called from processParentExecutionPayload during block processing, and from the validator during
43
+ * block production before computing withdrawals.
44
+ *
45
+ * Spec: https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.5/specs/gloas/beacon-chain.md#new-apply_parent_execution_payload
46
+ */
47
+ export function applyParentExecutionPayload(state: CachedBeaconStateGloas, requests: electra.ExecutionRequests): void {
48
+ const fork = state.config.getForkSeq(state.slot);
49
+ const parentBid = state.latestExecutionPayloadBid;
50
+ const parentSlot = parentBid.slot;
51
+ const parentEpoch = computeEpochAtSlot(parentSlot);
52
+ const currentEpoch = computeEpochAtSlot(state.slot);
53
+
54
+ // Process execution requests from parent's payload. The execution
55
+ // requests are processed at state.slot (child's slot), not the parent's slot.
56
+ if (requests.deposits.length > 0) {
57
+ const pendingValidatorPubkeys = getPendingValidatorPubkeys(state.config, state);
58
+ for (const deposit of requests.deposits) {
59
+ processDepositRequest(fork, state, deposit, pendingValidatorPubkeys);
60
+ }
61
+ }
62
+
63
+ for (const withdrawal of requests.withdrawals) {
64
+ processWithdrawalRequest(fork, state, withdrawal);
65
+ }
66
+
67
+ for (const consolidation of requests.consolidations) {
68
+ processConsolidationRequest(state, consolidation);
69
+ }
70
+
71
+ // Settle the builder payment
72
+ if (parentEpoch === currentEpoch) {
73
+ settleBuilderPayment(state, SLOTS_PER_EPOCH + (parentSlot % SLOTS_PER_EPOCH));
74
+ } else if (parentEpoch === currentEpoch - 1) {
75
+ settleBuilderPayment(state, parentSlot % SLOTS_PER_EPOCH);
76
+ } else if (parentBid.value > 0) {
77
+ // Parent is older than the previous epoch, its payment entry has been evicted from
78
+ // builder_pending_payments. Append the withdrawal directly.
79
+ state.builderPendingWithdrawals.push(
80
+ ssz.gloas.BuilderPendingWithdrawal.toViewDU({
81
+ feeRecipient: parentBid.feeRecipient,
82
+ amount: parentBid.value,
83
+ builderIndex: parentBid.builderIndex,
84
+ })
85
+ );
86
+ }
87
+
88
+ // Update parent payload availability and latest block hash
89
+ state.executionPayloadAvailability.set(parentSlot % SLOTS_PER_HISTORICAL_ROOT, true);
90
+ state.latestBlockHash = parentBid.blockHash;
91
+ }
92
+
93
+ /**
94
+ * Settle a builder payment at the given index: move its withdrawal (if any) to the
95
+ * pending withdrawals list and clear the payment slot.
96
+ *
97
+ * Spec: https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.5/specs/gloas/beacon-chain.md#new-settle_builder_payment
98
+ */
99
+ function settleBuilderPayment(state: CachedBeaconStateGloas, paymentIndex: number): void {
100
+ if (paymentIndex >= state.builderPendingPayments.length) {
101
+ throw new Error(
102
+ `Invalid builder payment index paymentIndex=${paymentIndex} limit=${state.builderPendingPayments.length}`
103
+ );
104
+ }
105
+ const payment = state.builderPendingPayments.get(paymentIndex).clone();
106
+ if (payment.withdrawal.amount > 0) {
107
+ state.builderPendingWithdrawals.push(payment.withdrawal);
108
+ }
109
+ state.builderPendingPayments.set(paymentIndex, ssz.gloas.BuilderPendingPayment.defaultViewDU());
110
+ }
111
+
112
+ function assertEmptyExecutionRequests(requests: electra.ExecutionRequests): void {
113
+ if (requests.deposits.length !== 0 || requests.withdrawals.length !== 0 || requests.consolidations.length !== 0) {
114
+ throw new Error("Parent execution requests must be empty when parent block is EMPTY");
115
+ }
116
+ }
@@ -10,6 +10,7 @@ import {
10
10
  } from "@lodestar/params";
11
11
  import {BuilderIndex, ValidatorIndex, capella, ssz} from "@lodestar/types";
12
12
  import {byteArrayEquals, toRootHex} from "@lodestar/utils";
13
+ import {ZERO_HASH} from "../constants/index.js";
13
14
  import {CachedBeaconStateCapella, CachedBeaconStateElectra, CachedBeaconStateGloas} from "../types.js";
14
15
  import {
15
16
  convertBuilderIndexToValidatorIndex,
@@ -31,9 +32,14 @@ export function processWithdrawals(
31
32
  state: CachedBeaconStateCapella | CachedBeaconStateElectra | CachedBeaconStateGloas,
32
33
  payload?: capella.FullOrBlindedExecutionPayload
33
34
  ): void {
34
- // Return early if the parent block is empty
35
- if (fork >= ForkSeq.gloas && !isParentBlockFull(state as CachedBeaconStateGloas)) {
36
- return;
35
+ // Return early if this is genesis block or the parent block is empty
36
+ if (fork >= ForkSeq.gloas) {
37
+ const stateGloas = state as CachedBeaconStateGloas;
38
+ const isGenesisBlock = byteArrayEquals(stateGloas.latestBlockHash, ZERO_HASH);
39
+ const isParentBlockEmpty = !isParentBlockFull(stateGloas);
40
+ if (isGenesisBlock || isParentBlockEmpty) {
41
+ return;
42
+ }
37
43
  }
38
44
 
39
45
  // processedBuilderWithdrawalsCount is withdrawals coming from builder payment since gloas (EIP-7732)
@@ -48,7 +54,9 @@ export function processWithdrawals(
48
54
  } = getExpectedWithdrawals(fork, state);
49
55
  const numWithdrawals = expectedWithdrawals.length;
50
56
 
51
- // After gloas, withdrawals are verified later in processExecutionPayloadEnvelope
57
+ // Pre-gloas verifies the payload's withdrawals against expectedWithdrawals here.
58
+ // Post-gloas, the payload arrives later as an envelope and that consistency check
59
+ // happens in verifyExecutionPayloadEnvelope against state.payloadExpectedWithdrawals.
52
60
  if (fork < ForkSeq.gloas) {
53
61
  if (payload === undefined) {
54
62
  throw Error("payload is required for pre-gloas processWithdrawals");
@@ -48,6 +48,9 @@ export function upgradeStateToGloas(stateFulu: CachedBeaconStateFulu): CachedBea
48
48
  stateGloasView.currentSyncCommittee = stateGloasCloned.currentSyncCommittee;
49
49
  stateGloasView.nextSyncCommittee = stateGloasCloned.nextSyncCommittee;
50
50
  stateGloasView.latestExecutionPayloadBid.blockHash = stateFulu.latestExecutionPayloadHeader.blockHash;
51
+ stateGloasView.latestExecutionPayloadBid.executionRequestsRoot = ssz.electra.ExecutionRequests.hashTreeRoot(
52
+ ssz.electra.ExecutionRequests.defaultValue()
53
+ );
51
54
  stateGloasView.nextWithdrawalIndex = stateGloasCloned.nextWithdrawalIndex;
52
55
  stateGloasView.nextWithdrawalValidatorIndex = stateGloasCloned.nextWithdrawalValidatorIndex;
53
56
  stateGloasView.historicalSummaries = stateGloasCloned.historicalSummaries;
@@ -1,7 +1,7 @@
1
1
  import {CompactMultiProof, ProofType, Tree, createProof} from "@chainsafe/persistent-merkle-tree";
2
2
  import {BitArray, ByteViews} from "@chainsafe/ssz";
3
3
  import {BeaconConfig} from "@lodestar/config";
4
- import {ForkName, ForkSeq, SLOTS_PER_HISTORICAL_ROOT, isForkPostGloas} from "@lodestar/params";
4
+ import {ForkName, ForkSeq, SLOTS_PER_HISTORICAL_ROOT} from "@lodestar/params";
5
5
  import {
6
6
  BeaconBlock,
7
7
  BeaconState,
@@ -28,8 +28,7 @@ import {
28
28
  rewards,
29
29
  } from "@lodestar/types";
30
30
  import {Checkpoint, Fork} from "@lodestar/types/phase0";
31
- import {processExecutionPayloadEnvelope} from "../block/index.js";
32
- import {ProcessExecutionPayloadEnvelopeOpts} from "../block/processExecutionPayloadEnvelope.js";
31
+ import {applyParentExecutionPayload} from "../block/processParentExecutionPayload.js";
33
32
  import {VoluntaryExitValidity, getVoluntaryExitValidity} from "../block/processVoluntaryExit.js";
34
33
  import {getExpectedWithdrawals} from "../block/processWithdrawals.js";
35
34
  import {EffectiveBalanceIncrements} from "../cache/effectiveBalanceIncrements.js";
@@ -784,19 +783,19 @@ export class BeaconStateView implements IBeaconStateViewLatestFork {
784
783
  return new BeaconStateView(newState);
785
784
  }
786
785
 
787
- processExecutionPayloadEnvelope(
788
- signedEnvelope: gloas.SignedExecutionPayloadEnvelope,
789
- opts?: ProcessExecutionPayloadEnvelopeOpts
790
- ): BeaconStateView {
791
- const fork = this.config.getForkName(this.cachedState.slot);
792
- if (!isForkPostGloas(fork)) {
793
- throw Error(`processExecutionPayloadEnvelope is only available for gloas+ forks, got fork=${fork}`);
786
+ /**
787
+ * Spec: https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.5/specs/gloas/validator.md#executionpayload
788
+ */
789
+ getExpectedWithdrawalsForFullParent(executionRequests: electra.ExecutionRequests): capella.Withdrawal[] {
790
+ const fork = this.config.getForkSeq(this.cachedState.slot);
791
+ if (fork < ForkSeq.gloas) {
792
+ throw new Error("getExpectedWithdrawalsForFullParent is not available before Gloas");
794
793
  }
795
- const postPayloadState = processExecutionPayloadEnvelope(
796
- this.cachedState as CachedBeaconStateGloas,
797
- signedEnvelope,
798
- opts
799
- );
800
- return new BeaconStateView(postPayloadState);
794
+ // Make a copy of the state to avoid mutability issues
795
+ const stateCopy = this.cachedState.clone(true) as CachedBeaconStateGloas;
796
+ // Apply parent payload before computing withdrawals
797
+ applyParentExecutionPayload(stateCopy, executionRequests);
798
+
799
+ return getExpectedWithdrawals(fork, stateCopy).expectedWithdrawals;
801
800
  }
802
801
  }
@@ -41,7 +41,6 @@ import {
41
41
  rewards,
42
42
  } from "@lodestar/types";
43
43
  import {Checkpoint, Fork} from "@lodestar/types/phase0";
44
- import {ProcessExecutionPayloadEnvelopeOpts} from "../block/processExecutionPayloadEnvelope.js";
45
44
  import {VoluntaryExitValidity} from "../block/processVoluntaryExit.js";
46
45
  import {EffectiveBalanceIncrements} from "../cache/effectiveBalanceIncrements.js";
47
46
  import {EpochTransitionCacheOpts} from "../cache/epochTransitionCache.js";
@@ -254,10 +253,12 @@ export interface IBeaconStateViewGloas extends IBeaconStateViewFulu {
254
253
  getBuilder(index: BuilderIndex): gloas.Builder;
255
254
  canBuilderCoverBid(builderIndex: BuilderIndex, bidAmount: number): boolean;
256
255
  getIndexInPayloadTimelinessCommittee(validatorIndex: ValidatorIndex, slot: Slot): number;
257
- processExecutionPayloadEnvelope(
258
- signedEnvelope: gloas.SignedExecutionPayloadEnvelope,
259
- opts?: ProcessExecutionPayloadEnvelopeOpts
260
- ): IBeaconStateView;
256
+ /**
257
+ * Compute expected withdrawals as if the parent was FULL.
258
+ * Clones the state, applies parent payload effects, then computes withdrawals.
259
+ * Used by prepare_execution_payload when building on FULL parent.
260
+ */
261
+ getExpectedWithdrawalsForFullParent(executionRequests: electra.ExecutionRequests): capella.Withdrawal[];
261
262
  }
262
263
 
263
264
  /**
@@ -1,34 +1,21 @@
1
1
  import {ChainForkConfig} from "@lodestar/config";
2
- import {GENESIS_SLOT, ZERO_HASH} from "@lodestar/params";
2
+ import {ZERO_HASH} from "@lodestar/params";
3
3
  import {phase0, ssz} from "@lodestar/types";
4
4
  import {BeaconStateAllForks} from "../types.js";
5
- import {blockToHeader} from "./blockRoot.js";
6
5
  import {computeCheckpointEpochAtStateSlot} from "./epoch.js";
7
6
 
8
7
  export function computeAnchorCheckpoint(
9
- config: ChainForkConfig,
8
+ _config: ChainForkConfig,
10
9
  anchorState: BeaconStateAllForks
11
10
  ): {checkpoint: phase0.Checkpoint; blockHeader: phase0.BeaconBlockHeader} {
12
- let blockHeader: phase0.BeaconBlockHeader;
13
- let root: Uint8Array;
14
- const blockTypes = config.getForkTypes(anchorState.latestBlockHeader.slot);
15
-
16
- if (anchorState.latestBlockHeader.slot === GENESIS_SLOT) {
17
- const block = blockTypes.BeaconBlock.defaultValue();
18
- block.stateRoot = anchorState.hashTreeRoot();
19
- blockHeader = blockToHeader(config, block);
20
- root = ssz.phase0.BeaconBlockHeader.hashTreeRoot(blockHeader);
21
- } else {
22
- blockHeader = ssz.phase0.BeaconBlockHeader.clone(anchorState.latestBlockHeader);
23
- if (ssz.Root.equals(blockHeader.stateRoot, ZERO_HASH)) {
24
- blockHeader.stateRoot = anchorState.hashTreeRoot();
25
- }
26
- root = ssz.phase0.BeaconBlockHeader.hashTreeRoot(blockHeader);
11
+ const blockHeader = ssz.phase0.BeaconBlockHeader.clone(anchorState.latestBlockHeader);
12
+ if (ssz.Root.equals(blockHeader.stateRoot, ZERO_HASH)) {
13
+ blockHeader.stateRoot = anchorState.hashTreeRoot();
27
14
  }
28
15
 
29
16
  return {
30
17
  checkpoint: {
31
- root,
18
+ root: ssz.phase0.BeaconBlockHeader.hashTreeRoot(blockHeader),
32
19
  // the checkpoint epoch = computeEpochAtSlot(anchorState.slot) + 1 if slot is not at epoch boundary
33
20
  // this is similar to a process_slots() call
34
21
  epoch: computeCheckpointEpochAtStateSlot(anchorState.slot),
@@ -1,9 +0,0 @@
1
- import { gloas } from "@lodestar/types";
2
- import { CachedBeaconStateGloas } from "../types.js";
3
- export type ProcessExecutionPayloadEnvelopeOpts = {
4
- verifySignature?: boolean;
5
- verifyStateRoot?: boolean;
6
- dontTransferCache?: boolean;
7
- };
8
- export declare function processExecutionPayloadEnvelope(state: CachedBeaconStateGloas, signedEnvelope: gloas.SignedExecutionPayloadEnvelope, opts?: ProcessExecutionPayloadEnvelopeOpts): CachedBeaconStateGloas;
9
- //# sourceMappingURL=processExecutionPayloadEnvelope.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"processExecutionPayloadEnvelope.d.ts","sourceRoot":"","sources":["../../src/block/processExecutionPayloadEnvelope.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,KAAK,EAAM,MAAM,iBAAiB,CAAC;AAI3C,OAAO,EAAC,sBAAsB,EAAC,MAAM,aAAa,CAAC;AAOnD,MAAM,MAAM,mCAAmC,GAAG;IAChD,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC;AAKF,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,sBAAsB,EAC7B,cAAc,EAAE,KAAK,CAAC,8BAA8B,EACpD,IAAI,CAAC,EAAE,mCAAmC,GACzC,sBAAsB,CAoDxB"}
@@ -1,103 +0,0 @@
1
- import { SLOTS_PER_EPOCH, SLOTS_PER_HISTORICAL_ROOT } from "@lodestar/params";
2
- import { ssz } from "@lodestar/types";
3
- import { byteArrayEquals, toHex, toRootHex } from "@lodestar/utils";
4
- import { getExecutionPayloadEnvelopeSignatureSet } from "../signatureSets/executionPayloadEnvelope.js";
5
- import { BeaconStateView } from "../stateView/beaconStateView.js";
6
- import { computeTimeAtSlot } from "../util/index.js";
7
- import { verifySignatureSet } from "../util/signatureSets.js";
8
- import { processConsolidationRequest } from "./processConsolidationRequest.js";
9
- import { getPendingValidatorPubkeys, processDepositRequest } from "./processDepositRequest.js";
10
- import { processWithdrawalRequest } from "./processWithdrawalRequest.js";
11
- // Unlike other block processing functions which mutate state in-place, this function
12
- // clones the state and returns the post-state, similar to stateTransition().
13
- // This function does not call execution engine to verify payload. Need to call it from other place.
14
- export function processExecutionPayloadEnvelope(state, signedEnvelope, opts) {
15
- const { verifySignature = true } = opts ?? {};
16
- const envelope = signedEnvelope.message;
17
- const payload = envelope.payload;
18
- const fork = state.config.getForkSeq(payload.slotNumber);
19
- if (verifySignature && !verifyExecutionPayloadEnvelopeSignature(state, signedEnvelope)) {
20
- throw Error(`Execution payload envelope has invalid signature builderIndex=${envelope.builderIndex}`);
21
- }
22
- // .clone() before mutating state, similar to stateTransition()
23
- const postState = state.clone(opts?.dontTransferCache);
24
- validateExecutionPayloadEnvelope(postState, envelope);
25
- const requests = envelope.executionRequests;
26
- if (requests.deposits.length > 0) {
27
- // Build cache of pending validator pubkeys once, shared across all deposit requests
28
- const pendingValidatorPubkeys = getPendingValidatorPubkeys(postState.config, postState);
29
- for (const deposit of requests.deposits) {
30
- processDepositRequest(fork, postState, deposit, pendingValidatorPubkeys);
31
- }
32
- }
33
- for (const withdrawal of requests.withdrawals) {
34
- processWithdrawalRequest(fork, postState, withdrawal);
35
- }
36
- for (const consolidation of requests.consolidations) {
37
- processConsolidationRequest(postState, consolidation);
38
- }
39
- // Queue the builder payment
40
- const paymentIndex = SLOTS_PER_EPOCH + (postState.slot % SLOTS_PER_EPOCH);
41
- const payment = postState.builderPendingPayments.get(paymentIndex).clone();
42
- const amount = payment.withdrawal.amount;
43
- if (amount > 0) {
44
- postState.builderPendingWithdrawals.push(payment.withdrawal);
45
- }
46
- postState.builderPendingPayments.set(paymentIndex, ssz.gloas.BuilderPendingPayment.defaultViewDU());
47
- // Cache the execution payload hash
48
- postState.executionPayloadAvailability.set(postState.slot % SLOTS_PER_HISTORICAL_ROOT, true);
49
- postState.latestBlockHash = payload.blockHash;
50
- postState.commit();
51
- return postState;
52
- }
53
- function validateExecutionPayloadEnvelope(state, envelope) {
54
- const payload = envelope.payload;
55
- // Cache latest block header state root
56
- if (byteArrayEquals(state.latestBlockHeader.stateRoot, ssz.Root.defaultValue())) {
57
- const previousStateRoot = state.hashTreeRoot();
58
- state.latestBlockHeader.stateRoot = previousStateRoot;
59
- }
60
- // Verify consistency with the beacon block
61
- if (!byteArrayEquals(envelope.beaconBlockRoot, state.latestBlockHeader.hashTreeRoot())) {
62
- throw new Error(`Envelope's block is not the latest block header envelope=${toRootHex(envelope.beaconBlockRoot)} latestBlockHeader=${toRootHex(state.latestBlockHeader.hashTreeRoot())}`);
63
- }
64
- if (payload.slotNumber !== state.slot) {
65
- throw new Error(`Slot mismatch between payload and state payload=${payload.slotNumber} state=${state.slot}`);
66
- }
67
- // Verify consistency with the committed bid
68
- const committedBid = state.latestExecutionPayloadBid;
69
- if (envelope.builderIndex !== committedBid.builderIndex) {
70
- throw new Error(`Builder index mismatch between envelope and committed bid envelope=${envelope.builderIndex} committedBid=${committedBid.builderIndex}`);
71
- }
72
- if (!byteArrayEquals(committedBid.prevRandao, payload.prevRandao)) {
73
- throw new Error(`Prev randao mismatch between committed bid and payload committedBid=${toHex(committedBid.prevRandao)} payload=${toHex(payload.prevRandao)}`);
74
- }
75
- // Verify consistency with expected withdrawals
76
- const payloadWithdrawalsRoot = ssz.capella.Withdrawals.hashTreeRoot(payload.withdrawals);
77
- const expectedWithdrawalsRoot = state.payloadExpectedWithdrawals.hashTreeRoot();
78
- if (!byteArrayEquals(payloadWithdrawalsRoot, expectedWithdrawalsRoot)) {
79
- throw new Error(`Withdrawals mismatch between payload and expected withdrawals payload=${toRootHex(payloadWithdrawalsRoot)} expected=${toRootHex(expectedWithdrawalsRoot)}`);
80
- }
81
- // Verify the gas_limit
82
- if (Number(committedBid.gasLimit) !== payload.gasLimit) {
83
- throw new Error(`Gas limit mismatch between envelope's payload and committed bid envelope=${payload.gasLimit} committedBid=${Number(committedBid.gasLimit)}`);
84
- }
85
- // Verify the block hash
86
- if (!byteArrayEquals(committedBid.blockHash, payload.blockHash)) {
87
- throw new Error(`Block hash mismatch between envelope's payload and committed bid envelope=${toRootHex(payload.blockHash)} committedBid=${toRootHex(committedBid.blockHash)}`);
88
- }
89
- // Verify consistency of the parent hash with respect to the previous execution payload
90
- if (!byteArrayEquals(payload.parentHash, state.latestBlockHash)) {
91
- throw new Error(`Parent hash mismatch between envelope's payload and state envelope=${toRootHex(payload.parentHash)} state=${toRootHex(state.latestBlockHash)}`);
92
- }
93
- // Verify timestamp
94
- if (payload.timestamp !== computeTimeAtSlot(state.config, state.slot, state.genesisTime)) {
95
- throw new Error(`Timestamp mismatch between envelope's payload and state envelope=${payload.timestamp} state=${computeTimeAtSlot(state.config, state.slot, state.genesisTime)}`);
96
- }
97
- // Skipped: Verify the execution payload is valid
98
- }
99
- function verifyExecutionPayloadEnvelopeSignature(state, signedEnvelope) {
100
- const signatureSet = getExecutionPayloadEnvelopeSignatureSet(state.config, state.epochCtx.pubkeyCache, new BeaconStateView(state), signedEnvelope, state.latestBlockHeader.proposerIndex);
101
- return verifySignatureSet(signatureSet);
102
- }
103
- //# sourceMappingURL=processExecutionPayloadEnvelope.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"processExecutionPayloadEnvelope.js","sourceRoot":"","sources":["../../src/block/processExecutionPayloadEnvelope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAE,yBAAyB,EAAC,MAAM,kBAAkB,CAAC;AAC5E,OAAO,EAAQ,GAAG,EAAC,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAC,eAAe,EAAE,KAAK,EAAE,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAC,uCAAuC,EAAC,MAAM,8CAA8C,CAAC;AACrG,OAAO,EAAC,eAAe,EAAC,MAAM,iCAAiC,CAAC;AAEhE,OAAO,EAAC,iBAAiB,EAAC,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAC,kBAAkB,EAAC,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAC,2BAA2B,EAAC,MAAM,kCAAkC,CAAC;AAC7E,OAAO,EAAC,0BAA0B,EAAE,qBAAqB,EAAC,MAAM,4BAA4B,CAAC;AAC7F,OAAO,EAAC,wBAAwB,EAAC,MAAM,+BAA+B,CAAC;AAQvE,qFAAqF;AACrF,6EAA6E;AAC7E,oGAAoG;AACpG,MAAM,UAAU,+BAA+B,CAC7C,KAA6B,EAC7B,cAAoD,EACpD,IAA0C,EAClB;IACxB,MAAM,EAAC,eAAe,GAAG,IAAI,EAAC,GAAG,IAAI,IAAI,EAAE,CAAC;IAC5C,MAAM,QAAQ,GAAG,cAAc,CAAC,OAAO,CAAC;IACxC,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC;IACjC,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAEzD,IAAI,eAAe,IAAI,CAAC,uCAAuC,CAAC,KAAK,EAAE,cAAc,CAAC,EAAE,CAAC;QACvF,MAAM,KAAK,CAAC,iEAAiE,QAAQ,CAAC,YAAY,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