Add BeaconChainHarness tests for The Merge (#2661)

* Start adding merge tests

* Expose MockExecutionLayer

* Add mock_execution_layer to BeaconChainHarness

* Progress with merge test

* Return more detailed errors with gas limit issues

* Use a better gas limit in block gen

* Ensure TTD is met in block gen

* Fix basic_merge tests

* Start geth testing

* Fix conflicts after rebase

* Remove geth tests

* Improve merge test

* Address clippy lints

* Make pow block gen a pure function

* Add working new test, breaking existing test

* Fix test names

* Add should_panic

* Don't run merge tests in debug

* Detect a tokio runtime when starting MockServer

* Fix clippy lint, include merge tests
This commit is contained in:
Paul Hauner
2021-10-02 11:39:11 +10:00
parent 801f6f7425
commit a1033a9247
14 changed files with 642 additions and 249 deletions

View File

@@ -30,7 +30,6 @@ pub async fn handle_rpc<T: EthSpec>(
"latest" => Ok(serde_json::to_value(
ctx.execution_block_generator
.read()
.await
.latest_execution_block(),
)
.unwrap()),
@@ -50,7 +49,6 @@ pub async fn handle_rpc<T: EthSpec>(
Ok(serde_json::to_value(
ctx.execution_block_generator
.read()
.await
.execution_block_by_hash(hash),
)
.unwrap())
@@ -60,7 +58,6 @@ pub async fn handle_rpc<T: EthSpec>(
let payload_id = ctx
.execution_block_generator
.write()
.await
.prepare_payload(request)?;
Ok(serde_json::to_value(JsonPayloadIdResponse { payload_id }).unwrap())
@@ -70,7 +67,6 @@ pub async fn handle_rpc<T: EthSpec>(
let status = ctx
.execution_block_generator
.write()
.await
.execute_payload(request.into());
Ok(serde_json::to_value(ExecutePayloadResponseWrapper { status }).unwrap())
@@ -82,7 +78,6 @@ pub async fn handle_rpc<T: EthSpec>(
let response = ctx
.execution_block_generator
.write()
.await
.get_payload(id)
.ok_or_else(|| format!("no payload for id {}", id))?;
@@ -93,7 +88,6 @@ pub async fn handle_rpc<T: EthSpec>(
let request: JsonConsensusValidatedRequest = get_param_0(params)?;
ctx.execution_block_generator
.write()
.await
.consensus_validated(request.block_hash, request.status)?;
Ok(JsonValue::Null)
@@ -102,7 +96,6 @@ pub async fn handle_rpc<T: EthSpec>(
let request: JsonForkChoiceUpdatedRequest = get_param_0(params)?;
ctx.execution_block_generator
.write()
.await
.forkchoice_updated(request.head_block_hash, request.finalized_block_hash)?;
Ok(JsonValue::Null)