mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-11 04:31:51 +00:00
Update to consensus-specs v1.1.9 (#3016)
## Issue Addressed Closes #3014 ## Proposed Changes - Rename `receipt_root` to `receipts_root` - Rename `execute_payload` to `notify_new_payload` - This is slightly weird since we modify everything except the actual HTTP call to the engine API. That change is expected to be implemented in #2985 (cc @ethDreamer) - Enable "random" tests for Bellatrix. ## Notes This will break *partially* compatibility with Kintusgi testnets in order to gain compatibility with [Kiln](https://hackmd.io/@n0ble/kiln-spec) testnets. I think it will only break the BN APIs due to the `receipts_root` change, however it might have some other effects too. Co-authored-by: Michael Sproul <micsproul@gmail.com>
This commit is contained in:
@@ -235,7 +235,7 @@ impl<T: EthSpec> ExecutionBlockGenerator<T> {
|
||||
self.payload_ids.remove(id)
|
||||
}
|
||||
|
||||
pub fn execute_payload(&mut self, payload: ExecutionPayload<T>) -> ExecutePayloadResponse {
|
||||
pub fn notify_new_payload(&mut self, payload: ExecutionPayload<T>) -> ExecutePayloadResponse {
|
||||
let parent = if let Some(parent) = self.blocks.get(&payload.parent_hash) {
|
||||
parent
|
||||
} else {
|
||||
@@ -325,7 +325,7 @@ impl<T: EthSpec> ExecutionBlockGenerator<T> {
|
||||
let mut execution_payload = ExecutionPayload {
|
||||
parent_hash: forkchoice_state.head_block_hash,
|
||||
fee_recipient: attributes.suggested_fee_recipient,
|
||||
receipt_root: Hash256::repeat_byte(42),
|
||||
receipts_root: Hash256::repeat_byte(42),
|
||||
state_root: Hash256::repeat_byte(43),
|
||||
logs_bloom: vec![0; 256].into(),
|
||||
random: attributes.random,
|
||||
|
||||
@@ -57,7 +57,7 @@ pub async fn handle_rpc<T: EthSpec>(
|
||||
ENGINE_EXECUTE_PAYLOAD_V1 => {
|
||||
let request: JsonExecutionPayloadV1<T> = get_param(params, 0)?;
|
||||
|
||||
let response = if let Some(status) = *ctx.static_execute_payload_response.lock() {
|
||||
let response = if let Some(status) = *ctx.static_notify_new_payload_response.lock() {
|
||||
match status {
|
||||
ExecutePayloadResponseStatus::Valid => ExecutePayloadResponse {
|
||||
status,
|
||||
@@ -74,7 +74,7 @@ pub async fn handle_rpc<T: EthSpec>(
|
||||
} else {
|
||||
ctx.execution_block_generator
|
||||
.write()
|
||||
.execute_payload(request.into())
|
||||
.notify_new_payload(request.into())
|
||||
};
|
||||
|
||||
Ok(serde_json::to_value(JsonExecutePayloadV1Response::from(response)).unwrap())
|
||||
|
||||
@@ -146,7 +146,7 @@ impl<T: EthSpec> MockExecutionLayer<T> {
|
||||
assert_eq!(payload.random, random);
|
||||
|
||||
let (payload_response, latest_valid_hash) =
|
||||
self.el.execute_payload(&payload).await.unwrap();
|
||||
self.el.notify_new_payload(&payload).await.unwrap();
|
||||
assert_eq!(payload_response, ExecutePayloadResponseStatus::Valid);
|
||||
assert_eq!(latest_valid_hash, Some(payload.block_hash));
|
||||
|
||||
|
||||
@@ -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_execute_payload_response: <_>::default(),
|
||||
static_notify_new_payload_response: <_>::default(),
|
||||
_phantom: PhantomData,
|
||||
});
|
||||
|
||||
@@ -117,7 +117,8 @@ impl<T: EthSpec> MockServer<T> {
|
||||
}
|
||||
|
||||
pub fn all_payloads_valid(&self) {
|
||||
*self.ctx.static_execute_payload_response.lock() = Some(ExecutePayloadResponseStatus::Valid)
|
||||
*self.ctx.static_notify_new_payload_response.lock() =
|
||||
Some(ExecutePayloadResponseStatus::Valid)
|
||||
}
|
||||
|
||||
pub fn insert_pow_block(
|
||||
@@ -187,7 +188,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_execute_payload_response: Arc<Mutex<Option<ExecutePayloadResponseStatus>>>,
|
||||
pub static_notify_new_payload_response: Arc<Mutex<Option<ExecutePayloadResponseStatus>>>,
|
||||
pub _phantom: PhantomData<T>,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user