Apply EIP-7044 to block signature batch verification (#5637)

This commit is contained in:
tersec 2023-12-01 14:44:45 +00:00 committed by GitHub
parent 7634f92408
commit 6a9d522705
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 3 deletions

View File

@ -284,7 +284,8 @@ proc addHeadBlockWithParent*(
var sigs: seq[SignatureSet]
if (let e = sigs.collectSignatureSets(
signedBlock, dag.db.immutableValidators,
dag.clearanceState, dag.cfg.genesisFork(), cache); e.isErr()):
dag.clearanceState, dag.cfg.genesisFork(), dag.cfg.capellaFork(),
cache); e.isErr()):
# A PublicKey or Signature isn't on the BLS12-381 curve
info "Unable to load signature sets",
err = e.error()

View File

@ -231,9 +231,10 @@ func bls_to_execution_change_signature_set*(
proc collectSignatureSets*(
sigs: var seq[SignatureSet],
signed_block: ForkySignedBeaconBlock,
validatorKeys: auto,
validatorKeys: openArray[ImmutableValidatorData2],
state: ForkedHashedBeaconState,
genesis_fork: Fork,
capella_fork: Fork,
cache: var StateCache): Result[void, cstring] =
## Collect all signature verifications that process_block would normally do
## except deposits, in one go.
@ -392,7 +393,13 @@ proc collectSignatureSets*(
return err("collectSignatureSets: invalid voluntary exit")
sigs.add voluntary_exit_signature_set(
fork, genesis_validators_root, volex.message, key,
# https://eips.ethereum.org/EIPS/eip-7044
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/deneb/beacon-chain.md#modified-process_voluntary_exit
(if state.kind >= ConsensusFork.Capella:
capella_fork
else:
fork),
genesis_validators_root, volex.message, key,
volex.signature.load.valueOr do:
return err(
"collectSignatureSets: cannot load voluntary exit signature"))