E2E deposit testing overhaul (#11667)

* rewrite/refactor deposit testing code

keep track of sent deposits so that they can be compared in detail with
the validator set retreived from the API.

* fix bugs in evaluator and retry

* lint + deepsource appeasement

* typo s/Sprintf/Printf/

* gosec, more like nosec

* fix gosec number - 204->304

* type switch to get signed block from container

* improve comments

* centralizing constants and adding comments

* lock around Depositor to avoid future races

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>
This commit is contained in:
kasey
2022-11-18 21:40:32 -06:00
committed by GitHub
parent 4b033f4cc7
commit d58d3f2c57
37 changed files with 949 additions and 419 deletions

View File

@@ -288,3 +288,20 @@ func BuildSignedBeaconBlockFromExecutionPayload(
return NewSignedBeaconBlock(fullBlock)
}
// BeaconBlockContainerToSignedBeaconBlock converts BeaconBlockContainer (API response) to a SignedBeaconBlock.
// This is particularly useful for using the values from API calls.
func BeaconBlockContainerToSignedBeaconBlock(obj *eth.BeaconBlockContainer) (interfaces.SignedBeaconBlock, error) {
switch obj.Block.(type) {
case *eth.BeaconBlockContainer_BlindedBellatrixBlock:
return NewSignedBeaconBlock(obj.GetBlindedBellatrixBlock())
case *eth.BeaconBlockContainer_BellatrixBlock:
return NewSignedBeaconBlock(obj.GetBellatrixBlock())
case *eth.BeaconBlockContainer_AltairBlock:
return NewSignedBeaconBlock(obj.GetAltairBlock())
case *eth.BeaconBlockContainer_Phase0Block:
return NewSignedBeaconBlock(obj.GetPhase0Block())
default:
return nil, errors.New("container block type not recognized")
}
}