foundry-rs / foundry-rs/foundry

feat(forge/cheatcodes): "server" feature flag to disable sys env var reads

Open
#9,038 0 comments 1 reaction 0 assignees View on GitHub
A-cheatcodes A-internals A-library T-feature T-post-V1
Dominant language
Rust
Stars
10.6k
Forks
2.6k
Avg merge
16h 38m
Merged PRs (30d)
511

Description

### Component

Forge

### Describe the feature you would like

Tracked by #9012

In order to safely run tests on untrusted contracts in the server setting, currently users *must* fork to disable system env reads.

I propose adding a feature flag to the forge library crate and the cheatcodes crate to use a provided `Hashmap` as an "injected environment".

I think this should be set on the `MultiContractRunnerBuilder` and then passed to the cheat codes config

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by tracing the forge library crate's MultiContractRunnerBuilder into the cheatcodes crate configuration. Define how the server feature flag supplies a Hashmap as the injected environment, and verify that untrusted-contract tests can run without reading system environment variables.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
blockchain, devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.