@lodestar/state-transition 1.39.0-dev.b255111a20 → 1.39.0-dev.b6bba4cb8c

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 (61) hide show
  1. package/lib/block/isValidIndexedAttestation.d.ts.map +1 -1
  2. package/lib/block/isValidIndexedAttestation.js +2 -2
  3. package/lib/block/isValidIndexedAttestation.js.map +1 -1
  4. package/lib/block/processAttestationsAltair.js +1 -1
  5. package/lib/block/processAttestationsAltair.js.map +1 -1
  6. package/lib/block/processProposerSlashing.js +1 -1
  7. package/lib/block/processProposerSlashing.js.map +1 -1
  8. package/lib/block/processRandao.js +2 -2
  9. package/lib/block/processRandao.js.map +1 -1
  10. package/lib/block/processSyncCommittee.d.ts +2 -1
  11. package/lib/block/processSyncCommittee.d.ts.map +1 -1
  12. package/lib/block/processSyncCommittee.js +6 -4
  13. package/lib/block/processSyncCommittee.js.map +1 -1
  14. package/lib/block/processVoluntaryExit.js +1 -1
  15. package/lib/block/processVoluntaryExit.js.map +1 -1
  16. package/lib/signatureSets/attesterSlashings.d.ts +4 -5
  17. package/lib/signatureSets/attesterSlashings.d.ts.map +1 -1
  18. package/lib/signatureSets/attesterSlashings.js +10 -7
  19. package/lib/signatureSets/attesterSlashings.js.map +1 -1
  20. package/lib/signatureSets/index.d.ts +2 -2
  21. package/lib/signatureSets/index.d.ts.map +1 -1
  22. package/lib/signatureSets/index.js +10 -10
  23. package/lib/signatureSets/index.js.map +1 -1
  24. package/lib/signatureSets/indexedAttestation.d.ts +5 -6
  25. package/lib/signatureSets/indexedAttestation.d.ts.map +1 -1
  26. package/lib/signatureSets/indexedAttestation.js +12 -9
  27. package/lib/signatureSets/indexedAttestation.js.map +1 -1
  28. package/lib/signatureSets/proposer.d.ts +2 -2
  29. package/lib/signatureSets/proposer.d.ts.map +1 -1
  30. package/lib/signatureSets/proposer.js +7 -4
  31. package/lib/signatureSets/proposer.js.map +1 -1
  32. package/lib/signatureSets/proposerSlashings.d.ts +3 -4
  33. package/lib/signatureSets/proposerSlashings.d.ts.map +1 -1
  34. package/lib/signatureSets/proposerSlashings.js +7 -4
  35. package/lib/signatureSets/proposerSlashings.js.map +1 -1
  36. package/lib/signatureSets/randao.d.ts +2 -3
  37. package/lib/signatureSets/randao.d.ts.map +1 -1
  38. package/lib/signatureSets/randao.js +6 -4
  39. package/lib/signatureSets/randao.js.map +1 -1
  40. package/lib/signatureSets/voluntaryExits.d.ts +4 -5
  41. package/lib/signatureSets/voluntaryExits.d.ts.map +1 -1
  42. package/lib/signatureSets/voluntaryExits.js +10 -7
  43. package/lib/signatureSets/voluntaryExits.js.map +1 -1
  44. package/lib/stateTransition.d.ts.map +1 -1
  45. package/lib/stateTransition.js +1 -2
  46. package/lib/stateTransition.js.map +1 -1
  47. package/package.json +6 -6
  48. package/src/block/isValidIndexedAttestation.ts +4 -2
  49. package/src/block/processAttestationsAltair.ts +1 -1
  50. package/src/block/processProposerSlashing.ts +1 -1
  51. package/src/block/processRandao.ts +2 -2
  52. package/src/block/processSyncCommittee.ts +7 -4
  53. package/src/block/processVoluntaryExit.ts +1 -1
  54. package/src/signatureSets/attesterSlashings.ts +10 -9
  55. package/src/signatureSets/index.ts +11 -11
  56. package/src/signatureSets/indexedAttestation.ts +12 -11
  57. package/src/signatureSets/proposer.ts +5 -4
  58. package/src/signatureSets/proposerSlashings.ts +7 -6
  59. package/src/signatureSets/randao.ts +4 -5
  60. package/src/signatureSets/voluntaryExits.ts +10 -9
  61. package/src/stateTransition.ts +1 -4
@@ -1,11 +1,10 @@
1
1
  import { BeaconConfig } from "@lodestar/config";
2
2
  import { BeaconBlock } from "@lodestar/types";
3
3
  import { Index2PubkeyCache } from "../cache/pubkeyCache.js";
4
- import { CachedBeaconStateAllForks } from "../types.js";
5
4
  import { ISignatureSet } from "../util/index.js";
6
- export declare function verifyRandaoSignature(config: BeaconConfig, index2pubkey: Index2PubkeyCache, state: CachedBeaconStateAllForks, block: BeaconBlock): boolean;
5
+ export declare function verifyRandaoSignature(config: BeaconConfig, index2pubkey: Index2PubkeyCache, block: BeaconBlock): boolean;
7
6
  /**
8
7
  * Extract signatures to allow validating all block signatures at once
9
8
  */
10
- export declare function getRandaoRevealSignatureSet(config: BeaconConfig, index2pubkey: Index2PubkeyCache, state: CachedBeaconStateAllForks, block: BeaconBlock): ISignatureSet;
9
+ export declare function getRandaoRevealSignatureSet(config: BeaconConfig, index2pubkey: Index2PubkeyCache, block: BeaconBlock): ISignatureSet;
11
10
  //# sourceMappingURL=randao.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"randao.d.ts","sourceRoot":"","sources":["../../src/signatureSets/randao.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAC,WAAW,EAAM,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAC,iBAAiB,EAAC,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAC,yBAAyB,EAAC,MAAM,aAAa,CAAC;AACtD,OAAO,EACL,aAAa,EAKd,MAAM,kBAAkB,CAAC;AAE1B,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,iBAAiB,EAC/B,KAAK,EAAE,yBAAyB,EAChC,KAAK,EAAE,WAAW,GACjB,OAAO,CAET;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,iBAAiB,EAC/B,KAAK,EAAE,yBAAyB,EAChC,KAAK,EAAE,WAAW,GACjB,aAAa,CAWf"}
1
+ {"version":3,"file":"randao.d.ts","sourceRoot":"","sources":["../../src/signatureSets/randao.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAC,WAAW,EAAM,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAC,iBAAiB,EAAC,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EACL,aAAa,EAKd,MAAM,kBAAkB,CAAC;AAE1B,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,iBAAiB,EAC/B,KAAK,EAAE,WAAW,GACjB,OAAO,CAET;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,iBAAiB,EAC/B,KAAK,EAAE,WAAW,GACjB,aAAa,CAaf"}
@@ -1,16 +1,18 @@
1
1
  import { DOMAIN_RANDAO } from "@lodestar/params";
2
2
  import { ssz } from "@lodestar/types";
3
3
  import { SignatureSetType, computeEpochAtSlot, computeSigningRoot, verifySignatureSet, } from "../util/index.js";
4
- export function verifyRandaoSignature(config, index2pubkey, state, block) {
5
- return verifySignatureSet(getRandaoRevealSignatureSet(config, index2pubkey, state, block));
4
+ export function verifyRandaoSignature(config, index2pubkey, block) {
5
+ return verifySignatureSet(getRandaoRevealSignatureSet(config, index2pubkey, block));
6
6
  }
7
7
  /**
8
8
  * Extract signatures to allow validating all block signatures at once
9
9
  */
10
- export function getRandaoRevealSignatureSet(config, index2pubkey, state, block) {
10
+ export function getRandaoRevealSignatureSet(config, index2pubkey, block) {
11
11
  // should not get epoch from epochCtx
12
12
  const epoch = computeEpochAtSlot(block.slot);
13
- const domain = config.getDomain(state.slot, DOMAIN_RANDAO, block.slot);
13
+ // the getDomain() api requires the state slot as 1st param, however it's the same to block.slot in state-transition
14
+ // and the same epoch when we verify blocks in batch in beacon-node. So we can safely use block.slot here.
15
+ const domain = config.getDomain(block.slot, DOMAIN_RANDAO, block.slot);
14
16
  return {
15
17
  type: SignatureSetType.single,
16
18
  pubkey: index2pubkey[block.proposerIndex],
@@ -1 +1 @@
1
- {"version":3,"file":"randao.js","sourceRoot":"","sources":["../../src/signatureSets/randao.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAc,GAAG,EAAC,MAAM,iBA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AC,MAAM,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC,CAAC;AACtF,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,2BAA2B,CACzC,MAAoB,EACpB,YAA+B,EAC/B,KAAkB;IAElB,qCAAqC;IACrC,MAAM,KAAK,GAAG,kBAAkB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7C,oHAAoH;IACpH,0GAA0G;IAC1G,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,aAAa,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IAEvE,OAAO;QACL,IAAI,EAAE,gBAAgB,CAAC,MAAM;QAC7B,MAAM,EAAE,YAAY,CAAC,KAAK,CAAC,aAAa,CAAC;QACzC,WAAW,EAAE,kBAAkB,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC;QACzD,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,YAAY;KACnC,CAAC;AACJ,CAAC"}
@@ -1,12 +1,11 @@
1
1
  import { BeaconConfig } from "@lodestar/config";
2
- import { SignedBeaconBlock, phase0 } from "@lodestar/types";
2
+ import { SignedBeaconBlock, Slot, phase0 } from "@lodestar/types";
3
3
  import { Index2PubkeyCache } from "../cache/pubkeyCache.js";
4
- import { CachedBeaconStateAllForks } from "../types.js";
5
4
  import { ISignatureSet } from "../util/index.js";
6
- export declare function verifyVoluntaryExitSignature(config: BeaconConfig, index2pubkey: Index2PubkeyCache, state: CachedBeaconStateAllForks, signedVoluntaryExit: phase0.SignedVoluntaryExit): boolean;
5
+ export declare function verifyVoluntaryExitSignature(config: BeaconConfig, index2pubkey: Index2PubkeyCache, stateSlot: Slot, signedVoluntaryExit: phase0.SignedVoluntaryExit): boolean;
7
6
  /**
8
7
  * Extract signatures to allow validating all block signatures at once
9
8
  */
10
- export declare function getVoluntaryExitSignatureSet(config: BeaconConfig, index2pubkey: Index2PubkeyCache, state: CachedBeaconStateAllForks, signedVoluntaryExit: phase0.SignedVoluntaryExit): ISignatureSet;
11
- export declare function getVoluntaryExitsSignatureSets(config: BeaconConfig, index2pubkey: Index2PubkeyCache, state: CachedBeaconStateAllForks, signedBlock: SignedBeaconBlock): ISignatureSet[];
9
+ export declare function getVoluntaryExitSignatureSet(config: BeaconConfig, index2pubkey: Index2PubkeyCache, stateSlot: Slot, signedVoluntaryExit: phase0.SignedVoluntaryExit): ISignatureSet;
10
+ export declare function getVoluntaryExitsSignatureSets(config: BeaconConfig, index2pubkey: Index2PubkeyCache, signedBlock: SignedBeaconBlock): ISignatureSet[];
12
11
  //# 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;AAC9C,OAAO,EAAC,iBAAiB,EAAE,MAAM,EAAM,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAC,iBAAiB,EAAC,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAC,yBAAyB,EAAC,MAAM,aAAa,CAAC;AACtD,OAAO,EACL,aAAa,EAKd,MAAM,kBAAkB,CAAC;AAE1B,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,iBAAiB,EAC/B,KAAK,EAAE,yBAAyB,EAChC,mBAAmB,EAAE,MAAM,CAAC,mBAAmB,GAC9C,OAAO,CAET;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,iBAAiB,EAC/B,KAAK,EAAE,yBAAyB,EAChC,mBAAmB,EAAE,MAAM,CAAC,mBAAmB,GAC9C,aAAa,CAUf;AAED,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,iBAAiB,EAC/B,KAAK,EAAE,yBAAyB,EAChC,WAAW,EAAE,iBAAiB,GAC7B,aAAa,EAAE,CAIjB"}
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,iBAAiB,EAAE,IAAI,EAAE,MAAM,EAAM,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAC,iBAAiB,EAAC,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EACL,aAAa,EAKd,MAAM,kBAAkB,CAAC;AAE1B,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,iBAAiB,EAC/B,SAAS,EAAE,IAAI,EACf,mBAAmB,EAAE,MAAM,CAAC,mBAAmB,GAC9C,OAAO,CAET;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,iBAAiB,EAC/B,SAAS,EAAE,IAAI,EACf,mBAAmB,EAAE,MAAM,CAAC,mBAAmB,GAC9C,aAAa,CAUf;AAED,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,iBAAiB,EAC/B,WAAW,EAAE,iBAAiB,GAC7B,aAAa,EAAE,CAOjB"}
@@ -1,14 +1,14 @@
1
1
  import { ssz } from "@lodestar/types";
2
2
  import { SignatureSetType, computeSigningRoot, computeStartSlotAtEpoch, verifySignatureSet, } from "../util/index.js";
3
- export function verifyVoluntaryExitSignature(config, index2pubkey, state, signedVoluntaryExit) {
4
- return verifySignatureSet(getVoluntaryExitSignatureSet(config, index2pubkey, state, signedVoluntaryExit));
3
+ export function verifyVoluntaryExitSignature(config, index2pubkey, stateSlot, signedVoluntaryExit) {
4
+ return verifySignatureSet(getVoluntaryExitSignatureSet(config, index2pubkey, stateSlot, signedVoluntaryExit));
5
5
  }
6
6
  /**
7
7
  * Extract signatures to allow validating all block signatures at once
8
8
  */
9
- export function getVoluntaryExitSignatureSet(config, index2pubkey, state, signedVoluntaryExit) {
10
- const slot = computeStartSlotAtEpoch(signedVoluntaryExit.message.epoch);
11
- const domain = config.getDomainForVoluntaryExit(state.slot, slot);
9
+ export function getVoluntaryExitSignatureSet(config, index2pubkey, stateSlot, signedVoluntaryExit) {
10
+ const messageSlot = computeStartSlotAtEpoch(signedVoluntaryExit.message.epoch);
11
+ const domain = config.getDomainForVoluntaryExit(stateSlot, messageSlot);
12
12
  return {
13
13
  type: SignatureSetType.single,
14
14
  pubkey: index2pubkey[signedVoluntaryExit.message.validatorIndex],
@@ -16,7 +16,10 @@ export function getVoluntaryExitSignatureSet(config, index2pubkey, state, signed
16
16
  signature: signedVoluntaryExit.signature,
17
17
  };
18
18
  }
19
- export function getVoluntaryExitsSignatureSets(config, index2pubkey, state, signedBlock) {
20
- return signedBlock.message.body.voluntaryExits.map((voluntaryExit) => getVoluntaryExitSignatureSet(config, index2pubkey, state, voluntaryExit));
19
+ export function getVoluntaryExitsSignatureSets(config, index2pubkey, signedBlock) {
20
+ // the getDomain() api requires the state slot as 1st param, however it's the same to block.slot in state-transition
21
+ // and the same epoch when we verify blocks in batch in beacon-node. So we can safely use block.slot here.
22
+ const blockSlot = signedBlock.message.slot;
23
+ return signedBlock.message.body.voluntaryExits.map((voluntaryExit) => getVoluntaryExitSignatureSet(config, index2pubkey, blockSlot, voluntaryExit));
21
24
  }
22
25
  //# sourceMappingURL=voluntaryExits.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"voluntaryExits.js","sourceRoot":"","sources":["../../src/signatureSets/voluntaryExits.ts"],"names":[],"mappings":"AACA,OAAO,EAA4B,GAAG,EAAC,MAAM,iBAAiB,CAAC;AAG/D,OAAO,EAEL,gBAAgB,EAChB,kBAAkB,EAClB,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,UAAU,4BAA4B,CAC1C,MAAoB,EACpB,YAA+B,EAC/B,KAAgC,EAChC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xB,yBAAyB,CACvB,YAAY,EAAE,KAAK,EACnB,eAAe,EAAE,MAAM,EAAE,EACzB,KAAK,EAAE,MAAM,EAAE,EACf,iBAAiB,EAAE,OAAO,EAAE,EAC5B,iBAAiB,EAAE,OAAO,EAAE,EAC5B,QAAQ,CAAC,EAAE,MAAM,EAAE,GAClB,IAAI,CAAC;CACT;AAED;;GAEG;AACH,oBAAY,gBAAgB;IAC1B,eAAe,oBAAoB;IACnC,YAAY,iBAAiB;CAC9B;AAED;;GAEG;AACH,oBAAY,uBAAuB;IACjC,eAAe,qBAAqB;IACpC,eAAe,qBAAqB;IACpC,eAAe,sBAAsB;IACrC,gBAAgB,uBAAuB;IACvC,UAAU,gBAAgB;IAC1B,mBAAmB,2BAA2B;CAC/C;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,yBAAyB,EAChC,WAAW,EAAE,iBAAiB,GAAG,wBAAwB,EACzD,OAAO,GAAE,mBAIR,EACD,EAAC,OAAO,EAAE,gBAAgB,EAAC,GAAE,sBAA2B,GACvD,yBAAyB,CA8D3B;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,yBAAyB,EAChC,IAAI,EAAE,IAAI,EACV,wBAAwB,CAAC,EAAE,wBAAwB,GAAG;IAAC,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAAC,EACnF,EAAC,OAAO,EAAE,gBAAgB,EAAC,GAAE,sBAA2B,GACvD,yBAAyB,CAiB3B"}
@@ -52,8 +52,7 @@ export function stateTransition(state, signedBlock, options = {
52
52
  // Includes state upgrades
53
53
  postState = processSlotsWithTransientCache(postState, blockSlot, options, { metrics, validatorMonitor });
54
54
  // Verify proposer signature only
55
- if (verifyProposer &&
56
- !verifyProposerSignature(postState.config, postState.epochCtx.index2pubkey, postState, signedBlock)) {
55
+ if (verifyProposer && !verifyProposerSignature(postState.config, postState.epochCtx.index2pubkey, signedBlock)) {
57
56
  throw new Error("Invalid block signature");
58
57
  }
59
58
  // Process block
@@ -1 +1 @@
1
- {"version":3,"file":"stateTransition.js","sourceRoot":"","sources":["../src/stateTransition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAA2D,GAAG,EAAC,MAAM,iBAAiB,CAAC;AAC9F,OAAO,EAAC,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAoB,sBAAsB,EAAE,sBAAsB,EAAC,MAAM,yBAAyB,CAAC;AAC1G,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAiD,kBAAkB,EAAC,MAAM,iCAAiC,CAAC;AACnH,OAAO,EAAC,mBAAmB,EAAE,YAAY,EAAC,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAA+B,kBAAkB,EAAE,mBAAmB,EAAC,MAAM,cAAc,CAAC;AACnG,OAAO,EAAC,uBAAuB,EAAC,MAAM,0BAA0B,CAAC;AACjE,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAC,kBAAkB,EAAC,MAAM,8BAA8B,CAAC;AAWhE,OAAO,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AA8BnD;;GAEG;AACH,MAAM,CAAN,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,uDAAmC,CAAA;IACnC,iDAA6B,CAAA;AAC/B,CAAC,EAHW,gBAAgB,KAAhB,gBAAgB,QAG3B;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,uBAOX;AAPD,WAAY,uBAAuB;IACjC,+DAAoC,CAAA;IACpC,+DAAoC,CAAA;IACpC,gEAAqC,CAAA;IACrC,kEAAuC,CAAA;IACvC,qDAA0B,CAAA;IAC1B,yEAA8C,CAAA;AAChD,CAAC,EAPW,uBAAuB,KAAvB,uBAA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U,KAAK,MAAM,CAAC,gBAAgB,EAAE,CAAC;gBAC3C,SAAS,GAAG,mBAAmB,CAAC,SAAkC,CAA8B,CAAC;YACnG,CAAC;YAED,CAAC;gBACC,MAAM,KAAK,GAAG,OAAO,EAAE,uBAAuB,CAAC,UAAU,CAAC,EAAC,IAAI,EAAE,mBAAmB,CAAC,iBAAiB,EAAC,CAAC,CAAC;gBACzG,uHAAuH;gBACvH,SAAS,CAAC,QAAQ,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;gBAChD,KAAK,EAAE,EAAE,CAAC;YACZ,CAAC;YAED,+GAA+G;YAC/G,0GAA0G;YAC1G,CAAC;gBACC,MAAM,KAAK,GAAG,OAAO,EAAE,yBAAyB,CAAC,UAAU,EAAE,CAAC;gBAC9D,SAAS,CAAC,MAAM,EAAE,CAAC;gBACnB,KAAK,EAAE,EAAE,CAAC;YACZ,CAAC;YAED,oIAAoI;YACpI,oBAAoB,EAAE,EAAE,CAAC;QAC3B,CAAC;aAAM,CAAC;YACN,SAAS,CAAC,IAAI,EAAE,CAAC;QACnB,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,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.39.0-dev.b255111a20",
14
+ "version": "1.39.0-dev.b6bba4cb8c",
15
15
  "type": "module",
16
16
  "exports": {
17
17
  ".": {
@@ -62,10 +62,10 @@
62
62
  "@chainsafe/pubkey-index-map": "^3.0.0",
63
63
  "@chainsafe/ssz": "^1.2.2",
64
64
  "@chainsafe/swap-or-not-shuffle": "^1.2.1",
65
- "@lodestar/config": "1.39.0-dev.b255111a20",
66
- "@lodestar/params": "1.39.0-dev.b255111a20",
67
- "@lodestar/types": "1.39.0-dev.b255111a20",
68
- "@lodestar/utils": "1.39.0-dev.b255111a20",
65
+ "@lodestar/config": "1.39.0-dev.b6bba4cb8c",
66
+ "@lodestar/params": "1.39.0-dev.b6bba4cb8c",
67
+ "@lodestar/types": "1.39.0-dev.b6bba4cb8c",
68
+ "@lodestar/utils": "1.39.0-dev.b6bba4cb8c",
69
69
  "bigint-buffer": "^1.1.5"
70
70
  },
71
71
  "keywords": [
@@ -74,5 +74,5 @@
74
74
  "beacon",
75
75
  "blockchain"
76
76
  ],
77
- "gitHead": "fef01ee3907fe176b3c98c0328bcf297025b8632"
77
+ "gitHead": "0218a7a470c8b2afbf0f1fd407863bc1be198b59"
78
78
  }
@@ -21,7 +21,7 @@ export function isValidIndexedAttestation(
21
21
  }
22
22
 
23
23
  if (verifySignature) {
24
- return verifySignatureSet(getIndexedAttestationSignatureSet(config, index2pubkey, state, indexedAttestation));
24
+ return verifySignatureSet(getIndexedAttestationSignatureSet(config, index2pubkey, state.slot, indexedAttestation));
25
25
  }
26
26
  return true;
27
27
  }
@@ -38,7 +38,9 @@ export function isValidIndexedAttestationBigint(
38
38
  }
39
39
 
40
40
  if (verifySignature) {
41
- return verifySignatureSet(getIndexedAttestationBigintSignatureSet(config, index2pubkey, state, indexedAttestation));
41
+ return verifySignatureSet(
42
+ getIndexedAttestationBigintSignatureSet(config, index2pubkey, state.slot, indexedAttestation)
43
+ );
42
44
  }
43
45
  return true;
44
46
  }
@@ -67,7 +67,7 @@ export function processAttestationsAltair(
67
67
  const sigSet = getAttestationWithIndicesSignatureSet(
68
68
  state.config,
69
69
  epochCtx.index2pubkey,
70
- state,
70
+ state.slot,
71
71
  attestation,
72
72
  attestingIndices
73
73
  );
@@ -80,7 +80,7 @@ export function assertValidProposerSlashing(
80
80
  const signatureSets = getProposerSlashingSignatureSets(
81
81
  state.config,
82
82
  state.epochCtx.index2pubkey,
83
- state,
83
+ state.slot,
84
84
  proposerSlashing
85
85
  );
86
86
  for (let i = 0; i < signatureSets.length; i++) {
@@ -12,12 +12,12 @@ import {getRandaoMix} from "../util/index.js";
12
12
  * PERF: Fixed work independent of block contents.
13
13
  */
14
14
  export function processRandao(state: CachedBeaconStateAllForks, block: BeaconBlock, verifySignature = true): void {
15
- const {epochCtx} = state;
15
+ const {epochCtx, config} = state;
16
16
  const epoch = epochCtx.epoch;
17
17
  const randaoReveal = block.body.randaoReveal;
18
18
 
19
19
  // verify RANDAO reveal
20
- if (verifySignature && !verifyRandaoSignature(state.config, epochCtx.index2pubkey, state, block)) {
20
+ if (verifySignature && !verifyRandaoSignature(config, epochCtx.index2pubkey, block)) {
21
21
  throw new Error("RANDAO reveal is an invalid signature");
22
22
  }
23
23
 
@@ -3,6 +3,7 @@ import {BeaconConfig} from "@lodestar/config";
3
3
  import {DOMAIN_SYNC_COMMITTEE, SYNC_COMMITTEE_SIZE} from "@lodestar/params";
4
4
  import {altair, ssz} from "@lodestar/types";
5
5
  import {Index2PubkeyCache} from "../cache/pubkeyCache.js";
6
+ import {SyncCommitteeCache} from "../cache/syncCommitteeCache.js";
6
7
  import {G2_POINT_AT_INFINITY} from "../constants/index.js";
7
8
  import {CachedBeaconStateAllForks} from "../types.js";
8
9
  import {
@@ -28,7 +29,7 @@ export function processSyncAggregate(
28
29
  const signatureSet = getSyncCommitteeSignatureSet(
29
30
  state.config,
30
31
  state.epochCtx.index2pubkey,
31
- state,
32
+ state.epochCtx.currentSyncCommitteeIndexed,
32
33
  block,
33
34
  participantIndices
34
35
  );
@@ -73,7 +74,7 @@ export function processSyncAggregate(
73
74
  export function getSyncCommitteeSignatureSet(
74
75
  config: BeaconConfig,
75
76
  index2pubkey: Index2PubkeyCache,
76
- state: CachedBeaconStateAllForks,
77
+ currentSyncCommitteeIndexed: SyncCommitteeCache,
77
78
  block: altair.BeaconBlock,
78
79
  /** Optional parameter to prevent computing it twice */
79
80
  participantIndices?: number[]
@@ -101,7 +102,7 @@ export function getSyncCommitteeSignatureSet(
101
102
  const rootSigned = block.parentRoot;
102
103
 
103
104
  if (!participantIndices) {
104
- const committeeIndices = state.epochCtx.currentSyncCommitteeIndexed.validatorIndices;
105
+ const committeeIndices = currentSyncCommitteeIndexed.validatorIndices;
105
106
  participantIndices = syncAggregate.syncCommitteeBits.intersectValues(committeeIndices);
106
107
  }
107
108
 
@@ -115,7 +116,9 @@ export function getSyncCommitteeSignatureSet(
115
116
  throw Error("Empty sync committee signature is not infinity");
116
117
  }
117
118
 
118
- const domain = config.getDomain(state.slot, DOMAIN_SYNC_COMMITTEE, previousSlot);
119
+ // the getDomain() api requires the state slot as 1st param, however it's the same to block.slot in state-transition
120
+ // and the same epoch when we verify blocks in batch in beacon-node. So we can safely use block.slot here.
121
+ const domain = config.getDomain(block.slot, DOMAIN_SYNC_COMMITTEE, previousSlot);
119
122
 
120
123
  return {
121
124
  type: SignatureSetType.aggregate,
@@ -76,7 +76,7 @@ export function getVoluntaryExitValidity(
76
76
 
77
77
  if (
78
78
  verifySignature &&
79
- !verifyVoluntaryExitSignature(state.config, epochCtx.index2pubkey, state, signedVoluntaryExit)
79
+ !verifyVoluntaryExitSignature(state.config, epochCtx.index2pubkey, state.slot, signedVoluntaryExit)
80
80
  ) {
81
81
  return VoluntaryExitValidity.invalidSignature;
82
82
  }
@@ -1,19 +1,20 @@
1
1
  import {BeaconConfig} from "@lodestar/config";
2
2
  import {DOMAIN_BEACON_ATTESTER} from "@lodestar/params";
3
- import {AttesterSlashing, IndexedAttestationBigint, SignedBeaconBlock, ssz} from "@lodestar/types";
3
+ import {AttesterSlashing, IndexedAttestationBigint, SignedBeaconBlock, Slot, ssz} from "@lodestar/types";
4
4
  import {Index2PubkeyCache} from "../cache/pubkeyCache.js";
5
- import {CachedBeaconStateAllForks} from "../types.js";
6
5
  import {ISignatureSet, SignatureSetType, computeSigningRoot, computeStartSlotAtEpoch} from "../util/index.js";
7
6
 
8
7
  /** Get signature sets from all AttesterSlashing objects in a block */
9
8
  export function getAttesterSlashingsSignatureSets(
10
9
  config: BeaconConfig,
11
10
  index2pubkey: Index2PubkeyCache,
12
- state: CachedBeaconStateAllForks,
13
11
  signedBlock: SignedBeaconBlock
14
12
  ): ISignatureSet[] {
13
+ // the getDomain() api requires the state slot as 1st param, however it's the same to block.slot in state-transition
14
+ // and the same epoch when we verify blocks in batch in beacon-node. So we can safely use block.slot here.
15
+ const blockSlot = signedBlock.message.slot;
15
16
  return signedBlock.message.body.attesterSlashings.flatMap((attesterSlashing) =>
16
- getAttesterSlashingSignatureSets(config, index2pubkey, state, attesterSlashing)
17
+ getAttesterSlashingSignatureSets(config, index2pubkey, blockSlot, attesterSlashing)
17
18
  );
18
19
  }
19
20
 
@@ -21,22 +22,22 @@ export function getAttesterSlashingsSignatureSets(
21
22
  export function getAttesterSlashingSignatureSets(
22
23
  config: BeaconConfig,
23
24
  index2pubkey: Index2PubkeyCache,
24
- state: CachedBeaconStateAllForks,
25
+ stateSlot: Slot,
25
26
  attesterSlashing: AttesterSlashing
26
27
  ): ISignatureSet[] {
27
28
  return [attesterSlashing.attestation1, attesterSlashing.attestation2].map((attestation) =>
28
- getIndexedAttestationBigintSignatureSet(config, index2pubkey, state, attestation)
29
+ getIndexedAttestationBigintSignatureSet(config, index2pubkey, stateSlot, attestation)
29
30
  );
30
31
  }
31
32
 
32
33
  export function getIndexedAttestationBigintSignatureSet(
33
34
  config: BeaconConfig,
34
35
  index2pubkey: Index2PubkeyCache,
35
- state: CachedBeaconStateAllForks,
36
+ stateSlot: Slot,
36
37
  indexedAttestation: IndexedAttestationBigint
37
38
  ): ISignatureSet {
38
- const slot = computeStartSlotAtEpoch(Number(indexedAttestation.data.target.epoch as bigint));
39
- const domain = config.getDomain(state.slot, DOMAIN_BEACON_ATTESTER, slot);
39
+ const messageSlot = computeStartSlotAtEpoch(Number(indexedAttestation.data.target.epoch as bigint));
40
+ const domain = config.getDomain(stateSlot, DOMAIN_BEACON_ATTESTER, messageSlot);
40
41
 
41
42
  return {
42
43
  type: SignatureSetType.aggregate,
@@ -3,7 +3,7 @@ import {ForkSeq} from "@lodestar/params";
3
3
  import {IndexedAttestation, SignedBeaconBlock, altair, capella} from "@lodestar/types";
4
4
  import {getSyncCommitteeSignatureSet} from "../block/processSyncCommittee.js";
5
5
  import {Index2PubkeyCache} from "../cache/pubkeyCache.js";
6
- import {CachedBeaconStateAllForks, CachedBeaconStateAltair} from "../types.js";
6
+ import {SyncCommitteeCache} from "../cache/syncCommitteeCache.js";
7
7
  import {ISignatureSet} from "../util/index.js";
8
8
  import {getAttesterSlashingsSignatureSets} from "./attesterSlashings.js";
9
9
  import {getBlsToExecutionChangeSignatureSets} from "./blsToExecutionChange.js";
@@ -29,7 +29,7 @@ export * from "./voluntaryExits.js";
29
29
  export function getBlockSignatureSets(
30
30
  config: BeaconConfig,
31
31
  index2pubkey: Index2PubkeyCache,
32
- state: CachedBeaconStateAllForks,
32
+ currentSyncCommitteeIndexed: SyncCommitteeCache,
33
33
  signedBlock: SignedBeaconBlock,
34
34
  indexedAttestations: IndexedAttestation[],
35
35
  opts?: {
@@ -38,18 +38,18 @@ export function getBlockSignatureSets(
38
38
  }
39
39
  ): ISignatureSet[] {
40
40
  // fork based validations
41
- const fork = state.config.getForkSeq(signedBlock.message.slot);
41
+ const fork = config.getForkSeq(signedBlock.message.slot);
42
42
 
43
43
  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),
44
+ getRandaoRevealSignatureSet(config, index2pubkey, signedBlock.message),
45
+ ...getProposerSlashingsSignatureSets(config, index2pubkey, signedBlock),
46
+ ...getAttesterSlashingsSignatureSets(config, index2pubkey, signedBlock),
47
+ ...getAttestationsSignatureSets(config, index2pubkey, signedBlock, indexedAttestations),
48
+ ...getVoluntaryExitsSignatureSets(config, index2pubkey, signedBlock),
49
49
  ];
50
50
 
51
51
  if (!opts?.skipProposerSignature) {
52
- signatureSets.push(getBlockProposerSignatureSet(config, index2pubkey, state, signedBlock));
52
+ signatureSets.push(getBlockProposerSignatureSet(config, index2pubkey, signedBlock));
53
53
  }
54
54
 
55
55
  // Only after altair fork, validate tSyncCommitteeSignature
@@ -57,7 +57,7 @@ export function getBlockSignatureSets(
57
57
  const syncCommitteeSignatureSet = getSyncCommitteeSignatureSet(
58
58
  config,
59
59
  index2pubkey,
60
- state as CachedBeaconStateAltair,
60
+ currentSyncCommitteeIndexed,
61
61
  (signedBlock as altair.SignedBeaconBlock).message
62
62
  );
63
63
  // There may be no participants in this syncCommitteeSignature, so it must not be validated
@@ -69,7 +69,7 @@ export function getBlockSignatureSets(
69
69
  // only after capella fork
70
70
  if (fork >= ForkSeq.capella) {
71
71
  const blsToExecutionChangeSignatureSets = getBlsToExecutionChangeSignatureSets(
72
- state.config,
72
+ config,
73
73
  signedBlock as capella.SignedBeaconBlock
74
74
  );
75
75
  if (blsToExecutionChangeSignatureSets.length > 0) {
@@ -1,8 +1,7 @@
1
1
  import {BeaconConfig} from "@lodestar/config";
2
2
  import {DOMAIN_BEACON_ATTESTER} from "@lodestar/params";
3
- import {IndexedAttestation, SignedBeaconBlock, phase0, ssz} from "@lodestar/types";
3
+ import {IndexedAttestation, SignedBeaconBlock, Slot, phase0, ssz} from "@lodestar/types";
4
4
  import {Index2PubkeyCache} from "../cache/pubkeyCache.js";
5
- import {CachedBeaconStateAllForks} from "../types.js";
6
5
  import {
7
6
  ISignatureSet,
8
7
  computeSigningRoot,
@@ -12,11 +11,11 @@ import {
12
11
 
13
12
  export function getAttestationDataSigningRoot(
14
13
  config: BeaconConfig,
15
- state: CachedBeaconStateAllForks,
14
+ stateSlot: Slot,
16
15
  data: phase0.AttestationData
17
16
  ): Uint8Array {
18
- const slot = computeStartSlotAtEpoch(data.target.epoch);
19
- const domain = config.getDomain(state.slot, DOMAIN_BEACON_ATTESTER, slot);
17
+ const messageSlot = computeStartSlotAtEpoch(data.target.epoch);
18
+ const domain = config.getDomain(stateSlot, DOMAIN_BEACON_ATTESTER, messageSlot);
20
19
 
21
20
  return computeSigningRoot(ssz.phase0.AttestationData, data, domain);
22
21
  }
@@ -24,13 +23,13 @@ export function getAttestationDataSigningRoot(
24
23
  export function getAttestationWithIndicesSignatureSet(
25
24
  config: BeaconConfig,
26
25
  index2pubkey: Index2PubkeyCache,
27
- state: CachedBeaconStateAllForks,
26
+ stateSlot: Slot,
28
27
  attestation: Pick<phase0.Attestation, "data" | "signature">,
29
28
  attestingIndices: number[]
30
29
  ): ISignatureSet {
31
30
  return createAggregateSignatureSetFromComponents(
32
31
  attestingIndices.map((i) => index2pubkey[i]),
33
- getAttestationDataSigningRoot(config, state, attestation.data),
32
+ getAttestationDataSigningRoot(config, stateSlot, attestation.data),
34
33
  attestation.signature
35
34
  );
36
35
  }
@@ -38,13 +37,13 @@ export function getAttestationWithIndicesSignatureSet(
38
37
  export function getIndexedAttestationSignatureSet(
39
38
  config: BeaconConfig,
40
39
  index2pubkey: Index2PubkeyCache,
41
- state: CachedBeaconStateAllForks,
40
+ stateSlot: Slot,
42
41
  indexedAttestation: IndexedAttestation
43
42
  ): ISignatureSet {
44
43
  return getAttestationWithIndicesSignatureSet(
45
44
  config,
46
45
  index2pubkey,
47
- state,
46
+ stateSlot,
48
47
  indexedAttestation,
49
48
  indexedAttestation.attestingIndices
50
49
  );
@@ -53,7 +52,6 @@ export function getIndexedAttestationSignatureSet(
53
52
  export function getAttestationsSignatureSets(
54
53
  config: BeaconConfig,
55
54
  index2pubkey: Index2PubkeyCache,
56
- state: CachedBeaconStateAllForks,
57
55
  signedBlock: SignedBeaconBlock,
58
56
  indexedAttestations: IndexedAttestation[]
59
57
  ): ISignatureSet[] {
@@ -62,7 +60,10 @@ export function getAttestationsSignatureSets(
62
60
  `Indexed attestations length mismatch: got ${indexedAttestations.length}, expected ${signedBlock.message.body.attestations.length}`
63
61
  );
64
62
  }
63
+ // the getDomain() api requires the state slot as 1st param, however it's the same to block.slot in state-transition
64
+ // and the same epoch when we verify blocks in batch in beacon-node. So we can safely use block.slot here.
65
+ const blockSlot = signedBlock.message.slot;
65
66
  return indexedAttestations.map((indexedAttestation) =>
66
- getIndexedAttestationSignatureSet(config, index2pubkey, state, indexedAttestation)
67
+ getIndexedAttestationSignatureSet(config, index2pubkey, blockSlot, indexedAttestation)
67
68
  );
68
69
  }
@@ -9,20 +9,21 @@ import {ISignatureSet, SignatureSetType, verifySignatureSet} from "../util/signa
9
9
  export function verifyProposerSignature(
10
10
  config: BeaconConfig,
11
11
  index2pubkey: Index2PubkeyCache,
12
- state: CachedBeaconStateAllForks,
13
12
  signedBlock: SignedBeaconBlock | SignedBlindedBeaconBlock
14
13
  ): boolean {
15
- const signatureSet = getBlockProposerSignatureSet(config, index2pubkey, state, signedBlock);
14
+ const signatureSet = getBlockProposerSignatureSet(config, index2pubkey, signedBlock);
16
15
  return verifySignatureSet(signatureSet);
17
16
  }
18
17
 
19
18
  export function getBlockProposerSignatureSet(
20
19
  config: BeaconConfig,
21
20
  index2pubkey: Index2PubkeyCache,
22
- state: CachedBeaconStateAllForks,
23
21
  signedBlock: SignedBeaconBlock | SignedBlindedBeaconBlock
24
22
  ): ISignatureSet {
25
- const domain = config.getDomain(state.slot, DOMAIN_BEACON_PROPOSER, signedBlock.message.slot);
23
+ // the getDomain() api requires the state slot as 1st param, however it's the same to block.slot in state-transition
24
+ // and the same epoch when we verify blocks in batch in beacon-node. So we can safely use block.slot here.
25
+ const blockSlot = signedBlock.message.slot;
26
+ const domain = config.getDomain(blockSlot, DOMAIN_BEACON_PROPOSER, blockSlot);
26
27
 
27
28
  const blockType = isBlindedBeaconBlock(signedBlock.message)
28
29
  ? config.getPostBellatrixForkTypes(signedBlock.message.slot).BlindedBeaconBlock
@@ -1,8 +1,7 @@
1
1
  import {BeaconConfig} from "@lodestar/config";
2
2
  import {DOMAIN_BEACON_PROPOSER} from "@lodestar/params";
3
- import {SignedBeaconBlock, phase0, ssz} from "@lodestar/types";
3
+ import {SignedBeaconBlock, Slot, phase0, ssz} from "@lodestar/types";
4
4
  import {Index2PubkeyCache} from "../cache/pubkeyCache.js";
5
- import {CachedBeaconStateAllForks} from "../types.js";
6
5
  import {ISignatureSet, SignatureSetType, computeSigningRoot} from "../util/index.js";
7
6
 
8
7
  /**
@@ -11,7 +10,7 @@ import {ISignatureSet, SignatureSetType, computeSigningRoot} from "../util/index
11
10
  export function getProposerSlashingSignatureSets(
12
11
  config: BeaconConfig,
13
12
  index2pubkey: Index2PubkeyCache,
14
- state: CachedBeaconStateAllForks,
13
+ stateSlot: Slot,
15
14
  proposerSlashing: phase0.ProposerSlashing
16
15
  ): ISignatureSet[] {
17
16
  const pubkey = index2pubkey[proposerSlashing.signedHeader1.message.proposerIndex];
@@ -19,7 +18,7 @@ export function getProposerSlashingSignatureSets(
19
18
  // In state transition, ProposerSlashing headers are only partially validated. Their slot could be higher than the
20
19
  // clock and the slashing would still be valid. Must use bigint variants to hash correctly to all possible values
21
20
  return [proposerSlashing.signedHeader1, proposerSlashing.signedHeader2].map((signedHeader): ISignatureSet => {
22
- const domain = config.getDomain(state.slot, DOMAIN_BEACON_PROPOSER, Number(signedHeader.message.slot as bigint));
21
+ const domain = config.getDomain(stateSlot, DOMAIN_BEACON_PROPOSER, Number(signedHeader.message.slot as bigint));
23
22
 
24
23
  return {
25
24
  type: SignatureSetType.single,
@@ -33,10 +32,12 @@ export function getProposerSlashingSignatureSets(
33
32
  export function getProposerSlashingsSignatureSets(
34
33
  config: BeaconConfig,
35
34
  index2pubkey: Index2PubkeyCache,
36
- state: CachedBeaconStateAllForks,
37
35
  signedBlock: SignedBeaconBlock
38
36
  ): ISignatureSet[] {
37
+ // the getDomain() api requires the state slot as 1st param, however it's the same to block.slot in state-transition
38
+ // and the same epoch when we verify blocks in batch in beacon-node. So we can safely use block.slot here.
39
+ const blockSlot = signedBlock.message.slot;
39
40
  return signedBlock.message.body.proposerSlashings.flatMap((proposerSlashing) =>
40
- getProposerSlashingSignatureSets(config, index2pubkey, state, proposerSlashing)
41
+ getProposerSlashingSignatureSets(config, index2pubkey, blockSlot, proposerSlashing)
41
42
  );
42
43
  }
@@ -2,7 +2,6 @@ import {BeaconConfig} from "@lodestar/config";
2
2
  import {DOMAIN_RANDAO} from "@lodestar/params";
3
3
  import {BeaconBlock, ssz} from "@lodestar/types";
4
4
  import {Index2PubkeyCache} from "../cache/pubkeyCache.js";
5
- import {CachedBeaconStateAllForks} from "../types.js";
6
5
  import {
7
6
  ISignatureSet,
8
7
  SignatureSetType,
@@ -14,10 +13,9 @@ import {
14
13
  export function verifyRandaoSignature(
15
14
  config: BeaconConfig,
16
15
  index2pubkey: Index2PubkeyCache,
17
- state: CachedBeaconStateAllForks,
18
16
  block: BeaconBlock
19
17
  ): boolean {
20
- return verifySignatureSet(getRandaoRevealSignatureSet(config, index2pubkey, state, block));
18
+ return verifySignatureSet(getRandaoRevealSignatureSet(config, index2pubkey, block));
21
19
  }
22
20
 
23
21
  /**
@@ -26,12 +24,13 @@ export function verifyRandaoSignature(
26
24
  export function getRandaoRevealSignatureSet(
27
25
  config: BeaconConfig,
28
26
  index2pubkey: Index2PubkeyCache,
29
- 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
+ // the getDomain() api requires the state slot as 1st param, however it's the same to block.slot in state-transition
32
+ // and the same epoch when we verify blocks in batch in beacon-node. So we can safely use block.slot here.
33
+ const domain = config.getDomain(block.slot, DOMAIN_RANDAO, block.slot);
35
34
 
36
35
  return {
37
36
  type: SignatureSetType.single,