File tree Expand file tree Collapse file tree 7 files changed +29
-18
lines changed
Expand file tree Collapse file tree 7 files changed +29
-18
lines changed Original file line number Diff line number Diff line change 7373 git clone https://github.com/Chia-Network/clvm_tools.git --branch=main --single-branch
7474 python -m pip install ./clvm_tools
7575 python -m pip install colorama
76- maturin develop --release
76+ maturin develop --release --cargo-extra-args="--features=openssl"
7777
7878 - name : Run benchmarks
7979 if : ${{ !startsWith(matrix.os, 'windows') }}
@@ -119,7 +119,7 @@ jobs:
119119 git clone https://github.com/Chia-Network/clvm_tools.git --branch=main --single-branch
120120 python -m pip install ./clvm_tools
121121 python -m pip install colorama
122- maturin develop --release
122+ maturin develop --release --cargo-extra-args="--features=openssl"
123123
124124 - name : Run cost checks
125125 run : |
Original file line number Diff line number Diff line change 5252 if [ ! -f "activate" ]; then ln -s venv/bin/activate; fi && \
5353 . ./activate && \
5454 pip install maturin && \
55- CC=gcc maturin build --no-sdist --release --strip --manylinux 2014 \
55+ CC=gcc maturin build --no-sdist --release --strip --manylinux 2014 --cargo-extra-args="--features=openssl" \
5656 '
5757
5858 - name : Upload artifacts
Original file line number Diff line number Diff line change 4343 . ./venv/bin/activate
4444 export PATH=~/.cargo/bin:$PATH
4545 arch -arm64 pip install maturin
46- arch -arm64 maturin build --no-sdist -i python --release --strip
46+ arch -arm64 maturin build --no-sdist -i python --release --strip --cargo-extra-args="--features=openssl"
4747
4848 - name : Install clvm_rs wheel
4949 run : |
Original file line number Diff line number Diff line change 5050 python -m venv venv
5151 ln -s venv/bin/activate
5252 . ./activate
53- maturin build --no-sdist -i python --release --strip
53+ maturin build --no-sdist -i python --release --strip --cargo-extra-args="--features=openssl"
5454
5555# - name: Build Linux with maturin on Python ${{ matrix.python }}
5656# if: startsWith(matrix.os, 'ubuntu')
8686 . ./activate && \
8787 pip install --upgrade pip && \
8888 pip install maturin && \
89- CC=gcc maturin build --no-sdist --release --strip --manylinux 2010 \
89+ CC=gcc maturin build --no-sdist --release --strip --manylinux 2010 --cargo-extra-args="--features=openssl" \
9090 '
9191
9292 - name : Build Windows with maturin on Python ${{ matrix.python }}
Original file line number Diff line number Diff line change @@ -27,11 +27,8 @@ num-bigint = "=0.4.0"
2727num-traits = " =0.2.14"
2828num-integer = " =0.1.44"
2929bls12_381 = " =0.5.0"
30-
3130sha2 = " =0.9.5"
32-
33- [target .'cfg(unix)' .dependencies ]
34- openssl = { version = " 0.10.35" , features = [" vendored" ] }
31+ openssl = { version = " 0.10.35" , features = [" vendored" ], optional = true }
3532
3633[target .'cfg(target_family="wasm")' .dependencies ]
3734wasm-bindgen = " =0.2.75"
Original file line number Diff line number Diff line change @@ -15,12 +15,26 @@ Build `clvm_rs` directly into the current virtualenv with
1515$ maturin develop --release
1616```
1717
18+ On UNIX-based platforms, you may get a speed boost on ` sha256 ` operations by building
19+ with OpenSSL.
20+
21+ ```
22+ $ maturin develop --release --cargo-extra-args="--features=openssl"
23+ ```
24+
25+
1826To build the wheel, do
1927
2028```
2129$ maturin build --release --no-sdist
2230````
2331
32+ or
33+
34+ ```
35+ $ maturin build --release --no-sdist --cargo-extra-args="--features=openssl"
36+ ```
37+
2438
2539WASM
2640----
@@ -34,7 +48,7 @@ $ cargo install wasm-pack
3448Then build with
3549
3650```
37- $ wasm-pack build --release
51+ $ wasm-pack build --release
3852```
3953
4054
Original file line number Diff line number Diff line change 1- #[ cfg( not( unix ) ) ]
1+ #[ cfg( not( openssl ) ) ]
22use sha2:: { Digest , Sha256 as Ctx } ;
33
4- #[ cfg( unix ) ]
4+ #[ cfg( openssl ) ]
55use openssl:: sha;
66
77// WINDOWS PART
88
9- #[ cfg( not( unix ) ) ]
9+ #[ cfg( not( openssl ) ) ]
1010#[ derive( Clone ) ]
1111pub struct Sha256 {
1212 ctx : Ctx ,
1313}
1414
15- #[ cfg( not( unix ) ) ]
15+ #[ cfg( not( openssl ) ) ]
1616impl Sha256 {
1717 pub fn new ( ) -> Sha256 {
1818 Sha256 { ctx : Ctx :: new ( ) }
@@ -25,15 +25,15 @@ impl Sha256 {
2525 }
2626}
2727
28- // UNIX PART
28+ // OPENSSL PART
2929
30- #[ cfg( unix ) ]
30+ #[ cfg( openssl ) ]
3131#[ derive( Clone ) ]
3232pub struct Sha256 {
3333 ctx : sha:: Sha256 ,
3434}
3535
36- #[ cfg( unix ) ]
36+ #[ cfg( openssl ) ]
3737impl Sha256 {
3838 pub fn new ( ) -> Sha256 {
3939 Sha256 {
You can’t perform that action at this time.
0 commit comments