mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-04-30 03:01:58 -04:00
fix(rpc/engine): check osaka in getBlobsV1 (#18669)
Signed-off-by: Delweng <delweng@gmail.com>
This commit is contained in:
@@ -29,7 +29,10 @@ use reth_rpc_api::{EngineApiServer, IntoEngineApiRpcModule};
|
||||
use reth_storage_api::{BlockReader, HeaderProvider, StateProviderFactory};
|
||||
use reth_tasks::TaskSpawner;
|
||||
use reth_transaction_pool::TransactionPool;
|
||||
use std::{sync::Arc, time::Instant};
|
||||
use std::{
|
||||
sync::Arc,
|
||||
time::{Instant, SystemTime},
|
||||
};
|
||||
use tokio::sync::oneshot;
|
||||
use tracing::{debug, trace, warn};
|
||||
|
||||
@@ -752,6 +755,15 @@ where
|
||||
&self,
|
||||
versioned_hashes: Vec<B256>,
|
||||
) -> EngineApiResult<Vec<Option<BlobAndProofV1>>> {
|
||||
// Only allow this method before Osaka fork
|
||||
let current_timestamp =
|
||||
SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).unwrap_or_default().as_secs();
|
||||
if self.inner.chain_spec.is_osaka_active_at_timestamp(current_timestamp) {
|
||||
return Err(EngineApiError::EngineObjectValidationError(
|
||||
reth_payload_primitives::EngineObjectValidationError::UnsupportedFork,
|
||||
));
|
||||
}
|
||||
|
||||
if versioned_hashes.len() > MAX_BLOB_LIMIT {
|
||||
return Err(EngineApiError::BlobRequestTooLarge { len: versioned_hashes.len() })
|
||||
}
|
||||
@@ -787,6 +799,15 @@ where
|
||||
&self,
|
||||
versioned_hashes: Vec<B256>,
|
||||
) -> EngineApiResult<Option<Vec<BlobAndProofV2>>> {
|
||||
// Check if Osaka fork is active
|
||||
let current_timestamp =
|
||||
SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).unwrap_or_default().as_secs();
|
||||
if !self.inner.chain_spec.is_osaka_active_at_timestamp(current_timestamp) {
|
||||
return Err(EngineApiError::EngineObjectValidationError(
|
||||
reth_payload_primitives::EngineObjectValidationError::UnsupportedFork,
|
||||
));
|
||||
}
|
||||
|
||||
if versioned_hashes.len() > MAX_BLOB_LIMIT {
|
||||
return Err(EngineApiError::BlobRequestTooLarge { len: versioned_hashes.len() })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user