Skip to content

Commit 76a576e

Browse files
committed
Split sphincsplus_rust_test
* Sphincs sign and verify move to tools/ckb-sphincs-utils * The code of test contract is left in sphincsplus_rust_test
1 parent 548c6c0 commit 76a576e

File tree

16 files changed

+101
-49
lines changed

16 files changed

+101
-49
lines changed

.github/workflows/rust.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ jobs:
1515
run: ./tests/sphincsplus/all_run.sh
1616
- name: Run sphincs+ rust tests
1717
run: ./tests/sphincsplus_rust/run_rust.sh
18+
- name: Run Tools tests
19+
run: cd tools/ckb-sphincs-tools && cargo test

tests/sphincsplus_rust/Cargo.lock

Lines changed: 8 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/sphincsplus_rust/Cargo.toml

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,23 @@ version = "0.1.0"
77

88
[features]
99
default = ["shake", "hash_128", "hash_options_f", "thashes_simple"]
10-
haraka = []
11-
sha2 = []
12-
shake = []
10+
haraka = ["ckb_sphincs_utils/haraka"]
11+
sha2 = ["ckb_sphincs_utils/sha2"]
12+
shake = ["ckb_sphincs_utils/shake"]
1313

14-
hash_128 = []
15-
hash_192 = []
16-
hash_256 = []
14+
hash_128 = ["ckb_sphincs_utils/hash_128"]
15+
hash_192 = ["ckb_sphincs_utils/hash_192"]
16+
hash_256 = ["ckb_sphincs_utils/hash_256"]
1717

18-
hash_options_f = []
19-
hash_options_s = []
18+
hash_options_f = ["ckb_sphincs_utils/hash_options_f"]
19+
hash_options_s = ["ckb_sphincs_utils/hash_options_s"]
20+
21+
thashes_robust = ["ckb_sphincs_utils/thashes_robust"]
22+
thashes_simple = ["ckb_sphincs_utils/thashes_simple"]
2023

21-
thashes_robust = []
22-
thashes_simple = []
2324

2425
[dependencies]
26+
ckb_sphincs_utils = { path = "../../tools/ckb-sphincs-utils", default-features = false }
2527
ckb-chain-spec = "0.107.0"
2628
ckb-hash = "0.107.0"
2729
ckb-script = "0.107.0"
@@ -31,6 +33,3 @@ lazy_static = "1.4.0"
3133
libc = "0.2.139"
3234
num_enum = "0.5.10"
3335
rand = "0.8.5"
34-
35-
[build-dependencies]
36-
cc = "1.0.79"

tests/sphincsplus_rust/src/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
11
pub mod dummy_data_loader;
2-
pub mod sphincsplus;
32
pub mod utils;
4-
5-
pub use sphincsplus::SphincsPlus;

tests/sphincsplus_rust/src/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use super::dummy_data_loader::DummyDataLoader;
2-
use super::sphincsplus::*;
2+
use ckb_sphincs_utils::sphincsplus::*;
33
use ckb_hash::blake2b_256;
44
use ckb_types::core::{
55
cell::{CellMetaBuilder, ResolvedTransaction},

tools/ckb-sphincs-tools/Cargo.lock

Lines changed: 17 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tools/ckb-sphincs-tools/Cargo.toml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ version = "0.1.0"
77

88
[features]
99
default = ["shake", "hash_128", "hash_options_f", "thashes_simple"]
10-
haraka = ["sphincsplus_rust_test/haraka"]
11-
sha2 = ["sphincsplus_rust_test/sha2"]
12-
shake = ["sphincsplus_rust_test/shake"]
10+
haraka = ["ckb_sphincs_utils/haraka"]
11+
sha2 = ["ckb_sphincs_utils/sha2"]
12+
shake = ["ckb_sphincs_utils/shake"]
1313

14-
hash_128 = ["sphincsplus_rust_test/hash_128"]
15-
hash_192 = ["sphincsplus_rust_test/hash_192"]
16-
hash_256 = ["sphincsplus_rust_test/hash_256"]
14+
hash_128 = ["ckb_sphincs_utils/hash_128"]
15+
hash_192 = ["ckb_sphincs_utils/hash_192"]
16+
hash_256 = ["ckb_sphincs_utils/hash_256"]
1717

18-
hash_options_f = ["sphincsplus_rust_test/hash_options_f"]
19-
hash_options_s = ["sphincsplus_rust_test/hash_options_s"]
18+
hash_options_f = ["ckb_sphincs_utils/hash_options_f"]
19+
hash_options_s = ["ckb_sphincs_utils/hash_options_s"]
2020

21-
thashes_robust = ["sphincsplus_rust_test/thashes_robust"]
22-
thashes_simple = ["sphincsplus_rust_test/thashes_simple"]
21+
thashes_robust = ["ckb_sphincs_utils/thashes_robust"]
22+
thashes_simple = ["ckb_sphincs_utils/thashes_simple"]
2323

2424
[dependencies]
2525
ckb-crypto = "0.106.0"
@@ -30,4 +30,4 @@ ckb-types = "0.106.0"
3030
clap = {version = "4.1.7", features = ["derive"]}
3131
lazy_static = "1.4.0"
3232
serde_json = "1.0.93"
33-
sphincsplus_rust_test = {path = "../../tests/sphincsplus_rust", default-features = false}
33+
ckb_sphincs_utils = {path = "../ckb-sphincs-utils", default-features = false}

tools/ckb-sphincs-tools/src/sub_conversion.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use ckb_types::{
1414
H256,
1515
};
1616
use lazy_static::lazy_static;
17-
use sphincsplus_rust_test::SphincsPlus;
17+
use ckb_sphincs_utils::SphincsPlus;
1818

1919
lazy_static! {
2020
pub static ref SPHINCSPLUS_EXAMPLE_BIN: Bytes =

tools/ckb-sphincs-tools/src/sub_gen_key.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use serde_json::{from_str, Value};
2-
use sphincsplus_rust_test::SphincsPlus;
2+
use ckb_sphincs_utils::SphincsPlus;
33
use std::path::PathBuf;
44

55
pub fn subcmd_gen_key(key_file: PathBuf) {

tools/ckb-sphincs-tools/src/sub_sign.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use ckb_types::H256;
2-
use sphincsplus_rust_test::SphincsPlus;
2+
use ckb_sphincs_utils::SphincsPlus;
33

44
pub fn sub_sign(key: SphincsPlus, message: H256) {
55
let sign = key.sign(message.as_bytes());

0 commit comments

Comments
 (0)