test(evm-core): fix stale delegation.rs test module#405
Open
manuelmauro wants to merge 1 commit into
Open
Conversation
The `Delegation` API was refactored from an `Option`-returning conversion to a `Result`-based `TryFrom<&[u8]>`, but the test module was never updated to match: - `try_from` was called with `&Vec<u8>`; the impl is `TryFrom<&[u8]>`, and trait selection does not deref-coerce `&Vec<u8>` to `&[u8]`. Pass `bytes.as_slice()` instead. - assertions compared against `Some(..)`/`None`; `try_from` returns `Result`. Compare against `Ok(..)`/`Err(DelegationError::InvalidFormat)`. The library itself compiles regardless, so `cargo check` without `--tests` never caught this. Surfaced by `cargo check --workspace --tests`.
manuelmauro
added a commit
to moonbeam-foundation/moonbeam
that referenced
this pull request
May 18, 2026
- Add an evm row for the `delegation.rs` test-module fix (moonbeam-foundation/evm@a122857), upstreamed as rust-ethereum/evm#405. - Correct the EIP-7939 row: PR #400 merged into `rust-ethereum/evm:v0.x`, so it is inherited from the upstream base, not a moonbeam cherry-pick (`Included` -> `Dropped`). Fix the matching "v1.0 only" claim in the Phase 1.2 plan.
manuelmauro
added a commit
to Moonsong-Labs/knowledge-work-plugins
that referenced
this pull request
May 18, 2026
…k verification (#52) ## What Adds a **"Verify the branch compiles"** step to the `qa-cherry-picks` skill's `verify-cherry-picks.md`, requiring `cargo check --workspace --tests` during fork-branch QA. ## Why The verification flow confirmed cherry-picks via git but never checked that the fork branch still built. Plain `cargo check --workspace` skips `#[cfg(test)]` modules and integration tests, so a cherry-pick — or an upstream refactor it lands on top of — can leave a test module that no longer compiles while the check still reports success. This was hit during the stable2603 cycle: evm's `evm-core` `delegation.rs` test module had been broken since an `Option`→`Result` API refactor, and a `--tests`-less check let it ride along undetected from one stable branch to the next. (Since fixed upstream: rust-ethereum/evm#405.) --------- Co-authored-by: Rodrigo Quelhas <22591718+RomarQ@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
evm-core'score/src/delegation.rshas a#[cfg(test)] mod teststhat does not compile:Delegation::try_from(&bytes)is called withbytes: Vec<u8>(so the argument is&Vec<u8>), but the impl isTryFrom<&[u8]>— trait selection does not deref-coerce&Vec<u8>to&[u8].Some(..)/None, buttry_fromreturnsResult<Delegation, DelegationError>.The module has been broken since #367 first added the file — the test was written against an
Option-returning draft of theDelegationAPI, while the merged impl returnsResultviaTryFrom.Why CI didn't catch it
The root
Cargo.tomlis both a[package](evm) and a[workspace], with nodefault-members. Per Cargo's rules, commands run from the root then default to the root package only — socargo test(the workflow's only test step) never descends intoevm-core, andcargo buildcompilesevm-coreonly as a dependency (a dependency's#[cfg(test)]modules are never built).cargo clippy --alllints lib/bin targets but not test targets.It surfaces with:
Fix
&[u8](bytes.as_slice()) so theTryFrom<&[u8]>impl is selected.Ok(..)/Err(DelegationError::InvalidFormat).Test-only change; no library code is touched.
Optional follow-up
Adding
--workspaceto thecargo teststep in.github/workflows/rust.ymlwould catch this whole class of never-compiled test code acrosscore/gasometer/runtime/fuzzer.