Files
revive/CHANGELOG.md
T
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

8.0 KiB

Changelog

Unreleased

This is a development pre-release.

Supported polkadot-sdk rev: 2503.0.1

v0.4.0

This is a development pre-release.

Supported polkadot-sdk rev: 2503.0.1

Added

  • Line debug information per YUL builtin and for if statements.

Fixed

  • The debug info source file matches the YUL path in --debug-output-dir, allowing tools to display the source line.

v0.3.0

This is a development pre-release.

Supported polkadot-sdk rev: 2503.0.1

Fixed

  • llvm-context: Bugfix the SAR YUL builtin translation.
  • runtime-api: Add the missing memset builtin.
  • npm package: Bugfix the exports field defined in the package.json.

v0.2.0

This is a development pre-release.

Supported polkadot-sdk rev: 2503.0.1

Changed

  • Removed the license printer from the resolc binary.
  • EVM bytecode is no longer requested from solc (except in test utils) leading to less compilation work in the pipeline.

Fixed

  • solc-json-interface: Serializing of any custom key in the JSON input is only skipped if not provided.
  • npm package resolution no longer fails with an 'ERR_PACKAGE_PATH_NOT_EXPORTED' error for packages defining exports fields in the package.json.

v0.1.0

This is a development pre-release.

Supported polkadot-sdk rev: 2503.0.1

Added

  • Add the PolkaVM heap size, stack size and debug info CLI compiler options to the standard JSON settings. This makes the standard JSON input succint for reproducible builds.

Changed

  • Supported polkadot-sdk version is now 2503.0.1
  • The emsdk version is now 4.0.9

Fixed

v0.1.0-dev.16

This is a development pre-release.

Supported polkadot-sdk rev:c29e72a8628835e34deb6aa7db9a78a2e4eabcee

Added

  • Move the npm package from paritytech/js-revive, into this repo. The package @parity/resolc will be deployed to npm for each release.
  • Support for solc v0.8.30

Changed

  • By default, heavy size optimizations are applied.

Fixed

  • @parity/resolc: The solc dependency package is constrained to the latest supported version, preventing breaking the package ever time a new solc package was released.
  • The resolc npm package no longer ignores the optimizer settings

v0.1.0-dev.14

This is a development pre-release.

Supported polkadot-sdk rev:c29e72a8628835e34deb6aa7db9a78a2e4eabcee

Added

  • The revive-runner helper utility binary which helps to run contracts locally without a blockchain node.
  • Allow configuration of the EVM heap memory size and stack size via CLI flags and JSON input settings.

Changed

  • The default PVM stack memory size was increased from 16kb to 32kb.

Fixed

  • Constructors avoid storing zero sized immutable data on exit.

v0.1.0-dev.13

This is a development pre-release.

Supported polkadot-sdk rev:c29e72a8628835e34deb6aa7db9a78a2e4eabcee

Added

  • Support for solc v0.8.29
  • Decouples the solc JSON-input-output type definitions from the Solidity fronted and expose them via a dedicated crate.
  • --supported-solc-versions for resolc binary to return a semver range of supported solc versions.
  • Support for passing LLVM command line options via the prcoess input or providing one or more --llvm-arg='..' resolc CLI flag. This allows more fine-grained control over the LLVM backend configuration.

Changed

  • Storage keys and values are big endian. This was a pre-mature optimization because for the contract itself it this is a no-op and thus not observable. However we should consider the storage layout as part of the contract ABI. The endianness of transient storage values are still kept as-is.
  • Running resolc using webkit is no longer supported.

Fixed

  • A missing byte swap for the create2 salt value.

v0.1.0-dev.12

This is a development pre-release.

Supported polkadot-sdk rev: 21f6f0705e53c15aa2b8a5706b208200447774a9

Added

  • Per file output selection for --standard-json mode.
  • The ir output selection option for --standard-json mode.

Changed

  • Improved code size: Large contracts compile to smaller code blobs when enabling aggressive size optimizations (-Oz).

Fixed

v0.1.0-dev.11

This is a development pre-release.

Supported polkadot-sdk rev: 274a781e8ca1a9432c7ec87593bd93214abbff50

Added

Changed

Fixed

  • A bug causing incorrect loads from the emulated EVM linear memory.
  • A missing integer truncate after switching to 64bit.

v0.1.0-dev.10

This is a development pre-release.

Supported polkadot-sdk rev: 274a781e8ca1a9432c7ec87593bd93214abbff50

Added

  • Support for the coinbase opcode.
  • The resolc web JS version.

Changed

  • Missing the --overwrite flag emits an error instead of a warning.
  • The resolc executable prints the help by default.
  • Removed support for legacy EVM assembly (EVMLA) translation.
  • integration: identify cached code blobs on source code to fix potential confusions.
  • Setting base, include or allow paths in emscripten is now a hard error.
  • Employ a heuristic to detect address.transfer and address.send calls. If detected, the re-entrant call flag is not set and 0 deposit limit is endowed.

Fixed

  • Solidity: Add the solc --libraries files to sources.
  • A data race in tests.
  • Fix broken pipe errors.
  • llvm-builder: Allow warnings.
  • solidity: Fix the custom compiler warning messages.

v0.1.0-dev.9

This is a development pre-release.

Added

Changed

  • Syscalls with more than 6 arguments now pack them into registers.

Fixed

  • Remove reloading of the resolc.js file (fix issue with relative path in web worker)

v0.1.0-dev.8

This is a development pre-release.

Added

  • The revive-llvm-builder crate with the revive-llvm helper utility for streamlined management of the LLVM framework dependency.
  • Initial support for running resolc in the browser.

Changed

  • Suported contracts runtime is polkadot-sdk git version d62a90c8c729acd98c7e9a5cab9803b8b211ffc5.
  • The minimum supported Rust version is 1.81.0.
  • Error out early instead of invoking solc with invalid base or include path flags.

Fixed

  • Decouple the LLVM target dependency from the LLVM host dependency.
  • Do not error out if no files and no errors were produced. This aligns resolc closer to solc.
  • Fixes input normalization in the Wasm version.

v0.1.0-dev.7

This is a development pre-release.

Added

  • Implement the GASPRICE opcode.
  • Implement the BASEFEE opcode.
  • Implement the GASLIMIT opcode.

Changed

  • The GAS opcode now returns the remaining ref_time.
  • Contracts can now be supplied call data input of arbitrary size.
  • Some syscalls now return the value in a register, slightly improving emitted contract code.
  • Calls forward maximum weight limits instead of 0, anticipating a change in polkadot-sdk where weight limits of 0 no longer interprets as uncapped limit.

Fixed

  • A linker bug which was preventing certain contracts from linking with the PVM linker.
  • JS: Fix encoding conversion from JS string (UTF-16) to UTF-8.
  • The git commit hash slug is always displayed in the version string.

v0.1.0-dev.6

This is a development pre-release.

Added

  • Implement the BLOCKHASH opcode.
  • Implement delegate calls.
  • Implement the GASPRICE opcode. Currently hard-coded to return 1.
  • The ELF shared object contract artifact is dumped into the debug output directory.
  • Initial support for emitting debug info (opt in via the -g flag)

Changed

  • resolc now emits 64bit PolkaVM blobs, reducing contract code size and execution time.
  • The RISC-V bit-manipulation target feature (zbb) is enabled.

Fixed

  • Compilation to Wasm (for usage in node and web browsers)

v0.1.0-dev.5

This is development pre-release.

Added

  • Implement the CODESIZE and EXTCODESIZE opcodes.

Changed

  • Include the full revive version in the contract metadata.

Fixed

v0.1.0-dev-4

This is development pre-release.

Added

  • Support the ORIGIN opcode.

Changed

  • Update polkavm to v0.14.0.
  • Enable the a, fast-unaligned-access and xtheadcondmov LLVM target features, decreasing the code size for some contracts.

Fixed