@lodestar/state-transition 1.39.0-dev.b37f2bd1bd → 1.39.0-dev.c151a164f2

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 (81) hide show
  1. package/lib/block/isValidIndexedAttestation.d.ts +3 -2
  2. package/lib/block/isValidIndexedAttestation.d.ts.map +1 -1
  3. package/lib/block/isValidIndexedAttestation.js +4 -4
  4. package/lib/block/isValidIndexedAttestation.js.map +1 -1
  5. package/lib/block/processAttestationPhase0.d.ts.map +1 -1
  6. package/lib/block/processAttestationPhase0.js +1 -1
  7. package/lib/block/processAttestationPhase0.js.map +1 -1
  8. package/lib/block/processAttestationsAltair.d.ts.map +1 -1
  9. package/lib/block/processAttestationsAltair.js +1 -1
  10. package/lib/block/processAttestationsAltair.js.map +1 -1
  11. package/lib/block/processAttesterSlashing.js +1 -1
  12. package/lib/block/processAttesterSlashing.js.map +1 -1
  13. package/lib/block/processProposerSlashing.d.ts.map +1 -1
  14. package/lib/block/processProposerSlashing.js +1 -1
  15. package/lib/block/processProposerSlashing.js.map +1 -1
  16. package/lib/block/processRandao.js +1 -1
  17. package/lib/block/processRandao.js.map +1 -1
  18. package/lib/block/processSyncCommittee.d.ts +2 -1
  19. package/lib/block/processSyncCommittee.d.ts.map +1 -1
  20. package/lib/block/processSyncCommittee.js +3 -3
  21. package/lib/block/processSyncCommittee.js.map +1 -1
  22. package/lib/block/processVoluntaryExit.d.ts.map +1 -1
  23. package/lib/block/processVoluntaryExit.js +2 -1
  24. package/lib/block/processVoluntaryExit.js.map +1 -1
  25. package/lib/cache/epochCache.d.ts +0 -3
  26. package/lib/cache/epochCache.d.ts.map +1 -1
  27. package/lib/cache/epochCache.js +0 -3
  28. package/lib/cache/epochCache.js.map +1 -1
  29. package/lib/cache/stateCache.d.ts +1 -0
  30. package/lib/cache/stateCache.d.ts.map +1 -1
  31. package/lib/cache/stateCache.js.map +1 -1
  32. package/lib/signatureSets/attesterSlashings.d.ts +4 -3
  33. package/lib/signatureSets/attesterSlashings.d.ts.map +1 -1
  34. package/lib/signatureSets/attesterSlashings.js +6 -6
  35. package/lib/signatureSets/attesterSlashings.js.map +1 -1
  36. package/lib/signatureSets/index.d.ts +2 -1
  37. package/lib/signatureSets/index.d.ts.map +1 -1
  38. package/lib/signatureSets/index.js +8 -8
  39. package/lib/signatureSets/index.js.map +1 -1
  40. package/lib/signatureSets/indexedAttestation.d.ts +5 -4
  41. package/lib/signatureSets/indexedAttestation.d.ts.map +1 -1
  42. package/lib/signatureSets/indexedAttestation.js +8 -8
  43. package/lib/signatureSets/indexedAttestation.js.map +1 -1
  44. package/lib/signatureSets/proposer.d.ts +3 -2
  45. package/lib/signatureSets/proposer.d.ts.map +1 -1
  46. package/lib/signatureSets/proposer.js +3 -4
  47. package/lib/signatureSets/proposer.js.map +1 -1
  48. package/lib/signatureSets/proposerSlashings.d.ts +3 -2
  49. package/lib/signatureSets/proposerSlashings.d.ts.map +1 -1
  50. package/lib/signatureSets/proposerSlashings.js +4 -4
  51. package/lib/signatureSets/proposerSlashings.js.map +1 -1
  52. package/lib/signatureSets/randao.d.ts +3 -2
  53. package/lib/signatureSets/randao.d.ts.map +1 -1
  54. package/lib/signatureSets/randao.js +4 -4
  55. package/lib/signatureSets/randao.js.map +1 -1
  56. package/lib/signatureSets/voluntaryExits.d.ts +4 -3
  57. package/lib/signatureSets/voluntaryExits.d.ts.map +1 -1
  58. package/lib/signatureSets/voluntaryExits.js +6 -6
  59. package/lib/signatureSets/voluntaryExits.js.map +1 -1
  60. package/lib/stateTransition.d.ts.map +1 -1
  61. package/lib/stateTransition.js +2 -1
  62. package/lib/stateTransition.js.map +1 -1
  63. package/package.json +6 -6
  64. package/src/block/isValidIndexedAttestation.ts +5 -2
  65. package/src/block/processAttestationPhase0.ts +1 -0
  66. package/src/block/processAttestationsAltair.ts +7 -1
  67. package/src/block/processAttesterSlashing.ts +1 -1
  68. package/src/block/processProposerSlashing.ts +6 -1
  69. package/src/block/processRandao.ts +1 -1
  70. package/src/block/processSyncCommittee.ts +10 -2
  71. package/src/block/processVoluntaryExit.ts +4 -1
  72. package/src/cache/epochCache.ts +0 -3
  73. package/src/cache/stateCache.ts +1 -0
  74. package/src/signatureSets/attesterSlashings.ts +7 -3
  75. package/src/signatureSets/index.ts +9 -6
  76. package/src/signatureSets/indexedAttestation.ts +9 -3
  77. package/src/signatureSets/proposer.ts +4 -2
  78. package/src/signatureSets/proposerSlashings.ts +5 -6
  79. package/src/signatureSets/randao.ts +5 -2
  80. package/src/signatureSets/voluntaryExits.ts +7 -3
  81. package/src/stateTransition.ts +4 -1
@@ -1,4 +1,5 @@
1
1
  import {byteArrayEquals} from "@chainsafe/ssz";
2
+ import {BeaconConfig} from "@lodestar/config";
2
3
  import {DOMAIN_SYNC_COMMITTEE, SYNC_COMMITTEE_SIZE} from "@lodestar/params";
3
4
  import {altair, ssz} from "@lodestar/types";
4
5
  import {Index2PubkeyCache} from "../cache/pubkeyCache.js";
@@ -24,7 +25,13 @@ export function processSyncAggregate(
24
25
  if (verifySignatures) {
25
26
  // This is to conform to the spec - we want the signature to be verified
26
27
  const participantIndices = block.body.syncAggregate.syncCommitteeBits.intersectValues(committeeIndices);
27
- const signatureSet = getSyncCommitteeSignatureSet(state.epochCtx.index2pubkey, state, block, participantIndices);
28
+ const signatureSet = getSyncCommitteeSignatureSet(
29
+ state.config,
30
+ state.epochCtx.index2pubkey,
31
+ state,
32
+ block,
33
+ participantIndices
34
+ );
28
35
  // When there's no participation we consider the signature valid and just ignore i
29
36
  if (signatureSet !== null && !verifySignatureSet(signatureSet)) {
30
37
  throw Error("Sync committee signature invalid");
@@ -64,6 +71,7 @@ export function processSyncAggregate(
64
71
  }
65
72
 
66
73
  export function getSyncCommitteeSignatureSet(
74
+ config: BeaconConfig,
67
75
  index2pubkey: Index2PubkeyCache,
68
76
  state: CachedBeaconStateAllForks,
69
77
  block: altair.BeaconBlock,
@@ -107,7 +115,7 @@ export function getSyncCommitteeSignatureSet(
107
115
  throw Error("Empty sync committee signature is not infinity");
108
116
  }
109
117
 
110
- const domain = state.config.getDomain(state.slot, DOMAIN_SYNC_COMMITTEE, previousSlot);
118
+ const domain = config.getDomain(state.slot, DOMAIN_SYNC_COMMITTEE, previousSlot);
111
119
 
112
120
  return {
113
121
  type: SignatureSetType.aggregate,
@@ -74,7 +74,10 @@ export function getVoluntaryExitValidity(
74
74
  return VoluntaryExitValidity.pendingWithdrawals;
75
75
  }
76
76
 
77
- if (verifySignature && !verifyVoluntaryExitSignature(epochCtx.index2pubkey, state, signedVoluntaryExit)) {
77
+ if (
78
+ verifySignature &&
79
+ !verifyVoluntaryExitSignature(state.config, epochCtx.index2pubkey, state, signedVoluntaryExit)
80
+ ) {
78
81
  return VoluntaryExitValidity.invalidSignature;
79
82
  }
80
83
 
@@ -108,9 +108,6 @@ export class EpochCache {
108
108
  /**
109
109
  * Unique globally shared pubkey registry. There should only exist one for the entire application.
110
110
  *
111
- * TODO: this is a hack, we need a safety mechanism in case a bad eth1 majority vote is in,
112
- * or handle non finalized data differently, or use an immutable.js structure for cheap copies
113
- *
114
111
  * $VALIDATOR_COUNT x 192 char String -> Number Map
115
112
  */
116
113
  pubkey2index: PubkeyIndexMap;
@@ -17,6 +17,7 @@ import {
17
17
  } from "./types.js";
18
18
 
19
19
  export type BeaconStateCache = {
20
+ /** @deprecated should not access config outside of state-transition package */
20
21
  config: BeaconConfig;
21
22
  epochCtx: EpochCache;
22
23
  /** Count of clones created from this BeaconStateCache instance. readonly to prevent accidental usage downstream */
@@ -1,3 +1,4 @@
1
+ import {BeaconConfig} from "@lodestar/config";
1
2
  import {DOMAIN_BEACON_ATTESTER} from "@lodestar/params";
2
3
  import {AttesterSlashing, IndexedAttestationBigint, SignedBeaconBlock, ssz} from "@lodestar/types";
3
4
  import {Index2PubkeyCache} from "../cache/pubkeyCache.js";
@@ -6,33 +7,36 @@ import {ISignatureSet, SignatureSetType, computeSigningRoot, computeStartSlotAtE
6
7
 
7
8
  /** Get signature sets from all AttesterSlashing objects in a block */
8
9
  export function getAttesterSlashingsSignatureSets(
10
+ config: BeaconConfig,
9
11
  index2pubkey: Index2PubkeyCache,
10
12
  state: CachedBeaconStateAllForks,
11
13
  signedBlock: SignedBeaconBlock
12
14
  ): ISignatureSet[] {
13
15
  return signedBlock.message.body.attesterSlashings.flatMap((attesterSlashing) =>
14
- getAttesterSlashingSignatureSets(index2pubkey, state, attesterSlashing)
16
+ getAttesterSlashingSignatureSets(config, index2pubkey, state, attesterSlashing)
15
17
  );
16
18
  }
17
19
 
18
20
  /** Get signature sets from a single AttesterSlashing object */
19
21
  export function getAttesterSlashingSignatureSets(
22
+ config: BeaconConfig,
20
23
  index2pubkey: Index2PubkeyCache,
21
24
  state: CachedBeaconStateAllForks,
22
25
  attesterSlashing: AttesterSlashing
23
26
  ): ISignatureSet[] {
24
27
  return [attesterSlashing.attestation1, attesterSlashing.attestation2].map((attestation) =>
25
- getIndexedAttestationBigintSignatureSet(index2pubkey, state, attestation)
28
+ getIndexedAttestationBigintSignatureSet(config, index2pubkey, state, attestation)
26
29
  );
27
30
  }
28
31
 
29
32
  export function getIndexedAttestationBigintSignatureSet(
33
+ config: BeaconConfig,
30
34
  index2pubkey: Index2PubkeyCache,
31
35
  state: CachedBeaconStateAllForks,
32
36
  indexedAttestation: IndexedAttestationBigint
33
37
  ): ISignatureSet {
34
38
  const slot = computeStartSlotAtEpoch(Number(indexedAttestation.data.target.epoch as bigint));
35
- const domain = state.config.getDomain(state.slot, DOMAIN_BEACON_ATTESTER, slot);
39
+ const domain = config.getDomain(state.slot, DOMAIN_BEACON_ATTESTER, slot);
36
40
 
37
41
  return {
38
42
  type: SignatureSetType.aggregate,
@@ -1,3 +1,4 @@
1
+ import {BeaconConfig} from "@lodestar/config";
1
2
  import {ForkSeq} from "@lodestar/params";
2
3
  import {IndexedAttestation, SignedBeaconBlock, altair, capella} from "@lodestar/types";
3
4
  import {getSyncCommitteeSignatureSet} from "../block/processSyncCommittee.js";
@@ -26,6 +27,7 @@ export * from "./voluntaryExits.js";
26
27
  * Deposits are not included because they can legally have invalid signatures.
27
28
  */
28
29
  export function getBlockSignatureSets(
30
+ config: BeaconConfig,
29
31
  index2pubkey: Index2PubkeyCache,
30
32
  state: CachedBeaconStateAllForks,
31
33
  signedBlock: SignedBeaconBlock,
@@ -39,20 +41,21 @@ export function getBlockSignatureSets(
39
41
  const fork = state.config.getForkSeq(signedBlock.message.slot);
40
42
 
41
43
  const signatureSets = [
42
- getRandaoRevealSignatureSet(index2pubkey, state, signedBlock.message),
43
- ...getProposerSlashingsSignatureSets(index2pubkey, state, signedBlock),
44
- ...getAttesterSlashingsSignatureSets(index2pubkey, state, signedBlock),
45
- ...getAttestationsSignatureSets(index2pubkey, state, signedBlock, indexedAttestations),
46
- ...getVoluntaryExitsSignatureSets(index2pubkey, state, signedBlock),
44
+ getRandaoRevealSignatureSet(config, index2pubkey, state, signedBlock.message),
45
+ ...getProposerSlashingsSignatureSets(config, index2pubkey, state, signedBlock),
46
+ ...getAttesterSlashingsSignatureSets(config, index2pubkey, state, signedBlock),
47
+ ...getAttestationsSignatureSets(config, index2pubkey, state, signedBlock, indexedAttestations),
48
+ ...getVoluntaryExitsSignatureSets(config, index2pubkey, state, signedBlock),
47
49
  ];
48
50
 
49
51
  if (!opts?.skipProposerSignature) {
50
- signatureSets.push(getBlockProposerSignatureSet(index2pubkey, state, signedBlock));
52
+ signatureSets.push(getBlockProposerSignatureSet(config, index2pubkey, state, signedBlock));
51
53
  }
52
54
 
53
55
  // Only after altair fork, validate tSyncCommitteeSignature
54
56
  if (fork >= ForkSeq.altair) {
55
57
  const syncCommitteeSignatureSet = getSyncCommitteeSignatureSet(
58
+ config,
56
59
  index2pubkey,
57
60
  state as CachedBeaconStateAltair,
58
61
  (signedBlock as altair.SignedBeaconBlock).message
@@ -1,3 +1,4 @@
1
+ import {BeaconConfig} from "@lodestar/config";
1
2
  import {DOMAIN_BEACON_ATTESTER} from "@lodestar/params";
2
3
  import {IndexedAttestation, SignedBeaconBlock, phase0, ssz} from "@lodestar/types";
3
4
  import {Index2PubkeyCache} from "../cache/pubkeyCache.js";
@@ -10,16 +11,18 @@ import {
10
11
  } from "../util/index.js";
11
12
 
12
13
  export function getAttestationDataSigningRoot(
14
+ config: BeaconConfig,
13
15
  state: CachedBeaconStateAllForks,
14
16
  data: phase0.AttestationData
15
17
  ): Uint8Array {
16
18
  const slot = computeStartSlotAtEpoch(data.target.epoch);
17
- const domain = state.config.getDomain(state.slot, DOMAIN_BEACON_ATTESTER, slot);
19
+ const domain = config.getDomain(state.slot, DOMAIN_BEACON_ATTESTER, slot);
18
20
 
19
21
  return computeSigningRoot(ssz.phase0.AttestationData, data, domain);
20
22
  }
21
23
 
22
24
  export function getAttestationWithIndicesSignatureSet(
25
+ config: BeaconConfig,
23
26
  index2pubkey: Index2PubkeyCache,
24
27
  state: CachedBeaconStateAllForks,
25
28
  attestation: Pick<phase0.Attestation, "data" | "signature">,
@@ -27,17 +30,19 @@ export function getAttestationWithIndicesSignatureSet(
27
30
  ): ISignatureSet {
28
31
  return createAggregateSignatureSetFromComponents(
29
32
  attestingIndices.map((i) => index2pubkey[i]),
30
- getAttestationDataSigningRoot(state, attestation.data),
33
+ getAttestationDataSigningRoot(config, state, attestation.data),
31
34
  attestation.signature
32
35
  );
33
36
  }
34
37
 
35
38
  export function getIndexedAttestationSignatureSet(
39
+ config: BeaconConfig,
36
40
  index2pubkey: Index2PubkeyCache,
37
41
  state: CachedBeaconStateAllForks,
38
42
  indexedAttestation: IndexedAttestation
39
43
  ): ISignatureSet {
40
44
  return getAttestationWithIndicesSignatureSet(
45
+ config,
41
46
  index2pubkey,
42
47
  state,
43
48
  indexedAttestation,
@@ -46,6 +51,7 @@ export function getIndexedAttestationSignatureSet(
46
51
  }
47
52
 
48
53
  export function getAttestationsSignatureSets(
54
+ config: BeaconConfig,
49
55
  index2pubkey: Index2PubkeyCache,
50
56
  state: CachedBeaconStateAllForks,
51
57
  signedBlock: SignedBeaconBlock,
@@ -57,6 +63,6 @@ export function getAttestationsSignatureSets(
57
63
  );
58
64
  }
59
65
  return indexedAttestations.map((indexedAttestation) =>
60
- getIndexedAttestationSignatureSet(index2pubkey, state, indexedAttestation)
66
+ getIndexedAttestationSignatureSet(config, index2pubkey, state, indexedAttestation)
61
67
  );
62
68
  }
@@ -1,3 +1,4 @@
1
+ import {BeaconConfig} from "@lodestar/config";
1
2
  import {DOMAIN_BEACON_PROPOSER} from "@lodestar/params";
2
3
  import {SignedBeaconBlock, SignedBlindedBeaconBlock, Slot, isBlindedBeaconBlock, phase0, ssz} from "@lodestar/types";
3
4
  import {Index2PubkeyCache} from "../cache/pubkeyCache.js";
@@ -6,20 +7,21 @@ import {computeSigningRoot} from "../util/index.js";
6
7
  import {ISignatureSet, SignatureSetType, verifySignatureSet} from "../util/signatureSets.js";
7
8
 
8
9
  export function verifyProposerSignature(
10
+ config: BeaconConfig,
9
11
  index2pubkey: Index2PubkeyCache,
10
12
  state: CachedBeaconStateAllForks,
11
13
  signedBlock: SignedBeaconBlock | SignedBlindedBeaconBlock
12
14
  ): boolean {
13
- const signatureSet = getBlockProposerSignatureSet(index2pubkey, state, signedBlock);
15
+ const signatureSet = getBlockProposerSignatureSet(config, index2pubkey, state, signedBlock);
14
16
  return verifySignatureSet(signatureSet);
15
17
  }
16
18
 
17
19
  export function getBlockProposerSignatureSet(
20
+ config: BeaconConfig,
18
21
  index2pubkey: Index2PubkeyCache,
19
22
  state: CachedBeaconStateAllForks,
20
23
  signedBlock: SignedBeaconBlock | SignedBlindedBeaconBlock
21
24
  ): ISignatureSet {
22
- const {config} = state;
23
25
  const domain = config.getDomain(state.slot, DOMAIN_BEACON_PROPOSER, signedBlock.message.slot);
24
26
 
25
27
  const blockType = isBlindedBeaconBlock(signedBlock.message)
@@ -1,3 +1,4 @@
1
+ import {BeaconConfig} from "@lodestar/config";
1
2
  import {DOMAIN_BEACON_PROPOSER} from "@lodestar/params";
2
3
  import {SignedBeaconBlock, phase0, ssz} from "@lodestar/types";
3
4
  import {Index2PubkeyCache} from "../cache/pubkeyCache.js";
@@ -8,6 +9,7 @@ import {ISignatureSet, SignatureSetType, computeSigningRoot} from "../util/index
8
9
  * Extract signatures to allow validating all block signatures at once
9
10
  */
10
11
  export function getProposerSlashingSignatureSets(
12
+ config: BeaconConfig,
11
13
  index2pubkey: Index2PubkeyCache,
12
14
  state: CachedBeaconStateAllForks,
13
15
  proposerSlashing: phase0.ProposerSlashing
@@ -17,11 +19,7 @@ export function getProposerSlashingSignatureSets(
17
19
  // In state transition, ProposerSlashing headers are only partially validated. Their slot could be higher than the
18
20
  // clock and the slashing would still be valid. Must use bigint variants to hash correctly to all possible values
19
21
  return [proposerSlashing.signedHeader1, proposerSlashing.signedHeader2].map((signedHeader): ISignatureSet => {
20
- const domain = state.config.getDomain(
21
- state.slot,
22
- DOMAIN_BEACON_PROPOSER,
23
- Number(signedHeader.message.slot as bigint)
24
- );
22
+ const domain = config.getDomain(state.slot, DOMAIN_BEACON_PROPOSER, Number(signedHeader.message.slot as bigint));
25
23
 
26
24
  return {
27
25
  type: SignatureSetType.single,
@@ -33,11 +31,12 @@ export function getProposerSlashingSignatureSets(
33
31
  }
34
32
 
35
33
  export function getProposerSlashingsSignatureSets(
34
+ config: BeaconConfig,
36
35
  index2pubkey: Index2PubkeyCache,
37
36
  state: CachedBeaconStateAllForks,
38
37
  signedBlock: SignedBeaconBlock
39
38
  ): ISignatureSet[] {
40
39
  return signedBlock.message.body.proposerSlashings.flatMap((proposerSlashing) =>
41
- getProposerSlashingSignatureSets(index2pubkey, state, proposerSlashing)
40
+ getProposerSlashingSignatureSets(config, index2pubkey, state, proposerSlashing)
42
41
  );
43
42
  }
@@ -1,3 +1,4 @@
1
+ import {BeaconConfig} from "@lodestar/config";
1
2
  import {DOMAIN_RANDAO} from "@lodestar/params";
2
3
  import {BeaconBlock, ssz} from "@lodestar/types";
3
4
  import {Index2PubkeyCache} from "../cache/pubkeyCache.js";
@@ -11,24 +12,26 @@ import {
11
12
  } from "../util/index.js";
12
13
 
13
14
  export function verifyRandaoSignature(
15
+ config: BeaconConfig,
14
16
  index2pubkey: Index2PubkeyCache,
15
17
  state: CachedBeaconStateAllForks,
16
18
  block: BeaconBlock
17
19
  ): boolean {
18
- return verifySignatureSet(getRandaoRevealSignatureSet(index2pubkey, state, block));
20
+ return verifySignatureSet(getRandaoRevealSignatureSet(config, index2pubkey, state, block));
19
21
  }
20
22
 
21
23
  /**
22
24
  * Extract signatures to allow validating all block signatures at once
23
25
  */
24
26
  export function getRandaoRevealSignatureSet(
27
+ config: BeaconConfig,
25
28
  index2pubkey: Index2PubkeyCache,
26
29
  state: CachedBeaconStateAllForks,
27
30
  block: BeaconBlock
28
31
  ): ISignatureSet {
29
32
  // should not get epoch from epochCtx
30
33
  const epoch = computeEpochAtSlot(block.slot);
31
- const domain = state.config.getDomain(state.slot, DOMAIN_RANDAO, block.slot);
34
+ const domain = config.getDomain(state.slot, DOMAIN_RANDAO, block.slot);
32
35
 
33
36
  return {
34
37
  type: SignatureSetType.single,
@@ -1,3 +1,4 @@
1
+ import {BeaconConfig} from "@lodestar/config";
1
2
  import {SignedBeaconBlock, phase0, ssz} from "@lodestar/types";
2
3
  import {Index2PubkeyCache} from "../cache/pubkeyCache.js";
3
4
  import {CachedBeaconStateAllForks} from "../types.js";
@@ -10,23 +11,25 @@ import {
10
11
  } from "../util/index.js";
11
12
 
12
13
  export function verifyVoluntaryExitSignature(
14
+ config: BeaconConfig,
13
15
  index2pubkey: Index2PubkeyCache,
14
16
  state: CachedBeaconStateAllForks,
15
17
  signedVoluntaryExit: phase0.SignedVoluntaryExit
16
18
  ): boolean {
17
- return verifySignatureSet(getVoluntaryExitSignatureSet(index2pubkey, state, signedVoluntaryExit));
19
+ return verifySignatureSet(getVoluntaryExitSignatureSet(config, index2pubkey, state, signedVoluntaryExit));
18
20
  }
19
21
 
20
22
  /**
21
23
  * Extract signatures to allow validating all block signatures at once
22
24
  */
23
25
  export function getVoluntaryExitSignatureSet(
26
+ config: BeaconConfig,
24
27
  index2pubkey: Index2PubkeyCache,
25
28
  state: CachedBeaconStateAllForks,
26
29
  signedVoluntaryExit: phase0.SignedVoluntaryExit
27
30
  ): ISignatureSet {
28
31
  const slot = computeStartSlotAtEpoch(signedVoluntaryExit.message.epoch);
29
- const domain = state.config.getDomainForVoluntaryExit(state.slot, slot);
32
+ const domain = config.getDomainForVoluntaryExit(state.slot, slot);
30
33
 
31
34
  return {
32
35
  type: SignatureSetType.single,
@@ -37,11 +40,12 @@ export function getVoluntaryExitSignatureSet(
37
40
  }
38
41
 
39
42
  export function getVoluntaryExitsSignatureSets(
43
+ config: BeaconConfig,
40
44
  index2pubkey: Index2PubkeyCache,
41
45
  state: CachedBeaconStateAllForks,
42
46
  signedBlock: SignedBeaconBlock
43
47
  ): ISignatureSet[] {
44
48
  return signedBlock.message.body.voluntaryExits.map((voluntaryExit) =>
45
- getVoluntaryExitSignatureSet(index2pubkey, state, voluntaryExit)
49
+ getVoluntaryExitSignatureSet(config, index2pubkey, state, voluntaryExit)
46
50
  );
47
51
  }
@@ -111,7 +111,10 @@ export function stateTransition(
111
111
  postState = processSlotsWithTransientCache(postState, blockSlot, options, {metrics, validatorMonitor});
112
112
 
113
113
  // Verify proposer signature only
114
- if (verifyProposer && !verifyProposerSignature(postState.epochCtx.index2pubkey, postState, signedBlock)) {
114
+ if (
115
+ verifyProposer &&
116
+ !verifyProposerSignature(postState.config, postState.epochCtx.index2pubkey, postState, signedBlock)
117
+ ) {
115
118
  throw new Error("Invalid block signature");
116
119
  }
117
120