@lodestar/state-transition 1.41.0-dev.aeb5a213ee → 1.41.0-dev.bb273175f2

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 (106) hide show
  1. package/lib/block/externalData.d.ts +2 -1
  2. package/lib/block/externalData.d.ts.map +1 -1
  3. package/lib/block/externalData.js +2 -0
  4. package/lib/block/externalData.js.map +1 -1
  5. package/lib/block/isValidIndexedAttestation.d.ts +3 -3
  6. package/lib/block/isValidIndexedAttestation.d.ts.map +1 -1
  7. package/lib/block/isValidIndexedAttestation.js +4 -4
  8. package/lib/block/isValidIndexedAttestation.js.map +1 -1
  9. package/lib/block/isValidIndexedPayloadAttestation.js +1 -1
  10. package/lib/block/isValidIndexedPayloadAttestation.js.map +1 -1
  11. package/lib/block/processAttestationPhase0.js +1 -1
  12. package/lib/block/processAttestationPhase0.js.map +1 -1
  13. package/lib/block/processAttestationsAltair.js +1 -1
  14. package/lib/block/processAttestationsAltair.js.map +1 -1
  15. package/lib/block/processAttesterSlashing.d.ts +2 -2
  16. package/lib/block/processAttesterSlashing.d.ts.map +1 -1
  17. package/lib/block/processAttesterSlashing.js +3 -3
  18. package/lib/block/processAttesterSlashing.js.map +1 -1
  19. package/lib/block/processExecutionPayloadEnvelope.js +5 -1
  20. package/lib/block/processExecutionPayloadEnvelope.js.map +1 -1
  21. package/lib/block/processProposerSlashing.d.ts +2 -2
  22. package/lib/block/processProposerSlashing.d.ts.map +1 -1
  23. package/lib/block/processProposerSlashing.js +3 -3
  24. package/lib/block/processProposerSlashing.js.map +1 -1
  25. package/lib/block/processRandao.js +1 -1
  26. package/lib/block/processRandao.js.map +1 -1
  27. package/lib/block/processSyncCommittee.js +1 -1
  28. package/lib/block/processSyncCommittee.js.map +1 -1
  29. package/lib/block/processVoluntaryExit.js +1 -1
  30. package/lib/block/processVoluntaryExit.js.map +1 -1
  31. package/lib/block/processWithdrawalRequest.js +2 -2
  32. package/lib/block/processWithdrawalRequest.js.map +1 -1
  33. package/lib/cache/epochCache.d.ts +8 -15
  34. package/lib/cache/epochCache.d.ts.map +1 -1
  35. package/lib/cache/epochCache.js +34 -33
  36. package/lib/cache/epochCache.js.map +1 -1
  37. package/lib/cache/pubkeyCache.d.ts +21 -6
  38. package/lib/cache/pubkeyCache.d.ts.map +1 -1
  39. package/lib/cache/pubkeyCache.js +39 -14
  40. package/lib/cache/pubkeyCache.js.map +1 -1
  41. package/lib/cache/stateCache.d.ts.map +1 -1
  42. package/lib/cache/stateCache.js +3 -7
  43. package/lib/cache/stateCache.js.map +1 -1
  44. package/lib/cache/syncCommitteeCache.d.ts +3 -2
  45. package/lib/cache/syncCommitteeCache.d.ts.map +1 -1
  46. package/lib/cache/syncCommitteeCache.js +4 -4
  47. package/lib/cache/syncCommitteeCache.js.map +1 -1
  48. package/lib/index.d.ts +1 -1
  49. package/lib/index.d.ts.map +1 -1
  50. package/lib/index.js +1 -1
  51. package/lib/index.js.map +1 -1
  52. package/lib/rewards/attestationsRewards.d.ts +2 -2
  53. package/lib/rewards/attestationsRewards.d.ts.map +1 -1
  54. package/lib/rewards/attestationsRewards.js +4 -4
  55. package/lib/rewards/attestationsRewards.js.map +1 -1
  56. package/lib/rewards/syncCommitteeRewards.d.ts +2 -2
  57. package/lib/rewards/syncCommitteeRewards.d.ts.map +1 -1
  58. package/lib/rewards/syncCommitteeRewards.js +5 -2
  59. package/lib/rewards/syncCommitteeRewards.js.map +1 -1
  60. package/lib/signatureSets/proposer.d.ts +2 -2
  61. package/lib/signatureSets/proposer.d.ts.map +1 -1
  62. package/lib/signatureSets/proposer.js +2 -2
  63. package/lib/signatureSets/proposer.js.map +1 -1
  64. package/lib/signatureSets/randao.d.ts +2 -2
  65. package/lib/signatureSets/randao.d.ts.map +1 -1
  66. package/lib/signatureSets/randao.js +2 -2
  67. package/lib/signatureSets/randao.js.map +1 -1
  68. package/lib/signatureSets/voluntaryExits.d.ts +2 -2
  69. package/lib/signatureSets/voluntaryExits.d.ts.map +1 -1
  70. package/lib/signatureSets/voluntaryExits.js +2 -2
  71. package/lib/signatureSets/voluntaryExits.js.map +1 -1
  72. package/lib/stateTransition.js +1 -1
  73. package/lib/stateTransition.js.map +1 -1
  74. package/lib/stateView/beaconStateView.d.ts.map +1 -1
  75. package/lib/stateView/beaconStateView.js +10 -12
  76. package/lib/stateView/beaconStateView.js.map +1 -1
  77. package/lib/util/signatureSets.d.ts +7 -7
  78. package/lib/util/signatureSets.d.ts.map +1 -1
  79. package/lib/util/signatureSets.js +18 -12
  80. package/lib/util/signatureSets.js.map +1 -1
  81. package/package.json +7 -7
  82. package/src/block/externalData.ts +2 -0
  83. package/src/block/isValidIndexedAttestation.ts +5 -5
  84. package/src/block/isValidIndexedPayloadAttestation.ts +1 -1
  85. package/src/block/processAttestationPhase0.ts +1 -1
  86. package/src/block/processAttestationsAltair.ts +1 -1
  87. package/src/block/processAttesterSlashing.ts +4 -4
  88. package/src/block/processExecutionPayloadEnvelope.ts +5 -1
  89. package/src/block/processProposerSlashing.ts +4 -4
  90. package/src/block/processRandao.ts +1 -1
  91. package/src/block/processSyncCommittee.ts +1 -1
  92. package/src/block/processVoluntaryExit.ts +1 -1
  93. package/src/block/processWithdrawalRequest.ts +2 -2
  94. package/src/cache/epochCache.ts +44 -36
  95. package/src/cache/pubkeyCache.ts +62 -21
  96. package/src/cache/stateCache.ts +3 -7
  97. package/src/cache/syncCommitteeCache.ts +4 -5
  98. package/src/index.ts +1 -1
  99. package/src/rewards/attestationsRewards.ts +5 -5
  100. package/src/rewards/syncCommitteeRewards.ts +6 -5
  101. package/src/signatureSets/proposer.ts +3 -3
  102. package/src/signatureSets/randao.ts +3 -7
  103. package/src/signatureSets/voluntaryExits.ts +3 -3
  104. package/src/stateTransition.ts +1 -1
  105. package/src/stateView/beaconStateView.ts +10 -12
  106. package/src/util/signatureSets.ts +23 -17
@@ -1,4 +1,3 @@
1
- import {PubkeyIndexMap} from "@chainsafe/pubkey-index-map";
2
1
  import {BeaconConfig} from "@lodestar/config";
3
2
  import {
4
3
  EFFECTIVE_BALANCE_INCREMENT,
@@ -16,6 +15,7 @@ import {
16
15
  import {ValidatorIndex, rewards} from "@lodestar/types";
17
16
  import {fromHex} from "@lodestar/utils";
18
17
  import {EpochTransitionCache, beforeProcessEpoch} from "../cache/epochTransitionCache.js";
18
+ import {PubkeyCache} from "../cache/pubkeyCache.js";
19
19
  import {CachedBeaconStateAllForks, CachedBeaconStateAltair} from "../types.js";
20
20
  import {
21
21
  FLAG_ELIGIBLE_ATTESTER,
@@ -34,7 +34,7 @@ const defaultAttestationsPenalty = {target: 0, source: 0};
34
34
 
35
35
  export async function computeAttestationsRewards(
36
36
  config: BeaconConfig,
37
- pubkey2index: PubkeyIndexMap,
37
+ pubkeyCache: PubkeyCache,
38
38
  state: CachedBeaconStateAllForks,
39
39
  validatorIds?: (ValidatorIndex | string)[]
40
40
  ): Promise<rewards.AttestationsRewards> {
@@ -53,7 +53,7 @@ export async function computeAttestationsRewards(
53
53
  );
54
54
  const totalRewards = computeTotalAttestationsRewardsAltair(
55
55
  config,
56
- pubkey2index,
56
+ pubkeyCache,
57
57
  stateAltair,
58
58
  transitionCache,
59
59
  idealRewards,
@@ -142,7 +142,7 @@ function computeIdealAttestationsRewardsAndPenaltiesAltair(
142
142
  // Same calculation as `getRewardsAndPenaltiesAltair` but returns the breakdown of rewards instead of aggregated
143
143
  function computeTotalAttestationsRewardsAltair(
144
144
  config: BeaconConfig,
145
- pubkey2index: PubkeyIndexMap,
145
+ pubkeyCache: PubkeyCache,
146
146
  state: CachedBeaconStateAltair,
147
147
  transitionCache: EpochTransitionCache,
148
148
  idealRewards: rewards.IdealAttestationsReward[],
@@ -153,7 +153,7 @@ function computeTotalAttestationsRewardsAltair(
153
153
  const {flags} = transitionCache;
154
154
  const {epochCtx} = state;
155
155
  const validatorIndices = validatorIds
156
- .map((id) => (typeof id === "number" ? id : pubkey2index.get(fromHex(id))))
156
+ .map((id) => (typeof id === "number" ? id : pubkeyCache.getIndex(fromHex(id))))
157
157
  .filter((index) => index !== undefined); // Validator indices to include in the result
158
158
 
159
159
  const inactivityPenaltyDenominator = config.INACTIVITY_SCORE_BIAS * INACTIVITY_PENALTY_QUOTIENT_ALTAIR;
@@ -1,12 +1,12 @@
1
1
  import {BeaconConfig} from "@lodestar/config";
2
2
  import {ForkName, SYNC_COMMITTEE_SIZE} from "@lodestar/params";
3
3
  import {BeaconBlock, ValidatorIndex, altair, rewards} from "@lodestar/types";
4
- import {Index2PubkeyCache} from "../cache/pubkeyCache.js";
4
+ import {PubkeyCache} from "../cache/pubkeyCache.js";
5
5
  import {CachedBeaconStateAllForks, CachedBeaconStateAltair} from "../cache/stateCache.js";
6
6
 
7
7
  export async function computeSyncCommitteeRewards(
8
8
  config: BeaconConfig,
9
- index2pubkey: Index2PubkeyCache,
9
+ pubkeyCache: PubkeyCache,
10
10
  block: BeaconBlock,
11
11
  preState: CachedBeaconStateAllForks,
12
12
  validatorIds: (ValidatorIndex | string)[] = []
@@ -47,9 +47,10 @@ export async function computeSyncCommitteeRewards(
47
47
 
48
48
  if (validatorIds.length) {
49
49
  const filtersSet = new Set(validatorIds);
50
- return rewards.filter(
51
- (reward) => filtersSet.has(reward.validatorIndex) || filtersSet.has(index2pubkey[reward.validatorIndex].toHex())
52
- );
50
+ return rewards.filter((reward) => {
51
+ const pubkeyHex = pubkeyCache.get(reward.validatorIndex)?.toHex();
52
+ return filtersSet.has(reward.validatorIndex) || (pubkeyHex !== undefined && filtersSet.has(pubkeyHex));
53
+ });
53
54
  }
54
55
 
55
56
  return rewards;
@@ -1,17 +1,17 @@
1
1
  import {BeaconConfig} from "@lodestar/config";
2
2
  import {DOMAIN_BEACON_PROPOSER} from "@lodestar/params";
3
3
  import {SignedBeaconBlock, SignedBlindedBeaconBlock, Slot, isBlindedBeaconBlock, phase0, ssz} from "@lodestar/types";
4
- import {Index2PubkeyCache} from "../cache/pubkeyCache.js";
4
+ import {PubkeyCache} from "../cache/pubkeyCache.js";
5
5
  import {computeSigningRoot} from "../util/index.js";
6
6
  import {ISignatureSet, SignatureSetType, verifySignatureSet} from "../util/signatureSets.js";
7
7
 
8
8
  export function verifyProposerSignature(
9
9
  config: BeaconConfig,
10
- index2pubkey: Index2PubkeyCache,
10
+ pubkeyCache: PubkeyCache,
11
11
  signedBlock: SignedBeaconBlock | SignedBlindedBeaconBlock
12
12
  ): boolean {
13
13
  const signatureSet = getBlockProposerSignatureSet(config, signedBlock);
14
- return verifySignatureSet(signatureSet, index2pubkey);
14
+ return verifySignatureSet(signatureSet, pubkeyCache);
15
15
  }
16
16
 
17
17
  export function getBlockProposerSignatureSet(
@@ -1,7 +1,7 @@
1
1
  import {BeaconConfig} from "@lodestar/config";
2
2
  import {DOMAIN_RANDAO} from "@lodestar/params";
3
3
  import {BeaconBlock, ssz} from "@lodestar/types";
4
- import {Index2PubkeyCache} from "../cache/pubkeyCache.js";
4
+ import {PubkeyCache} from "../cache/pubkeyCache.js";
5
5
  import {
6
6
  ISignatureSet,
7
7
  SignatureSetType,
@@ -10,12 +10,8 @@ import {
10
10
  verifySignatureSet,
11
11
  } from "../util/index.js";
12
12
 
13
- export function verifyRandaoSignature(
14
- config: BeaconConfig,
15
- index2pubkey: Index2PubkeyCache,
16
- block: BeaconBlock
17
- ): boolean {
18
- return verifySignatureSet(getRandaoRevealSignatureSet(config, block), index2pubkey);
13
+ export function verifyRandaoSignature(config: BeaconConfig, pubkeyCache: PubkeyCache, block: BeaconBlock): boolean {
14
+ return verifySignatureSet(getRandaoRevealSignatureSet(config, block), pubkeyCache);
19
15
  }
20
16
 
21
17
  /**
@@ -1,6 +1,6 @@
1
1
  import {BeaconConfig} from "@lodestar/config";
2
2
  import {SignedBeaconBlock, Slot, phase0, ssz} from "@lodestar/types";
3
- import {Index2PubkeyCache} from "../cache/pubkeyCache.js";
3
+ import {PubkeyCache} from "../cache/pubkeyCache.js";
4
4
  import {
5
5
  ISignatureSet,
6
6
  SignatureSetType,
@@ -11,11 +11,11 @@ import {
11
11
 
12
12
  export function verifyVoluntaryExitSignature(
13
13
  config: BeaconConfig,
14
- index2pubkey: Index2PubkeyCache,
14
+ pubkeyCache: PubkeyCache,
15
15
  stateSlot: Slot,
16
16
  signedVoluntaryExit: phase0.SignedVoluntaryExit
17
17
  ): boolean {
18
- return verifySignatureSet(getVoluntaryExitSignatureSet(config, stateSlot, signedVoluntaryExit), index2pubkey);
18
+ return verifySignatureSet(getVoluntaryExitSignatureSet(config, stateSlot, signedVoluntaryExit), pubkeyCache);
19
19
  }
20
20
 
21
21
  /**
@@ -112,7 +112,7 @@ export function stateTransition(
112
112
  postState = processSlotsWithTransientCache(postState, blockSlot, options, {metrics, validatorMonitor});
113
113
 
114
114
  // Verify proposer signature only
115
- if (verifyProposer && !verifyProposerSignature(postState.config, postState.epochCtx.index2pubkey, signedBlock)) {
115
+ if (verifyProposer && !verifyProposerSignature(postState.config, postState.epochCtx.pubkeyCache, signedBlock)) {
116
116
  throw new Error("Invalid block signature");
117
117
  }
118
118
 
@@ -1,5 +1,4 @@
1
1
  import {CompactMultiProof, ProofType, Tree, createProof} from "@chainsafe/persistent-merkle-tree";
2
- import {PubkeyIndexMap} from "@chainsafe/pubkey-index-map";
3
2
  import {ByteViews} from "@chainsafe/ssz";
4
3
  import {BeaconConfig} from "@lodestar/config";
5
4
  import {ForkSeq, SLOTS_PER_HISTORICAL_ROOT} from "@lodestar/params";
@@ -32,6 +31,7 @@ import {VoluntaryExitValidity, getVoluntaryExitValidity} from "../block/processV
32
31
  import {getExpectedWithdrawals} from "../block/processWithdrawals.js";
33
32
  import {EffectiveBalanceIncrements} from "../cache/effectiveBalanceIncrements.js";
34
33
  import {EpochTransitionCacheOpts} from "../cache/epochTransitionCache.js";
34
+ import {PubkeyCache, createPubkeyCache} from "../cache/pubkeyCache.js";
35
35
  import {RewardCache} from "../cache/rewardCache.js";
36
36
  import {
37
37
  CachedBeaconStateAllForks,
@@ -543,7 +543,7 @@ export class BeaconStateView implements IBeaconStateView {
543
543
  async computeAttestationsRewards(validatorIds?: (ValidatorIndex | string)[]): Promise<rewards.AttestationsRewards> {
544
544
  return computeAttestationsRewards(
545
545
  this.cachedState.config,
546
- this.cachedState.epochCtx.pubkey2index,
546
+ this.cachedState.epochCtx.pubkeyCache,
547
547
  this.cachedState,
548
548
  validatorIds
549
549
  );
@@ -555,7 +555,7 @@ export class BeaconStateView implements IBeaconStateView {
555
555
  ): Promise<rewards.SyncCommitteeRewards> {
556
556
  return computeSyncCommitteeRewards(
557
557
  this.cachedState.config,
558
- this.cachedState.epochCtx.index2pubkey,
558
+ this.cachedState.epochCtx.pubkeyCache,
559
559
  block,
560
560
  this.cachedState,
561
561
  validatorIds
@@ -641,8 +641,7 @@ export class BeaconStateView implements IBeaconStateView {
641
641
  {
642
642
  config: this.config,
643
643
  // as of Feb 2026, it's not necessary to sync pubkey cache as it's shared across states in Lodestar
644
- pubkey2index: this.cachedState.epochCtx.pubkey2index,
645
- index2pubkey: this.cachedState.epochCtx.index2pubkey,
644
+ pubkeyCache: this.cachedState.epochCtx.pubkeyCache,
646
645
  },
647
646
  {
648
647
  skipSyncPubkeys: true,
@@ -715,14 +714,13 @@ export function createBeaconStateViewForHistoricalRegen(
715
714
  ): IBeaconStateView {
716
715
  const state = getStateTypeFromBytes(config, stateBytes).deserializeToViewDU(stateBytes);
717
716
 
718
- const pubkey2index = new PubkeyIndexMap();
719
- syncPubkeyCache(state, pubkey2index);
717
+ const pubkeyCache = createPubkeyCache();
718
+ syncPubkeyCache(state, pubkeyCache);
720
719
  const cachedState = createCachedBeaconState(
721
720
  state,
722
721
  {
723
722
  config,
724
- pubkey2index,
725
- index2pubkey: [],
723
+ pubkeyCache,
726
724
  },
727
725
  {
728
726
  skipSyncPubkeys: true,
@@ -735,12 +733,12 @@ export function createBeaconStateViewForHistoricalRegen(
735
733
  /**
736
734
  * Populate a PubkeyIndexMap with any new entries based on a BeaconState
737
735
  */
738
- function syncPubkeyCache(state: BeaconStateAllForks, pubkey2index: PubkeyIndexMap): void {
736
+ function syncPubkeyCache(state: BeaconStateAllForks, pubkeyCache: PubkeyCache): void {
739
737
  // Get the validators sub tree once for all the loop
740
738
 
741
739
  const newCount = state.validators.length;
742
- for (let i = pubkey2index.size; i < newCount; i++) {
740
+ for (let i = pubkeyCache.size; i < newCount; i++) {
743
741
  const pubkey = state.validators.getReadonly(i).pubkey;
744
- pubkey2index.set(pubkey, i);
742
+ pubkeyCache.set(i, pubkey);
745
743
  }
746
744
  }
@@ -1,6 +1,6 @@
1
1
  import {PublicKey, Signature, aggregatePublicKeys, fastAggregateVerify, verify} from "@chainsafe/blst";
2
2
  import {Root} from "@lodestar/types";
3
- import {Index2PubkeyCache} from "../cache/pubkeyCache.js";
3
+ import {PubkeyCache} from "../cache/pubkeyCache.js";
4
4
 
5
5
  export enum SignatureSetType {
6
6
  single = "single",
@@ -49,18 +49,21 @@ export type ISignatureSet = SingleSignatureSet | IndexedSignatureSet | Aggregate
49
49
 
50
50
  /**
51
51
  * Get the pubkey for a signature set, performing aggregation if necessary.
52
- * Requires index2pubkey cache for indexed and aggregate sets.
52
+ * Requires pubkeyCache for indexed and aggregate sets.
53
53
  */
54
- export function getSignatureSetPubkey(signatureSet: ISignatureSet, index2pubkey: Index2PubkeyCache): PublicKey {
54
+ export function getSignatureSetPubkey(signatureSet: ISignatureSet, pubkeyCache: PubkeyCache): PublicKey {
55
55
  switch (signatureSet.type) {
56
56
  case SignatureSetType.single:
57
57
  return signatureSet.pubkey;
58
58
 
59
- case SignatureSetType.indexed:
60
- return index2pubkey[signatureSet.index];
59
+ case SignatureSetType.indexed: {
60
+ return pubkeyCache.getOrThrow(signatureSet.index);
61
+ }
61
62
 
62
63
  case SignatureSetType.aggregate: {
63
- const pubkeys = signatureSet.indices.map((i) => index2pubkey[i]);
64
+ const pubkeys = signatureSet.indices.map((i) => {
65
+ return pubkeyCache.getOrThrow(i);
66
+ });
64
67
  return aggregatePublicKeys(pubkeys);
65
68
  }
66
69
 
@@ -69,11 +72,11 @@ export function getSignatureSetPubkey(signatureSet: ISignatureSet, index2pubkey:
69
72
  }
70
73
  }
71
74
 
72
- export function verifySignatureSet(signatureSet: SingleSignatureSet, index2pubkey?: Index2PubkeyCache): boolean;
73
- export function verifySignatureSet(signatureSet: IndexedSignatureSet, index2pubkey: Index2PubkeyCache): boolean;
74
- export function verifySignatureSet(signatureSet: AggregatedSignatureSet, index2pubkey: Index2PubkeyCache): boolean;
75
- export function verifySignatureSet(signatureSet: ISignatureSet, index2pubkey: Index2PubkeyCache): boolean;
76
- export function verifySignatureSet(signatureSet: ISignatureSet, index2pubkey?: Index2PubkeyCache): boolean {
75
+ export function verifySignatureSet(signatureSet: SingleSignatureSet, pubkeyCache?: PubkeyCache): boolean;
76
+ export function verifySignatureSet(signatureSet: IndexedSignatureSet, pubkeyCache: PubkeyCache): boolean;
77
+ export function verifySignatureSet(signatureSet: AggregatedSignatureSet, pubkeyCache: PubkeyCache): boolean;
78
+ export function verifySignatureSet(signatureSet: ISignatureSet, pubkeyCache: PubkeyCache): boolean;
79
+ export function verifySignatureSet(signatureSet: ISignatureSet, pubkeyCache?: PubkeyCache): boolean {
77
80
  // All signatures are not trusted and must be group checked (p2.subgroup_check)
78
81
  const signature = Signature.fromBytes(signatureSet.signature, true);
79
82
 
@@ -82,17 +85,20 @@ export function verifySignatureSet(signatureSet: ISignatureSet, index2pubkey?: I
82
85
  return verify(signatureSet.signingRoot, signatureSet.pubkey, signature);
83
86
 
84
87
  case SignatureSetType.indexed: {
85
- if (!index2pubkey) {
86
- throw Error("index2pubkey required for indexed signature set");
88
+ if (!pubkeyCache) {
89
+ throw Error("pubkeyCache required for indexed signature set");
87
90
  }
88
- return verify(signatureSet.signingRoot, index2pubkey[signatureSet.index], signature);
91
+ const pubkey = pubkeyCache.getOrThrow(signatureSet.index);
92
+ return verify(signatureSet.signingRoot, pubkey, signature);
89
93
  }
90
94
 
91
95
  case SignatureSetType.aggregate: {
92
- if (!index2pubkey) {
93
- throw Error("index2pubkey required for aggregate signature set");
96
+ if (!pubkeyCache) {
97
+ throw Error("pubkeyCache required for aggregate signature set");
94
98
  }
95
- const pubkeys = signatureSet.indices.map((i) => index2pubkey[i]);
99
+ const pubkeys = signatureSet.indices.map((i) => {
100
+ return pubkeyCache.getOrThrow(i);
101
+ });
96
102
  return fastAggregateVerify(signatureSet.signingRoot, pubkeys, signature);
97
103
  }
98
104