Skip to content

Revive's resolver not processing remappings properly when compiling using standard json #145

Closed
@Brianspha

Description

@Brianspha

While integrating Revive, discovered an issue with the import resolver where remappings are not being processed correctly. Looking at both solc and Revive's behavior with identical standard JSON input:

{
 "settings": {
   "remappings": ["forge-std/=lib/forge-std/src/"]
 }
}

Both compilers receive the same command line args:

--allow-paths /workspace/test_proj,/workspace/test_proj/lib --base-path /workspace/test_proj --standard-json

However, Revive only searches in the base path and fails with for example:
Source not found: Searched the following locations: "/workspace/test_proj" While solc successfully resolves imports by applying the remappings. I've verified this behavior in both Foundry and Remix integrations with Revive, confirming it's an issue with how Revive processes remappings rather than being integration-specific.

The command line args are being passed correctly as contracts with no remappings work fine, suggesting the issue is in how the resolver handles remappings during import resolution. With remix integration one would need to observe the network tab after compiling and notice that compilation results yield an error.

Testing & Reproduction

Remix: Observe the network tab after compiling to see compilation results yielding an error
Foundry:

  • Clone and build the foundry-revive fork
  • Run cargo build -p forge in the repository root
  • Create a new foundry project using ../target/debug/forge init this may require you to login to git if using a container/vm/docker
  • Then compile with forge build --resolc-compile so ../target/debug/forge --resolc-compile

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions