lodestar icon indicating copy to clipboard operation
lodestar copied to clipboard

Gossip validation to work with EpochShuffling

Open twoeths opened this issue 1 month ago • 1 comments

Problem description

Right now we need a full cached beacon state in order to validate gossip messages

Solution description

per #8650 we should switch to querying and using EpochShuffling instead

Additional context

No response

twoeths avatar Dec 02 '25 10:12 twoeths

when verifying a gossip block, we call this function:

export function getBlockProposerSignatureSet(
  state: CachedBeaconStateAllForks,
  signedBlock: SignedBeaconBlock | SignedBlindedBeaconBlock
): ISignatureSet {
  const {config, epochCtx} = state;
  const domain = config.getDomain(state.slot, DOMAIN_BEACON_PROPOSER, signedBlock.message.slot);

  const blockType = isBlindedBeaconBlock(signedBlock.message)
    ? config.getPostBellatrixForkTypes(signedBlock.message.slot).BlindedBeaconBlock
    : config.getForkTypes(signedBlock.message.slot).BeaconBlock;

  return {
    type: SignatureSetType.single,
    pubkey: epochCtx.index2pubkey[signedBlock.message.proposerIndex],
    signingRoot: computeSigningRoot(blockType, signedBlock.message, domain),
    signature: signedBlock.signature,
  };
}

this function uses a beacon state just to get slot, config, index2pubkey we can pass them directly instead of a whole CachedBeaconStateAllForks need to work on #8652 first

twoeths avatar Dec 08 '25 09:12 twoeths