Skip to content

Commit

Permalink
chore: types and lint fixes (#6819)
Browse files Browse the repository at this point in the history
  • Loading branch information
g11tech committed Jul 1, 2024
1 parent c321062 commit d971d31
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ import {
import {IBeaconChain} from "..";
import {AttestationError, AttestationErrorCode, GossipAction} from "../errors/index.js";
import {RegenCaller} from "../regen/index.js";
import {
getSeenAttDataKeyFromSignedAggregateAndProof,
} from "../../util/sszBytes.js";
import {getSeenAttDataKeyFromSignedAggregateAndProof} from "../../util/sszBytes.js";
import {getSelectionProofSignatureSet, getAggregateAndProofSignatureSet} from "./signatureSets/index.js";
import {
getAttestationDataSigningRoot,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe("validate gossip attestation", () => {
attestation: null,
serializedData,
attSlot,
seenAttestationDataKey: getSeenAttDataKeyPhase0(serializedData),
seenAttestationKey: getSeenAttDataKeyPhase0(serializedData),
},
subnet0
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describe("validateAttestation", () => {
const {chain, subnet} = getValidData();
await expectGossipError(
chain,
{attestation: null, serializedData: Buffer.alloc(0), attSlot: 0, seenAttestationDataKey: "invalid"},
{attestation: null, serializedData: Buffer.alloc(0), attSlot: 0, seenAttestationKey: "invalid"},
subnet,
GossipErrorCode.INVALID_SERIALIZED_BYTES_ERROR_CODE
);
Expand All @@ -72,7 +72,7 @@ describe("validateAttestation", () => {
attestation: null,
serializedData,
attSlot: attestation.data.slot,
seenAttestationDataKey: getSeenAttDataKeyPhase0(serializedData),
seenAttestationKey: getSeenAttDataKeyPhase0(serializedData),
},
subnet,
AttestationErrorCode.BAD_TARGET_EPOCH
Expand All @@ -91,7 +91,7 @@ describe("validateAttestation", () => {
attestation: null,
serializedData,
attSlot: attestation.data.slot,
seenAttestationDataKey: getSeenAttDataKeyPhase0(serializedData),
seenAttestationKey: getSeenAttDataKeyPhase0(serializedData),
},
subnet,
AttestationErrorCode.PAST_SLOT
Expand All @@ -110,7 +110,7 @@ describe("validateAttestation", () => {
attestation: null,
serializedData,
attSlot: attestation.data.slot,
seenAttestationDataKey: getSeenAttDataKeyPhase0(serializedData),
seenAttestationKey: getSeenAttDataKeyPhase0(serializedData),
},
subnet,
AttestationErrorCode.FUTURE_SLOT
Expand All @@ -135,7 +135,7 @@ describe("validateAttestation", () => {
attestation: null,
serializedData,
attSlot: attestation.data.slot,
seenAttestationDataKey: getSeenAttDataKeyPhase0(serializedData),
seenAttestationKey: getSeenAttDataKeyPhase0(serializedData),
},
subnet,
AttestationErrorCode.NOT_EXACTLY_ONE_AGGREGATION_BIT_SET
Expand All @@ -155,7 +155,7 @@ describe("validateAttestation", () => {
attestation: null,
serializedData,
attSlot: attestation.data.slot,
seenAttestationDataKey: getSeenAttDataKeyPhase0(serializedData),
seenAttestationKey: getSeenAttDataKeyPhase0(serializedData),
},
subnet,
AttestationErrorCode.NOT_EXACTLY_ONE_AGGREGATION_BIT_SET
Expand All @@ -179,7 +179,7 @@ describe("validateAttestation", () => {
attestation: null,
serializedData,
attSlot: attestation.data.slot,
seenAttestationDataKey: getSeenAttDataKeyPhase0(serializedData),
seenAttestationKey: getSeenAttDataKeyPhase0(serializedData),
},
subnet,
AttestationErrorCode.UNKNOWN_OR_PREFINALIZED_BEACON_BLOCK_ROOT
Expand All @@ -199,7 +199,7 @@ describe("validateAttestation", () => {
attestation: null,
serializedData,
attSlot: attestation.data.slot,
seenAttestationDataKey: getSeenAttDataKeyPhase0(serializedData),
seenAttestationKey: getSeenAttDataKeyPhase0(serializedData),
},
subnet,
AttestationErrorCode.INVALID_TARGET_ROOT
Expand All @@ -226,7 +226,7 @@ describe("validateAttestation", () => {
attestation: null,
serializedData,
attSlot: attestation.data.slot,
seenAttestationDataKey: getSeenAttDataKeyPhase0(serializedData),
seenAttestationKey: getSeenAttDataKeyPhase0(serializedData),
},
subnet,
AttestationErrorCode.WRONG_NUMBER_OF_AGGREGATION_BITS
Expand All @@ -245,7 +245,7 @@ describe("validateAttestation", () => {
attestation: null,
serializedData,
attSlot: attestation.data.slot,
seenAttestationDataKey: getSeenAttDataKeyPhase0(serializedData),
seenAttestationKey: getSeenAttDataKeyPhase0(serializedData),
},
invalidSubnet,
AttestationErrorCode.INVALID_SUBNET_ID
Expand All @@ -265,7 +265,7 @@ describe("validateAttestation", () => {
attestation: null,
serializedData,
attSlot: attestation.data.slot,
seenAttestationDataKey: getSeenAttDataKeyPhase0(serializedData),
seenAttestationKey: getSeenAttDataKeyPhase0(serializedData),
},
subnet,
AttestationErrorCode.ATTESTATION_ALREADY_KNOWN
Expand All @@ -287,7 +287,7 @@ describe("validateAttestation", () => {
attestation: null,
serializedData,
attSlot: attestation.data.slot,
seenAttestationDataKey: getSeenAttDataKeyPhase0(serializedData),
seenAttestationKey: getSeenAttDataKeyPhase0(serializedData),
},
subnet,
AttestationErrorCode.INVALID_SIGNATURE
Expand Down
2 changes: 1 addition & 1 deletion packages/validator/src/services/attestation.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {toHexString} from "@chainsafe/ssz";
import {allForks, BLSSignature, electra, isElectraAttestation, phase0, Slot, ssz} from "@lodestar/types";
import {allForks, BLSSignature, phase0, Slot, ssz} from "@lodestar/types";
import {computeEpochAtSlot, isAggregatorFromCommitteeLength} from "@lodestar/state-transition";
import {sleep} from "@lodestar/utils";
import {ApiClient, routes} from "@lodestar/api";
Expand Down
5 changes: 1 addition & 4 deletions packages/validator/src/services/validatorStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import {
BlindedBeaconBlock,
BLSPubkey,
BLSSignature,
electra,
Epoch,
phase0,
Root,
Expand Down Expand Up @@ -806,9 +805,7 @@ export class ValidatorStore {
);
}
if (isAfterElectra && data.index !== 0) {
throw Error(
`Non-zero committee index post-electra during signing: att.committeeIndex ${data.index}`
);
throw Error(`Non-zero committee index post-electra during signing: att.committeeIndex ${data.index}`);
}
if (this.config.getForkSeq(duty.slot) >= ForkSeq.electra && data.index !== 0) {
throw Error(`Attestataion data index must be 0 post electra: index ${data.index}`);
Expand Down

0 comments on commit d971d31

Please sign in to comment.