@lodestar/state-transition 1.50.0-dev.c04a499311 → 1.50.0-dev.c3aaeedc3b
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/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/signatureSets/index.ts +4 -2
- package/src/signatureSets/voluntaryExits.ts +3 -55
|
@@ -1 +1 @@
|
|
|
1
|
-
{"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,
|
|
1
|
+
{"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,EA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C,OAAO,CAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC;YAC3G,MAAM,GAAG,GAAI,KAA+B,CAAC,6BAA6B,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACzG,aAAa,CAAC,IAAI,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.c3aaeedc3b",
|
|
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.c3aaeedc3b",
|
|
73
|
+
"@lodestar/params": "^1.50.0-dev.c3aaeedc3b",
|
|
74
|
+
"@lodestar/types": "^1.50.0-dev.c3aaeedc3b",
|
|
75
|
+
"@lodestar/utils": "^1.50.0-dev.c3aaeedc3b",
|
|
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.c3aaeedc3b"
|
|
80
80
|
},
|
|
81
81
|
"keywords": [
|
|
82
82
|
"ethereum",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"beacon",
|
|
85
85
|
"blockchain"
|
|
86
86
|
],
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "166b75e36415d0978d463f1009b518c0f94fdbd7"
|
|
88
88
|
}
|
|
@@ -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
|
-
}
|