@lodestar/state-transition 1.50.0-dev.5ad1067954 → 1.50.0-dev.6155cf7acc
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/processProposerSlashing.d.ts.map +1 -1
- package/lib/block/processProposerSlashing.js +0 -23
- package/lib/block/processProposerSlashing.js.map +1 -1
- package/lib/block/slashValidator.d.ts.map +1 -1
- package/lib/block/slashValidator.js +11 -0
- package/lib/block/slashValidator.js.map +1 -1
- package/lib/signatureSets/index.d.ts.map +1 -1
- package/lib/signatureSets/index.js +2 -2
- package/lib/signatureSets/index.js.map +1 -1
- package/lib/signatureSets/voluntaryExits.d.ts +2 -6
- package/lib/signatureSets/voluntaryExits.d.ts.map +1 -1
- package/lib/signatureSets/voluntaryExits.js +2 -32
- package/lib/signatureSets/voluntaryExits.js.map +1 -1
- package/package.json +8 -8
- package/src/block/processProposerSlashing.ts +2 -28
- package/src/block/slashValidator.ts +13 -2
- package/src/signatureSets/index.ts +4 -2
- package/src/signatureSets/voluntaryExits.ts +3 -55
|
@@ -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,
|
|
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,EAAC,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAC,IAAI,EAAE,MAAM,EAAM,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAC,yBAAyB,EAAC,MAAM,aAAa,CAAC;AAKtD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,yBAAyB,EAChC,gBAAgB,EAAE,MAAM,CAAC,gBAAgB,EACzC,gBAAgB,UAAO,GACtB,IAAI,CAKN;AAED,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,YAAY,EACpB,SAAS,EAAE,IAAI,EACf,gBAAgB,EAAE,MAAM,CAAC,gBAAgB,EACzC,QAAQ,EAAE,SAAS,EACnB,gBAAgB,UAAO,GACtB,IAAI,CAqCN"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ForkSeq, SLOTS_PER_EPOCH } from "@lodestar/params";
|
|
2
1
|
import { ssz } from "@lodestar/types";
|
|
3
2
|
import { getProposerSlashingSignatureSets } from "../signatureSets/index.js";
|
|
4
3
|
import { computeEpochAtSlot, isSlashableValidator } from "../util/index.js";
|
|
@@ -13,28 +12,6 @@ import { slashValidator } from "./slashValidator.js";
|
|
|
13
12
|
export function processProposerSlashing(fork, state, proposerSlashing, verifySignatures = true) {
|
|
14
13
|
const proposer = state.validators.getReadonly(proposerSlashing.signedHeader1.message.proposerIndex);
|
|
15
14
|
assertValidProposerSlashing(state.config, state.slot, proposerSlashing, proposer, verifySignatures);
|
|
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.
|
|
21
|
-
const slot = Number(proposerSlashing.signedHeader1.message.slot);
|
|
22
|
-
const proposalEpoch = computeEpochAtSlot(slot);
|
|
23
|
-
const currentEpoch = state.epochCtx.epoch;
|
|
24
|
-
const previousEpoch = currentEpoch - 1;
|
|
25
|
-
const paymentIndex = proposalEpoch === currentEpoch
|
|
26
|
-
? SLOTS_PER_EPOCH + (slot % SLOTS_PER_EPOCH)
|
|
27
|
-
: proposalEpoch === previousEpoch
|
|
28
|
-
? slot % SLOTS_PER_EPOCH
|
|
29
|
-
: undefined;
|
|
30
|
-
if (paymentIndex !== undefined) {
|
|
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
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
15
|
slashValidator(fork, state, proposerSlashing.signedHeader1.message.proposerIndex);
|
|
39
16
|
}
|
|
40
17
|
export function assertValidProposerSlashing(config, stateSlot, proposerSlashing, proposer, verifySignatures = true) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processProposerSlashing.js","sourceRoot":"","sources":["../../src/block/processProposerSlashing.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"processProposerSlashing.js","sourceRoot":"","sources":["../../src/block/processProposerSlashing.ts"],"names":[],"mappings":"AAEA,OAAO,EAAe,GAAG,EAAC,MAAM,iBAAiB,CAAC;AAElD,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;IAEvB,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,gBAAgB,CAAC,aAAa,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IACpG,2BAA2B,CAAC,KAAK,CAA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ACrB,MAAM,aAAa,GAAG,gCAAgC,CAAC,MAAM,EAAE,SAAS,EAAE,gBAAgB,CAAC,CAAC;QAC5F,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC9C,IAAI,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC1C,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;YACvE,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slashValidator.d.ts","sourceRoot":"","sources":["../../src/block/slashValidator.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,OAAO,EAWR,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAC,cAAc,
|
|
1
|
+
{"version":3,"file":"slashValidator.d.ts","sourceRoot":"","sources":["../../src/block/slashValidator.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,OAAO,EAWR,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAC,cAAc,EAAM,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAC,yBAAyB,EAAkD,MAAM,aAAa,CAAC;AAOvG,wBAAgB,cAAc,CAC5B,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,yBAAyB,EAChC,YAAY,EAAE,cAAc,EAC5B,kBAAkB,CAAC,EAAE,cAAc,GAClC,IAAI,CAgFN"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EFFECTIVE_BALANCE_INCREMENT, EPOCHS_PER_SLASHINGS_VECTOR, ForkSeq, MIN_SLASHING_PENALTY_QUOTIENT, MIN_SLASHING_PENALTY_QUOTIENT_ALTAIR, MIN_SLASHING_PENALTY_QUOTIENT_BELLATRIX, MIN_SLASHING_PENALTY_QUOTIENT_ELECTRA, PROPOSER_REWARD_QUOTIENT, PROPOSER_WEIGHT, TIMELY_TARGET_FLAG_INDEX, WEIGHT_DENOMINATOR, WHISTLEBLOWER_REWARD_QUOTIENT, WHISTLEBLOWER_REWARD_QUOTIENT_ELECTRA, } from "@lodestar/params";
|
|
2
|
+
import { ssz } from "@lodestar/types";
|
|
2
3
|
import { decreaseBalance, increaseBalance } from "../util/index.js";
|
|
3
4
|
import { initiateValidatorExit } from "./initiateValidatorExit.js";
|
|
4
5
|
/** Same to https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.5/specs/altair/beacon-chain.md#has_flag */
|
|
@@ -57,5 +58,15 @@ export function slashValidator(fork, state, slashedIndex, whistleblowerIndex) {
|
|
|
57
58
|
state.epochCtx.currentTargetUnslashedBalanceIncrements -= Math.floor(effectiveBalance / EFFECTIVE_BALANCE_INCREMENT);
|
|
58
59
|
}
|
|
59
60
|
}
|
|
61
|
+
if (fork >= ForkSeq.gloas) {
|
|
62
|
+
// Cleared on every slashing, not only proposer slashings: a proposer slashed via an attester slashing
|
|
63
|
+
// first would otherwise keep the builder paying for a block it equivocated on
|
|
64
|
+
const { builderPendingPayments } = state;
|
|
65
|
+
for (let i = 0; i < builderPendingPayments.length; i++) {
|
|
66
|
+
if (builderPendingPayments.getReadonly(i).proposerIndex === slashedIndex) {
|
|
67
|
+
builderPendingPayments.set(i, ssz.gloas.BuilderPendingPayment.defaultViewDU());
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
60
71
|
}
|
|
61
72
|
//# sourceMappingURL=slashValidator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slashValidator.js","sourceRoot":"","sources":["../../src/block/slashValidator.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC3B,OAAO,EACP,6BAA6B,EAC7B,oCAAoC,EACpC,uCAAuC,EACvC,qCAAqC,EACrC,wBAAwB,EACxB,eAAe,EACf,wBAAwB,EACxB,kBAAkB,EAClB,6BA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
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/signatureSets/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAC,kBAAkB,EAAE,iBAAiB,EAAyB,MAAM,iBAAiB,CAAC;AAE9F,OAAO,EAAC,kBAAkB,EAAC,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAC,gBAAgB,EAAwB,MAAM,2BAA2B,CAAC;AAClF,OAAO,EAAC,aAAa,EAA4C,MAAM,kBAAkB,CAAC;AAU1F,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC;AACxC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AAEpC;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,YAAY,EACpB,2BAA2B,EAAE,kBAAkB,EAC/C,KAAK,EAAE,gBAAgB,EACvB,WAAW,EAAE,iBAAiB,EAC9B,mBAAmB,EAAE,kBAAkB,EAAE,EACzC,IAAI,CAAC,EAAE;IACL,wFAAwF;IACxF,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC,GACA,aAAa,EAAE,CAwDjB"}
|
|
@@ -8,7 +8,7 @@ import { getPayloadAttestationDataSigningRoot } from "./indexedPayloadAttestatio
|
|
|
8
8
|
import { getBlockProposerSignatureSet } from "./proposer.js";
|
|
9
9
|
import { getProposerSlashingsSignatureSets } from "./proposerSlashings.js";
|
|
10
10
|
import { getRandaoRevealSignatureSet } from "./randao.js";
|
|
11
|
-
import {
|
|
11
|
+
import { getVoluntaryExitSignatureSet } from "./voluntaryExits.js";
|
|
12
12
|
export * from "./attesterSlashings.js";
|
|
13
13
|
export * from "./blsToExecutionChange.js";
|
|
14
14
|
export * from "./executionPayloadBid.js";
|
|
@@ -32,7 +32,7 @@ export function getBlockSignatureSets(config, currentSyncCommitteeIndexed, state
|
|
|
32
32
|
...getProposerSlashingsSignatureSets(config, signedBlock),
|
|
33
33
|
...getAttesterSlashingsSignatureSets(config, signedBlock),
|
|
34
34
|
...getAttestationsSignatureSets(config, signedBlock, indexedAttestations),
|
|
35
|
-
...
|
|
35
|
+
...signedBlock.message.body.voluntaryExits.map((voluntaryExit) => getVoluntaryExitSignatureSet(config, state, voluntaryExit)),
|
|
36
36
|
];
|
|
37
37
|
if (!opts?.skipProposerSignature) {
|
|
38
38
|
signatureSets.push(getBlockProposerSignatureSet(config, signedBlock));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/signatureSets/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAC,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAC,4BAA4B,EAAC,MAAM,kCAAkC,CAAC;AAG9E,OAAO,EAAgB,yCAAyC,EAAC,MAAM,kBAAkB,CAAC;AAC1F,OAAO,EAAC,iCAAiC,EAAC,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAC,oCAAoC,EAAC,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EAAC,4BAA4B,EAAC,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAC,oCAAoC,EAAC,MAAM,gCAAgC,CAAC;AACpF,OAAO,EAAC,4BAA4B,EAAC,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAC,iCAAiC,EAAC,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAC,2BAA2B,EAAC,MAAM,aAAa,CAAC;AACxD,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/signatureSets/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAC,MAAM,k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CAChB,yCAAyC,CACvC,kBAAkB,CAAC,eAAe,CAAC,eAAe,CAAC,GAAG,CAAC,EACvD,oCAAoC,CAAC,MAAM,EAAE,kBAAkB,CAAC,IAAI,CAAC,EACrE,kBAAkB,CAAC,SAAS,CAC7B,CACF,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,aAAa,CAAC;AACvB,CAAC"}
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import { BeaconConfig } from "@lodestar/config";
|
|
2
|
-
import {
|
|
3
|
-
import { IBeaconStateView
|
|
2
|
+
import { phase0 } from "@lodestar/types";
|
|
3
|
+
import { IBeaconStateView } from "../stateView/interface.js";
|
|
4
4
|
import { ISignatureSet } from "../util/index.js";
|
|
5
5
|
export declare function verifyVoluntaryExitSignature(config: BeaconConfig, state: IBeaconStateView, signedVoluntaryExit: phase0.SignedVoluntaryExit): boolean;
|
|
6
6
|
/**
|
|
7
7
|
* Extract signatures to allow validating all block signatures at once
|
|
8
8
|
*/
|
|
9
9
|
export declare function getVoluntaryExitSignatureSet(config: BeaconConfig, state: IBeaconStateView, signedVoluntaryExit: phase0.SignedVoluntaryExit): ISignatureSet;
|
|
10
|
-
export declare function getVoluntaryExitsSignatureSets(config: BeaconConfig, state: IBeaconStateView, signedBlock: SignedBeaconBlock): ISignatureSet[];
|
|
11
|
-
export declare function getValidatorVoluntaryExitSignatureSet(config: BeaconConfig, stateSlot: Slot, signedVoluntaryExit: phase0.SignedVoluntaryExit): ISignatureSet;
|
|
12
|
-
export declare function getBuilderVoluntaryExitSignatureSet(config: BeaconConfig, state: IBeaconStateViewGloas, signedVoluntaryExit: phase0.SignedVoluntaryExit): ISignatureSet;
|
|
13
|
-
export declare function isBuilderVoluntaryExit(signedVoluntaryExit: phase0.SignedVoluntaryExit): boolean;
|
|
14
10
|
//# sourceMappingURL=voluntaryExits.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"voluntaryExits.d.ts","sourceRoot":"","sources":["../../src/signatureSets/voluntaryExits.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"voluntaryExits.d.ts","sourceRoot":"","sources":["../../src/signatureSets/voluntaryExits.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAC,MAAM,EAAM,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAC,gBAAgB,EAAC,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EACL,aAAa,EAKd,MAAM,kBAAkB,CAAC;AAE1B,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,gBAAgB,EACvB,mBAAmB,EAAE,MAAM,CAAC,mBAAmB,GAC9C,OAAO,CAET;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,gBAAgB,EACvB,mBAAmB,EAAE,MAAM,CAAC,mBAAmB,GAC9C,aAAa,CAUf"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { ForkSeq } from "@lodestar/params";
|
|
2
1
|
import { ssz } from "@lodestar/types";
|
|
3
|
-
import {
|
|
4
|
-
import { SignatureSetType, computeSigningRoot, computeStartSlotAtEpoch, convertValidatorIndexToBuilderIndex, isBuilderIndex, verifySignatureSet, } from "../util/index.js";
|
|
2
|
+
import { SignatureSetType, computeSigningRoot, computeStartSlotAtEpoch, verifySignatureSet, } from "../util/index.js";
|
|
5
3
|
export function verifyVoluntaryExitSignature(config, state, signedVoluntaryExit) {
|
|
6
4
|
return verifySignatureSet(getVoluntaryExitSignatureSet(config, state, signedVoluntaryExit));
|
|
7
5
|
}
|
|
@@ -9,21 +7,8 @@ export function verifyVoluntaryExitSignature(config, state, signedVoluntaryExit)
|
|
|
9
7
|
* Extract signatures to allow validating all block signatures at once
|
|
10
8
|
*/
|
|
11
9
|
export function getVoluntaryExitSignatureSet(config, state, signedVoluntaryExit) {
|
|
12
|
-
const fork = config.getForkSeq(state.slot);
|
|
13
|
-
if (fork >= ForkSeq.gloas && isBuilderVoluntaryExit(signedVoluntaryExit)) {
|
|
14
|
-
if (!isStatePostGloas(state)) {
|
|
15
|
-
throw new Error(`Expected gloas+ state for builder voluntary exit signature, got fork=${state.forkName}`);
|
|
16
|
-
}
|
|
17
|
-
return getBuilderVoluntaryExitSignatureSet(config, state, signedVoluntaryExit);
|
|
18
|
-
}
|
|
19
|
-
return getValidatorVoluntaryExitSignatureSet(config, state.slot, signedVoluntaryExit);
|
|
20
|
-
}
|
|
21
|
-
export function getVoluntaryExitsSignatureSets(config, state, signedBlock) {
|
|
22
|
-
return signedBlock.message.body.voluntaryExits.map((voluntaryExit) => getVoluntaryExitSignatureSet(config, state, voluntaryExit));
|
|
23
|
-
}
|
|
24
|
-
export function getValidatorVoluntaryExitSignatureSet(config, stateSlot, signedVoluntaryExit) {
|
|
25
10
|
const messageSlot = computeStartSlotAtEpoch(signedVoluntaryExit.message.epoch);
|
|
26
|
-
const domain = config.getDomainForVoluntaryExit(
|
|
11
|
+
const domain = config.getDomainForVoluntaryExit(state.slot, messageSlot);
|
|
27
12
|
return {
|
|
28
13
|
type: SignatureSetType.indexed,
|
|
29
14
|
index: signedVoluntaryExit.message.validatorIndex,
|
|
@@ -31,19 +16,4 @@ export function getValidatorVoluntaryExitSignatureSet(config, stateSlot, signedV
|
|
|
31
16
|
signature: signedVoluntaryExit.signature,
|
|
32
17
|
};
|
|
33
18
|
}
|
|
34
|
-
export function getBuilderVoluntaryExitSignatureSet(config, state, signedVoluntaryExit) {
|
|
35
|
-
const messageSlot = computeStartSlotAtEpoch(signedVoluntaryExit.message.epoch);
|
|
36
|
-
const domain = config.getDomainForVoluntaryExit(state.slot, messageSlot);
|
|
37
|
-
const builderIndex = convertValidatorIndexToBuilderIndex(signedVoluntaryExit.message.validatorIndex);
|
|
38
|
-
const builder = state.getBuilder(builderIndex);
|
|
39
|
-
return {
|
|
40
|
-
type: SignatureSetType.single,
|
|
41
|
-
pubkey: builder.pubkey,
|
|
42
|
-
signingRoot: computeSigningRoot(ssz.phase0.VoluntaryExit, signedVoluntaryExit.message, domain),
|
|
43
|
-
signature: signedVoluntaryExit.signature,
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
export function isBuilderVoluntaryExit(signedVoluntaryExit) {
|
|
47
|
-
return isBuilderIndex(signedVoluntaryExit.message.validatorIndex);
|
|
48
|
-
}
|
|
49
19
|
//# sourceMappingURL=voluntaryExits.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"voluntaryExits.js","sourceRoot":"","sources":["../../src/signatureSets/voluntaryExits.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"voluntaryExits.js","sourceRoot":"","sources":["../../src/signatureSets/voluntaryExits.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,GAAG,EAAC,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAEL,gBAAgB,EAChB,kBAAkB,EAClB,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,UAAU,4BAA4B,CAC1C,MAAoB,EACpB,KAAuB,EACvB,mBAA+C;IAE/C,OAAO,kBAAkB,CAAC,4BAA4B,CAAC,MAAM,EAAE,KAAK,EAAE,mBAAmB,CAAC,CAAC,CAAC;AAC9F,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,4BAA4B,CAC1C,MAAoB,EACpB,KAAuB,EACvB,mBAA+C;IAE/C,MAAM,WAAW,GAAG,uBAAuB,CAAC,mBAAmB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC/E,MAAM,MAAM,GAAG,MAAM,CAAC,yBAAyB,CAAC,KAAK,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IAEzE,OAAO;QACL,IAAI,EAAE,gBAAgB,CAAC,OAAO;QAC9B,KAAK,EAAE,mBAAmB,CAAC,OAAO,CAAC,cAAc;QACjD,WAAW,EAAE,kBAAkB,CAAC,GAAG,CAAC,MAAM,CAAC,aAAa,EAAE,mBAAmB,CAAC,OAAO,EAAE,MAAM,CAAC;QAC9F,SAAS,EAAE,mBAAmB,CAAC,SAAS;KACzC,CAAC;AACJ,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.50.0-dev.
|
|
14
|
+
"version": "1.50.0-dev.6155cf7acc",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
@@ -68,15 +68,15 @@
|
|
|
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.8.
|
|
72
|
-
"@lodestar/config": "^1.50.0-dev.
|
|
73
|
-
"@lodestar/params": "^1.50.0-dev.
|
|
74
|
-
"@lodestar/types": "^1.50.0-dev.
|
|
75
|
-
"@lodestar/utils": "^1.50.0-dev.
|
|
71
|
+
"@chainsafe/ssz": "^1.8.1",
|
|
72
|
+
"@lodestar/config": "^1.50.0-dev.6155cf7acc",
|
|
73
|
+
"@lodestar/params": "^1.50.0-dev.6155cf7acc",
|
|
74
|
+
"@lodestar/types": "^1.50.0-dev.6155cf7acc",
|
|
75
|
+
"@lodestar/utils": "^1.50.0-dev.6155cf7acc",
|
|
76
76
|
"@vekexasia/bigint-buffer2": "^1.1.1"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
|
-
"@lodestar/test-utils": "^1.50.0-dev.
|
|
79
|
+
"@lodestar/test-utils": "^1.50.0-dev.6155cf7acc"
|
|
80
80
|
},
|
|
81
81
|
"keywords": [
|
|
82
82
|
"ethereum",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"beacon",
|
|
85
85
|
"blockchain"
|
|
86
86
|
],
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "f3b1d06e36f4a9885fe92df882ba543a91b1ca0a"
|
|
88
88
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {BeaconConfig} from "@lodestar/config";
|
|
2
|
-
import {ForkSeq
|
|
2
|
+
import {ForkSeq} from "@lodestar/params";
|
|
3
3
|
import {Slot, phase0, ssz} from "@lodestar/types";
|
|
4
4
|
import {Validator} from "@lodestar/types/phase0";
|
|
5
5
|
import {getProposerSlashingSignatureSets} from "../signatureSets/index.js";
|
|
6
|
-
import {CachedBeaconStateAllForks
|
|
6
|
+
import {CachedBeaconStateAllForks} from "../types.js";
|
|
7
7
|
import {computeEpochAtSlot, isSlashableValidator} from "../util/index.js";
|
|
8
8
|
import {verifySignatureSet} from "../util/signatureSets.js";
|
|
9
9
|
import {slashValidator} from "./slashValidator.js";
|
|
@@ -23,32 +23,6 @@ export function processProposerSlashing(
|
|
|
23
23
|
const proposer = state.validators.getReadonly(proposerSlashing.signedHeader1.message.proposerIndex);
|
|
24
24
|
assertValidProposerSlashing(state.config, state.slot, proposerSlashing, proposer, verifySignatures);
|
|
25
25
|
|
|
26
|
-
if (fork >= ForkSeq.gloas) {
|
|
27
|
-
// Remove the BuilderPendingPayment corresponding to this proposal if it is still in the
|
|
28
|
-
// 2-epoch window. Only clear it when the slashed validator is the proposer associated with
|
|
29
|
-
// the payment; otherwise an unrelated same-slot equivocation could grief an honest proposer's
|
|
30
|
-
// payment.
|
|
31
|
-
const slot = Number(proposerSlashing.signedHeader1.message.slot);
|
|
32
|
-
const proposalEpoch = computeEpochAtSlot(slot);
|
|
33
|
-
const currentEpoch = state.epochCtx.epoch;
|
|
34
|
-
const previousEpoch = currentEpoch - 1;
|
|
35
|
-
|
|
36
|
-
const paymentIndex =
|
|
37
|
-
proposalEpoch === currentEpoch
|
|
38
|
-
? SLOTS_PER_EPOCH + (slot % SLOTS_PER_EPOCH)
|
|
39
|
-
: proposalEpoch === previousEpoch
|
|
40
|
-
? slot % SLOTS_PER_EPOCH
|
|
41
|
-
: undefined;
|
|
42
|
-
|
|
43
|
-
if (paymentIndex !== undefined) {
|
|
44
|
-
const builderPendingPayments = (state as CachedBeaconStateGloas).builderPendingPayments;
|
|
45
|
-
const payment = builderPendingPayments.get(paymentIndex);
|
|
46
|
-
if (payment.proposerIndex === proposerSlashing.signedHeader1.message.proposerIndex) {
|
|
47
|
-
builderPendingPayments.set(paymentIndex, ssz.gloas.BuilderPendingPayment.defaultViewDU());
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
26
|
slashValidator(fork, state, proposerSlashing.signedHeader1.message.proposerIndex);
|
|
53
27
|
}
|
|
54
28
|
|
|
@@ -13,8 +13,8 @@ import {
|
|
|
13
13
|
WHISTLEBLOWER_REWARD_QUOTIENT,
|
|
14
14
|
WHISTLEBLOWER_REWARD_QUOTIENT_ELECTRA,
|
|
15
15
|
} from "@lodestar/params";
|
|
16
|
-
import {ValidatorIndex} from "@lodestar/types";
|
|
17
|
-
import {CachedBeaconStateAllForks, CachedBeaconStateAltair} from "../types.js";
|
|
16
|
+
import {ValidatorIndex, ssz} from "@lodestar/types";
|
|
17
|
+
import {CachedBeaconStateAllForks, CachedBeaconStateAltair, CachedBeaconStateGloas} from "../types.js";
|
|
18
18
|
import {decreaseBalance, increaseBalance} from "../util/index.js";
|
|
19
19
|
import {initiateValidatorExit} from "./initiateValidatorExit.js";
|
|
20
20
|
|
|
@@ -95,4 +95,15 @@ export function slashValidator(
|
|
|
95
95
|
);
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
+
|
|
99
|
+
if (fork >= ForkSeq.gloas) {
|
|
100
|
+
// Cleared on every slashing, not only proposer slashings: a proposer slashed via an attester slashing
|
|
101
|
+
// first would otherwise keep the builder paying for a block it equivocated on
|
|
102
|
+
const {builderPendingPayments} = state as CachedBeaconStateGloas;
|
|
103
|
+
for (let i = 0; i < builderPendingPayments.length; i++) {
|
|
104
|
+
if (builderPendingPayments.getReadonly(i).proposerIndex === slashedIndex) {
|
|
105
|
+
builderPendingPayments.set(i, ssz.gloas.BuilderPendingPayment.defaultViewDU());
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
98
109
|
}
|
|
@@ -12,7 +12,7 @@ import {getPayloadAttestationDataSigningRoot} from "./indexedPayloadAttestation.
|
|
|
12
12
|
import {getBlockProposerSignatureSet} from "./proposer.js";
|
|
13
13
|
import {getProposerSlashingsSignatureSets} from "./proposerSlashings.js";
|
|
14
14
|
import {getRandaoRevealSignatureSet} from "./randao.js";
|
|
15
|
-
import {
|
|
15
|
+
import {getVoluntaryExitSignatureSet} from "./voluntaryExits.js";
|
|
16
16
|
|
|
17
17
|
export * from "./attesterSlashings.js";
|
|
18
18
|
export * from "./blsToExecutionChange.js";
|
|
@@ -49,7 +49,9 @@ export function getBlockSignatureSets(
|
|
|
49
49
|
...getProposerSlashingsSignatureSets(config, signedBlock),
|
|
50
50
|
...getAttesterSlashingsSignatureSets(config, signedBlock),
|
|
51
51
|
...getAttestationsSignatureSets(config, signedBlock, indexedAttestations),
|
|
52
|
-
...
|
|
52
|
+
...signedBlock.message.body.voluntaryExits.map((voluntaryExit) =>
|
|
53
|
+
getVoluntaryExitSignatureSet(config, state, voluntaryExit)
|
|
54
|
+
),
|
|
53
55
|
];
|
|
54
56
|
|
|
55
57
|
if (!opts?.skipProposerSignature) {
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import {BeaconConfig} from "@lodestar/config";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {IBeaconStateView, IBeaconStateViewGloas, isStatePostGloas} from "../stateView/interface.js";
|
|
2
|
+
import {phase0, ssz} from "@lodestar/types";
|
|
3
|
+
import {IBeaconStateView} from "../stateView/interface.js";
|
|
5
4
|
import {
|
|
6
5
|
ISignatureSet,
|
|
7
6
|
SignatureSetType,
|
|
8
7
|
computeSigningRoot,
|
|
9
8
|
computeStartSlotAtEpoch,
|
|
10
|
-
convertValidatorIndexToBuilderIndex,
|
|
11
|
-
isBuilderIndex,
|
|
12
9
|
verifySignatureSet,
|
|
13
10
|
} from "../util/index.js";
|
|
14
11
|
|
|
@@ -27,36 +24,9 @@ export function getVoluntaryExitSignatureSet(
|
|
|
27
24
|
config: BeaconConfig,
|
|
28
25
|
state: IBeaconStateView,
|
|
29
26
|
signedVoluntaryExit: phase0.SignedVoluntaryExit
|
|
30
|
-
): ISignatureSet {
|
|
31
|
-
const fork = config.getForkSeq(state.slot);
|
|
32
|
-
|
|
33
|
-
if (fork >= ForkSeq.gloas && isBuilderVoluntaryExit(signedVoluntaryExit)) {
|
|
34
|
-
if (!isStatePostGloas(state)) {
|
|
35
|
-
throw new Error(`Expected gloas+ state for builder voluntary exit signature, got fork=${state.forkName}`);
|
|
36
|
-
}
|
|
37
|
-
return getBuilderVoluntaryExitSignatureSet(config, state, signedVoluntaryExit);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return getValidatorVoluntaryExitSignatureSet(config, state.slot, signedVoluntaryExit);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export function getVoluntaryExitsSignatureSets(
|
|
44
|
-
config: BeaconConfig,
|
|
45
|
-
state: IBeaconStateView,
|
|
46
|
-
signedBlock: SignedBeaconBlock
|
|
47
|
-
): ISignatureSet[] {
|
|
48
|
-
return signedBlock.message.body.voluntaryExits.map((voluntaryExit) =>
|
|
49
|
-
getVoluntaryExitSignatureSet(config, state, voluntaryExit)
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export function getValidatorVoluntaryExitSignatureSet(
|
|
54
|
-
config: BeaconConfig,
|
|
55
|
-
stateSlot: Slot,
|
|
56
|
-
signedVoluntaryExit: phase0.SignedVoluntaryExit
|
|
57
27
|
): ISignatureSet {
|
|
58
28
|
const messageSlot = computeStartSlotAtEpoch(signedVoluntaryExit.message.epoch);
|
|
59
|
-
const domain = config.getDomainForVoluntaryExit(
|
|
29
|
+
const domain = config.getDomainForVoluntaryExit(state.slot, messageSlot);
|
|
60
30
|
|
|
61
31
|
return {
|
|
62
32
|
type: SignatureSetType.indexed,
|
|
@@ -65,25 +35,3 @@ export function getValidatorVoluntaryExitSignatureSet(
|
|
|
65
35
|
signature: signedVoluntaryExit.signature,
|
|
66
36
|
};
|
|
67
37
|
}
|
|
68
|
-
|
|
69
|
-
export function getBuilderVoluntaryExitSignatureSet(
|
|
70
|
-
config: BeaconConfig,
|
|
71
|
-
state: IBeaconStateViewGloas,
|
|
72
|
-
signedVoluntaryExit: phase0.SignedVoluntaryExit
|
|
73
|
-
): ISignatureSet {
|
|
74
|
-
const messageSlot = computeStartSlotAtEpoch(signedVoluntaryExit.message.epoch);
|
|
75
|
-
const domain = config.getDomainForVoluntaryExit(state.slot, messageSlot);
|
|
76
|
-
const builderIndex = convertValidatorIndexToBuilderIndex(signedVoluntaryExit.message.validatorIndex);
|
|
77
|
-
const builder = state.getBuilder(builderIndex);
|
|
78
|
-
|
|
79
|
-
return {
|
|
80
|
-
type: SignatureSetType.single,
|
|
81
|
-
pubkey: builder.pubkey,
|
|
82
|
-
signingRoot: computeSigningRoot(ssz.phase0.VoluntaryExit, signedVoluntaryExit.message, domain),
|
|
83
|
-
signature: signedVoluntaryExit.signature,
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export function isBuilderVoluntaryExit(signedVoluntaryExit: phase0.SignedVoluntaryExit): boolean {
|
|
88
|
-
return isBuilderIndex(signedVoluntaryExit.message.validatorIndex);
|
|
89
|
-
}
|