Skip to content

Refac: collapse ExecutionKind/EvmKind into orthogonal Job + PointInTime types #2720

Description

@gventino-cw

Context

Raised by @carneiro in #2710 (comment): the execution type system (EvmKind, ExecutionKind, PoolTaskKind, plus PointInTime/BlockFilter) is redundant and can lose meaning — e.g. an ExecutionKind::CallPast always maps onto an EvmKind::CallPast, so the second enum adds no information, and since the tags are stored and hand-constructed, nothing stops them from disagreeing (a CallPast execution ending up tagged Inspect, etc.).

Analysis confirms the redundancy is structural:

  • EvmKind fuses three different concerns:
    1. revm configuration policy — but create_evm (src/eth/executor/evm/util.rs) only ever reads kind.is_transaction()/is_call() (chain-id check, nonce check, EIP-3607). CallPast vs CallPresent vs Inspect make zero difference to the EVM.
    2. storage view — which actually comes from the input's ExecutionKind (database.reset(input.kind())), not from EvmKind at all.
    3. pool scheduling lane — admission gate key + limits + metrics label, its only real job.
  • ExecutionKind mixes the what (transaction/call/inspect/access-list) with the where (pending/latest/past block) in its variants (CallPast(n), RPC(PointInTime), ...).

Proposal

Collapse to two orthogonal axes and derive everything else:

  • enum Job { Transaction, Call, Inspect, AccessList } — what is executed.
  • PointInTime { Pending, Latest, Past(n) } — which state view (already exists).
  • struct ExecutionContext { job: Job, at: PointInTime } replaces ExecutionKind.
  • create_evm takes only the policy bit it needs (is_transaction).
  • The pool derives a small Lane from (job, at) in a single match — used as admission gate key and metrics label (label strings unchanged so dashboards don't break).
  • EvmKind and the old ExecutionKind are deleted; hand-constructed kind tags disappear, so tag/input mismatches become impossible by construction.
  • PointInTime and BlockFilter stay separate: one is the execution-internal state view, the other is RPC request resolution (hash/timestamp/range → number) that happens before execution.

Scope

On main: ExecutionKind is used in 12 files (rpc/server.rs, storage/resolve_pending.rs, stratus_storage.rs, session.rs, evm inputs, follower importer/consensus, metrics); EvmKind in 7 (infra/metrics.rs, evm_worker_pool.rs, transaction_worker.rs, evm/mod.rs, evm/util.rs).

Branch: refac/evm-kind-orthogonal.

Activity

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions