From 3e91ddb17defd97252ff76bfaac8c19c1f0b8d3c Mon Sep 17 00:00:00 2001 From: mohanson Date: Thu, 30 Oct 2025 15:05:37 +0800 Subject: [PATCH 1/7] Update ckb-std and ckb-testtool to v1.0 --- .github/workflows/rust.yml | 14 +++++++------- atomics-contract/Cargo.toml | 4 ++-- c-wrapper-crate/Cargo.toml | 2 +- contract-without-simulator/Cargo.toml | 4 ++-- contract/Cargo.toml | 4 ++-- native-simulator/Cargo.toml | 4 ++-- stack-reorder-contract/Cargo.toml | 4 ++-- standalone-contract/Cargo.toml | 6 +++--- workspace/tests/Cargo.toml | 4 ++-- x64-simulator-crate/Cargo.toml | 8 ++++---- 10 files changed, 27 insertions(+), 27 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index df9c67d..dc8c4bf 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -67,8 +67,8 @@ jobs: steps: - name: Install dependencies run: apt-get update && apt-get -y install curl git build-essential pkg-config libssl-dev lsb-release wget software-properties-common gnupg - - name: Install llvm 18 - run: wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && ./llvm.sh 18 && rm llvm.sh + - name: Install llvm 19 + run: wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && ./llvm.sh 19 && rm llvm.sh - uses: actions-rust-lang/setup-rust-toolchain@v1 with: components: clippy @@ -189,8 +189,8 @@ jobs: - uses: actions/checkout@v3 with: submodules: true - - name: Install llvm 18 - run: brew install llvm@18 + - name: Install llvm 19 + run: brew install llvm@19 - name: Install riscv64 target run: rustup target add riscv64imac-unknown-none-elf - name: Install cargo generate @@ -228,7 +228,7 @@ jobs: shell: pwsh # https://github.com/ScoopInstaller/Install#for-admin # - # Note that on Windows we cannot choose LLVM 18 here, we have to settle on latest stable LLVM + # Note that on Windows we cannot choose LLVM 19 here, we have to settle on latest stable LLVM run: | iex "& {$(irm get.scoop.sh)} -RunAsAdmin" scoop install llvm yasm @@ -272,14 +272,14 @@ jobs: usesh: true prepare: | set -ex - pkg install -y llvm18 git gmake bash + pkg install -y llvm19 git gmake bash curl https://sh.rustup.rs -sSf | sh -s -- -y . $HOME/.cargo/env rustup target add riscv64imac-unknown-none-elf cargo install cargo-generate run: | set -ex - . $HOME/.cargo/env + . $HOME/.cargo/env cargo generate --path . standalone-contract --name test-contract cd test-contract gmake build test check clippy diff --git a/atomics-contract/Cargo.toml b/atomics-contract/Cargo.toml index e2294fc..673a64b 100644 --- a/atomics-contract/Cargo.toml +++ b/atomics-contract/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "{{project-name}}" version = "0.1.0" -edition = "2021" +edition = "2024" [dependencies] -ckb-std = { version = "0.17.0", default-features = false, features = ["allocator", "calc-hash", "ckb-types", "libc"] } +ckb-std = { version = "1.0", default-features = false, features = ["allocator", "calc-hash", "ckb-types", "libc"] } log = { version = "0.4.20", default-features = false } [build-dependencies] diff --git a/c-wrapper-crate/Cargo.toml b/c-wrapper-crate/Cargo.toml index b88099d..65fcf5c 100644 --- a/c-wrapper-crate/Cargo.toml +++ b/c-wrapper-crate/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "{{project-name}}" version = "0.1.0" -edition = "2021" +edition = "2024" [dependencies] diff --git a/contract-without-simulator/Cargo.toml b/contract-without-simulator/Cargo.toml index 7f814e7..7d786c2 100644 --- a/contract-without-simulator/Cargo.toml +++ b/contract-without-simulator/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "{{project-name}}" version = "0.1.0" -edition = "2021" +edition = "2024" [dependencies] -ckb-std = "0.17.0" +ckb-std = "1.0" diff --git a/contract/Cargo.toml b/contract/Cargo.toml index 98f1654..ba79d45 100644 --- a/contract/Cargo.toml +++ b/contract/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "{{project-name}}" version = "0.1.0" -edition = "2021" +edition = "202r" [dependencies] -ckb-std = "0.17.0" +ckb-std = "1.0" [features] library = [] diff --git a/native-simulator/Cargo.toml b/native-simulator/Cargo.toml index e10c02e..203488c 100644 --- a/native-simulator/Cargo.toml +++ b/native-simulator/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "{{project-name}}" version = "0.1.0" -edition = "2021" +edition = "2024" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] {{project-name | append: "@@SIMULATOR_PLACEHOLDER@@" | remove: "-sim@@SIMULATOR_PLACEHOLDER@@"}} = { path = "../../contracts/{{project-name | append: "@@SIMULATOR_PLACEHOLDER@@" | remove: "-sim@@SIMULATOR_PLACEHOLDER@@"}}", features = ["native-simulator"] } -ckb-std = { version = "0.17.0", features = ["native-simulator"] } +ckb-std = { version = "1.0", features = ["native-simulator"] } [lib] crate-type = ["cdylib"] diff --git a/stack-reorder-contract/Cargo.toml b/stack-reorder-contract/Cargo.toml index 84a7ca9..d421a05 100644 --- a/stack-reorder-contract/Cargo.toml +++ b/stack-reorder-contract/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "{{project-name}}" version = "0.1.0" -edition = "2021" +edition = "2024" [dependencies] -ckb-std = "0.17.0" +ckb-std = "1.0" [build-dependencies] cc = "1.0" diff --git a/standalone-contract/Cargo.toml b/standalone-contract/Cargo.toml index eaa8943..ff14c1c 100644 --- a/standalone-contract/Cargo.toml +++ b/standalone-contract/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "{{project-name}}" version = "0.1.0" -edition = "2021" +edition = "2024" [dependencies] -ckb-std = "0.17.0" +ckb-std = "1.0" [dev-dependencies] -ckb-testtool = "0.15.0" +ckb-testtool = "1.0" serde_json = "1.0" diff --git a/workspace/tests/Cargo.toml b/workspace/tests/Cargo.toml index af50018..38cefca 100644 --- a/workspace/tests/Cargo.toml +++ b/workspace/tests/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "tests" version = "0.1.0" -edition = "2021" +edition = "2024" [features] native-simulator = [ "ckb-testtool/native-simulator" ] [dependencies] -ckb-testtool = "0.15.0" +ckb-testtool = "1.0" serde_json = "1.0" diff --git a/x64-simulator-crate/Cargo.toml b/x64-simulator-crate/Cargo.toml index 4208904..f202a77 100644 --- a/x64-simulator-crate/Cargo.toml +++ b/x64-simulator-crate/Cargo.toml @@ -1,18 +1,18 @@ [package] name = "{{project-name}}" version = "0.1.0" -edition = "2021" +edition = "2024" [dependencies] -ckb-std = "0.17.0" +ckb-std = "1.0" # Supporting native tests powered by ckb-x64-simulator [target.'cfg(all(target_arch = "x86_64", unix))'.dependencies.ckb-std] -version = "0.17.0" +version = "1.0" features = ["native-simulator"] [target.'cfg(all(target_arch = "x86_64", unix))'.dev-dependencies] -ckb-testtool = "0.15.0" +ckb-testtool = "1.0" rusty-fork = "0.3.0" rand = "0.8.5" serde_json = "1.0" From 065cdb59c320fc579796b41df93a2911651bb775 Mon Sep 17 00:00:00 2001 From: mohanson Date: Thu, 30 Oct 2025 15:28:14 +0800 Subject: [PATCH 2/7] Fix ci --- contract/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contract/Cargo.toml b/contract/Cargo.toml index ba79d45..2c53492 100644 --- a/contract/Cargo.toml +++ b/contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "{{project-name}}" version = "0.1.0" -edition = "202r" +edition = "2024" [dependencies] ckb-std = "1.0" From 5d5434f7be99fad04086b9d025af142ca8496da2 Mon Sep 17 00:00:00 2001 From: mohanson Date: Thu, 30 Oct 2025 15:34:18 +0800 Subject: [PATCH 3/7] Deprecated method --- atomics-contract/build.rs | 1 - c-wrapper-crate/build.rs | 1 - stack-reorder-contract/build.rs | 1 - 3 files changed, 3 deletions(-) diff --git a/atomics-contract/build.rs b/atomics-contract/build.rs index 37c4423..07beff1 100644 --- a/atomics-contract/build.rs +++ b/atomics-contract/build.rs @@ -15,7 +15,6 @@ fn main() { ); build .file(format!("{top}/deps/lib-dummy-atomics/atomics.c")) - .static_flag(true) .include(format!("{top}/deps/ckb-c-stdlib")) .include(format!("{top}/deps/ckb-c-stdlib/libc")) .no_default_flags(true) diff --git a/c-wrapper-crate/build.rs b/c-wrapper-crate/build.rs index 5a212b6..3f5c8ab 100644 --- a/c-wrapper-crate/build.rs +++ b/c-wrapper-crate/build.rs @@ -15,7 +15,6 @@ fn main() { ); build .file("c.c") - .static_flag(true) .include(format!("{top}/deps/ckb-c-stdlib")) .include(format!("{top}/deps/ckb-c-stdlib/libc")) .no_default_flags(true) diff --git a/stack-reorder-contract/build.rs b/stack-reorder-contract/build.rs index ff6dfc9..fa329a8 100644 --- a/stack-reorder-contract/build.rs +++ b/stack-reorder-contract/build.rs @@ -11,7 +11,6 @@ fn main() { ); build .file("bootloader.S") - .static_flag(true) .no_default_flags(true) .flag("--target=riscv64") .flag("-march=rv64imc_zba_zbb_zbc_zbs") From dd15c77caa098e3804c17ce92af31c6e31759e37 Mon Sep 17 00:00:00 2001 From: mohanson Date: Thu, 30 Oct 2025 15:37:14 +0800 Subject: [PATCH 4/7] software-properties-common is not available in Debian Trixie --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index dc8c4bf..cb9e53c 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -66,7 +66,7 @@ jobs: steps: - name: Install dependencies - run: apt-get update && apt-get -y install curl git build-essential pkg-config libssl-dev lsb-release wget software-properties-common gnupg + run: apt-get update && apt-get -y install curl git build-essential pkg-config libssl-dev lsb-release wget gnupg - name: Install llvm 19 run: wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && ./llvm.sh 19 && rm llvm.sh - uses: actions-rust-lang/setup-rust-toolchain@v1 From d48b971a7aca4192836f06a10ec764600b614f7b Mon Sep 17 00:00:00 2001 From: mohanson Date: Thu, 30 Oct 2025 15:45:18 +0800 Subject: [PATCH 5/7] Fix tests --- atomics-contract/.cargo-generate/tests.rs | 6 +++--- contract-without-simulator/.cargo-generate/tests.rs | 6 +++--- contract/.cargo-generate/tests.rs | 6 +++--- stack-reorder-contract/.cargo-generate/tests.rs | 6 +++--- standalone-contract/src/tests/tests.rs | 6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/atomics-contract/.cargo-generate/tests.rs b/atomics-contract/.cargo-generate/tests.rs index 04a07fd..b763d6b 100644 --- a/atomics-contract/.cargo-generate/tests.rs +++ b/atomics-contract/.cargo-generate/tests.rs @@ -15,7 +15,7 @@ fn test_{{crate_name}}() { // prepare cells let input_out_point = context.create_cell( CellOutput::new_builder() - .capacity(1000u64.pack()) + .capacity(1000) .lock(lock_script.clone()) .build(), Bytes::new(), @@ -25,11 +25,11 @@ fn test_{{crate_name}}() { .build(); let outputs = vec![ CellOutput::new_builder() - .capacity(500u64.pack()) + .capacity(500) .lock(lock_script.clone()) .build(), CellOutput::new_builder() - .capacity(500u64.pack()) + .capacity(500) .lock(lock_script) .build(), ]; diff --git a/contract-without-simulator/.cargo-generate/tests.rs b/contract-without-simulator/.cargo-generate/tests.rs index 04a07fd..b763d6b 100644 --- a/contract-without-simulator/.cargo-generate/tests.rs +++ b/contract-without-simulator/.cargo-generate/tests.rs @@ -15,7 +15,7 @@ fn test_{{crate_name}}() { // prepare cells let input_out_point = context.create_cell( CellOutput::new_builder() - .capacity(1000u64.pack()) + .capacity(1000) .lock(lock_script.clone()) .build(), Bytes::new(), @@ -25,11 +25,11 @@ fn test_{{crate_name}}() { .build(); let outputs = vec![ CellOutput::new_builder() - .capacity(500u64.pack()) + .capacity(500) .lock(lock_script.clone()) .build(), CellOutput::new_builder() - .capacity(500u64.pack()) + .capacity(500) .lock(lock_script) .build(), ]; diff --git a/contract/.cargo-generate/tests.rs b/contract/.cargo-generate/tests.rs index 04a07fd..b763d6b 100644 --- a/contract/.cargo-generate/tests.rs +++ b/contract/.cargo-generate/tests.rs @@ -15,7 +15,7 @@ fn test_{{crate_name}}() { // prepare cells let input_out_point = context.create_cell( CellOutput::new_builder() - .capacity(1000u64.pack()) + .capacity(1000) .lock(lock_script.clone()) .build(), Bytes::new(), @@ -25,11 +25,11 @@ fn test_{{crate_name}}() { .build(); let outputs = vec![ CellOutput::new_builder() - .capacity(500u64.pack()) + .capacity(500) .lock(lock_script.clone()) .build(), CellOutput::new_builder() - .capacity(500u64.pack()) + .capacity(500) .lock(lock_script) .build(), ]; diff --git a/stack-reorder-contract/.cargo-generate/tests.rs b/stack-reorder-contract/.cargo-generate/tests.rs index 04a07fd..b763d6b 100644 --- a/stack-reorder-contract/.cargo-generate/tests.rs +++ b/stack-reorder-contract/.cargo-generate/tests.rs @@ -15,7 +15,7 @@ fn test_{{crate_name}}() { // prepare cells let input_out_point = context.create_cell( CellOutput::new_builder() - .capacity(1000u64.pack()) + .capacity(1000) .lock(lock_script.clone()) .build(), Bytes::new(), @@ -25,11 +25,11 @@ fn test_{{crate_name}}() { .build(); let outputs = vec![ CellOutput::new_builder() - .capacity(500u64.pack()) + .capacity(500) .lock(lock_script.clone()) .build(), CellOutput::new_builder() - .capacity(500u64.pack()) + .capacity(500) .lock(lock_script) .build(), ]; diff --git a/standalone-contract/src/tests/tests.rs b/standalone-contract/src/tests/tests.rs index 45c5e7d..57086da 100644 --- a/standalone-contract/src/tests/tests.rs +++ b/standalone-contract/src/tests/tests.rs @@ -26,7 +26,7 @@ fn test_{{crate_name}}() { // prepare cells let input_out_point = context.create_cell( CellOutput::new_builder() - .capacity(1000u64.pack()) + .capacity(1000) .lock(lock_script.clone()) .build(), Bytes::new(), @@ -36,11 +36,11 @@ fn test_{{crate_name}}() { .build(); let outputs = vec![ CellOutput::new_builder() - .capacity(500u64.pack()) + .capacity(500) .lock(lock_script.clone()) .build(), CellOutput::new_builder() - .capacity(500u64.pack()) + .capacity(500) .lock(lock_script) .build(), ]; From c1aaa9cbcd93e13d6ecaec8552dab626d44b1f8a Mon Sep 17 00:00:00 2001 From: mohanson Date: Thu, 30 Oct 2025 15:50:23 +0800 Subject: [PATCH 6/7] Call to unsafe function --- x64-simulator-crate/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x64-simulator-crate/src/lib.rs b/x64-simulator-crate/src/lib.rs index 367210b..7ce4243 100644 --- a/x64-simulator-crate/src/lib.rs +++ b/x64-simulator-crate/src/lib.rs @@ -58,7 +58,7 @@ mod tests { let mut file = tempfile::NamedTempFile::new().expect("tempfile"); file.write_all(json.as_ref()).expect("write"); file.flush().expect("flush"); - std::env::set_var("CKB_TX_FILE", file.path()); + unsafe { std::env::set_var("CKB_TX_FILE", file.path()); } file }; From 7f24cb8f7acae6564c5226f5489ae7e0ab5f5a36 Mon Sep 17 00:00:00 2001 From: mohanson Date: Thu, 30 Oct 2025 16:19:39 +0800 Subject: [PATCH 7/7] Support llvm-20, llvm-21 in find_clang --- standalone-contract/scripts/find_clang | 4 +++- workspace/scripts/find_clang | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/standalone-contract/scripts/find_clang b/standalone-contract/scripts/find_clang index e62a84e..8035213 100755 --- a/standalone-contract/scripts/find_clang +++ b/standalone-contract/scripts/find_clang @@ -12,13 +12,15 @@ fi # at the end. SEARCH_TARGET="${SEARCH_TARGET:-llvm-strip}" -CANDIDATES=("${SEARCH_TARGET}" "${SEARCH_TARGET}-19" "${SEARCH_TARGET}-18" "${SEARCH_TARGET}-17" "${SEARCH_TARGET}-16") +CANDIDATES=("${SEARCH_TARGET}" "${SEARCH_TARGET}-19" "${SEARCH_TARGET}-20" "${SEARCH_TARGET}-21" "${SEARCH_TARGET}-18" "${SEARCH_TARGET}-17" "${SEARCH_TARGET}-16") BREW_PREFIX=$(brew --prefix 2> /dev/null) if [[ -n "${BREW_PREFIX}" ]]; then CANDIDATES+=( "${BREW_PREFIX}/opt/llvm/bin/${SEARCH_TARGET}" "${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}" diff --git a/workspace/scripts/find_clang b/workspace/scripts/find_clang index e62a84e..8035213 100755 --- a/workspace/scripts/find_clang +++ b/workspace/scripts/find_clang @@ -12,13 +12,15 @@ fi # at the end. SEARCH_TARGET="${SEARCH_TARGET:-llvm-strip}" -CANDIDATES=("${SEARCH_TARGET}" "${SEARCH_TARGET}-19" "${SEARCH_TARGET}-18" "${SEARCH_TARGET}-17" "${SEARCH_TARGET}-16") +CANDIDATES=("${SEARCH_TARGET}" "${SEARCH_TARGET}-19" "${SEARCH_TARGET}-20" "${SEARCH_TARGET}-21" "${SEARCH_TARGET}-18" "${SEARCH_TARGET}-17" "${SEARCH_TARGET}-16") BREW_PREFIX=$(brew --prefix 2> /dev/null) if [[ -n "${BREW_PREFIX}" ]]; then CANDIDATES+=( "${BREW_PREFIX}/opt/llvm/bin/${SEARCH_TARGET}" "${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}"