Skip to content

refactor: extract IRState.withTx and YulTransaction.ofIR helpers#1733

Merged
Th0rgal merged 2 commits intomainfrom
paper/refactor-state-helpers
Apr 16, 2026
Merged

refactor: extract IRState.withTx and YulTransaction.ofIR helpers#1733
Th0rgal merged 2 commits intomainfrom
paper/refactor-state-helpers

Conversation

@Th0rgal
Copy link
Copy Markdown
Member

@Th0rgal Th0rgal commented Apr 16, 2026

Summary

  • Introduce IRState.withTx helper that applies transaction context fields (sender, msgValue, etc.) to an IR state, replacing 37 inline occurrences of the 9-line record update pattern
  • Introduce YulTransaction.ofIR helper that converts IR transactions to Yul transactions, eliminating duplicate field-copying boilerplate
  • Both are @[reducible] with @[simp] lemmas so existing proofs work unchanged
  • Net reduction: 153 lines (57 insertions, 210 deletions)

Motivation

The paper listings for EthRes 2026 include theorem signatures from these files. The inline record updates made the theorems difficult to read both in code and in the paper. These helpers make the proof signatures self-documenting.

Test plan

  • lake build Compiler.Proofs.YulGeneration.Equivalence passes
  • lake build Compiler.Proofs.YulGeneration.Preservation passes (pre-existing simp warnings only)
  • lake build Compiler.Proofs.EndToEnd passes
  • Full CI build

🤖 Generated with Claude Code


Note

Low Risk
Mechanical refactor of proof/semantic glue code; main risk is unintended rewriting/simp changes that could subtly affect proof obligations, but runtime semantics are unchanged.

Overview
Refactors the IR→Yul proof stack to eliminate repeated transaction-field record construction by introducing IRState.withTx (apply IRTransaction context onto an IRState) and YulTransaction.ofIR (convert IRTransaction to YulTransaction) with supporting simp lemmas.

Updates end-to-end and preservation/equivalence proofs (EndToEnd.lean, YulGeneration/{Equivalence,Preservation}.lean) to use these helpers in hypotheses and runtime calls, simplifying theorem signatures without changing proof intent.

Reviewed by Cursor Bugbot for commit 8c58fb2. Bugbot is set up for automated code reviews on this repo. Configure here.

Thomas Marchand and others added 2 commits April 16, 2026 10:18
Replace 37 inline occurrences of the 9-line transaction-context
record update pattern with two @[reducible] helpers:

- IRState.withTx: copies transaction fields into an IR state
- YulTransaction.ofIR: converts IR transactions to Yul transactions

Both helpers include @[simp] lemmas (sender, storage, events) so
existing proofs work unchanged. Net reduction: 153 lines.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Th0rgal Th0rgal merged commit e79c454 into main Apr 16, 2026
Th0rgal pushed a commit that referenced this pull request Apr 16, 2026
Pick up YulTransaction.ofIR_sender/ofIR_args from #1733.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Th0rgal pushed a commit that referenced this pull request Apr 16, 2026
…bridge

Merge origin/main to pick up:
- refactor: extract IRState.withTx and YulTransaction.ofIR helpers (#1733)
- fix: link to the paper

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant