-
-
Notifications
You must be signed in to change notification settings - Fork 300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: ignore already known errors in API #6321
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,13 @@ import { | |
} from "@lodestar/types"; | ||
import {ExecutionStatus} from "@lodestar/fork-choice"; | ||
import {toHex, racePromisesWithCutoff, RaceEvent} from "@lodestar/utils"; | ||
import {AttestationError, AttestationErrorCode, GossipAction, SyncCommitteeError} from "../../../chain/errors/index.js"; | ||
import { | ||
AttestationError, | ||
AttestationErrorCode, | ||
GossipAction, | ||
SyncCommitteeError, | ||
SyncCommitteeErrorCode, | ||
} from "../../../chain/errors/index.js"; | ||
import {validateApiAggregateAndProof} from "../../../chain/validation/index.js"; | ||
import {ZERO_HASH} from "../../../constants/index.js"; | ||
import {SyncState} from "../../../sync/index.js"; | ||
|
@@ -1073,20 +1079,18 @@ export function getValidatorApi({ | |
const sentPeers = await network.publishBeaconAggregateAndProof(signedAggregateAndProof); | ||
metrics?.onPoolSubmitAggregatedAttestation(seenTimestampSec, indexedAttestation, sentPeers); | ||
} catch (e) { | ||
const logCtx = { | ||
slot: signedAggregateAndProof.message.aggregate.data.slot, | ||
index: signedAggregateAndProof.message.aggregate.data.index, | ||
}; | ||
|
||
if (e instanceof AttestationError && e.type.code === AttestationErrorCode.AGGREGATOR_ALREADY_KNOWN) { | ||
logger.debug("Ignoring known signedAggregateAndProof"); | ||
logger.debug("Ignoring known signedAggregateAndProof", logCtx); | ||
return; // Ok to submit the same aggregate twice | ||
} | ||
|
||
errors.push(e as Error); | ||
logger.error( | ||
`Error on publishAggregateAndProofs [${i}]`, | ||
{ | ||
slot: signedAggregateAndProof.message.aggregate.data.slot, | ||
index: signedAggregateAndProof.message.aggregate.data.index, | ||
}, | ||
e as Error | ||
); | ||
logger.error(`Error on publishAggregateAndProofs [${i}]`, logCtx, e as Error); | ||
if (e instanceof AttestationError && e.action === GossipAction.REJECT) { | ||
chain.persistInvalidSszValue(ssz.phase0.SignedAggregateAndProof, signedAggregateAndProof, "api_reject"); | ||
} | ||
|
@@ -1128,15 +1132,21 @@ export function getValidatorApi({ | |
); | ||
await network.publishContributionAndProof(contributionAndProof); | ||
} catch (e) { | ||
const logCtx = { | ||
slot: contributionAndProof.message.contribution.slot, | ||
subcommitteeIndex: contributionAndProof.message.contribution.subcommitteeIndex, | ||
}; | ||
|
||
if ( | ||
e instanceof SyncCommitteeError && | ||
e.type.code === SyncCommitteeErrorCode.SYNC_COMMITTEE_AGGREGATOR_ALREADY_KNOWN | ||
) { | ||
logger.debug("Ignoring known contributionAndProof", logCtx); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This error was already ignored previously (added in #2598) but it got removed again by #2816 as the PR changed the error behavior. In #4019 it was introduced again that the error is thrown during validation but the handling on the API was not re-added. The error was recently observed (#6021 (comment)) and should be ignored again. |
||
return; // Ok to submit the same aggregate twice | ||
} | ||
|
||
errors.push(e as Error); | ||
logger.error( | ||
`Error on publishContributionAndProofs [${i}]`, | ||
{ | ||
slot: contributionAndProof.message.contribution.slot, | ||
subcommitteeIndex: contributionAndProof.message.contribution.subcommitteeIndex, | ||
}, | ||
e as Error | ||
); | ||
logger.error(`Error on publishContributionAndProofs [${i}]`, logCtx, e as Error); | ||
if (e instanceof SyncCommitteeError && e.action === GossipAction.REJECT) { | ||
chain.persistInvalidSszValue(ssz.altair.SignedContributionAndProof, contributionAndProof, "api_reject"); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This just fixes a typo but it is worth highlighting that we don't need to handle already known errors in submitPoolSyncCommitteeSignatures as the api only verifies the signature
lodestar/packages/beacon-node/src/api/impl/beacon/pool/index.ts
Lines 184 to 186 in d7ca290