Skip to content

[pallet-revive]: move eth-rpc-only types out of pallet-revive#12037

Open
0xOmarA wants to merge 12 commits into
0xOmarA/versioned-storagefrom
0xOmarA/separate-eth-rpc-types
Open

[pallet-revive]: move eth-rpc-only types out of pallet-revive#12037
0xOmarA wants to merge 12 commits into
0xOmarA/versioned-storagefrom
0xOmarA/separate-eth-rpc-types

Conversation

@0xOmarA
Copy link
Copy Markdown
Contributor

@0xOmarA 0xOmarA commented May 8, 2026

Description

This PR is part of the versioning effort #11923 and closes #12045. This PR moves a number of types which used to be defined in pallet-revive over to the eth-rpc. A small set of byte wrapper types are now used from the pallet-revive-types crate.

The reason for this moving of types is that a lot of types were defined in pallet-revive but were not being used by pallet-revive in any way. They were defined there and were being used exclusively in the eth-rpc. Therefore, them being defined in pallet-revive did not make sense.

The public types which were moved to the eth-rpc are as follows:

  • pallet_revive_eth_rpc::types::fee_history:

    • FeeHistoryResult
  • pallet_revive_eth_rpc::types::log:

    • FilterResults
    • Log
  • pallet_revive_eth_rpc::types::receipt:

    • ReceiptInfo
  • pallet_revive_eth_rpc::types::subscriptions:

    • BlockHeader
    • BoundedOneOrMany
    • LogsSubscriptionFilter
    • SubscriptionItem
    • SubscriptionKind
    • SubscriptionOptions
    • SubscriptionParameters
  • pallet_revive_eth_rpc::types::sync:

    • SyncingProgress
    • SyncingStatus
  • pallet_revive_eth_rpc::types::trace:

    • TraceCallConfig
    • TracerConfig
    • TransactionTrace

The byte wrapper types which were removed from pallet-revive and are now used from pallet-revive-types are:

  • pallet_revive_types::common:
    • Byte
    • Bytes
    • Bytes8
    • Bytes32
    • Bytes256

The following pallet-owned types are still defined in pallet-revive, but the generated rpc_types_gen.rs catch-all file was removed and these types were split into focused modules:

  • pallet_revive::evm::api::block:

    • Block
    • Withdrawal
  • pallet_revive::evm::api::transaction:

    • AccessList
    • AccessListEntry
    • AuthorizationListEntry
    • GenericTransaction
    • HashesOrTransactionInfos
    • InputOrData
    • Transaction1559Signed
    • Transaction1559Unsigned
    • Transaction2930Signed
    • Transaction2930Unsigned
    • Transaction4844Signed
    • Transaction4844Unsigned
    • Transaction7702Signed
    • Transaction7702Unsigned
    • TransactionInfo
    • TransactionLegacySigned
    • TransactionLegacyUnsigned
    • TransactionSigned
    • TransactionUnsigned
  • pallet_revive::evm::api::state_override:

    • StateOverride
    • StateOverrideSet
    • StorageOverride

The old pallet-local block specifier and filter request types were removed instead of being moved. The eth-rpc now uses the corresponding alloy types:

  • alloy_rpc_types:
    • BlockId
    • BlockNumberOrTag
    • Filter

Integration

Downstream code which imported eth-rpc-only response or request helper types from pallet_revive::evm should import them from pallet-revive-eth-rpc instead. The eth-rpc crate re-exports these through its crate root and also groups them under pallet_revive_eth_rpc::types.

Code using Ethereum block specifiers or log filters in the eth-rpc should use the alloy request types re-exported by pallet-revive-eth-rpc:

use pallet_revive_eth_rpc::{BlockId, BlockNumberOrTag, Filter};

The core pallet transaction, block, and state override types remain available through the existing pallet_revive::evm::* public re-exports. Their backing modules changed, but users of the public re-export path should not need source changes for those types.

The byte wrappers are now the canonical definitions from pallet_revive_types::common. pallet_revive::evm::* continues to re-export them for compatibility.

Review Notes

The main structure change is that src/evm/api/rpc_types_gen.rs was removed. Types which are still used by pallet execution/storage were moved into src/evm/api/block.rs, src/evm/api/transaction.rs, and src/evm/api/state_override.rs. This is intended to be a definition and impl move, while keeping the public pallet_revive::evm::* re-export surface stable for the pallet-owned types.

The eth-rpc-only types now live in rpc/src/types/, grouped by use: fee history, logs, receipts, subscriptions, sync status, and debug tracing. The eth-rpc crate re-exports types::*, so RPC users can continue importing these types from the RPC crate root.

The TracerConfig deserializer was kept in the eth-rpc because the debug RPC accepts multiple request shapes. It handles both explicit tracer objects such as { "tracer": "callTracer", "tracerConfig": { ... } } and the inline execution tracer shape where execution tracer options are placed directly at the top level.

The duplicate byte wrapper definitions in pallet-revive were deleted. pallet-revive now re-exports Byte, Bytes, Bytes8, Bytes32, and Bytes256 from pallet-revive-types::common. The missing DecodeWithMemTracking derive support and the old byte serialization tests were added to the types crate.

0xOmarA added 10 commits May 8, 2026 20:22
We had some block specifier types defined in the codebase such as
`BlockTag`, `BlockNumberOrTag`, and `BlockNumberOrTagOrHash`. These
types were defined in pallet-revive and were never used there in any
way. The primary consumer of these types was the eth-rpc.

These types were removed in favor of types which are available through
alloy. Additionally, the `Filter`, `AddressOrAddresses` types were also
removed as we can use their alloy equivalent types in the eth-rpc.
This commit moves the types `SubscriptionKind`, `SubscriptionOptions`,
`LogsSubscriptionFilter`, `SubscriptionParameters`, `SubscriptionItem`,
and `BoundedOneOrMany` from pallet-revive and into the eth-rpc.

In a similar way to the previous commit, these types were not used in
any capacity by pallet-revive. They were defined in there but
exclusively used by the eth-rpc.
The `Log`, `FilterResults`, and `ReceiptInfo` types have been moved from
pallet-revive to the eth-rpc since they were not being used in revive
and only in the eth-rpc.
@0xOmarA 0xOmarA requested a review from a team as a code owner May 8, 2026 22:27
mod fee_history;
mod log;
mod receipt;
pub mod subscriptions;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: is there a reason this one module needs to be pub?


/// Build pallet transaction information from an RPC receipt and signed transaction.
#[must_use]
pub(crate) fn transaction_info_from_receipt(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: any reason this is a free function instead of ReceiptInfo::to_transaction_info?

/// A helper type used when a type can be serialized and deserialized as either being one or as an
/// array.
#[derive(
Debug, Clone, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord, Encode, Decode, TypeInfo,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: are Encode, Decode, and TypeInfo still required for BoundedOneOrMany?

match (from_block, to_block, filter.block_hash) {
match (from_block, to_block, block_hash) {
(Some(_), _, Some(_)) | (_, Some(_), Some(_)) => {
anyhow::bail!("block number and block hash cannot be used together");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: is this arm still reachable? Looks like the let above makes it impossible.

Copy link
Copy Markdown
Contributor

@marian-radu marian-radu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Worth pinging the anvil-polkadot team. After this PR is merged, revive_conversions.rs will stop compiling on the next polkadot-sdk bump.

Note: CI needs a look.

Copy link
Copy Markdown
Member

@athei athei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason for this moving of types is that a lot of types were defined in pallet-revive but were not being used by pallet-revive in any way. They were defined there and were being used exclusively in the eth-rpc. Therefore, them being defined in pallet-revive did not make sense.

What about downstream users of those types? They now need to import the rpc. Which is std dependency. Defining all types inside pallet-revive was on purpose for this reason.

Requesting changes and waiting for a rationale why those need to be moved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants