You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+24Lines changed: 24 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -171,6 +171,30 @@ make test
171
171
172
172
The templates provided here, use the same conventions as `ckb-native-build-sample` project, so feel free to refer to the more detailed [usage](https://github.com/xxuejie/ckb-native-build-sample?tab=readme-ov-file#usage) doc in the sample project.
173
173
174
+
### Reproducible Build
175
+
176
+
When using this set of templates, we always recommend to use locally installed native versions of LLVM & Rust to build and test your scripts. However, reproducible build is an important part of CKB scripts, which would require locked versions of LLVM & Rust to work, which might not be an easy task when using locally installed versions of compilers.
177
+
178
+
For the time being, we have prepared a script that does reproducible build via [a docker container image](https://github.com/cryptape/llvm-n-rust). We do want to mention that docker is not necessarily THE way to do reproducible build, nor is it the best way to do reproducible build. There might well be other ways that are better, such as chroot or Nix. It's just that historically, docker has been used in CKB script's build process, and adding a script leveraging docker here, provides an easy solution into the issue.
179
+
180
+
To do reproducible build, you can use the included script with varying commands:
181
+
182
+
```
183
+
$ ./scripts/reproducible_build_docker # Clean current repository, used locked LLVM & Rust from a docker container
184
+
# to build all contracts, then test the binaries against a checksum file.
185
+
186
+
$ ./scripts/reproducible_build_docker --update # Update the checksum file with new binaries, could be handy when you have
187
+
# made changes to the binaries.
188
+
189
+
$ ./scripts/reproducible_build_docker --no-clean # Do not clean intermediate files before building, it is not recommended to
190
+
# use this but when you really know what you are doing, it could help you save
191
+
# some time.
192
+
193
+
$ ./scripts/reproducible_build_docker --proxy "..." # Setup docker container so it pulls Rust crates using a proxy server
194
+
```
195
+
196
+
By default, the checksum file is stored in `checksums.txt` in the root of the repository. It is strongly recommended that this file is checked into version control, and a CI is setup so reproducible build is always checked in new commits.
197
+
174
198
### Standalone Contract Crate
175
199
176
200
In rare cases if you want to simply use a standalone contract crate without a workspace. The [standalone-contract](https://github.com/cryptape/ckb-script-templates/tree/main/standalone-contract) template is prepared for you:
0 commit comments