lodestar
lodestar copied to clipboard
Gossip validation to work with EpochShuffling
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
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