LJ 733e01c78e Implement verification of reproducible builds and run differential E2E tests (#468)
## Description

This adds verification for reproducible builds (via
[revive-differential-tests](https://github.com/paritytech/revive-differential-tests)
testing framework) by:

1. Compiling
[contracts](https://github.com/paritytech/resolc-compiler-tests/tree/main/fixtures/solidity)
and generating hashes from each bytecode
    * With the resolc builds:
      * linux musl
      * macos universal
      * windows
      * (future todo: wasm32 emscripten)
    * With optimization levels `0`, `3`, `z` for each contract
2. Exporting the hashes
3. Comparing the hashes
    * For each optimization level:
* Checks if each hash for a specific contract is identical across the
platforms

This PR also runs the differential E2E tests (via `retester`) with the
resolc linux musl build.

All of the above only runs if our `test` workflow succeeds.

## Related

This PR initially implemented the above in this repo but has now been
implemented into the separate testing framework instead. The most
relevant PRs implemented alongside this PR as prerequisites are:

* `revive-differential-tests`:
  * [Generate bytecode hashes included in the report
](https://github.com/paritytech/revive-differential-tests/pull/238)
* [Fix handling of resolc's optimizer `mode` and allow setting solc
optimizer
enabled](https://github.com/paritytech/revive-differential-tests/pull/243)
* [Fix solc and resolc optimization
settings](https://github.com/paritytech/revive-differential-tests/pull/253)
* [Implement a `compile` context/subcommand for standalone compilation
mode](https://github.com/paritytech/revive-differential-tests/pull/239)
* [Implement support for `--mode` CLI argument for
`compile`](https://github.com/paritytech/revive-differential-tests/pull/246)
* [Implement `export-hashes` and `compare-hashes` subcommands for report
processor
](https://github.com/paritytech/revive-differential-tests/pull/250)
* [Implement GH actions for compiling, exporting and comparing
hashes](https://github.com/paritytech/revive-differential-tests/pull/251)
* [Gate zombienet-sdk behind `cfg(unix)` to fix Windows
builds](https://github.com/paritytech/revive-differential-tests/pull/254)
* [Link library-using contracts with dummy addresses for `--compile`
command](https://github.com/paritytech/revive-differential-tests/pull/267)
* `revive`:
* [Build LLVM for Windows using MSVC-compatible
Clang](https://github.com/paritytech/revive/pull/497)
* [Apply LLVM patches for deterministic operand order and correct
peephole optimization for `minsize`
](https://github.com/paritytech/revive/pull/500)
* Investigation of comparison mismatches in third-party dependencies:
  * `llvm-project`:
* [`SelectionDAG` type legalization produces different operand ordering
for `i256` multiply across
platforms](https://github.com/llvm/llvm-project/issues/190148)
  * `solidity`:
* [Windows absolute paths in standard JSON break import resolution and
library linking](https://github.com/argotorg/solidity/issues/16579)

## Notes

### Failed compilations

Since
[resolc-compiler-tests](https://github.com/paritytech/resolc-compiler-tests)
currently includes contracts that are expected to fail resolc
compilation (e.g. due to unsupported instructions, contracts that are
expected to work with solc for evm/revm), the compilation workflow job
is not expected to fail if compilation fails for a contract.

Instead, if a contract compiles with one build but not with another, a
hash will be missing and will thereby generate a mismatch when comparing
all hashes, failing at the verification step.

## Resolved Issues

Closes [#175](https://github.com/paritytech/revive/issues/175)
2026-04-14 16:58:58 +02:00
2026-02-23 15:48:07 -05:00
2026-04-13 22:06:26 +02:00
2026-04-13 22:06:26 +02:00
2025-05-08 12:36:11 +02:00
2026-04-13 22:06:26 +02:00
2026-04-13 22:06:26 +02:00
2026-04-13 22:06:26 +02:00
2025-01-13 15:58:27 +01:00
2025-05-08 12:36:11 +02:00
2024-03-12 12:06:02 +01:00
2024-03-12 12:06:02 +01:00
2026-01-13 10:43:25 +01:00
2026-04-13 22:06:26 +02:00
2026-04-13 14:59:24 +02:00
2025-01-13 15:58:27 +01:00

CI Docs

revive

Yul recompiler to LLVM, targetting RISC-V on PolkaVM.

Check the docs or visit contracts.polkadot.io to learn more about revive and contracts on Polkadot!

Discussion around the development is hosted on the Polkadot Forum.

Warning

Solidity on PVM is running on the pallet-revive runtime. This introduces observable semantic differences in comparison with the EVM.

Study the differences section carefully. Ignoring these differences may lead to defunct contracts.

Notable examples:

  • The 63/64 gas rule isn't implemented in the pallet (introduces potential DoS vector when calling other contracts)
  • Contract instantiation works differently (by hash instead of by code)
  • The gas model implemented by pallet-revive differs from Ethereum
  • The heap size is fixed instead of gas-metered and there's a fixed amount of stack size (contracts working fine on EVM may trap on PVM)

Installation

Building Solidity contracts for PolkaVM requires installing the following two compilers:

resolc binary releases

resolc is distributed as a standalone binary (with solc as the only external dependency). Please download one of our binary releases for your target platform and mind the platform specific instructions below. We also provide nightly builds.

MacOS users

MacOS users need to clear the downloaded attribute from the binary and set the executable flag.

xattr -rc resolc-universal-apple-darwin
chmod +x resolc-universal-apple-darwin
Linux users

Linux users need to set the executable flag.

chmod +x resolc-x86_64-unknown-linux-musl

resolc NPM package

We distribute the revive compiler as node.js module and hardhat plugin.

Note: The solc dependency is bundled via NPM packaging and defaults to the latest supported version.

Building from source

Building revive requires a stable Rust installation and a C++ toolchain for building LLVM on your system.

LLVM

revive depends on a custom build of LLVM v18.1.8 with the RISC-V embedded target, including the compiler-rt builtins. You can either download a build from our releases (recommended for older hardware) or build it from source.

Download from our LLVM releases

Download the latest LLVM build from our releases.

MacOS users need to clear the downloaded attribute from all binaries after extracting the archive:

xattr -rc </path/to/the/extracted/archive>/target-llvm/gnu/target-final/bin/*

After extracting the archive, point $LLVM_SYS_211_PREFIX to it:

export LLVM_SYS_211_PREFIX=</path/to/the/extracted/archive>/target-llvm/gnu/target-final
Building from source

The Makefile provides a shortcut target to obtain a compatible LLVM build, using the provided revive-llvm utility. Once installed, point $LLVM_SYS_211_PREFIX to the installation afterwards:

make install-llvm
export LLVM_SYS_211_PREFIX=${PWD}/target-llvm/gnu/target-final

The resolc Solidity frontend

To build the resolc Solidity frontend executable, make sure you have obtained a compatible LLVM build and did export the LLVM_SYS_211_PREFIX environment variable pointing to it (see above).

To install the resolc Solidity frontend executable:

make install-bin
resolc --version

Development

Please consult the Developer Guide to learn more about how contribute to the project.

Acknowledgements

The revive compiler project, after some early experiments with EVM bytecode translations, decided to fork the era-compiler framework. Frontend, code generator and some supporting libraries are based of ZKSync zksolc. I'd like to express my gratitude and thank the original authors for providing a useable code base under a generous license.

S
Description
No description provided
Readme
29 MiB
1 Watchers 0 Forks
Languages
Rust 89.2%
Solidity 4.4%
Yul 3.4%
JavaScript 1%
Python 0.4%
Other 1.5%