don't expect context bytes for blob messages

This commit is contained in:
realbigsean 2022-12-20 19:32:54 -05:00
parent 9c46a1cb21
commit a67fa516c7
No known key found for this signature in database
GPG Key ID: B372B64D866BF8CC
4 changed files with 39 additions and 33 deletions

View File

@ -570,38 +570,42 @@ fn handle_v1_response<T: EthSpec>(
SignedBeaconBlock::Base(SignedBeaconBlockBase::from_ssz_bytes(decoded_buffer)?),
)))),
Protocol::BlobsByRange => {
let fork_name = fork_name.take().ok_or_else(|| {
RPCError::ErrorResponse(
RPCResponseErrorCode::InvalidRequest,
format!("No context bytes provided for {} response", protocol),
)
})?;
match fork_name {
ForkName::Eip4844 => Ok(Some(RPCResponse::BlobsByRange(Arc::new(
BlobsSidecar::from_ssz_bytes(decoded_buffer)?,
)))),
_ => Err(RPCError::ErrorResponse(
RPCResponseErrorCode::InvalidRequest,
"Invalid forkname for blobsbyrange".to_string(),
)),
}
Ok(Some(RPCResponse::BlobsByRange(Arc::new(
BlobsSidecar::from_ssz_bytes(decoded_buffer)?,
))))
//FIXME(sean) do we need context bytes?
// let fork_name = fork_name.take().ok_or_else(|| {
// RPCError::ErrorResponse(
// RPCResponseErrorCode::InvalidRequest,
// format!("No context bytes provided for {} response", protocol),
// )
// })?;
// match fork_name {
// ForkName::Eip4844 => ,
// _ => Err(RPCError::ErrorResponse(
// RPCResponseErrorCode::InvalidRequest,
// "Invalid forkname for blobsbyrange".to_string(),
// )),
// }
}
Protocol::BlobsByRoot => {
let fork_name = fork_name.take().ok_or_else(|| {
RPCError::ErrorResponse(
RPCResponseErrorCode::InvalidRequest,
format!("No context bytes provided for {} response", protocol),
)
})?;
match fork_name {
ForkName::Eip4844 => Ok(Some(RPCResponse::BlobsByRoot(Arc::new(
SignedBeaconBlockAndBlobsSidecar::from_ssz_bytes(decoded_buffer)?,
)))),
_ => Err(RPCError::ErrorResponse(
RPCResponseErrorCode::InvalidRequest,
"Invalid forkname for blobsbyroot".to_string(),
)),
}
Ok(Some(RPCResponse::BlobsByRoot(Arc::new(
SignedBeaconBlockAndBlobsSidecar::from_ssz_bytes(decoded_buffer)?,
))))
//FIXME(sean) do we need context bytes?
// let fork_name = fork_name.take().ok_or_else(|| {
// RPCError::ErrorResponse(
// RPCResponseErrorCode::InvalidRequest,
// format!("No context bytes provided for {} response", protocol),
// )
// })?;
// match fork_name {
// ForkName::Eip4844 =>
// _ => Err(RPCError::ErrorResponse(
// RPCResponseErrorCode::InvalidRequest,
// "Invalid forkname for blobsbyroot".to_string(),
// )),
// }
}
Protocol::Ping => Ok(Some(RPCResponse::Pong(Ping {
data: u64::from_ssz_bytes(decoded_buffer)?,

View File

@ -503,6 +503,8 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> HotColdDB<E, Hot, Cold>
}
pub fn get_blobs(&self, block_root: &Hash256) -> Result<Option<BlobsSidecar<E>>, Error> {
// FIXME(sean) I was attempting to use a blob cache here but was getting deadlocks,
// may want to attempt to use one again
if let Some(bytes) = self
.hot_db
.get_bytes(DBColumn::BeaconBlob.into(), block_root.as_bytes())?

View File

@ -12,8 +12,8 @@
"berlinBlock": 0,
"londonBlock": 0,
"mergeNetsplitBlock": 0,
"shanghaiTime": 0,
"shardingForkTime": 0,
"shanghaiTime": 1671582851,
"shardingForkTime": 1671582947,
"terminalTotalDifficulty": 0
},
"alloc": {

View File

@ -1,4 +1,4 @@
GETH_BINARY=geth
GETH_BINARY=/home/sean/CLionProjects/eip4844-interop/geth/go-ethereum/build/bin/geth
# Base directories for the validator keys and secrets
DATADIR=~/.lighthouse/local-testnet