Commit Graph
100 Commits
Author SHA1 Message Date
xermicus fb0e9e6a30 release resolc v1.3.0 (#548)
## v1.3.0

Supported `polkadot-sdk` rev: `2604.2.0`

### Added

- The newyork IR code size optimization pipeline, selectable via the
`--newyork` CLI flag or the `settings.polkavm.newyork` standard JSON
input field.
This can reduce code size by up to 50%. Considered a new and
experimental feature, switched off by default.
[#519](https://github.com/paritytech/revive/pull/519)

### Changed

- The latest supported `polkadot-sdk` version is now `2604.2.0`

Signed-off-by: xermicus <cyrill@parity.io>
2026-06-19 11:50:41 +02:00
xermicus d7407fe138 remove ambiguous ny opt configuration (#550)
Otherwise the std json input settings aren't succint.

Signed-off-by: xermicus <cyrill@parity.io>
2026-06-18 19:12:27 +02:00
98d818f958 The new Yul optimizer toolkit (#519)
This PR introduces powerful code size optimizations. This is achieved
with an additional IR layer in between Yul and LLVM IR. It works quite
well (see below for a comparison) because it captures optimization gains
that neither solc nor LLVM can realize.

The feature is gated behind `--newyork` or a corresponding standard JSON
input setting and **off by default**.

### How it works

We implemented an SSA IR modelled after or inspired by the [MLIR SCF
dialect](https://mlir.llvm.org/docs/Dialects/SCFDialect/). Yul is
translated into this IR and the IR implements mainly the following
optimizations:

- **Type narrowing**: narrows 256-bit values to I1..I160 where provable
(bidirectional + interprocedural), so LLVM emits native 32/64-bit ops
instead
    of software 256-bit arithmetic.
- **FMP range proof**: exposes the `mload(0x40) < heap_size` bound to
LLVM
IPSCCP, eliminating trailing overflow checks on FMP-derived offsets.
Single
    largest code-size contributor.
- **Heap analysis**: skips big-endian byte-swaps where native
little-endian
    layout is safe.
  - **mem_opt / keccak fusion+folding**, **compound outlining** (mapping
sload/sstore), **guard narrowing**, **inlining** tuned for PolkaVM, and
    **exact + fuzzy function dedup**.

### Results
The optimizations implemented with the newyork IR bring substantial code
size improvements.
  - Integration contracts: approximately **-20% to -50%** code size.
  - OpenZeppelin Wizard corpus: around **-47%** code size.

This table shows the code size improvements on various OpenZeppelin ERC
implementations, taken from their [contracts
wizard](https://wizard.openzeppelin.com/), with almost all features
enabled.

| Contract | Default: (bytes) | With `--newyork`: (bytes) | Reduction |
|---|---:|---:|---:|
| erc1155 | 59,206 | 30,649 | -48.2% |
| erc20 | 81,697 | 42,893 | -47.5% |
| erc721 | 92,052 | 49,423 | -46.3% |
| oz_gov | 141,861 | 81,159 | -42.8% |
| oz_rwa | 77,274 | 37,975 | -50.9% |
| oz_simple_erc20 | 29,950 | 16,554 | -44.7% |
| oz_stable | 82,117 | 39,032 | -52.5% |
| **Total** | **564,157** | **297,685** | **-47.2%** |

We believe this to be a reasonably representative dataset and conclude
that the newyork IR achieves drastic code size reductions on real world
dApp implementations.

### Methodology, security and runtime performance

Since the main contributors to these improvements are the FMP range
proofs and the type narrowing, we don't expect big runtime performance
regressions (it may even benefit runtime performance in some cases).

The PR also includes docs
(`book/src/developer_guide/newyork_{optimizer,ir}.md`) and many new
integration tests, including regression tests for known FMP soundness
traps.

The PR was authored collaboratively and reviewed extensively by the
`revive` maintainers, as well as Claude Opus, Claude Fable, Qwen,
Minimax and Deepseek LLMs, over a span of many months.

The `newyork` compiler pipeline introduces no new regressions over our
integration and differential test suites (containing over 30000 test
cases). This was achieved by careful manual reviews and many LLM bughunt
loops. Additionally, a final security review by Anthropic's Fable 5 LLM
found no remaining soundness issues. Nonetheless, like any brand new
software, please consider this an experimental feature upon release.

---------

Signed-off-by: xermicus <bigcyrill@hotmail.com>
Signed-off-by: xermicus <cyrill@parity.io>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: neo <me@90f9.org>
Co-authored-by: LJ <81748770+elle-j@users.noreply.github.com>
2026-06-17 12:35:16 +02:00
xermicus 998ec823d5 bump cargo dependencies (#545)
- Update PVM to fix a downstream bug.
- Update the polkadot-sdk to get rid of most retester exceptions.

Signed-off-by: xermicus <cyrill@parity.io>
2026-06-17 07:45:59 +02:00
xermicus 9b22bcdc7c CI: Do not trigger release workflow on pushes to main (#537)
Drop main push trigger from release workflow to avoid tag-run
cancellation.

---------

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2026-05-29 17:20:26 +02:00
xermicus c3599b8c4c bump the resolc js version to 1.2.0 (#535)
Signed-off-by: xermicus <cyrill@parity.io>
2026-05-29 08:08:44 +02:00
xermicus b2c025faad release resolc v1.2.0 (#534)
Supported `polkadot-sdk` rev: `2603`

### Changed

- Updated `LLVM` from `21.1.8` to LLVM `22.1.4`

### Added

- Support for solc v0.8.35.

### Fixed

- A constant folding bug causing incorrect translation of a signed
remainder edge case. The affected pattern (Solidity % or Yul smod):
  - SREM over the two constant operands `type(int256).min` and `-1`.
- At least one of the two constants needs folding (i.e. not just
`type(int256).min % -1`),
and is written specifically such that solc doesn't fold but LLVM does,
resulting in UB (signed-overflow).
- Fix `mulmod` returning out-of-range result for large moduli.

---------

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2026-05-28 23:20:11 +02:00
xermicus ae8033130b Fix __ulongrem stdlib edge case (#531)
The implementation is off-by-one.

---------

Signed-off-by: xermicus <cyrill@parity.io>
2026-05-28 17:25:23 +02:00
xermicus 40e97d11eb Fix optimization specific SREM edge case (#527)
Existing test coverage didn't catch a signed remainder overflow
semantics edge case behavior where at least one the operators is being
constant folded by LLVM instead of solc. This PR fixes the SREM
translation bug and adds missing test coverage for division ops with
constants.

Closes #524

---------

Signed-off-by: xermicus <cyrill@parity.io>
2026-05-28 09:01:41 +02:00
xermicus ee869cdd18 Support solc v0.8.35 (#512)
- Support solc v0.8.35
- The new `erc7201` is comptime (already translated to a constant in
Yul)

Didn't spot any relevant breakage or addition in the release notes so
should be no-brainer.

---------

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2026-05-01 20:14:36 +02:00
xermicus f887e75545 Release resolc v1.1.0 (#504)
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2026-04-13 22:06:26 +02:00
xermicus 255f5cc31b Update dependencies (#503)
- Rust dependencies
- JS dependencies
- Retester submodule

---------

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2026-04-13 14:59:24 +02:00
xermicus dc155efc73 runtime-api: remove the spurious +fast-unaligned-access flag (#491)
Slipped through in #120

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2026-03-10 11:27:50 +01:00
xermicus 71d584dd6e inhert stderr for recursive process (#485)
Allows for debug logs. The stdout stay piped as its used for
intra-process communication.

Signed-off-by: xermicus <bigcyrill@hotmail.com>
2026-02-22 18:57:20 +01:00
xermicus 073276696f recursive processes use the current executable by default (#484)
- Recursive processes spawn the currently running executable by default,
removing the annoyance of mixing different compiler builds during
contract compilation.
- Remove the unused `once_cell` dependency.

Signed-off-by: xermicus <bigcyrill@hotmail.com>
2026-02-22 18:14:21 +01:00
xermicusandClaude Opus 4.6 c0a7596617 support solc v0.8.34 (#482)
As a drive-by fix, the get-llvm action now ignores LLVM releases marked
as pre-release.

---------

Signed-off-by: xermicus <bigcyrill@hotmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 14:27:03 +01:00
xermicusandminimax-m2.5 d8d998c114 Fix Yul mode discarding solc validation errors (#478)
In `--yul` mode, resolc now properly exits when solc reports validation
errors (e.g., invalid hex literals, variable redeclarations), matching
`--standard-json behavior.`

`runs_without_input_file` was adapted because it was relying on it where
the new behavior correctly matches solc --strict-assembly.

Closes #477

Co-authored-by: minimax-m2.5 <neo@zion>

---------

Signed-off-by: xermicus <bigcyrill@hotmail.com>
2026-02-16 11:03:24 +01:00
xermicus b2157d025b Add the differential tester as submodule (#472)
Signed-off-by: xermicus <bigcyrill@hotmail.com>
2026-02-06 11:31:00 +01:00
xermicus f24e2d8477 npm package: fix --bin (#467)
The `--bin` CLI flag was not producing bytecode because the
`outputSelection` was not updated to explicitly requested it.

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2026-01-31 11:05:21 +01:00
xermicus b080c1d86c resolc v1.0.0 (#465)
This marks a milestone: Smart contracts on Polkadot Asset Hub are live
and we release the first compiler version!

Signed-off-by: xermicus <bigcyrill@hotmail.com>
2026-01-29 19:17:08 +01:00
xermicus 95ae938ddf Add missing 63/64 rule documentation and a test (#462)
- Prominently point out the important differences of the `pallet-revive`
runtime.
- Add a test case illustrating the problem.

See also: https://github.com/paritytech/contract-issues/issues/257

---------

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2026-01-27 19:43:14 +01:00
xermicus 99b73ec083 fix the ci (#463)
Temp fix for the CI: Pin to a compatible Rust version.
2026-01-27 16:15:25 +01:00
xermicus 09625c6310 update docs (#458)
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2026-01-16 19:52:52 +01:00
xermicus 50e4d47bc6 update Rust dependencies (#456)
Signed-off-by: xermicus <cyrill@parity.io>
2026-01-15 13:55:14 +01:00
xermicus 289af875db remove superfluous byte swap in linkersymbol builtin translation (#455)
- Remove the superfluous byte swap in the `linkersymbol` builtin
translation.
- Support testing the `linkersymbol` builtin translation in the runner
specs.

---------

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2026-01-15 12:43:46 +01:00
xermicus 4f4e925517 render the nightly builds (#452)
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2026-01-14 11:13:10 +01:00
xermicus 285065632e remove the revive-explorer (#450)
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2026-01-13 10:43:25 +01:00
xermicus a1a4f8e6ea Clip OOB values in call data load and copy (#448)
The OOB logic is implemented in the runtime but truncation circumvented
it.

Closes #263

---------

Signed-off-by: xermicus <cyrill@parity.io>
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2026-01-13 10:15:31 +01:00
xermicus c1ce984ca2 Add CLAUDE.md (#449)
The initial version of the `CLAUDE.md` file.

Signed-off-by: xermicus <cyrill@parity.io>
2026-01-12 20:04:26 +01:00
xermicus 81ce306735 release v0.6.0 (#445)
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2026-01-08 11:45:11 +01:00
xermicus ab1929d184 Mention nightly builds in README.md (#444) 2026-01-07 09:45:47 +01:00
xermicus d8c23130bb revive-runner: enable PVM logs (#442)
This PR fixes a small oversight from #431: Set the debug config of the
revive-runner `Runtime` such that we get the PVM logs back. Since the
revive runner runtime is mainly meant for debugging, I further decided
to enable unlimited contract sizes and disable [EIP
3607](https://eips.ethereum.org/EIPS/eip-3607) too.

---------

Signed-off-by: xermicus <cyrill@parity.io>
2026-01-06 18:31:45 +01:00
xermicus 13070a4bdf Ensure correct flags are passed to solc in std json mode (#440)
This tests the marketplace contracts to compile fine. In prior versions
this fails to compile, hitting the solc "Stack too deep" error.

Closes #409

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2026-01-06 11:16:59 +01:00
xermicus cfcd2ff77c Support solc v0.8.33 (#439)
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2026-01-05 10:59:45 +01:00
xermicus be6f734cfc Use the EVM call gas syscall variants (#436)
- Emit the `call_evm` and `delegate_call_evm` syscalls for contract
calls.
- The call gas is no longer ignored.

---------

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-12-18 17:01:24 +01:00
xermicus 25ee4eef5a dedicated safe integer truncation integration test (#435)
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-12-17 10:25:41 +01:00
xermicus 9446132608 Emit consume_all_gas in invalid and bounds checks (#433)
Closes #374

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-12-16 10:04:51 +01:00
xermicus 91bd1b0b4e Do not build the book during test (#432)
Avoid spurious changes in the build output directory.
2025-12-15 14:16:03 +01:00
xermicus e568a924ae update to polkadot-sdk unstable2507 (#431)
Support for `polkadot-sdk` release `unstable2507`. This release will be
deployed to Kusama and is supposed the first one on Polkadot.

---------

Signed-off-by: xermicus <cyrill@parity.io>
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-12-15 14:02:48 +01:00
xermicus 11f82c8488 Support solc v0.8.31 (#430)
- Support for solc v0.8.31.
- Support for the `clz` Yul builtin.

---------

Signed-off-by: xermicus <cyrill@parity.io>
2025-12-05 15:25:13 +01:00
xermicus 45ceab7dc7 Additional bounds check in sbrk (#428)
Close #356

Signed-off-by: xermicus <cyrill@parity.io>
2025-12-03 16:00:19 +01:00
xermicus a9ccb1f9b4 small docs fixes (#426)
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-12-02 18:01:01 +01:00
e7e40a0ded The revive compiler documentation (#424)
This PR adds comprehensive project documentation in the form of an
mdBook.

---------

Signed-off-by: xermicus <cyrill@parity.io>
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
Co-authored-by: LJ <81748770+elle-j@users.noreply.github.com>
Co-authored-by: PG Herveou <pgherveou@gmail.com>
2025-12-01 14:58:02 +01:00
xermicus 1e0cce0fa8 Fix the Makefile (#421)
Fix the Makefile
2025-11-24 16:17:54 +01:00
xermicus d97d094a8a Update the Rust dependencies (#420)
The `Cargo.lock` kept changing locally on all my hosts. Not sure why
exactly - maybe it got forgotten in a recent PR. I took it as an
opportunity to quickly update the Rust dependencies.

---------

Signed-off-by: xermicus <bigcyrill@hotmail.com>
2025-11-21 15:34:21 +01:00
xermicus 975b610d9f Add the LLVM dir to the .ignore file (#419)
LLVM is now a submodule and no longer in `.gitignore`. Thus, some dev
tools I use, like `rg` and `fd`, now consider the `llvm/` directory.
This PR fixes that by adding `llvm/` to the `.ignore` file.

Signed-off-by: xermicus <bigcyrill@hotmail.com>
2025-11-21 14:43:44 +01:00
xermicus a1090cfa5a revive-yul: fix the code block exit (#414)
This PR fixes the missing `STOP` instruction at the end of `code`
blocks.

---------

Signed-off-by: xermicus <bigcyrill@hotmail.com>
2025-11-17 18:47:58 +01:00
xermicus dd48baadc7 resolc: fix the Yul test utils (#413)
- Fixes multiple bugs in the Yul test util helpers.
- The simple Yul builder utility helper now returns the contract builds.

Signed-off-by: xermicus <bigcyrill@hotmail.com>
2025-11-17 17:45:03 +01:00
xermicus 79aaca1a85 std json: do not request EVM bytecode (#410)
These compiler outputs are irrelevant for the `resolc` compilation
pipeline. It can also break the compilation pipeline. For example, solc
may reject the code without via-ir or fail during the EVM codegen phase
with stack too deep errors - which is not relevant to us.

---------

Signed-off-by: xermicus <cyrill@parity.io>
2025-11-13 10:32:32 +01:00
xermicus 878ca91689 RISCV relaxations (#408)
This PR enables RISC-V relaxations and changes to internal linkage for internal function and global symbols.

See also:
https://github.com/llvm/llvm-project/issues/167381#issuecomment-3513830043

Signed-off-by: xermicus <cyrill@parity.io>
2025-11-11 17:27:53 +01:00
xermicus 046455db06 release v0.5.0 (#401)
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-11-03 16:10:20 +01:00
xermicus 70037e1136 initial SELFDESTRUCT support (#400)
Note:
- The unstable interface in `v2509.0.0` of `polkadot-sdk` is required.
- The differential test fails against EVM in `v2509.0.0` of
`polkadot-sdk`.

---------

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-11-03 15:04:04 +01:00
xermicus c0cdde5a5a llvm-context: fix off-by-one in SDIV overflow semantics (#398)
- Fix the wrong predicate (the negative side in 2s complement has one
more bit)
- Increase test coverage

Signed-off-by: xermicus <cyrill@parity.io>
2025-10-31 14:07:01 +01:00
xermicus df1921ba93 runtime-api: sync syscall function signatures with pallet (#397)
This PR synchronizes the syscall function signatures in the runtime-api
with the current revive pallet API surface.

Signed-off-by: xermicus <cyrill@parity.io>
2025-10-30 14:43:55 +01:00
xermicus 84018c18ae switch to the new storage API (#396)
This PR switches to the new `get_storage_or_zero` and
`set_storage_or_clear` syscalls which are more tailored towards
Solidity.

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-10-30 14:13:37 +01:00
xermicus 42cac55be8 update cargo dependencies (#395)
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-10-29 10:01:05 +01:00
xermicus f46bea6a96 llvm-context: do not trap zero length OOB heap access (#389)
Fixes https://github.com/paritytech/contract-issues/issues/120

---------

Signed-off-by: xermicus <cyrill@parity.io>
2025-10-15 22:39:42 +02:00
xermicus 2090830858 release 0.4.1 (#388)
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-10-08 14:04:48 +02:00
xermicus 7346d82dfa do not prune the AST output in standard JSON mode (#385)
- do not prune the AST output in standard JSON mode (required for
foundry)
- do not serialize the output format if there was not blob produced

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-10-07 15:27:44 +02:00
xermicus 8240163be0 release resolc 0.4.0 (#384)
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-10-06 09:12:34 +02:00
xermicus b560d72139 Prevent frontend function confusion (#383)
Function symbols can clash as we compile multiple YUL `object`
definition into the same `LLVM` module.
- Disambiguate via unique function symbols based its location (runtime
or deploy code).
- Use `LinkOnceODR` linkage for compiler builtin helpers.

---------

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-09-29 23:05:57 +02:00
xermicus 6858cb9a61 mark internal functions linker private (#381)
Prevents unused functions in the emitted ELF object. Drive-by add a
missing test case (which misses a relocation under `-Oz` when all
internal functions are marked as private).

---------

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-09-29 17:55:29 +02:00
xermicus 1cc4f967b4 vet cargo docs on CI (#380)
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-09-29 13:39:09 +02:00
xermicus 713b7e5409 Nightly release workflow fix (#378)
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-09-28 13:12:10 +02:00
xermicus 94ec34c4d5 Separate compilation and linker phases (#376)
Separate between compilation and linker phases to allow deploy time
linking and back-porting era compiler changes to fix #91. Unlinked
contract binaries (caused by missing libraries or missing factory
dependencies in turn) are emitted as raw ELF object.

Few drive by fixes:
- #98
- A compiler panic on missing libraries definitions.
- Fixes some incosistent type forwarding in JSON output (empty string
vs. null object).
- Remove the unused fallback for size optimization setting.
- Remove the broken `--lvm-ir`  mode.
- CI workflow fixes.

---------

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
Signed-off-by: xermicus <bigcyrill@hotmail.com>
Signed-off-by: xermicus <cyrill@parity.io>
2025-09-27 20:52:22 +02:00
xermicus 13faedf08a link to readme in the build utils llvm error message more (#373)
Signed-off-by: xermicus <cyrill@parity.io>
2025-09-02 14:21:54 +02:00
xermicus 903cbd7159 YUL tree visitor interface (#369)
- Implement the visitor interface. This simplifies working with the AST,
for example transformations into other IRs or collecting and analyzing
various statistics.
- Switch the explorer to use the visitor interface.
- Add the reciprocal function name conversion for function names.
- Some drive-by cosmetic fixes.

---------

Signed-off-by: xermicus <bigcyrill@hotmail.com>
2025-08-10 00:08:25 +02:00
xermicus a96e1a4233 fix new Rust 1.89 warnings (#368) 2025-08-08 11:14:26 +02:00
xermicus 9751481f6b the revive-explorer utility (#364)
A maintainable and more precise version of what was a hacky but useful
script, exploring the compilers YUL lowering unit.

It analyzes a given shared objects from the debug dump and outputs:
- The count of each YUL statement translated.
- A per YUL statement break-down of bytecode size contributed per.
- Estimated `yul-phaser` cost parameters.

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-07-22 09:17:55 +02:00
xermicus c285a6ec3d add columns to debug information (#362)
- Add column numbers to debug information.
- Do not build allocas at entry for now.

---------

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-07-17 09:53:54 +02:00
xermicus a0396dd6d0 solc-json-interface: support for YUL optimizer details (#361)
- Add support for the YUL optimizer details in the standard json input
definition.
- Make optimizer settings optional. They can be omitted and solc will
pick default values ([see here for
reference](https://docs.soliditylang.org/en/latest/using-the-compiler.html#input-description)).

For example allows to use the
[`yul-phaser`](https://github.com/ethereum/solidity/blob/0917604a5ec7cff8bd40a1137f4fcb303fb90527/tools/yulPhaser/README.md?plain=1)
utility. I did a single search with slightly adjusted costs (just made
some educated guess) and after an hour or so this already found an
optimizer sequence
(`OESsShMxeoufcSTvlFxtelTfnfEvicdFxnsvopgCaIeLcnvsTtUrUgdVTUttaeUomccTTTuujsVVvVDvvueUrTjUOmjrrhuuTtj`)
which shrinks the size of the `EndpointV2.sol` from LayerZero by 10%.

---------

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
Signed-off-by: xermicus <cyrill@parity.io>
2025-07-14 11:25:45 +02:00
xermicus b238913a7d emit YUL builtins debug line info and fix debug info source file (#358)
This PR fixes and enhances debug info generation:
1. Adds line information for each lowered YUL builtin and the `if`
statement.
2. Fixes the debug info source path to match the YUL file of the
contract dumped to the `--debug-output-dir`.

This improves inspection of the generated code a lot. Excerpt from
`llvm-objdump -Sl /tmp/dbg/contracts_EndpointV2.sol.EndpointV2.so`:

```
; /tmp/dbg/contracts_EndpointV2.sol.EndpointV2.yul:203
;                 let _1 := memoryguard(0x80)
   13c3e: 3aa5b023      sd      a0, 0x3a0(a1)
   13c42: 38a5bc23      sd      a0, 0x398(a1)
   13c46: 38a5b823      sd      a0, 0x390(a1)
   13c4a: 08000513      li      a0, 0x80
   13c4e: 38a5b423      sd      a0, 0x388(a1)
; /tmp/dbg/contracts_EndpointV2.sol.EndpointV2.yul:204
;                 mstore(64, _1)
   13c52: 3885b503      ld      a0, 0x388(a1)
   13c56: 3905b603      ld      a2, 0x390(a1)
   13c5a: 3985b683      ld      a3, 0x398(a1)
   13c5e: 3a05b703      ld      a4, 0x3a0(a1)
   13c62: 38e5b023      sd      a4, 0x380(a1)
   13c66: 36d5bc23      sd      a3, 0x378(a1)
   13c6a: 36c5b823      sd      a2, 0x370(a1)
   13c6e: 36a5b423      sd      a0, 0x368(a1)
   13c72: 04000513      li      a0, 0x40
   13c76: 65d9          lui     a1, 0x16
   13c78: a605859b      addiw   a1, a1, -0x5a0
   13c7c: 95a6          add     a1, a1, s1
   13c7e: 00000097      auipc   ra, 0x0
   13c82: 000080e7      jalr    ra <__runtime+0x1de>

0000000000013c86 <.Lpcrel_hi27>:
; /tmp/dbg/contracts_EndpointV2.sol.EndpointV2.yul:205
;                 if iszero(lt(calldatasize(), 4))
   13c86: 00000517      auipc   a0, 0x0
   13c8a: 00053503      ld      a0, 0x0(a0)
   13c8e: 4108          lw      a0, 0x0(a0)
   13c90: 4591          li      a1, 0x4
   13c92: 06b56263      bltu    a0, a1, 0x13cf6 <.Lpcrel_hi27+0x70>
   13c96: a009          j       0x13c98 <.Lpcrel_hi27+0x12>
```

---------

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-07-04 19:56:52 +02:00
xermicus ed608699af release resolc v0.3.0 (#354)
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-06-28 12:32:48 +02:00
xermicus 75fc23c810 add the missing memset builtin (#353)
Closes  #350

- Add the missing `memset` builtin which was accidentally deleted in a
previous PR.
- Add a compilation test to ensure the `memset` builtin is present.

---------

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-06-28 12:01:34 +02:00
xermicus 486c9c28a1 new clippies (#352)
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-06-28 11:48:24 +02:00
xermicus 8754d802fa llvm-context: bugfix PHI values in SAR builtin translation (#345)
Closes #344

Signed-off-by: xermicus <cyrill@parity.io>
2025-06-14 15:12:03 +02:00
xermicus e94432eaa0 ci: the resolc version dictates binary releases (#341)
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-06-03 15:47:33 +02:00
xermicus 1fc3aa1554 release resolc v0.2.0 (#340)
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-06-03 15:36:54 +02:00
xermicus 8a3c587bbe solc-json-interface: do not unconditionally skip serialization of custom keys (#337)
The data structure can be used to build the JSON input for `resolc` too.
In that case serializing of provided custom options should not be
dismissed.

Makes the memory settings struct more modular as a drive-by.

---------

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-06-03 08:17:54 +02:00
xermicus 8a730f42cc update NPM package version (#336)
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-05-28 08:15:41 +02:00
xermicus 413819facd do not use wildcard dependency in resolc crate (#335)
Do not use wildcard dependency in resolc crate. No sure why the publish
dry-run doesn't catch this.

---------

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-05-27 14:19:24 +02:00
xermicus fa0ad68279 make resolc crate publishable (#334)
- Fetching the commit SHA must not panic if not executed in a git
repository.
- Remove the license printer.

---------

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-05-27 14:13:12 +02:00
xermicus 004c71d5d5 add description to revive-differential (#333)
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-05-27 13:26:05 +02:00
xermicus 4d659ac2a6 release resolc v0.1.0 (#332)
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-05-27 12:06:42 +02:00
xermicus ed9dc60417 bump dependencies (#331)
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-05-27 11:24:15 +02:00
xermicus 3b9144ef3b add installation instructions to the readme (#330)
Closes #294

---------

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-05-27 10:23:42 +02:00
xermicus bd4e108bb0 resolc crate (#328)
- Factor the YUL crate out of `revive-solidity`.
- `revive-solidity` is in reality not a Solidity implementation but the
revive solidity compiler driver (`resolc`). By renaming we not only get
this straight but also a binary with the same name as the crate which
should be less confusing.

---------

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-05-27 09:48:43 +02:00
xermicus 090e3ac13c bugfix an env var in the release workflow (#329)
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-05-27 09:29:25 +02:00
xermicus 3389865af7 solc-json-interface: make the input Cloneable (#323)
It helps external consumers working with the
`revive-solc-json-interface` crate.

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-05-21 10:03:32 +02:00
xermicus af39d506d9 update emsdk (#324)
Update Emscripten SDK to latest version `v4.0.9`.

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-05-21 07:01:41 +02:00
xermicus bb2f829361 expose custom PVM settings in the standard json interface (#318)
Exposes the following PolkaVM specific options via the standard json
interface:
- Heap size
- Stack size
- Whether to emit source level debug information

Additionally it is now forbidden to specify those as CLI option in
standard JSON mode. They are bytecode altering options and having
multiple ways to specify them creates unnecessary room for confusion:
The standard JSON input description should be sufficient and succint for
reproducible builds.

Closes #290

---------

Signed-off-by: xermicus <bigcyrill@hotmail.com>
2025-05-13 15:19:00 +02:00
xermicus 1b8fcc4649 Update the Rust version (#316)
- Update the Rust version to 1.85
- Update the package-lock.json
- Update the musl-cross docker image

---------

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-05-09 20:00:58 +02:00
xermicus 722dd86c27 remove STATUS.md (#315)
This information is provided in the docs.

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-05-09 12:21:25 +02:00
xermicus 32f55b976c update changelog (#313)
somehow went wrong

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-05-08 14:16:46 +02:00
xermicus fbaa45f283 support solc v0.8.30 (#308)
- Add support for solc `v0.8.30`. No changes in YUL or the binary
interface.
- Fix a semver bug in the NPM packages to correctly align their solc
dependencies with our last supported version.

---------

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-05-08 13:29:13 +02:00
xermicus f2fac85dae add npm package information to release checklist (#312)
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-05-08 13:14:28 +02:00
xermicus 11d47d74ac apply size optimizations by default (#298)
So far if no optimization level was specified, optimizations for
execution time were applied. However, we currently are a bit limited on
code size. Add to that, this setting is not available in solc and people
generally ignore the docs, generating a lot of support requests.

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-05-07 15:35:48 +02:00
xermicus e3a9c95d32 llvm-builder: use the ninja generator for building the builtins on windows (#299)
The builtins build should use the Ninja generator (MSVC does not build a
valid archive).

Tested and verified here:
https://github.com/paritytech/revive-alex-workflowtest/releases/tag/untagged-f02d0f574bab8404fead

Closes #305

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-05-07 11:10:58 +02:00
xermicus f6a412eef4 release resolc v0.1.0-dev.14 (#289)
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-04-24 11:57:46 +02:00
xermicus 20e77cb0b5 configurable stack and heap memory size (#288)
- Allow configuration of the maximum heap and stack size via CLI flags
and JSON input settings.
- Increase the default value for the stack size to 32kb.

---------

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-04-24 10:47:38 +02:00