Skip to content

ci(ed25519-vectors): harden splice frame check and pin-parity version parse - #1081

Merged
alpergundogdu merged 1 commit into
mainfrom
hardening/ed25519-splice-parity
Jul 9, 2026
Merged

alpergundogdu merged 1 commit into
mainfrom
hardening/ed25519-splice-parity

Conversation

@alpergundogdu

@alpergundogdu alpergundogdu commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor

What & why

Follow-up robustness hardening to the Ed25519 differential-vector drift guard merged in #1075. These are the two optional items surfaced during review of that PR. Neither fires in the normal CI/local workflow — they turn corrupt-input edge cases from silent misbehavior into a loud failure / correct parse.

Changes

  1. contracts/test/ed25519-vectors/src/main.rs — splice() frame validation. Before consuming the // === frame line above/below each AUTO-GENERATED marker, verify it's actually a frame. Previously, a hand-edited .t.sol that lost a frame line but kept the marker would have its first real line silently deleted by --write; it now panics with a clear message naming the file and marker. This also replaces the misleading "markers out of order" diagnostic that fired when the END marker was the last line of the file.

  2. crates/incentive/tests/ed25519_pin_parity.rs — version-token parse. A qualified Cargo.lock dependency edge can be "name version (source)" (not just "name version") when a git/path override coexists with the registry copy. The parse now takes only the version token, so a trailing (source) suffix can't leak into the compared string and cause a spurious pin-mismatch failure. No such edge exists today (all dalek crates are single-source crates.io), so this is purely defensive.

Verification

  • cargo run -- --write + forge fmt stays idempotent (empty diff against committed vectors).
  • Pin-parity test still passes, and still trips on a simulated generator/node dalek mismatch.
  • New frame check panics as intended on a frame-stripped file (verified by temporarily removing a frame line), and the file is left untouched.
  • cargo fmt --check + cargo clippy -D warnings clean on both the generator workspace and decdn-incentive.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved validation around generated test data so missing or misplaced separator lines are caught with clearer errors.
    • Fixed version extraction in dependency pin checks to ignore extra trailing text, reducing false mismatches between expected and resolved versions.

… parse

Follow-up robustness hardening to the drift guard added in #1075. Neither
fires in the normal CI/local workflow; both make a corrupt-input edge case
fail loudly or parse correctly instead of silently misbehaving.

- splice(): verify the line above/below each marker is actually a `// ===`
  frame before consuming it. A hand-edited .t.sol that lost a frame line
  (but kept the marker) previously had its first real line silently deleted;
  it now panics with a clear message. Also gives an accurate diagnostic when
  the END marker is the last line, replacing the misleading "markers out of
  order".
- ed25519_pin_parity: take only the version token from a qualified Cargo.lock
  dependency edge, stripping any trailing ` (source)` suffix (present when a
  git/path override coexists with the registry copy) so it can't leak into
  the version string and cause a spurious mismatch.

Verified: --write + forge fmt stays idempotent, the parity test still passes
and still trips on a simulated pin drift, and the new frame check panics on a
frame-stripped file. fmt/clippy clean.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Copilot AI review requested due to automatic review settings July 9, 2026 09:33
@coderabbitai

coderabbitai Bot commented Jul 9, 2026 •

Copy link
Copy Markdown

Review Change Stack

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: b4d5fedf-1c69-4789-8b0d-c93f5b244927

📥 Commits

Reviewing files that changed from the base of the PR and between b31952a and dd08cfc.

📒 Files selected for processing (2)
  • contracts/test/ed25519-vectors/src/main.rs
  • crates/incentive/tests/ed25519_pin_parity.rs
 _______________________________________________________________________________________
< Analyze workflow to improve concurrency. Exploit concurrency in your user's workflow. >
 ---------------------------------------------------------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch hardening/ed25519-splice-parity

Comment @coderabbitai help to get the list of available commands.

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request improves robustness in test utilities. In contracts/test/ed25519-vectors/src/main.rs, the splice function now explicitly verifies that the lines immediately outside the start and end markers are // === frame lines to prevent silently overwriting real code. In crates/incentive/tests/ed25519_pin_parity.rs, the dependency version parser is updated to extract only the version token from qualified edges, preventing spurious mismatches when source suffixes are present. There are no review comments, so I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Copilot AI 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.

Pull request overview

This PR hardens the Ed25519 differential-vector drift guard added in #1075 by turning two corrupt-input edge cases into explicit failures / correct parsing, without affecting the normal CI/local workflow when inputs are well-formed.

Changes:

  • Tightens splice() validation in the vector generator to confirm expected // === frame lines exist around the AUTO-GENERATED marker span before rewriting.
  • Makes the pin-parity test’s Cargo.lock dependency parsing robust to qualified entries of the form "name version (source)" by extracting only the version token.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
crates/incentive/tests/ed25519_pin_parity.rs Parses only the version token from a qualified Cargo.lock dependency entry to avoid spurious pin mismatches.
contracts/test/ed25519-vectors/src/main.rs Validates marker-adjacent frame lines before splicing to prevent silent deletion of real code when frames are missing/corrupted.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

Gas snapshot

No gas changes vs base.

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

Contracts coverage

Line coverage: 91.47% (2347/2566 lines)
▲ +0.00pp vs base (91.47% → 91.47%)
Run: 29008630220

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

Coverage report

Total: 81.71% (was 81.71%, ● 0.00%) — 42842/52433 lines

No coverage data for changed Rust files.

History
Commit Total Δ vs base
dd08cfc (HEAD) 81.71% ● 0.00%

@alpergundogdu
alpergundogdu merged commit 3afbc19 into main Jul 9, 2026
24 checks passed
@alpergundogdu
alpergundogdu deleted the hardening/ed25519-splice-parity branch July 9, 2026 09:51
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.

2 participants