Skip to content
Snippets Groups Projects
Commit b1c3b0fd authored by Hugo Trentesaux's avatar Hugo Trentesaux
Browse files

add unsigned datapod index request

parent 2fcad6d1
Branches
Tags
1 merge request!34Draft: tx comments
...@@ -106,7 +106,7 @@ version = "0.8.7" ...@@ -106,7 +106,7 @@ version = "0.8.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if",
"getrandom", "getrandom",
"once_cell", "once_cell",
"version_check", "version_check",
...@@ -496,7 +496,7 @@ dependencies = [ ...@@ -496,7 +496,7 @@ dependencies = [
"ark-std", "ark-std",
"digest 0.10.7", "digest 0.10.7",
"rand_core 0.6.4", "rand_core 0.6.4",
"sha3 0.10.8", "sha3",
] ]
[[package]] [[package]]
...@@ -520,12 +520,6 @@ dependencies = [ ...@@ -520,12 +520,6 @@ dependencies = [
"nodrop", "nodrop",
] ]
[[package]]
name = "arrayvec"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
[[package]] [[package]]
name = "arrayvec" name = "arrayvec"
version = "0.7.4" version = "0.7.4"
...@@ -583,7 +577,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" ...@@ -583,7 +577,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f97ab0c5b00a7cdbe5a371b9a782ee7be1316095885c8a4ea1daf490eb0ef65" checksum = "8f97ab0c5b00a7cdbe5a371b9a782ee7be1316095885c8a4ea1daf490eb0ef65"
dependencies = [ dependencies = [
"async-lock 3.3.0", "async-lock 3.3.0",
"cfg-if 1.0.0", "cfg-if",
"concurrent-queue", "concurrent-queue",
"futures-io", "futures-io",
"futures-lite", "futures-lite",
...@@ -637,7 +631,7 @@ dependencies = [ ...@@ -637,7 +631,7 @@ dependencies = [
"async-lock 3.3.0", "async-lock 3.3.0",
"async-signal", "async-signal",
"blocking", "blocking",
"cfg-if 1.0.0", "cfg-if",
"event-listener 4.0.3", "event-listener 4.0.3",
"futures-lite", "futures-lite",
"rustix 0.38.31", "rustix 0.38.31",
...@@ -653,7 +647,7 @@ dependencies = [ ...@@ -653,7 +647,7 @@ dependencies = [
"async-io", "async-io",
"async-lock 2.8.0", "async-lock 2.8.0",
"atomic-waker", "atomic-waker",
"cfg-if 1.0.0", "cfg-if",
"futures-core", "futures-core",
"futures-io", "futures-io",
"rustix 0.38.31", "rustix 0.38.31",
...@@ -705,7 +699,7 @@ checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" ...@@ -705,7 +699,7 @@ checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837"
dependencies = [ dependencies = [
"addr2line 0.21.0", "addr2line 0.21.0",
"cc", "cc",
"cfg-if 1.0.0", "cfg-if",
"libc", "libc",
"miniz_oxide", "miniz_oxide",
"object 0.32.2", "object 0.32.2",
...@@ -873,17 +867,6 @@ dependencies = [ ...@@ -873,17 +867,6 @@ dependencies = [
"constant_time_eq 0.1.5", "constant_time_eq 0.1.5",
] ]
[[package]]
name = "blake2b_simd"
version = "0.5.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "afa748e348ad3be8263be728124b24a24f268266f6f5d58af9d75f6a40b5c587"
dependencies = [
"arrayref",
"arrayvec 0.5.2",
"constant_time_eq 0.1.5",
]
[[package]] [[package]]
name = "blake2b_simd" name = "blake2b_simd"
version = "1.0.2" version = "1.0.2"
...@@ -897,28 +880,26 @@ dependencies = [ ...@@ -897,28 +880,26 @@ dependencies = [
[[package]] [[package]]
name = "blake2s_simd" name = "blake2s_simd"
version = "0.5.11" version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e461a7034e85b211a4acb57ee2e6730b32912b06c08cc242243c39fc21ae6a2" checksum = "94230421e395b9920d23df13ea5d77a20e1725331f90fbbf6df6040b33f756ae"
dependencies = [ dependencies = [
"arrayref", "arrayref",
"arrayvec 0.5.2", "arrayvec 0.7.4",
"constant_time_eq 0.1.5", "constant_time_eq 0.3.0",
] ]
[[package]] [[package]]
name = "blake3" name = "blake3"
version = "0.3.8" version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b64485778c4f16a6a5a9d335e80d449ac6c70cdd6a06d2af18a6f6f775a125b3" checksum = "30cca6d3674597c30ddf2c587bf8d9d65c9a84d2326d941cc79c9842dfe0ef52"
dependencies = [ dependencies = [
"arrayref", "arrayref",
"arrayvec 0.5.2", "arrayvec 0.7.4",
"cc", "cc",
"cfg-if 0.1.10", "cfg-if",
"constant_time_eq 0.1.5", "constant_time_eq 0.3.0",
"crypto-mac",
"digest 0.9.0",
] ]
[[package]] [[package]]
...@@ -927,7 +908,6 @@ version = "0.9.0" ...@@ -927,7 +908,6 @@ version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4"
dependencies = [ dependencies = [
"block-padding",
"generic-array", "generic-array",
] ]
...@@ -940,12 +920,6 @@ dependencies = [ ...@@ -940,12 +920,6 @@ dependencies = [
"generic-array", "generic-array",
] ]
[[package]]
name = "block-padding"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae"
[[package]] [[package]]
name = "blocking" name = "blocking"
version = "1.5.1" version = "1.5.1"
...@@ -1016,12 +990,6 @@ dependencies = [ ...@@ -1016,12 +990,6 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "cfg-if"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
[[package]] [[package]]
name = "cfg-if" name = "cfg-if"
version = "1.0.0" version = "1.0.0"
...@@ -1034,7 +1002,7 @@ version = "0.9.1" ...@@ -1034,7 +1002,7 @@ version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if",
"cipher", "cipher",
"cpufeatures", "cpufeatures",
] ]
...@@ -1066,13 +1034,30 @@ dependencies = [ ...@@ -1066,13 +1034,30 @@ dependencies = [
[[package]] [[package]]
name = "cid" name = "cid"
version = "0.7.0" version = "0.8.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6b8976b33648136e969aafa6eb33d58ff0d301fa0b4e8d513db58fd32cd81aa" checksum = "f6ed9c8b2d17acb8110c46f1da5bf4a696d745e1474a16db0cd2b49cd0249bf2"
dependencies = [ dependencies = [
"core2",
"multibase", "multibase",
"multihash 0.14.0", "multihash 0.16.3",
"unsigned-varint", "serde",
"serde_bytes",
"unsigned-varint 0.7.2",
]
[[package]]
name = "cid"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3147d8272e8fa0ccd29ce51194dd98f79ddfb8191ba9e3409884e751798acf3a"
dependencies = [
"core2",
"multibase",
"multihash 0.19.1",
"serde",
"serde_bytes",
"unsigned-varint 0.8.0",
] ]
[[package]] [[package]]
...@@ -1283,7 +1268,7 @@ version = "0.3.5" ...@@ -1283,7 +1268,7 @@ version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eeaa953eaad386a53111e47172c2fedba671e5684c8dd601a5f474f4f118710f" checksum = "eeaa953eaad386a53111e47172c2fedba671e5684c8dd601a5f474f4f118710f"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if",
] ]
[[package]] [[package]]
...@@ -1310,7 +1295,7 @@ version = "1.3.2" ...@@ -1310,7 +1295,7 @@ version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if",
] ]
[[package]] [[package]]
...@@ -1443,7 +1428,7 @@ version = "4.1.2" ...@@ -1443,7 +1428,7 @@ version = "4.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a677b8922c94e01bdbb12126b0bc852f00447528dee1782229af9c720c3f348" checksum = "0a677b8922c94e01bdbb12126b0bc852f00447528dee1782229af9c720c3f348"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if",
"cpufeatures", "cpufeatures",
"curve25519-dalek-derive", "curve25519-dalek-derive",
"digest 0.10.7", "digest 0.10.7",
...@@ -1541,7 +1526,7 @@ version = "5.5.3" ...@@ -1541,7 +1526,7 @@ version = "5.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if",
"hashbrown 0.14.3", "hashbrown 0.14.3",
"lock_api", "lock_api",
"once_cell", "once_cell",
...@@ -1877,7 +1862,7 @@ version = "0.8.33" ...@@ -1877,7 +1862,7 @@ version = "0.8.33"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if",
] ]
[[package]] [[package]]
...@@ -2082,7 +2067,7 @@ version = "15.1.0" ...@@ -2082,7 +2067,7 @@ version = "15.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "878babb0b136e731cc77ec2fd883ff02745ff21e6fb662729953d44923df009c" checksum = "878babb0b136e731cc77ec2fd883ff02745ff21e6fb662729953d44923df009c"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if",
"parity-scale-codec", "parity-scale-codec",
"scale-info", "scale-info",
] ]
...@@ -2093,7 +2078,7 @@ version = "16.0.0" ...@@ -2093,7 +2078,7 @@ version = "16.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87cf1549fba25a6fcac22785b61698317d958e96cac72a59102ea45b9ae64692" checksum = "87cf1549fba25a6fcac22785b61698317d958e96cac72a59102ea45b9ae64692"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if",
"parity-scale-codec", "parity-scale-codec",
"scale-info", "scale-info",
"serde", "serde",
...@@ -2231,7 +2216,7 @@ dependencies = [ ...@@ -2231,7 +2216,7 @@ dependencies = [
"anyhow", "anyhow",
"bip39", "bip39",
"bs58", "bs58",
"cid", "cid 0.11.1",
"clap", "clap",
"comfy-table", "comfy-table",
"confy", "confy",
...@@ -2242,6 +2227,7 @@ dependencies = [ ...@@ -2242,6 +2227,7 @@ dependencies = [
"hex", "hex",
"inquire", "inquire",
"ipfs-api-backend-hyper", "ipfs-api-backend-hyper",
"ipld-core",
"log", "log",
"nacl", "nacl",
"parity-scale-codec", "parity-scale-codec",
...@@ -2249,6 +2235,7 @@ dependencies = [ ...@@ -2249,6 +2235,7 @@ dependencies = [
"rpassword", "rpassword",
"scrypt", "scrypt",
"serde", "serde",
"serde_ipld_dagcbor",
"serde_json", "serde_json",
"sp-core", "sp-core",
"sp-runtime", "sp-runtime",
...@@ -2273,7 +2260,7 @@ version = "0.2.12" ...@@ -2273,7 +2260,7 @@ version = "0.2.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if",
"libc", "libc",
"wasi", "wasi",
] ]
...@@ -2394,6 +2381,12 @@ dependencies = [ ...@@ -2394,6 +2381,12 @@ dependencies = [
"tracing", "tracing",
] ]
[[package]]
name = "half"
version = "1.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b43ede17f21864e81be2fa654110bf1e793774238d86ef8555c37e6519c0403"
[[package]] [[package]]
name = "hash-db" name = "hash-db"
version = "0.16.0" version = "0.16.0"
...@@ -2810,7 +2803,7 @@ version = "0.1.12" ...@@ -2810,7 +2803,7 @@ version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if",
] ]
[[package]] [[package]]
...@@ -2884,7 +2877,7 @@ checksum = "9b74065805db266ba2c6edbd670b23c4714824a955628472b2e46cc9f3a869cb" ...@@ -2884,7 +2877,7 @@ checksum = "9b74065805db266ba2c6edbd670b23c4714824a955628472b2e46cc9f3a869cb"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"bytes", "bytes",
"cfg-if 1.0.0", "cfg-if",
"common-multipart-rfc7578", "common-multipart-rfc7578",
"dirs", "dirs",
"futures", "futures",
...@@ -2901,6 +2894,17 @@ dependencies = [ ...@@ -2901,6 +2894,17 @@ dependencies = [
"walkdir", "walkdir",
] ]
[[package]]
name = "ipld-core"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4ede82a79e134f179f4b29b5fdb1eb92bd1b38c4dfea394c539051150a21b9b"
dependencies = [
"cid 0.11.1",
"serde",
"serde_bytes",
]
[[package]] [[package]]
name = "ipnet" name = "ipnet"
version = "2.9.0" version = "2.9.0"
...@@ -3046,7 +3050,7 @@ version = "0.13.3" ...@@ -3046,7 +3050,7 @@ version = "0.13.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "956ff9b67e26e1a6a866cb758f12c6f8746208489e3e4a4b5580802f2f0a587b" checksum = "956ff9b67e26e1a6a866cb758f12c6f8746208489e3e4a4b5580802f2f0a587b"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if",
"ecdsa", "ecdsa",
"elliptic-curve", "elliptic-curve",
"once_cell", "once_cell",
...@@ -3307,7 +3311,7 @@ dependencies = [ ...@@ -3307,7 +3311,7 @@ dependencies = [
"percent-encoding", "percent-encoding",
"serde", "serde",
"static_assertions", "static_assertions",
"unsigned-varint", "unsigned-varint 0.7.2",
"url", "url",
] ]
...@@ -3324,19 +3328,21 @@ dependencies = [ ...@@ -3324,19 +3328,21 @@ dependencies = [
[[package]] [[package]]
name = "multihash" name = "multihash"
version = "0.14.0" version = "0.16.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "752a61cd890ff691b4411423d23816d5866dd5621e4d1c5687a53b94b5a979d8" checksum = "1c346cf9999c631f002d8f977c4eaeaa0e6386f16007202308d0b3757522c2cc"
dependencies = [ dependencies = [
"blake2b_simd 0.5.11", "blake2b_simd",
"blake2s_simd", "blake2s_simd",
"blake3", "blake3",
"digest 0.9.0", "core2",
"generic-array", "digest 0.10.7",
"multihash-derive 0.7.2", "multihash-derive",
"sha2 0.9.9", "serde",
"sha3 0.9.1", "serde-big-array",
"unsigned-varint", "sha2 0.10.8",
"sha3",
"unsigned-varint 0.7.2",
] ]
[[package]] [[package]]
...@@ -3346,22 +3352,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" ...@@ -3346,22 +3352,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "835d6ff01d610179fbce3de1694d007e500bf33a7f29689838941d6bf783ae40" checksum = "835d6ff01d610179fbce3de1694d007e500bf33a7f29689838941d6bf783ae40"
dependencies = [ dependencies = [
"core2", "core2",
"multihash-derive 0.8.1", "multihash-derive",
"unsigned-varint", "unsigned-varint 0.7.2",
] ]
[[package]] [[package]]
name = "multihash-derive" name = "multihash"
version = "0.7.2" version = "0.19.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "424f6e86263cd5294cbd7f1e95746b95aca0e0d66bff31e5a40d6baa87b4aa99" checksum = "076d548d76a0e2a0d4ab471d0b1c36c577786dfc4471242035d97a12a735c492"
dependencies = [ dependencies = [
"proc-macro-crate 1.1.3", "core2",
"proc-macro-error", "serde",
"proc-macro2", "unsigned-varint 0.7.2",
"quote",
"syn 1.0.109",
"synstructure",
] ]
[[package]] [[package]]
...@@ -3606,7 +3609,7 @@ version = "0.9.9" ...@@ -3606,7 +3609,7 @@ version = "0.9.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if",
"libc", "libc",
"redox_syscall", "redox_syscall",
"smallvec", "smallvec",
...@@ -3749,7 +3752,7 @@ version = "3.4.0" ...@@ -3749,7 +3752,7 @@ version = "3.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30054e72317ab98eddd8561db0f6524df3367636884b7b21b703e4b280a84a14" checksum = "30054e72317ab98eddd8561db0f6524df3367636884b7b21b703e4b280a84a14"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if",
"concurrent-queue", "concurrent-queue",
"pin-project-lite", "pin-project-lite",
"rustix 0.38.31", "rustix 0.38.31",
...@@ -4432,7 +4435,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" ...@@ -4432,7 +4435,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eca070c12893629e2cc820a9761bedf6ce1dcddc9852984d1dc734b8bd9bd024" checksum = "eca070c12893629e2cc820a9761bedf6ce1dcddc9852984d1dc734b8bd9bd024"
dependencies = [ dependencies = [
"bitvec", "bitvec",
"cfg-if 1.0.0", "cfg-if",
"derive_more", "derive_more",
"parity-scale-codec", "parity-scale-codec",
"scale-info-derive", "scale-info-derive",
...@@ -4511,7 +4514,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" ...@@ -4511,7 +4514,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "772575a524feeb803e5b0fcbc6dd9f367e579488197c94c6e4023aad2305774d" checksum = "772575a524feeb803e5b0fcbc6dd9f367e579488197c94c6e4023aad2305774d"
dependencies = [ dependencies = [
"ahash 0.8.7", "ahash 0.8.7",
"cfg-if 1.0.0", "cfg-if",
"hashbrown 0.13.2", "hashbrown 0.13.2",
] ]
...@@ -4656,6 +4659,15 @@ dependencies = [ ...@@ -4656,6 +4659,15 @@ dependencies = [
"serde_derive", "serde_derive",
] ]
[[package]]
name = "serde-big-array"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd31f59f6fe2b0c055371bb2f16d7f0aa7d8881676c04a55b1596d1a17cd10a4"
dependencies = [
"serde",
]
[[package]] [[package]]
name = "serde_bytes" name = "serde_bytes"
version = "0.11.14" version = "0.11.14"
...@@ -4676,6 +4688,17 @@ dependencies = [ ...@@ -4676,6 +4688,17 @@ dependencies = [
"syn 2.0.65", "syn 2.0.65",
] ]
[[package]]
name = "serde_ipld_dagcbor"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "950f35fcae42dd9268d9253eb8f846dcef4d66e4e7d56494f38c8eb13e16d87b"
dependencies = [
"cid 0.8.6",
"half",
"serde",
]
[[package]] [[package]]
name = "serde_json" name = "serde_json"
version = "1.0.117" version = "1.0.117"
...@@ -4725,7 +4748,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" ...@@ -4725,7 +4748,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6" checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6"
dependencies = [ dependencies = [
"block-buffer 0.9.0", "block-buffer 0.9.0",
"cfg-if 1.0.0", "cfg-if",
"cpufeatures", "cpufeatures",
"digest 0.9.0", "digest 0.9.0",
"opaque-debug", "opaque-debug",
...@@ -4738,7 +4761,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" ...@@ -4738,7 +4761,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800"
dependencies = [ dependencies = [
"block-buffer 0.9.0", "block-buffer 0.9.0",
"cfg-if 1.0.0", "cfg-if",
"cpufeatures", "cpufeatures",
"digest 0.9.0", "digest 0.9.0",
"opaque-debug", "opaque-debug",
...@@ -4750,23 +4773,11 @@ version = "0.10.8" ...@@ -4750,23 +4773,11 @@ version = "0.10.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if",
"cpufeatures", "cpufeatures",
"digest 0.10.7", "digest 0.10.7",
] ]
[[package]]
name = "sha3"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809"
dependencies = [
"block-buffer 0.9.0",
"digest 0.9.0",
"keccak",
"opaque-debug",
]
[[package]] [[package]]
name = "sha3" name = "sha3"
version = "0.10.8" version = "0.10.8"
...@@ -4914,7 +4925,7 @@ dependencies = [ ...@@ -4914,7 +4925,7 @@ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
"sha2 0.10.8", "sha2 0.10.8",
"sha3 0.10.8", "sha3",
"siphasher", "siphasher",
"slab", "slab",
"smallvec", "smallvec",
...@@ -5105,11 +5116,11 @@ name = "sp-crypto-hashing" ...@@ -5105,11 +5116,11 @@ name = "sp-crypto-hashing"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/duniter/duniter-polkadot-sdk.git?branch=duniter-substrate-v1.11.0#030a7b8fd5ef03e4da466e65ce8fe92e3cff90e4" source = "git+https://github.com/duniter/duniter-polkadot-sdk.git?branch=duniter-substrate-v1.11.0#030a7b8fd5ef03e4da466e65ce8fe92e3cff90e4"
dependencies = [ dependencies = [
"blake2b_simd 1.0.2", "blake2b_simd",
"byteorder", "byteorder",
"digest 0.10.7", "digest 0.10.7",
"sha2 0.10.8", "sha2 0.10.8",
"sha3 0.10.8", "sha3",
"twox-hash", "twox-hash",
] ]
...@@ -5732,7 +5743,7 @@ version = "1.1.7" ...@@ -5732,7 +5743,7 @@ version = "1.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if",
"once_cell", "once_cell",
] ]
...@@ -6065,7 +6076,7 @@ version = "1.6.3" ...@@ -6065,7 +6076,7 @@ version = "1.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if",
"digest 0.10.7", "digest 0.10.7",
"rand", "rand",
"static_assertions", "static_assertions",
...@@ -6190,6 +6201,12 @@ version = "0.7.2" ...@@ -6190,6 +6201,12 @@ version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6889a77d49f1f013504cec6bf97a2c730394adedaeb1deb5ea08949a50541105" checksum = "6889a77d49f1f013504cec6bf97a2c730394adedaeb1deb5ea08949a50541105"
[[package]]
name = "unsigned-varint"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb066959b24b5196ae73cb057f45598450d2c5f71460e98c49b738086eff9c06"
[[package]] [[package]]
name = "untrusted" name = "untrusted"
version = "0.7.1" version = "0.7.1"
...@@ -6256,7 +6273,7 @@ dependencies = [ ...@@ -6256,7 +6273,7 @@ dependencies = [
"rand_chacha", "rand_chacha",
"rand_core 0.6.4", "rand_core 0.6.4",
"sha2 0.10.8", "sha2 0.10.8",
"sha3 0.10.8", "sha3",
"thiserror", "thiserror",
"zeroize", "zeroize",
] ]
...@@ -6292,7 +6309,7 @@ version = "0.2.91" ...@@ -6292,7 +6309,7 @@ version = "0.2.91"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1e124130aee3fb58c5bdd6b639a0509486b0338acaaae0c84a5124b0f588b7f" checksum = "c1e124130aee3fb58c5bdd6b639a0509486b0338acaaae0c84a5124b0f588b7f"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if",
"wasm-bindgen-macro", "wasm-bindgen-macro",
] ]
...@@ -6317,7 +6334,7 @@ version = "0.4.41" ...@@ -6317,7 +6334,7 @@ version = "0.4.41"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "877b9c3f61ceea0e56331985743b13f3d25c406a7098d45180fb5f09bc19ed97" checksum = "877b9c3f61ceea0e56331985743b13f3d25c406a7098d45180fb5f09bc19ed97"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if",
"js-sys", "js-sys",
"wasm-bindgen", "wasm-bindgen",
"web-sys", "web-sys",
...@@ -6410,7 +6427,7 @@ checksum = "f907fdead3153cb9bfb7a93bbd5b62629472dc06dee83605358c64c52ed3dda9" ...@@ -6410,7 +6427,7 @@ checksum = "f907fdead3153cb9bfb7a93bbd5b62629472dc06dee83605358c64c52ed3dda9"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bincode", "bincode",
"cfg-if 1.0.0", "cfg-if",
"indexmap 1.9.3", "indexmap 1.9.3",
"libc", "libc",
"log", "log",
...@@ -6433,7 +6450,7 @@ version = "8.0.1" ...@@ -6433,7 +6450,7 @@ version = "8.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3b9daa7c14cd4fa3edbf69de994408d5f4b7b0959ac13fa69d465f6597f810d" checksum = "d3b9daa7c14cd4fa3edbf69de994408d5f4b7b0959ac13fa69d465f6597f810d"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if",
] ]
[[package]] [[package]]
...@@ -6464,7 +6481,7 @@ dependencies = [ ...@@ -6464,7 +6481,7 @@ dependencies = [
"addr2line 0.19.0", "addr2line 0.19.0",
"anyhow", "anyhow",
"bincode", "bincode",
"cfg-if 1.0.0", "cfg-if",
"cpp_demangle", "cpp_demangle",
"gimli 0.27.3", "gimli 0.27.3",
"log", "log",
...@@ -6493,7 +6510,7 @@ version = "8.0.1" ...@@ -6493,7 +6510,7 @@ version = "8.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aecae978b13f7f67efb23bd827373ace4578f2137ec110bbf6a4a7cde4121bbd" checksum = "aecae978b13f7f67efb23bd827373ace4578f2137ec110bbf6a4a7cde4121bbd"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if",
"libc", "libc",
"windows-sys 0.45.0", "windows-sys 0.45.0",
] ]
...@@ -6506,7 +6523,7 @@ checksum = "658cf6f325232b6760e202e5255d823da5e348fdea827eff0a2a22319000b441" ...@@ -6506,7 +6523,7 @@ checksum = "658cf6f325232b6760e202e5255d823da5e348fdea827eff0a2a22319000b441"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"cc", "cc",
"cfg-if 1.0.0", "cfg-if",
"indexmap 1.9.3", "indexmap 1.9.3",
"libc", "libc",
"log", "log",
...@@ -6813,7 +6830,7 @@ version = "0.50.0" ...@@ -6813,7 +6830,7 @@ version = "0.50.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if",
"windows-sys 0.48.0", "windows-sys 0.48.0",
] ]
......
...@@ -46,9 +46,11 @@ inquire = "^0.6.2" ...@@ -46,9 +46,11 @@ inquire = "^0.6.2"
directories = "^5.0.1" directories = "^5.0.1"
comfy-table = "^7.1.1" comfy-table = "^7.1.1"
# IPFS (RPC API and CID) # IPFS (RPC API, CID, IPLD, dagcbor)
ipfs-api-backend-hyper = { version = "0.6", features = ["with-hyper-rustls"] } ipfs-api-backend-hyper = { version = "^0.6", features = ["with-hyper-rustls"] }
cid = "0.7.0" cid = { version = "^0.11.0", features = ["serde"] }
ipld-core = { version = "^0.4.1", features = ["serde"] }
serde_ipld_dagcbor = "^0.1.0"
# crypto # crypto
scrypt = { version = "^0.11", default-features = false } # for old-style key generation scrypt = { version = "^0.11", default-features = false } # for old-style key generation
nacl = { version = "^0.5.3" } # for old-style key generation nacl = { version = "^0.5.3" } # for old-style key generation
......
...@@ -24,6 +24,9 @@ pub enum Subcommand { ...@@ -24,6 +24,9 @@ pub enum Subcommand {
/// Make transaction comment offchain instead of onchain (requires IPFS) /// Make transaction comment offchain instead of onchain (requires IPFS)
#[clap(short = 'x', long = "offchain")] #[clap(short = 'x', long = "offchain")]
offchain: bool, offchain: bool,
/// Make transaction comment offchain instead of onchain and submit index request to datapod (requires IPFS)
#[clap(short = 'd', long = "datapod")]
datapod: bool,
}, },
/// Transfer the same amount for each space-separated address. /// Transfer the same amount for each space-separated address.
/// If an address appears mutiple times, it will get multiple times the same amount /// If an address appears mutiple times, it will get multiple times the same amount
...@@ -49,6 +52,7 @@ pub async fn handle_command(data: Data, command: Subcommand) -> Result<(), GcliE ...@@ -49,6 +52,7 @@ pub async fn handle_command(data: Data, command: Subcommand) -> Result<(), GcliE
is_ud, is_ud,
comment, comment,
offchain, offchain,
datapod,
} => { } => {
if let Some(comment) = comment { if let Some(comment) = comment {
if is_ud || allow_death { if is_ud || allow_death {
...@@ -56,7 +60,10 @@ pub async fn handle_command(data: Data, command: Subcommand) -> Result<(), GcliE ...@@ -56,7 +60,10 @@ pub async fn handle_command(data: Data, command: Subcommand) -> Result<(), GcliE
"ud or allow death commented transfers are not handled yet".to_string(), "ud or allow death commented transfers are not handled yet".to_string(),
)); ));
} }
if offchain { if datapod {
commands::commented::transfer_offchain_datapod(&data, amount, dest, comment)
.await?;
} else if offchain {
commands::commented::transfer_offchain(&data, amount, dest, comment).await?; commands::commented::transfer_offchain(&data, amount, dest, comment).await?;
} else { } else {
commands::commented::transfer_onchain(&data, amount, dest, comment).await?; commands::commented::transfer_onchain(&data, amount, dest, comment).await?;
......
use crate::*; use crate::*;
use cid::Cid; use cid::Cid;
use ipfs_api_backend_hyper::{IpfsApi, IpfsClient};
use serde::{Deserialize, Serialize};
use std::io::Cursor;
use std::time::{SystemTime, UNIX_EPOCH};
/// Index request
#[derive(Debug, Serialize, Deserialize)]
struct IndexRequest {
/// pubkey of the author of the document
pubkey: String,
/// timestamp of the document
time: u64,
/// kind of the document, arbitrary string interpreted by the datapod
kind: String,
/// data coming with the index request
data: Option<Cid>,
/// signature of the following byte payload :
/// ["dd" prefix for 'duniter datapods' | timestamp as u64 bytes | kind bytes | data bytes or 0x00]
sig: Option<String>,
}
const TOPIC: &'static str = "ddd";
const TRANSACTION_COMMENT: &'static str =
"bafkreiegjt5mrfj2hshuw6koejdfiykq57mzjeprfckxj5zpxxtqj4qzeu";
#[cfg(any(feature = "dev", feature = "gdev"))] // find how to get runtime calls #[cfg(any(feature = "dev", feature = "gdev"))] // find how to get runtime calls
type Call = runtime::runtime_types::gdev_runtime::RuntimeCall; type Call = runtime::runtime_types::gdev_runtime::RuntimeCall;
...@@ -32,6 +55,46 @@ pub async fn transfer_offchain( ...@@ -32,6 +55,46 @@ pub async fn transfer_offchain(
.map_err(|e| e.into()) .map_err(|e| e.into())
} }
/// commented balance transfer, offchain upload to local ipfs node, index request for datapods
pub async fn transfer_offchain_datapod(
data: &Data,
amount: u64,
dest: AccountId,
comment: String,
) -> Result<(), GcliError> {
let response = commands::ipfs::upload_string(&comment)
.await
.map_err(|e| anyhow::anyhow!(e))?;
let cid = Cid::from_str(&response.hash).map_err(|e| anyhow!(e))?;
// serialize index request and upload it to ipfs
let irbytes = serde_ipld_dagcbor::to_vec(&IndexRequest {
pubkey: data.address().to_string(),
time: SystemTime::now()
.duration_since(UNIX_EPOCH)
.expect("time goes forward")
.as_secs(),
kind: TRANSACTION_COMMENT.to_string(),
data: Some(cid),
sig: None,
})
.map_err(|e| anyhow!(e))?;
let response2 = commands::ipfs::upload_dagcbor(&irbytes)
.await
.map_err(|e| anyhow::anyhow!(e))?;
let cid2 = Cid::from_str(&response2.cid.cid_string).map_err(|e| anyhow!(e))?;
// submit index request CID to pubsub
let client = IpfsClient::default();
let ircid = Cursor::new(format!("{}\n", cid2.to_string()));
client
.pubsub_pub(TOPIC, ircid)
.await
.map_err(|e| anyhow!(e))?;
// once offchain comment indexing is requested, write the comment CID as tx comment
transfer(data, amount, dest, cid.to_bytes().to_vec())
.await
.map_err(|e| e.into())
}
/// wrap a transfer call and a remark and submit them /// wrap a transfer call and a remark and submit them
async fn transfer( async fn transfer(
data: &Data, data: &Data,
......
use crate::{Data, GcliError}; use crate::{Data, GcliError};
use ipfs_api_backend_hyper::response::{AddResponse, VersionResponse}; use ipfs_api_backend_hyper::request::{DagCodec, DagPut};
use ipfs_api_backend_hyper::response::{AddResponse, DagPutResponse, VersionResponse};
use ipfs_api_backend_hyper::{IpfsApi, IpfsClient}; use ipfs_api_backend_hyper::{IpfsApi, IpfsClient};
use std::io::Cursor; use std::io::Cursor;
...@@ -23,6 +24,21 @@ pub async fn upload_string(txt: &str) -> Result<AddResponse, ipfs_api_backend_hy ...@@ -23,6 +24,21 @@ pub async fn upload_string(txt: &str) -> Result<AddResponse, ipfs_api_backend_hy
// client.add(data).await // client.add(data).await
// } // }
/// upload dag
pub async fn upload_dagcbor(bytes: &[u8]) -> Result<DagPutResponse, ipfs_api_backend_hyper::Error> {
let client = IpfsClient::default();
let data = Cursor::new(bytes.to_owned());
client
.dag_put_with_options(
data,
DagPut {
input_codec: Some(DagCodec::Cbor),
..Default::default()
},
)
.await
}
/// define ipfs subcommands /// define ipfs subcommands
#[derive(Clone, Default, Debug, clap::Parser)] #[derive(Clone, Default, Debug, clap::Parser)]
pub enum Subcommand { pub enum Subcommand {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment