Skip to content
Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
git submodule add https://github.com/nervosnetwork/ckb-c-stdlib deps/ckb-c-stdlib &&
git submodule add https://github.com/xxuejie/lib-dummy-atomics deps/lib-dummy-atomics
- name: Lock Rust version
run: cd test-workspace && echo "1.92.0" > rust-toolchain
run: cd test-workspace && echo "1.95.0" > rust-toolchain
- name: Install riscv64 target & clippy
run: cd test-workspace && rustup target add riscv64imac-unknown-none-elf && rustup component add clippy
- name: Run all checks
Expand All @@ -60,7 +60,7 @@ jobs:
- name: Generate standalone contract
run: cargo generate --path . standalone-contract --name test-contract
- name: Lock Rust version
run: cd test-contract && echo "1.92.0" > rust-toolchain
run: cd test-contract && echo "1.95.0" > rust-toolchain
- name: Run all checks
run: cd test-contract && make build test check clippy
- name: Reproducible build runs
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This repository keeps a series of CKB script templates that can be inflated via

[molecule](https://github.com/nervosnetwork/molecule) starting from 0.8.0, switches to [bytes](https://crates.io/crates/bytes) instead of `Vec` internally to keep data in `no_std` environment. However, bytes would require atomic builtins so as to function, this could lead to unsupported CKB-VM instructions (RISC-V A extension instructions to be precise) being generated. There are 2 ways to solve this issue:

* Enable `dummy-atomic` feature in `ckb-std` crate, also use make sure `FULL_RUSTFLAGS` in the contract makefile is updated so `-a` is included, for example: `FULL_RUSTFLAGS := -C target-feature=+zba,+zbb,+zbc,+zbs,-a $(CUSTOM_RUSTFLAGS)`. Or see [this PR](https://github.com/cryptape/ckb-script-templates/pull/17) for how to change `RUSTFLAGS`.
* Make sure `FULL_RUSTFLAGS` in the contract makefile is updated so `passes=lower-atomic` is included, for example: `FULL_RUSTFLAGS := -C target-feature=+zba,+zbb,+zbc,+zbs -C passes=lower-atomic $(CUSTOM_RUSTFLAGS)`. Or see [this PR](https://github.com/cryptape/ckb-script-templates/pull/17) for how to change `RUSTFLAGS`.
* Enable `bytes_vec` feature in `molecule` crate

[ckb-gen-types](https://crates.io/crates/ckb-gen-types) starting from 0.117.0 is also affected, since `ckb-gen-types` has upgraded to `molecule` 0.8.0 in this version.
Expand Down
2 changes: 1 addition & 1 deletion atomics-contract/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ TOP := $(cur_dir)
CUSTOM_RUSTFLAGS := -C debug-assertions
# RUSTFLAGS that are less likely to be tweaked by developers. Most likely
# one would want to keep the default values here.
FULL_RUSTFLAGS := -C target-feature=+zba,+zbb,+zbc,+zbs,-a $(CUSTOM_RUSTFLAGS)
FULL_RUSTFLAGS := -C target-feature=+zba,+zbb,+zbc,+zbs -C passes=lower-atomic $(CUSTOM_RUSTFLAGS)
# Additional cargo args to append here. For example, one can use
# make test CARGO_ARGS="-- --nocapture" so as to inspect data emitted to
# stdout in unit tests
Expand Down
2 changes: 1 addition & 1 deletion contract-without-simulator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ TOP := $(cur_dir)
CUSTOM_RUSTFLAGS := -C debug-assertions
# RUSTFLAGS that are less likely to be tweaked by developers. Most likely
# one would want to keep the default values here.
FULL_RUSTFLAGS := -C target-feature=+zba,+zbb,+zbc,+zbs,-a $(CUSTOM_RUSTFLAGS)
FULL_RUSTFLAGS := -C target-feature=+zba,+zbb,+zbc,+zbs -C passes=lower-atomic $(CUSTOM_RUSTFLAGS)
# Additional cargo args to append here. For example, one can use
# make test CARGO_ARGS="-- --nocapture" so as to inspect data emitted to
# stdout in unit tests
Expand Down
2 changes: 1 addition & 1 deletion contract/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ TOP := $(cur_dir)
CUSTOM_RUSTFLAGS := -C debug-assertions
# RUSTFLAGS that are less likely to be tweaked by developers. Most likely
# one would want to keep the default values here.
FULL_RUSTFLAGS := -C target-feature=+zba,+zbb,+zbc,+zbs,-a $(CUSTOM_RUSTFLAGS)
FULL_RUSTFLAGS := -C target-feature=+zba,+zbb,+zbc,+zbs -C passes=lower-atomic $(CUSTOM_RUSTFLAGS)
# Additional cargo args to append here. For example, one can use
# make test CARGO_ARGS="-- --nocapture" so as to inspect data emitted to
# stdout in unit tests
Expand Down
2 changes: 1 addition & 1 deletion stack-reorder-contract/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ TOP := $(cur_dir)
CUSTOM_RUSTFLAGS := -C debug-assertions
# RUSTFLAGS that are less likely to be tweaked by developers. Most likely
# one would want to keep the default values here.
FULL_RUSTFLAGS := -C target-feature=+zba,+zbb,+zbc,+zbs,-a $(CUSTOM_RUSTFLAGS) \
FULL_RUSTFLAGS := -C target-feature=+zba,+zbb,+zbc,+zbs -C passes=lower-atomic $(CUSTOM_RUSTFLAGS) \
-C link-arg=-T$(cur_dir)ld_interface.ld
# Additional cargo args to append here. For example, one can use
# make test CARGO_ARGS="-- --nocapture" so as to inspect data emitted to
Expand Down
2 changes: 1 addition & 1 deletion standalone-contract/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ TOP := $(cur_dir)
CUSTOM_RUSTFLAGS := -C debug-assertions
# RUSTFLAGS that are less likely to be tweaked by developers. Most likely
# one would want to keep the default values here.
FULL_RUSTFLAGS := -C target-feature=+zba,+zbb,+zbc,+zbs,-a $(CUSTOM_RUSTFLAGS)
FULL_RUSTFLAGS := -C target-feature=+zba,+zbb,+zbc,+zbs -C passes=lower-atomic $(CUSTOM_RUSTFLAGS)
# Additional cargo args to append here. For example, one can use
# make test CARGO_ARGS="-- --nocapture" so as to inspect data emitted to
# stdout in unit tests
Expand Down
6 changes: 2 additions & 4 deletions standalone-contract/scripts/find_clang
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fi
# at the end.
SEARCH_TARGET="${SEARCH_TARGET:-llvm-strip}"

CANDIDATES=("${SEARCH_TARGET}" "${SEARCH_TARGET}-19" "${SEARCH_TARGET}-20" "${SEARCH_TARGET}-21" "${SEARCH_TARGET}-18" "${SEARCH_TARGET}-17" "${SEARCH_TARGET}-16")
CANDIDATES=("${SEARCH_TARGET}" "${SEARCH_TARGET}-19" "${SEARCH_TARGET}-20" "${SEARCH_TARGET}-21" "${SEARCH_TARGET}-22")

BREW_PREFIX=$(brew --prefix 2> /dev/null)
if [[ -n "${BREW_PREFIX}" ]]; then
Expand All @@ -21,9 +21,7 @@ if [[ -n "${BREW_PREFIX}" ]]; then
"${BREW_PREFIX}/opt/llvm@19/bin/${SEARCH_TARGET}"
"${BREW_PREFIX}/opt/llvm@20/bin/${SEARCH_TARGET}"
"${BREW_PREFIX}/opt/llvm@21/bin/${SEARCH_TARGET}"
"${BREW_PREFIX}/opt/llvm@18/bin/${SEARCH_TARGET}"
"${BREW_PREFIX}/opt/llvm@17/bin/${SEARCH_TARGET}"
"${BREW_PREFIX}/opt/llvm@16/bin/${SEARCH_TARGET}"
"${BREW_PREFIX}/opt/llvm@22/bin/${SEARCH_TARGET}"
)
fi

Expand Down
4 changes: 2 additions & 2 deletions standalone-contract/scripts/reproducible_build_docker
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
set -ex

DOCKER="${DOCKER:-docker}"
# docker pull nervos/llvm-n-rust:20260325
DOCKER_IMAGE="${DOCKER_IMAGE:-docker.io/nervos/llvm-n-rust@sha256:cfe226cbb93955b72209eac9db2d99b9405b03871972ea2998c7059dc4dd920f}"
# docker pull nervos/llvm-n-rust:20260610
DOCKER_IMAGE="${DOCKER_IMAGE:-docker.io/nervos/llvm-n-rust@sha256:c1abd0c0542222b3e6c3e87361636fe2f3e08b9a3126e5bb1df10880aa0f23ca}"
CHECKSUM_FILE_PATH="${CHECKSUM_FILE_PATH:-checksums.txt}"

# We are parsing command line arguments based on tips from:
Expand Down
1 change: 1 addition & 0 deletions workspace/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/build
/target
/tests/failed_txs
/Cargo.lock
6 changes: 2 additions & 4 deletions workspace/scripts/find_clang
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fi
# at the end.
SEARCH_TARGET="${SEARCH_TARGET:-llvm-strip}"

CANDIDATES=("${SEARCH_TARGET}" "${SEARCH_TARGET}-19" "${SEARCH_TARGET}-20" "${SEARCH_TARGET}-21" "${SEARCH_TARGET}-18" "${SEARCH_TARGET}-17" "${SEARCH_TARGET}-16")
CANDIDATES=("${SEARCH_TARGET}" "${SEARCH_TARGET}-19" "${SEARCH_TARGET}-20" "${SEARCH_TARGET}-21" "${SEARCH_TARGET}-22")

BREW_PREFIX=$(brew --prefix 2> /dev/null)
if [[ -n "${BREW_PREFIX}" ]]; then
Expand All @@ -21,9 +21,7 @@ if [[ -n "${BREW_PREFIX}" ]]; then
"${BREW_PREFIX}/opt/llvm@19/bin/${SEARCH_TARGET}"
"${BREW_PREFIX}/opt/llvm@20/bin/${SEARCH_TARGET}"
"${BREW_PREFIX}/opt/llvm@21/bin/${SEARCH_TARGET}"
"${BREW_PREFIX}/opt/llvm@18/bin/${SEARCH_TARGET}"
"${BREW_PREFIX}/opt/llvm@17/bin/${SEARCH_TARGET}"
"${BREW_PREFIX}/opt/llvm@16/bin/${SEARCH_TARGET}"
"${BREW_PREFIX}/opt/llvm@22/bin/${SEARCH_TARGET}"
Comment thread
mohanson marked this conversation as resolved.
)
fi

Expand Down
4 changes: 2 additions & 2 deletions workspace/scripts/reproducible_build_docker
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
set -ex

DOCKER="${DOCKER:-docker}"
# docker pull nervos/llvm-n-rust:20260325
DOCKER_IMAGE="${DOCKER_IMAGE:-docker.io/nervos/llvm-n-rust@sha256:cfe226cbb93955b72209eac9db2d99b9405b03871972ea2998c7059dc4dd920f}"
# docker pull nervos/llvm-n-rust:20260610
DOCKER_IMAGE="${DOCKER_IMAGE:-docker.io/nervos/llvm-n-rust@sha256:c1abd0c0542222b3e6c3e87361636fe2f3e08b9a3126e5bb1df10880aa0f23ca}"
CHECKSUM_FILE_PATH="${CHECKSUM_FILE_PATH:-checksums.txt}"

# We are parsing command line arguments based on tips from:
Expand Down
Loading