Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose fs_permissions for Solidity Test in Hardhat config #6452

Closed
kanej opened this issue Mar 6, 2025 · 1 comment
Closed

Expose fs_permissions for Solidity Test in Hardhat config #6452

kanej opened this issue Mar 6, 2025 · 1 comment
Assignees
Labels
status:ready This issue is ready to be worked on v-next A Hardhat v3 development task

Comments

@kanej
Copy link
Member

kanej commented Mar 6, 2025

Initially reported on Telegram: https://t.me/c/2274028871/184

To allow for vm.readFile, Foundry requires one to add something like

fs_permissions = [
  { access = "read-write", path = "./" },
]

to one's foundry.toml. How do we achieve this in Hardhat 3?

Setting fs_permissions for the readFile cheatcode is supported in the underlying Solidity Test library (i.e. EDR's Solidity Test). However, it is not currently being exposed in hardhat.config.{js,ts}.

We need to update Hardhat 3's Solidity Test config to allow specifying fs permissions.

@kanej kanej added the v-next A Hardhat v3 development task label Mar 6, 2025
@kanej kanej added this to the Public Alpha Feature Rollout milestone Mar 6, 2025
@kanej kanej added this to Hardhat Mar 6, 2025
@github-project-automation github-project-automation bot moved this to Backlog in Hardhat Mar 6, 2025
@github-actions github-actions bot added the status:ready This issue is ready to be worked on label Mar 6, 2025
@kanej kanej moved this from Backlog to To-do in Hardhat Mar 6, 2025
@galargh galargh self-assigned this Mar 6, 2025
@galargh
Copy link
Member

galargh commented Mar 6, 2025

This is already possible via the solidityTest.fsPermissions.read, solidityTest.fsPermissions.write and solidityTest.fsPermissions.readWrite config properties.

Here's a minimal example:

{
  "solidityTest": {
    "fsPermissions": {
      "readWrite": [
        "./"
      ]
    },
  }
}

I'm going to close this as resolved ✅

@galargh galargh closed this as completed Mar 6, 2025
@github-project-automation github-project-automation bot moved this from To-do to Done in Hardhat Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:ready This issue is ready to be worked on v-next A Hardhat v3 development task
Projects
Status: Done
Development

No branches or pull requests

2 participants