@lodestar/state-transition 1.39.0-dev.882891d89c → 1.39.0-dev.b37f2bd1bd

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