Skip to content

refac: collapse ExecutionKind/EvmKind into orthogonal Job + StateView types - #2721

Open
gventino-cw wants to merge 1 commit into
mainfrom
refac/evm-kind-orthogonal
Open

gventino-cw wants to merge 1 commit into
mainfrom
refac/evm-kind-orthogonal

Conversation

@gventino-cw

Copy link
Copy Markdown
Contributor

Motivation

Review of #2710 (discussion r4138469433) pointed out that ExecutionKind and EvmKind encode overlapping, redundant information: ExecutionKind::CallLatest and ExecutionKind::CallPast fuse what triggers the execution with when the state is read, while EvmKind re-derives the same distinction for the worker pool.

This collapses both into orthogonal types, with no behavior change.

Changes

New: Job + StateView + ExecutionContext (src/eth/types/execution_context.rs, replaces src/eth/types/execution_kind.rs):

  • Job { Transaction, Call, Rpc, AccessList } — what triggers the execution. Drives EVM policy (nonce/EIP-3607 checks, chain-id check) and storage cache eligibility (Job::Call | Job::AccessList reads from FoundAt::PermLatest cache latest, exactly the old CallLatest/CallPast/AccessList set).
  • StateView { Pending, Latest(Option<BlockNumber>), Past(BlockNumber) } — which state storage reads resolve to. Pending reads transient state; Past(n) reads a mined block; Latest(n) resolves through the block cache.
  • ExecutionContext { job, at } — the combination, carried end-to-end by EVM inputs, the executor, and storage read/read_account/read_slot.

EvmKind → Lane (src/eth/executor/evm/types/mod.rs): Lane { Transaction, CallPresent, CallPast, Inspector } keeps only what the worker pool genuinely needs — admission lane and busy-gauge metric label — with identical label strings ("transaction", "call_present", "call_past", "inspector").

Metric labels now come from a single ExecutionContext::metrics_label() instead of per-enum AsRefStr impls; EVM execution labels (transaction, call_latest, call_past, access_list) are byte-identical to before.

Verification

  • cargo check --all-targets clean
  • No references to ExecutionKind/EvmKind remain
  • Unit tests: executor 9, storage 38, follower 2, rpc 54, validate 2, config_loader 15 — all pass
  • just lint-check fails only on the pre-existing fetch_update deprecation at src/eth/follower/importer/mod.rs:60 (same on main)

Closes #2720

@gventino-cw
gventino-cw requested a review from a team as a code owner September 30, 2026 15:08

@cloudwalk-review-agent cloudwalk-review-agent Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Summary

Refactor looks behavior-preserving and internally consistent: ExecutionKind/EvmKind responsibilities are cleanly split into ExecutionContext { job, at } and worker-pool Lane, and callsites were updated coherently across executor, storage, RPC, follower, and metrics.

I checked the highest-risk paths (state resolution, EVM policy toggles, and routing):

  • Storage read resolution still keys off state view (Pending vs Latest(Some) vs Past) in a way that matches prior semantics.
  • EVM policy flags (tx_chain_id_check, nonce/EIP-3607 checks) now depend on Job::is_transaction(), which preserves the old tx-vs-call behavior.
  • Worker-pool busy metrics moved to Lane labels with unchanged label values.

No concrete correctness/security/deploy-blocking issues found in the provided diff context.

@github-actions

Copy link
Copy Markdown
Contributor

Failed to generate code suggestions for PR

… types

Replace the fused ExecutionKind enum (CallLatest/CallPast/Transaction/RPC/AccessList)
with an orthogonal pair:

- Job {Transaction, Call, Rpc, AccessList}: what triggers the execution (EVM policy,
  cache eligibility)
- StateView {Pending, Latest(Option<BlockNumber>), Past(BlockNumber)}: which state
  storage reads resolve to
- ExecutionContext {job, at}: the combination, carried by EVM inputs and storage reads

EvmKind is replaced by Lane {Transaction, CallPresent, CallPast, Inspector}, which
keeps only what the worker pool genuinely needs (admission lane + busy-gauge metric
label), with identical label strings.

Closes #2720
@gventino-cw
gventino-cw force-pushed the refac/evm-kind-orthogonal branch from d53381e to ca791a0 Compare September 30, 2026 18:23
@gventino-cw
gventino-cw marked this pull request as ready for review September 30, 2026 18:41

@cloudwalk-review-agent cloudwalk-review-agent Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Summary

Refactor appears behavior-preserving in the provided diff: the split into ExecutionContext { job, at } plus worker-pool Lane is consistently propagated through executor, EVM/session reset, storage read resolution, RPC entrypoints, and metrics label emission.

I specifically checked the high-risk paths:

  • EVM policy toggles still separate tx vs non-tx behavior via Job::is_transaction() (chain-id/nonce/EIP-3607).
  • Storage pending/latest/past resolution semantics are preserved via StateView (Pending temp-first, Latest(Some) staleness-aware downgrade path, Past fixed block).
  • Worker busy gauges keep the same label strings after EvmKind→Lane rename.

No concrete correctness/security/concurrency issue was found in the supplied context.

@github-actions

Copy link
Copy Markdown
Contributor

Failed to generate code suggestions for PR

This branch has not been deployed

No deployments
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.

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

1 participant