Skip to content

Commit

Permalink
Merge ea4caa5 into d1cddb7
Browse files Browse the repository at this point in the history
  • Loading branch information
g11tech authored Feb 20, 2023
2 parents d1cddb7 + ea4caa5 commit bea1aaa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
21 changes: 10 additions & 11 deletions packages/beacon-node/src/api/impl/beacon/pool/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,18 +114,17 @@ export function getBeaconPoolApi({
await Promise.all(
blsToExecutionChanges.map(async (blsToExecutionChange, i) => {
try {
await validateBlsToExecutionChange(chain, blsToExecutionChange);
// TODO: Remove below condition
// Only used for testing in devnet-3 of withdrawals
chain.opPool.insertBlsToExecutionChange(
blsToExecutionChange,
// true if pre capella else false
!(
chain.clock.currentEpoch >= chain.config.CAPELLA_FORK_EPOCH &&
// TODO: Remove this condition once testing is done
network.isSubscribedToGossipCoreTopics()
)
// Ignore even if the change exists and reprocess
await validateBlsToExecutionChange(chain, blsToExecutionChange, true);
const preCapella = !(
chain.clock.currentEpoch >= chain.config.CAPELLA_FORK_EPOCH &&
// TODO: Remove this condition once testing is done
network.isSubscribedToGossipCoreTopics()
);
chain.opPool.insertBlsToExecutionChange(blsToExecutionChange, preCapella);
if (!preCapella) {
await network.gossip.publishBlsToExecutionChange(blsToExecutionChange);
}
} catch (e) {
errors.push(e as Error);
logger.error(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ import {BlsToExecutionChangeError, BlsToExecutionChangeErrorCode, GossipAction}

export async function validateBlsToExecutionChange(
chain: IBeaconChain,
blsToExecutionChange: capella.SignedBLSToExecutionChange
blsToExecutionChange: capella.SignedBLSToExecutionChange,
ignoreExists = false
): Promise<void> {
// [IGNORE] The blsToExecutionChange is the first valid blsToExecutionChange received for the validator with index
// signedBLSToExecutionChange.message.validatorIndex.
if (chain.opPool.hasSeenBlsToExecutionChange(blsToExecutionChange.message.validatorIndex)) {
if (!ignoreExists && chain.opPool.hasSeenBlsToExecutionChange(blsToExecutionChange.message.validatorIndex)) {
throw new BlsToExecutionChangeError(GossipAction.IGNORE, {
code: BlsToExecutionChangeErrorCode.ALREADY_EXISTS,
});
Expand Down

0 comments on commit bea1aaa

Please sign in to comment.