Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RPC Executor improvements #10974

Open
Rjected opened this issue Sep 17, 2024 · 1 comment
Open

RPC Executor improvements #10974

Rjected opened this issue Sep 17, 2024 · 1 comment
Assignees
Labels
A-op-reth Related to Optimism and op-reth A-rpc Related to the RPC implementation C-bug An unexpected or incorrect behavior S-needs-design This issue requires design work to think about how it would best be accomplished

Comments

@Rjected
Copy link
Member

Rjected commented Sep 17, 2024

debug_executionWitness currently needs to output all state required to execute the given block. The endpoint currently does not work for optimism because it needs to use the optimism executor, and the eth mainnet system calls may be different from optimism. It also needs to retain more execution-related information than is desired for the vanilla executor.

The debug_executionWitness endpoint

The endpoint needs to return the following information:

  • all state that was accessed or changed during block execution
    • including system calls and transactions
  • all code loaded during execution
  • merkle proofs for the state accessed / changed during block execution

We need to leave the current executor as-is, so we don't do more than needed during regular block processing.

A new executor

So, we now have the BlockAccessListExecutor, which implements the Executor trait:

impl<EvmConfig, DB> Executor<DB> for BlockAccessListExecutor<EvmConfig, DB>

This is a new executor that retains the accessed state in the BundleState of the BlockExecutionOutput. There is also one for optimism. This separate executor meets all requirements for the endpoint, but we still need to make this executor accessible to the RPC endpoint.

Executors in RPC

We currently have the BlockExecutorProvider, which provides multiple types of executors for RPC to use:

type Executor<DB: Database<Error: Into<ProviderError> + Display>>: for<'a> Executor<
DB,
Input<'a> = BlockExecutionInput<'a, BlockWithSenders>,
Output = BlockExecutionOutput<Receipt>,
Error = BlockExecutionError,
>;
/// An executor that can execute a batch of blocks given a database.
type BatchExecutor<DB: Database<Error: Into<ProviderError> + Display>>: for<'a> BatchExecutor<
DB,
Input<'a> = BlockExecutionInput<'a, BlockWithSenders>,
Output = ExecutionOutcome,
Error = BlockExecutionError,
>;

This PR includes a third type of executor to include in the BlockExecutorProvider trait: #10868

We can either:

  • pursue this direction further, or
  • change how we get executors for rpc somehow

cc @mattsse

@Rjected Rjected added S-needs-design This issue requires design work to think about how it would best be accomplished A-rpc Related to the RPC implementation labels Sep 17, 2024
@mattsse mattsse self-assigned this Sep 18, 2024
@emhane emhane added C-bug An unexpected or incorrect behavior A-op-reth Related to Optimism and op-reth S-needs-design This issue requires design work to think about how it would best be accomplished and removed S-needs-design This issue requires design work to think about how it would best be accomplished labels Sep 18, 2024
@malik672
Copy link
Contributor

debug_executionWitness currently needs to output all state required to execute the given block. The endpoint currently does not work for optimism because it needs to use the optimism executor, and the eth mainnet system calls may be different from optimism. It also needs to retain more execution-related information than is desired for the vanilla executor.

The debug_executionWitness endpoint

The endpoint needs to return the following information:

  • all state that was accessed or changed during block execution

    • including system calls and transactions
  • all code loaded during execution

  • merkle proofs for the state accessed / changed during block execution

We need to leave the current executor as-is, so we don't do more than needed during regular block processing.

A new executor

So, we now have the BlockAccessListExecutor, which implements the Executor trait:

impl<EvmConfig, DB> Executor<DB> for BlockAccessListExecutor<EvmConfig, DB>

This is a new executor that retains the accessed state in the BundleState of the BlockExecutionOutput. There is also one for optimism. This separate executor meets all requirements for the endpoint, but we still need to make this executor accessible to the RPC endpoint.

Executors in RPC

We currently have the BlockExecutorProvider, which provides multiple types of executors for RPC to use:

type Executor<DB: Database<Error: Into<ProviderError> + Display>>: for<'a> Executor<
DB,
Input<'a> = BlockExecutionInput<'a, BlockWithSenders>,
Output = BlockExecutionOutput<Receipt>,
Error = BlockExecutionError,
>;
/// An executor that can execute a batch of blocks given a database.
type BatchExecutor<DB: Database<Error: Into<ProviderError> + Display>>: for<'a> BatchExecutor<
DB,
Input<'a> = BlockExecutionInput<'a, BlockWithSenders>,
Output = ExecutionOutcome,
Error = BlockExecutionError,
>;

This PR includes a third type of executor to include in the BlockExecutorProvider trait: #10868

We can either:

  • pursue this direction further, or
  • change how we get executors for rpc somehow

cc @mattsse

I'm not sure but I think it should be made custom, would solve the compatibility issue easily

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-op-reth Related to Optimism and op-reth A-rpc Related to the RPC implementation C-bug An unexpected or incorrect behavior S-needs-design This issue requires design work to think about how it would best be accomplished
Projects
Status: Todo
Development

No branches or pull requests

4 participants