Fix VC not properly handled getAggregatedAttestation's 404 error. (#6254)
* Fix VC not properly handled getAggregatedAttestation's 404 error. * Update AllTests.
This commit is contained in:
parent
1ab6f1654f
commit
f3da063510
|
@ -891,6 +891,7 @@ OK: 1/1 Fail: 0/1 Skip: 0/1
|
||||||
+ /eth/v1/validator/sync_committee_selections serialization/deserialization test OK
|
+ /eth/v1/validator/sync_committee_selections serialization/deserialization test OK
|
||||||
+ bestSuccess() API timeout test OK
|
+ bestSuccess() API timeout test OK
|
||||||
+ firstSuccessParallel() API timeout test OK
|
+ firstSuccessParallel() API timeout test OK
|
||||||
|
+ getAggregatedAttestationDataScore() default test OK
|
||||||
+ getAggregatedAttestationDataScore() test vectors OK
|
+ getAggregatedAttestationDataScore() test vectors OK
|
||||||
+ getAttestationDataScore() test vectors OK
|
+ getAttestationDataScore() test vectors OK
|
||||||
+ getLiveness() response deserialization test OK
|
+ getLiveness() response deserialization test OK
|
||||||
|
@ -899,7 +900,7 @@ OK: 1/1 Fail: 0/1 Skip: 0/1
|
||||||
+ getUniqueVotes() test vectors OK
|
+ getUniqueVotes() test vectors OK
|
||||||
+ normalizeUri() test vectors OK
|
+ normalizeUri() test vectors OK
|
||||||
```
|
```
|
||||||
OK: 11/11 Fail: 0/11 Skip: 0/11
|
OK: 12/12 Fail: 0/12 Skip: 0/12
|
||||||
## Validator change pool testing suite
|
## Validator change pool testing suite
|
||||||
```diff
|
```diff
|
||||||
+ addValidatorChangeMessage/getAttesterSlashingMessage OK
|
+ addValidatorChangeMessage/getAttesterSlashingMessage OK
|
||||||
|
@ -1019,4 +1020,4 @@ OK: 2/2 Fail: 0/2 Skip: 0/2
|
||||||
OK: 9/9 Fail: 0/9 Skip: 0/9
|
OK: 9/9 Fail: 0/9 Skip: 0/9
|
||||||
|
|
||||||
---TOTAL---
|
---TOTAL---
|
||||||
OK: 684/689 Fail: 0/689 Skip: 5/689
|
OK: 685/690 Fail: 0/690 Skip: 5/690
|
||||||
|
|
|
@ -45,6 +45,9 @@ const
|
||||||
|
|
||||||
const
|
const
|
||||||
preferSSZ* = "application/octet-stream,application/json;q=0.9"
|
preferSSZ* = "application/octet-stream,application/json;q=0.9"
|
||||||
|
LowestScoreAggregatedAttestation* =
|
||||||
|
phase0.Attestation(
|
||||||
|
aggregation_bits: CommitteeValidatorsBits(BitSeq.init(1)))
|
||||||
|
|
||||||
static:
|
static:
|
||||||
doAssert(ClientMaximumValidatorIds <= ServerMaximumValidatorIds)
|
doAssert(ClientMaximumValidatorIds <= ServerMaximumValidatorIds)
|
||||||
|
@ -615,6 +618,10 @@ type
|
||||||
fork_choice_nodes*: seq[RestNode]
|
fork_choice_nodes*: seq[RestNode]
|
||||||
extra_data*: RestExtraData
|
extra_data*: RestExtraData
|
||||||
|
|
||||||
|
func isLowestScoreAggregatedAttestation*(a: phase0.Attestation): bool =
|
||||||
|
(a.data.slot == Slot(0)) and (a.data.index == 0'u64) and
|
||||||
|
(a.data.source.epoch == Epoch(0)) and (a.data.target.epoch == Epoch(0))
|
||||||
|
|
||||||
func `==`*(a, b: RestValidatorIndex): bool =
|
func `==`*(a, b: RestValidatorIndex): bool =
|
||||||
uint64(a) == uint64(b)
|
uint64(a) == uint64(b)
|
||||||
|
|
||||||
|
|
|
@ -1708,6 +1708,13 @@ proc getAggregatedAttestation*(
|
||||||
handle400()
|
handle400()
|
||||||
ApiResponse[GetAggregatedAttestationResponse].err(
|
ApiResponse[GetAggregatedAttestationResponse].err(
|
||||||
ResponseInvalidError)
|
ResponseInvalidError)
|
||||||
|
of 404:
|
||||||
|
# A 404 error must be returned if no attestation is available for the
|
||||||
|
# requested `attestation_data_root`. To address the issue #6184, we
|
||||||
|
# use empty GetAggregatedAttestationResponse.
|
||||||
|
ApiResponse[GetAggregatedAttestationResponse].ok(
|
||||||
|
GetAggregatedAttestationResponse(
|
||||||
|
data: LowestScoreAggregatedAttestation))
|
||||||
of 500:
|
of 500:
|
||||||
handle500()
|
handle500()
|
||||||
ApiResponse[GetAggregatedAttestationResponse].err(
|
ApiResponse[GetAggregatedAttestationResponse].err(
|
||||||
|
|
|
@ -296,6 +296,12 @@ proc produceAndPublishAggregates(service: AttestationServiceRef,
|
||||||
err_name = exc.name, err_msg = exc.msg
|
err_name = exc.name, err_msg = exc.msg
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if isLowestScoreAggregatedAttestation(aggAttestation):
|
||||||
|
warn "Aggregated attestation with the root was not seen by the " &
|
||||||
|
"beacon node",
|
||||||
|
attestation_root = shortLog(attestationRoot)
|
||||||
|
return
|
||||||
|
|
||||||
let pendingAggregates =
|
let pendingAggregates =
|
||||||
block:
|
block:
|
||||||
var res: seq[Future[bool]]
|
var res: seq[Future[bool]]
|
||||||
|
|
|
@ -746,6 +746,15 @@ suite "Validator Client test suite":
|
||||||
score = shortScore(getAggregatedAttestationDataScore(adata))
|
score = shortScore(getAggregatedAttestationDataScore(adata))
|
||||||
check score == vector[1]
|
check score == vector[1]
|
||||||
|
|
||||||
|
test "getAggregatedAttestationDataScore() default test":
|
||||||
|
let
|
||||||
|
adata = GetAggregatedAttestationResponse(
|
||||||
|
data: LowestScoreAggregatedAttestation)
|
||||||
|
score = shortScore(getAggregatedAttestationDataScore(adata))
|
||||||
|
check:
|
||||||
|
score == "0.0000"
|
||||||
|
isLowestScoreAggregatedAttestation(adata.data) == true
|
||||||
|
|
||||||
test "getSyncCommitteeContributionDataScore() test vectors":
|
test "getSyncCommitteeContributionDataScore() test vectors":
|
||||||
for vector in ContributionDataVectors:
|
for vector in ContributionDataVectors:
|
||||||
let
|
let
|
||||||
|
|
Loading…
Reference in New Issue