chore: change BlockAndProofV1 to use alloy_eips instead (#10969)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
krane
2024-09-18 19:25:18 +04:00
committed by GitHub
parent d76fd148d5
commit 74e58d8c82
15 changed files with 22 additions and 38 deletions

View File

@ -20,8 +20,8 @@ reth-engine-primitives.workspace = true
reth-network-peers.workspace = true
# ethereum
alloy-json-rpc.workspace = true
alloy-eips.workspace = true
alloy-json-rpc.workspace = true
alloy-primitives.workspace = true
# misc

View File

@ -3,7 +3,7 @@
//! This contains the `engine_` namespace and the subset of the `eth_` namespace that is exposed to
//! the consensus client.
use alloy_eips::{BlockId, BlockNumberOrTag};
use alloy_eips::{eip4844::BlobAndProofV1, BlockId, BlockNumberOrTag};
use alloy_json_rpc::RpcObject;
use alloy_primitives::{Address, BlockHash, Bytes, B256, U256, U64};
use jsonrpsee::{core::RpcResult, proc_macros::rpc};
@ -15,8 +15,8 @@ use reth_rpc_types::{
ForkchoiceState, ForkchoiceUpdated, PayloadId, PayloadStatus, TransitionConfiguration,
},
state::StateOverride,
BlobAndProofV1, BlockOverrides, EIP1186AccountProofResponse, Filter, JsonStorageKey, Log,
SyncStatus, TransactionRequest,
BlockOverrides, EIP1186AccountProofResponse, Filter, JsonStorageKey, Log, SyncStatus,
TransactionRequest,
};
// NOTE: We can't use associated types in the `EngineApi` trait because of jsonrpsee, so we use a
// generic here. It would be nice if the rpc macro would understand which types need to have serde.

View File

@ -28,6 +28,7 @@ reth-evm.workspace = true
reth-transaction-pool.workspace = true
# ethereum
alloy-eips.workspace = true
alloy-primitives.workspace = true
# async

View File

@ -1,6 +1,7 @@
use crate::{
capabilities::EngineCapabilities, metrics::EngineApiMetrics, EngineApiError, EngineApiResult,
};
use alloy_eips::eip4844::BlobAndProofV1;
use alloy_primitives::{BlockHash, BlockNumber, B256, U64};
use async_trait::async_trait;
use jsonrpsee_core::RpcResult;
@ -15,14 +16,11 @@ use reth_payload_primitives::{
};
use reth_primitives::{Block, BlockHashOrNumber, EthereumHardfork};
use reth_rpc_api::EngineApiServer;
use reth_rpc_types::{
engine::{
CancunPayloadFields, ClientVersionV1, ExecutionPayload, ExecutionPayloadBodiesV1,
ExecutionPayloadBodiesV2, ExecutionPayloadInputV2, ExecutionPayloadV1, ExecutionPayloadV3,
ExecutionPayloadV4, ForkchoiceState, ForkchoiceUpdated, PayloadId, PayloadStatus,
TransitionConfiguration,
},
BlobAndProofV1,
use reth_rpc_types::engine::{
CancunPayloadFields, ClientVersionV1, ExecutionPayload, ExecutionPayloadBodiesV1,
ExecutionPayloadBodiesV2, ExecutionPayloadInputV2, ExecutionPayloadV1, ExecutionPayloadV3,
ExecutionPayloadV4, ForkchoiceState, ForkchoiceUpdated, PayloadId, PayloadStatus,
TransitionConfiguration,
};
use reth_rpc_types_compat::engine::payload::{
convert_payload_input_v2_to_payload, convert_to_payload_body_v1, convert_to_payload_body_v2,

View File

@ -14,7 +14,6 @@ workspace = true
[dependencies]
# ethereum
alloy-eips.workspace = true
alloy-primitives = { workspace = true, features = ["rand", "rlp", "serde"] }
alloy-rpc-types.workspace = true
alloy-rpc-types-admin.workspace = true
@ -33,7 +32,6 @@ op-alloy-rpc-types-engine.workspace = true
# misc
jsonrpsee-types = { workspace = true, optional = true }
serde.workspace = true
[dev-dependencies]
# misc

View File

@ -61,18 +61,6 @@ pub use eth::{
},
};
use alloy_eips::eip4844::{Blob, Bytes48};
use serde::{Deserialize, Serialize};
/// Blob type returned in responses to `engine_getBlobsV1`: <https://github.com/ethereum/execution-apis/pull/559>
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct BlobAndProofV1 {
/// The blob data.
pub blob: Box<Blob>,
/// The KZG proof for the blob.
pub proof: Bytes48,
}
/// Optimism specific rpc types.
pub mod optimism {
pub use op_alloy_rpc_types::*;

View File

@ -18,15 +18,15 @@ reth-chainspec.workspace = true
reth-eth-wire-types.workspace = true
reth-primitives = { workspace = true, features = ["c-kzg", "secp256k1"] }
reth-execution-types.workspace = true
reth-rpc-types.workspace = true
reth-fs-util.workspace = true
reth-storage-api.workspace = true
reth-tasks.workspace = true
revm.workspace = true
# ethereum
alloy-rlp.workspace = true
alloy-eips.workspace = true
alloy-primitives.workspace = true
alloy-rlp.workspace = true
# async/futures
futures-util.workspace = true

View File

@ -1,11 +1,11 @@
//! A simple diskstore for blobs
use crate::blobstore::{BlobStore, BlobStoreCleanupStat, BlobStoreError, BlobStoreSize};
use alloy_eips::eip4844::BlobAndProofV1;
use alloy_primitives::{TxHash, B256};
use alloy_rlp::{Decodable, Encodable};
use parking_lot::{Mutex, RwLock};
use reth_primitives::BlobTransactionSidecar;
use reth_rpc_types::BlobAndProofV1;
use schnellru::{ByLength, LruMap};
use std::{collections::HashSet, fmt, fs, io, path::PathBuf, sync::Arc};
use tracing::{debug, trace};

View File

@ -1,9 +1,9 @@
use crate::blobstore::{
BlobStore, BlobStoreCleanupStat, BlobStoreError, BlobStoreSize, BlobTransactionSidecar,
};
use alloy_eips::eip4844::BlobAndProofV1;
use alloy_primitives::B256;
use parking_lot::RwLock;
use reth_rpc_types::BlobAndProofV1;
use std::{collections::HashMap, sync::Arc};
/// An in-memory blob store.

View File

@ -1,11 +1,11 @@
//! Storage for blob data of EIP4844 transactions.
use alloy_eips::eip4844::BlobAndProofV1;
use alloy_primitives::B256;
pub use disk::{DiskFileBlobStore, DiskFileBlobStoreConfig, OpenDiskFileBlobStore};
pub use mem::InMemoryBlobStore;
pub use noop::NoopBlobStore;
use reth_primitives::BlobTransactionSidecar;
use reth_rpc_types::BlobAndProofV1;
use std::{
fmt,
sync::atomic::{AtomicUsize, Ordering},

View File

@ -1,6 +1,6 @@
use crate::blobstore::{BlobStore, BlobStoreCleanupStat, BlobStoreError, BlobTransactionSidecar};
use alloy_eips::eip4844::BlobAndProofV1;
use alloy_primitives::B256;
use reth_rpc_types::BlobAndProofV1;
/// A blobstore implementation that does nothing
#[derive(Clone, Copy, Debug, PartialOrd, PartialEq, Eq, Default)]

View File

@ -151,12 +151,12 @@
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
use crate::{identifier::TransactionId, pool::PoolInner};
use alloy_eips::eip4844::BlobAndProofV1;
use alloy_primitives::{Address, TxHash, B256, U256};
use aquamarine as _;
use reth_eth_wire_types::HandleMempoolData;
use reth_execution_types::ChangedAccount;
use reth_primitives::{BlobTransactionSidecar, PooledTransactionsElement};
use reth_rpc_types::BlobAndProofV1;
use reth_storage_api::StateProviderFactory;
use std::{collections::HashSet, sync::Arc};
use tokio::sync::mpsc::Receiver;

View File

@ -16,10 +16,10 @@ use crate::{
PooledTransactionsElement, PropagatedTransactions, TransactionEvents, TransactionOrigin,
TransactionPool, TransactionValidationOutcome, TransactionValidator, ValidPoolTransaction,
};
use alloy_eips::eip4844::BlobAndProofV1;
use alloy_primitives::{Address, TxHash, B256, U256};
use reth_eth_wire_types::HandleMempoolData;
use reth_primitives::BlobTransactionSidecar;
use reth_rpc_types::BlobAndProofV1;
use std::{collections::HashSet, marker::PhantomData, sync::Arc};
use tokio::sync::{mpsc, mpsc::Receiver};

View File

@ -7,6 +7,7 @@ use crate::{
validate::ValidPoolTransaction,
AllTransactionsEvents,
};
use alloy_eips::eip4844::BlobAndProofV1;
use alloy_primitives::{Address, TxHash, TxKind, B256, U256};
use futures_util::{ready, Stream};
use reth_eth_wire_types::HandleMempoolData;
@ -17,7 +18,6 @@ use reth_primitives::{
PooledTransactionsElementEcRecovered, SealedBlock, Transaction, TransactionSignedEcRecovered,
EIP1559_TX_TYPE_ID, EIP4844_TX_TYPE_ID, EIP7702_TX_TYPE_ID,
};
use reth_rpc_types::BlobAndProofV1;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
use std::{