Compare commits

...

5 Commits

Author SHA1 Message Date
xermicus 6c2c633651 release resolc v0.1.0-dev.11 (#214)
Signed-off-by: xermicus <cyrill@parity.io>
2025-02-18 08:08:20 +01:00
xermicus a73b0925c6 ci: do not run bun tests (#215) 2025-02-17 17:04:53 +01:00
xermicus ee650cf03a ci: use upstream evm for tests (#213)
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-02-17 11:33:30 +01:00
Evgeny Snitko c2210442b6 Release workflow (#201)
Co-authored-by: xermicus <cyrill@parity.io>
2025-02-17 11:09:10 +01:00
xermicus cb268850a9 llvm-context: remove the linear memory pointer indirection (#211) 2025-02-13 13:21:43 +01:00
17 changed files with 532 additions and 187 deletions
-16
View File
@@ -9,7 +9,6 @@ on:
env: env:
CARGO_TERM_COLOR: always CARGO_TERM_COLOR: always
REVIVE_WASM_INSTALL_DIR: ${{ github.workspace }}/target/wasm32-unknown-emscripten/release REVIVE_WASM_INSTALL_DIR: ${{ github.workspace }}/target/wasm32-unknown-emscripten/release
BUN_VERSION: 1.1.43
jobs: jobs:
build-revive-wasm: build-revive-wasm:
@@ -113,21 +112,6 @@ jobs:
with: with:
node-version: "20" node-version: "20"
- name: Install Bun on Windows
if: runner.os == 'Windows'
run: |
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
iex (new-object net.webclient).downloadstring('https://get.scoop.sh')
scoop install bun@${{ env.BUN_VERSION }}
scoop install wget
Join-Path (Resolve-Path ~).Path "scoop\shims" >> $Env:GITHUB_PATH
- name: Install Bun on macOS and Linux
if: runner.os != 'Windows'
run: |
curl -fsSL https://bun.sh/install | bash -s bun-v${{ env.BUN_VERSION }}
echo "$HOME/.bun/bin" >> $GITHUB_PATH
- name: Install packages - name: Install packages
run: npm install run: npm install
+347
View File
@@ -0,0 +1,347 @@
name: Release
run-name: Release ${{ github.ref_name }}
on:
push:
branches:
- 'main'
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
env:
#rust-musl-cross:x86_64-musl
RUST_MUSL_CROSS_IMAGE: messense/rust-musl-cross@sha256:68b86bc7cb2867259e6b233415a665ff4469c28b57763e78c3bfea1c68091561
jobs:
#
#
#
tag:
runs-on: ubuntu-24.04
permissions:
contents: write
outputs:
TAG: ${{ steps.versions.outputs.TAG }}
PKG_VER: ${{ steps.versions.outputs.PKG_VER }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-tags: 'true'
fetch-depth: 0
- name: Versions
id: versions
run: |
export CURRENT_TAG=$(git describe --tags --abbrev=0 --exclude "llvm-*")
export PKG_VER=v$(cat Cargo.toml | grep -A 5 package] | grep version | cut -d '=' -f 2 | tr -d '"' | tr -d " ")
echo "Current tag $CURRENT_TAG"
echo "Package version $PKG_VER"
#
echo "PKG_VER=$PKG_VER" >> $GITHUB_OUTPUT
if [ $CURRENT_TAG == $PKG_VER ];
then
echo "Tag is up to date. Nothing to do.";
export TAG=old;
else
echo "Tag was updated.";
export TAG=new;
fi
echo "TAG=$TAG" >> $GITHUB_OUTPUT
#
#
#
build-linux-all:
if: ${{ needs.tag.outputs.TAG == 'new' }}
runs-on: parity-large
needs: [tag]
steps:
- uses: actions/checkout@v4
- name: install linux deps
run: |
sudo apt-get update && sudo apt-get install -y cmake ninja-build \
curl git libssl-dev pkg-config clang lld musl
- name: Install Rust stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: rust-src
target: wasm32-unknown-emscripten
- name: versions
run: |
rustup show
cargo --version
cmake --version
echo "bash:" && bash --version
echo "ninja:" && ninja --version
echo "clang:" && clang --version
- name: build revive-llvm
run: make install-llvm-builder
# musl LLVM
- name: llvm-musl-cache restore
id: llvm-musl-cache
uses: actions/cache/restore@v4
with:
path: target-llvm/musl/target-final
key: llvm-linux-musl-${{ hashFiles('crates/solidity/**') }}
- name: Build musl LLVM
if: steps.llvm-musl-cache.outputs.cache-hit != 'true'
run: |
revive-llvm --target-env musl clone
revive-llvm --target-env musl build --llvm-projects lld --llvm-projects clang
- name: llvm-musl-cache save
if: steps.llvm-musl-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: target-llvm/musl/target-final
key: llvm-linux-musl-${{ hashFiles('crates/solidity/**') }}
# emscripten LLVM
- name: llvm-emscripten-cache restore
id: llvm-emscripten-cache
uses: actions/cache/restore@v4
with:
path: |
target-llvm/emscripten/target-final
emsdk
key: llvm-linux-emscripten-${{ hashFiles('crates/solidity/**') }}
- name: Build emscripten LLVM
if: steps.llvm-emscripten-cache.outputs.cache-hit != 'true'
run: |
revive-llvm --target-env emscripten clone
source emsdk/emsdk_env.sh
revive-llvm --target-env emscripten build --llvm-projects lld
- name: llvm-emscripten-cache save
if: steps.llvm-emscripten-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: |
target-llvm/emscripten/target-final
emsdk
key: llvm-linux-emscripten-${{ hashFiles('crates/solidity/**') }}
# Build revive
- name: build musl
run: |
mkdir resolc-out
docker run -v $PWD:/opt/revive $RUST_MUSL_CROSS_IMAGE /bin/bash -c "
cd /opt/revive
apt update && apt upgrade -y && apt install -y pkg-config
export LLVM_SYS_181_PREFIX=/opt/revive/target-llvm/musl/target-final
make install-bin
cp /root/.cargo/bin/resolc /opt/revive/resolc-out/resolc
"
- name: check musl
run: |
mkdir solc
curl -sSLo solc/solc https://github.com/ethereum/solidity/releases/download/v0.8.28/solc-static-linux
chmod +x solc/solc
PATH=$PWD/solc:$PATH
result=$(./resolc-out/resolc --bin crates/integration/contracts/flipper.sol)
echo $result
if [[ $result == *'0x50564d'* ]]; then exit 0; else exit 1; fi
- name: Set Up Node.js
uses: actions/setup-node@v3
with:
node-version: "20"
- name: build wasm
run: |
export LLVM_SYS_181_PREFIX=$PWD/target-llvm/musl/target-final
export REVIVE_LLVM_TARGET_PREFIX=$PWD/target-llvm/emscripten/target-final
source emsdk/emsdk_env.sh
rustup target add wasm32-unknown-emscripten
make install-wasm
- name: check wasm
run: |
curl -sSLo solc/soljson.js https://github.com/ethereum/solidity/releases/download/v0.8.28/soljson.js
node -e "
const soljson = require('solc/soljson');
const createRevive = require('./target/wasm32-unknown-emscripten/release/resolc.js');
const compiler = createRevive();
compiler.soljson = soljson;
const standardJsonInput =
{
language: 'Solidity',
sources: {
'MyContract.sol': {
content: 'pragma solidity ^0.8.0; contract MyContract { function greet() public pure returns (string memory) { return \'Hello\'; } }',
},
},
settings: { optimizer: { enabled: false } }
};
compiler.writeToStdin(JSON.stringify(standardJsonInput));
compiler.callMain(['--standard-json']);
// Collect output
const stdout = compiler.readFromStdout();
const stderr = compiler.readFromStderr();
if (stderr) { console.error(stderr); process.exit(1); }
let out = JSON.parse(stdout);
let bytecode = out.contracts['MyContract.sol']['MyContract'].evm.bytecode.object
console.log(bytecode);
if(!bytecode.startsWith('50564d')) { process.exit(1); }
"
- uses: actions/upload-artifact@v4
with:
name: revive-wasm
path: |
./target/wasm32-unknown-emscripten/release/resolc.js
./target/wasm32-unknown-emscripten/release/resolc.wasm
./target/wasm32-unknown-emscripten/release/resolc_web.js
retention-days: 1
- uses: actions/upload-artifact@v4
with:
name: revive-linux
path: |
./resolc-out/resolc
retention-days: 1
#
#
#
create-release:
needs: [tag, build-linux-all]
runs-on: ubuntu-24.04
permissions:
contents: write
outputs:
upload_url: ${{ steps.create_release.outputs.result }}
steps:
- uses: actions/checkout@v4
- name: Create/update tag
id: tag
uses: actions/github-script@v7
with:
result-encoding: string
script: |
await github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/${{ needs.tag.outputs.PKG_VER }}',
sha: context.sha
})
- name: get relese notes
id: get-notes
run: |
{
echo 'releaseNotes<<EOF'
sed '/^## ${{ needs.tag.outputs.PKG_VER }}/,/^## v/!d' CHANGELOG.md | sed -e '1d' -e '$d'
echo EOF
} >> "$GITHUB_OUTPUT"
- name: Create release
id: create_release
env:
releaseNotes: ${{ steps.get-notes.outputs.releaseNotes }}
version: ${{ needs.tag.outputs.PKG_VER }}
uses: actions/github-script@v7
with:
result-encoding: string
script: |
let response = await github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: process.env.version,
name: process.env.version,
body: process.env.releaseNotes,
draft: true,
prerelease: true
});
console.log(response);
return response.data.upload_url;
- name: Log
run: |
echo "tag result: ${{ needs.tag.outputs.TAG }}"
echo "pkg version: ${{ needs.tag.outputs.PKG_VER }}"
#
#
#
upload-assets:
runs-on: ubuntu-24.04
needs: [create-release]
steps:
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: revive-wasm
path: resolc/
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: revive-linux
path: resolc/
- name: upload resolc
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./resolc/resolc
asset_name: resolc-static-linux
asset_content_type: application/octet-stream
- name: upload resolc.js
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./resolc/resolc.js
asset_name: resolc.js
asset_content_type: application/octet-stream
- name: upload resolc.wasm
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./resolc/resolc.wasm
asset_name: resolc.wasm
asset_content_type: application/octet-stream
- name: upload resolc_web.js
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./resolc/resolc_web.js
asset_name: resolc_web.js
asset_content_type: application/octet-stream
+3 -4
View File
@@ -32,10 +32,9 @@ jobs:
- name: Install geth - name: Install geth
run: | run: |
git clone https://github.com/xermicus/go-ethereum --branch=cl/fix-runner-state-dump --depth=1 sudo add-apt-repository -y ppa:ethereum/ethereum
cd go-ethereum sudo apt update
make all sudo apt install -y ethereum
echo "$(pwd)/build/bin/" >> $GITHUB_PATH
- name: Machete - name: Machete
uses: bnjbvr/cargo-machete@main uses: bnjbvr/cargo-machete@main
+14
View File
@@ -6,6 +6,20 @@ This is a development pre-release.
Supported `polkadot-sdk` rev: `274a781e8ca1a9432c7ec87593bd93214abbff50` Supported `polkadot-sdk` rev: `274a781e8ca1a9432c7ec87593bd93214abbff50`
## 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 ## v0.1.0-dev.10
This is a development pre-release. This is a development pre-release.
Generated
+67 -67
View File
@@ -166,9 +166,9 @@ dependencies = [
[[package]] [[package]]
name = "alloy-eips" name = "alloy-eips"
version = "0.11.0" version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7149e011edbd588f6df6564b369c75f6b538d76db14053d95e0b43b2d92e4266" checksum = "5591581ca2ab0b3e7226a4047f9a1bfcf431da1d0cce3752fda609fea3c27e37"
dependencies = [ dependencies = [
"alloy-eip2124", "alloy-eip2124",
"alloy-eip2930", "alloy-eip2930",
@@ -185,9 +185,9 @@ dependencies = [
[[package]] [[package]]
name = "alloy-genesis" name = "alloy-genesis"
version = "0.11.0" version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acaec0cc4c1489d61d6f33d0c3dd522c750025f4b5c8f59cd546221e4df660e5" checksum = "0cded3a2d4bd7173f696458c5d4c98c18a628dfcc9f194385e80a486e412e2e0"
dependencies = [ dependencies = [
"alloy-eips", "alloy-eips",
"alloy-primitives", "alloy-primitives",
@@ -259,9 +259,9 @@ dependencies = [
[[package]] [[package]]
name = "alloy-serde" name = "alloy-serde"
version = "0.11.0" version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86aa42c36e3c0db5bd9a7314e98aa261a61d5e3d6a0bd7e51fb8b0a3d6438481" checksum = "8732058f5ca28c1d53d241e8504620b997ef670315d7c8afab856b3e3b80d945"
dependencies = [ dependencies = [
"alloy-primitives", "alloy-primitives",
"serde", "serde",
@@ -1267,9 +1267,9 @@ dependencies = [
[[package]] [[package]]
name = "blst" name = "blst"
version = "0.3.13" version = "0.3.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4378725facc195f1a538864863f6de233b500a8862747e7f165078a419d5e874" checksum = "47c79a94619fade3c0b887670333513a67ac28a6a7e653eb260bf0d4103db38d"
dependencies = [ dependencies = [
"cc", "cc",
"glob", "glob",
@@ -1669,9 +1669,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5"
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.2.13" version = "1.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c7777341816418c02e033934a09f20dc0ccaf65a5201ef8a450ae0105a573fda" checksum = "0c3d1b2e905a3a7b00a6141adb0e4c0bb941d11caf55349d863942a1cc44e3c9"
dependencies = [ dependencies = [
"jobserver", "jobserver",
"libc", "libc",
@@ -3050,9 +3050,9 @@ checksum = "e48c92028aaa870e83d51c64e5d4e0b6981b360c522198c23959f219a4e1b15b"
[[package]] [[package]]
name = "equivalent" name = "equivalent"
version = "1.0.1" version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
[[package]] [[package]]
name = "errno" name = "errno"
@@ -4683,7 +4683,7 @@ checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104"
[[package]] [[package]]
name = "lld-sys" name = "lld-sys"
version = "0.1.0-dev.10" version = "0.1.0-dev.11"
dependencies = [ dependencies = [
"cc", "cc",
"libc", "libc",
@@ -5095,9 +5095,9 @@ checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381"
[[package]] [[package]]
name = "openssl" name = "openssl"
version = "0.10.70" version = "0.10.71"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "61cfb4e166a8bb8c9b55c500bc2308550148ece889be90f609377e58140f42c6" checksum = "5e14130c6a98cd258fdcb0fb6d744152343ff729cbfcb28c656a9d12b999fbcd"
dependencies = [ dependencies = [
"bitflags 2.8.0", "bitflags 2.8.0",
"cfg-if", "cfg-if",
@@ -5127,9 +5127,9 @@ checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e"
[[package]] [[package]]
name = "openssl-sys" name = "openssl-sys"
version = "0.9.105" version = "0.9.106"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b22d5b84be05a8d6947c7cb71f7c849aa0f112acd4bf51c2a7c1c988ac0a9dc" checksum = "8bb61ea9811cc39e3c2069f40b8b8e2e70d8569b361f879786cc7ed48b777cdd"
dependencies = [ dependencies = [
"cc", "cc",
"libc", "libc",
@@ -7706,15 +7706,15 @@ dependencies = [
[[package]] [[package]]
name = "polkavm" name = "polkavm"
version = "0.20.0" version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0e3ed30e5a50c82ee5747c89cf4a06dbc914871d7ec795622f265428c0fbe40" checksum = "cfd34e2f74206fff33482ae1718e275f11365ef8c4de7f0e69217f8845303867"
dependencies = [ dependencies = [
"libc", "libc",
"log", "log",
"polkavm-assembler 0.20.0", "polkavm-assembler 0.21.0",
"polkavm-common 0.20.0", "polkavm-common 0.21.0",
"polkavm-linux-raw 0.20.0", "polkavm-linux-raw 0.21.0",
] ]
[[package]] [[package]]
@@ -7737,9 +7737,9 @@ dependencies = [
[[package]] [[package]]
name = "polkavm-assembler" name = "polkavm-assembler"
version = "0.20.0" version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90acfc8722902636fd875d48654696ba64208e469e5e9030ef55a509656c02f0" checksum = "f512bc80cb10439391a7c13a9eb2d37cf66b7305e7df0a06d662eff4f5b07625"
dependencies = [ dependencies = [
"log", "log",
] ]
@@ -7766,12 +7766,12 @@ dependencies = [
[[package]] [[package]]
name = "polkavm-common" name = "polkavm-common"
version = "0.20.0" version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae5e62a5310d5ee861b4623c0929d03d60b95dff0f1ec0c9e05dd1c522f5cc86" checksum = "5c16b809cfd398f861261c045a8745e6c78b71ea7e0d3ef6f7cc553eb27bc17e"
dependencies = [ dependencies = [
"log", "log",
"polkavm-assembler 0.20.0", "polkavm-assembler 0.21.0",
] ]
[[package]] [[package]]
@@ -7838,15 +7838,15 @@ dependencies = [
[[package]] [[package]]
name = "polkavm-disassembler" name = "polkavm-disassembler"
version = "0.20.0" version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c7e81a448e08c0e0adbe2466ef0f6a866f438117cda0c1602a46f779744a308" checksum = "6de96c15f2c149d3c0680438e8d25b1c0e0bf25c69f4fa37a890ca2401d158a7"
dependencies = [ dependencies = [
"clap", "clap",
"iced-x86", "iced-x86",
"polkavm 0.20.0", "polkavm 0.21.0",
"polkavm-common 0.20.0", "polkavm-common 0.21.0",
"polkavm-linker 0.20.0", "polkavm-linker 0.21.0",
] ]
[[package]] [[package]]
@@ -7883,16 +7883,16 @@ dependencies = [
[[package]] [[package]]
name = "polkavm-linker" name = "polkavm-linker"
version = "0.20.0" version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3f2f97a0c34daa9fb29341b235f4480fa80c1029f120f8387da3189036325f1" checksum = "23bc764986c4a63f9ab9890c3f4eb9b4c13b6ff80d79685bd48ade147234aab4"
dependencies = [ dependencies = [
"dirs", "dirs",
"gimli 0.31.1", "gimli 0.31.1",
"hashbrown 0.14.5", "hashbrown 0.14.5",
"log", "log",
"object 0.36.7", "object 0.36.7",
"polkavm-common 0.20.0", "polkavm-common 0.21.0",
"regalloc2 0.9.3", "regalloc2 0.9.3",
"rustc-demangle", "rustc-demangle",
] ]
@@ -7911,9 +7911,9 @@ checksum = "136ae072ab6fa38e584a06d12b1b216cff19f54d5cd202a8f8c5ec2e92e7e4bb"
[[package]] [[package]]
name = "polkavm-linux-raw" name = "polkavm-linux-raw"
version = "0.20.0" version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be71d93774fef36046d3707e84081e9e5dc65e046d7ea34f2d422b149ac0a9c8" checksum = "be6cd1d48c5e7814d287a3e12a339386a5dfa2f3ac72f932335f4cf56467f1b3"
[[package]] [[package]]
name = "poly1305" name = "poly1305"
@@ -8113,9 +8113,9 @@ dependencies = [
[[package]] [[package]]
name = "psm" name = "psm"
version = "0.1.24" version = "0.1.25"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "200b9ff220857e53e184257720a14553b2f4aa02577d2ed9842d45d4b9654810" checksum = "f58e5423e24c18cc840e1c98370b3993c6649cd1678b4d24318bcf0a083cbe88"
dependencies = [ dependencies = [
"cc", "cc",
] ]
@@ -8364,7 +8364,7 @@ dependencies = [
[[package]] [[package]]
name = "revive-benchmarks" name = "revive-benchmarks"
version = "0.1.0-dev.10" version = "0.1.0-dev.11"
dependencies = [ dependencies = [
"alloy-primitives", "alloy-primitives",
"criterion", "criterion",
@@ -8376,18 +8376,18 @@ dependencies = [
[[package]] [[package]]
name = "revive-build-utils" name = "revive-build-utils"
version = "0.1.0-dev.10" version = "0.1.0-dev.11"
[[package]] [[package]]
name = "revive-builtins" name = "revive-builtins"
version = "0.1.0-dev.10" version = "0.1.0-dev.11"
dependencies = [ dependencies = [
"revive-build-utils", "revive-build-utils",
] ]
[[package]] [[package]]
name = "revive-common" name = "revive-common"
version = "0.1.0-dev.10" version = "0.1.0-dev.11"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"serde", "serde",
@@ -8397,7 +8397,7 @@ dependencies = [
[[package]] [[package]]
name = "revive-differential" name = "revive-differential"
version = "0.1.0-dev.10" version = "0.1.0-dev.11"
dependencies = [ dependencies = [
"alloy-genesis", "alloy-genesis",
"alloy-primitives", "alloy-primitives",
@@ -8410,7 +8410,7 @@ dependencies = [
[[package]] [[package]]
name = "revive-integration" name = "revive-integration"
version = "0.1.0-dev.10" version = "0.1.0-dev.11"
dependencies = [ dependencies = [
"alloy-primitives", "alloy-primitives",
"alloy-sol-types", "alloy-sol-types",
@@ -8425,19 +8425,19 @@ dependencies = [
[[package]] [[package]]
name = "revive-linker" name = "revive-linker"
version = "0.1.0-dev.10" version = "0.1.0-dev.11"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"libc", "libc",
"lld-sys", "lld-sys",
"polkavm-linker 0.20.0", "polkavm-linker 0.21.0",
"revive-builtins", "revive-builtins",
"tempfile", "tempfile",
] ]
[[package]] [[package]]
name = "revive-llvm-builder" name = "revive-llvm-builder"
version = "0.1.0-dev.10" version = "0.1.0-dev.11"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"assert_cmd", "assert_cmd",
@@ -8458,14 +8458,14 @@ dependencies = [
[[package]] [[package]]
name = "revive-llvm-context" name = "revive-llvm-context"
version = "0.1.0-dev.10" version = "0.1.0-dev.11"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"hex", "hex",
"inkwell", "inkwell",
"itertools 0.14.0", "itertools 0.14.0",
"num", "num",
"polkavm-common 0.20.0", "polkavm-common 0.21.0",
"polkavm-disassembler", "polkavm-disassembler",
"revive-common", "revive-common",
"revive-linker", "revive-linker",
@@ -8478,7 +8478,7 @@ dependencies = [
[[package]] [[package]]
name = "revive-runner" name = "revive-runner"
version = "0.1.0-dev.10" version = "0.1.0-dev.11"
dependencies = [ dependencies = [
"alloy-primitives", "alloy-primitives",
"hex", "hex",
@@ -8493,7 +8493,7 @@ dependencies = [
[[package]] [[package]]
name = "revive-runtime-api" name = "revive-runtime-api"
version = "0.1.0-dev.10" version = "0.1.0-dev.11"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"inkwell", "inkwell",
@@ -8503,7 +8503,7 @@ dependencies = [
[[package]] [[package]]
name = "revive-solidity" name = "revive-solidity"
version = "0.1.0-dev.10" version = "0.1.0-dev.11"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"clap", "clap",
@@ -8529,7 +8529,7 @@ dependencies = [
[[package]] [[package]]
name = "revive-stdlib" name = "revive-stdlib"
version = "0.1.0-dev.10" version = "0.1.0-dev.11"
dependencies = [ dependencies = [
"inkwell", "inkwell",
"revive-build-utils", "revive-build-utils",
@@ -9431,9 +9431,9 @@ dependencies = [
[[package]] [[package]]
name = "smallvec" name = "smallvec"
version = "1.13.2" version = "1.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" checksum = "7fcf8323ef1faaee30a44a340193b1ac6814fd9b7b4e88e9d4519a3e4abe1cfd"
[[package]] [[package]]
name = "snowbridge-amcl" name = "snowbridge-amcl"
@@ -10026,7 +10026,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-crypto-ec-utils" name = "sp-crypto-ec-utils"
version = "0.10.0" version = "0.10.0"
source = "git+https://github.com/paritytech/polkadot-sdk#f340e07ffd7cff69e930d19563186ff7f0fed601" source = "git+https://github.com/paritytech/polkadot-sdk#83db0474f4df9988b01c6125a49cc59aa1b90939"
dependencies = [ dependencies = [
"ark-bls12-377", "ark-bls12-377",
"ark-bls12-377-ext", "ark-bls12-377-ext",
@@ -10093,7 +10093,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-debug-derive" name = "sp-debug-derive"
version = "14.0.0" version = "14.0.0"
source = "git+https://github.com/paritytech/polkadot-sdk#f340e07ffd7cff69e930d19563186ff7f0fed601" source = "git+https://github.com/paritytech/polkadot-sdk#83db0474f4df9988b01c6125a49cc59aa1b90939"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -10113,7 +10113,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-externalities" name = "sp-externalities"
version = "0.25.0" version = "0.25.0"
source = "git+https://github.com/paritytech/polkadot-sdk#f340e07ffd7cff69e930d19563186ff7f0fed601" source = "git+https://github.com/paritytech/polkadot-sdk#83db0474f4df9988b01c6125a49cc59aa1b90939"
dependencies = [ dependencies = [
"environmental", "environmental",
"parity-scale-codec", "parity-scale-codec",
@@ -10322,7 +10322,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-runtime-interface" name = "sp-runtime-interface"
version = "24.0.0" version = "24.0.0"
source = "git+https://github.com/paritytech/polkadot-sdk#f340e07ffd7cff69e930d19563186ff7f0fed601" source = "git+https://github.com/paritytech/polkadot-sdk#83db0474f4df9988b01c6125a49cc59aa1b90939"
dependencies = [ dependencies = [
"bytes", "bytes",
"impl-trait-for-tuples", "impl-trait-for-tuples",
@@ -10354,7 +10354,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-runtime-interface-proc-macro" name = "sp-runtime-interface-proc-macro"
version = "17.0.0" version = "17.0.0"
source = "git+https://github.com/paritytech/polkadot-sdk#f340e07ffd7cff69e930d19563186ff7f0fed601" source = "git+https://github.com/paritytech/polkadot-sdk#83db0474f4df9988b01c6125a49cc59aa1b90939"
dependencies = [ dependencies = [
"Inflector", "Inflector",
"expander", "expander",
@@ -10443,7 +10443,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7
[[package]] [[package]]
name = "sp-std" name = "sp-std"
version = "14.0.0" version = "14.0.0"
source = "git+https://github.com/paritytech/polkadot-sdk#f340e07ffd7cff69e930d19563186ff7f0fed601" source = "git+https://github.com/paritytech/polkadot-sdk#83db0474f4df9988b01c6125a49cc59aa1b90939"
[[package]] [[package]]
name = "sp-storage" name = "sp-storage"
@@ -10460,7 +10460,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-storage" name = "sp-storage"
version = "19.0.0" version = "19.0.0"
source = "git+https://github.com/paritytech/polkadot-sdk#f340e07ffd7cff69e930d19563186ff7f0fed601" source = "git+https://github.com/paritytech/polkadot-sdk#83db0474f4df9988b01c6125a49cc59aa1b90939"
dependencies = [ dependencies = [
"impl-serde", "impl-serde",
"parity-scale-codec", "parity-scale-codec",
@@ -10495,7 +10495,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-tracing" name = "sp-tracing"
version = "16.0.0" version = "16.0.0"
source = "git+https://github.com/paritytech/polkadot-sdk#f340e07ffd7cff69e930d19563186ff7f0fed601" source = "git+https://github.com/paritytech/polkadot-sdk#83db0474f4df9988b01c6125a49cc59aa1b90939"
dependencies = [ dependencies = [
"parity-scale-codec", "parity-scale-codec",
"tracing", "tracing",
@@ -10592,7 +10592,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-wasm-interface" name = "sp-wasm-interface"
version = "20.0.0" version = "20.0.0"
source = "git+https://github.com/paritytech/polkadot-sdk#f340e07ffd7cff69e930d19563186ff7f0fed601" source = "git+https://github.com/paritytech/polkadot-sdk#83db0474f4df9988b01c6125a49cc59aa1b90939"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"impl-trait-for-tuples", "impl-trait-for-tuples",
@@ -11017,9 +11017,9 @@ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
[[package]] [[package]]
name = "tempfile" name = "tempfile"
version = "3.16.0" version = "3.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38c246215d7d24f48ae091a2902398798e05d978b24315d6efbc00ede9a8bb91" checksum = "a40f762a77d2afa88c2d919489e390a12bdd261ed568e60cfa7e48d4e20f0d33"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"fastrand", "fastrand",
+21 -21
View File
@@ -3,7 +3,7 @@ resolver = "2"
members = ["crates/*"] members = ["crates/*"]
[workspace.package] [workspace.package]
version = "0.1.0-dev.10" version = "0.1.0-dev.11"
authors = [ authors = [
"Cyrill Leutwiler <cyrill@parity.io>", "Cyrill Leutwiler <cyrill@parity.io>",
"Parity Technologies <admin@parity.io>", "Parity Technologies <admin@parity.io>",
@@ -14,24 +14,24 @@ repository = "https://github.com/paritytech/revive"
rust-version = "1.81.0" rust-version = "1.81.0"
[workspace.dependencies] [workspace.dependencies]
revive-benchmarks = { version = "0.1.0-dev.10", path = "crates/benchmarks" } revive-benchmarks = { version = "0.1.0-dev.11", path = "crates/benchmarks" }
revive-builtins = { version = "0.1.0-dev.10", path = "crates/builtins" } revive-builtins = { version = "0.1.0-dev.11", path = "crates/builtins" }
revive-common = { version = "0.1.0-dev.10", path = "crates/common" } revive-common = { version = "0.1.0-dev.11", path = "crates/common" }
revive-differential = { version = "0.1.0-dev.10", path = "crates/differential" } revive-differential = { version = "0.1.0-dev.11", path = "crates/differential" }
revive-integration = { version = "0.1.0-dev.10", path = "crates/integration" } revive-integration = { version = "0.1.0-dev.11", path = "crates/integration" }
revive-linker = { version = "0.1.0-dev.10", path = "crates/linker" } revive-linker = { version = "0.1.0-dev.11", path = "crates/linker" }
lld-sys = { version = "0.1.0-dev.10", path = "crates/lld-sys" } lld-sys = { version = "0.1.0-dev.11", path = "crates/lld-sys" }
revive-llvm-context = { version = "0.1.0-dev.10", path = "crates/llvm-context" } revive-llvm-context = { version = "0.1.0-dev.11", path = "crates/llvm-context" }
revive-runtime-api = { version = "0.1.0-dev.10", path = "crates/runtime-api" } revive-runtime-api = { version = "0.1.0-dev.11", path = "crates/runtime-api" }
revive-runner = { version = "0.1.0-dev.10", path = "crates/runner" } revive-runner = { version = "0.1.0-dev.11", path = "crates/runner" }
revive-solidity = { version = "0.1.0-dev.10", path = "crates/solidity" } revive-solidity = { version = "0.1.0-dev.11", path = "crates/solidity" }
revive-stdlib = { version = "0.1.0-dev.10", path = "crates/stdlib" } revive-stdlib = { version = "0.1.0-dev.11", path = "crates/stdlib" }
revive-build-utils = { version = "0.1.0-dev.10", path = "crates/build-utils" } revive-build-utils = { version = "0.1.0-dev.11", path = "crates/build-utils" }
hex = "0.4.3" hex = "0.4.3"
cc = "1.2" cc = "1.2"
libc = "0.2.169" libc = "0.2.169"
tempfile = "3.16" tempfile = "3.17"
anyhow = "1.0" anyhow = "1.0"
semver = { version = "1.0", features = ["serde"] } semver = { version = "1.0", features = ["serde"] }
itertools = "0.14" itertools = "0.14"
@@ -47,14 +47,14 @@ which = "7.0"
path-slash = "0.2" path-slash = "0.2"
rayon = "1.8" rayon = "1.8"
clap = { version = "4", default-features = false, features = ["derive"] } clap = { version = "4", default-features = false, features = ["derive"] }
polkavm-common = "0.20.0" polkavm-common = "0.21.0"
polkavm-linker = "0.20.0" polkavm-linker = "0.21.0"
polkavm-disassembler = "0.20.0" polkavm-disassembler = "0.21.0"
polkavm = "0.20.0" polkavm = "0.21.0"
alloy-primitives = { version = "0.8.21", features = ["serde"] } alloy-primitives = { version = "0.8.21", features = ["serde"] }
alloy-sol-types = "0.8.21" alloy-sol-types = "0.8.21"
alloy-genesis = "0.11.0" alloy-genesis = "0.11.1"
alloy-serde = "0.11.0" alloy-serde = "0.11.1"
env_logger = { version = "0.11.6", default-features = false } env_logger = { version = "0.11.6", default-features = false }
serde_stacker = "0.1.11" serde_stacker = "0.1.11"
criterion = { version = "0.5.1", features = ["html_reports"] } criterion = { version = "0.5.1", features = ["html_reports"] }
+4 -5
View File
@@ -4,8 +4,7 @@ Prior to the first stable release we neither have formal release processes nor d
To create a new pre-release: To create a new pre-release:
1. Merge a release PR which updates the `-dev.X` versions in the workspace `Cargo.toml` and updates the `CHANGELOG.md` accordingly 1. Merge a release PR which updates the `-dev.X` versions in the workspace `Cargo.toml` and updates the `CHANGELOG.md` accordingly. The release workflow will attempt to build and publish a new release whenever the latest git tag does not match the cargo package version.
2. Push a release tag to `main` 2. Wait for the `Release` workflow to finish. If the workflow fails after the `build-linux-all` step, check if a tag has been created and delete it before restarting or pushing updates. Note: It's more convenient to debug the release workflow in a fork (the fork has to be under the `paritytech` org to access `parity-large` runners).
3. Create a __pre-release__ from the tag and manually upload the `resolc` binary from docker image 3. Check draft release on [Releases page](https://github.com/paritytech/revive/releases) and publish (should contain `resolc.js`, `resolc.wasm`, `resolc-web.js`, and `resolc-static-linux` release assets)
4. Manually upload `resolc.js`, `resolc-web.js` and `resolc.wasm` from the `build-revive-wasm` action artifacts. 4. Update the [contract-docs](https://github.com/paritytech/contract-docs/) accordingly
5. Update the [contract-docs](https://github.com/paritytech/contract-docs/) accordingly
+40
View File
@@ -0,0 +1,40 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;
/* runner.json
{
"differential": true,
"actions": [
{
"Instantiate": {
"code": {
"Solidity": {
"contract": "MLoad"
}
}
}
},
{
"Call": {
"dest": {
"Instantiated": 0
},
"data": "e2179b8e"
}
}
]
}
*/
contract MLoad {
constructor() payable {
assert(g() == 0);
}
function g() public payable returns (uint m) {
assembly {
m := mload(0)
}
}
}
+1
View File
@@ -55,6 +55,7 @@ test_spec!(create2, "CreateB", "Create2.sol");
test_spec!(transfer, "Transfer", "Transfer.sol"); test_spec!(transfer, "Transfer", "Transfer.sol");
test_spec!(send, "Send", "Send.sol"); test_spec!(send, "Send", "Send.sol");
test_spec!(function_pointer, "FunctionPointer", "FunctionPointer.sol"); test_spec!(function_pointer, "FunctionPointer", "FunctionPointer.sol");
test_spec!(mload, "MLoad", "MLoad.sol");
fn instantiate(path: &str, contract: &str) -> Vec<SpecsAction> { fn instantiate(path: &str, contract: &str) -> Vec<SpecsAction> {
vec![Instantiate { vec![Instantiate {
@@ -6,15 +6,9 @@ pub const LLVM_VERSION: semver::Version = semver::Version::new(18, 1, 4);
/// The pointer width sized type. /// The pointer width sized type.
pub static XLEN: usize = revive_common::BIT_LENGTH_X32; pub static XLEN: usize = revive_common::BIT_LENGTH_X32;
/// The heap memory pointer pointer global variable name.
pub static GLOBAL_HEAP_MEMORY_POINTER: &str = "memory_pointer";
/// The calldata size global variable name. /// The calldata size global variable name.
pub static GLOBAL_CALLDATA_SIZE: &str = "calldatasize"; pub static GLOBAL_CALLDATA_SIZE: &str = "calldatasize";
/// The call flags global variable name.
pub static GLOBAL_CALL_FLAGS: &str = "call_flags";
/// The deployer call header size that consists of: /// The deployer call header size that consists of:
/// - bytecode hash (32 bytes) /// - bytecode hash (32 bytes)
pub const DEPLOYER_CALL_HEADER_SIZE: usize = revive_common::BYTE_LENGTH_WORD; pub const DEPLOYER_CALL_HEADER_SIZE: usize = revive_common::BYTE_LENGTH_WORD;
@@ -24,22 +24,6 @@ impl Entry {
where where
D: Dependency + Clone, D: Dependency + Clone,
{ {
context.set_global(
crate::polkavm::GLOBAL_HEAP_MEMORY_POINTER,
context.llvm().ptr_type(AddressSpace::Heap.into()),
AddressSpace::Stack,
context.xlen_type().get_undef(),
);
context.build_store(
context
.get_global(crate::polkavm::GLOBAL_HEAP_MEMORY_POINTER)?
.into(),
context.build_sbrk(
context.xlen_type().const_zero(),
context.xlen_type().const_zero(),
)?,
)?;
context.set_global( context.set_global(
crate::polkavm::GLOBAL_CALLDATA_SIZE, crate::polkavm::GLOBAL_CALLDATA_SIZE,
context.xlen_type(), context.xlen_type(),
@@ -47,13 +31,6 @@ impl Entry {
context.xlen_type().get_undef(), context.xlen_type().get_undef(),
); );
context.set_global(
crate::polkavm::GLOBAL_CALL_FLAGS,
context.word_type(),
AddressSpace::Stack,
context.word_const(0),
);
Ok(()) Ok(())
} }
@@ -70,6 +47,11 @@ impl Entry {
.build_runtime_call(revive_runtime_api::polkavm_imports::CALL_DATA_SIZE, &[]) .build_runtime_call(revive_runtime_api::polkavm_imports::CALL_DATA_SIZE, &[])
.expect("the call_data_size syscall method should return a value") .expect("the call_data_size syscall method should return a value")
.into_int_value(); .into_int_value();
let call_data_size_value = context.builder().build_int_truncate(
call_data_size_value,
context.xlen_type(),
"call_data_size_truncated",
)?;
context context
.builder() .builder()
.build_store(call_data_size_pointer, call_data_size_value)?; .build_store(call_data_size_pointer, call_data_size_value)?;
@@ -90,13 +72,6 @@ impl Entry {
.borrow() .borrow()
.get_nth_param(Self::ARGUMENT_INDEX_CALL_FLAGS); .get_nth_param(Self::ARGUMENT_INDEX_CALL_FLAGS);
context.set_global(
crate::polkavm::GLOBAL_CALL_FLAGS,
is_deploy.get_type(),
AddressSpace::Stack,
is_deploy.into_int_value(),
);
let deploy_code_call_block = context.append_basic_block("deploy_code_call_block"); let deploy_code_call_block = context.append_basic_block("deploy_code_call_block");
let runtime_code_call_block = context.append_basic_block("runtime_code_call_block"); let runtime_code_call_block = context.append_basic_block("runtime_code_call_block");
+14 -13
View File
@@ -1209,17 +1209,17 @@ where
/// Build a call to PolkaVM `msize` for querying the linear memory size. /// Build a call to PolkaVM `msize` for querying the linear memory size.
pub fn build_msize(&self) -> anyhow::Result<inkwell::values::IntValue<'ctx>> { pub fn build_msize(&self) -> anyhow::Result<inkwell::values::IntValue<'ctx>> {
Ok(self let memory_size_pointer = self
.builder() .module()
.build_call( .get_global(revive_runtime_api::polkavm_imports::MEMORY_SIZE)
self.runtime_api_method(revive_runtime_api::polkavm_imports::MEMORY_SIZE), .expect("the memory size symbol should have been declared")
&[], .as_pointer_value();
"call_msize", let memory_size_value = self.builder().build_load(
)? self.xlen_type(),
.try_as_basic_value() memory_size_pointer,
.left() "memory_size_value",
.expect("sbrk returns an int") )?;
.into_int_value()) Ok(memory_size_value.into_int_value())
} }
/// Call PolkaVM `sbrk` for extending the heap by `offset` + `size`, /// Call PolkaVM `sbrk` for extending the heap by `offset` + `size`,
@@ -1265,8 +1265,9 @@ where
self.build_heap_alloc(offset, length)?; self.build_heap_alloc(offset, length)?;
let heap_start = self let heap_start = self
.get_global(crate::polkavm::GLOBAL_HEAP_MEMORY_POINTER)? .module()
.value .get_global(revive_runtime_api::polkavm_imports::MEMORY)
.expect("the memory symbol should have been declared")
.as_pointer_value(); .as_pointer_value();
Ok(self.build_gep( Ok(self.build_gep(
Pointer::new(self.byte_type(), AddressSpace::Stack, heap_start), Pointer::new(self.byte_type(), AddressSpace::Stack, heap_start),
+3 -7
View File
@@ -8,10 +8,10 @@
#define EVM_WORD_SIZE 32 #define EVM_WORD_SIZE 32
#define ALIGN(size) ((size + EVM_WORD_SIZE - 1) & ~(EVM_WORD_SIZE - 1)) #define ALIGN(size) ((size + EVM_WORD_SIZE - 1) & ~(EVM_WORD_SIZE - 1))
#define MAX_MEMORY_SIZE (64 * 1024) #define MAX_MEMORY_SIZE (64 * 1024)
static char __memory[MAX_MEMORY_SIZE]; char __memory[MAX_MEMORY_SIZE];
static uint32_t __memory_size = 0; uint32_t __memory_size = 0;
void * __sbrk_internal(uint32_t offset, uint32_t size) { void * __sbrk_internal(uint32_t offset, uint32_t size) {
if (offset >= MAX_MEMORY_SIZE || size > MAX_MEMORY_SIZE) { if (offset >= MAX_MEMORY_SIZE || size > MAX_MEMORY_SIZE) {
return NULL; return NULL;
} }
@@ -27,10 +27,6 @@ void * __sbrk_internal(uint32_t offset, uint32_t size) {
return (void *)&__memory[__memory_size]; return (void *)&__memory[__memory_size];
} }
uint32_t __msize() {
return __memory_size;
}
void * memset(void *b, int c, size_t len) { void * memset(void *b, int c, size_t len) {
uint8_t *dest = b; uint8_t *dest = b;
while (len-- > 0) *dest++ = c; while (len-- > 0) *dest++ = c;
+7 -12
View File
@@ -1,18 +1,14 @@
//! This crate vendors the [PolkaVM][0] C API and provides a LLVM module for interacting
//! with the `pallet-revive` runtime API.
//! At present, the revive pallet requires blobs to export `call` and `deploy`,
//! and offers a bunch of [runtime API methods][1]. The provided [module] implements
//! those exports and imports.
//! [0]: [https://crates.io/crates/polkavm]
//! [1]: [https://docs.rs/pallet-contracts/26.0.0/pallet_contracts/api_doc/index.html]
use inkwell::{context::Context, memory_buffer::MemoryBuffer, module::Module, support::LLVMString}; use inkwell::{context::Context, memory_buffer::MemoryBuffer, module::Module, support::LLVMString};
include!(concat!(env!("OUT_DIR"), "/polkavm_imports.rs")); include!(concat!(env!("OUT_DIR"), "/polkavm_imports.rs"));
pub static SBRK: &str = "__sbrk_internal"; /// The emulated EVM heap memory global symbol.
pub static MEMORY: &str = "__memory";
pub static MEMORY_SIZE: &str = "__msize"; /// The emulated EVM heap memory size global symbol.
pub static MEMORY_SIZE: &str = "__memory_size";
pub static SBRK: &str = "__sbrk_internal";
pub static ADDRESS: &str = "address"; pub static ADDRESS: &str = "address";
@@ -82,9 +78,8 @@ pub static WEIGHT_TO_FEE: &str = "weight_to_fee";
/// All imported runtime API symbols. /// All imported runtime API symbols.
/// Useful for configuring common attributes and linkage. /// Useful for configuring common attributes and linkage.
pub static IMPORTS: [&str; 35] = [ pub static IMPORTS: [&str; 34] = [
SBRK, SBRK,
MEMORY_SIZE,
ADDRESS, ADDRESS,
BALANCE, BALANCE,
BALANCE_OF, BALANCE_OF,
@@ -16,11 +16,11 @@
], ],
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"@types/jest": "^29.5.11", "@types/jest": "^29.5.14",
"@types/shelljs": "^0.8.15", "@types/shelljs": "^0.8.15",
"jest": "^29.7.0", "jest": "^29.7.0",
"shelljs": "^0.8.5", "shelljs": "^0.8.5",
"ts-jest": "^29.1.1", "ts-jest": "^29.2.5",
"typescript": "^5.3.3" "typescript": "^5.7.3"
} }
} }
+1 -1
View File
@@ -21,4 +21,4 @@
"prettier": "^3.4.2", "prettier": "^3.4.2",
"terser": "^5.37.0" "terser": "^5.37.0"
} }
} }
+2 -2
View File
@@ -3,11 +3,11 @@
"private": true, "private": true,
"scripts": { "scripts": {
"test:cli": "npm run test -w crates/solidity/src/tests/cli-tests", "test:cli": "npm run test -w crates/solidity/src/tests/cli-tests",
"test:wasm": "npm run test:all -w js", "test:wasm": "npm run test:node -w js",
"build:package": "npm run build:package -w js" "build:package": "npm run build:package -w js"
}, },
"workspaces": [ "workspaces": [
"crates/solidity/src/tests/cli-tests", "crates/solidity/src/tests/cli-tests",
"js" "js"
] ]
} }