@lodestar/state-transition 1.44.0-rc.2 → 1.44.0-rc.3
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/index.d.ts +2 -0
- package/lib/block/index.d.ts.map +1 -1
- package/lib/block/index.js +3 -1
- package/lib/block/index.js.map +1 -1
- package/lib/block/processBuilderDepositRequest.d.ts +10 -0
- package/lib/block/processBuilderDepositRequest.d.ts.map +1 -0
- package/lib/block/processBuilderDepositRequest.js +27 -0
- package/lib/block/processBuilderDepositRequest.js.map +1 -0
- package/lib/block/processBuilderExitRequest.d.ts +13 -0
- package/lib/block/processBuilderExitRequest.d.ts.map +1 -0
- package/lib/block/processBuilderExitRequest.js +29 -0
- package/lib/block/processBuilderExitRequest.js.map +1 -0
- package/lib/block/processDepositRequest.d.ts +2 -8
- package/lib/block/processDepositRequest.d.ts.map +1 -1
- package/lib/block/processDepositRequest.js +2 -98
- package/lib/block/processDepositRequest.js.map +1 -1
- package/lib/block/processExecutionPayloadBid.d.ts +2 -3
- package/lib/block/processExecutionPayloadBid.d.ts.map +1 -1
- package/lib/block/processExecutionPayloadBid.js +16 -8
- package/lib/block/processExecutionPayloadBid.js.map +1 -1
- package/lib/block/processParentExecutionPayload.d.ts +2 -2
- package/lib/block/processParentExecutionPayload.d.ts.map +1 -1
- package/lib/block/processParentExecutionPayload.js +16 -8
- package/lib/block/processParentExecutionPayload.js.map +1 -1
- package/lib/block/processProposerSlashing.d.ts.map +1 -1
- package/lib/block/processProposerSlashing.js +9 -1
- package/lib/block/processProposerSlashing.js.map +1 -1
- package/lib/block/processVoluntaryExit.d.ts +1 -1
- package/lib/block/processVoluntaryExit.d.ts.map +1 -1
- package/lib/block/processVoluntaryExit.js +1 -35
- package/lib/block/processVoluntaryExit.js.map +1 -1
- package/lib/slot/upgradeStateToGloas.js +34 -28
- package/lib/slot/upgradeStateToGloas.js.map +1 -1
- package/lib/stateView/beaconStateView.d.ts +1 -1
- package/lib/stateView/beaconStateView.d.ts.map +1 -1
- package/lib/stateView/beaconStateView.js.map +1 -1
- package/lib/stateView/interface.d.ts +1 -1
- package/lib/stateView/interface.d.ts.map +1 -1
- package/lib/stateView/nativeBeaconStateView.d.ts +1 -1
- package/lib/stateView/nativeBeaconStateView.d.ts.map +1 -1
- package/lib/stateView/nativeBeaconStateView.js.map +1 -1
- package/lib/util/gloas.d.ts +17 -0
- package/lib/util/gloas.d.ts.map +1 -1
- package/lib/util/gloas.js +59 -1
- package/lib/util/gloas.js.map +1 -1
- package/package.json +7 -7
- package/src/block/index.ts +6 -1
- package/src/block/processBuilderDepositRequest.ts +43 -0
- package/src/block/processBuilderExitRequest.ts +39 -0
- package/src/block/processDepositRequest.ts +3 -124
- package/src/block/processExecutionPayloadBid.ts +24 -9
- package/src/block/processParentExecutionPayload.ts +23 -11
- package/src/block/processProposerSlashing.ts +9 -4
- package/src/block/processVoluntaryExit.ts +2 -61
- package/src/slot/upgradeStateToGloas.ts +48 -32
- package/src/stateView/beaconStateView.ts +1 -1
- package/src/stateView/interface.ts +1 -1
- package/src/stateView/nativeBeaconStateView.ts +1 -1
- package/src/util/gloas.ts +76 -1
package/lib/block/index.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ export { processBlockHeader, processExecutionPayload, processRandao, processEth1
|
|
|
17
17
|
export * from "./externalData.js";
|
|
18
18
|
export * from "./initiateValidatorExit.js";
|
|
19
19
|
export * from "./isValidIndexedAttestation.js";
|
|
20
|
+
export * from "./processBuilderDepositRequest.js";
|
|
21
|
+
export * from "./processBuilderExitRequest.js";
|
|
20
22
|
export * from "./processDepositRequest.js";
|
|
21
23
|
export * from "./processOperations.js";
|
|
22
24
|
export declare function processBlock(fork: ForkSeq, state: CachedBeaconStateAllForks, block: BeaconBlock | BlindedBeaconBlock, externalData: BlockExternalData & ProcessBlockOpts, opts?: ProcessBlockOpts, metrics?: BeaconStateTransitionMetrics | null): void;
|
package/lib/block/index.d.ts.map
CHANGED
|
@@ -1 +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,CAAC;AAClC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mCAAmC,CAAC;AAClD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AAEvC,wBAAgB,YAAY,CAC1B,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,yBAAyB,EAChC,KAAK,EAAE,WAAW,GAAG,kBAAkB,EACvC,YAAY,EAAE,iBAAiB,GAAG,gBAAgB,EAClD,IAAI,CAAC,EAAE,gBAAgB,EACvB,OAAO,CAAC,EAAE,4BAA4B,GAAG,IAAI,GAC5C,IAAI,CA+DN"}
|
package/lib/block/index.js
CHANGED
|
@@ -18,6 +18,8 @@ export { processBlockHeader, processExecutionPayload, processRandao, processEth1
|
|
|
18
18
|
export * from "./externalData.js";
|
|
19
19
|
export * from "./initiateValidatorExit.js";
|
|
20
20
|
export * from "./isValidIndexedAttestation.js";
|
|
21
|
+
export * from "./processBuilderDepositRequest.js";
|
|
22
|
+
export * from "./processBuilderExitRequest.js";
|
|
21
23
|
export * from "./processDepositRequest.js";
|
|
22
24
|
export * from "./processOperations.js";
|
|
23
25
|
export function processBlock(fork, state, block, externalData, opts, metrics) {
|
|
@@ -47,7 +49,7 @@ export function processBlock(fork, state, block, externalData, opts, metrics) {
|
|
|
47
49
|
processExecutionPayload(fork, state, block.body, externalData);
|
|
48
50
|
}
|
|
49
51
|
if (fork >= ForkSeq.gloas) {
|
|
50
|
-
processExecutionPayloadBid(state, block);
|
|
52
|
+
processExecutionPayloadBid(state, block.body.signedExecutionPayloadBid);
|
|
51
53
|
}
|
|
52
54
|
processRandao(state, block, verifySignatures);
|
|
53
55
|
processEth1Data(state, block.body.eth1Data);
|
package/lib/block/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/block/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,OAAO,E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AC;IAC7E,CAAC;IAED,IAAI,IAAI,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QAC1B,yBAAyB,CAAC,YAAY,CAAC,CAAC;QACxC,2EAA2E;QAC3E,+BAA+B;QAC/B,IAAI,YAAY,CAAC,sBAAsB,KAAK,sBAAsB,CAAC,OAAO,EAAE,CAAC;YAC3E,MAAM,KAAK,CAAC,gCAAgC,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;IAED,MAAM,OAAO,GAAG,KAAK,CAAC,eAAe,CAAC;IACtC,OAAO,EAAE,eAAe,CAAC,GAAG,CAAC,EAAC,IAAI,EAAE,kBAAkB,CAAC,WAAW,EAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAC3F,OAAO,EAAE,eAAe,CAAC,GAAG,CAAC,EAAC,IAAI,EAAE,kBAAkB,CAAC,aAAa,EAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IAC9F,OAAO,EAAE,eAAe,CAAC,GAAG,CAAC,EAAC,IAAI,EAAE,kBAAkB,CAAC,QAAQ,EAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;AAAA,CACrF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { gloas } from "@lodestar/types";
|
|
2
|
+
import { CachedBeaconStateGloas } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Process a builder deposit request from the execution layer: register a new builder
|
|
5
|
+
* (proof-of-possession gated) or top up an existing builder's balance.
|
|
6
|
+
*
|
|
7
|
+
* Spec: https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.11/specs/gloas/beacon-chain.md#new-process_builder_deposit_request
|
|
8
|
+
*/
|
|
9
|
+
export declare function processBuilderDepositRequest(state: CachedBeaconStateGloas, request: gloas.BuilderDepositRequest): void;
|
|
10
|
+
//# sourceMappingURL=processBuilderDepositRequest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processBuilderDepositRequest.d.ts","sourceRoot":"","sources":["../../src/block/processBuilderDepositRequest.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,KAAK,EAAC,MAAM,iBAAiB,CAAC;AACtC,OAAO,EAAC,sBAAsB,EAAC,MAAM,aAAa,CAAC;AAInD;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,sBAAsB,EAC7B,OAAO,EAAE,KAAK,CAAC,qBAAqB,GACnC,IAAI,CA2BN"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { FAR_FUTURE_EPOCH } from "@lodestar/params";
|
|
2
|
+
import { computeEpochAtSlot } from "../util/epoch.js";
|
|
3
|
+
import { addBuilderToRegistry, findBuilderIndexByPubkey, isValidBuilderDepositSignature } from "../util/gloas.js";
|
|
4
|
+
/**
|
|
5
|
+
* Process a builder deposit request from the execution layer: register a new builder
|
|
6
|
+
* (proof-of-possession gated) or top up an existing builder's balance.
|
|
7
|
+
*
|
|
8
|
+
* Spec: https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.11/specs/gloas/beacon-chain.md#new-process_builder_deposit_request
|
|
9
|
+
*/
|
|
10
|
+
export function processBuilderDepositRequest(state, request) {
|
|
11
|
+
const { pubkey, withdrawalCredentials, amount, signature } = request;
|
|
12
|
+
const builderIndex = findBuilderIndexByPubkey(state, pubkey);
|
|
13
|
+
if (builderIndex === null) {
|
|
14
|
+
if (isValidBuilderDepositSignature(state.config, pubkey, withdrawalCredentials, amount, signature)) {
|
|
15
|
+
addBuilderToRegistry(state, pubkey, withdrawalCredentials[0], withdrawalCredentials.subarray(12), amount, state.slot);
|
|
16
|
+
}
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const builder = state.builders.get(builderIndex);
|
|
20
|
+
// Increase balance by deposit amount
|
|
21
|
+
builder.balance += amount;
|
|
22
|
+
// If exited, reset the withdrawable epoch
|
|
23
|
+
if (builder.withdrawableEpoch !== FAR_FUTURE_EPOCH) {
|
|
24
|
+
builder.withdrawableEpoch = computeEpochAtSlot(state.slot) + state.config.MIN_BUILDER_WITHDRAWABILITY_DELAY;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=processBuilderDepositRequest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processBuilderDepositRequest.js","sourceRoot":"","sources":["../../src/block/processBuilderDepositRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAGlD,OAAO,EAAC,kBAAkB,EAAC,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAC,oBAAoB,EAAE,wBAAwB,EAAE,8BAA8B,EAAC,MAAM,kBAAkB,CAAC;AAEhH;;;;;GAKG;AACH,MAAM,UAAU,4BAA4B,CAC1C,KAA6B,EAC7B,OAAoC,EAC9B;IACN,MAAM,EAAC,MAAM,EAAE,qBAAqB,EAAE,MAAM,EAAE,SAAS,EAAC,GAAG,OAAO,CAAC;IACnE,MAAM,YAAY,GAAG,wBAAwB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAE7D,IAAI,YAAY,KAAK,IAAI,EAAE,CAAC;QAC1B,IAAI,8BAA8B,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,qBAAqB,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,CAAC;YACnG,oBAAoB,CAClB,KAAK,EACL,MAAM,EACN,qBAAqB,CAAC,CAAC,CAAC,EACxB,qBAAqB,CAAC,QAAQ,CAAC,EAAE,CAAC,EAClC,MAAM,EACN,KAAK,CAAC,IAAI,CACX,CAAC;QACJ,CAAC;QACD,OAAO;IACT,CAAC;IAED,MAAM,OAAO,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IAEjD,qCAAqC;IACrC,OAAO,CAAC,OAAO,IAAI,MAAM,CAAC;IAE1B,0CAA0C;IAC1C,IAAI,OAAO,CAAC,iBAAiB,KAAK,gBAAgB,EAAE,CAAC;QACnD,OAAO,CAAC,iBAAiB,GAAG,kBAAkB,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,iCAAiC,CAAC;IAC9G,CAAC;AAAA,CACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { gloas } from "@lodestar/types";
|
|
2
|
+
import { CachedBeaconStateGloas } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Apply a builder exit request. Authorizes the exit via `source_address` (the builder's
|
|
5
|
+
* execution_address), not the BLS key — mirroring EIP-7002's 0x01 credential exit.
|
|
6
|
+
*
|
|
7
|
+
* Drops the request silently if any precondition fails; the EL has already dequeued it
|
|
8
|
+
* deterministically, so the fee is forfeited but `requests_hash` agreement is unaffected.
|
|
9
|
+
*
|
|
10
|
+
* Spec: https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.11/specs/gloas/beacon-chain.md#new-process_builder_exit_request
|
|
11
|
+
*/
|
|
12
|
+
export declare function processBuilderExitRequest(state: CachedBeaconStateGloas, request: gloas.BuilderExitRequest): void;
|
|
13
|
+
//# sourceMappingURL=processBuilderExitRequest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processBuilderExitRequest.d.ts","sourceRoot":"","sources":["../../src/block/processBuilderExitRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,iBAAiB,CAAC;AAEtC,OAAO,EAAC,sBAAsB,EAAC,MAAM,aAAa,CAAC;AAQnD;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,sBAAsB,EAAE,OAAO,EAAE,KAAK,CAAC,kBAAkB,GAAG,IAAI,CAmBhH"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { byteArrayEquals } from "@lodestar/utils";
|
|
2
|
+
import { findBuilderIndexByPubkey, getPendingBalanceToWithdrawForBuilder, initiateBuilderExit, isActiveBuilder, } from "../util/gloas.js";
|
|
3
|
+
/**
|
|
4
|
+
* Apply a builder exit request. Authorizes the exit via `source_address` (the builder's
|
|
5
|
+
* execution_address), not the BLS key — mirroring EIP-7002's 0x01 credential exit.
|
|
6
|
+
*
|
|
7
|
+
* Drops the request silently if any precondition fails; the EL has already dequeued it
|
|
8
|
+
* deterministically, so the fee is forfeited but `requests_hash` agreement is unaffected.
|
|
9
|
+
*
|
|
10
|
+
* Spec: https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.11/specs/gloas/beacon-chain.md#new-process_builder_exit_request
|
|
11
|
+
*/
|
|
12
|
+
export function processBuilderExitRequest(state, request) {
|
|
13
|
+
const builderIndex = findBuilderIndexByPubkey(state, request.pubkey);
|
|
14
|
+
if (builderIndex === null) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const builder = state.builders.getReadonly(builderIndex);
|
|
18
|
+
if (!isActiveBuilder(builder, state.finalizedCheckpoint.epoch)) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (!byteArrayEquals(builder.executionAddress, request.sourceAddress)) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
if (getPendingBalanceToWithdrawForBuilder(state, builderIndex) !== 0) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
initiateBuilderExit(state, builderIndex);
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=processBuilderExitRequest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processBuilderExitRequest.js","sourceRoot":"","sources":["../../src/block/processBuilderExitRequest.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EACL,wBAAwB,EACxB,qCAAqC,EACrC,mBAAmB,EACnB,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAE1B;;;;;;;;GAQG;AACH,MAAM,UAAU,yBAAyB,CAAC,KAA6B,EAAE,OAAiC,EAAQ;IAChH,MAAM,YAAY,GAAG,wBAAwB,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACrE,IAAI,YAAY,KAAK,IAAI,EAAE,CAAC;QAC1B,OAAO;IACT,CAAC;IAED,MAAM,OAAO,GAAG,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;IAEzD,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,KAAK,CAAC,mBAAmB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/D,OAAO;IACT,CAAC;IACD,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,gBAAgB,EAAE,OAAO,CAAC,aAAa,CAAC,EAAE,CAAC;QACtE,OAAO;IACT,CAAC;IACD,IAAI,qCAAqC,CAAC,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;QACrE,OAAO;IACT,CAAC;IAED,mBAAmB,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;AAAA,CAC1C"}
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import { ForkSeq } from "@lodestar/params";
|
|
2
|
-
import {
|
|
2
|
+
import { electra } from "@lodestar/types";
|
|
3
3
|
import { CachedBeaconStateElectra, CachedBeaconStateGloas } from "../types.js";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Apply a deposit for a builder. Either increases balance for existing builder or adds new builder to registry.
|
|
7
|
-
* Spec: https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.1/specs/gloas/beacon-chain.md#new-apply_deposit_for_builder
|
|
8
|
-
*/
|
|
9
|
-
export declare function applyDepositForBuilder(state: CachedBeaconStateGloas, pubkey: BLSPubkey, withdrawalCredentials: Bytes32, amount: UintNum64, signature: Bytes32, slot: UintNum64): void;
|
|
10
|
-
export declare function processDepositRequest(fork: ForkSeq, state: CachedBeaconStateElectra | CachedBeaconStateGloas, depositRequest: electra.DepositRequest, pendingDepositsLookup?: PendingDepositsLookup): void;
|
|
4
|
+
export declare function processDepositRequest(fork: ForkSeq, state: CachedBeaconStateElectra | CachedBeaconStateGloas, depositRequest: electra.DepositRequest): void;
|
|
11
5
|
//# sourceMappingURL=processDepositRequest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processDepositRequest.d.ts","sourceRoot":"","sources":["../../src/block/processDepositRequest.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"processDepositRequest.d.ts","sourceRoot":"","sources":["../../src/block/processDepositRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAqC,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAC,OAAO,EAAM,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAC,wBAAwB,EAAE,sBAAsB,EAAC,MAAM,aAAa,CAAC;AAE7E,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,wBAAwB,GAAG,sBAAsB,EACxD,cAAc,EAAE,OAAO,CAAC,cAAc,GACrC,IAAI,CAgBN"}
|
|
@@ -1,103 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ForkSeq, UNSET_DEPOSIT_REQUESTS_START_INDEX } from "@lodestar/params";
|
|
2
2
|
import { ssz } from "@lodestar/types";
|
|
3
|
-
|
|
4
|
-
import { findBuilderIndexByPubkey, isBuilderWithdrawalCredential } from "../util/gloas.js";
|
|
5
|
-
import { computeEpochAtSlot, isValidatorKnown } from "../util/index.js";
|
|
6
|
-
import { PendingDepositsLookup } from "../util/pendingDepositsLookup.js";
|
|
7
|
-
import { isValidDepositSignature } from "./processDeposit.js";
|
|
8
|
-
/**
|
|
9
|
-
* Apply a deposit for a builder. Either increases balance for existing builder or adds new builder to registry.
|
|
10
|
-
* Spec: https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.1/specs/gloas/beacon-chain.md#new-apply_deposit_for_builder
|
|
11
|
-
*/
|
|
12
|
-
export function applyDepositForBuilder(state, pubkey, withdrawalCredentials, amount, signature, slot) {
|
|
13
|
-
const builderIndex = findBuilderIndexByPubkey(state, pubkey);
|
|
14
|
-
if (builderIndex !== null) {
|
|
15
|
-
// Existing builder - increase balance
|
|
16
|
-
const builder = state.builders.get(builderIndex);
|
|
17
|
-
builder.balance += amount;
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
// New builder - verify signature and add to registry
|
|
21
|
-
if (isValidDepositSignature(state.config, pubkey, withdrawalCredentials, amount, signature)) {
|
|
22
|
-
addBuilderToRegistry(state, pubkey, withdrawalCredentials, amount, slot);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Add a new builder to the builders registry.
|
|
28
|
-
* Reuses slots from exited and fully withdrawn builders if available.
|
|
29
|
-
*/
|
|
30
|
-
function addBuilderToRegistry(state, pubkey, withdrawalCredentials, amount, slot) {
|
|
31
|
-
const currentEpoch = computeEpochAtSlot(state.slot);
|
|
32
|
-
const depositEpoch = computeEpochAtSlot(slot);
|
|
33
|
-
// Try to find a reusable slot from an exited builder with zero balance
|
|
34
|
-
let builderIndex = state.builders.length;
|
|
35
|
-
for (let i = 0; i < state.builders.length; i++) {
|
|
36
|
-
const builder = state.builders.getReadonly(i);
|
|
37
|
-
if (builder.withdrawableEpoch <= currentEpoch && builder.balance === 0) {
|
|
38
|
-
builderIndex = i;
|
|
39
|
-
break;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
// Create new builder
|
|
43
|
-
const newBuilder = ssz.gloas.Builder.toViewDU({
|
|
44
|
-
pubkey,
|
|
45
|
-
version: withdrawalCredentials[0],
|
|
46
|
-
executionAddress: withdrawalCredentials.subarray(12),
|
|
47
|
-
balance: amount,
|
|
48
|
-
depositEpoch: depositEpoch,
|
|
49
|
-
withdrawableEpoch: FAR_FUTURE_EPOCH,
|
|
50
|
-
});
|
|
51
|
-
if (builderIndex < state.builders.length) {
|
|
52
|
-
// Reuse existing slot
|
|
53
|
-
state.builders.set(builderIndex, newBuilder);
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
// Append to end
|
|
57
|
-
state.builders.push(newBuilder);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
// TODO GLOAS: the PendingDepositsLookup is currently scoped to a single envelope of
|
|
61
|
-
// deposit-requests. We can track it as ephemeral within EpochCache and transfer to the next block
|
|
62
|
-
// transition to reuse cached signature verifications.
|
|
63
|
-
// See https://github.com/ChainSafe/lodestar/issues/9181
|
|
64
|
-
export function processDepositRequest(fork, state, depositRequest, pendingDepositsLookup) {
|
|
3
|
+
export function processDepositRequest(fork, state, depositRequest) {
|
|
65
4
|
const { pubkey, withdrawalCredentials, amount, signature } = depositRequest;
|
|
66
|
-
if (fork >= ForkSeq.gloas) {
|
|
67
|
-
const stateGloas = state;
|
|
68
|
-
const lookup = pendingDepositsLookup ?? PendingDepositsLookup.build(stateGloas);
|
|
69
|
-
const pubkeyHex = toPubkeyHex(pubkey);
|
|
70
|
-
const builderIndex = findBuilderIndexByPubkey(stateGloas, pubkey);
|
|
71
|
-
const validatorIndex = state.epochCtx.getValidatorIndex(pubkey);
|
|
72
|
-
const isBuilder = builderIndex !== null;
|
|
73
|
-
const isValidator = isValidatorKnown(state, validatorIndex);
|
|
74
|
-
if (isBuilder) {
|
|
75
|
-
// Top up an existing builder regardless of withdrawal credential prefix
|
|
76
|
-
applyDepositForBuilder(stateGloas, pubkey, withdrawalCredentials, amount, signature, state.slot);
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
// Only check the (expensive) "pending validator" condition when needed
|
|
80
|
-
if (isBuilderWithdrawalCredential(withdrawalCredentials) &&
|
|
81
|
-
!isValidator &&
|
|
82
|
-
!lookup.hasPendingValidator(state.config, pubkeyHex)) {
|
|
83
|
-
applyDepositForBuilder(stateGloas, pubkey, withdrawalCredentials, amount, signature, state.slot);
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
const pendingDeposit = ssz.electra.PendingDeposit.toViewDU({
|
|
87
|
-
pubkey,
|
|
88
|
-
withdrawalCredentials,
|
|
89
|
-
amount,
|
|
90
|
-
signature,
|
|
91
|
-
slot: state.slot,
|
|
92
|
-
});
|
|
93
|
-
// Keep the lookup in sync with state.pendingDeposits so later deposit-requests
|
|
94
|
-
// in the same envelope see this deposit
|
|
95
|
-
lookup.add(pendingDeposit, pubkeyHex);
|
|
96
|
-
state.pendingDeposits.push(pendingDeposit);
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
// Pre-Gloas (Electra) path
|
|
100
|
-
// depositRequestsStartIndex is only set in Electra, from Fulu the eth1 bridge deposit mechanism was removed.
|
|
101
5
|
if (fork === ForkSeq.electra && state.depositRequestsStartIndex === UNSET_DEPOSIT_REQUESTS_START_INDEX) {
|
|
102
6
|
state.depositRequestsStartIndex = depositRequest.index;
|
|
103
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processDepositRequest.js","sourceRoot":"","sources":["../../src/block/processDepositRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"processDepositRequest.js","sourceRoot":"","sources":["../../src/block/processDepositRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,kCAAkC,EAAC,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAU,GAAG,EAAC,MAAM,iBAAiB,CAAC;AAG7C,MAAM,UAAU,qBAAqB,CACnC,IAAa,EACb,KAAwD,EACxD,cAAsC,EAChC;IACN,MAAM,EAAC,MAAM,EAAE,qBAAqB,EAAE,MAAM,EAAE,SAAS,EAAC,GAAG,cAAc,CAAC;IAE1E,IAAI,IAAI,KAAK,OAAO,CAAC,OAAO,IAAI,KAAK,CAAC,yBAAyB,KAAK,kCAAkC,EAAE,CAAC;QACvG,KAAK,CAAC,yBAAyB,GAAG,cAAc,CAAC,KAAK,CAAC;IACzD,CAAC;IAED,sCAAsC;IACtC,MAAM,cAAc,GAAG,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,QAAQ,CAAC;QACzD,MAAM;QACN,qBAAqB;QACrB,MAAM;QACN,SAAS;QACT,IAAI,EAAE,KAAK,CAAC,IAAI;KACjB,CAAC,CAAC;IACH,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;AAAA,CAC5C"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { BeaconBlock } from "@lodestar/types";
|
|
1
|
+
import { gloas } from "@lodestar/types";
|
|
3
2
|
import { CachedBeaconStateGloas } from "../types.js";
|
|
4
|
-
export declare function processExecutionPayloadBid(state: CachedBeaconStateGloas,
|
|
3
|
+
export declare function processExecutionPayloadBid(state: CachedBeaconStateGloas, signedBid: gloas.SignedExecutionPayloadBid): void;
|
|
5
4
|
//# sourceMappingURL=processExecutionPayloadBid.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processExecutionPayloadBid.d.ts","sourceRoot":"","sources":["../../src/block/processExecutionPayloadBid.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"processExecutionPayloadBid.d.ts","sourceRoot":"","sources":["../../src/block/processExecutionPayloadBid.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,KAAK,EAAM,MAAM,iBAAiB,CAAC;AAI3C,OAAO,EAAC,sBAAsB,EAAC,MAAM,aAAa,CAAC;AAInD,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,sBAAsB,EAC7B,SAAS,EAAE,KAAK,CAAC,yBAAyB,GACzC,IAAI,CAyFN"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { PublicKey, Signature, verify } from "@chainsafe/blst";
|
|
2
|
-
import { BUILDER_INDEX_SELF_BUILD, SLOTS_PER_EPOCH } from "@lodestar/params";
|
|
2
|
+
import { BUILDER_INDEX_SELF_BUILD, GENESIS_SLOT, PAYLOAD_BUILDER_VERSION, SLOTS_PER_EPOCH } from "@lodestar/params";
|
|
3
3
|
import { ssz } from "@lodestar/types";
|
|
4
4
|
import { byteArrayEquals, toHex, toRootHex } from "@lodestar/utils";
|
|
5
5
|
import { G2_POINT_AT_INFINITY } from "../constants/constants.js";
|
|
6
6
|
import { getExecutionPayloadBidSigningRoot } from "../signatureSets/executionPayloadBid.js";
|
|
7
7
|
import { canBuilderCoverBid, isActiveBuilder } from "../util/gloas.js";
|
|
8
|
-
import { getCurrentEpoch, getRandaoMix } from "../util/index.js";
|
|
9
|
-
export function processExecutionPayloadBid(state,
|
|
10
|
-
const signedBid = block.body.signedExecutionPayloadBid;
|
|
8
|
+
import { getBlockRootAtSlot, getCurrentEpoch, getRandaoMix } from "../util/index.js";
|
|
9
|
+
export function processExecutionPayloadBid(state, signedBid) {
|
|
11
10
|
const bid = signedBid.message;
|
|
12
11
|
const { builderIndex, value: amount } = bid;
|
|
13
12
|
// For self-builds, amount must be zero regardless of withdrawal credential prefix
|
|
@@ -26,6 +25,10 @@ export function processExecutionPayloadBid(state, block) {
|
|
|
26
25
|
if (!isActiveBuilder(builder, state.finalizedCheckpoint.epoch)) {
|
|
27
26
|
throw Error(`Invalid execution payload bid: builder ${builderIndex} is not active`);
|
|
28
27
|
}
|
|
28
|
+
// Verify that the builder is a payload builder
|
|
29
|
+
if (builder.version !== PAYLOAD_BUILDER_VERSION) {
|
|
30
|
+
throw Error(`Invalid execution payload bid: builder ${builderIndex} version ${builder.version} != ${PAYLOAD_BUILDER_VERSION}`);
|
|
31
|
+
}
|
|
29
32
|
// Verify that the builder has funds to cover the bid
|
|
30
33
|
if (!canBuilderCoverBid(state, builderIndex, amount)) {
|
|
31
34
|
throw Error(`Invalid execution payload bid: builder ${builderIndex} has insufficient balance`);
|
|
@@ -35,14 +38,18 @@ export function processExecutionPayloadBid(state, block) {
|
|
|
35
38
|
throw Error(`Invalid execution payload bid: invalid signature for builder ${builderIndex}`);
|
|
36
39
|
}
|
|
37
40
|
}
|
|
38
|
-
if (bid.slot !==
|
|
39
|
-
throw Error(`Bid slot ${bid.slot} does not match
|
|
41
|
+
if (bid.slot !== state.slot) {
|
|
42
|
+
throw Error(`Bid slot ${bid.slot} does not match state slot ${state.slot}`);
|
|
43
|
+
}
|
|
44
|
+
if (state.slot <= GENESIS_SLOT) {
|
|
45
|
+
throw Error(`Execution payload bid not allowed at genesis slot ${state.slot}`);
|
|
40
46
|
}
|
|
41
47
|
if (!byteArrayEquals(bid.parentBlockHash, state.latestBlockHash)) {
|
|
42
48
|
throw Error(`Parent block hash ${toRootHex(bid.parentBlockHash)} of bid does not match state's latest block hash ${toRootHex(state.latestBlockHash)}`);
|
|
43
49
|
}
|
|
44
|
-
|
|
45
|
-
|
|
50
|
+
const parentBlockRoot = getBlockRootAtSlot(state, state.slot - 1);
|
|
51
|
+
if (!byteArrayEquals(bid.parentBlockRoot, parentBlockRoot)) {
|
|
52
|
+
throw Error(`Parent block root ${toRootHex(bid.parentBlockRoot)} of bid does not match state's parent block root ${toRootHex(parentBlockRoot)}`);
|
|
46
53
|
}
|
|
47
54
|
const stateRandao = getRandaoMix(state, getCurrentEpoch(state));
|
|
48
55
|
if (!byteArrayEquals(bid.prevRandao, stateRandao)) {
|
|
@@ -61,6 +68,7 @@ export function processExecutionPayloadBid(state, block) {
|
|
|
61
68
|
amount,
|
|
62
69
|
builderIndex,
|
|
63
70
|
}),
|
|
71
|
+
proposerIndex: state.epochCtx.getBeaconProposer(state.slot),
|
|
64
72
|
});
|
|
65
73
|
state.builderPendingPayments.set(SLOTS_PER_EPOCH + (bid.slot % SLOTS_PER_EPOCH), pendingPaymentView);
|
|
66
74
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processExecutionPayloadBid.js","sourceRoot":"","sources":["../../src/block/processExecutionPayloadBid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,SAAS,EAAE,MAAM,EAAC,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAC,wBAAwB,
|
|
1
|
+
{"version":3,"file":"process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iB,CAAC,KAAK,CAAC,IAAI,CAAC;SAC5D,CAAC,CAAC;QAEH,KAAK,CAAC,sBAAsB,CAAC,GAAG,CAAC,eAAe,GAAG,CAAC,GAAG,CAAC,IAAI,GAAG,eAAe,CAAC,EAAE,kBAAkB,CAAC,CAAC;IACvG,CAAC;IAED,KAAK,CAAC,yBAAyB,GAAG,GAAG,CAAC,KAAK,CAAC,mBAAmB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AAAA,CAC/E;AAED,SAAS,kCAAkC,CACzC,KAA6B,EAC7B,MAAkB,EAClB,SAA0C,EACjC;IACT,MAAM,WAAW,GAAG,iCAAiC,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;IAEnG,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAC9C,MAAM,SAAS,GAAG,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QAEjE,OAAO,MAAM,CAAC,WAAW,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;IACnD,CAAC;IAAC,OAAO,EAAE,EAAE,CAAC;QACZ,OAAO,KAAK,CAAC,CAAC,8FAA8F;IAC9G,CAAC;AAAA,CACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ForkPostGloas } from "@lodestar/params";
|
|
2
|
-
import { BeaconBlock,
|
|
2
|
+
import { BeaconBlock, gloas } from "@lodestar/types";
|
|
3
3
|
import { CachedBeaconStateGloas } from "../types.js";
|
|
4
4
|
/**
|
|
5
5
|
* Process parent execution payload effects as the first step of processBlock.
|
|
@@ -16,5 +16,5 @@ export declare function processParentExecutionPayload(state: CachedBeaconStateGl
|
|
|
16
16
|
*
|
|
17
17
|
* Spec: https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.6/specs/gloas/beacon-chain.md#new-apply_parent_execution_payload
|
|
18
18
|
*/
|
|
19
|
-
export declare function applyParentExecutionPayload(state: CachedBeaconStateGloas, requests:
|
|
19
|
+
export declare function applyParentExecutionPayload(state: CachedBeaconStateGloas, requests: gloas.ExecutionRequests): void;
|
|
20
20
|
//# sourceMappingURL=processParentExecutionPayload.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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"}
|
|
@@ -2,7 +2,8 @@ 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";
|
|
5
|
-
import {
|
|
5
|
+
import { processBuilderDepositRequest } from "./processBuilderDepositRequest.js";
|
|
6
|
+
import { processBuilderExitRequest } from "./processBuilderExitRequest.js";
|
|
6
7
|
import { processConsolidationRequest } from "./processConsolidationRequest.js";
|
|
7
8
|
import { processDepositRequest } from "./processDepositRequest.js";
|
|
8
9
|
import { processWithdrawalRequest } from "./processWithdrawalRequest.js";
|
|
@@ -22,7 +23,7 @@ export function processParentExecutionPayload(state, block) {
|
|
|
22
23
|
return;
|
|
23
24
|
}
|
|
24
25
|
// Parent was FULL -- verify the bid commitment and apply the payload
|
|
25
|
-
const requestsRoot = ssz.
|
|
26
|
+
const requestsRoot = ssz.gloas.ExecutionRequests.hashTreeRoot(requests);
|
|
26
27
|
if (!byteArrayEquals(requestsRoot, parentBid.executionRequestsRoot)) {
|
|
27
28
|
throw new Error(`Parent execution requests root mismatch actual=${toRootHex(requestsRoot)} expected=${toRootHex(parentBid.executionRequestsRoot)}`);
|
|
28
29
|
}
|
|
@@ -45,11 +46,8 @@ export function applyParentExecutionPayload(state, requests) {
|
|
|
45
46
|
const currentEpoch = computeEpochAtSlot(state.slot);
|
|
46
47
|
// Process execution requests from parent's payload. The execution
|
|
47
48
|
// requests are processed at state.slot (child's slot), not the parent's slot.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
for (const deposit of requests.deposits) {
|
|
51
|
-
processDepositRequest(fork, state, deposit, pendingDepositsLookup);
|
|
52
|
-
}
|
|
49
|
+
for (const deposit of requests.deposits) {
|
|
50
|
+
processDepositRequest(fork, state, deposit);
|
|
53
51
|
}
|
|
54
52
|
for (const withdrawal of requests.withdrawals) {
|
|
55
53
|
processWithdrawalRequest(fork, state, withdrawal);
|
|
@@ -57,6 +55,12 @@ export function applyParentExecutionPayload(state, requests) {
|
|
|
57
55
|
for (const consolidation of requests.consolidations) {
|
|
58
56
|
processConsolidationRequest(state, consolidation);
|
|
59
57
|
}
|
|
58
|
+
for (const builderDeposit of requests.builderDeposits) {
|
|
59
|
+
processBuilderDepositRequest(state, builderDeposit);
|
|
60
|
+
}
|
|
61
|
+
for (const builderExit of requests.builderExits) {
|
|
62
|
+
processBuilderExitRequest(state, builderExit);
|
|
63
|
+
}
|
|
60
64
|
// Settle the builder payment
|
|
61
65
|
if (parentEpoch === currentEpoch) {
|
|
62
66
|
settleBuilderPayment(state, SLOTS_PER_EPOCH + (parentSlot % SLOTS_PER_EPOCH));
|
|
@@ -94,7 +98,11 @@ function settleBuilderPayment(state, paymentIndex) {
|
|
|
94
98
|
state.builderPendingPayments.set(paymentIndex, ssz.gloas.BuilderPendingPayment.defaultViewDU());
|
|
95
99
|
}
|
|
96
100
|
function assertEmptyExecutionRequests(requests) {
|
|
97
|
-
if (requests.deposits.length !== 0 ||
|
|
101
|
+
if (requests.deposits.length !== 0 ||
|
|
102
|
+
requests.withdrawals.length !== 0 ||
|
|
103
|
+
requests.consolidations.length !== 0 ||
|
|
104
|
+
requests.builderDeposits.length !== 0 ||
|
|
105
|
+
requests.builderExits.length !== 0) {
|
|
98
106
|
throw new Error("Parent execution requests must be empty when parent block is EMPTY");
|
|
99
107
|
}
|
|
100
108
|
}
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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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AK,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;AAAA,CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processProposerSlashing.d.ts","sourceRoot":"","sources":["../../src/block/processProposerSlashing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAC,OAAO,EAAkB,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAC,IAAI,EAAE,MAAM,EAAM,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAC,WAAW,EAAC,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAC,yBAAyB,EAAyB,MAAM,aAAa,CAAC;AAK9E;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,yBAAyB,EAChC,gBAAgB,EAAE,MAAM,CAAC,gBAAgB,EACzC,gBAAgB,UAAO,GACtB,IAAI,
|
|
1
|
+
{"version":3,"file":"processProposerSlashing.d.ts","sourceRoot":"","sources":["../../src/block/processProposerSlashing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAC,OAAO,EAAkB,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAC,IAAI,EAAE,MAAM,EAAM,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAC,WAAW,EAAC,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAC,yBAAyB,EAAyB,MAAM,aAAa,CAAC;AAK9E;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,yBAAyB,EAChC,gBAAgB,EAAE,MAAM,CAAC,gBAAgB,EACzC,gBAAgB,UAAO,GACtB,IAAI,CAsCN;AAED,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,YAAY,EACpB,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,IAAI,EACf,gBAAgB,EAAE,MAAM,CAAC,gBAAgB,EACzC,QAAQ,EAAE,SAAS,EACnB,gBAAgB,UAAO,GACtB,IAAI,CAqCN"}
|
|
@@ -14,6 +14,10 @@ export function processProposerSlashing(fork, state, proposerSlashing, verifySig
|
|
|
14
14
|
const proposer = state.validators.getReadonly(proposerSlashing.signedHeader1.message.proposerIndex);
|
|
15
15
|
assertValidProposerSlashing(state.config, state.epochCtx.pubkeyCache, state.slot, proposerSlashing, proposer, verifySignatures);
|
|
16
16
|
if (fork >= ForkSeq.gloas) {
|
|
17
|
+
// Remove the BuilderPendingPayment corresponding to this proposal if it is still in the
|
|
18
|
+
// 2-epoch window. Only clear it when the slashed validator is the proposer associated with
|
|
19
|
+
// the payment; otherwise an unrelated same-slot equivocation could grief an honest proposer's
|
|
20
|
+
// payment.
|
|
17
21
|
const slot = Number(proposerSlashing.signedHeader1.message.slot);
|
|
18
22
|
const proposalEpoch = computeEpochAtSlot(slot);
|
|
19
23
|
const currentEpoch = state.epochCtx.epoch;
|
|
@@ -24,7 +28,11 @@ export function processProposerSlashing(fork, state, proposerSlashing, verifySig
|
|
|
24
28
|
? slot % SLOTS_PER_EPOCH
|
|
25
29
|
: undefined;
|
|
26
30
|
if (paymentIndex !== undefined) {
|
|
27
|
-
state.builderPendingPayments
|
|
31
|
+
const builderPendingPayments = state.builderPendingPayments;
|
|
32
|
+
const payment = builderPendingPayments.get(paymentIndex);
|
|
33
|
+
if (payment.proposerIndex === proposerSlashing.signedHeader1.message.proposerIndex) {
|
|
34
|
+
builderPendingPayments.set(paymentIndex, ssz.gloas.BuilderPendingPayment.defaultViewDU());
|
|
35
|
+
}
|
|
28
36
|
}
|
|
29
37
|
}
|
|
30
38
|
slashValidator(fork, state, proposerSlashing.signedHeader1.message.proposerIndex);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processProposerSlashing.js","sourceRoot":"","sources":["../../src/block/processProposerSlashing.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAE,eAAe,EAAC,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAe,GAAG,EAAC,MAAM,iBAAiB,CAAC;AAGlD,OAAO,EAAC,gCAAgC,EAAC,MAAM,2BAA2B,CAAC;AAE3E,OAAO,EAAC,kBAAkB,EAAE,oBAAoB,EAAC,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAAC,kBAAkB,EAAC,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAC,cAAc,EAAC,MAAM,qBAAqB,CAAC;AAEnD;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CACrC,IAAa,EACb,KAAgC,EAChC,gBAAyC,EACzC,gBAAgB,GAAG,IAAI,EACjB;IACN,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,gBAAgB,CAAC,aAAa,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IACpG,2BAA2B,CACzB,KAAK,CAAC,MAAM,EACZ,KAAK,CAAC,QAAQ,CAAC,WAAW,EAC1B,KAAK,CAAC,IAAI,EACV,gBAAgB,EAChB,QAAQ,EACR,gBAAgB,CACjB,CAAC;IAEF,IAAI,IAAI,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QAC1B,MAAM,IAAI,GAAG,MAAM,CAAC,gBAAgB,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACjE,MAAM,aAAa,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC;QAC/C,MAAM,YAAY,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC;QAC1C,MAA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{
|
|
|
11
11
|
invalidSignature = "invalid_signature"
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
|
-
* Process a VoluntaryExit operation. Initiates the exit of a validator
|
|
14
|
+
* Process a VoluntaryExit operation. Initiates the exit of a validator.
|
|
15
15
|
*
|
|
16
16
|
* PERF: Work depends on number of VoluntaryExit per block. On regular networks the average is 0 / block.
|
|
17
17
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processVoluntaryExit.d.ts","sourceRoot":"","sources":["../../src/block/processVoluntaryExit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,OAAO,EAAC,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAC,MAAM,EAAC,MAAM,iBAAiB,CAAC;AAGvC,OAAO,EAAC,yBAAyB,
|
|
1
|
+
{"version":3,"file":"processVoluntaryExit.d.ts","sourceRoot":"","sources":["../../src/block/processVoluntaryExit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,OAAO,EAAC,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAC,MAAM,EAAC,MAAM,iBAAiB,CAAC;AAGvC,OAAO,EAAC,yBAAyB,EAA2B,MAAM,aAAa,CAAC;AAIhF,oBAAY,qBAAqB;IAC/B,KAAK,UAAU;IACf,QAAQ,aAAa;IACrB,aAAa,mBAAmB;IAChC,UAAU,gBAAgB;IAC1B,eAAe,sBAAsB;IACrC,kBAAkB,wBAAwB;IAC1C,gBAAgB,sBAAsB;CACvC;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,yBAAyB,EAChC,mBAAmB,EAAE,MAAM,CAAC,mBAAmB,EAC/C,eAAe,UAAO,GACrB,IAAI,CAQN;AAED,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,yBAAyB,EAChC,mBAAmB,EAAE,MAAM,CAAC,mBAAmB,EAC/C,eAAe,UAAO,GACrB,qBAAqB,CAUvB;AAoDD,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,yBAAyB,EAChC,mBAAmB,EAAE,MAAM,CAAC,mBAAmB,EAC/C,eAAe,UAAO,GACrB,OAAO,CAET"}
|