fix compilation errors, rename capella -> shanghai, cleanup some rebase issues

This commit is contained in:
realbigsean
2022-04-05 16:55:42 -04:00
parent 809b52715e
commit fe6fc55449
38 changed files with 218 additions and 311 deletions

View File

@@ -9,12 +9,9 @@ pub use types::{
Address, EthSpec, ExecutionBlockHash, ExecutionPayload, ExecutionPayloadHeader, FixedVector,
Hash256, Uint256, VariableList,
};
pub mod auth;
use crate::engines::ForkChoiceState;
pub use types::{Address, EthSpec, ExecutionPayload, Hash256, Uint256};
use types::{Blob, KZGCommitment};
pub mod auth;
pub mod http;
pub mod json_structures;

View File

@@ -667,10 +667,10 @@ impl HttpJsonRpc {
Ok(response.into())
}
async fn get_blob_v1<T: EthSpec>(
pub async fn get_blob_v1<T: EthSpec>(
&self,
payload_id: PayloadId,
versioned_hash: Hash256,
versioned_hash: ExecutionBlockHash,
) -> Result<BlobDetailsV1, Error> {
let params = json!([JsonPayloadIdRequest::from(payload_id), versioned_hash]);

View File

@@ -897,60 +897,7 @@ impl<T: EthSpec> ExecutionLayer<T> {
proposer_index: u64,
versioned_hash: Hash256,
) -> Result<BlobDetailsV1, Error> {
let suggested_fee_recipient = self.get_suggested_fee_recipient(proposer_index).await;
debug!(
self.log(),
"Issuing engine_getBlob";
"suggested_fee_recipient" => ?suggested_fee_recipient,
"random" => ?random,
"timestamp" => timestamp,
"parent_hash" => ?parent_hash,
);
self.engines()
.first_success(|engine| async move {
let payload_id = if let Some(id) = engine
.get_payload_id(parent_hash, timestamp, random, suggested_fee_recipient)
.await
{
// The payload id has been cached for this engine.
id
} else {
// The payload id has *not* been cached for this engine. Trigger an artificial
// fork choice update to retrieve a payload ID.
//
// TODO(merge): a better algorithm might try to favour a node that already had a
// cached payload id, since a payload that has had more time to produce is
// likely to be more profitable.
let fork_choice_state = ForkChoiceState {
head_block_hash: parent_hash,
safe_block_hash: parent_hash,
finalized_block_hash,
};
let payload_attributes = PayloadAttributes {
timestamp,
random,
suggested_fee_recipient,
};
engine
.notify_forkchoice_updated(
fork_choice_state,
Some(payload_attributes),
self.log(),
)
.await
.map(|response| response.payload_id)?
.ok_or(ApiError::PayloadIdUnavailable)?
};
engine
.api
.get_blob_v1::<T>(payload_id, versioned_hash)
.await
})
.await
.map_err(Error::EngineErrors)
todo!()
}
/// Maps to the `engine_newPayload` JSON-RPC call.