@lodestar/state-transition
Version:
Beacon Chain state transition function and utils
51 lines • 2.51 kB
JavaScript
import { ForkSeq } from "@lodestar/params";
import { getSyncCommitteeSignatureSet } from "../block/processSyncCommittee.js";
import { getAttesterSlashingsSignatureSets } from "./attesterSlashings.js";
import { getBlsToExecutionChangeSignatureSets } from "./blsToExecutionChange.js";
import { getAttestationsSignatureSets } from "./indexedAttestation.js";
import { getBlockProposerSignatureSet } from "./proposer.js";
import { getProposerSlashingsSignatureSets } from "./proposerSlashings.js";
import { getRandaoRevealSignatureSet } from "./randao.js";
import { getVoluntaryExitsSignatureSets } from "./voluntaryExits.js";
export * from "./attesterSlashings.js";
export * from "./indexedAttestation.js";
export * from "./proposer.js";
export * from "./proposerSlashings.js";
export * from "./randao.js";
export * from "./voluntaryExits.js";
export * from "./blsToExecutionChange.js";
/**
* Includes all signatures on the block (except the deposit signatures) for verification.
* Deposits are not included because they can legally have invalid signatures.
*/
export function getBlockSignatureSets(state, signedBlock, opts) {
// fork based validations
const fork = state.config.getForkSeq(signedBlock.message.slot);
const signatureSets = [
getRandaoRevealSignatureSet(state, signedBlock.message),
...getProposerSlashingsSignatureSets(state, signedBlock),
...getAttesterSlashingsSignatureSets(state, signedBlock),
...getAttestationsSignatureSets(state, signedBlock),
...getVoluntaryExitsSignatureSets(state, signedBlock),
];
if (!opts?.skipProposerSignature) {
signatureSets.push(getBlockProposerSignatureSet(state, signedBlock));
}
// Only after altair fork, validate tSyncCommitteeSignature
if (fork >= ForkSeq.altair) {
const syncCommitteeSignatureSet = getSyncCommitteeSignatureSet(state, signedBlock.message);
// There may be no participants in this syncCommitteeSignature, so it must not be validated
if (syncCommitteeSignatureSet) {
signatureSets.push(syncCommitteeSignatureSet);
}
}
// only after capella fork
if (fork >= ForkSeq.capella) {
const blsToExecutionChangeSignatureSets = getBlsToExecutionChangeSignatureSets(state.config, signedBlock);
if (blsToExecutionChangeSignatureSets.length > 0) {
signatureSets.push(...blsToExecutionChangeSignatureSets);
}
}
return signatureSets;
}
//# sourceMappingURL=index.js.map