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

@@ -68,6 +68,7 @@ impl<T: EthSpec> MockServer<T> {
previous_request: <_>::default(),
preloaded_responses,
static_new_payload_response: <_>::default(),
static_forkchoice_updated_response: <_>::default(),
_phantom: PhantomData,
});
@@ -134,6 +135,7 @@ impl<T: EthSpec> MockServer<T> {
},
should_import: true,
};
*self.ctx.static_forkchoice_updated_response.lock() = Some(response.status.clone());
*self.ctx.static_new_payload_response.lock() = Some(response)
}
@@ -148,6 +150,7 @@ impl<T: EthSpec> MockServer<T> {
},
should_import,
};
*self.ctx.static_forkchoice_updated_response.lock() = Some(response.status.clone());
*self.ctx.static_new_payload_response.lock() = Some(response)
}
@@ -160,6 +163,7 @@ impl<T: EthSpec> MockServer<T> {
},
should_import: true,
};
*self.ctx.static_forkchoice_updated_response.lock() = Some(response.status.clone());
*self.ctx.static_new_payload_response.lock() = Some(response)
}
@@ -248,6 +252,7 @@ pub struct Context<T: EthSpec> {
pub preloaded_responses: Arc<Mutex<Vec<serde_json::Value>>>,
pub previous_request: Arc<Mutex<Option<serde_json::Value>>>,
pub static_new_payload_response: Arc<Mutex<Option<StaticNewPayloadResponse>>>,
pub static_forkchoice_updated_response: Arc<Mutex<Option<PayloadStatusV1>>>,
pub _phantom: PhantomData<T>,
}