Skip to content
Snippets Groups Projects
Commit 415088fc authored by Éloïs's avatar Éloïs
Browse files

[ref] whole: split crate documents: create new crate dubp-common-doc

parent 57c4a485
Branches
Tags
1 merge request!194Elois/indexs
Showing
with 614 additions and 104 deletions
......@@ -289,15 +289,46 @@ dependencies = [
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "dubp-common-doc"
version = "0.1.0"
dependencies = [
"dup-crypto 0.7.0",
"durs-common-tools 0.2.0",
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"json-pest-parser 0.2.0",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"pest 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"pest_derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.86 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.86 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)",
"shrinkwraprs 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"unwrap 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "dubp-currency-params"
version = "0.2.0"
dependencies = [
"bincode 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"dubp-common-doc 0.1.0",
"durs-common-tools 0.2.0",
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.86 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "dubp-documents"
version = "0.13.0"
version = "0.14.0"
dependencies = [
"dup-crypto 0.6.0",
"dup-currency-params 0.1.0",
"durs-common-tools 0.1.0",
"dubp-common-doc 0.1.0",
"dubp-currency-params 0.2.0",
"dup-crypto 0.7.0",
"durs-common-tools 0.2.0",
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"json-pest-parser 0.1.0",
"json-pest-parser 0.2.0",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"pest 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"pest_derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
......@@ -312,10 +343,11 @@ dependencies = [
name = "dubp-documents-tests-tools"
version = "0.1.0"
dependencies = [
"dubp-documents 0.13.0",
"dup-crypto 0.6.0",
"dubp-common-doc 0.1.0",
"dubp-currency-params 0.2.0",
"dubp-documents 0.14.0",
"dup-crypto 0.7.0",
"dup-crypto-tests-tools 0.1.0",
"dup-currency-params 0.1.0",
]
[[package]]
......@@ -335,12 +367,12 @@ dependencies = [
[[package]]
name = "dup-crypto"
version = "0.6.0"
version = "0.7.0"
dependencies = [
"base58 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"bincode 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"durs-common-tools 0.1.0",
"durs-common-tools 0.2.0",
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
......@@ -354,17 +386,7 @@ dependencies = [
name = "dup-crypto-tests-tools"
version = "0.1.0"
dependencies = [
"dup-crypto 0.6.0",
]
[[package]]
name = "dup-currency-params"
version = "0.1.0"
dependencies = [
"bincode 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"durs-common-tools 0.1.0",
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.86 (registry+https://github.com/rust-lang/crates.io-index)",
"dup-crypto 0.7.0",
]
[[package]]
......@@ -372,13 +394,14 @@ name = "durs-blockchain"
version = "0.2.0-a"
dependencies = [
"dirs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"dubp-documents 0.13.0",
"dubp-common-doc 0.1.0",
"dubp-currency-params 0.2.0",
"dubp-documents 0.14.0",
"dubp-documents-tests-tools 0.1.0",
"dup-crypto 0.6.0",
"dup-crypto 0.7.0",
"dup-crypto-tests-tools 0.1.0",
"dup-currency-params 0.1.0",
"durs-blockchain-dal 0.2.0-a",
"durs-common-tools 0.1.0",
"durs-common-tools 0.2.0",
"durs-conf 0.2.0-a",
"durs-message 0.2.0-a",
"durs-module 0.2.0-a",
......@@ -386,7 +409,7 @@ dependencies = [
"durs-network-documents 0.4.0",
"durs-wot 0.8.0-a0.9",
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"json-pest-parser 0.1.0",
"json-pest-parser 0.2.0",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
"pbr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
......@@ -401,13 +424,14 @@ dependencies = [
name = "durs-blockchain-dal"
version = "0.2.0-a"
dependencies = [
"dubp-documents 0.13.0",
"dubp-common-doc 0.1.0",
"dubp-currency-params 0.2.0",
"dubp-documents 0.14.0",
"dubp-documents-tests-tools 0.1.0",
"dup-crypto 0.6.0",
"dup-crypto 0.7.0",
"dup-crypto-tests-tools 0.1.0",
"dup-currency-params 0.1.0",
"durs-common-tests-tools 0.1.0",
"durs-common-tools 0.1.0",
"durs-common-tools 0.2.0",
"durs-conf 0.2.0-a",
"durs-module 0.2.0-a",
"durs-wot 0.8.0-a0.9",
......@@ -431,7 +455,7 @@ dependencies = [
[[package]]
name = "durs-common-tools"
version = "0.1.0"
version = "0.2.0"
dependencies = [
"pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
......@@ -441,10 +465,10 @@ name = "durs-conf"
version = "0.2.0-a"
dependencies = [
"dirs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"dubp-documents 0.13.0",
"dup-crypto 0.6.0",
"dup-currency-params 0.1.0",
"durs-common-tools 0.1.0",
"dubp-currency-params 0.2.0",
"dubp-documents 0.14.0",
"dup-crypto 0.7.0",
"durs-common-tools 0.2.0",
"durs-module 0.2.0-a",
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
......@@ -460,10 +484,10 @@ name = "durs-core"
version = "0.2.0-a"
dependencies = [
"dirs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"dup-crypto 0.6.0",
"dup-currency-params 0.1.0",
"dubp-currency-params 0.2.0",
"dup-crypto 0.7.0",
"durs-blockchain 0.2.0-a",
"durs-common-tools 0.1.0",
"durs-common-tools 0.2.0",
"durs-conf 0.2.0-a",
"durs-message 0.2.0-a",
"durs-module 0.2.0-a",
......@@ -484,9 +508,10 @@ dependencies = [
name = "durs-message"
version = "0.2.0-a"
dependencies = [
"dubp-documents 0.13.0",
"dup-crypto 0.6.0",
"dup-currency-params 0.1.0",
"dubp-common-doc 0.1.0",
"dubp-currency-params 0.2.0",
"dubp-documents 0.14.0",
"dup-crypto 0.7.0",
"durs-blockchain-dal 0.2.0-a",
"durs-module 0.2.0-a",
"durs-network 0.2.0-a",
......@@ -500,10 +525,10 @@ dependencies = [
name = "durs-module"
version = "0.2.0-a"
dependencies = [
"dubp-documents 0.13.0",
"dup-crypto 0.6.0",
"dup-currency-params 0.1.0",
"durs-common-tools 0.1.0",
"dubp-currency-params 0.2.0",
"dubp-documents 0.14.0",
"dup-crypto 0.7.0",
"durs-common-tools 0.2.0",
"durs-network-documents 0.4.0",
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
......@@ -517,9 +542,10 @@ dependencies = [
name = "durs-network"
version = "0.2.0-a"
dependencies = [
"dubp-documents 0.13.0",
"dup-crypto 0.6.0",
"durs-common-tools 0.1.0",
"dubp-common-doc 0.1.0",
"dubp-documents 0.14.0",
"dup-crypto 0.7.0",
"durs-common-tools 0.2.0",
"durs-module 0.2.0-a",
"durs-network-documents 0.4.0",
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
......@@ -535,10 +561,11 @@ version = "0.4.0"
dependencies = [
"base58 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bincode 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"dubp-documents 0.13.0",
"dup-crypto 0.6.0",
"dup-currency-params 0.1.0",
"durs-common-tools 0.1.0",
"dubp-common-doc 0.1.0",
"dubp-currency-params 0.2.0",
"dubp-documents 0.14.0",
"dup-crypto 0.7.0",
"durs-common-tools 0.2.0",
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
......@@ -556,10 +583,10 @@ dependencies = [
name = "durs-skeleton"
version = "0.1.0"
dependencies = [
"dubp-documents 0.13.0",
"dup-crypto 0.6.0",
"dup-currency-params 0.1.0",
"durs-common-tools 0.1.0",
"dubp-currency-params 0.2.0",
"dubp-documents 0.14.0",
"dup-crypto 0.7.0",
"durs-common-tools 0.2.0",
"durs-conf 0.2.0-a",
"durs-message 0.2.0-a",
"durs-module 0.2.0-a",
......@@ -576,10 +603,10 @@ dependencies = [
name = "durs-tui"
version = "0.2.0-a"
dependencies = [
"dubp-documents 0.13.0",
"dup-crypto 0.6.0",
"dup-currency-params 0.1.0",
"durs-common-tools 0.1.0",
"dubp-currency-params 0.2.0",
"dubp-documents 0.14.0",
"dup-crypto 0.7.0",
"durs-common-tools 0.2.0",
"durs-conf 0.2.0-a",
"durs-message 0.2.0-a",
"durs-module 0.2.0-a",
......@@ -600,7 +627,7 @@ version = "0.8.0-a0.9"
dependencies = [
"bincode 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
"durs-common-tools 0.1.0",
"durs-common-tools 0.2.0",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.86 (registry+https://github.com/rust-lang/crates.io-index)",
......@@ -612,11 +639,12 @@ name = "durs-ws2p"
version = "0.2.0-a"
dependencies = [
"bincode 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"dubp-documents 0.13.0",
"dup-crypto 0.6.0",
"dup-currency-params 0.1.0",
"dubp-common-doc 0.1.0",
"dubp-currency-params 0.2.0",
"dubp-documents 0.14.0",
"dup-crypto 0.7.0",
"durs-common-tests-tools 0.1.0",
"durs-common-tools 0.1.0",
"durs-common-tools 0.2.0",
"durs-conf 0.2.0-a",
"durs-message 0.2.0-a",
"durs-module 0.2.0-a",
......@@ -640,10 +668,11 @@ version = "0.2.0-a"
dependencies = [
"bincode 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
"dubp-documents 0.13.0",
"dup-crypto 0.6.0",
"dup-currency-params 0.1.0",
"durs-common-tools 0.1.0",
"dubp-common-doc 0.1.0",
"dubp-currency-params 0.2.0",
"dubp-documents 0.14.0",
"dup-crypto 0.7.0",
"durs-common-tools 0.2.0",
"durs-network-documents 0.4.0",
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
......@@ -657,10 +686,11 @@ dependencies = [
name = "durs-ws2p-protocol"
version = "0.2.0-a"
dependencies = [
"dubp-documents 0.13.0",
"dup-crypto 0.6.0",
"dup-currency-params 0.1.0",
"durs-common-tools 0.1.0",
"dubp-common-doc 0.1.0",
"dubp-currency-params 0.2.0",
"dubp-documents 0.14.0",
"dup-crypto 0.7.0",
"durs-common-tools 0.2.0",
"durs-module 0.2.0-a",
"durs-network-documents 0.4.0",
"durs-ws2p-messages 0.2.0-a",
......@@ -678,10 +708,11 @@ version = "0.2.0-a"
dependencies = [
"bincode 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
"dubp-documents 0.13.0",
"dup-crypto 0.6.0",
"dup-currency-params 0.1.0",
"durs-common-tools 0.1.0",
"dubp-common-doc 0.1.0",
"dubp-currency-params 0.2.0",
"dubp-documents 0.14.0",
"dup-crypto 0.7.0",
"durs-common-tools 0.2.0",
"durs-conf 0.2.0-a",
"durs-message 0.2.0-a",
"durs-module 0.2.0-a",
......@@ -854,6 +885,14 @@ dependencies = [
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "itertools"
version = "0.7.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "itoa"
version = "0.4.3"
......@@ -861,7 +900,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "json-pest-parser"
version = "0.1.0"
version = "0.2.0"
dependencies = [
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"pest 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
......@@ -1120,6 +1159,14 @@ dependencies = [
"difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "proc-macro2"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "proc-macro2"
version = "0.4.27"
......@@ -1128,6 +1175,14 @@ dependencies = [
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "quote"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "quote"
version = "0.6.11"
......@@ -1484,6 +1539,17 @@ dependencies = [
"cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "shrinkwraprs"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"itertools 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.12.15 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "simplelog"
version = "0.5.3"
......@@ -1537,6 +1603,16 @@ dependencies = [
"syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "syn"
version = "0.12.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "syn"
version = "0.15.26"
......@@ -1868,6 +1944,7 @@ dependencies = [
"checksum id_tree 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0c265a4e397174ac4e22b5e923ad2905858aa5f1512e3b5b4942ee4ff56d146f"
"checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e"
"checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08"
"checksum itertools 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0d47946d458e94a1b7bcabbf6521ea7c037062c81f534615abcad76e84d4970d"
"checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b"
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
"checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1"
......@@ -1900,7 +1977,9 @@ dependencies = [
"checksum pest_meta 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f5a3492a4ed208ffc247adcdcc7ba2a95be3104f58877d0d02f0df39bf3efb5e"
"checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c"
"checksum pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a029430f0d744bc3d15dd474d591bed2402b645d024583082b9f63bb936dac6"
"checksum proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cd07deb3c6d1d9ff827999c7f9b04cdfd66b1b17ae508e14fe47b620f2282ae0"
"checksum proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)" = "4d317f9caece796be1980837fd5cb3dfec5613ebdb04ad0956deea83ce168915"
"checksum quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1eca14c727ad12702eb4b6bfb5a232287dcf8385cb8ca83a3eeaf6519c44c408"
"checksum quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "cdd8e04bd9c52e0342b406469d494fcb033be4bdbe5c606016defbb1681411e1"
"checksum rand 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)" = "64ac302d8f83c0c1974bf758f6b041c6c8ada916fbb44a609158ca8b064cc76c"
"checksum rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293"
......@@ -1940,6 +2019,7 @@ dependencies = [
"checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d"
"checksum sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b4d8bfd0e469f417657573d8451fb33d16cfe0989359b93baf3a1ffc639543d"
"checksum sha2-asm 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8aba8afb8bba3f5d433ede1d036c46e122a7b75a67c92a6b7b5f11d87e2e4478"
"checksum shrinkwraprs 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7d5f047b90b2ca2d1526ff73d67cba61f86f4cf9a8afddc99dd96702ded8e684"
"checksum simplelog 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e95345f185d5adeb8ec93459d2dc99654e294cc6ccf5b75414d8ea262de9a13"
"checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
"checksum smallvec 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "88aea073965ab29f6edb5493faf96ad662fb18aa9eeb186a3b7057951605ed15"
......@@ -1947,6 +2027,7 @@ dependencies = [
"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550"
"checksum structopt 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "670ad348dc73012fcf78c71f06f9d942232cdd4c859d4b6975e27836c3efc0c3"
"checksum structopt-derive 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "ef98172b1a00b0bec738508d3726540edcbd186d50dfd326f2b1febbb3559f04"
"checksum syn 0.12.15 (registry+https://github.com/rust-lang/crates.io-index)" = "c97c05b8ebc34ddd6b967994d5c6e9852fa92f8b82b3858c39451f97346dcce5"
"checksum syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)" = "f92e629aa1d9c827b2bb8297046c1ccffc57c99b947a680d3ccff1f136a3bee9"
"checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015"
"checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8"
......
......@@ -7,6 +7,7 @@ members = [
"lib/core/module",
"lib/core/network",
"lib/crypto",
"lib/dubp/common-doc",
"lib/dubp/currency-params",
"lib/dubp/documents",
"lib/dubp/wot",
......
......@@ -10,9 +10,10 @@ edition = "2018"
path = "src/lib.rs"
[dependencies]
dup-crypto = { path = "../../crypto" }
dubp-common-doc = { path = "../../dubp/common-doc"} #, version = "0.1.0" }
dubp-currency-params = { path = "../../dubp/currency-params" }
dubp-documents= { path = "../../dubp/documents" }
dup-crypto = { path = "../../crypto" }
durs-module = { path = "../module" }
durs-network = { path = "../network" }
durs-blockchain-dal = { path = "../../modules/blockchain/blockchain-dal" }
......
......@@ -14,9 +14,9 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
use crate::*;
use dubp_common_doc::Blockstamp;
use dubp_documents::documents::block::BlockDocument;
use dubp_documents::documents::UserDocumentDUBP;
use dubp_documents::Blockstamp;
use durs_network::events::NetworkEvent;
/// The DURS event message.
......
......@@ -14,7 +14,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
use crate::*;
use dubp_documents::BlockNumber;
use dubp_common_doc::BlockNumber;
use dup_crypto::hashs::Hash;
use dup_crypto::keys::*;
use durs_blockchain_dal::filters::identities::IdentitiesFilter;
......
......@@ -13,13 +13,13 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
use dubp_common_doc::BlockNumber;
use dubp_common_doc::Blockstamp;
use dubp_documents::documents::block::BlockDocument;
use dubp_documents::documents::certification::CertificationDocument;
use dubp_documents::documents::identity::IdentityDocument;
use dubp_documents::documents::membership::MembershipDocument;
use dubp_documents::documents::revocation::RevocationDocumentV10;
use dubp_documents::BlockNumber;
use dubp_documents::Blockstamp;
use dup_crypto::hashs::Hash;
use dup_crypto::keys::*;
use durs_module::ModuleReqId;
......
......@@ -10,9 +10,10 @@ edition = "2018"
path = "lib.rs"
[dependencies]
durs-common-tools = { path = "../../tools/common-tools" }
dup-crypto = { path = "../../crypto" }
dubp-common-doc = { path = "../../dubp/common-doc"} #, version = "0.1.0" }
dubp-documents= { path = "../../dubp/documents" }
dup-crypto = { path = "../../crypto" }
durs-common-tools = { path = "../../tools/common-tools" }
durs-module = { path = "../module" }
durs-network-documents = { path = "../../dunp/network-documents" }
failure = "0.1.5"
......
......@@ -18,9 +18,9 @@
use crate::network_head::NetworkHead;
use crate::network_peer::PeerCard;
use crate::NodeFullId;
use dubp_common_doc::blockstamp::Blockstamp;
use dubp_documents::documents::block::BlockDocument;
use dubp_documents::documents::UserDocumentDUBP;
use dubp_documents::Blockstamp;
use durs_common_tools::Percent;
#[derive(Debug, Clone)]
......
......@@ -16,9 +16,9 @@
//! Defined network requests.
use crate::*;
use dubp_common_doc::blockstamp::Blockstamp;
use dubp_documents::documents::block::BlockDocument;
use dubp_documents::documents::UserDocumentDUBP;
use dubp_documents::Blockstamp;
#[derive(Debug, Copy, Clone)]
/// Type containing a request addressed to the network module
......
[package]
name = "dubp-common-doc"
version = "0.1.0"
authors = ["elois <elois@ifee.fr>"]
description = "Provide common tools for DUBP (DUniter Blockhain Protocol)."
repository = "https://git.duniter.org/nodes/rust/duniter-rs"
readme = "README.md"
keywords = ["duniter", "dunitrust", "blockchain", "cryptocurrency"]
license = "AGPL-3.0"
edition = "2018"
[lib]
path = "src/lib.rs"
[dependencies]
dup-crypto = { path = "../../crypto", version = "0.7.0" }
durs-common-tools = { path = "../../tools/common-tools", version = "0.2.0" }
failure = "0.1.5"
json-pest-parser = { path = "../../tools/json-pest-parser", version = "0.2.0" }
pest = "2.1.0"
pest_derive = "2.1.0"
serde = "1.0.*"
serde_derive = "1.0.*"
serde_json = "1.0.*"
shrinkwraprs = "0.2.*"
log = "0.4.*"
unwrap = "1.2.1"
[dev-dependencies]
pretty_assertions = "0.5.1"
[features]
\ No newline at end of file
# DUBP common doc
`dubp-common-doc` is a crate provide common tools To handle [DUBP](dubp-latest-rfc) documents.
[dubp-latest-rfc]: https://git.duniter.org/nodes/common/doc/blob/master/rfc/0009_Duniter_Blockchain_Protocol_V11.md
## How to use it
You can add `dubp-common-doc` as a `cargo` dependency in your Rust project.
......@@ -15,11 +15,17 @@
//! Wrapper for blockstamp
use crate::*;
/// Type of errors for [`BlockUId`] parsing.
use crate::{BlockHash, BlockNumber};
use dup_crypto::bases::BaseConvertionError;
use dup_crypto::hashs::Hash;
use failure::Fail;
use serde::{Deserialize, Serialize};
use std::cmp::Ordering;
use std::fmt::{Debug, Display, Error, Formatter};
/// Type of errors for [`Blockstamp`] parsing.
///
/// [`BlockUId`]: struct.BlockUId.html
/// [`Blockstamp`]: struct.Blockstamp.html
#[derive(Debug, Copy, Clone, PartialEq, Eq, Fail)]
pub enum BlockstampParseError {
/// Given string have invalid format
......@@ -30,7 +36,13 @@ pub enum BlockstampParseError {
InvalidBlockNumber(),
/// [`BlockHash`](struct.BlockHash.html) part is not a valid hex number.
#[fail(display = "BlockHash part is not a valid hex number.")]
InvalidBlockHash(),
InvalidBlockHash(BaseConvertionError),
}
impl From<BaseConvertionError> for BlockstampParseError {
fn from(e: BaseConvertionError) -> Self {
BlockstampParseError::InvalidBlockHash(e)
}
}
/// A blockstamp (Unique ID).
......@@ -105,17 +117,17 @@ pub enum ReadBytesBlockstampError {
/// Bytes vector is too long
TooLong(),
/// IoError
IoError(::std::io::Error),
IoError(std::io::Error),
}
impl From<::std::io::Error> for ReadBytesBlockstampError {
fn from(e: ::std::io::Error) -> Self {
impl From<std::io::Error> for ReadBytesBlockstampError {
fn from(e: std::io::Error) -> Self {
ReadBytesBlockstampError::IoError(e)
}
}
impl Blockstamp {
/// Create a `BlockUId` from a text.
/// Create a `Blockstamp` from a text.
pub fn from_string(src: &str) -> Result<Blockstamp, BlockstampParseError> {
let mut split = src.split('-');
......@@ -123,18 +135,14 @@ impl Blockstamp {
Err(BlockstampParseError::InvalidFormat())
} else {
let id = split.next().unwrap().parse::<u32>();
let hash = Hash::from_hex(split.next().unwrap());
let hash = Hash::from_hex(split.next().unwrap())?;
if id.is_err() {
Err(BlockstampParseError::InvalidBlockNumber())
} else if hash.is_err() {
Err(BlockstampParseError::InvalidBlockHash())
} else {
Ok(Blockstamp {
id: BlockNumber(id.unwrap()),
hash: BlockHash(
hash.expect("Try to get hash of an uncompleted or reduce block !"),
),
hash: BlockHash(hash),
})
}
}
......
// Copyright (C) 2017-2019 The AXIOM TEAM Association.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//! Define DUBP Documents errors types.
use dup_crypto::keys::SigError;
use std::collections::HashMap;
/// List of possible errors for document signatures verification.
#[derive(Debug, Eq, PartialEq)]
pub enum DocumentSigsErr {
/// Not same amount of issuers and signatures.
/// (issuers count, signatures count)
IncompletePairs(usize, usize),
/// Signatures don't match.
/// List of mismatching pairs indexes.
Invalid(HashMap<usize, SigError>),
}
// Copyright (C) 2017-2019 The AXIOM TEAM Association.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//! Provide common tools for DUBP.
#![deny(
missing_debug_implementations,
missing_copy_implementations,
trivial_casts,
trivial_numeric_casts,
unsafe_code,
unstable_features,
unused_import_braces
)]
#[macro_use]
extern crate pest_derive;
pub mod blockstamp;
pub mod currencies_codes;
pub mod errors;
pub mod parser;
pub mod traits;
use dup_crypto::hashs::Hash;
use serde::{Deserialize, Serialize};
use shrinkwraprs::Shrinkwrap;
use std::fmt::{Debug, Display, Error, Formatter};
pub use blockstamp::{Blockstamp, PreviousBlockstamp};
/// Currency name
#[derive(Debug, Clone, Eq, Hash, PartialEq, Deserialize, Serialize, Shrinkwrap)]
pub struct CurrencyName(pub String);
impl Display for CurrencyName {
fn fmt(&self, f: &mut Formatter) -> Result<(), Error> {
write!(f, "{}", self.0)
}
}
impl From<&str> for CurrencyName {
fn from(s: &str) -> Self {
CurrencyName(s.to_owned())
}
}
/// A block number.
#[derive(
Copy, Clone, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize, Shrinkwrap,
)]
pub struct BlockNumber(pub u32);
impl Display for BlockNumber {
fn fmt(&self, f: &mut Formatter) -> Result<(), Error> {
write!(f, "{}", self.0)
}
}
/// Wrapper of a block hash.
#[derive(
Copy, Clone, Default, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize, Shrinkwrap,
)]
pub struct BlockHash(pub Hash);
impl Display for BlockHash {
fn fmt(&self, f: &mut Formatter) -> Result<(), Error> {
write!(f, "{}", self.0.to_hex())
}
}
impl Debug for BlockHash {
fn fmt(&self, f: &mut Formatter) -> Result<(), Error> {
write!(f, "BlockHash({})", self)
}
}
// Copyright (C) 2017-2019 The AXIOM TEAM Association.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//! Provide parser for DUBP documents.
use failure::Fail;
use pest::iterators::Pair;
use pest::RuleType;
use std::net::AddrParseError;
#[derive(Debug, Clone, Copy, Parser)]
#[grammar = "documents_grammar.pest"]
/// Parser for Documents
pub struct DocumentsParser;
pub trait TextDocumentParser<R: RuleType> {
/// Type of document generated by the parser
type DocumentType;
/// Parse text document from raw format
fn parse(doc: &str) -> Result<Self::DocumentType, TextDocumentParseError>;
/// Parse text document from pest pairs
fn from_pest_pair(pairs: Pair<R>) -> Result<Self::DocumentType, TextDocumentParseError>;
/// Parse text document from versioned pest pairs
fn from_versioned_pest_pair(
version: u16,
pairs: Pair<R>,
) -> Result<Self::DocumentType, TextDocumentParseError>;
}
/// Error with pest parser (grammar)
#[derive(Debug, Clone, Eq, Fail, PartialEq)]
#[fail(display = "Grammar error: {}", _0)]
pub struct PestError(pub String);
impl<T: pest::RuleType> From<pest::error::Error<T>> for PestError {
fn from(e: pest::error::Error<T>) -> Self {
PestError(format!("{}", e))
}
}
/// List of possible errors while parsing a text document.
#[derive(Debug, Clone, Eq, Fail, PartialEq)]
pub enum TextDocumentParseError {
/// The given source don't have a valid specific document format (document type).
#[fail(display = "TextDocumentParseError: Invalid inner format: {}", _0)]
InvalidInnerFormat(String),
/// Ip address parse error
#[fail(display = "TextDocumentParseError: invalid ip: {}", _0)]
IpAddrError(AddrParseError),
/// Error with pest parser
#[fail(display = "TextDocumentParseError: {}", _0)]
PestError(PestError),
/// Unexpected rule
#[fail(display = "TextDocumentParseError: Unexpected rule: '{}'", _0)]
UnexpectedRule(String),
/// Unexpected version
#[fail(display = "TextDocumentParseError: Unexpected version: '{}'", _0)]
UnexpectedVersion(String),
/// Unknown type
#[fail(display = "TextDocumentParseError: UnknownType.")]
UnknownType,
}
impl From<AddrParseError> for TextDocumentParseError {
fn from(e: AddrParseError) -> Self {
TextDocumentParseError::IpAddrError(e)
}
}
impl From<PestError> for TextDocumentParseError {
fn from(e: PestError) -> Self {
TextDocumentParseError::PestError(e)
}
}
impl<T: pest::RuleType> From<pest::error::Error<T>> for TextDocumentParseError {
fn from(e: pest::error::Error<T>) -> Self {
TextDocumentParseError::PestError(e.into())
}
}
// Copyright (C) 2017-2019 The AXIOM TEAM Association.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//! Define DUBP Documents Traits.
pub mod text;
use crate::blockstamp::Blockstamp;
use crate::errors::DocumentSigsErr;
use dup_crypto::keys::*;
use serde::Serialize;
use std::collections::HashMap;
use std::fmt::Debug;
/// trait providing commun methods for any documents of any protocol version.
///
/// # Design choice
///
/// Allow only ed25519 for protocol 10 and many differents
/// schemes for protocol 11 through a proxy type.
pub trait Document: Debug + Clone + PartialEq + Eq {
/// Type of the `PublicKey` used by the document.
type PublicKey: PublicKey;
/// Get document as bytes for signature verification.
fn as_bytes(&self) -> &[u8];
/// Get document blockstamp
fn blockstamp(&self) -> Blockstamp;
/// Get document currency name.
fn currency(&self) -> &str;
/// Iterate over document issuers.
fn issuers(&self) -> &Vec<Self::PublicKey>;
/// Some documents do not directly store the sequence of bytes that will be signed but generate
// it on request, so these types of documents cannot provide a reference to the signed bytes.
fn no_as_bytes(&self) -> bool {
false
}
/// Get document to bytes for signature verification.
fn to_bytes(&self) -> Vec<u8> {
self.as_bytes().to_vec()
}
/// Iterate over document signatures.
fn signatures(&self) -> &Vec<<Self::PublicKey as PublicKey>::Signature>;
/// Verify one signature
#[inline]
fn verify_one_signature(
&self,
public_key: &Self::PublicKey,
signature: &<Self::PublicKey as PublicKey>::Signature,
) -> Result<(), SigError> {
if self.no_as_bytes() {
public_key.verify(&self.to_bytes(), signature)
} else {
public_key.verify(self.as_bytes(), signature)
}
}
/// Verify signatures of document content
fn verify_signatures(&self) -> Result<(), DocumentSigsErr> {
let issuers_count = self.issuers().len();
let signatures_count = self.signatures().len();
if issuers_count != signatures_count {
Err(DocumentSigsErr::IncompletePairs(
issuers_count,
signatures_count,
))
} else {
let issuers = self.issuers();
let signatures = self.signatures();
let mismatches: HashMap<usize, SigError> = issuers
.iter()
.zip(signatures)
.enumerate()
.filter_map(|(i, (key, signature))| {
if let Err(e) = self.verify_one_signature(key, signature) {
Some((i, e))
} else {
None
}
})
.collect();
if mismatches.is_empty() {
Ok(())
} else {
Err(DocumentSigsErr::Invalid(mismatches))
}
}
}
/// Get document version.
fn version(&self) -> u16;
}
/// Trait helper for building new documents.
pub trait DocumentBuilder {
/// Type of the builded document.
type Document: Document;
/// Type of the private keys signing the documents.
type PrivateKey: PrivateKey<
Signature = <<Self::Document as Document>::PublicKey as PublicKey>::Signature,
>;
/// Build a document with provided signatures.
fn build_with_signature(
&self,
signatures: Vec<<<Self::Document as Document>::PublicKey as PublicKey>::Signature>,
) -> Self::Document;
/// Build a document and sign it with the private key.
fn build_and_sign(&self, private_keys: Vec<Self::PrivateKey>) -> Self::Document;
}
/// Trait for a document parser from a `S` source
/// format to a `D` document. Will return the
/// parsed document or an `E` error.
pub trait DocumentParser<S, D, E> {
/// Parse a source and return a document or an error.
fn parse(source: S) -> Result<D, E>;
}
/// Stringify a document
pub trait ToStringObject {
/// Generated string object
type StringObject: Serialize;
/// Transforms object fields into string
fn to_string_object(&self) -> Self::StringObject;
}
/// Jsonify a document
pub trait ToJsonObject: ToStringObject {
/// Convert to JSON String
fn to_json_string(&self) -> Result<String, serde_json::Error> {
Ok(serde_json::to_string(&self.to_string_object())?)
}
/// Convert to JSON String pretty
fn to_json_string_pretty(&self) -> Result<String, serde_json::Error> {
Ok(serde_json::to_string_pretty(&self.to_string_object())?)
}
}
impl<T: ToStringObject> ToJsonObject for T {}
......@@ -15,10 +15,11 @@
//! Define the Text Document Traits.
use super::{Document, DocumentBuilder};
use crate::*;
use dup_crypto::keys::*;
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
/// Contains a document in full or compact format
pub enum TextDocumentFormat<D: TextDocument> {
/// Complete format (Allows to check the validity of the signature)
......@@ -56,7 +57,7 @@ impl<D: TextDocument> CompactTextDocument for TextDocumentFormat<D> {
}
}
/// Trait for a V10 document.
/// Trait for a text document.
pub trait TextDocument: Document<PublicKey = PubKey> {
/// Type of associated compact document.
type CompactTextDocument_: CompactTextDocument;
......
......@@ -13,6 +13,7 @@ path = "src/lib.rs"
[dependencies]
bincode = "1.0.1"
dubp-common-doc = { path = "../common-doc" } #, version = "0.1.0" }
durs-common-tools = { path = "../../tools/common-tools", version = "0.2.0" }
failure = "0.1.5"
serde = { version = "1.0.*", features = ["derive"] }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment