Compare commits

...

5 commits

Author SHA1 Message Date
Gilles Filippini
428047e4e7 chore: uprade async-graphql 2023-03-19 23:39:29 +01:00
librelois
c8d178fd89 feat(bda): impl requests CompressedBlockChunk, CurrentBlockstamp & Sync 2021-06-13 19:40:17 +02:00
librelois
92f5dbea20 deps: upgrade core 2021-06-06 21:47:05 +02:00
librelois
98425968db deps: upgrade core 2021-06-05 19:09:16 +02:00
librelois
3fbf29f71a feat(gql): add field aggregate.sum for query wallets 2021-06-04 02:37:38 +02:00
13 changed files with 358 additions and 167 deletions

251
Cargo.lock generated
View file

@ -1,5 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "Inflector"
version = "0.11.4"
@ -18,9 +20,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
[[package]]
name = "aho-corasick"
version = "0.7.15"
version = "0.7.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5"
checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac"
dependencies = [
"memchr",
]
@ -70,6 +72,12 @@ dependencies = [
"serde",
]
[[package]]
name = "ascii_utils"
version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71938f30533e4d95a6d17aa530939da3842c2ab6f4f84b9dae68447e4129f74a"
[[package]]
name = "async-bincode"
version = "0.6.1"
@ -78,7 +86,7 @@ checksum = "2a31c08aa335b3ab414d29bdefe1f4353408abf93f3db1e3e2cc78d3ec4f0d43"
dependencies = [
"bincode",
"byteorder",
"bytes 1.0.1",
"bytes",
"futures-core",
"futures-sink",
"serde",
@ -87,21 +95,25 @@ dependencies = [
[[package]]
name = "async-graphql"
version = "2.8.2"
version = "4.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb5e71af65ee4a367603829e92b26710caf4116d1eaca8953dedf1809b33694a"
checksum = "84ecd9edbd48b68e44f81b720d83e670d876dce440856feee6c892c8cd3f6798"
dependencies = [
"async-graphql-derive",
"async-graphql-parser",
"async-graphql-value",
"async-stream",
"async-trait",
"bytes",
"fast_chemail",
"fnv",
"futures-util",
"http",
"indexmap",
"log",
"mime",
"multer",
"num-traits",
"once_cell",
"pin-project-lite",
"regex",
@ -114,13 +126,13 @@ dependencies = [
[[package]]
name = "async-graphql-derive"
version = "2.8.2"
version = "4.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6fd4c2eb837e894909fe13509f2351fa3990c114426e41255936800892ccbe26"
checksum = "a8801127f6a7b3af410498d2f971ee6da8f12f9b0b784473da636ce04e5ac565"
dependencies = [
"Inflector",
"async-graphql-parser",
"darling 0.12.4",
"darling 0.14.4",
"proc-macro-crate",
"proc-macro2",
"quote",
@ -130,23 +142,24 @@ dependencies = [
[[package]]
name = "async-graphql-parser"
version = "2.7.1"
version = "4.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2a8d8116f3015b7686ef98ffb70a74183c3c17bf45135993d3f095812e09e786"
checksum = "c4097e2e3e313a9220df25485046b7749f4b8d749aba8ed7e09e929d60a643e3"
dependencies = [
"async-graphql-value",
"pest",
"pest_derive",
"serde",
"serde_json",
]
[[package]]
name = "async-graphql-value"
version = "2.6.5"
version = "4.0.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8342ada84efe4b3d59e1313d1d2740a8ccfc76ddb57ccf55e45a6464dd7d0d3"
checksum = "7a941b499fead4a3fb5392cabf42446566d18c86313f69f2deab69560394d65f"
dependencies = [
"bytes",
"indexmap",
"serde",
"serde_json",
]
@ -346,17 +359,14 @@ version = "1.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
[[package]]
name = "bytes"
version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38"
[[package]]
name = "bytes"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040"
dependencies = [
"serde",
]
[[package]]
name = "cc"
@ -428,12 +438,6 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
[[package]]
name = "convert_case"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e"
[[package]]
name = "cpuid-bool"
version = "0.1.2"
@ -532,12 +536,12 @@ dependencies = [
[[package]]
name = "darling"
version = "0.12.4"
version = "0.14.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f2c43f534ea4b0b049015d00269734195e6d3f0f6635cb692251aca6f9f8b3c"
checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850"
dependencies = [
"darling_core 0.12.4",
"darling_macro 0.12.4",
"darling_core 0.14.4",
"darling_macro 0.14.4",
]
[[package]]
@ -556,9 +560,9 @@ dependencies = [
[[package]]
name = "darling_core"
version = "0.12.4"
version = "0.14.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e91455b86830a1c21799d94524df0845183fa55bafd9aa137b01c7d1065fa36"
checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0"
dependencies = [
"fnv",
"ident_case",
@ -581,11 +585,11 @@ dependencies = [
[[package]]
name = "darling_macro"
version = "0.12.4"
version = "0.14.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "29b5acf0dea37a7f66f7b25d2c5e93fd46f8f6968b1a5d7a3e02e97768afc95a"
checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e"
dependencies = [
"darling_core 0.12.4",
"darling_core 0.14.4",
"quote",
"syn",
]
@ -632,18 +636,6 @@ dependencies = [
"syn",
]
[[package]]
name = "derive_more"
version = "0.99.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f82b1b72f1263f214c0f823371768776c4f5841b942c9883aa8e5ec584fd0ba6"
dependencies = [
"convert_case",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "diff"
version = "0.1.12"
@ -694,9 +686,9 @@ checksum = "4bb454f0228b18c7f4c3b0ebbee346ed9c52e7443b0999cd543ff3571205701d"
[[package]]
name = "dubp"
version = "0.57.0"
version = "0.58.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "66f0006f2695beb0ebeaf9018bf7fc16f92ad2a60bc5522ca9813d257dc501f4"
checksum = "429ad631310968b6f0ef8b0621ff685ff03a1f69304174c7d8e7dbed47ec68aa"
dependencies = [
"dubp-block",
"dubp-common",
@ -710,9 +702,9 @@ dependencies = [
[[package]]
name = "dubp-block"
version = "0.57.0"
version = "0.58.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4524d9bfb9dff0857d705663138dfc3de0761a322ed7c9a429f2777411f3395c"
checksum = "8481be98e093e9f599ef685f8b2880ac273145ce4b12bae45a6fe28b158acb38"
dependencies = [
"dubp-documents",
"dubp-documents-parser",
@ -725,9 +717,9 @@ dependencies = [
[[package]]
name = "dubp-common"
version = "0.57.0"
version = "0.58.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "270b8470070985a1291e0bde3ec76b61b79a148be135a6d2e372e699b5c50d1c"
checksum = "ab01b4870cd960917b638dfd951996dcb19850fdc9868a46d81c7a48c1882f2a"
dependencies = [
"dup-crypto",
"serde",
@ -738,9 +730,9 @@ dependencies = [
[[package]]
name = "dubp-documents"
version = "0.57.0"
version = "0.58.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd04417e58905daf5e0a7c392e6deb19c6503f6d1aaff92fd12895d701681427"
checksum = "38c2667a2c02b657ecce47a2f8d421ddd8f193a77277518aa74585bd42303246"
dependencies = [
"beef",
"dubp-wallet",
@ -752,9 +744,9 @@ dependencies = [
[[package]]
name = "dubp-documents-parser"
version = "0.57.0"
version = "0.58.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f4e2aa1ce0bd09b26f710ba725e55901ec0ec47fbe26b43b26071f8cf439962"
checksum = "9597df5d36e1e269802341908d8970d58ccde6162b402748f8b8b1bd50c1bec6"
dependencies = [
"dubp-documents",
"json-pest-parser",
@ -766,9 +758,9 @@ dependencies = [
[[package]]
name = "dubp-wallet"
version = "0.57.0"
version = "0.58.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c8ee60a2d7fe343782fa4ab3e281e23cdf4313d8ffb029d64bb600dd53a347bb"
checksum = "d044529bbf5928e9519b9040516365e6e20f2d65f8c8e565930f5561b8ff0126"
dependencies = [
"byteorder",
"dubp-common",
@ -781,7 +773,7 @@ dependencies = [
[[package]]
name = "dubp-wot"
version = "0.11.0"
source = "git+https://git.duniter.org/nodes/rust/duniter-core#56dd9795ec8e2ee053f4c8ce9e020bd1e335300d"
source = "git+https://git.duniter.org/nodes/rust/duniter-core#eebd168525aa1d1424ad12ad71da768471207d83"
dependencies = [
"log",
"once_cell",
@ -793,7 +785,7 @@ dependencies = [
[[package]]
name = "duniter-bc-reader"
version = "0.1.0"
source = "git+https://git.duniter.org/nodes/rust/duniter-core#56dd9795ec8e2ee053f4c8ce9e020bd1e335300d"
source = "git+https://git.duniter.org/nodes/rust/duniter-core#eebd168525aa1d1424ad12ad71da768471207d83"
dependencies = [
"anyhow",
"dubp",
@ -824,9 +816,9 @@ dependencies = [
[[package]]
name = "duniter-bda-types"
version = "0.57.0"
version = "0.58.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "023475a8fefc5dc75f150d3fb0afea984df5be359e1eb061f37a18a1b74be9e7"
checksum = "a04e49bc24390430f986d07c43a5cafd431ded3954d31d554efd6c34b77c2788"
dependencies = [
"arrayvec 0.7.0",
"bincode",
@ -840,7 +832,7 @@ dependencies = [
[[package]]
name = "duniter-conf"
version = "0.1.0"
source = "git+https://git.duniter.org/nodes/rust/duniter-core#56dd9795ec8e2ee053f4c8ce9e020bd1e335300d"
source = "git+https://git.duniter.org/nodes/rust/duniter-core#eebd168525aa1d1424ad12ad71da768471207d83"
dependencies = [
"anyhow",
"dubp",
@ -854,7 +846,7 @@ dependencies = [
[[package]]
name = "duniter-core"
version = "1.8.1"
source = "git+https://git.duniter.org/nodes/rust/duniter-core#56dd9795ec8e2ee053f4c8ce9e020bd1e335300d"
source = "git+https://git.duniter.org/nodes/rust/duniter-core#eebd168525aa1d1424ad12ad71da768471207d83"
dependencies = [
"dubp",
"dubp-wot",
@ -869,7 +861,7 @@ dependencies = [
[[package]]
name = "duniter-dbs"
version = "0.1.0"
source = "git+https://git.duniter.org/nodes/rust/duniter-core#56dd9795ec8e2ee053f4c8ce9e020bd1e335300d"
source = "git+https://git.duniter.org/nodes/rust/duniter-core#eebd168525aa1d1424ad12ad71da768471207d83"
dependencies = [
"arrayvec 0.7.0",
"bincode",
@ -892,7 +884,7 @@ dependencies = [
[[package]]
name = "duniter-dbs-write-ops"
version = "0.1.0"
source = "git+https://git.duniter.org/nodes/rust/duniter-core#56dd9795ec8e2ee053f4c8ce9e020bd1e335300d"
source = "git+https://git.duniter.org/nodes/rust/duniter-core#eebd168525aa1d1424ad12ad71da768471207d83"
dependencies = [
"chrono",
"dubp",
@ -907,7 +899,7 @@ dependencies = [
[[package]]
name = "duniter-global"
version = "1.8.1"
source = "git+https://git.duniter.org/nodes/rust/duniter-core#56dd9795ec8e2ee053f4c8ce9e020bd1e335300d"
source = "git+https://git.duniter.org/nodes/rust/duniter-core#eebd168525aa1d1424ad12ad71da768471207d83"
dependencies = [
"async-rwlock",
"dubp",
@ -927,7 +919,7 @@ dependencies = [
"async-graphql",
"async-mutex",
"async-trait",
"bytes 1.0.1",
"bytes",
"duniter-bda",
"duniter-core",
"duniter-gva-conf",
@ -1041,7 +1033,7 @@ dependencies = [
[[package]]
name = "duniter-mempools"
version = "0.1.0"
source = "git+https://git.duniter.org/nodes/rust/duniter-core#56dd9795ec8e2ee053f4c8ce9e020bd1e335300d"
source = "git+https://git.duniter.org/nodes/rust/duniter-core#eebd168525aa1d1424ad12ad71da768471207d83"
dependencies = [
"dubp",
"duniter-bc-reader",
@ -1054,7 +1046,7 @@ dependencies = [
[[package]]
name = "duniter-module"
version = "0.1.0"
source = "git+https://git.duniter.org/nodes/rust/duniter-core#56dd9795ec8e2ee053f4c8ce9e020bd1e335300d"
source = "git+https://git.duniter.org/nodes/rust/duniter-core#eebd168525aa1d1424ad12ad71da768471207d83"
dependencies = [
"anyhow",
"async-mutex",
@ -1073,9 +1065,9 @@ dependencies = [
[[package]]
name = "duniter-peer"
version = "0.57.0"
version = "0.58.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1604f510b17e284453cb06f46a9304be9ed65728163ac35f3b22cd5f058952d3"
checksum = "952ebba568abb1a8a1a7f83ff960a88b4c1de9cd29c74c6885ecc83ca56cccaf"
dependencies = [
"beef",
"dubp-common",
@ -1088,9 +1080,9 @@ dependencies = [
[[package]]
name = "dup-crypto"
version = "0.57.0"
version = "0.58.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "83e883538079a059b2126a94a13e1d1c62a3a93cd14174eea9d4dd3b4f40cb73"
checksum = "f74bc2e8282dd156cd62e54686bc77a22dbaa711facac93b27d6f2c72ff5d07a"
dependencies = [
"base64",
"blake3",
@ -1181,6 +1173,15 @@ dependencies = [
"num_cpus",
]
[[package]]
name = "fast_chemail"
version = "0.9.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "495a39d30d624c2caabe6312bfead73e7717692b44e0b32df168c275a2e8e9e4"
dependencies = [
"ascii_utils",
]
[[package]]
name = "flate2"
version = "1.0.20"
@ -1419,7 +1420,7 @@ version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc018e188373e2777d0ef2467ebff62a08e66c3f5857b23c8fbec3018210dc00"
dependencies = [
"bytes 1.0.1",
"bytes",
"fnv",
"futures-core",
"futures-sink",
@ -1446,7 +1447,7 @@ checksum = "f0b7591fb62902706ae8e7aaff416b1b0fa2c0fd0878b46dc13baa3712d8a855"
dependencies = [
"base64",
"bitflags",
"bytes 1.0.1",
"bytes",
"headers-core",
"http",
"mime",
@ -1493,7 +1494,7 @@ version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "527e8c9ac747e28542699a951517aa9a6945af506cd1f2e1b53a576c17b6cc11"
dependencies = [
"bytes 1.0.1",
"bytes",
"fnv",
"itoa",
]
@ -1504,7 +1505,7 @@ version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5dfb77c123b4e2f72a2069aeae0b4b4949cc7e966df277813fc16347e7549737"
dependencies = [
"bytes 1.0.1",
"bytes",
"http",
"pin-project-lite",
]
@ -1527,7 +1528,7 @@ version = "0.14.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f006b8784cfb01fe7aa9c46f5f5cd4cf5c85a8c612a0653ec97642979062665"
dependencies = [
"bytes 1.0.1",
"bytes",
"futures-channel",
"futures-core",
"futures-util",
@ -1585,6 +1586,7 @@ checksum = "824845a0bf897a9042383849b02c1bc219c2383772efcd5c6f9766fa4b81aef3"
dependencies = [
"autocfg",
"hashbrown",
"serde",
]
[[package]]
@ -1593,7 +1595,7 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f97967975f448f1a7ddb12b0bc41069d09ed6a1c161a92687e057325db35d413"
dependencies = [
"bytes 1.0.1",
"bytes",
]
[[package]]
@ -1641,7 +1643,7 @@ dependencies = [
[[package]]
name = "kv_typed"
version = "0.1.0"
source = "git+https://git.duniter.org/nodes/rust/duniter-core#56dd9795ec8e2ee053f4c8ce9e020bd1e335300d"
source = "git+https://git.duniter.org/nodes/rust/duniter-core#eebd168525aa1d1424ad12ad71da768471207d83"
dependencies = [
"byteorder",
"cfg-if 0.1.10",
@ -1716,9 +1718,9 @@ dependencies = [
[[package]]
name = "log"
version = "0.4.14"
version = "0.4.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710"
checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
dependencies = [
"cfg-if 1.0.0",
]
@ -1737,9 +1739,9 @@ checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
[[package]]
name = "memchr"
version = "2.3.4"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525"
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
[[package]]
name = "memoffset"
@ -1827,21 +1829,20 @@ dependencies = [
[[package]]
name = "multer"
version = "1.2.2"
version = "2.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99851e6ad01b0fbe086dda2dea00d68bb84fc7d7eae2c39ca7313da9197f4d31"
checksum = "6ed4198ce7a4cbd2a57af78d28c6fbb57d81ac5f1d6ad79ac6c5587419cbdf22"
dependencies = [
"bytes 0.5.6",
"derive_more",
"bytes",
"encoding_rs",
"futures",
"futures-util",
"http",
"httparse",
"lazy_static",
"log",
"memchr",
"mime",
"regex",
"twoway 0.2.1",
"spin 0.9.6",
"version_check",
]
[[package]]
@ -1859,7 +1860,7 @@ dependencies = [
"rand 0.7.3",
"safemem",
"tempfile",
"twoway 0.1.8",
"twoway",
]
[[package]]
@ -2170,11 +2171,11 @@ checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086"
[[package]]
name = "proc-macro2"
version = "1.0.26"
version = "1.0.52"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a152013215dca273577e18d2bf00fa862b89b24169fb78c4c95aeb07992c9cec"
checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224"
dependencies = [
"unicode-xid",
"unicode-ident",
]
[[package]]
@ -2205,9 +2206,9 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
[[package]]
name = "quote"
version = "1.0.9"
version = "1.0.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7"
checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc"
dependencies = [
"proc-macro2",
]
@ -2345,9 +2346,9 @@ dependencies = [
[[package]]
name = "regex"
version = "1.4.5"
version = "1.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "957056ecddbeba1b26965114e191d2e8589ce74db242b6ea25fc4062427a5c19"
checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733"
dependencies = [
"aho-corasick",
"memchr",
@ -2356,9 +2357,9 @@ dependencies = [
[[package]]
name = "regex-syntax"
version = "0.6.23"
version = "0.6.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548"
checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848"
[[package]]
name = "remove_dir_all"
@ -2384,7 +2385,7 @@ dependencies = [
"cc",
"libc",
"once_cell",
"spin",
"spin 0.5.2",
"untrusted",
"web-sys",
"winapi",
@ -2568,6 +2569,12 @@ version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
[[package]]
name = "spin"
version = "0.9.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5d6e0250b93c8427a177b849d144a96d5acc57006149479403d7861ab721e34"
[[package]]
name = "spinning_top"
version = "0.2.3"
@ -2633,13 +2640,13 @@ checksum = "1e81da0851ada1f3e9d4312c704aa4f8806f0f9d69faaf8df2f3464b4a9437c2"
[[package]]
name = "syn"
version = "1.0.70"
version = "1.0.109"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9505f307c872bab8eb46f77ae357c8eba1fdacead58ee5a850116b1d7f82883"
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
dependencies = [
"proc-macro2",
"quote",
"unicode-xid",
"unicode-ident",
]
[[package]]
@ -2730,7 +2737,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "83f0c8e7c0addab50b663055baf787d0af7f413a46e6e7fb9559a4e4db7137a5"
dependencies = [
"autocfg",
"bytes 1.0.1",
"bytes",
"libc",
"memchr",
"mio",
@ -2780,7 +2787,7 @@ version = "0.6.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "940a12c99365c31ea8dd9ba04ec1be183ffe4920102bb7122c2f515437601e8e"
dependencies = [
"bytes 1.0.1",
"bytes",
"futures-core",
"futures-sink",
"log",
@ -2901,7 +2908,7 @@ checksum = "8ada8297e8d70872fa9a551d93250a9f407beb9f37ef86494eb20012a2ff7c24"
dependencies = [
"base64",
"byteorder",
"bytes 1.0.1",
"bytes",
"http",
"httparse",
"input_buffer",
@ -2921,16 +2928,6 @@ dependencies = [
"memchr",
]
[[package]]
name = "twoway"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b40075910de3a912adbd80b5d8bad6ad10a23eeb1f5bf9d4006839e899ba5bc"
dependencies = [
"memchr",
"unchecked-index",
]
[[package]]
name = "typenum"
version = "1.13.0"
@ -2943,12 +2940,6 @@ version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c"
[[package]]
name = "unchecked-index"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eeba86d422ce181a719445e51872fa30f1f7413b62becb52e95ec91aa262d85c"
[[package]]
name = "unicase"
version = "2.6.0"
@ -2967,6 +2958,12 @@ dependencies = [
"matches",
]
[[package]]
name = "unicode-ident"
version = "1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4"
[[package]]
name = "unicode-normalization"
version = "0.1.17"
@ -3064,7 +3061,7 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "332d47745e9a0c38636dbd454729b147d16bd1ed08ae67b3ab281c4506771054"
dependencies = [
"bytes 1.0.1",
"bytes",
"futures",
"headers",
"http",

View file

@ -9,7 +9,7 @@ repository = "https://git.duniter.org/nodes/rust/modules/duniter-gva"
[dependencies]
anyhow = "1.0.33"
arrayvec = { version = "0.7", features = ["serde"] }
async-graphql = { version = "2.8", features = ["log"] }
async-graphql = { version = "4.0", features = ["log"] }
async-mutex = "1.4.0"
async-trait = "0.1.41"
bytes = "1.0"
@ -41,6 +41,7 @@ tokio = { version = "1.2", features = ["macros", "rt-multi-thread", "time"] }
unwrap = "1.2.1"
[features]
default = ["explorer"]
explorer = ["duniter-gva-db/explorer", "duniter-gva-indexer/explorer"]
[workspace]

View file

@ -20,6 +20,7 @@ mod members_count;
mod peers;
mod prepare_simple_payment;
mod send_txs;
mod sync;
mod utxos;
use duniter_core::crypto::keys::KeyPair;
@ -47,30 +48,26 @@ pub(super) async fn execute_req_type(
BcaReqTypeV0::BalancesOfPubkeys(pubkeys) => {
balances::exec_req_balances_of_pubkeys(bda_executor, pubkeys).await
}
BcaReqTypeV0::BalancesOfScripts(scripts) => {
balances::exec_req_balances_of_scripts(bda_executor, scripts).await
}
BcaReqTypeV0::CompressedBlockChunk { chunk_id } => {
sync::exec_req_compressed_block_chunk(bda_executor, chunk_id).await
}
BcaReqTypeV0::CurrentBlockstamp => {
if let Some(current_meta) = bda_executor.cm_accessor.get_current_meta(|cm| *cm).await {
Ok(BcaRespTypeV0::CurrentBlockstamp(
current_meta.current_block_meta.blockstamp(),
))
} else {
Err("no blockchain".into())
}
}
BcaReqTypeV0::CurrentUd => current_ud::exec_req_current_ud(bda_executor).await,
BcaReqTypeV0::FirstUtxosOfPubkeys {
amount_target_opt,
pubkeys,
} => utxos::exec_req_first_utxos_of_pubkeys(bda_executor, amount_target_opt, pubkeys).await,
BcaReqTypeV0::LastBlockstampOutOfForkWindow => {
last_blockstamp_out_of_fork_window::exec_req_last_blockstamp_out_of_fork_window(
bda_executor,
)
.await
}
BcaReqTypeV0::MembersCount => members_count::exec_req_members_count(bda_executor).await,
BcaReqTypeV0::PrepareSimplePayment(params) => {
prepare_simple_payment::exec_req_prepare_simple_payment(bda_executor, params).await
}
BcaReqTypeV0::ProofServerPubkey { challenge } => Ok(BcaRespTypeV0::ProofServerPubkey {
challenge,
server_pubkey: bda_executor.self_keypair.public_key(),
sig: bda_executor
.self_keypair
.generate_signator()
.sign(&challenge),
}),
BcaReqTypeV0::Ping => Ok(BcaRespTypeV0::Pong),
BcaReqTypeV0::SendTxs(txs) => send_txs::send_txs(bda_executor, txs).await,
BcaReqTypeV0::Identities(pubkeys) => {
let dbs_reader = bda_executor.dbs_reader();
Ok(BcaRespTypeV0::Identities(
@ -92,10 +89,27 @@ pub(super) async fn execute_req_type(
.await??,
))
}
BcaReqTypeV0::CurrentUd => current_ud::exec_req_current_ud(bda_executor).await,
BcaReqTypeV0::BalancesOfScripts(scripts) => {
balances::exec_req_balances_of_scripts(bda_executor, scripts).await
BcaReqTypeV0::LastBlockstampOutOfForkWindow => {
last_blockstamp_out_of_fork_window::exec_req_last_blockstamp_out_of_fork_window(
bda_executor,
)
.await
}
BcaReqTypeV0::MembersCount => members_count::exec_req_members_count(bda_executor).await,
BcaReqTypeV0::PrepareSimplePayment(params) => {
prepare_simple_payment::exec_req_prepare_simple_payment(bda_executor, params).await
}
BcaReqTypeV0::ProofServerPubkey { challenge } => Ok(BcaRespTypeV0::ProofServerPubkey {
challenge,
server_pubkey: bda_executor.self_keypair.public_key(),
sig: bda_executor
.self_keypair
.generate_signator()
.sign(&challenge),
}),
BcaReqTypeV0::Ping => Ok(BcaRespTypeV0::Pong),
BcaReqTypeV0::PeersV10 { n } => peers::exec_req_peers_v1(bda_executor, n).await,
BcaReqTypeV0::SendTxs(txs) => send_txs::send_txs(bda_executor, txs).await,
BcaReqTypeV0::Sync { from, to } => sync::exec_req_sync(bda_executor, from, to).await,
}
}

View file

@ -0,0 +1,96 @@
// Copyright (C) 2020 Éloïs SANCHEZ.
//
// 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/>.
use crate::*;
use duniter_core::bda_types::peer::Peer;
use duniter_gva_db::BLOCKS_CHUNK_SIZE;
pub(super) async fn exec_req_compressed_block_chunk(
bda_executor: &BdaExecutor,
chunk_id: usize,
) -> Result<BcaRespTypeV0, ExecReqTypeError> {
if let Some(ref profile_path) = bda_executor.profile_path_opt {
let chunks_folder_path = profile_path.join("data/gva_v1_blocks_chunks");
if let Some(chunk_data) = duniter_gva_dbs_reader::blocks_chunks::read_compressed_chunk(
chunk_id as u32,
&chunks_folder_path,
false,
)? {
Ok(BcaRespTypeV0::CompressedBlockChunk {
chunk_id,
compressed_data: chunk_data,
})
} else {
Err("not found".into())
}
} else {
Err("Cannot get compressed block chunk in memony mode".into())
}
}
pub(super) async fn exec_req_sync(
bda_executor: &BdaExecutor,
from: u32,
to_opt: Option<u32>,
) -> Result<BcaRespTypeV0, ExecReqTypeError> {
let (target_blockstamp, last_chunk_id_opt) = if let Some(to) = to_opt {
if to < from {
return Err("to < from".into());
}
let dbs_reader = bda_executor.dbs_reader();
if let Some(block_meta) = bda_executor
.dbs_pool
.execute(move |shared_dbs| dbs_reader.block(&shared_dbs.bc_db_ro, U32BE(to)))
.await??
{
(block_meta.blockstamp(), Some(to / BLOCKS_CHUNK_SIZE))
} else {
return Err("Not enough blocks, try another server".into());
}
} else if let Some(current_meta) = bda_executor.cm_accessor.get_current_meta(|cm| *cm).await {
(current_meta.current_block_meta.blockstamp(), None)
} else {
return Err("no blockchain".into());
};
let first_chunk_id = (from + 1) / BLOCKS_CHUNK_SIZE;
let dbs_reader = bda_executor.dbs_reader();
let (peers, blocks_chunks_hashs) = bda_executor
.dbs_pool
.execute(move |shared_dbs| {
Ok::<_, KvError>((
dbs_reader
.get_some_peers(&shared_dbs.dunp_db, 0)?
.into_iter()
.map(|peer_db| Peer {
peer: peer_db.peer,
is_member: peer_db.member,
is_up: peer_db.status,
})
.collect(),
dbs_reader.blocks_chunks_hashs(first_chunk_id, last_chunk_id_opt)?,
))
})
.await??;
Ok(BcaRespTypeV0::Sync {
blocks_chunks_hashs,
peers,
target_blockstamp,
})
}

View file

@ -24,9 +24,7 @@
mod exec_req_type;
const MAX_BATCH_SIZE: usize = 10;
const RESP_MIN_SIZE: usize = 64;
type RespBytes = SmallVec<[u8; RESP_MIN_SIZE]>;
pub use duniter_core::dbs::kv_typed::prelude::*;
use crate::exec_req_type::ExecReqTypeError;
#[cfg(test)]
@ -40,17 +38,20 @@ use duniter_core::bda_types::{
BcaResp, BcaRespTypeV0, BcaRespV0,
};
use duniter_core::crypto::keys::{ed25519::Ed25519KeyPair, Signator};
pub use duniter_core::dbs::kv_typed::prelude::*;
use duniter_core::dbs::{FileBackend, SharedDbs};
#[cfg(not(test))]
use duniter_core::global::AsyncAccessor;
use duniter_gva_dbs_reader::DbsReader;
use futures::{prelude::stream::FuturesUnordered, StreamExt, TryStream, TryStreamExt};
use once_cell::sync::OnceCell;
use smallvec::SmallVec;
use std::path::PathBuf;
use tokio::task::JoinError;
const MAX_BATCH_SIZE: usize = 10;
const RESP_MIN_SIZE: usize = 64;
type RespBytes = SmallVec<[u8; RESP_MIN_SIZE]>;
#[cfg(test)]
use crate::tests::DbsReaderImpl;
#[cfg(not(test))]
@ -58,11 +59,13 @@ use duniter_gva_dbs_reader::DbsReaderImpl;
static BDA_EXECUTOR: OnceCell<BdaExecutor> = OnceCell::new();
#[allow(clippy::too_many_arguments)]
pub fn set_bda_executor(
currency: String,
cm_accessor: AsyncAccessor,
dbs_pool: fast_threadpool::ThreadPoolAsyncHandler<SharedDbs<FileBackend>>,
dbs_reader: DbsReaderImpl,
profile_path_opt: Option<PathBuf>,
self_keypair: Ed25519KeyPair,
software_version: &'static str,
txs_mempool: duniter_core::mempools::TxsMempool,
@ -73,6 +76,7 @@ pub fn set_bda_executor(
cm_accessor,
dbs_pool,
dbs_reader,
profile_path_opt,
self_keypair,
software_version,
txs_mempool,
@ -100,6 +104,7 @@ struct BdaExecutor {
currency: String,
dbs_pool: fast_threadpool::ThreadPoolAsyncHandler<SharedDbs<FileBackend>>,
dbs_reader: DbsReaderImpl,
profile_path_opt: Option<PathBuf>,
self_keypair: Ed25519KeyPair,
software_version: &'static str,
txs_mempool: duniter_core::mempools::TxsMempool,
@ -264,6 +269,7 @@ mod tests {
currency: "g1".to_owned(),
dbs_pool: threadpool.into_async_handler(),
dbs_reader: duniter_core::dbs::kv_typed::prelude::Arc::new(mock_dbs_reader),
profile_path_opt: None,
self_keypair: Ed25519KeyPair::from_seed(
Seed32::random().expect("fail to gen random seed"),
),

View file

@ -49,6 +49,8 @@ pub(crate) use duniter_core::wot::WotId;
pub(crate) use serde::{Deserialize, Serialize};
pub(crate) use std::collections::BTreeSet;
pub const BLOCKS_CHUNK_SIZE: u32 = 4_096;
db_schema!(
GvaV1,
[

View file

@ -19,6 +19,26 @@ use flate2::read::ZlibDecoder;
pub const CHUNK_FILE_PREFIX: &str = "_";
pub const CHUNK_FILE_EXT: &str = ".bin.gz";
impl DbsReaderImpl {
pub(super) fn blocks_chunks_hashs_(
&self,
from: u32,
to_opt: Option<u32>,
) -> KvResult<Vec<Hash>> {
if let Some(to) = to_opt {
self.0
.blocks_chunk_hash()
.iter(U32BE(from)..=U32BE(to), |it| {
it.values().map_ok(|hash_db| hash_db.0).collect()
})
} else {
self.0.blocks_chunk_hash().iter(U32BE(from).., |it| {
it.values().map_ok(|hash_db| hash_db.0).collect()
})
}
}
}
/// Read and decompress chunk file
pub fn read_compressed_chunk(
chunk_index: u32,

View file

@ -86,6 +86,7 @@ pub trait DbsReader {
bc_db: &BcV2DbRo<FileBackend>,
page_info: PageInfo<block::BlockCursor>,
) -> KvResult<PagedData<Vec<(block::BlockCursor, BlockMetaV2)>>>;
fn blocks_chunks_hashs(&self, from: u32, to_opt: Option<u32>) -> KvResult<Vec<Hash>>;
fn endpoints<Db: 'static + NetworkV1DbReadable>(
&self,
network_db: &Db,
@ -229,6 +230,10 @@ impl DbsReader for DbsReaderImpl {
self.blocks_(bc_db, page_info)
}
fn blocks_chunks_hashs(&self, from: u32, to_opt: Option<u32>) -> KvResult<Vec<Hash>> {
self.blocks_chunks_hashs_(from, to_opt)
}
fn endpoints<Db: 'static + NetworkV1DbReadable>(
&self,
network_db: &Db,

View file

@ -8,7 +8,7 @@ edition = "2018"
[dependencies]
anyhow = "1.0.33"
arrayvec = { version = "0.7", features = ["serde"] }
async-graphql = { version = "2.8", features = ["log"] }
async-graphql = { version = "4.0", features = ["log"] }
async-trait = "0.1.41"
duniter-core = { git = "https://git.duniter.org/nodes/rust/duniter-core" }
duniter-gva-db = { path = "../db" }

View file

@ -33,6 +33,31 @@ pub(crate) struct AmountWithBase {
pub(crate) amount: i32,
pub(crate) base: i32,
}
impl AmountWithBase {
fn increment_base(self) -> Self {
Self {
amount: self.amount / 10,
base: self.base + 1,
}
}
}
impl std::ops::Add for AmountWithBase {
type Output = Self;
fn add(self, rhs: Self) -> Self::Output {
#[allow(clippy::comparison_chain)]
if self.base == rhs.base {
Self {
amount: self.amount + rhs.amount,
base: self.base,
}
} else if self.base > rhs.base {
self.add(rhs.increment_base())
} else {
self.increment_base().add(rhs)
}
}
}
impl From<SourceAmount> for AmountWithBase {
fn from(sa: SourceAmount) -> Self {
Self {
@ -41,6 +66,11 @@ impl From<SourceAmount> for AmountWithBase {
}
}
}
impl std::iter::Sum for AmountWithBase {
fn sum<I: Iterator<Item = Self>>(iter: I) -> Self {
iter.fold(AmountWithBase::default(), std::ops::Add::add)
}
}
#[derive(async_graphql::SimpleObject)]
pub(crate) struct EdgeTx {

View file

@ -32,7 +32,7 @@ impl WalletsQuery {
#[graphql(desc = "minimal balance")] min_balance: Option<i64>,
#[graphql(desc = "pagination", default)] pagination: Pagination,
#[graphql(desc = "Wallet type filter", default)] wallet_type_filter: WalletTypeFilter,
) -> async_graphql::Result<Connection<String, Wallet, EmptyFields, EmptyFields>> {
) -> async_graphql::Result<Connection<String, Wallet, AggregateSum, EmptyFields>> {
let QueryContext { is_whitelisted } = ctx.data::<QueryContext>()?;
let data = ctx.data::<GvaSchemaData>()?;
@ -160,7 +160,19 @@ impl WalletsQuery {
}
};
let mut conn = Connection::new(has_previous_page, has_next_page);
let sum = if ctx.look_ahead().field("aggregate").field("sum").exists() {
data.iter().map(|wallet| wallet.balance).sum()
} else {
AmountWithBase::default()
};
let mut conn = Connection::with_additional_fields(
has_previous_page,
has_next_page,
AggregateSum {
aggregate: Sum { sum },
},
);
conn.append(
data.into_iter()

View file

@ -18,8 +18,6 @@ use duniter_gva_dbs_reader::blocks_chunks::{CHUNK_FILE_EXT, CHUNK_FILE_PREFIX};
use flate2::write::ZlibEncoder;
use flate2::Compression;
const CHUNK_SIZE: u32 = 4_096;
pub fn apply_block_blocks_chunk<B: Backend>(
block: &DubpBlockV10,
gva_db: &GvaV1Db<B>,
@ -33,7 +31,7 @@ pub fn apply_block_blocks_chunk<B: Backend>(
GvaBlockDbV1(DubpBlock::V10(block.clone())),
)?;
if (block_number + 1) % CHUNK_SIZE == 0 {
if (block_number + 1) % BLOCKS_CHUNK_SIZE == 0 {
let current_chunk: Vec<GvaBlockDbV1> = gva_db
.current_blocks_chunk()
.iter(.., |it| it.values().collect::<Result<Vec<_>, _>>())?;
@ -41,7 +39,7 @@ pub fn apply_block_blocks_chunk<B: Backend>(
.serialize(&current_chunk)
.map_err(|e| KvError::DeserError(e.into()))?;
let chunk_hash = Hash::compute_blake3(current_chunk_bin.as_ref());
let chunk_index = U32BE(block_number / CHUNK_SIZE);
let chunk_index = U32BE(block_number / BLOCKS_CHUNK_SIZE);
gva_db
.blocks_chunk_hash_write()
.upsert(chunk_index, HashDb(chunk_hash))?;
@ -66,9 +64,9 @@ pub fn revert_block_blocks_chunk<B: Backend>(
let block_number = block.number().0;
let chunks_folder_path = profile_path.join("data/gva_v1_blocks_chunks");
gva_db.write(|mut db| {
if (block_number + 1) % CHUNK_SIZE == 0 {
if (block_number + 1) % BLOCKS_CHUNK_SIZE == 0 {
// Uncompress last compressed chunk and replace it in current chunk
let chunk_index = U32BE(block_number / CHUNK_SIZE);
let chunk_index = U32BE(block_number / BLOCKS_CHUNK_SIZE);
if let Some(current_chunk_bin) =
duniter_gva_dbs_reader::blocks_chunks::read_compressed_chunk(
chunk_index.0,
@ -81,7 +79,7 @@ pub fn revert_block_blocks_chunk<B: Backend>(
let current_chunk: Vec<GvaBlockDbV1> = bincode_db()
.deserialize(current_chunk_bin.as_ref())
.map_err(|e| KvError::DeserError(e.into()))?;
let current_chunk_begin = block_number - CHUNK_SIZE + 1;
let current_chunk_begin = block_number - BLOCKS_CHUNK_SIZE + 1;
for (i, block) in current_chunk.into_iter().enumerate() {
db.current_blocks_chunk
.upsert(U32BE(current_chunk_begin + i as u32), block);

View file

@ -46,7 +46,10 @@ use duniter_gva_db::*;
use duniter_gva_gql::{GvaSchema, QueryContext};
use duniter_gva_indexer::{get_gva_db_ro, get_gva_db_rw};
use futures::{StreamExt, TryStreamExt};
use std::{convert::Infallible, path::Path};
use std::{
convert::Infallible,
path::{Path, PathBuf},
};
#[cfg(test)]
use tests::get_public_ips;
use warp::{http::Response as HttpResponse, Filter as _, Rejection};
@ -62,6 +65,7 @@ pub struct GvaModule {
gva_db_ro: &'static GvaV1DbRo<FileBackend>,
mempools: Mempools,
mode: DuniterMode,
profile_path_opt: Option<PathBuf>,
self_keypair: Ed25519KeyPair,
software_version: &'static str,
}
@ -125,6 +129,7 @@ impl duniter_core::module::DuniterModule for GvaModule {
gva_db_ro: get_gva_db_ro(profile_path_opt),
mempools,
mode,
profile_path_opt: profile_path_opt.map(ToOwned::to_owned),
self_keypair,
software_version,
},
@ -142,6 +147,7 @@ impl duniter_core::module::DuniterModule for GvaModule {
gva_db_ro,
mempools,
mode,
profile_path_opt,
self_keypair,
software_version,
} = self;
@ -154,6 +160,7 @@ impl duniter_core::module::DuniterModule for GvaModule {
dbs_pool,
gva_db_ro,
mempools,
profile_path_opt,
self_keypair,
software_version,
)
@ -235,12 +242,14 @@ impl duniter_core::module::DuniterModule for GvaModule {
}
impl GvaModule {
#[allow(clippy::too_many_arguments)]
async fn start_inner(
conf: GvaConf,
currency: String,
dbs_pool: fast_threadpool::ThreadPoolAsyncHandler<SharedDbs<FileBackend>>,
gva_db_ro: &'static GvaV1DbRo<FileBackend>,
mempools: Mempools,
profile_path_opt: Option<PathBuf>,
self_keypair: Ed25519KeyPair,
software_version: &'static str,
) {
@ -253,6 +262,7 @@ impl GvaModule {
AsyncAccessor::new(),
dbs_pool.clone(),
duniter_gva_dbs_reader::create_dbs_reader(gva_db_ro),
profile_path_opt,
self_keypair,
software_version,
mempools.txs,