foundry-rs / foundry-rs/foundry
feat: add revive compiler support
- 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
This proposal aims to integrate the Revive(Resolc) compiler into the Foundry stack. The Revive compiler compiles Solidity code into PolkaVM’s RISC-V instruction set, enabling Solidity contract execution on AssetHub chain.
We see two possible approaches for this integration:
1. Adding Revive(Resolc) as part of the `Multicompiler`. [Draft PR](https://github.com/paritytech/foundry-revive-compiler/pull/4/files)
2. Implementing a custom compiler integration, similar to how zkSync is handled. [Draft PR](https://github.com/paritytech/foundry-revive-compiler/pull/5/files)
You can see our considerations [here](https://github.com/paritytech/foundry-revive/issues/7)
Our primary goal is **to upstream our changes into Foundry**, ensuring long-term maintainability and alignment with the ecosystem.
We would greatly appreciate your guidance on the preferred approach that would best facilitate upstreaming our compiler into Foundry.
Looking forward to your insights!
### Additional context
**Context: Integrating Foundry with Polkadot AssetHub**
The goal of this project is to integrate Foundry with the Polkadot AssetHub chain. AssetHub offers Ethereum compatibility, enabling the execution of Solidity smart contracts.
We aim to achieve the highest possible level of compatibility with Ethereum, covering both contract execution semantics and RPC endpoints. This ensures a seamless experience for developers familiar with Ethereum, allowing them to build and deploy applications on AssetHub with minimal friction.
**Key Differences from Ethereum Solutions**
Unlike most Ethereum-compatible platforms, AssetHub does not use the Ethereum Virtual Machine (EVM). Instead, we leverage our own PolkaVM, which is built on the RISC-V instruction set.
For Solidity developers, this difference is largely transparent. Our Revive(Resolc) compiler ensures full Solidity support, including inline assembly. However, one key distinction is that the compiled bytecode is not EVM-compatible due to the underlying architecture.
For more informations, please refer to our [documentation](https://contracts.polkadot.io/differences_to_eth)
**Compilation for PolkaVM**
To compile Solidity contracts for execution on PolkaVM, we use the Revive(Resolc) compiler. This tool compiles Solidity code into a format compatible with PolkaVM. The compiler architecture you can find [here](https://contracts.polkadot.io/revive_compiler/architecture).
Contributor guide
Research direction
Start by reading Foundry's Multicompiler entry point and the existing zkSync compiler integration, then compare the two linked draft PRs for Revive(Resolc). Done means choosing and implementing an upstreamable integration path for compiling Solidity to PolkaVM, with the required compatibility validated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, solidity
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100