Ensure VALID response from fcU updates protoarray (#3126)

## Issue Addressed

NA

## Proposed Changes

Ensures that a `VALID` response from a `forkchoiceUpdate` call will update that block in `ProtoArray`.

I also had to modify the mock execution engine so it wouldn't return valid when all payloads were supposed to be some other static value.

## Additional Info

NA
This commit is contained in:
Paul Hauner
2022-04-05 20:58:17 +00:00
parent 42cdaf5840
commit 8a40763183
7 changed files with 121 additions and 5 deletions

View File

@@ -18,6 +18,7 @@ pub enum Error<T> {
InvalidProtoArrayBytes(String),
InvalidLegacyProtoArrayBytes(String),
FailedToProcessInvalidExecutionPayload(String),
FailedToProcessValidExecutionPayload(String),
MissingProtoArrayBlock(Hash256),
UnknownAncestor {
ancestor_slot: Slot,
@@ -512,6 +513,16 @@ where
Ok(true)
}
/// See `ProtoArrayForkChoice::process_execution_payload_validation` for documentation.
pub fn on_valid_execution_payload(
&mut self,
block_root: Hash256,
) -> Result<(), Error<T::Error>> {
self.proto_array
.process_execution_payload_validation(block_root)
.map_err(Error::FailedToProcessValidExecutionPayload)
}
/// See `ProtoArrayForkChoice::process_execution_payload_invalidation` for documentation.
pub fn on_invalid_execution_payload(
&mut self,