Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"

[env]
# Makes `--target wasm32-linera-chain` resolve to linera-service/wasm32-linera-chain.json
# anywhere in the repo.
RUST_TARGET_PATH = { value = "linera-service", relative = true }

[build]
# We allow redundant explicit links because `cargo rdme` doesn't know how to resolve implicit intra-crate links.
rustdocflags = ["-Arustdoc::redundant_explicit_links"]
6 changes: 5 additions & 1 deletion .github/workflows/dynamodb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,18 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install nightly toolchain for wasm builds
run: |
rustup toolchain install $(sed -n 's/^channel = "\(.*\)"/\1/p' toolchains/nightly/rust-toolchain.toml) --component rust-src
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build example applications
run: |
unset RUSTUP_TOOLCHAIN RUSTFLAGS
cd examples
cargo build --locked --release --target wasm32-unknown-unknown
cargo build --locked --release --target wasm32-linera-chain
- name: Build
run: |
cargo build --locked --features dynamodb
Expand Down
24 changes: 22 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install nightly toolchain for wasm builds
run: |
rustup toolchain install $(sed -n 's/^channel = "\(.*\)"/\1/p' toolchains/nightly/rust-toolchain.toml) --component rust-src
Comment on lines +69 to +71
Copy link
Copy Markdown
Contributor

@Twey Twey Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't love parsing TOML with sed 😅 We do this generally by linking the toolchain to rust-toolchain.toml.

I wonder if it's time to always use a nightly toolchain. We can still be compatible with stable Rust by forbidding #![feature] flags in the core code — @ma2bd for interest.

- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
Expand Down Expand Up @@ -233,6 +236,9 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install nightly toolchain for wasm builds
run: |
rustup toolchain install $(sed -n 's/^channel = "\(.*\)"/\1/p' toolchains/nightly/rust-toolchain.toml) --component rust-src
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
Expand Down Expand Up @@ -279,6 +285,11 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
override: false
- name: Install nightly toolchain for wasm builds
run: |
rustup toolchain install $(sed -n 's/^channel = "\(.*\)"/\1/p' toolchains/nightly/rust-toolchain.toml) --component rust-src
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
Expand All @@ -303,6 +314,11 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
override: false
- name: Install nightly toolchain for wasm builds
run: |
rustup toolchain install $(sed -n 's/^channel = "\(.*\)"/\1/p' toolchains/nightly/rust-toolchain.toml) --component rust-src
- uses: foundry-rs/foundry-toolchain@v1.4.0
- name: Ensure Solc Directory Exists
run: mkdir -p /home/runner/.solc
Expand Down Expand Up @@ -365,14 +381,18 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install nightly toolchain for wasm builds
run: |
rustup toolchain install $(sed -n 's/^channel = "\(.*\)"/\1/p' toolchains/nightly/rust-toolchain.toml) --component rust-src
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build example applications
run: |
unset RUSTUP_TOOLCHAIN RUSTFLAGS
cd examples
cargo build --locked --release --target wasm32-unknown-unknown
cargo build --locked --release --target wasm32-linera-chain
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can (and should) put this in .cargo/config.toml so we don't need to specify it here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC, the issue was that .cargo/config.toml was being ignored in the CI b/c of some ENV overwrites.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think its RUSTFLAGS specifically are a bit fiddly. But the target should be fine.

- name: Run the storage-service instance
run: |
cargo run --release -p linera-storage-service -- memory --endpoint $LINERA_STORAGE_SERVICE &
Expand Down Expand Up @@ -556,7 +576,7 @@ jobs:
needs: changed-files
if: needs.changed-files.outputs.should-run == 'true'
runs-on: linera-io-self-hosted-ci
timeout-minutes: 20
timeout-minutes: 40

steps:
- uses: actions/checkout@v4
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/scylladb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,18 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install nightly toolchain for wasm builds
run: |
rustup toolchain install $(sed -n 's/^channel = "\(.*\)"/\1/p' toolchains/nightly/rust-toolchain.toml) --component rust-src
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build example applications
run: |
unset RUSTUP_TOOLCHAIN RUSTFLAGS
cd examples
cargo build --locked --release --target wasm32-unknown-unknown
cargo build --locked --release --target wasm32-linera-chain
- name: Build
run: |
cargo build --locked --features scylladb
Expand Down
19 changes: 7 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 4 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,7 @@ revm-state = { version = "4.0.1", default-features = false, features = [
"serde",
] }
rocksdb = "0.21.0"
# 0.8.2 doesn't build with Rust 1.87. Remove `=` once
# https://github.com/linera-io/linera-protocol/issues/4742 is resolved.
ruzstd = "=0.8.1"
ruzstd = "0.8"
scylla = "~1.1.0"
semver = "1.0.22"
serde = { version = "1.0.197", features = ["derive"] }
Expand Down Expand Up @@ -286,9 +284,9 @@ url = "2.4"
wasm-bindgen = "0.2.100"
wasm-bindgen-futures = "=0.4.50"
wasm-bindgen-test = "0.3.42"
wasm-instrument = { package = "linera-wasm-instrument", version = "0.4.0-linera.1" }
wasmer = { package = "linera-wasmer", version = "4.4.0-linera.7", default-features = false }
wasmer-compiler-singlepass = { package = "linera-wasmer-compiler-singlepass", version = "4.4.0-linera.7", default-features = false, features = [
wasm-instrument = { package = "linera-wasm-instrument", git = "https://github.com/linera-io/wasm-instrument", branch = "bulk-memory-support" }
wasmer = { package = "linera-wasmer", git = "https://github.com/linera-io/wasmer", branch = "fix-rust-probestack", default-features = false }
wasmer-compiler-singlepass = { package = "linera-wasmer-compiler-singlepass", git = "https://github.com/linera-io/wasmer", branch = "fix-rust-probestack", default-features = false, features = [
"std",
"unwind",
"avx",
Expand Down
11 changes: 11 additions & 0 deletions examples/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[env]
# Makes `--target wasm32-linera-chain` resolve to linera-service/wasm32-linera-chain.json
RUST_TARGET_PATH = { value = "../linera-service", relative = true }

[build]
# Required for rustc to accept the custom wasm32-linera-chain target spec.
rustflags = ["-Zunstable-options"]

[unstable]
build-std = ["std", "panic_abort"]
json-target-spec = true
21 changes: 9 additions & 12 deletions examples/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ futures-util = "0.3.26"
getrandom = { version = "0.2.12", default-features = false, features = [
"custom",
] }
half = { version = ">=2.3.1, <2.6", features = [
"rand_distr",
"num-traits",
"use-intrinsics",
] }
hex = "0.4.3"
insta = { version = "1.36.1", features = ["yaml"] }
linera-sdk = { path = "../linera-sdk" }
Expand Down
10 changes: 5 additions & 5 deletions examples/amm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,27 +79,27 @@ OWNER_2="${INFO_2[1]}"
Now we have to publish and create the fungible applications. The flag `--wait-for-outgoing-messages` waits until a quorum of validators has confirmed that all sent cross-chain messages have been delivered.

```bash
(cd examples/fungible && cargo build --release --target wasm32-unknown-unknown)
(cd examples/fungible && cargo build --release --target wasm32-linera-chain)

FUN1_APP_ID=$(linera --wait-for-outgoing-messages \
publish-and-create examples/target/wasm32-unknown-unknown/release/fungible_{contract,service}.wasm \
publish-and-create examples/target/wasm32-linera-chain/release/fungible_{contract,service}.wasm \
--json-argument "{ \"accounts\": {
\"$OWNER_AMM\": \"100.\"
} }" \
--json-parameters "{ \"ticker_symbol\": \"FUN1\" }" \
)

FUN2_APP_ID=$(linera --wait-for-outgoing-messages \
publish-and-create examples/target/wasm32-unknown-unknown/release/fungible_{contract,service}.wasm \
publish-and-create examples/target/wasm32-linera-chain/release/fungible_{contract,service}.wasm \
--json-argument "{ \"accounts\": {
\"$OWNER_AMM\": \"100.\"
} }" \
--json-parameters "{ \"ticker_symbol\": \"FUN2\" }" \
)

(cd examples/amm && cargo build --release --target wasm32-unknown-unknown)
(cd examples/amm && cargo build --release --target wasm32-linera-chain)
AMM_APPLICATION_ID=$(linera --wait-for-outgoing-messages \
publish-and-create examples/target/wasm32-unknown-unknown/release/amm_{contract,service}.wasm \
publish-and-create examples/target/wasm32-linera-chain/release/amm_{contract,service}.wasm \
--json-parameters "{\"tokens\":["\"$FUN1_APP_ID\"","\"$FUN2_APP_ID\""]}" \
--required-application-ids $FUN1_APP_ID $FUN2_APP_ID)
```
Expand Down
4 changes: 2 additions & 2 deletions examples/counter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ Now, compile the `counter` application WebAssembly binaries, publish and create

```bash
cd examples/counter
cargo build --release --target wasm32-unknown-unknown
cargo build --release --target wasm32-linera-chain

LINERA_APPLICATION_ID=$(linera publish-and-create \
../target/wasm32-unknown-unknown/release/counter_{contract,service}.wasm \
../target/wasm32-linera-chain/release/counter_{contract,service}.wasm \
--json-argument "1")
```

Expand Down
4 changes: 2 additions & 2 deletions examples/fungible/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ Now, compile the `fungible` application WebAssembly binaries, and publish them a
bytecode:

```bash
(cd examples/fungible && cargo build --release --target wasm32-unknown-unknown)
(cd examples/fungible && cargo build --release --target wasm32-linera-chain)

MODULE_ID=$(linera publish-module \
examples/target/wasm32-unknown-unknown/release/fungible_{contract,service}.wasm)
examples/target/wasm32-linera-chain/release/fungible_{contract,service}.wasm)
```

Here, we stored the new module ID in a variable `MODULE_ID` to be reused it later.
Expand Down
Loading
Loading