Skip to content

Conversation

@peterargue
Copy link
Contributor

@peterargue peterargue commented Jan 6, 2026

Backports ee6c8e9 to [v0.45.0-experimental-cadence-v1.8.7](https://github.com/onflow/flow-go/releases/tag/v0.45.0-experimental-cadence-v1.8.7) for use by the emulator

Summary by CodeRabbit

  • Improvements
    • More reliable script execution and system-contract invocations by ensuring the runtime environment is fully initialized before use.
    • Reduced setup-related errors during dependency checks, improving stability when running scripts and automated validations.

✏️ Tip: You can customize this high-level summary in your review settings.

@peterargue peterargue requested a review from a team as a code owner January 6, 2026 00:16
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 6, 2026

📝 Walkthrough

Walkthrough

When EVM is enabled, InternalEVM is initialized in both ScriptRuntimeEnv and TxRuntimeEnv. The executeScript flow now calls SetupEnvironment for ScriptRuntimeEnv and again for TxRuntimeEnv, propagating any error from either setup to ensure InternalEVM is available for system-contract invocations.

Changes

Cohort / File(s) Change Summary
EVM Dual Environment Setup
fvm/script.go
Added a second SetupEnvironment call targeting TxRuntimeEnv (in addition to the existing ScriptRuntimeEnv call) when EVM is enabled; now propagates errors from both environment initializations so InternalEVM is available for system-contract dependency checks.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Caller as executeScript
  participant ScriptEnv as ScriptRuntimeEnv
  participant TxEnv as TxRuntimeEnv
  participant EVM as InternalEVM
  participant SysContract as SystemContract

  Caller->>ScriptEnv: SetupEnvironment(ScriptRuntimeEnv)
  alt setup success
    ScriptEnv->>EVM: initialize InternalEVM
    Caller->>TxEnv: SetupEnvironment(TxRuntimeEnv)
    alt setup success
      TxEnv->>EVM: ensure InternalEVM available
      Caller->>SysContract: invoke dependency checks (may call system contracts)
      SysContract->>EVM: use InternalEVM for checks
      Caller->>Caller: proceed to execute script
    else setup error
      TxEnv-->>Caller: return error (propagated)
    end
  else setup error
    ScriptEnv-->>Caller: return error (propagated)
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 Two homes now prepped where the EVM can play,
Script and Tx both ready to join in the fray,
We call them twice, check errors with care,
So system contracts find InternalEVM there,
A cheerful hop for stability today!

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title describes a backport of a fix for access scripts to a specific experimental Cadence version, which aligns with the PR objective of backporting commit ee6c8e9 to the v0.45.0-experimental-cadence-v1.8.7 release branch.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2008b1a and 2b5aaef.

📒 Files selected for processing (1)
  • fvm/script.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • fvm/script.go
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (37)
  • GitHub Check: Lint (./insecure/)
  • GitHub Check: Lint (./integration/)
  • GitHub Check: Lint (./)
  • GitHub Check: Unit Tests (network/p2p/node)
  • GitHub Check: Unit Tests (network/p2p/connection)
  • GitHub Check: Unit Tests (network/p2p/scoring)
  • GitHub Check: Unit Tests (module)
  • GitHub Check: Unit Tests (others)
  • GitHub Check: Unit Tests (engine/execution)
  • GitHub Check: Unit Tests (network/alsp)
  • GitHub Check: Unit Tests (network/test/cohort1)
  • GitHub Check: Unit Tests (network/test/cohort2)
  • GitHub Check: Unit Tests (network/p2p)
  • GitHub Check: Unit Tests (engine/verification)
  • GitHub Check: Unit Tests (module/dkg)
  • GitHub Check: Unit Tests (engine/execution/ingestion)
  • GitHub Check: Unit Tests (engine/consensus)
  • GitHub Check: Unit Tests (engine)
  • GitHub Check: Unit Tests (ledger)
  • GitHub Check: Unit Tests (storage)
  • GitHub Check: Unit Tests (network)
  • GitHub Check: Unit Tests (engine/execution/computation)
  • GitHub Check: Unit Tests (consensus)
  • GitHub Check: Unit Tests (engine/common)
  • GitHub Check: Unit Tests (engine/collection)
  • GitHub Check: Unit Tests (fvm)
  • GitHub Check: Unit Tests (utils)
  • GitHub Check: Unit Tests (state)
  • GitHub Check: Unit Tests (cmd)
  • GitHub Check: Unit Tests (engine/access)
  • GitHub Check: Unit Tests (admin)
  • GitHub Check: Integration Tests Others (integration)
  • GitHub Check: Unit Tests Insecure (insecure)
  • GitHub Check: Unit Tests Insecure (insecure/integration/functional/test/gossipsub/rpc_inspector)
  • GitHub Check: Unit Tests Insecure (insecure/integration/functional/test/gossipsub/scoring)
  • GitHub Check: Docker Build
  • GitHub Check: analyze-code (go)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@github-actions
Copy link
Contributor

github-actions bot commented Jan 6, 2026

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@codecov-commenter
Copy link

codecov-commenter commented Jan 6, 2026

Codecov Report

❌ Patch coverage is 71.42857% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
fvm/script.go 71.42% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Contributor

@janezpodhostnik janezpodhostnik left a comment

Choose a reason for hiding this comment

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

I'm ok with merging this for now, before we do the proper fix with #8295.

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.

6 participants