@lodestar/validator 1.41.0-dev.9fa839a030 → 1.41.0-dev.aeab9f930d

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 (114) hide show
  1. package/lib/buckets.js +2 -1
  2. package/lib/buckets.js.map +1 -1
  3. package/lib/genesis.js.map +1 -1
  4. package/lib/index.d.ts +1 -0
  5. package/lib/index.d.ts.map +1 -1
  6. package/lib/index.js +1 -0
  7. package/lib/index.js.map +1 -1
  8. package/lib/metrics.d.ts +1 -1
  9. package/lib/metrics.d.ts.map +1 -1
  10. package/lib/metrics.js +4 -2
  11. package/lib/metrics.js.map +1 -1
  12. package/lib/repositories/metaDataRepository.d.ts.map +1 -1
  13. package/lib/repositories/metaDataRepository.js.map +1 -1
  14. package/lib/services/attestation.d.ts +0 -20
  15. package/lib/services/attestation.d.ts.map +1 -1
  16. package/lib/services/attestation.js +8 -3
  17. package/lib/services/attestation.js.map +1 -1
  18. package/lib/services/attestationDuties.d.ts +0 -20
  19. package/lib/services/attestationDuties.d.ts.map +1 -1
  20. package/lib/services/attestationDuties.js.map +1 -1
  21. package/lib/services/block.d.ts +1 -1
  22. package/lib/services/block.d.ts.map +1 -1
  23. package/lib/services/block.js +88 -1
  24. package/lib/services/block.js.map +1 -1
  25. package/lib/services/blockDuties.d.ts +0 -31
  26. package/lib/services/blockDuties.d.ts.map +1 -1
  27. package/lib/services/blockDuties.js.map +1 -1
  28. package/lib/services/chainHeaderTracker.d.ts.map +1 -1
  29. package/lib/services/chainHeaderTracker.js.map +1 -1
  30. package/lib/services/doppelgangerService.d.ts.map +1 -1
  31. package/lib/services/doppelgangerService.js +2 -1
  32. package/lib/services/doppelgangerService.js.map +1 -1
  33. package/lib/services/emitter.d.ts +1 -3
  34. package/lib/services/emitter.d.ts.map +1 -1
  35. package/lib/services/emitter.js +2 -1
  36. package/lib/services/emitter.js.map +1 -1
  37. package/lib/services/externalSignerSync.d.ts +1 -1
  38. package/lib/services/externalSignerSync.d.ts.map +1 -1
  39. package/lib/services/externalSignerSync.js +10 -3
  40. package/lib/services/externalSignerSync.js.map +1 -1
  41. package/lib/services/indices.d.ts +0 -2
  42. package/lib/services/indices.d.ts.map +1 -1
  43. package/lib/services/indices.js.map +1 -1
  44. package/lib/services/prepareBeaconProposer.js.map +1 -1
  45. package/lib/services/syncCommittee.d.ts +0 -19
  46. package/lib/services/syncCommittee.d.ts.map +1 -1
  47. package/lib/services/syncCommittee.js.map +1 -1
  48. package/lib/services/syncCommitteeDuties.d.ts +0 -20
  49. package/lib/services/syncCommitteeDuties.d.ts.map +1 -1
  50. package/lib/services/syncCommitteeDuties.js.map +1 -1
  51. package/lib/services/syncingStatusTracker.d.ts.map +1 -1
  52. package/lib/services/syncingStatusTracker.js.map +1 -1
  53. package/lib/services/utils.js.map +1 -1
  54. package/lib/services/validatorStore.d.ts +3 -2
  55. package/lib/services/validatorStore.d.ts.map +1 -1
  56. package/lib/services/validatorStore.js +35 -4
  57. package/lib/services/validatorStore.js.map +1 -1
  58. package/lib/slashingProtection/attestation/attestationByTargetRepository.d.ts.map +1 -1
  59. package/lib/slashingProtection/attestation/attestationByTargetRepository.js.map +1 -1
  60. package/lib/slashingProtection/attestation/attestationLowerBoundRepository.d.ts.map +1 -1
  61. package/lib/slashingProtection/attestation/attestationLowerBoundRepository.js.map +1 -1
  62. package/lib/slashingProtection/attestation/errors.js +2 -1
  63. package/lib/slashingProtection/attestation/errors.js.map +1 -1
  64. package/lib/slashingProtection/attestation/index.d.ts.map +1 -1
  65. package/lib/slashingProtection/attestation/index.js.map +1 -1
  66. package/lib/slashingProtection/block/blockBySlotRepository.d.ts.map +1 -1
  67. package/lib/slashingProtection/block/blockBySlotRepository.js.map +1 -1
  68. package/lib/slashingProtection/block/errors.js +2 -1
  69. package/lib/slashingProtection/block/errors.js.map +1 -1
  70. package/lib/slashingProtection/block/index.d.ts.map +1 -1
  71. package/lib/slashingProtection/block/index.js.map +1 -1
  72. package/lib/slashingProtection/index.d.ts.map +1 -1
  73. package/lib/slashingProtection/index.js.map +1 -1
  74. package/lib/slashingProtection/interchange/errors.js +2 -1
  75. package/lib/slashingProtection/interchange/errors.js.map +1 -1
  76. package/lib/slashingProtection/interchange/formats/completeV4.d.ts +1 -1
  77. package/lib/slashingProtection/interchange/formats/completeV4.d.ts.map +1 -1
  78. package/lib/slashingProtection/interchange/formats/completeV4.js.map +1 -1
  79. package/lib/slashingProtection/interchange/formats/v5.js.map +1 -1
  80. package/lib/slashingProtection/interchange/parseInterchange.js.map +1 -1
  81. package/lib/slashingProtection/interchange/serializeInterchange.js.map +1 -1
  82. package/lib/slashingProtection/minMaxSurround/distanceStoreRepository.d.ts.map +1 -1
  83. package/lib/slashingProtection/minMaxSurround/distanceStoreRepository.js.map +1 -1
  84. package/lib/slashingProtection/minMaxSurround/errors.js +2 -1
  85. package/lib/slashingProtection/minMaxSurround/errors.js.map +1 -1
  86. package/lib/slashingProtection/minMaxSurround/minMaxSurround.d.ts.map +1 -1
  87. package/lib/slashingProtection/minMaxSurround/minMaxSurround.js.map +1 -1
  88. package/lib/slashingProtection/utils.d.ts +1 -1
  89. package/lib/slashingProtection/utils.d.ts.map +1 -1
  90. package/lib/slashingProtection/utils.js.map +1 -1
  91. package/lib/util/batch.js.map +1 -1
  92. package/lib/util/clock.d.ts +0 -6
  93. package/lib/util/clock.d.ts.map +1 -1
  94. package/lib/util/clock.js +2 -1
  95. package/lib/util/clock.js.map +1 -1
  96. package/lib/util/difference.js.map +1 -1
  97. package/lib/util/externalSignerClient.d.ts +6 -2
  98. package/lib/util/externalSignerClient.d.ts.map +1 -1
  99. package/lib/util/externalSignerClient.js +6 -1
  100. package/lib/util/externalSignerClient.js.map +1 -1
  101. package/lib/util/format.js.map +1 -1
  102. package/lib/util/logger.js.map +1 -1
  103. package/lib/util/params.js.map +1 -1
  104. package/lib/util/url.js.map +1 -1
  105. package/lib/validator.d.ts +1 -1
  106. package/lib/validator.d.ts.map +1 -1
  107. package/lib/validator.js.map +1 -1
  108. package/package.json +14 -14
  109. package/src/index.ts +1 -0
  110. package/src/services/attestation.ts +8 -3
  111. package/src/services/block.ts +107 -1
  112. package/src/services/externalSignerSync.ts +12 -4
  113. package/src/services/validatorStore.ts +44 -2
  114. package/src/util/externalSignerClient.ts +8 -1
@@ -6,6 +6,7 @@ import {
6
6
  DOMAIN_AGGREGATE_AND_PROOF,
7
7
  DOMAIN_APPLICATION_BUILDER,
8
8
  DOMAIN_BEACON_ATTESTER,
9
+ DOMAIN_BEACON_BUILDER,
9
10
  DOMAIN_BEACON_PROPOSER,
10
11
  DOMAIN_CONTRIBUTION_AND_PROOF,
11
12
  DOMAIN_RANDAO,
@@ -39,6 +40,7 @@ import {
39
40
  ValidatorIndex,
40
41
  altair,
41
42
  bellatrix,
43
+ gloas,
42
44
  phase0,
43
45
  ssz,
44
46
  } from "@lodestar/types";
@@ -487,6 +489,38 @@ export class ValidatorStore {
487
489
  } as SignedBeaconBlock | SignedBlindedBeaconBlock;
488
490
  }
489
491
 
492
+ async signExecutionPayloadEnvelope(
493
+ pubkey: BLSPubkey,
494
+ envelope: gloas.ExecutionPayloadEnvelope,
495
+ currentSlot: Slot,
496
+ logger?: LoggerVc
497
+ ): Promise<gloas.SignedExecutionPayloadEnvelope> {
498
+ // Make sure the envelope slot is not higher than the current slot to avoid potential attacks.
499
+ if (envelope.slot > currentSlot) {
500
+ throw Error(`Not signing envelope with slot ${envelope.slot} greater than current slot ${currentSlot}`);
501
+ }
502
+
503
+ const signingSlot = envelope.slot;
504
+ const domain = this.config.getDomain(signingSlot, DOMAIN_BEACON_BUILDER);
505
+ const signingRoot = computeSigningRoot(ssz.gloas.ExecutionPayloadEnvelope, envelope, domain);
506
+
507
+ logger?.debug("Signing execution payload envelope", {
508
+ slot: signingSlot,
509
+ beaconBlockRoot: toRootHex(envelope.beaconBlockRoot),
510
+ signingRoot: toRootHex(signingRoot),
511
+ });
512
+
513
+ const signableMessage: SignableMessage = {
514
+ type: SignableMessageType.EXECUTION_PAYLOAD_ENVELOPE,
515
+ data: envelope,
516
+ };
517
+
518
+ return {
519
+ message: envelope,
520
+ signature: await this.getSignature(pubkey, signingRoot, signingSlot, signableMessage),
521
+ };
522
+ }
523
+
490
524
  async signRandao(pubkey: BLSPubkey, slot: Slot): Promise<BLSSignature> {
491
525
  const signingSlot = slot;
492
526
  const domain = this.config.getDomain(slot, DOMAIN_RANDAO);
@@ -797,13 +831,21 @@ export class ValidatorStore {
797
831
  throw Error(`Inconsistent duties during signing: duty.slot ${duty.slot} != att.slot ${data.slot}`);
798
832
  }
799
833
 
800
- const isPostElectra = this.config.getForkSeq(data.slot) >= ForkSeq.electra;
834
+ const forkSeq = this.config.getForkSeq(data.slot);
835
+ const isPostElectra = forkSeq >= ForkSeq.electra;
836
+ const isPostGloas = forkSeq >= ForkSeq.gloas;
837
+
801
838
  if (!isPostElectra && duty.committeeIndex !== data.index) {
802
839
  throw Error(
803
840
  `Inconsistent duties during signing: duty.committeeIndex ${duty.committeeIndex} != att.committeeIndex ${data.index}`
804
841
  );
805
842
  }
806
- if (isPostElectra && data.index !== 0) {
843
+ if (isPostGloas) {
844
+ // After Gloas, data.index signals payload status: 0 (EMPTY) or 1 (FULL)
845
+ if (data.index !== 0 && data.index !== 1) {
846
+ throw Error(`Invalid payload status index post-gloas during signing: data.index=${data.index}`);
847
+ }
848
+ } else if (isPostElectra && data.index !== 0) {
807
849
  throw Error(`Non-zero committee index post-electra during signing: att.committeeIndex ${data.index}`);
808
850
  }
809
851
  }
@@ -11,6 +11,7 @@ import {
11
11
  RootHex,
12
12
  Slot,
13
13
  altair,
14
+ gloas,
14
15
  phase0,
15
16
  ssz,
16
17
  sszTypesFor,
@@ -32,6 +33,7 @@ export enum SignableMessageType {
32
33
  SYNC_COMMITTEE_SELECTION_PROOF = "SYNC_COMMITTEE_SELECTION_PROOF",
33
34
  SYNC_COMMITTEE_CONTRIBUTION_AND_PROOF = "SYNC_COMMITTEE_CONTRIBUTION_AND_PROOF",
34
35
  VALIDATOR_REGISTRATION = "VALIDATOR_REGISTRATION",
36
+ EXECUTION_PAYLOAD_ENVELOPE = "EXECUTION_PAYLOAD_ENVELOPE",
35
37
  }
36
38
 
37
39
  const AggregationSlotType = new ContainerType({
@@ -80,7 +82,8 @@ export type SignableMessage =
80
82
  | {type: SignableMessageType.SYNC_COMMITTEE_MESSAGE; data: ValueOf<typeof SyncCommitteeMessageType>}
81
83
  | {type: SignableMessageType.SYNC_COMMITTEE_SELECTION_PROOF; data: ValueOf<typeof SyncAggregatorSelectionDataType>}
82
84
  | {type: SignableMessageType.SYNC_COMMITTEE_CONTRIBUTION_AND_PROOF; data: altair.ContributionAndProof}
83
- | {type: SignableMessageType.VALIDATOR_REGISTRATION; data: ValidatorRegistrationV1};
85
+ | {type: SignableMessageType.VALIDATOR_REGISTRATION; data: ValidatorRegistrationV1}
86
+ | {type: SignableMessageType.EXECUTION_PAYLOAD_ENVELOPE; data: gloas.ExecutionPayloadEnvelope};
84
87
 
85
88
  const requiresForkInfo: Record<SignableMessageType, boolean> = {
86
89
  [SignableMessageType.AGGREGATION_SLOT]: true,
@@ -95,6 +98,7 @@ const requiresForkInfo: Record<SignableMessageType, boolean> = {
95
98
  [SignableMessageType.SYNC_COMMITTEE_SELECTION_PROOF]: true,
96
99
  [SignableMessageType.SYNC_COMMITTEE_CONTRIBUTION_AND_PROOF]: true,
97
100
  [SignableMessageType.VALIDATOR_REGISTRATION]: false,
101
+ [SignableMessageType.EXECUTION_PAYLOAD_ENVELOPE]: true,
98
102
  };
99
103
 
100
104
  type Web3SignerSerializedRequest = {
@@ -266,6 +270,9 @@ function serializerSignableMessagePayload(config: BeaconConfig, payload: Signabl
266
270
 
267
271
  case SignableMessageType.VALIDATOR_REGISTRATION:
268
272
  return {validator_registration: ssz.bellatrix.ValidatorRegistrationV1.toJson(payload.data)};
273
+
274
+ case SignableMessageType.EXECUTION_PAYLOAD_ENVELOPE:
275
+ return {execution_payload_envelope: ssz.gloas.ExecutionPayloadEnvelope.toJson(payload.data)};
269
276
  }
270
277
  }
271
278