Engine API v1.0.0.alpha.6 + interop tests (#3024)

## Issue Addressed

NA

## Proposed Changes

This PR extends #3018 to address my review comments there and add automated integration tests with Geth (and other implementations, in the future).

I've also de-duplicated the "unused port" logic by creating an  `common/unused_port` crate.

## Additional Info

I'm not sure if we want to merge this PR, or update #3018 and merge that. I don't mind, I'm primarily opening this PR to make sure CI works.


Co-authored-by: Mark Mackey <mark@sigmaprime.io>
This commit is contained in:
Paul Hauner
2022-02-17 21:47:06 +00:00
parent 2f8531dc60
commit 0a6a8ea3b0
40 changed files with 1125 additions and 363 deletions

View File

@@ -1,7 +1,7 @@
//! Provides a mock execution engine HTTP JSON-RPC API for use in testing.
use crate::engine_api::http::JSONRPC_VERSION;
use crate::engine_api::ExecutePayloadResponseStatus;
use crate::engine_api::PayloadStatusV1Status;
use bytes::Bytes;
use environment::null_logger;
use execution_block_generator::{Block, PoWBlock};
@@ -62,7 +62,7 @@ impl<T: EthSpec> MockServer<T> {
last_echo_request: last_echo_request.clone(),
execution_block_generator: RwLock::new(execution_block_generator),
preloaded_responses,
static_notify_new_payload_response: <_>::default(),
static_new_payload_response: <_>::default(),
_phantom: PhantomData,
});
@@ -117,8 +117,7 @@ impl<T: EthSpec> MockServer<T> {
}
pub fn all_payloads_valid(&self) {
*self.ctx.static_notify_new_payload_response.lock() =
Some(ExecutePayloadResponseStatus::Valid)
*self.ctx.static_new_payload_response.lock() = Some(PayloadStatusV1Status::Valid)
}
pub fn insert_pow_block(
@@ -188,7 +187,7 @@ pub struct Context<T: EthSpec> {
pub last_echo_request: Arc<RwLock<Option<Bytes>>>,
pub execution_block_generator: RwLock<ExecutionBlockGenerator<T>>,
pub preloaded_responses: Arc<Mutex<Vec<serde_json::Value>>>,
pub static_notify_new_payload_response: Arc<Mutex<Option<ExecutePayloadResponseStatus>>>,
pub static_new_payload_response: Arc<Mutex<Option<PayloadStatusV1Status>>>,
pub _phantom: PhantomData<T>,
}