mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-11 18:04:18 +00:00
Revert "renames, remove , wrap BlockWrapper enum to make descontruction private"
This reverts commit 5b3b34a9d7.
This commit is contained in:
@@ -73,7 +73,7 @@ impl<TSpec: EthSpec> Encoder<RPCCodedResponse<TSpec>> for SSZSnappyInboundCodec<
|
||||
RPCResponse::BlocksByRange(res) => res.as_ssz_bytes(),
|
||||
RPCResponse::BlocksByRoot(res) => res.as_ssz_bytes(),
|
||||
RPCResponse::BlobsByRange(res) => res.as_ssz_bytes(),
|
||||
RPCResponse::BlockAndBlobsByRoot(res) => res.as_ssz_bytes(),
|
||||
RPCResponse::BlobsByRoot(res) => res.as_ssz_bytes(),
|
||||
RPCResponse::LightClientBootstrap(res) => res.as_ssz_bytes(),
|
||||
RPCResponse::Pong(res) => res.data.as_ssz_bytes(),
|
||||
RPCResponse::MetaData(res) =>
|
||||
@@ -439,8 +439,7 @@ fn context_bytes<T: EthSpec>(
|
||||
SignedBeaconBlock::Base { .. } => Some(fork_context.genesis_context_bytes()),
|
||||
};
|
||||
}
|
||||
if let RPCResponse::BlobsByRange(_) | RPCResponse::BlockAndBlobsByRoot(_) = rpc_variant
|
||||
{
|
||||
if let RPCResponse::BlobsByRange(_) | RPCResponse::BlobsByRoot(_) = rpc_variant {
|
||||
return fork_context.to_context_bytes(ForkName::Eip4844);
|
||||
}
|
||||
}
|
||||
@@ -586,7 +585,7 @@ fn handle_v1_response<T: EthSpec>(
|
||||
)))),
|
||||
_ => Err(RPCError::ErrorResponse(
|
||||
RPCResponseErrorCode::InvalidRequest,
|
||||
"Invalid fork name for blobs by range".to_string(),
|
||||
"Invalid forkname for blobsbyrange".to_string(),
|
||||
)),
|
||||
}
|
||||
}
|
||||
@@ -598,12 +597,12 @@ fn handle_v1_response<T: EthSpec>(
|
||||
)
|
||||
})?;
|
||||
match fork_name {
|
||||
ForkName::Eip4844 => Ok(Some(RPCResponse::BlockAndBlobsByRoot(
|
||||
ForkName::Eip4844 => Ok(Some(RPCResponse::BlobsByRoot(Arc::new(
|
||||
SignedBeaconBlockAndBlobsSidecar::from_ssz_bytes(decoded_buffer)?,
|
||||
))),
|
||||
)))),
|
||||
_ => Err(RPCError::ErrorResponse(
|
||||
RPCResponseErrorCode::InvalidRequest,
|
||||
"Invalid fork name for block and blobs by root".to_string(),
|
||||
"Invalid forkname for blobsbyroot".to_string(),
|
||||
)),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -281,7 +281,7 @@ pub enum RPCResponse<T: EthSpec> {
|
||||
LightClientBootstrap(LightClientBootstrap<T>),
|
||||
|
||||
/// A response to a get BLOBS_BY_ROOT request.
|
||||
BlockAndBlobsByRoot(SignedBeaconBlockAndBlobsSidecar<T>),
|
||||
BlobsByRoot(Arc<SignedBeaconBlockAndBlobsSidecar<T>>),
|
||||
|
||||
/// A PONG response to a PING request.
|
||||
Pong(Ping),
|
||||
@@ -372,7 +372,7 @@ impl<T: EthSpec> RPCCodedResponse<T> {
|
||||
RPCResponse::BlocksByRange(_) => true,
|
||||
RPCResponse::BlocksByRoot(_) => true,
|
||||
RPCResponse::BlobsByRange(_) => true,
|
||||
RPCResponse::BlockAndBlobsByRoot(_) => true,
|
||||
RPCResponse::BlobsByRoot(_) => true,
|
||||
RPCResponse::Pong(_) => false,
|
||||
RPCResponse::MetaData(_) => false,
|
||||
RPCResponse::LightClientBootstrap(_) => false,
|
||||
@@ -409,7 +409,7 @@ impl<T: EthSpec> RPCResponse<T> {
|
||||
RPCResponse::BlocksByRange(_) => Protocol::BlocksByRange,
|
||||
RPCResponse::BlocksByRoot(_) => Protocol::BlocksByRoot,
|
||||
RPCResponse::BlobsByRange(_) => Protocol::BlobsByRange,
|
||||
RPCResponse::BlockAndBlobsByRoot(_) => Protocol::BlobsByRoot,
|
||||
RPCResponse::BlobsByRoot(_) => Protocol::BlobsByRoot,
|
||||
RPCResponse::Pong(_) => Protocol::Ping,
|
||||
RPCResponse::MetaData(_) => Protocol::MetaData,
|
||||
RPCResponse::LightClientBootstrap(_) => Protocol::LightClientBootstrap,
|
||||
@@ -449,7 +449,7 @@ impl<T: EthSpec> std::fmt::Display for RPCResponse<T> {
|
||||
RPCResponse::BlobsByRange(blob) => {
|
||||
write!(f, "BlobsByRange: Blob slot: {}", blob.beacon_block_slot)
|
||||
}
|
||||
RPCResponse::BlockAndBlobsByRoot(blob) => {
|
||||
RPCResponse::BlobsByRoot(blob) => {
|
||||
write!(
|
||||
f,
|
||||
"BlobsByRoot: Blob slot: {}",
|
||||
|
||||
@@ -83,7 +83,7 @@ pub enum Response<TSpec: EthSpec> {
|
||||
/// A response to a LightClientUpdate request.
|
||||
LightClientBootstrap(LightClientBootstrap<TSpec>),
|
||||
/// A response to a get BLOBS_BY_ROOT request.
|
||||
BlobsByRoot(Option<SignedBeaconBlockAndBlobsSidecar<TSpec>>),
|
||||
BlobsByRoot(Option<Arc<SignedBeaconBlockAndBlobsSidecar<TSpec>>>),
|
||||
}
|
||||
|
||||
impl<TSpec: EthSpec> std::convert::From<Response<TSpec>> for RPCCodedResponse<TSpec> {
|
||||
@@ -98,7 +98,7 @@ impl<TSpec: EthSpec> std::convert::From<Response<TSpec>> for RPCCodedResponse<TS
|
||||
None => RPCCodedResponse::StreamTermination(ResponseTermination::BlocksByRange),
|
||||
},
|
||||
Response::BlobsByRoot(r) => match r {
|
||||
Some(b) => RPCCodedResponse::Success(RPCResponse::BlockAndBlobsByRoot(b)),
|
||||
Some(b) => RPCCodedResponse::Success(RPCResponse::BlobsByRoot(b)),
|
||||
None => RPCCodedResponse::StreamTermination(ResponseTermination::BlobsByRoot),
|
||||
},
|
||||
Response::BlobsByRange(r) => match r {
|
||||
|
||||
@@ -1315,7 +1315,7 @@ impl<AppReqId: ReqId, TSpec: EthSpec> Network<AppReqId, TSpec> {
|
||||
RPCResponse::BlocksByRoot(resp) => {
|
||||
self.build_response(id, peer_id, Response::BlocksByRoot(Some(resp)))
|
||||
}
|
||||
RPCResponse::BlockAndBlobsByRoot(resp) => {
|
||||
RPCResponse::BlobsByRoot(resp) => {
|
||||
self.build_response(id, peer_id, Response::BlobsByRoot(Some(resp)))
|
||||
}
|
||||
// Should never be reached
|
||||
|
||||
Reference in New Issue
Block a user