Skip to content

Comments

fix(preprocessor): mark getCode as view in VmContractHelper#13089

Merged
grandizzy merged 1 commit intofoundry-rs:masterfrom
grandizzy:fix/creation-code-view-function
Jan 15, 2026
Merged

fix(preprocessor): mark getCode as view in VmContractHelper#13089
grandizzy merged 1 commit intofoundry-rs:masterfrom
grandizzy:fix/creation-code-view-function

Conversation

@grandizzy
Copy link
Collaborator

Summary

When using type(Contract).creationCode in test files with dynamic_test_linking = true, Foundry transforms it to VmContractHelper.getCode(). The generated interface was missing the view modifier, which broke view function compatibility.

Fix

Added view modifier to the getCode function in the generated VmContractHelper interface.

Test

Added preprocess_creation_code_in_view_function test to verify type(Contract).creationCode works in view functions with dynamic linking.

Fixes #13086

When using `type(Contract).creationCode` in test files with dynamic linking,
Foundry transforms it to `VmContractHelper.getCode()`. The generated interface
was missing the `view` modifier, which broke view function compatibility.

Fixes foundry-rs#13086
@mattsse mattsse added this pull request to the merge queue Jan 15, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 15, 2026
@grandizzy grandizzy added this pull request to the merge queue Jan 15, 2026
Merged via the queue into foundry-rs:master with commit a0fb0e8 Jan 15, 2026
29 of 31 checks passed
@grandizzy grandizzy deleted the fix/creation-code-view-function branch January 15, 2026 00:36
@github-project-automation github-project-automation bot moved this to Done in Foundry Jan 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Title: type(Contract).creationCode in test files is transformed into state-modifying call, breaking view function

2 participants