add (Signed)AggregateAndProof SSZ tests (#6285)

This commit is contained in:
tersec 2024-05-14 14:51:06 +03:00 committed by GitHub
parent 9c669cf57a
commit 1c3aaa7be2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 17 additions and 19 deletions

View File

@ -16,7 +16,7 @@ import
../spec/datatypes/base,
./block_pools_types, blockchain_dag
debugRaiseAssert "probably just need Electra shortLog here"
debugComment "probably just need Electra shortLog here"
import ../spec/forks # prune this, it's for electra attestation logging
export

View File

@ -938,7 +938,7 @@ proc check_attestation*(
return err("Electra attestation data index not 0")
var participants_count = 0
debugRaiseAssert "cache doesn't know about forks"
debugComment "cache doesn't know about forks"
for index in attestation.committee_bits.oneIndices:
if not (index.uint64 < get_committee_count_per_slot(
state, data.target.epoch, cache)):
@ -1548,7 +1548,7 @@ func queue_entire_balance_and_reset_validator(
let validator = addr state.validators.mitem(index)
validator[].effective_balance = 0.Gwei
validator[].activation_eligibility_epoch = FAR_FUTURE_EPOCH
debugRaiseAssert "check hashlist add return"
debugComment "check hashlist add return"
discard state.pending_balance_deposits.add PendingBalanceDeposit(
index: index, amount: balance)
@ -1975,7 +1975,7 @@ func upgrade_to_electra*(
# churn
for index, validator in post.validators:
if has_compounding_withdrawal_credential(validator):
debugRaiseAssert "in theory truncating"
debugComment "in theory truncating"
queue_excess_active_balance(post[], ValidatorIndex(index))
post

View File

@ -1967,7 +1967,7 @@ proc readValue*(reader: var JsonReader[RestJson],
value.electraBody.execution_payload.excess_blob_gas,
ep_src.excess_blob_gas.get())
debugRaiseAssert "electra support missing, including attslashing/atts"
debugComment "electra support missing, including attslashing/atts"
## RestPublishedBeaconBlock
proc readValue*(reader: var JsonReader[RestJson],

View File

@ -961,7 +961,7 @@ func toLightClientHeader*(
electra.SignedBeaconBlock | electra.TrustedSignedBeaconBlock,
kind: static LightClientDataFork): auto =
when blck is electra.SignedBeaconBlock or blck is electra.TrustedSignedBeaconBlock:
debugRaiseAssert "toLightClientHeader electra missing"
debugComment "toLightClientHeader electra missing"
default(deneb.LightClientHeader)
elif kind == LightClientDataFork.Deneb:
blck.toDenebLightClientHeader()

View File

@ -601,7 +601,7 @@ proc process_consolidation*(
target_validator.withdrawal_credentials.data.toOpenArray(12, 31)):
return err("Consolidation: source and target don't have same withdrawal address")
debugRaiseAssert "this is per spec, near-verbatim, but Nimbus generally factors this out into spec/signatures.nim. so, create verify_consolidation_signature infra there, call here"
debugComment "this is per spec, near-verbatim, but Nimbus generally factors this out into spec/signatures.nim. so, create verify_consolidation_signature infra there, call here"
# Verify consolidation is signed by the source and the target
let
domain = compute_domain(
@ -610,7 +610,7 @@ proc process_consolidation*(
signing_root = compute_signing_root(consolidation, domain)
pubkeys = [source_validator[].pubkey, target_validator.pubkey]
debugRaiseAssert "as a good example, this trustedsig hack typically/should live in spec/signatures.nim"
debugComment "as a good example, this trustedsig hack typically/should live in spec/signatures.nim"
when not (signed_consolidation.signature is TrustedSig):
if not blsFastAggregateVerify(
pubkeys, signing_root.data, signed_consolidation.signature):
@ -621,7 +621,7 @@ proc process_consolidation*(
cfg, state, source_validator[].effective_balance, cache)
source_validator[].withdrawable_epoch =
source_validator[].exit_epoch + cfg.MIN_VALIDATOR_WITHDRAWABILITY_DELAY
debugRaiseAssert "check HashList add return value"
debugComment "check HashList add return value"
discard state.pending_consolidations.add(PendingConsolidation(
source_index: consolidation.source_index,
target_index: consolidation.target_index
@ -706,7 +706,7 @@ proc process_operations(
discard ? process_execution_layer_withdrawal_request(
cfg, state, op, default(ExitQueueInfo), cache)
for op in body.execution_payload.deposit_receipts:
debugRaiseAssert "combine with previous bloom filter construction"
debugComment "combine with previous bloom filter construction"
let bloom_filter = constructBloomFilter(state.validators.asSeq)
? process_deposit_receipt(cfg, state, bloom_filter[], op, {})
for op in body.consolidations:

View File

@ -497,7 +497,7 @@ proc makeBeaconBlockForHeadAndSlot*(
warn "Eth1 deposits not available. Skipping block proposal", slot
return err("Eth1 deposits not available")
debugRaiseAssert "b_v makeBeaconBlockForHeadAndSlot doesn't know how to get Electra attestations because attpool doesn't either"
debugComment "b_v makeBeaconBlockForHeadAndSlot doesn't know how to get Electra attestations because attpool doesn't either"
let
attestations =
when PayloadType.kind == ConsensusFork.Electra:
@ -672,7 +672,7 @@ proc constructSignableBlindedBlock[T: electra_mev.SignedBlindedBeaconBlock](
blindedBlock.message.body.blob_kzg_commitments,
blindedBundle.blob_kzg_commitments)
debugRaiseAssert "check for any additional electra mev requirements"
debugComment "check for any additional electra mev requirements"
blindedBlock
@ -722,7 +722,7 @@ func constructPlainBlindedBlock[T: electra_mev.BlindedBeaconBlock](
blindedBlock.body.blob_kzg_commitments,
blindedBundle.blob_kzg_commitments)
debugRaiseAssert "check for any additional electra mev requirements"
debugComment "check for any additional electra mev requirements"
blindedBlock

View File

@ -32,7 +32,7 @@ macro copyFields*(
dst: untyped, src: untyped, fieldNames: static[seq[string]]): untyped =
result = newStmtList()
for name in fieldNames:
debugRaiseAssert "deposit_receipts_root and exits_root are not currently filled in anywhere properly, so blinded electra proposals will fail"
debugComment "deposit_receipts_root and exits_root are not currently filled in anywhere properly, so blinded electra proposals will fail"
if name notin [
# These fields are the ones which vary between the blinded and
# unblinded objects, and can't simply be copied.

View File

@ -287,7 +287,7 @@ cli do(validatorsDir: string, secretsDir: string,
graffitiValue,
when typeof(payload).kind == ConsensusFork.Electra:
block:
debugRaiseAssert "wss_sim electra aggregates"
debugComment "wss_sim electra aggregates"
default(seq[electra.Attestation])
else:
blockAggregates,

View File

@ -99,8 +99,6 @@ proc loadExpectedHashTreeRoot(
# Test runner
# ----------------------------------------------------------------
debugRaiseAssert "re-enable AggregateAndProof and SignedAggregateAndProof"
suite "EF - Electra - SSZ consensus objects " & preset():
doAssert dirExists(SSZDir), "You need to run the \"download_test_vectors.sh\" script to retrieve the consensus spec test vectors."
for pathKind, sszType in walkDir(SSZDir, relative = true, checkDir = true):
@ -118,7 +116,7 @@ suite "EF - Electra - SSZ consensus objects " & preset():
let hash = loadExpectedHashTreeRoot(path)
case sszType:
of "AggregateAndProof": discard # checkSSZ(AggregateAndProof, path, hash)
of "AggregateAndProof": checkSSZ(electra.AggregateAndProof, path, hash)
of "Attestation": checkSSZ(electra.Attestation, path, hash)
of "AttestationData": checkSSZ(AttestationData, path, hash)
of "AttesterSlashing": checkSSZ(electra.AttesterSlashing, path, hash)
@ -165,7 +163,7 @@ suite "EF - Electra - SSZ consensus objects " & preset():
of "PowBlock": checkSSZ(PowBlock, path, hash)
of "ProposerSlashing": checkSSZ(ProposerSlashing, path, hash)
of "SignedAggregateAndProof":
discard #checkSSZ(SignedAggregateAndProof, path, hash)
checkSSZ(electra.SignedAggregateAndProof, path, hash)
of "SignedBeaconBlock":
checkSSZ(electra.SignedBeaconBlock, path, hash)
of "SignedBeaconBlockHeader":