fix invalid_signature_no_participants test case (#2741)

This commit is contained in:
tersec 2021-07-27 14:04:41 +00:00 committed by GitHub
parent 4ba69bf54d
commit 5f3225c6e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 7 deletions

View File

@ -135,6 +135,7 @@ FixtureAll-mainnet
+ [Invalid] invalid_signature_infinite_signature_with_all_participants OK
+ [Invalid] invalid_signature_infinite_signature_with_single_participant OK
+ [Invalid] invalid_signature_missing_participant OK
+ [Invalid] invalid_signature_no_participants OK
+ [Invalid] invalid_signature_past_block OK
+ [Invalid] invalid_slot_block_header OK
+ [Invalid] mismatched_target_and_slot OK
@ -278,7 +279,7 @@ FixtureAll-mainnet
+ fork_random_low_balances OK
+ fork_random_misc_balances OK
```
OK: 275/275 Fail: 0/275 Skip: 0/275
OK: 276/276 Fail: 0/276 Skip: 0/276
## Official - Altair - Epoch Processing - Effective balance updates [Preset: mainnet]
```diff
+ Effective balance updates - effective_balance_hysteresis [Preset: mainnet] OK
@ -511,4 +512,4 @@ OK: 1/1 Fail: 0/1 Skip: 0/1
OK: 27/27 Fail: 0/27 Skip: 0/27
---TOTAL---
OK: 421/421 Fail: 0/421 Skip: 0/421
OK: 422/422 Fail: 0/422 Skip: 0/422

View File

@ -427,7 +427,9 @@ proc makeBeaconBlock*(
attestations: List[Attestation, Limit MAX_ATTESTATIONS](attestations),
deposits: List[Deposit, Limit MAX_DEPOSITS](deposits),
voluntary_exits:
List[SignedVoluntaryExit, Limit MAX_VOLUNTARY_EXITS](voluntaryExits)))
List[SignedVoluntaryExit, Limit MAX_VOLUNTARY_EXITS](voluntaryExits),
sync_aggregate: SyncAggregate(sync_committee_signature:
default(CookedSig).toValidatorSig)))
# TODO sync committees

View File

@ -425,6 +425,12 @@ proc process_sync_aggregate*(
if aggregate.sync_committee_bits[i]:
participant_pubkeys.add committee_pubkeys[i]
# p2p-interface message validators check for empty sync committees, so it
# shouldn't run except as part of test suite.
if participant_pubkeys.len == 0 and
aggregate.sync_committee_signature != default(CookedSig).toValidatorSig():
return err("process_sync_aggregate: empty sync aggregates need signature of point at infinity")
# Empty participants allowed
if participant_pubkeys.len > 0 and not blsFastAggregateVerify(
participant_pubkeys, signing_root.data, aggregate.sync_committee_signature):

View File

@ -61,14 +61,11 @@ proc runTest(dir, identifier: string) =
reportDiff(preState, postState)
else:
let done = process_sync_aggregate(preState[], syncAggregate, cache).isOk
doAssert done == false, "We didn't expect this invalid proposer slashing to be processed."
doAssert done == false, "We didn't expect this invalid sync aggregate to be processed."
`testImpl_sync_committee _ identifier`()
suite "Official - Altair - Operations - Sync Aggregate" & preset():
for kind, path in walkDir(
OpSyncAggregateDir, relative = true, checkDir = true):
# TODO remove when it works
if path == "invalid_signature_no_participants":
continue
runTest(OpSyncAggregateDir, path)