diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 663c84a52..732efac14 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -28,13 +28,13 @@ The development team will be happy to help and guide you with any of these point When you are starting to contribute to grin, we really would appreciate if you come by the gitter chat channels. -In case of problems with trying out grin, before starting to contribute, there's the [Support chat](https://gitter.im/grin_community/support). Write there about what you've done, what you want to do, and maybe paste logs through a text paste webservice. +In case of problems with trying out grin, before starting to contribute, there's the [grincoin#support](https://keybase.io/team/grincoin) on Keybase. Write there about what you've done, what you want to do, and maybe paste logs through a text paste webservice. -* Please [join the grin Lobby](https://gitter.im/grin_community/Lobby) to get a feeling for the community. -* And [see the developers chat](https://gitter.im/grin_community/dev) if you have questions about source code files. +* Please [join the grincoin#general on Keybase](https://keybase.io/team/grincoin) to get a feeling for the community. +* And see the developers chat channel [grincoin#dev on Keybase](https://keybase.io/team/grincoin) if you have questions about source code files. If you explain what you're looking at and what you want to do, we'll try to help you along the way. -* Also see `docs/*.md` and the folder structure explanations, and [the wiki](https://github.com/mimblewimble/docs/wiki). -* Further information and discussions are in the [Forum](https://forum.grin.mw), the [website](https://grin.mw), the [mailing list](https://lists.launchpad.net/mimblewimble/) and news channels like the [@grincouncil](https://twitter.com/grincouncil) and a (mostly unfiltered!) Twitter bot that collects headlines, mailing list posts, and reddit posts related to Mimblewimble/Grin: [@grinmw](https://twitter.com/grinmw) +* See `docs/*.md` and the folder structure explanations, [the wiki](https://github.com/mimblewimble/docs/wiki) and the official [Grin documentation](https://docs.grin.mw/). +* Further information and discussions are in the [Forum](https://forum.grin.mw), the [website](https://grin.mw), the [mailing list](https://lists.launchpad.net/mimblewimble/) and news channels like the [Reddit/grincoin](https://www.reddit.com/r/grincoin/) and a (mostly unfiltered!) Twitter bot that collects headlines, mailing list posts, and reddit posts related to Mimblewimble/Grin: [@grinmw](https://twitter.com/grinmw) ## Testing diff --git a/Cargo.lock b/Cargo.lock index 54ae6824b..e968f8a05 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -114,9 +114,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" -version = "0.3.64" +version = "0.3.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e121dee8023ce33ab248d9ce1493df03c3b38a659b240096fcbd7048ff9c31f" +checksum = "cab84319d616cfb654d03394f38ab7e6f0919e181b1b57e1fd15e7fb4077d9a7" dependencies = [ "addr2line", "cc", @@ -141,9 +141,9 @@ checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" [[package]] name = "base64ct" -version = "1.4.1" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71acf5509fc522cce1b100ac0121c635129bfd4d91cdf036bcc9b9935f97ccf5" +checksum = "3bdca834647821e0b13d9539a8634eb62d3501b6b6c2cec1722786ee6671b851" [[package]] name = "bindgen" @@ -160,8 +160,8 @@ dependencies = [ "lazycell", "log", "peeking_take_while", - "proc-macro2 1.0.36", - "quote 1.0.16", + "proc-macro2 1.0.40", + "quote 1.0.20", "regex", "rustc-hash", "shlex", @@ -217,9 +217,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.9.1" +version = "3.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899" +checksum = "37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3" [[package]] name = "byteorder" @@ -289,7 +289,7 @@ checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" dependencies = [ "libc", "num-integer", - "num-traits 0.2.14", + "num-traits 0.2.15", "serde", "time", "winapi 0.3.9", @@ -297,9 +297,9 @@ dependencies = [ [[package]] name = "clang-sys" -version = "1.3.1" +version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cc00842eed744b858222c4c9faf7243aafc6d33f92f96935263ef4d8a41ce21" +checksum = "5a050e2153c5be08febd6734e29298e844fdb0fa21aeddd63b4eb7baa106c69b" dependencies = [ "glob", "libc", @@ -395,9 +395,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.4" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aaa7bd5fb665c6864b5f963dd9097905c54125909c7aa94c9e18507cdbe6c53" +checksum = "4c02a4d71819009c192cf4872265391563fd6a84c81ff2c0f2a7026ca4c1d85c" dependencies = [ "cfg-if 1.0.0", "crossbeam-utils", @@ -405,12 +405,12 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.8" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38" +checksum = "7d82ee10ce34d7bc12c2122495e7593a9c41347ecdd64185af4ecf72cb1a7f83" dependencies = [ "cfg-if 1.0.0", - "lazy_static", + "once_cell", ] [[package]] @@ -438,15 +438,15 @@ version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f877be4f7c9f246b183111634f75baa039715e3f46ce860677d3b19a69fb229c" dependencies = [ - "quote 1.0.16", - "syn 1.0.89", + "quote 1.0.20", + "syn 1.0.98", ] [[package]] name = "ctrlc" -version = "3.2.1" +version = "3.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a19c6cedffdc8c03a3346d723eb20bd85a13362bb96dc2ac000842c6381ec7bf" +checksum = "b37feaa84e6861e00a1f5e5aa8da3ee56d605c9992d33e082786754828e20865" dependencies = [ "nix", "winapi 0.3.9", @@ -489,7 +489,7 @@ dependencies = [ "log", "num 0.3.1", "owning_ref", - "syn 1.0.89", + "syn 1.0.98", "unicode-segmentation", "unicode-width", "wasmer_enumset", @@ -523,10 +523,10 @@ checksum = "f0c960ae2da4de88a91b2d920c2a7233b400bc33cb28453a2987822d8392519b" dependencies = [ "fnv", "ident_case", - "proc-macro2 1.0.36", - "quote 1.0.16", + "proc-macro2 1.0.40", + "quote 1.0.20", "strsim 0.9.3", - "syn 1.0.89", + "syn 1.0.98", ] [[package]] @@ -536,8 +536,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72" dependencies = [ "darling_core", - "quote 1.0.16", - "syn 1.0.89", + "quote 1.0.20", + "syn 1.0.98", ] [[package]] @@ -617,9 +617,9 @@ version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5c450cf304c9e18d45db562025a14fb1ca0f5c769b6f609309f81d4c31de455" dependencies = [ - "proc-macro2 1.0.36", - "quote 1.0.16", - "syn 1.0.89", + "proc-macro2 1.0.40", + "quote 1.0.20", + "syn 1.0.98", ] [[package]] @@ -657,28 +657,6 @@ dependencies = [ "termcolor", ] -[[package]] -name = "failure" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86" -dependencies = [ - "backtrace", - "failure_derive", -] - -[[package]] -name = "failure_derive" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4" -dependencies = [ - "proc-macro2 1.0.36", - "quote 1.0.16", - "syn 1.0.89", - "synstructure", -] - [[package]] name = "fastrand" version = "1.7.0" @@ -690,25 +668,23 @@ dependencies = [ [[package]] name = "filetime" -version = "0.2.15" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "975ccf83d8d9d0d84682850a38c8169027be83368805971cc4f238c2b245bc98" +checksum = "e94a7bbaa59354bc20dd75b67f23e2797b4490e9d6928203fb105c79e448c86c" dependencies = [ "cfg-if 1.0.0", "libc", - "redox_syscall 0.2.11", - "winapi 0.3.9", + "redox_syscall 0.2.13", + "windows-sys", ] [[package]] name = "flate2" -version = "1.0.22" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e6988e897c1c9c485f43b47a529cef42fde0547f9d8d41a7062518f1d8fc53f" +checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6" dependencies = [ - "cfg-if 1.0.0", "crc32fast", - "libc", "miniz_oxide", ] @@ -820,9 +796,9 @@ version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33c1e13800337f4d4d7a316bf45a567dbcb6ffe087f16424852d97e97a91f512" dependencies = [ - "proc-macro2 1.0.36", - "quote 1.0.16", - "syn 1.0.89", + "proc-macro2 1.0.40", + "quote 1.0.20", + "syn 1.0.98", ] [[package]] @@ -850,7 +826,7 @@ dependencies = [ "futures-sink", "futures-task", "memchr", - "pin-project-lite 0.2.8", + "pin-project-lite 0.2.9", "pin-utils", "slab", ] @@ -873,13 +849,13 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.5" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d39cd93900197114fa1fcb7ae84ca742095eed9442088988ae74fa744e930e77" +checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" dependencies = [ "cfg-if 1.0.0", "libc", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", ] [[package]] @@ -918,8 +894,6 @@ dependencies = [ "ctrlc", "cursive", "cursive_table_view", - "failure", - "failure_derive", "futures 0.3.21", "grin_api", "grin_chain", @@ -943,8 +917,6 @@ version = "5.2.0-alpha.1" dependencies = [ "bytes 0.5.6", "easy-jsonrpc-mw", - "failure", - "failure_derive", "futures 0.3.21", "grin_chain", "grin_core", @@ -964,6 +936,7 @@ dependencies = [ "serde", "serde_derive", "serde_json", + "thiserror", "tokio", "tokio-rustls", "url", @@ -980,8 +953,6 @@ dependencies = [ "croaring", "enum_primitive", "env_logger 0.7.1", - "failure", - "failure_derive", "grin_core", "grin_keychain", "grin_store", @@ -992,6 +963,7 @@ dependencies = [ "rand 0.6.5", "serde", "serde_derive", + "thiserror", ] [[package]] @@ -1020,8 +992,6 @@ dependencies = [ "chrono", "croaring", "enum_primitive", - "failure", - "failure_derive", "grin_keychain", "grin_util", "lazy_static", @@ -1034,6 +1004,7 @@ dependencies = [ "serde_derive", "serde_json", "siphasher", + "thiserror", "zeroize", ] @@ -1086,8 +1057,6 @@ version = "5.2.0-alpha.1" dependencies = [ "blake2-rfc", "chrono", - "failure", - "failure_derive", "grin_chain", "grin_core", "grin_keychain", @@ -1096,6 +1065,7 @@ dependencies = [ "rand 0.6.5", "serde", "serde_derive", + "thiserror", ] [[package]] @@ -1151,8 +1121,6 @@ dependencies = [ "chrono", "croaring", "env_logger 0.7.1", - "failure", - "failure_derive", "filetime", "grin_core", "grin_util", @@ -1164,6 +1132,7 @@ dependencies = [ "serde", "serde_derive", "tempfile", + "thiserror", ] [[package]] @@ -1208,9 +1177,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.11.2" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" +checksum = "607c8a29735385251a339424dd462993c0fed8fa09d378f259377df08c126022" [[package]] name = "heck" @@ -1242,13 +1211,13 @@ dependencies = [ [[package]] name = "http" -version = "0.2.6" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31f4c6746584866f0feabcc69893c5b51beef3831656a968ed7ae254cdc4fd03" +checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" dependencies = [ "bytes 1.1.0", "fnv", - "itoa 1.0.1", + "itoa 1.0.2", ] [[package]] @@ -1263,9 +1232,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.6.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9100414882e15fb7feccb4897e5f0ff0ff1ca7d1a86a23208ada4d7a18e6c6c4" +checksum = "496ce29bb5a52785b44e0f7ca2847ae0bb839c9bd28f69acac9b99d461c0c04c" [[package]] name = "httpdate" @@ -1367,9 +1336,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.8.0" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282a6247722caba404c065016bbfa522806e51714c34f5dfc3e4a3a46fcb4223" +checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" dependencies = [ "autocfg 1.1.0", "hashbrown", @@ -1401,9 +1370,9 @@ checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" [[package]] name = "itoa" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" +checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" [[package]] name = "jobserver" @@ -1416,9 +1385,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.56" +version = "0.3.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a38fc24e30fd564ce974c02bf1d337caddff65be6cc4735a1f7eab22a7440f04" +checksum = "c3fac17f7123a73ca62df411b1bf727ccc805daa070338fda671c86dac1bdc27" dependencies = [ "wasm-bindgen", ] @@ -1460,9 +1429,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.121" +version = "0.2.126" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efaa7b300f3b5fe8eb6bf21ce3895e1751d9665086af2d64b42f19701015ff4f" +checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" [[package]] name = "libgit2-sys" @@ -1498,9 +1467,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.5" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f35facd4a5673cb5a48822be2be1d4236c1c99cb4113cab7061ac720d5bf859" +checksum = "9702761c3935f8cc2f101793272e202c72b99da8f4224a19ddcf1279a6450bbf" dependencies = [ "cc", "libc", @@ -1510,9 +1479,9 @@ dependencies = [ [[package]] name = "linked-hash-map" -version = "0.5.4" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" [[package]] name = "lmdb-zero" @@ -1537,9 +1506,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.16" +version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6389c490849ff5bc16be905ae24bc913a9c8892e19b2341dbc175e14c341c2b8" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" dependencies = [ "cfg-if 1.0.0", "serde", @@ -1599,9 +1568,9 @@ checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" [[package]] name = "memchr" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memmap" @@ -1613,23 +1582,13 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "memoffset" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" -dependencies = [ - "autocfg 1.1.0", -] - [[package]] name = "miniz_oxide" -version = "0.4.4" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b" +checksum = "6f5c75688da582b8ffc1f1799e9db273f32133c49e048f614d22ec3256773ccc" dependencies = [ "adler", - "autocfg 1.1.0", ] [[package]] @@ -1719,15 +1678,13 @@ dependencies = [ [[package]] name = "nix" -version = "0.23.1" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f866317acbd3a240710c63f065ffb1e4fd466259045ccb504130b7f668f35c6" +checksum = "8f17df307904acd05aa8e32e97bb20f2a0df1728bbc2d771ae8f9a90463441e9" dependencies = [ "bitflags 1.3.2", - "cc", "cfg-if 1.0.0", "libc", - "memoffset", ] [[package]] @@ -1757,7 +1714,7 @@ dependencies = [ "num-integer", "num-iter", "num-rational 0.2.4", - "num-traits 0.2.14", + "num-traits 0.2.15", ] [[package]] @@ -1770,7 +1727,7 @@ dependencies = [ "num-integer", "num-iter", "num-rational 0.3.2", - "num-traits 0.2.14", + "num-traits 0.2.15", ] [[package]] @@ -1781,7 +1738,7 @@ checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" dependencies = [ "autocfg 1.1.0", "num-integer", - "num-traits 0.2.14", + "num-traits 0.2.15", ] [[package]] @@ -1791,7 +1748,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6b19411a9719e753aff12e5187b74d60d3dc449ec3f4dc21e3989c3f554bc95" dependencies = [ "autocfg 1.1.0", - "num-traits 0.2.14", + "num-traits 0.2.15", ] [[package]] @@ -1800,28 +1757,28 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "747d632c0c558b87dbabbe6a82f3b4ae03720d0646ac5b7b4dae89394be5f2c5" dependencies = [ - "num-traits 0.2.14", + "num-traits 0.2.15", ] [[package]] name = "num-integer" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" dependencies = [ "autocfg 1.1.0", - "num-traits 0.2.14", + "num-traits 0.2.15", ] [[package]] name = "num-iter" -version = "0.1.42" +version = "0.1.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2021c8337a54d21aca0d59a92577a029af9431cb59b909b03252b9c164fad59" +checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" dependencies = [ "autocfg 1.1.0", "num-integer", - "num-traits 0.2.14", + "num-traits 0.2.15", ] [[package]] @@ -1833,7 +1790,7 @@ dependencies = [ "autocfg 1.1.0", "num-bigint", "num-integer", - "num-traits 0.2.14", + "num-traits 0.2.15", ] [[package]] @@ -1844,7 +1801,7 @@ checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07" dependencies = [ "autocfg 1.1.0", "num-integer", - "num-traits 0.2.14", + "num-traits 0.2.15", ] [[package]] @@ -1853,14 +1810,14 @@ version = "0.1.43" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31" dependencies = [ - "num-traits 0.2.14", + "num-traits 0.2.15", ] [[package]] name = "num-traits" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" +checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" dependencies = [ "autocfg 1.1.0", ] @@ -1877,9 +1834,9 @@ dependencies = [ [[package]] name = "object" -version = "0.27.1" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67ac1d3f9a1d3616fd9a60c8d74296f22406a238b6a72f5cc1e6f314df4ffbf9" +checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53" dependencies = [ "memchr", ] @@ -1892,9 +1849,9 @@ checksum = "4eae0151b9dacf24fcc170d9995e511669a082856a91f958a2fe380bfab3fb22" [[package]] name = "once_cell" -version = "1.10.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9" +checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1" [[package]] name = "opaque-debug" @@ -1914,7 +1871,7 @@ version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3305af35278dd29f46fcdd139e0b1fbfae2153f0e5928b39b035542dd31e37b7" dependencies = [ - "num-traits 0.2.14", + "num-traits 0.2.15", ] [[package]] @@ -2020,22 +1977,22 @@ checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" [[package]] name = "pin-project" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58ad3879ad3baf4e44784bc6a718a8698867bb991f8ce24d1bcbe2cfb4c3a75e" +checksum = "78203e83c48cffbe01e4a2d35d566ca4de445d79a85372fc64e378bfc812a260" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "744b6f092ba29c3650faf274db506afd39944f48420f6c86b17cfe0ee1cb36bb" +checksum = "710faf75e1b33345361201d36d04e98ac1ed8909151a017ed384700836104c74" dependencies = [ - "proc-macro2 1.0.36", - "quote 1.0.16", - "syn 1.0.89", + "proc-macro2 1.0.40", + "quote 1.0.20", + "syn 1.0.98", ] [[package]] @@ -2046,9 +2003,9 @@ checksum = "257b64915a082f7811703966789728173279bdebb956b143dbcd23f6f970a777" [[package]] name = "pin-project-lite" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e280fbe77cc62c91527259e9442153f4688736748d24660126286329742b4c6c" +checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" [[package]] name = "pin-utils" @@ -2058,9 +2015,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe" +checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" [[package]] name = "pretty_assertions" @@ -2085,11 +2042,11 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.36" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029" +checksum = "dd96a1e8ed2596c337f8eae5f24924ec83f5ad5ab21ea8e455d3566c69fbcaf7" dependencies = [ - "unicode-xid 0.2.2", + "unicode-ident", ] [[package]] @@ -2109,11 +2066,11 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.16" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4af2ec4714533fcdf07e886f17025ace8b997b9ce51204ee69b6da831c3da57" +checksum = "3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804" dependencies = [ - "proc-macro2 1.0.36", + "proc-macro2 1.0.40", ] [[package]] @@ -2258,29 +2215,29 @@ checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" [[package]] name = "redox_syscall" -version = "0.2.11" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8380fe0152551244f0747b1bf41737e0f8a74f97a14ccefd1148187271634f3c" +checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" dependencies = [ "bitflags 1.3.2", ] [[package]] name = "redox_users" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7776223e2696f1aa4c6b0170e83212f47296a00424305117d013dfe86fb0fe55" +checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ "getrandom", - "redox_syscall 0.2.11", + "redox_syscall 0.2.13", "thiserror", ] [[package]] name = "regex" -version = "1.5.5" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286" +checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" dependencies = [ "aho-corasick", "memchr", @@ -2289,9 +2246,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.25" +version = "0.6.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" +checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" [[package]] name = "remove_dir_all" @@ -2373,9 +2330,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f" +checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" [[package]] name = "same-file" @@ -2388,12 +2345,12 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.19" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" +checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2" dependencies = [ "lazy_static", - "winapi 0.3.9", + "windows-sys", ] [[package]] @@ -2453,9 +2410,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.136" +version = "1.0.139" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789" +checksum = "0171ebb889e45aa68b44aee0859b3eede84c6f5f5c228e6f140c0b2a0a46cad6" dependencies = [ "serde_derive", ] @@ -2472,31 +2429,31 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.136" +version = "1.0.139" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9" +checksum = "dc1d3230c1de7932af58ad8ffbe1d784bd55efd5a9d84ac24f69c72d83543dfb" dependencies = [ - "proc-macro2 1.0.36", - "quote 1.0.16", - "syn 1.0.89", + "proc-macro2 1.0.40", + "quote 1.0.20", + "syn 1.0.98", ] [[package]] name = "serde_json" -version = "1.0.79" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e8d9fa5c3b304765ce1fd9c4c8a3de2c8db365a5b91be52f186efc675681d95" +checksum = "82c2c1fdcd807d1098552c5b9a36e425e42e9fbd7c6a37a8425f390f781f7fa7" dependencies = [ - "itoa 1.0.1", + "itoa 1.0.2", "ryu", "serde", ] [[package]] name = "serde_yaml" -version = "0.8.23" +version = "0.8.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a521f2940385c165a24ee286aa8599633d162077a54bdcae2a6fd5a7bfa7a0" +checksum = "1ec0091e1f5aa338283ce049bd9dfefd55e1f168ac233e85c1ffe0038fb48cbe" dependencies = [ "indexmap", "ryu", @@ -2525,9 +2482,9 @@ checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2" [[package]] name = "signal-hook" -version = "0.3.13" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "647c97df271007dcea485bb74ffdb57f2e683f1306c854f468a0c244badabf2d" +checksum = "a253b5e89e2698464fc26b545c9edceb338e18a89effeeecfea192c3025be29d" dependencies = [ "libc", "signal-hook-registry", @@ -2550,15 +2507,15 @@ checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" [[package]] name = "slab" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9def91fd1e018fe007022791f865d0ccc9b3a0d5001e01aabb8b40e46000afb5" +checksum = "eb703cfe953bccee95685111adeedb76fabe4e97549a58d16f03ea7b9367bb32" [[package]] name = "smallvec" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" +checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1" [[package]] name = "socket2" @@ -2620,13 +2577,13 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.89" +version = "1.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea297be220d52398dcc07ce15a209fce436d361735ac1db700cab3b6cdfb9f54" +checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd" dependencies = [ - "proc-macro2 1.0.36", - "quote 1.0.16", - "unicode-xid 0.2.2", + "proc-macro2 1.0.40", + "quote 1.0.20", + "unicode-ident", ] [[package]] @@ -2635,10 +2592,10 @@ version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" dependencies = [ - "proc-macro2 1.0.36", - "quote 1.0.16", - "syn 1.0.89", - "unicode-xid 0.2.2", + "proc-macro2 1.0.40", + "quote 1.0.20", + "syn 1.0.98", + "unicode-xid 0.2.3", ] [[package]] @@ -2650,7 +2607,7 @@ dependencies = [ "cfg-if 1.0.0", "fastrand", "libc", - "redox_syscall 0.2.11", + "redox_syscall 0.2.13", "remove_dir_all", "winapi 0.3.9", ] @@ -2695,22 +2652,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.30" +version = "1.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "854babe52e4df1653706b98fcfc05843010039b406875930a70e4d9644e5c417" +checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.30" +version = "1.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b" +checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" dependencies = [ - "proc-macro2 1.0.36", - "quote 1.0.16", - "syn 1.0.89", + "proc-macro2 1.0.40", + "quote 1.0.20", + "syn 1.0.98", ] [[package]] @@ -2726,19 +2683,20 @@ dependencies = [ [[package]] name = "time" -version = "0.1.43" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" +checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" dependencies = [ "libc", + "wasi 0.10.0+wasi-snapshot-preview1", "winapi 0.3.9", ] [[package]] name = "tinyvec" -version = "1.5.1" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" dependencies = [ "tinyvec_macros", ] @@ -2789,9 +2747,9 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e44da00bfc73a25f814cd8d7e57a68a5c31b74b3152a0a1d1f590c97ed06265a" dependencies = [ - "proc-macro2 1.0.36", - "quote 1.0.16", - "syn 1.0.89", + "proc-macro2 1.0.40", + "quote 1.0.20", + "syn 1.0.98", ] [[package]] @@ -2836,38 +2794,38 @@ dependencies = [ [[package]] name = "toml" -version = "0.5.8" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" +checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" dependencies = [ "serde", ] [[package]] name = "tower-service" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" -version = "0.1.32" +version = "0.1.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a1bdf54a7c28a2bbf701e1d2233f6c77f473486b94bee4f9678da5a148dca7f" +checksum = "a400e31aa60b9d44a52a8ee0343b5b18566b03a8321e0d321f695cf56e940160" dependencies = [ "cfg-if 1.0.0", "log", - "pin-project-lite 0.2.8", + "pin-project-lite 0.2.9", "tracing-core", ] [[package]] name = "tracing-core" -version = "0.1.23" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa31669fa42c09c34d94d8165dd2012e8ff3c66aca50f3bb226b68f216f2706c" +checksum = "7b7358be39f2f274f322d2aaed611acc57f382e8eb1e5b48cb9ae30933495ce7" dependencies = [ - "lazy_static", + "once_cell", ] [[package]] @@ -2909,15 +2867,21 @@ checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" [[package]] name = "unicode-bidi" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f" +checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" + +[[package]] +name = "unicode-ident" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c" [[package]] name = "unicode-normalization" -version = "0.1.19" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" +checksum = "854cbdc4f7bc6ae19c820d44abdc3277ac3e1b2b93db20a636825d9322fb60e6" dependencies = [ "tinyvec", ] @@ -2942,9 +2906,9 @@ checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" [[package]] name = "unicode-xid" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" +checksum = "957e51f3646910546462e67d5f7599b9e4fb8acdd304b087a6494730f9eebf04" [[package]] name = "unsafe-any" @@ -3014,15 +2978,21 @@ dependencies = [ [[package]] name = "wasi" -version = "0.10.2+wasi-snapshot-preview1" +version = "0.10.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" +checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.79" +version = "0.2.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25f1af7423d8588a3d840681122e72e6a24ddbcb3f0ec385cac0d12d24256c06" +checksum = "7c53b543413a17a202f4be280a7e5c62a1c69345f5de525ee64f8cfdbc954994" dependencies = [ "cfg-if 1.0.0", "wasm-bindgen-macro", @@ -3030,47 +3000,47 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.79" +version = "0.2.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b21c0df030f5a177f3cba22e9bc4322695ec43e7257d865302900290bcdedca" +checksum = "5491a68ab4500fa6b4d726bd67408630c3dbe9c4fe7bda16d5c82a1fd8c7340a" dependencies = [ "bumpalo", "lazy_static", "log", - "proc-macro2 1.0.36", - "quote 1.0.16", - "syn 1.0.89", + "proc-macro2 1.0.40", + "quote 1.0.20", + "syn 1.0.98", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.79" +version = "0.2.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f4203d69e40a52ee523b2529a773d5ffc1dc0071801c87b3d270b471b80ed01" +checksum = "c441e177922bc58f1e12c022624b6216378e5febc2f0533e41ba443d505b80aa" dependencies = [ - "quote 1.0.16", + "quote 1.0.20", "wasm-bindgen-macro-support", ] [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.79" +version = "0.2.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa8a30d46208db204854cadbb5d4baf5fcf8071ba5bf48190c3e59937962ebc" +checksum = "7d94ac45fcf608c1f45ef53e748d35660f168490c10b23704c7779ab8f5c3048" dependencies = [ - "proc-macro2 1.0.36", - "quote 1.0.16", - "syn 1.0.89", + "proc-macro2 1.0.40", + "quote 1.0.20", + "syn 1.0.98", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.79" +version = "0.2.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d958d035c4438e28c70e4321a2911302f10135ce78a9c7834c0cab4123d06a2" +checksum = "6a89911bd99e5f3659ec4acf9c4d93b0a90fe4a2a11f15328472058edc5261be" [[package]] name = "wasmer_enumset" @@ -3078,7 +3048,7 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf088cc1f7d247fd96dff0df46fb1bbb747d8a69ae1ecd71aed55c55e354b2d8" dependencies = [ - "num-traits 0.2.14", + "num-traits 0.2.15", "wasmer_enumset_derive", ] @@ -3089,16 +3059,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8d1b32d98e11194200baf6d3f85eb2d6cfe56f6d9af0dd617f90ca48f958a88" dependencies = [ "darling", - "proc-macro2 1.0.36", - "quote 1.0.16", - "syn 1.0.89", + "proc-macro2 1.0.40", + "quote 1.0.20", + "syn 1.0.98", ] [[package]] name = "web-sys" -version = "0.3.56" +version = "0.3.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c060b319f29dd25724f09a2ba1418f142f539b2be99fbf4d2d5a8f7330afb8eb" +checksum = "2fed94beee57daf8dd7d51f2b15dc2bcde92d7a72304cdf662a4371008b71b90" dependencies = [ "js-sys", "wasm-bindgen", @@ -3166,6 +3136,49 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-sys" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" +dependencies = [ + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" + +[[package]] +name = "windows_i686_gnu" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" + +[[package]] +name = "windows_i686_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" + [[package]] name = "winreg" version = "0.5.1" @@ -3208,9 +3221,9 @@ dependencies = [ [[package]] name = "zeroize" -version = "1.5.4" +version = "1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb5728b8afd3f280a869ce1d4c554ffaed35f45c231fc41bfbd0381bef50317" +checksum = "20b578acffd8516a6c3f2a1bdefc1ec37e547bb4e0fb8b6b01a4cafc886b4442" dependencies = [ "zeroize_derive", ] @@ -3221,9 +3234,9 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f8f187641dad4f680d25c4bfc4225b418165984179f26ca76ec4fb6441d3a17" dependencies = [ - "proc-macro2 1.0.36", - "quote 1.0.16", - "syn 1.0.89", + "proc-macro2 1.0.40", + "quote 1.0.20", + "syn 1.0.98", "synstructure", ] diff --git a/Cargo.toml b/Cargo.toml index 06d9b42ee..fa14e90f9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,8 +31,6 @@ futures = "0.3.19" serde_json = "1" log = "0.4" term = "0.6" -failure = "0.1" -failure_derive = "0.1" grin_api = { path = "./api", version = "5.2.0-alpha.1" } grin_config = { path = "./config", version = "5.2.0-alpha.1" } diff --git a/api/Cargo.toml b/api/Cargo.toml index df8b9c0f8..dc302ca21 100644 --- a/api/Cargo.toml +++ b/api/Cargo.toml @@ -11,8 +11,6 @@ edition = "2018" [dependencies] easy-jsonrpc-mw = "0.5.4" -failure = "0.1.1" -failure_derive = "0.1.1" hyper = "0.13" lazy_static = "1" regex = "1" @@ -20,6 +18,7 @@ ring = "0.16" serde = "1" serde_derive = "1" serde_json = "1" +thiserror = "1" log = "0.4" tokio = { version = "0.2", features = ["full"] } tokio-rustls = "0.13" diff --git a/api/src/client.rs b/api/src/client.rs index 01a0cbb16..cc5d490df 100644 --- a/api/src/client.rs +++ b/api/src/client.rs @@ -14,9 +14,8 @@ //! High level JSON/HTTP client API -use crate::rest::{Error, ErrorKind}; +use crate::rest::Error; use crate::util::to_base64; -use failure::{Fail, ResultExt}; use hyper::body; use hyper::header::{ACCEPT, AUTHORIZATION, CONTENT_TYPE, USER_AGENT}; use hyper::{Body, Client, Request}; @@ -181,9 +180,7 @@ fn build_request( None => Body::empty(), Some(json) => json.into(), }) - .map_err(|e| { - ErrorKind::RequestError(format!("Bad request {} {}: {}", method, url, e)).into() - }) + .map_err(|e| Error::RequestError(format!("Bad request {} {}: {}", method, url, e))) } pub fn create_post_request( @@ -194,9 +191,8 @@ pub fn create_post_request( where IN: Serialize, { - let json = serde_json::to_string(input).context(ErrorKind::Internal( - "Could not serialize data to JSON".to_owned(), - ))?; + let json = serde_json::to_string(input) + .map_err(|e| Error::Internal(format!("Could not serialize data to JSON: {}", e)))?; build_request(url, "POST", api_secret, Some(json)) } @@ -205,10 +201,8 @@ where for<'de> T: Deserialize<'de>, { let data = send_request(req, timeout)?; - serde_json::from_str(&data).map_err(|e| { - e.context(ErrorKind::ResponseError("Cannot parse response".to_owned())) - .into() - }) + serde_json::from_str(&data) + .map_err(|e| Error::ResponseError(format!("Cannot parse response {}", e))) } async fn handle_request_async(req: Request) -> Result @@ -217,7 +211,7 @@ where { let data = send_request_async(req, TimeOut::default()).await?; let ser = serde_json::from_str(&data) - .map_err(|e| e.context(ErrorKind::ResponseError("Cannot parse response".to_owned())))?; + .map_err(|e| Error::ResponseError(format!("Cannot parse response {}", e)))?; Ok(ser) } @@ -237,10 +231,10 @@ async fn send_request_async(req: Request, timeout: TimeOut) -> Result, timeout: TimeOut) -> Result, timeout: TimeOut) -> Result, hash: Option, commit: Option, - ) -> Result; + ) -> Result; /** Networked version of [Foreign::get_block](struct.Foreign.html#method.get_block). @@ -244,7 +244,7 @@ pub trait ForeignRpc: Sync + Send { height: Option, hash: Option, commit: Option, - ) -> Result; + ) -> Result; /** Networked version of [Foreign::get_version](struct.Foreign.html#method.get_version). @@ -277,7 +277,7 @@ pub trait ForeignRpc: Sync + Send { # ); ``` */ - fn get_version(&self) -> Result; + fn get_version(&self) -> Result; /** Networked version of [Foreign::get_tip](struct.Foreign.html#method.get_tip). @@ -312,7 +312,7 @@ pub trait ForeignRpc: Sync + Send { # ); ``` */ - fn get_tip(&self) -> Result; + fn get_tip(&self) -> Result; /** Networked version of [Foreign::get_kernel](struct.Foreign.html#method.get_kernel). @@ -355,7 +355,7 @@ pub trait ForeignRpc: Sync + Send { excess: String, min_height: Option, max_height: Option, - ) -> Result; + ) -> Result; /** Networked version of [Foreign::get_outputs](struct.Foreign.html#method.get_outputs). @@ -442,7 +442,7 @@ pub trait ForeignRpc: Sync + Send { end_height: Option, include_proof: Option, include_merkle_proof: Option, - ) -> Result, ErrorKind>; + ) -> Result, Error>; /** Networked version of [Foreign::get_unspent_outputs](struct.Foreign.html#method.get_unspent_outputs). @@ -503,7 +503,7 @@ pub trait ForeignRpc: Sync + Send { end_index: Option, max: u64, include_proof: Option, - ) -> Result; + ) -> Result; /** Networked version of [Foreign::get_pmmr_indices](struct.Foreign.html#method.get_pmmr_indices). @@ -540,7 +540,7 @@ pub trait ForeignRpc: Sync + Send { &self, start_block_height: u64, end_block_height: Option, - ) -> Result; + ) -> Result; /** Networked version of [Foreign::get_pool_size](struct.Foreign.html#method.get_pool_size). @@ -570,7 +570,7 @@ pub trait ForeignRpc: Sync + Send { # ); ``` */ - fn get_pool_size(&self) -> Result; + fn get_pool_size(&self) -> Result; /** Networked version of [Foreign::get_stempool_size](struct.Foreign.html#method.get_stempool_size). @@ -600,7 +600,7 @@ pub trait ForeignRpc: Sync + Send { # ); ``` */ - fn get_stempool_size(&self) -> Result; + fn get_stempool_size(&self) -> Result; /** Networked version of [Foreign::get_unconfirmed_transactions](struct.Foreign.html#method.get_unconfirmed_transactions). @@ -673,7 +673,7 @@ pub trait ForeignRpc: Sync + Send { # ); ``` */ - fn get_unconfirmed_transactions(&self) -> Result, ErrorKind>; + fn get_unconfirmed_transactions(&self) -> Result, Error>; /** Networked version of [Foreign::push_transaction](struct.Foreign.html#method.push_transaction). @@ -738,7 +738,7 @@ pub trait ForeignRpc: Sync + Send { # ); ``` */ - fn push_transaction(&self, tx: Transaction, fluff: Option) -> Result<(), ErrorKind>; + fn push_transaction(&self, tx: Transaction, fluff: Option) -> Result<(), Error>; } impl ForeignRpc for Foreign @@ -751,36 +751,36 @@ where height: Option, hash: Option, commit: Option, - ) -> Result { + ) -> Result { let mut parsed_hash: Option = None; if let Some(hash) = hash { let vec = util::from_hex(&hash) - .map_err(|e| ErrorKind::Argument(format!("invalid block hash: {}", e)))?; + .map_err(|e| Error::Argument(format!("invalid block hash: {}", e)))?; parsed_hash = Some(Hash::from_vec(&vec)); } - Foreign::get_header(self, height, parsed_hash, commit).map_err(|e| e.kind().clone()) + Foreign::get_header(self, height, parsed_hash, commit) } fn get_block( &self, height: Option, hash: Option, commit: Option, - ) -> Result { + ) -> Result { let mut parsed_hash: Option = None; if let Some(hash) = hash { let vec = util::from_hex(&hash) - .map_err(|e| ErrorKind::Argument(format!("invalid block hash: {}", e)))?; + .map_err(|e| Error::Argument(format!("invalid block hash: {}", e)))?; parsed_hash = Some(Hash::from_vec(&vec)); } - Foreign::get_block(self, height, parsed_hash, commit).map_err(|e| e.kind().clone()) + Foreign::get_block(self, height, parsed_hash, commit) } - fn get_version(&self) -> Result { - Foreign::get_version(self).map_err(|e| e.kind().clone()) + fn get_version(&self) -> Result { + Foreign::get_version(self) } - fn get_tip(&self) -> Result { - Foreign::get_tip(self).map_err(|e| e.kind().clone()) + fn get_tip(&self) -> Result { + Foreign::get_tip(self) } fn get_kernel( @@ -788,8 +788,8 @@ where excess: String, min_height: Option, max_height: Option, - ) -> Result { - Foreign::get_kernel(self, excess, min_height, max_height).map_err(|e| e.kind().clone()) + ) -> Result { + Foreign::get_kernel(self, excess, min_height, max_height) } fn get_outputs( @@ -799,7 +799,7 @@ where end_height: Option, include_proof: Option, include_merkle_proof: Option, - ) -> Result, ErrorKind> { + ) -> Result, Error> { Foreign::get_outputs( self, commits, @@ -808,7 +808,6 @@ where include_proof, include_merkle_proof, ) - .map_err(|e| e.kind().clone()) } fn get_unspent_outputs( @@ -817,33 +816,31 @@ where end_index: Option, max: u64, include_proof: Option, - ) -> Result { + ) -> Result { Foreign::get_unspent_outputs(self, start_index, end_index, max, include_proof) - .map_err(|e| e.kind().clone()) } fn get_pmmr_indices( &self, start_block_height: u64, end_block_height: Option, - ) -> Result { + ) -> Result { Foreign::get_pmmr_indices(self, start_block_height, end_block_height) - .map_err(|e| e.kind().clone()) } - fn get_pool_size(&self) -> Result { - Foreign::get_pool_size(self).map_err(|e| e.kind().clone()) + fn get_pool_size(&self) -> Result { + Foreign::get_pool_size(self) } - fn get_stempool_size(&self) -> Result { - Foreign::get_stempool_size(self).map_err(|e| e.kind().clone()) + fn get_stempool_size(&self) -> Result { + Foreign::get_stempool_size(self) } - fn get_unconfirmed_transactions(&self) -> Result, ErrorKind> { - Foreign::get_unconfirmed_transactions(self).map_err(|e| e.kind().clone()) + fn get_unconfirmed_transactions(&self) -> Result, Error> { + Foreign::get_unconfirmed_transactions(self) } - fn push_transaction(&self, tx: Transaction, fluff: Option) -> Result<(), ErrorKind> { - Foreign::push_transaction(self, tx, fluff).map_err(|e| e.kind().clone()) + fn push_transaction(&self, tx: Transaction, fluff: Option) -> Result<(), Error> { + Foreign::push_transaction(self, tx, fluff) } } @@ -854,7 +851,7 @@ macro_rules! doctest_helper_json_rpc_foreign_assert_response { // create temporary grin server, run jsonrpc request on node api, delete server, return // json response. - { + { /*use grin_servers::test_framework::framework::run_doctest; use grin_util as util; use serde_json; @@ -888,6 +885,6 @@ macro_rules! doctest_helper_json_rpc_foreign_assert_response { serde_json::to_string_pretty(&expected_response).unwrap() ); }*/ - } + } }; } diff --git a/api/src/handlers/blocks_api.rs b/api/src/handlers/blocks_api.rs index fb419d0d9..ca46db16e 100644 --- a/api/src/handlers/blocks_api.rs +++ b/api/src/handlers/blocks_api.rs @@ -20,7 +20,6 @@ use crate::router::{Handler, ResponseFuture}; use crate::types::*; use crate::util; use crate::web::*; -use failure::ResultExt; use hyper::{Body, Request, StatusCode}; use regex::Regex; use std::sync::Weak; @@ -43,33 +42,33 @@ impl HeaderHandler { if let Ok(height) = input.parse() { match w(&self.chain)?.get_header_by_height(height) { Ok(header) => return Ok(BlockHeaderPrintable::from_header(&header)), - Err(_) => return Err(ErrorKind::NotFound.into()), + Err(_) => return Err(Error::NotFound), } } check_block_param(&input)?; - let vec = util::from_hex(&input) - .map_err(|e| ErrorKind::Argument(format!("invalid input: {}", e)))?; + let vec = + util::from_hex(&input).map_err(|e| Error::Argument(format!("invalid input: {}", e)))?; let h = Hash::from_vec(&vec); let header = w(&self.chain)? .get_block_header(&h) - .context(ErrorKind::NotFound)?; + .map_err(|_| Error::NotFound)?; Ok(BlockHeaderPrintable::from_header(&header)) } fn get_header_for_output(&self, commit_id: String) -> Result { let oid = match get_output(&self.chain, &commit_id)? { Some((_, o)) => o, - None => return Err(ErrorKind::NotFound.into()), + None => return Err(Error::NotFound), }; match w(&self.chain)?.get_header_for_output(oid.commitment()) { Ok(header) => Ok(BlockHeaderPrintable::from_header(&header)), - Err(_) => Err(ErrorKind::NotFound.into()), + Err(_) => Err(Error::NotFound), } } pub fn get_header_v2(&self, h: &Hash) -> Result { let chain = w(&self.chain)?; - let header = chain.get_block_header(h).context(ErrorKind::NotFound)?; + let header = chain.get_block_header(h).map_err(|_| Error::NotFound)?; Ok(BlockHeaderPrintable::from_header(&header)) } @@ -83,7 +82,7 @@ impl HeaderHandler { if let Some(height) = height { match w(&self.chain)?.get_header_by_height(height) { Ok(header) => return Ok(header.hash()), - Err(_) => return Err(ErrorKind::NotFound.into()), + Err(_) => return Err(Error::NotFound), } } if let Some(hash) = hash { @@ -92,14 +91,16 @@ impl HeaderHandler { if let Some(commit) = commit { let oid = match get_output_v2(&self.chain, &commit, false, false)? { Some((_, o)) => o, - None => return Err(ErrorKind::NotFound.into()), + None => return Err(Error::NotFound), }; match w(&self.chain)?.get_header_for_output(oid.commitment()) { Ok(header) => return Ok(header.hash()), - Err(_) => return Err(ErrorKind::NotFound.into()), + Err(_) => return Err(Error::NotFound), } } - Err(ErrorKind::Argument("not a valid hash, height or output commit".to_owned()).into()) + Err(Error::Argument( + "not a valid hash, height or output commit".to_owned(), + )) } } @@ -132,16 +133,16 @@ impl BlockHandler { include_merkle_proof: bool, ) -> Result { let chain = w(&self.chain)?; - let block = chain.get_block(h).context(ErrorKind::NotFound)?; + let block = chain.get_block(h).map_err(|_| Error::NotFound)?; BlockPrintable::from_block(&block, &chain, include_proof, include_merkle_proof) - .map_err(|_| ErrorKind::Internal("chain error".to_owned()).into()) + .map_err(|_| Error::Internal("chain error".to_owned())) } fn get_compact_block(&self, h: &Hash) -> Result { let chain = w(&self.chain)?; - let block = chain.get_block(h).context(ErrorKind::NotFound)?; + let block = chain.get_block(h).map_err(|_| Error::NotFound)?; CompactBlockPrintable::from_compact_block(&block.into(), &chain) - .map_err(|_| ErrorKind::Internal("chain error".to_owned()).into()) + .map_err(|_| Error::Internal("chain error".to_owned())) } // Try to decode the string as a height or a hash. @@ -149,12 +150,12 @@ impl BlockHandler { if let Ok(height) = input.parse() { match w(&self.chain)?.get_header_by_height(height) { Ok(header) => return Ok(header.hash()), - Err(_) => return Err(ErrorKind::NotFound.into()), + Err(_) => return Err(Error::NotFound), } } check_block_param(&input)?; - let vec = util::from_hex(&input) - .map_err(|e| ErrorKind::Argument(format!("invalid input: {}", e)))?; + let vec = + util::from_hex(&input).map_err(|e| Error::Argument(format!("invalid input: {}", e)))?; Ok(Hash::from_vec(&vec)) } @@ -168,7 +169,7 @@ impl BlockHandler { if let Some(height) = height { match w(&self.chain)?.get_header_by_height(height) { Ok(header) => return Ok(header.hash()), - Err(_) => return Err(ErrorKind::NotFound.into()), + Err(_) => return Err(Error::NotFound), } } if let Some(hash) = hash { @@ -177,14 +178,16 @@ impl BlockHandler { if let Some(commit) = commit { let oid = match get_output_v2(&self.chain, &commit, false, false)? { Some((_, o)) => o, - None => return Err(ErrorKind::NotFound.into()), + None => return Err(Error::NotFound), }; match w(&self.chain)?.get_header_for_output(oid.commitment()) { Ok(header) => return Ok(header.hash()), - Err(_) => return Err(ErrorKind::NotFound.into()), + Err(_) => return Err(Error::NotFound), } } - Err(ErrorKind::Argument("not a valid hash, height or output commit".to_owned()).into()) + Err(Error::Argument( + "not a valid hash, height or output commit".to_owned(), + )) } } @@ -193,7 +196,7 @@ fn check_block_param(input: &str) -> Result<(), Error> { static ref RE: Regex = Regex::new(r"[0-9a-fA-F]{64}").unwrap(); } if !RE.is_match(&input) { - return Err(ErrorKind::Argument("Not a valid hash or height.".to_owned()).into()); + return Err(Error::Argument("Not a valid hash or height.".to_owned())); } Ok(()) } diff --git a/api/src/handlers/chain_api.rs b/api/src/handlers/chain_api.rs index edcf3c38c..a79aad2c5 100644 --- a/api/src/handlers/chain_api.rs +++ b/api/src/handlers/chain_api.rs @@ -21,7 +21,6 @@ use crate::types::*; use crate::util; use crate::util::secp::pedersen::Commitment; use crate::web::*; -use failure::ResultExt; use hyper::{Body, Request, StatusCode}; use std::sync::Weak; @@ -35,7 +34,7 @@ impl ChainHandler { pub fn get_tip(&self) -> Result { let head = w(&self.chain)? .head() - .map_err(|e| ErrorKind::Internal(format!("can't get head: {}", e)))?; + .map_err(|e| Error::Internal(format!("can't get head: {}", e)))?; Ok(Tip::from_tip(head)) } } @@ -56,7 +55,7 @@ impl ChainValidationHandler { pub fn validate_chain(&self, fast_validation: bool) -> Result<(), Error> { w(&self.chain)? .validate(fast_validation) - .map_err(|_| ErrorKind::Internal("chain error".to_owned()).into()) + .map_err(|_| Error::Internal("chain error".to_owned())) } } @@ -144,11 +143,10 @@ impl OutputHandler { // First check the commits length for commit in &commits { if commit.len() != 66 { - return Err(ErrorKind::RequestError(format!( + return Err(Error::RequestError(format!( "invalid commit length for {}", commit - )) - .into()); + ))); } } for commit in commits { @@ -202,7 +200,7 @@ impl OutputHandler { let chain = w(&self.chain)?; let outputs = chain .unspent_outputs_by_pmmr_index(start_index, max, end_index) - .context(ErrorKind::NotFound)?; + .map_err(|_| Error::NotFound)?; let out = OutputListing { last_retrieved_index: outputs.0, highest_index: outputs.1, @@ -219,7 +217,7 @@ impl OutputHandler { ) }) .collect::, _>>() - .context(ErrorKind::Internal("chain error".to_owned()))?, + .map_err(|_| Error::Internal("chain error".to_owned()))?, }; Ok(out) } @@ -258,14 +256,14 @@ impl OutputHandler { ) -> Result { let header = w(&self.chain)? .get_header_by_height(block_height) - .map_err(|_| ErrorKind::NotFound)?; + .map_err(|_| Error::NotFound)?; // TODO - possible to compact away blocks we care about // in the period between accepting the block and refreshing the wallet let chain = w(&self.chain)?; let block = chain .get_block(&header.hash()) - .map_err(|_| ErrorKind::NotFound)?; + .map_err(|_| Error::NotFound)?; let outputs = block .outputs() .iter() @@ -274,7 +272,7 @@ impl OutputHandler { OutputPrintable::from_output(output, &chain, Some(&header), include_proof, true) }) .collect::, _>>() - .context(ErrorKind::Internal("cain error".to_owned()))?; + .map_err(|_| Error::Internal("chain error".to_owned()))?; Ok(BlockOutputs { header: BlockHeaderDifficultyInfo::from_header(&header), @@ -291,14 +289,14 @@ impl OutputHandler { ) -> Result, Error> { let header = w(&self.chain)? .get_header_by_height(block_height) - .map_err(|_| ErrorKind::NotFound)?; + .map_err(|_| Error::NotFound)?; // TODO - possible to compact away blocks we care about // in the period between accepting the block and refreshing the wallet let chain = w(&self.chain)?; let block = chain .get_block(&header.hash()) - .map_err(|_| ErrorKind::NotFound)?; + .map_err(|_| Error::NotFound)?; let outputs = block .outputs() .iter() @@ -313,7 +311,7 @@ impl OutputHandler { ) }) .collect::, _>>() - .context(ErrorKind::Internal("cain error".to_owned()))?; + .map_err(|_| Error::Internal("chain error".to_owned()))?; Ok(outputs) } @@ -408,11 +406,11 @@ impl KernelHandler { .trim_end_matches('/') .rsplit('/') .next() - .ok_or_else(|| ErrorKind::RequestError("missing excess".into()))?; - let excess = util::from_hex(excess) - .map_err(|_| ErrorKind::RequestError("invalid excess hex".into()))?; + .ok_or_else(|| Error::RequestError("missing excess".into()))?; + let excess = + util::from_hex(excess).map_err(|_| Error::RequestError("invalid excess hex".into()))?; if excess.len() != 33 { - return Err(ErrorKind::RequestError("invalid excess length".into()).into()); + return Err(Error::RequestError("invalid excess length".into())); } let excess = Commitment::from_vec(excess); @@ -427,18 +425,18 @@ impl KernelHandler { if let Some(h) = params.get("min_height") { let h = h .parse() - .map_err(|_| ErrorKind::RequestError("invalid minimum height".into()))?; + .map_err(|_| Error::RequestError("invalid minimum height".into()))?; // Default is genesis min_height = if h == 0 { None } else { Some(h) }; } if let Some(h) = params.get("max_height") { let h = h .parse() - .map_err(|_| ErrorKind::RequestError("invalid maximum height".into()))?; + .map_err(|_| Error::RequestError("invalid maximum height".into()))?; // Default is current head let head_height = chain .head() - .map_err(|e| ErrorKind::Internal(format!("{}", e)))? + .map_err(|e| Error::Internal(format!("{}", e)))? .height; max_height = if h >= head_height { None } else { Some(h) }; } @@ -446,7 +444,7 @@ impl KernelHandler { let kernel = chain .get_kernel_height(&excess, min_height, max_height) - .map_err(|e| ErrorKind::Internal(format!("{}", e)))? + .map_err(|e| Error::Internal(format!("{}", e)))? .map(|(tx_kernel, height, mmr_index)| LocatedTxKernel { tx_kernel, height, @@ -462,22 +460,22 @@ impl KernelHandler { max_height: Option, ) -> Result { let excess = util::from_hex(&excess) - .map_err(|_| ErrorKind::RequestError("invalid excess hex".into()))?; + .map_err(|_| Error::RequestError("invalid excess hex".into()))?; if excess.len() != 33 { - return Err(ErrorKind::RequestError("invalid excess length".into()).into()); + return Err(Error::RequestError("invalid excess length".into())); } let excess = Commitment::from_vec(excess); let chain = w(&self.chain)?; let kernel = chain .get_kernel_height(&excess, min_height, max_height) - .map_err(|e| ErrorKind::Internal(format!("{}", e)))? + .map_err(|e| Error::Internal(format!("{}", e)))? .map(|(tx_kernel, height, mmr_index)| LocatedTxKernel { tx_kernel, height, mmr_index, }); - kernel.ok_or_else(|| ErrorKind::NotFound.into()) + kernel.ok_or(Error::NotFound) } } diff --git a/api/src/handlers/peers_api.rs b/api/src/handlers/peers_api.rs index c539f43e0..5b53176ab 100644 --- a/api/src/handlers/peers_api.rs +++ b/api/src/handlers/peers_api.rs @@ -74,7 +74,7 @@ impl PeerHandler { if let Some(addr) = addr { let peer_addr = PeerAddr(addr); let peer_data: PeerData = w(&self.peers)?.get_peer(peer_addr).map_err(|e| { - let e: Error = ErrorKind::Internal(format!("get peer error: {:?}", e)).into(); + let e: Error = Error::Internal(format!("get peer error: {:?}", e)); e })?; return Ok(vec![peer_data]); @@ -87,14 +87,14 @@ impl PeerHandler { let peer_addr = PeerAddr(addr); w(&self.peers)? .ban_peer(peer_addr, ReasonForBan::ManualBan) - .map_err(|e| ErrorKind::Internal(format!("ban peer error: {:?}", e)).into()) + .map_err(|e| Error::Internal(format!("ban peer error: {:?}", e))) } pub fn unban_peer(&self, addr: SocketAddr) -> Result<(), Error> { let peer_addr = PeerAddr(addr); w(&self.peers)? .unban_peer(peer_addr) - .map_err(|e| ErrorKind::Internal(format!("unban peer error: {:?}", e)).into()) + .map_err(|e| Error::Internal(format!("unban peer error: {:?}", e))) } } diff --git a/api/src/handlers/pool_api.rs b/api/src/handlers/pool_api.rs index e0ee083f9..96e76ad7f 100644 --- a/api/src/handlers/pool_api.rs +++ b/api/src/handlers/pool_api.rs @@ -23,7 +23,6 @@ use crate::types::*; use crate::util; use crate::util::RwLock; use crate::web::*; -use failure::ResultExt; use hyper::{Body, Request, StatusCode}; use std::sync::Weak; @@ -97,10 +96,10 @@ where let header = tx_pool .blockchain .chain_head() - .context(ErrorKind::Internal("Failed to get chain head".to_owned()))?; + .map_err(|e| Error::Internal(format!("Failed to get chain head: {}", e)))?; tx_pool .add_to_pool(source, tx, !fluff.unwrap_or(false), &header) - .context(ErrorKind::Internal("Failed to update pool".to_owned()))?; + .map_err(|e| Error::Internal(format!("Failed to update pool: {}", e)))?; Ok(()) } } @@ -134,13 +133,13 @@ where let wrapper: TxWrapper = parse_body(req).await?; let tx_bin = util::from_hex(&wrapper.tx_hex) - .map_err(|e| ErrorKind::RequestError(format!("Bad request: {}", e)))?; + .map_err(|e| Error::RequestError(format!("Bad request: {}", e)))?; // All wallet api interaction explicitly uses protocol version 1 for now. let version = ProtocolVersion(1); let tx: Transaction = ser::deserialize(&mut &tx_bin[..], version, DeserializationMode::default()) - .map_err(|e| ErrorKind::RequestError(format!("Bad request: {}", e)))?; + .map_err(|e| Error::RequestError(format!("Bad request: {}", e)))?; let source = pool::TxSource::PushApi; info!( @@ -156,10 +155,10 @@ where let header = tx_pool .blockchain .chain_head() - .context(ErrorKind::Internal("Failed to get chain head".to_owned()))?; + .map_err(|e| Error::Internal(format!("Failed to get chain head: {}", e)))?; tx_pool .add_to_pool(source, tx, !fluff, &header) - .context(ErrorKind::Internal("Failed to update pool".to_owned()))?; + .map_err(|e| Error::Internal(format!("Failed to update pool: {}", e)))?; Ok(()) } diff --git a/api/src/handlers/server_api.rs b/api/src/handlers/server_api.rs index 73770caad..0a8479ea1 100644 --- a/api/src/handlers/server_api.rs +++ b/api/src/handlers/server_api.rs @@ -50,7 +50,7 @@ impl StatusHandler { pub fn get_status(&self) -> Result { let head = w(&self.chain)? .head() - .map_err(|e| ErrorKind::Internal(format!("can't get head: {}", e)))?; + .map_err(|e| Error::Internal(format!("can't get head: {}", e)))?; let sync_status = w(&self.sync_state)?.status(); let (api_sync_status, api_sync_info) = sync_status_to_api(sync_status); Ok(Status::from_tip_and_peers( diff --git a/api/src/handlers/transactions_api.rs b/api/src/handlers/transactions_api.rs index 05f0fba65..ea4c351e1 100644 --- a/api/src/handlers/transactions_api.rs +++ b/api/src/handlers/transactions_api.rs @@ -20,7 +20,6 @@ use crate::types::*; use crate::util; use crate::util::secp::pedersen::Commitment; use crate::web::*; -use failure::ResultExt; use hyper::{Body, Request, StatusCode}; use std::sync::Weak; @@ -48,10 +47,8 @@ impl TxHashSetHandler { // gets roots fn get_roots(&self) -> Result { let chain = w(&self.chain)?; - let res = TxHashSet::from_head(&chain).context(ErrorKind::Internal( - "failed to read roots from txhashset".to_owned(), - ))?; - Ok(res) + TxHashSet::from_head(&chain) + .map_err(|e| Error::Internal(format!("failed to read roots from txhashset: {}", e))) } // gets last n outputs inserted in to the tree @@ -86,7 +83,7 @@ impl TxHashSetHandler { let chain = w(&self.chain)?; let outputs = chain .unspent_outputs_by_pmmr_index(start_index, max, end_index) - .context(ErrorKind::NotFound)?; + .map_err(|_| Error::NotFound)?; let out = OutputListing { last_retrieved_index: outputs.0, highest_index: outputs.1, @@ -95,7 +92,7 @@ impl TxHashSetHandler { .iter() .map(|x| OutputPrintable::from_output(x, &chain, None, true, true)) .collect::, _>>() - .context(ErrorKind::Internal("chain error".to_owned()))?, + .map_err(|e| Error::Internal(format!("chain error: {}", e)))?, }; Ok(out) } @@ -109,7 +106,7 @@ impl TxHashSetHandler { let chain = w(&self.chain)?; let range = chain .block_height_range_to_pmmr_indices(start_block_height, end_block_height) - .context(ErrorKind::NotFound)?; + .map_err(|_| Error::NotFound)?; let out = OutputListing { last_retrieved_index: range.0, highest_index: range.1, @@ -122,12 +119,12 @@ impl TxHashSetHandler { // (to avoid having to create a new type to pass around) fn get_merkle_proof_for_output(&self, id: &str) -> Result { let c = util::from_hex(id) - .map_err(|_| ErrorKind::Argument(format!("Not a valid commitment: {}", id)))?; + .map_err(|_| Error::Argument(format!("Not a valid commitment: {}", id)))?; let commit = Commitment::from_vec(c); let chain = w(&self.chain)?; - let output_pos = chain.get_output_pos(&commit).context(ErrorKind::NotFound)?; - let merkle_proof = chain::Chain::get_merkle_proof_for_pos(&chain, commit) - .map_err(|_| ErrorKind::NotFound)?; + let output_pos = chain.get_output_pos(&commit).map_err(|_| Error::NotFound)?; + let merkle_proof = + chain::Chain::get_merkle_proof_for_pos(&chain, commit).map_err(|_| Error::NotFound)?; Ok(OutputPrintable { output_type: OutputType::Coinbase, commit: Commitment::from_vec(vec![]), diff --git a/api/src/handlers/utils.rs b/api/src/handlers/utils.rs index 3986a0aa9..85b2b39dd 100644 --- a/api/src/handlers/utils.rs +++ b/api/src/handlers/utils.rs @@ -26,7 +26,7 @@ use std::sync::{Arc, Weak}; // boilerplate of dealing with `Weak`. pub fn w(weak: &Weak) -> Result, Error> { weak.upgrade() - .ok_or_else(|| ErrorKind::Internal("failed to upgrade weak reference".to_owned()).into()) + .ok_or_else(|| Error::Internal("failed to upgrade weak reference".to_owned())) } /// Internal function to retrieves an output by a given commitment @@ -35,7 +35,7 @@ fn get_unspent( id: &str, ) -> Result, Error> { let c = util::from_hex(id) - .map_err(|_| ErrorKind::Argument(format!("Not a valid commitment: {}", id)))?; + .map_err(|_| Error::Argument(format!("Not a valid commitment: {}", id)))?; let commit = Commitment::from_vec(c); let res = chain.get_unspent(commit)?; Ok(res) diff --git a/api/src/handlers/version_api.rs b/api/src/handlers/version_api.rs index cd1d7ff28..ddd2dbce1 100644 --- a/api/src/handlers/version_api.rs +++ b/api/src/handlers/version_api.rs @@ -33,7 +33,7 @@ impl VersionHandler { pub fn get_version(&self) -> Result { let head = w(&self.chain)? .head_header() - .map_err(|e| ErrorKind::Internal(format!("can't get head: {}", e)))?; + .map_err(|e| Error::Internal(format!("can't get head: {}", e)))?; Ok(Version { node_version: CRATE_VERSION.to_owned(), diff --git a/api/src/lib.rs b/api/src/lib.rs index 7a31e26fd..03c40868f 100644 --- a/api/src/lib.rs +++ b/api/src/lib.rs @@ -19,8 +19,6 @@ use grin_pool as pool; use grin_util as util; -#[macro_use] -extern crate failure_derive; #[macro_use] extern crate lazy_static; diff --git a/api/src/owner.rs b/api/src/owner.rs index 367fa637f..b63609c22 100644 --- a/api/src/owner.rs +++ b/api/src/owner.rs @@ -112,8 +112,8 @@ impl Owner { } pub fn reset_chain_head(&self, hash: String) -> Result<(), Error> { - let hash = Hash::from_hex(&hash) - .map_err(|_| ErrorKind::RequestError("invalid header hash".into()))?; + let hash = + Hash::from_hex(&hash).map_err(|_| Error::RequestError("invalid header hash".into()))?; let handler = ChainResetHandler { chain: self.chain.clone(), sync_state: self.sync_state.clone(), @@ -122,8 +122,8 @@ impl Owner { } pub fn invalidate_header(&self, hash: String) -> Result<(), Error> { - let hash = Hash::from_hex(&hash) - .map_err(|_| ErrorKind::RequestError("invalid header hash".into()))?; + let hash = + Hash::from_hex(&hash).map_err(|_| Error::RequestError("invalid header hash".into()))?; let handler = ChainResetHandler { chain: self.chain.clone(), sync_state: self.sync_state.clone(), diff --git a/api/src/owner_rpc.rs b/api/src/owner_rpc.rs index e68aa21b2..537a4fb2e 100644 --- a/api/src/owner_rpc.rs +++ b/api/src/owner_rpc.rs @@ -17,7 +17,7 @@ use crate::owner::Owner; use crate::p2p::types::PeerInfoDisplay; use crate::p2p::PeerData; -use crate::rest::ErrorKind; +use crate::rest::Error; use crate::types::Status; use std::net::SocketAddr; @@ -70,7 +70,7 @@ pub trait OwnerRpc: Sync + Send { # ); ``` */ - fn get_status(&self) -> Result; + fn get_status(&self) -> Result; /** Networked version of [Owner::validate_chain](struct.Owner.html#method.validate_chain). @@ -100,7 +100,7 @@ pub trait OwnerRpc: Sync + Send { # ); ``` */ - fn validate_chain(&self, assume_valid_rangeproofs_kernels: bool) -> Result<(), ErrorKind>; + fn validate_chain(&self, assume_valid_rangeproofs_kernels: bool) -> Result<(), Error>; /** Networked version of [Owner::compact_chain](struct.Owner.html#method.compact_chain). @@ -130,11 +130,11 @@ pub trait OwnerRpc: Sync + Send { # ); ``` */ - fn compact_chain(&self) -> Result<(), ErrorKind>; + fn compact_chain(&self) -> Result<(), Error>; - fn reset_chain_head(&self, hash: String) -> Result<(), ErrorKind>; + fn reset_chain_head(&self, hash: String) -> Result<(), Error>; - fn invalidate_header(&self, hash: String) -> Result<(), ErrorKind>; + fn invalidate_header(&self, hash: String) -> Result<(), Error>; /** Networked version of [Owner::get_peers](struct.Owner.html#method.get_peers). @@ -176,7 +176,7 @@ pub trait OwnerRpc: Sync + Send { # ); ``` */ - fn get_peers(&self, peer_addr: Option) -> Result, ErrorKind>; + fn get_peers(&self, peer_addr: Option) -> Result, Error>; /** Networked version of [Owner::get_connected_peers](struct.Owner.html#method.get_connected_peers). @@ -295,7 +295,7 @@ pub trait OwnerRpc: Sync + Send { # ); ``` */ - fn get_connected_peers(&self) -> Result, ErrorKind>; + fn get_connected_peers(&self) -> Result, Error>; /** Networked version of [Owner::ban_peer](struct.Owner.html#method.ban_peer). @@ -325,7 +325,7 @@ pub trait OwnerRpc: Sync + Send { # ); ``` */ - fn ban_peer(&self, peer_addr: SocketAddr) -> Result<(), ErrorKind>; + fn ban_peer(&self, peer_addr: SocketAddr) -> Result<(), Error>; /** Networked version of [Owner::unban_peer](struct.Owner.html#method.unban_peer). @@ -355,44 +355,44 @@ pub trait OwnerRpc: Sync + Send { # ); ``` */ - fn unban_peer(&self, peer_addr: SocketAddr) -> Result<(), ErrorKind>; + fn unban_peer(&self, peer_addr: SocketAddr) -> Result<(), Error>; } impl OwnerRpc for Owner { - fn get_status(&self) -> Result { - Owner::get_status(self).map_err(|e| e.kind().clone()) + fn get_status(&self) -> Result { + Owner::get_status(self) } - fn validate_chain(&self, assume_valid_rangeproofs_kernels: bool) -> Result<(), ErrorKind> { - Owner::validate_chain(self, assume_valid_rangeproofs_kernels).map_err(|e| e.kind().clone()) + fn validate_chain(&self, assume_valid_rangeproofs_kernels: bool) -> Result<(), Error> { + Owner::validate_chain(self, assume_valid_rangeproofs_kernels) } - fn reset_chain_head(&self, hash: String) -> Result<(), ErrorKind> { - Owner::reset_chain_head(self, hash).map_err(|e| e.kind().clone()) + fn reset_chain_head(&self, hash: String) -> Result<(), Error> { + Owner::reset_chain_head(self, hash) } - fn invalidate_header(&self, hash: String) -> Result<(), ErrorKind> { - Owner::invalidate_header(self, hash).map_err(|e| e.kind().clone()) + fn invalidate_header(&self, hash: String) -> Result<(), Error> { + Owner::invalidate_header(self, hash) } - fn compact_chain(&self) -> Result<(), ErrorKind> { - Owner::compact_chain(self).map_err(|e| e.kind().clone()) + fn compact_chain(&self) -> Result<(), Error> { + Owner::compact_chain(self) } - fn get_peers(&self, addr: Option) -> Result, ErrorKind> { - Owner::get_peers(self, addr).map_err(|e| e.kind().clone()) + fn get_peers(&self, addr: Option) -> Result, Error> { + Owner::get_peers(self, addr) } - fn get_connected_peers(&self) -> Result, ErrorKind> { - Owner::get_connected_peers(self).map_err(|e| e.kind().clone()) + fn get_connected_peers(&self) -> Result, Error> { + Owner::get_connected_peers(self) } - fn ban_peer(&self, addr: SocketAddr) -> Result<(), ErrorKind> { - Owner::ban_peer(self, addr).map_err(|e| e.kind().clone()) + fn ban_peer(&self, addr: SocketAddr) -> Result<(), Error> { + Owner::ban_peer(self, addr) } - fn unban_peer(&self, addr: SocketAddr) -> Result<(), ErrorKind> { - Owner::unban_peer(self, addr).map_err(|e| e.kind().clone()) + fn unban_peer(&self, addr: SocketAddr) -> Result<(), Error> { + Owner::unban_peer(self, addr) } } diff --git a/api/src/rest.rs b/api/src/rest.rs index f90d7e4b8..31e7468d8 100644 --- a/api/src/rest.rs +++ b/api/src/rest.rs @@ -20,7 +20,6 @@ use crate::router::{Handler, HandlerObj, ResponseFuture, Router, RouterError}; use crate::web::response; -use failure::{Backtrace, Context, Fail, ResultExt}; use futures::channel::oneshot; use futures::TryStreamExt; use hyper::server::accept; @@ -28,7 +27,6 @@ use hyper::service::make_service_fn; use hyper::{Body, Request, Server, StatusCode}; use rustls::internal::pemfile; use std::convert::Infallible; -use std::fmt::{self, Display}; use std::fs::File; use std::net::SocketAddr; use std::sync::Arc; @@ -39,76 +37,28 @@ use tokio::stream::StreamExt; use tokio_rustls::TlsAcceptor; /// Errors that can be returned by an ApiEndpoint implementation. -#[derive(Debug)] -pub struct Error { - inner: Context, -} - -#[derive(Clone, Eq, PartialEq, Debug, Fail, Serialize, Deserialize)] -pub enum ErrorKind { - #[fail(display = "Internal error: {}", _0)] +#[derive(Clone, Eq, PartialEq, Debug, thiserror::Error, Serialize, Deserialize)] +pub enum Error { + #[error("Internal error: {0}")] Internal(String), - #[fail(display = "Bad arguments: {}", _0)] + #[error("Bad arguments: {0}")] Argument(String), - #[fail(display = "Not found.")] + #[error("Not found.")] NotFound, - #[fail(display = "Request error: {}", _0)] + #[error("Request error: {0}")] RequestError(String), - #[fail(display = "ResponseError error: {}", _0)] + #[error("ResponseError error: {0}")] ResponseError(String), - #[fail(display = "Router error: {}", _0)] - Router(RouterError), -} - -impl Fail for Error { - fn cause(&self) -> Option<&dyn Fail> { - self.inner.cause() - } - - fn backtrace(&self) -> Option<&Backtrace> { - self.inner.backtrace() - } -} - -impl Display for Error { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - Display::fmt(&self.inner, f) - } -} - -impl Error { - pub fn kind(&self) -> &ErrorKind { - self.inner.get_context() - } -} - -impl From for Error { - fn from(kind: ErrorKind) -> Error { - Error { - inner: Context::new(kind), - } - } -} - -impl From> for Error { - fn from(inner: Context) -> Error { - Error { inner: inner } - } -} - -impl From for Error { - fn from(error: RouterError) -> Error { - Error { - inner: Context::new(ErrorKind::Router(error)), - } - } + #[error("Router error: {source}")] + Router { + #[from] + source: RouterError, + }, } impl From for Error { fn from(error: crate::chain::Error) -> Error { - Error { - inner: Context::new(ErrorKind::Internal(error.to_string())), - } + Error::Internal(error.to_string()) } } @@ -128,27 +78,24 @@ impl TLSConfig { } fn load_certs(&self) -> Result, Error> { - let certfile = File::open(&self.certificate).context(ErrorKind::Internal(format!( - "failed to open file {}", - self.certificate - )))?; + let certfile = File::open(&self.certificate).map_err(|e| { + Error::Internal(format!("failed to open file {} {}", self.certificate, e)) + })?; let mut reader = io::BufReader::new(certfile); pemfile::certs(&mut reader) - .map_err(|_| ErrorKind::Internal("failed to load certificate".to_string()).into()) + .map_err(|_| Error::Internal("failed to load certificate".to_string())) } fn load_private_key(&self) -> Result { - let keyfile = File::open(&self.private_key).context(ErrorKind::Internal(format!( - "failed to open file {}", - self.private_key - )))?; + let keyfile = File::open(&self.private_key) + .map_err(|e| Error::Internal(format!("failed to open private key file {}", e)))?; let mut reader = io::BufReader::new(keyfile); let keys = pemfile::pkcs8_private_keys(&mut reader) - .map_err(|_| ErrorKind::Internal("failed to load private key".to_string()))?; + .map_err(|_| Error::Internal("failed to load private key".to_string()))?; if keys.len() != 1 { - return Err(ErrorKind::Internal("expected a single private key".to_string()).into()); + return Err(Error::Internal("expected a single private key".to_string())); } Ok(keys[0].clone()) } @@ -158,9 +105,7 @@ impl TLSConfig { let key = self.load_private_key()?; let mut cfg = rustls::ServerConfig::new(rustls::NoClientAuth::new()); cfg.set_single_cert(certs, key) - .context(ErrorKind::Internal( - "set single certificate failed".to_string(), - ))?; + .map_err(|e| Error::Internal(format!("set single certificate failed {}", e)))?; Ok(Arc::new(cfg)) } } @@ -202,10 +147,9 @@ impl ApiServer { api_chan: &'static mut (oneshot::Sender<()>, oneshot::Receiver<()>), ) -> Result, Error> { if self.shutdown_sender.is_some() { - return Err(ErrorKind::Internal( + return Err(Error::Internal( "Can't start HTTP API server, it's running already".to_string(), - ) - .into()); + )); } let rx = &mut api_chan.1; let tx = &mut api_chan.0; @@ -238,7 +182,7 @@ impl ApiServer { eprintln!("HTTP API server error: {}", e) } }) - .map_err(|_| ErrorKind::Internal("failed to spawn API thread".to_string()).into()) + .map_err(|_| Error::Internal("failed to spawn API thread".to_string())) } /// Starts the TLS ApiServer at the provided address. @@ -251,10 +195,9 @@ impl ApiServer { api_chan: &'static mut (oneshot::Sender<()>, oneshot::Receiver<()>), ) -> Result, Error> { if self.shutdown_sender.is_some() { - return Err(ErrorKind::Internal( + return Err(Error::Internal( "Can't start HTTPS API server, it's running already".to_string(), - ) - .into()); + )); } let rx = &mut api_chan.1; @@ -296,7 +239,7 @@ impl ApiServer { eprintln!("HTTP API server error: {}", e) } }) - .map_err(|_| ErrorKind::Internal("failed to spawn API thread".to_string()).into()) + .map_err(|_| Error::Internal("failed to spawn API thread".to_string())) } /// Stops the API server, it panics in case of error diff --git a/api/src/router.rs b/api/src/router.rs index 8f3b503df..61c542135 100644 --- a/api/src/router.rs +++ b/api/src/router.rs @@ -86,13 +86,13 @@ pub trait Handler { } } -#[derive(Clone, Fail, Eq, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, thiserror::Error, Eq, Debug, PartialEq, Serialize, Deserialize)] pub enum RouterError { - #[fail(display = "Route already exists")] + #[error("Route already exists")] RouteAlreadyExists, - #[fail(display = "Route not found")] + #[error("Route not found")] RouteNotFound, - #[fail(display = "Value not found")] + #[error("Value not found")] NoValue, } diff --git a/api/src/web.rs b/api/src/web.rs index 06e7547fb..dd6ad09cb 100644 --- a/api/src/web.rs +++ b/api/src/web.rs @@ -16,10 +16,10 @@ where { let raw = body::to_bytes(req.into_body()) .await - .map_err(|e| ErrorKind::RequestError(format!("Failed to read request: {}", e)))?; + .map_err(|e| Error::RequestError(format!("Failed to read request: {}", e)))?; serde_json::from_reader(raw.bytes()) - .map_err(|e| ErrorKind::RequestError(format!("Invalid request body: {}", e)).into()) + .map_err(|e| Error::RequestError(format!("Invalid request body: {}", e))) } /// Convert Result to ResponseFuture @@ -29,16 +29,14 @@ where { match res { Ok(s) => json_response_pretty(&s), - Err(e) => match e.kind() { - ErrorKind::Argument(msg) => response(StatusCode::BAD_REQUEST, msg.clone()), - ErrorKind::RequestError(msg) => response(StatusCode::BAD_REQUEST, msg.clone()), - ErrorKind::NotFound => response(StatusCode::NOT_FOUND, ""), - ErrorKind::Internal(msg) => response(StatusCode::INTERNAL_SERVER_ERROR, msg.clone()), - ErrorKind::ResponseError(msg) => { - response(StatusCode::INTERNAL_SERVER_ERROR, msg.clone()) - } + Err(e) => match e { + Error::Argument(msg) => response(StatusCode::BAD_REQUEST, msg.clone()), + Error::RequestError(msg) => response(StatusCode::BAD_REQUEST, msg.clone()), + Error::NotFound => response(StatusCode::NOT_FOUND, ""), + Error::Internal(msg) => response(StatusCode::INTERNAL_SERVER_ERROR, msg.clone()), + Error::ResponseError(msg) => response(StatusCode::INTERNAL_SERVER_ERROR, msg.clone()), // place holder - ErrorKind::Router(_) => response(StatusCode::INTERNAL_SERVER_ERROR, ""), + Error::Router { .. } => response(StatusCode::INTERNAL_SERVER_ERROR, ""), }, } } @@ -147,7 +145,7 @@ macro_rules! must_get_query( ($req: expr) =>( match $req.uri().query() { Some(q) => q, - None => return Err(ErrorKind::RequestError("no query string".to_owned()).into()), + None => return Err(Error::RequestError("no query string".to_owned())), } )); @@ -158,7 +156,7 @@ macro_rules! parse_param( None => $default, Some(val) => match val.parse() { Ok(val) => val, - Err(_) => return Err(ErrorKind::RequestError(format!("invalid value of parameter {}", $name)).into()), + Err(_) => return Err(Error::RequestError(format!("invalid value of parameter {}", $name))), } } )); diff --git a/azure-pipelines.yml b/azure-pipelines.yml index d60e544b4..96300796f 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -67,9 +67,6 @@ jobs: CI_JOB: release PLATFORM: macos steps: - - script: | - brew uninstall llvm - displayName: macOS Uninstall LLVM - template: '.ci/test.yml' - template: '.ci/release.yml' - job: windows diff --git a/chain/Cargo.toml b/chain/Cargo.toml index 8ceff12a4..908bf1983 100644 --- a/chain/Cargo.toml +++ b/chain/Cargo.toml @@ -13,13 +13,12 @@ edition = "2018" bit-vec = "0.6" bitflags = "1" byteorder = "1" -failure = "0.1" -failure_derive = "0.1" croaring = "0.4.6" enum_primitive = "0.1" log = "0.4" serde = "1" serde_derive = "1" +thiserror = "1" chrono = "0.4.11" lru-cache = "0.1" lazy_static = "1" diff --git a/chain/src/chain.rs b/chain/src/chain.rs index 52bb6dc5c..dc74f7fa2 100644 --- a/chain/src/chain.rs +++ b/chain/src/chain.rs @@ -23,7 +23,7 @@ use crate::core::core::{ use crate::core::global; use crate::core::pow; use crate::core::ser::ProtocolVersion; -use crate::error::{Error, ErrorKind}; +use crate::error::Error; use crate::pipe; use crate::store; use crate::txhashset; @@ -376,11 +376,11 @@ impl Chain { pub fn is_known(&self, header: &BlockHeader) -> Result<(), Error> { let head = self.head()?; if head.hash() == header.hash() { - return Err(ErrorKind::Unfit("duplicate block".into()).into()); + return Err(Error::Unfit("duplicate block".into())); } if header.total_difficulty() <= head.total_difficulty { if self.block_exists(header.hash())? { - return Err(ErrorKind::Unfit("duplicate block".into()).into()); + return Err(Error::Unfit("duplicate block".into())); } } Ok(()) @@ -416,7 +416,7 @@ impl Chain { }, ); - Err(ErrorKind::Orphan.into()) + Err(Error::Orphan) } /// Attempt to add a new block to the chain. @@ -681,7 +681,7 @@ impl Chain { if tx.lock_height() <= height { Ok(()) } else { - Err(ErrorKind::TxLockHeight.into()) + Err(Error::TxLockHeight) } } @@ -1091,7 +1091,7 @@ impl Chain { let fork_point = self.fork_point()?; if !self.check_txhashset_needed(&fork_point)? { warn!("txhashset_write: txhashset received but it's not needed! ignored."); - return Err(ErrorKind::InvalidTxHashSet("not needed".to_owned()).into()); + return Err(Error::InvalidTxHashSet("not needed".to_owned())); } let header = match self.get_block_header(&h) { @@ -1369,10 +1369,9 @@ impl Chain { let rangeproofs = txhashset.rangeproofs_by_pmmr_index(start_index, max_count, max_pmmr_index); if outputs.0 != rangeproofs.0 || outputs.1.len() != rangeproofs.1.len() { - return Err(ErrorKind::TxHashSetErr(String::from( + return Err(Error::TxHashSetErr(String::from( "Output and rangeproof sets don't match", - )) - .into()); + ))); } let mut output_vec: Vec = vec![]; for (ref x, &y) in outputs.1.iter().zip(rangeproofs.1.iter()) { @@ -1411,56 +1410,56 @@ impl Chain { pub fn head(&self) -> Result { self.store .head() - .map_err(|e| ErrorKind::StoreErr(e, "chain head".to_owned()).into()) + .map_err(|e| Error::StoreErr(e, "chain head".to_owned())) } /// Tail of the block chain in this node after compact (cross-block cut-through) pub fn tail(&self) -> Result { self.store .tail() - .map_err(|e| ErrorKind::StoreErr(e, "chain tail".to_owned()).into()) + .map_err(|e| Error::StoreErr(e, "chain tail".to_owned())) } /// Tip (head) of the header chain. pub fn header_head(&self) -> Result { self.store .header_head() - .map_err(|e| ErrorKind::StoreErr(e, "header head".to_owned()).into()) + .map_err(|e| Error::StoreErr(e, "header head".to_owned())) } /// Block header for the chain head pub fn head_header(&self) -> Result { self.store .head_header() - .map_err(|e| ErrorKind::StoreErr(e, "chain head header".to_owned()).into()) + .map_err(|e| Error::StoreErr(e, "chain head header".to_owned())) } /// Gets a block by hash pub fn get_block(&self, h: &Hash) -> Result { self.store .get_block(h) - .map_err(|e| ErrorKind::StoreErr(e, "chain get block".to_owned()).into()) + .map_err(|e| Error::StoreErr(e, "chain get block".to_owned())) } /// Gets a block header by hash pub fn get_block_header(&self, h: &Hash) -> Result { self.store .get_block_header(h) - .map_err(|e| ErrorKind::StoreErr(e, "chain get header".to_owned()).into()) + .map_err(|e| Error::StoreErr(e, "chain get header".to_owned())) } /// Get previous block header. pub fn get_previous_header(&self, header: &BlockHeader) -> Result { self.store .get_previous_header(header) - .map_err(|e| ErrorKind::StoreErr(e, "chain get previous header".to_owned()).into()) + .map_err(|e| Error::StoreErr(e, "chain get previous header".to_owned())) } /// Get block_sums by header hash. pub fn get_block_sums(&self, h: &Hash) -> Result { self.store .get_block_sums(h) - .map_err(|e| ErrorKind::StoreErr(e, "chain get block_sums".to_owned()).into()) + .map_err(|e| Error::StoreErr(e, "chain get block_sums".to_owned())) } /// Gets the block header at the provided height. @@ -1482,7 +1481,7 @@ impl Chain { let txhashset = self.txhashset.read(); let (_, pos) = match txhashset.get_unspent(commit)? { Some(o) => o, - None => return Err(ErrorKind::OutputNotFound.into()), + None => return Err(Error::OutputNotFound), }; let hash = header_pmmr.get_header_hash_by_height(pos.height)?; Ok(self.get_block_header(&hash)?) @@ -1584,13 +1583,13 @@ impl Chain { fn is_on_current_chain>(&self, x: T, head: Tip) -> Result<(), Error> { let x: Tip = x.into(); if x.height > head.height { - return Err(ErrorKind::Other("not on current chain".to_string()).into()); + return Err(Error::Other("not on current chain".to_string())); } if x.hash() == self.get_header_hash_by_height(x.height)? { Ok(()) } else { - Err(ErrorKind::Other("not on current chain".to_string()).into()) + Err(Error::Other("not on current chain".to_string())) } } @@ -1624,7 +1623,7 @@ impl Chain { pub fn block_exists(&self, h: Hash) -> Result { self.store .block_exists(&h) - .map_err(|e| ErrorKind::StoreErr(e, "chain block exists".to_owned()).into()) + .map_err(|e| Error::StoreErr(e, "chain block exists".to_owned())) } } @@ -1789,7 +1788,7 @@ fn setup_head( info!("init: saved genesis: {:?}", genesis.hash()); } - Err(e) => return Err(ErrorKind::StoreErr(e, "chain init load head".to_owned()).into()), + Err(e) => return Err(Error::StoreErr(e, "chain init load head".to_owned())), }; batch.commit()?; Ok(()) diff --git a/chain/src/error.rs b/chain/src/error.rs index b35c88a3f..3ed9b3c88 100644 --- a/chain/src/error.rs +++ b/chain/src/error.rs @@ -19,293 +19,204 @@ use crate::core::ser; use crate::keychain; use crate::util::secp; use crate::util::secp::pedersen::Commitment; -use failure::{Backtrace, Context, Fail}; use grin_store as store; -use std::fmt::{self, Display}; use std::io; -/// Error definition -#[derive(Debug, Fail)] -pub struct Error { - inner: Context, -} - /// Chain error definitions -#[derive(Clone, Eq, PartialEq, Debug, Fail)] -pub enum ErrorKind { +#[derive(Clone, Eq, PartialEq, Debug, thiserror::Error)] +pub enum Error { /// The block doesn't fit anywhere in our chain - #[fail(display = "Block is unfit: {}", _0)] + #[error("Block is unfit: {0}")] Unfit(String), /// Special case of orphan blocks - #[fail(display = "Orphan")] + #[error("Orphan")] Orphan, /// Difficulty is too low either compared to ours or the block PoW hash - #[fail(display = "Difficulty is too low compared to ours or the block PoW hash")] + #[error("Difficulty is too low compared to ours or the block PoW hash")] DifficultyTooLow, /// Addition of difficulties on all previous block is wrong - #[fail(display = "Addition of difficulties on all previous blocks is wrong")] + #[error("Addition of difficulties on all previous blocks is wrong")] WrongTotalDifficulty, /// Block header edge_bits is lower than our min - #[fail(display = "Cuckoo Size too small")] + #[error("Cuckoo Size too small")] LowEdgebits, /// Scaling factor between primary and secondary PoW is invalid - #[fail(display = "Wrong scaling factor")] + #[error("Wrong scaling factor")] InvalidScaling, /// The proof of work is invalid - #[fail(display = "Invalid PoW")] + #[error("Invalid PoW")] InvalidPow, /// Peer abusively sending us an old block we already have - #[fail(display = "Old Block")] + #[error("Old Block")] OldBlock, /// The block doesn't sum correctly or a tx signature is invalid - #[fail(display = "Invalid Block Proof")] - InvalidBlockProof(block::Error), + #[error("Invalid Block Proof")] + InvalidBlockProof { + #[from] + /// Conversion + source: block::Error, + }, /// Block time is too old - #[fail(display = "Invalid Block Time")] + #[error("Invalid Block Time")] InvalidBlockTime, /// Block height is invalid (not previous + 1) - #[fail(display = "Invalid Block Height")] + #[error("Invalid Block Height")] InvalidBlockHeight, /// One of the root hashes in the block is invalid - #[fail(display = "Invalid Root")] + #[error("Invalid Root")] InvalidRoot, /// One of the MMR sizes in the block header is invalid - #[fail(display = "Invalid MMR Size")] + #[error("Invalid MMR Size")] InvalidMMRSize, /// Error from underlying keychain impl - #[fail(display = "Keychain Error")] - Keychain(keychain::Error), + #[error("Keychain Error")] + Keychain { + #[from] + /// Conversion + source: keychain::Error, + }, /// Error from underlying secp lib - #[fail(display = "Secp Lib Error")] - Secp(secp::Error), + #[error("Secp Lib Error")] + Secp { + #[from] + /// Conversion + source: secp::Error, + }, /// One of the inputs in the block has already been spent - #[fail(display = "Already Spent: {:?}", _0)] + #[error("Already Spent: {0:?}")] AlreadySpent(Commitment), /// An output with that commitment already exists (should be unique) - #[fail(display = "Duplicate Commitment: {:?}", _0)] + #[error("Duplicate Commitment: {0:?}")] DuplicateCommitment(Commitment), /// Attempt to spend a coinbase output before it sufficiently matures. - #[fail(display = "Attempt to spend immature coinbase")] + #[error("Attempt to spend immature coinbase")] ImmatureCoinbase, /// Error validating a Merkle proof (coinbase output) - #[fail(display = "Error validating merkle proof")] + #[error("Error validating merkle proof")] MerkleProof, /// Output not found - #[fail(display = "Output not found")] + #[error("Output not found")] OutputNotFound, /// Rangeproof not found - #[fail(display = "Rangeproof not found")] + #[error("Rangeproof not found")] RangeproofNotFound, /// Tx kernel not found - #[fail(display = "Tx kernel not found")] + #[error("Tx kernel not found")] TxKernelNotFound, /// output spent - #[fail(display = "Output is spent")] + #[error("Output is spent")] OutputSpent, /// Invalid block version, either a mistake or outdated software - #[fail(display = "Invalid Block Version: {:?}", _0)] + #[error("Invalid Block Version: {0:?}")] InvalidBlockVersion(block::HeaderVersion), /// We've been provided a bad txhashset - #[fail(display = "Invalid TxHashSet: {}", _0)] + #[error("Invalid TxHashSet: {0}")] InvalidTxHashSet(String), /// Internal issue when trying to save or load data from store - #[fail(display = "Store Error: {}, reason: {}", _1, _0)] + #[error("Store Error: {1}, reason: {0}")] StoreErr(store::Error, String), /// Internal issue when trying to save or load data from append only files - #[fail(display = "File Read Error: {}", _0)] + #[error("File Read Error: {0}")] FileReadErr(String), /// Error serializing or deserializing a type - #[fail(display = "Serialization Error")] - SerErr(ser::Error), + #[error("Serialization Error")] + SerErr { + #[from] + /// Conversion + source: ser::Error, + }, /// Error with the txhashset - #[fail(display = "TxHashSetErr: {}", _0)] + #[error("TxHashSetErr: {0}")] TxHashSetErr(String), /// Tx not valid based on lock_height. - #[fail(display = "Transaction Lock Height")] + #[error("Transaction Lock Height")] TxLockHeight, /// Tx is not valid due to NRD relative_height restriction. - #[fail(display = "NRD Relative Height")] + #[error("NRD Relative Height")] NRDRelativeHeight, /// No chain exists and genesis block is required - #[fail(display = "Genesis Block Required")] + #[error("Genesis Block Required")] GenesisBlockRequired, /// Error from underlying tx handling - #[fail(display = "Transaction Validation Error: {:?}", _0)] - Transaction(transaction::Error), + #[error("Transaction Validation Error: {source:?}")] + Transaction { + /// Conversion + #[from] + source: transaction::Error, + }, /// Error from underlying block handling - #[fail(display = "Block Validation Error: {:?}", _0)] + #[error("Block Validation Error: {0:?}")] Block(block::Error), /// Attempt to retrieve a header at a height greater than /// the max allowed by u64 limits - #[fail(display = "Invalid Header Height: {}", _0)] + #[error("Invalid Header Height: {0:?}")] InvalidHeaderHeight(u64), /// Anything else - #[fail(display = "Other Error: {}", _0)] + #[error("Other Error: {0}")] Other(String), /// Error from summing and verifying kernel sums via committed trait. - #[fail(display = "Committed Trait: Error summing and verifying kernel sums")] - Committed(committed::Error), + #[error("Committed Trait: Error summing and verifying kernel sums")] + Committed { + #[from] + /// Conversion + source: committed::Error, + }, /// We cannot process data once the Grin server has been stopped. - #[fail(display = "Stopped (Grin Shutting Down)")] + #[error("Stopped (Grin Shutting Down)")] Stopped, /// Internal Roaring Bitmap error - #[fail(display = "Roaring Bitmap error")] + #[error("Roaring Bitmap error")] Bitmap, /// Error during chain sync - #[fail(display = "Sync error")] + #[error("Sync error")] SyncError(String), /// PIBD segment related error - #[fail(display = "Segment error")] - SegmentError(segment::SegmentError), + #[error("Segment error")] + SegmentError { + #[from] + /// Conversion + source: segment::SegmentError, + }, /// We've decided to halt the PIBD process due to lack of supporting peers or /// otherwise failing to progress for a certain amount of time - #[fail(display = "Aborting PIBD error")] + #[error("Aborting PIBD error")] AbortingPIBDError, /// The segmenter is associated to a different block header - #[fail(display = "Segmenter header mismatch")] + #[error("Segmenter header mismatch")] SegmenterHeaderMismatch, /// Segment height not within allowed range - #[fail(display = "Invalid segment height")] + #[error("Invalid segment height")] InvalidSegmentHeight, /// Other issue with segment - #[fail(display = "Invalid segment: {}", _0)] + #[error("Invalid segment: {0}")] InvalidSegment(String), } -impl Display for Error { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - let cause = match self.cause() { - Some(c) => format!("{}", c), - None => String::from("Unknown"), - }; - let backtrace = match self.backtrace() { - Some(b) => format!("{}", b), - None => String::from("Unknown"), - }; - let output = format!( - "{} \n Cause: {} \n Backtrace: {}", - self.inner, cause, backtrace - ); - Display::fmt(&output, f) - } -} - impl Error { - /// get kind - pub fn kind(&self) -> ErrorKind { - self.inner.get_context().clone() - } - /// get cause - pub fn cause(&self) -> Option<&dyn Fail> { - self.inner.cause() - } - /// get backtrace - pub fn backtrace(&self) -> Option<&Backtrace> { - self.inner.backtrace() - } - /// Whether the error is due to a block that was intrinsically wrong pub fn is_bad_data(&self) -> bool { // shorter to match on all the "not the block's fault" errors - match self.kind() { - ErrorKind::Unfit(_) - | ErrorKind::Orphan - | ErrorKind::StoreErr(_, _) - | ErrorKind::SerErr(_) - | ErrorKind::TxHashSetErr(_) - | ErrorKind::GenesisBlockRequired - | ErrorKind::Other(_) => false, + match self { + Error::Unfit(_) + | Error::Orphan + | Error::StoreErr(_, _) + | Error::SerErr { .. } + | Error::TxHashSetErr(_) + | Error::GenesisBlockRequired + | Error::Other(_) => false, _ => true, } } } -impl From for Error { - fn from(kind: ErrorKind) -> Error { - Error { - inner: Context::new(kind), - } - } -} - -impl From> for Error { - fn from(inner: Context) -> Error { - Error { inner: inner } - } -} - -impl From for Error { - fn from(error: block::Error) -> Error { - let ec = error.clone(); - Error { - inner: error.context(ErrorKind::InvalidBlockProof(ec)), - } - } -} - impl From for Error { fn from(error: store::Error) -> Error { - let ec = error.clone(); - Error { - //inner: error.context();Context::new(ErrorKind::StoreErr(error.clone(), - // format!("{:?}", error))), - inner: error.context(ErrorKind::StoreErr(ec.clone(), format!("{:?}", ec))), - } - } -} - -impl From for Error { - fn from(error: keychain::Error) -> Error { - Error { - inner: Context::new(ErrorKind::Keychain(error)), - } - } -} - -impl From for Error { - fn from(error: transaction::Error) -> Error { - Error { - inner: Context::new(ErrorKind::Transaction(error)), - } - } -} - -impl From for Error { - fn from(error: committed::Error) -> Error { - Error { - inner: Context::new(ErrorKind::Committed(error)), - } + Error::StoreErr(error.clone(), format!("{:?}", error)) } } impl From for Error { fn from(e: io::Error) -> Error { - Error { - inner: Context::new(ErrorKind::TxHashSetErr(e.to_string())), - } - } -} - -impl From for Error { - fn from(error: ser::Error) -> Error { - Error { - inner: Context::new(ErrorKind::SerErr(error)), - } - } -} - -impl From for Error { - fn from(error: segment::SegmentError) -> Error { - Error { - inner: Context::new(ErrorKind::SegmentError(error)), - } - } -} - -impl From for Error { - fn from(e: secp::Error) -> Error { - Error { - inner: Context::new(ErrorKind::Secp(e)), - } + Error::TxHashSetErr(e.to_string()) } } diff --git a/chain/src/lib.rs b/chain/src/lib.rs index eb7a68449..1ece28456 100644 --- a/chain/src/lib.rs +++ b/chain/src/lib.rs @@ -47,7 +47,7 @@ pub mod types; // Re-export the base interface pub use crate::chain::{Chain, MAX_ORPHAN_SIZE}; -pub use crate::error::{Error, ErrorKind}; +pub use crate::error::Error; pub use crate::store::ChainStore; pub use crate::types::{ BlockStatus, ChainAdapter, Options, SyncState, SyncStatus, Tip, TxHashsetDownloadStats, diff --git a/chain/src/pipe.rs b/chain/src/pipe.rs index 8a8504420..e49ea5792 100644 --- a/chain/src/pipe.rs +++ b/chain/src/pipe.rs @@ -22,7 +22,7 @@ use crate::core::core::{ }; use crate::core::global; use crate::core::pow; -use crate::error::{Error, ErrorKind}; +use crate::error::Error; use crate::store; use crate::txhashset; use crate::types::{CommitPos, Options, Tip}; @@ -63,14 +63,14 @@ fn validate_pow_only(header: &BlockHeader, ctx: &mut BlockContext<'_>) -> Result return Ok(()); } if !header.pow.is_primary() && !header.pow.is_secondary() { - return Err(ErrorKind::LowEdgebits.into()); + return Err(Error::LowEdgebits); } if (ctx.pow_verifier)(header).is_err() { error!( "pipe: error validating header with cuckoo edge_bits {}", header.pow.edge_bits(), ); - return Err(ErrorKind::InvalidPow.into()); + return Err(Error::InvalidPow); } Ok(()) } @@ -289,7 +289,7 @@ pub fn process_block_header(header: &BlockHeader, ctx: &mut BlockContext<'_>) -> fn check_known_head(header: &BlockHeader, head: &Tip) -> Result<(), Error> { let bh = header.hash(); if bh == head.last_block_h || bh == head.prev_block_h { - return Err(ErrorKind::Unfit("already known in head".to_string()).into()); + return Err(Error::Unfit("already known in head".to_string())); } Ok(()) } @@ -306,16 +306,16 @@ fn check_known_store( // TODO - we flag this as an "abusive peer" but only in the case // where we have the full block in our store. // So this is not a particularly exhaustive check. - Err(ErrorKind::OldBlock.into()) + Err(Error::OldBlock) } else { - Err(ErrorKind::Unfit("already known in store".to_string()).into()) + Err(Error::Unfit("already known in store".to_string())) } } Ok(false) => { // Not yet processed this block, we can proceed. Ok(()) } - Err(e) => Err(ErrorKind::StoreErr(e, "pipe get this block".to_owned()).into()), + Err(e) => Err(Error::StoreErr(e, "pipe get this block".to_owned())), } } @@ -352,7 +352,9 @@ pub fn validate_header_denylist(header: &BlockHeader, denylist: &[Hash]) -> Resu ); if denylist.contains(&header.hash()) { - return Err(ErrorKind::Block(block::Error::Other("header hash denied".into())).into()); + return Err(Error::Block(block::Error::Other( + "header hash denied".into(), + ))); } else { return Ok(()); } @@ -370,18 +372,18 @@ fn validate_header(header: &BlockHeader, ctx: &mut BlockContext<'_>) -> Result<( // This header height must increase the height from the previous header by exactly 1. if header.height != prev.height + 1 { - return Err(ErrorKind::InvalidBlockHeight.into()); + return Err(Error::InvalidBlockHeight); } // This header must have a valid header version for its height. if !consensus::valid_header_version(header.height, header.version) { - return Err(ErrorKind::InvalidBlockVersion(header.version).into()); + return Err(Error::InvalidBlockVersion(header.version)); } if header.timestamp <= prev.timestamp { // prevent time warp attacks and some timestamp manipulations by forcing strict // time progression - return Err(ErrorKind::InvalidBlockTime.into()); + return Err(Error::InvalidBlockTime); } // We can determine output and kernel counts for this block based on mmr sizes from previous header. @@ -395,13 +397,13 @@ fn validate_header(header: &BlockHeader, ctx: &mut BlockContext<'_>) -> Result<( // Each block must contain at least 1 kernel and 1 output for the block reward. if num_outputs == 0 || num_kernels == 0 { - return Err(ErrorKind::InvalidMMRSize.into()); + return Err(Error::InvalidMMRSize); } // Block header is invalid (and block is invalid) if this lower bound is too heavy for a full block. let weight = TransactionBody::weight_by_iok(0, num_outputs, num_kernels); if weight > global::max_block_weight() { - return Err(ErrorKind::Block(block::Error::TooHeavy).into()); + return Err(Error::Block(block::Error::TooHeavy)); } // verify the proof of work and related parameters @@ -416,13 +418,13 @@ fn validate_header(header: &BlockHeader, ctx: &mut BlockContext<'_>) -> Result<( validate_pow_only(header, ctx)?; if header.total_difficulty() <= prev.total_difficulty() { - return Err(ErrorKind::DifficultyTooLow.into()); + return Err(Error::DifficultyTooLow); } let target_difficulty = header.total_difficulty() - prev.total_difficulty(); if header.pow.to_difficulty(header.height) < target_difficulty { - return Err(ErrorKind::DifficultyTooLow.into()); + return Err(Error::DifficultyTooLow); } // explicit check to ensure total_difficulty has increased by exactly @@ -437,7 +439,7 @@ fn validate_header(header: &BlockHeader, ctx: &mut BlockContext<'_>) -> Result<( target_difficulty.to_num(), next_header_info.difficulty.to_num() ); - return Err(ErrorKind::WrongTotalDifficulty.into()); + return Err(Error::WrongTotalDifficulty); } // check the secondary PoW scaling factor if applicable if header.version < HeaderVersion(5) @@ -447,7 +449,7 @@ fn validate_header(header: &BlockHeader, ctx: &mut BlockContext<'_>) -> Result<( "validate_header: header secondary scaling {} != {}", header.pow.secondary_scaling, next_header_info.secondary_scaling ); - return Err(ErrorKind::InvalidScaling.into()); + return Err(Error::InvalidScaling); } } @@ -456,9 +458,7 @@ fn validate_header(header: &BlockHeader, ctx: &mut BlockContext<'_>) -> Result<( fn validate_block(block: &Block, ctx: &mut BlockContext<'_>) -> Result<(), Error> { let prev = ctx.batch.get_previous_header(&block.header)?; - block - .validate(&prev.total_kernel_offset) - .map_err(ErrorKind::InvalidBlockProof)?; + block.validate(&prev.total_kernel_offset)?; Ok(()) } @@ -530,7 +530,7 @@ fn update_body_tail(bh: &BlockHeader, batch: &store::Batch<'_>) -> Result<(), Er let tip = Tip::from_header(bh); batch .save_body_tail(&tip) - .map_err(|e| ErrorKind::StoreErr(e, "pipe save body tail".to_owned()))?; + .map_err(|e| Error::StoreErr(e, "pipe save body tail".to_owned()))?; debug!("body tail {} @ {}", bh.hash(), bh.height); Ok(()) } @@ -539,14 +539,14 @@ fn update_body_tail(bh: &BlockHeader, batch: &store::Batch<'_>) -> Result<(), Er fn add_block_header(bh: &BlockHeader, batch: &store::Batch<'_>) -> Result<(), Error> { batch .save_block_header(bh) - .map_err(|e| ErrorKind::StoreErr(e, "pipe save header".to_owned()))?; + .map_err(|e| Error::StoreErr(e, "pipe save header".to_owned()))?; Ok(()) } fn update_header_head(head: &Tip, batch: &store::Batch<'_>) -> Result<(), Error> { batch .save_header_head(&head) - .map_err(|e| ErrorKind::StoreErr(e, "pipe save header head".to_owned()))?; + .map_err(|e| Error::StoreErr(e, "pipe save header head".to_owned()))?; debug!( "header head updated to {} at {}", @@ -559,7 +559,7 @@ fn update_header_head(head: &Tip, batch: &store::Batch<'_>) -> Result<(), Error> fn update_head(head: &Tip, batch: &store::Batch<'_>) -> Result<(), Error> { batch .save_body_head(&head) - .map_err(|e| ErrorKind::StoreErr(e, "pipe save body".to_owned()))?; + .map_err(|e| Error::StoreErr(e, "pipe save body".to_owned()))?; debug!("head updated to {} at {}", head.last_block_h, head.height); @@ -595,7 +595,7 @@ pub fn rewind_and_apply_header_fork( for h in fork_hashes { let header = batch .get_block_header(&h) - .map_err(|e| ErrorKind::StoreErr(e, "getting forked headers".to_string()))?; + .map_err(|e| Error::StoreErr(e, "getting forked headers".to_string()))?; // Re-validate every header being re-applied. // This makes it possible to check all header hashes against the ctx specific "denylist". @@ -646,7 +646,7 @@ pub fn rewind_and_apply_fork( for h in fork_hashes { let fb = batch .get_block(&h) - .map_err(|e| ErrorKind::StoreErr(e, "getting forked blocks".to_string()))?; + .map_err(|e| Error::StoreErr(e, "getting forked blocks".to_string()))?; // Re-verify coinbase maturity along this fork. verify_coinbase_maturity(&fb, ext, batch)?; diff --git a/chain/src/txhashset/bitmap_accumulator.rs b/chain/src/txhashset/bitmap_accumulator.rs index 2cd277b84..b0d8a0bc1 100644 --- a/chain/src/txhashset/bitmap_accumulator.rs +++ b/chain/src/txhashset/bitmap_accumulator.rs @@ -23,7 +23,7 @@ use crate::core::core::hash::{DefaultHashable, Hash}; use crate::core::core::pmmr::segment::{Segment, SegmentIdentifier, SegmentProof}; use crate::core::core::pmmr::{self, Backend, ReadablePMMR, ReadonlyPMMR, VecBackend, PMMR}; use crate::core::ser::{self, PMMRable, Readable, Reader, Writeable, Writer}; -use crate::error::{Error, ErrorKind}; +use crate::error::Error; use enum_primitive::FromPrimitive; /// The "bitmap accumulator" allows us to commit to a specific bitmap by splitting it into @@ -156,7 +156,7 @@ impl BitmapAccumulator { let mut pmmr = PMMR::at(&mut self.backend, last_pos); let rewind_pos = pmmr::insertion_to_pmmr_index(chunk_idx); pmmr.rewind(rewind_pos, &Bitmap::create()) - .map_err(ErrorKind::Other)?; + .map_err(Error::Other)?; Ok(()) } @@ -178,7 +178,7 @@ impl BitmapAccumulator { let last_pos = self.backend.size(); PMMR::at(&mut self.backend, last_pos) .push(&chunk) - .map_err(|e| ErrorKind::Other(e).into()) + .map_err(Error::Other) } /// The root hash of the bitmap accumulator MMR. diff --git a/chain/src/txhashset/rewindable_kernel_view.rs b/chain/src/txhashset/rewindable_kernel_view.rs index b2b2c2c4c..f49d03bb4 100644 --- a/chain/src/txhashset/rewindable_kernel_view.rs +++ b/chain/src/txhashset/rewindable_kernel_view.rs @@ -16,7 +16,7 @@ use crate::core::core::pmmr::{ReadablePMMR, ReadonlyPMMR, RewindablePMMR}; use crate::core::core::{BlockHeader, TxKernel}; -use crate::error::{Error, ErrorKind}; +use crate::error::Error; use grin_store::pmmr::PMMRBackend; /// Rewindable (but readonly) view of the kernel set (based on kernel MMR). @@ -40,7 +40,7 @@ impl<'a> RewindableKernelView<'a> { pub fn rewind(&mut self, header: &BlockHeader) -> Result<(), Error> { self.pmmr .rewind(header.kernel_mmr_size) - .map_err(&ErrorKind::TxHashSetErr)?; + .map_err(&Error::TxHashSetErr)?; // Update our header to reflect the one we rewound to. self.header = header.clone(); @@ -57,9 +57,9 @@ impl<'a> RewindableKernelView<'a> { let root = self .readonly_pmmr() .root() - .map_err(|_| ErrorKind::InvalidRoot)?; + .map_err(|_| Error::InvalidRoot)?; if root != self.header.kernel_root { - return Err(ErrorKind::InvalidTxHashSet(format!( + return Err(Error::InvalidTxHashSet(format!( "Kernel root at {} does not match", self.header.height )) diff --git a/chain/src/txhashset/segmenter.rs b/chain/src/txhashset/segmenter.rs index b614125a4..ed6a2aee2 100644 --- a/chain/src/txhashset/segmenter.rs +++ b/chain/src/txhashset/segmenter.rs @@ -19,7 +19,7 @@ use std::{sync::Arc, time::Instant}; use crate::core::core::hash::Hash; use crate::core::core::pmmr::ReadablePMMR; use crate::core::core::{BlockHeader, OutputIdentifier, Segment, SegmentIdentifier, TxKernel}; -use crate::error::{Error, ErrorKind}; +use crate::error::Error; use crate::txhashset::{BitmapAccumulator, BitmapChunk, TxHashSet}; use crate::util::secp::pedersen::RangeProof; use crate::util::RwLock; @@ -74,14 +74,14 @@ impl Segmenter { fn output_root(&self) -> Result { let txhashset = self.txhashset.read(); let pmmr = txhashset.output_pmmr_at(&self.header); - let root = pmmr.root().map_err(&ErrorKind::TxHashSetErr)?; + let root = pmmr.root().map_err(&Error::TxHashSetErr)?; Ok(root) } /// The root of the bitmap snapshot PMMR. fn bitmap_root(&self) -> Result { let pmmr = self.bitmap_snapshot.readonly_pmmr(); - let root = pmmr.root().map_err(&ErrorKind::TxHashSetErr)?; + let root = pmmr.root().map_err(&Error::TxHashSetErr)?; Ok(root) } diff --git a/chain/src/txhashset/txhashset.rs b/chain/src/txhashset/txhashset.rs index 817ccf793..19f3f1339 100644 --- a/chain/src/txhashset/txhashset.rs +++ b/chain/src/txhashset/txhashset.rs @@ -27,7 +27,7 @@ use crate::core::core::{ }; use crate::core::global; use crate::core::ser::{PMMRable, ProtocolVersion}; -use crate::error::{Error, ErrorKind}; +use crate::error::Error; use crate::linked_list::{ListIndex, PruneableListIndex, RewindableListIndex}; use crate::store::{self, Batch, ChainStore}; use crate::txhashset::bitmap_accumulator::{BitmapAccumulator, BitmapChunk}; @@ -140,7 +140,7 @@ impl PMMRHandle { head.hash(), head.height ); - return Err(ErrorKind::Other("header PMMR inconsistent".to_string()).into()); + return Err(Error::Other("header PMMR inconsistent".to_string())); } // use next header pos to find our size. @@ -165,14 +165,14 @@ impl PMMRHandle { /// Get the header hash at the specified height based on the current header MMR state. pub fn get_header_hash_by_height(&self, height: u64) -> Result { if height >= self.size { - return Err(ErrorKind::InvalidHeaderHeight(height).into()); + return Err(Error::InvalidHeaderHeight(height)); } let pos = pmmr::insertion_to_pmmr_index(height); let header_pmmr = ReadonlyPMMR::at(&self.backend, self.size); if let Some(entry) = header_pmmr.get_data(pos) { Ok(entry.hash()) } else { - Err(ErrorKind::Other("get header hash by height".to_string()).into()) + Err(Error::Other("get header hash by height".to_string())) } } @@ -180,14 +180,14 @@ impl PMMRHandle { /// Find the last leaf pos based on MMR size and return its header hash. pub fn head_hash(&self) -> Result { if self.size == 0 { - return Err(ErrorKind::Other("MMR empty, no head".to_string()).into()); + return Err(Error::Other("MMR empty, no head".to_string())); } let header_pmmr = ReadonlyPMMR::at(&self.backend, self.size); let leaf_pos = pmmr::bintree_rightmost(self.size - 1); if let Some(entry) = header_pmmr.get_data(leaf_pos) { Ok(entry.hash()) } else { - Err(ErrorKind::Other("failed to find head hash".to_string()).into()) + Err(Error::Other("failed to find head hash".to_string())) } } @@ -314,7 +314,9 @@ impl TxHashSet { commit_index, }) } else { - Err(ErrorKind::TxHashSetErr("failed to open kernel PMMR".to_string()).into()) + Err(Error::TxHashSetErr( + "failed to open kernel PMMR".to_string(), + )) } } @@ -358,7 +360,7 @@ impl TxHashSet { } } Ok(None) => Ok(None), - Err(e) => Err(ErrorKind::StoreErr(e, "txhashset unspent check".to_string()).into()), + Err(e) => Err(Error::StoreErr(e, "txhashset unspent check".to_string())), } } @@ -502,7 +504,7 @@ impl TxHashSet { let pos0 = self.commit_index.get_output_pos(&commit)?; PMMR::at(&mut self.output_pmmr_h.backend, self.output_pmmr_h.size) .merkle_proof(pos0) - .map_err(|_| ErrorKind::MerkleProof.into()) + .map_err(|_| Error::MerkleProof) } /// Compact the MMR data files and flush the rm logs @@ -1031,7 +1033,7 @@ impl<'a> HeaderExtension<'a> { if let Some(hash) = self.get_header_hash_by_height(height) { Ok(batch.get_block_header(&hash)?) } else { - Err(ErrorKind::Other("get header by height".to_string()).into()) + Err(Error::Other("get header by height".to_string())) } } @@ -1059,7 +1061,7 @@ impl<'a> HeaderExtension<'a> { /// This may be either the header MMR or the sync MMR depending on the /// extension. pub fn apply_header(&mut self, header: &BlockHeader) -> Result<(), Error> { - self.pmmr.push(header).map_err(&ErrorKind::TxHashSetErr)?; + self.pmmr.push(header).map_err(&Error::TxHashSetErr)?; self.head = Tip::from_header(header); Ok(()) } @@ -1078,7 +1080,7 @@ impl<'a> HeaderExtension<'a> { let header_pos = 1 + pmmr::insertion_to_pmmr_index(header.height); self.pmmr .rewind(header_pos, &Bitmap::create()) - .map_err(&ErrorKind::TxHashSetErr)?; + .map_err(&Error::TxHashSetErr)?; // Update our head to reflect the header we rewound to. self.head = Tip::from_header(header); @@ -1093,7 +1095,7 @@ impl<'a> HeaderExtension<'a> { /// The root of the header MMR for convenience. pub fn root(&self) -> Result { - Ok(self.pmmr.root().map_err(|_| ErrorKind::InvalidRoot)?) + Ok(self.pmmr.root().map_err(|_| Error::InvalidRoot)?) } /// Validate the prev_root of the header against the root of the current header MMR. @@ -1104,7 +1106,7 @@ impl<'a> HeaderExtension<'a> { return Ok(()); } if self.root()? != header.prev_root { - Err(ErrorKind::InvalidRoot.into()) + Err(Error::InvalidRoot) } else { Ok(()) } @@ -1313,11 +1315,11 @@ impl<'a> Extension<'a> { Ok(true) => { self.rproof_pmmr .prune(pos.pos - 1) - .map_err(ErrorKind::TxHashSetErr)?; + .map_err(Error::TxHashSetErr)?; Ok(()) } - Ok(false) => Err(ErrorKind::AlreadySpent(commit).into()), - Err(e) => Err(ErrorKind::TxHashSetErr(e).into()), + Ok(false) => Err(Error::AlreadySpent(commit)), + Err(e) => Err(Error::TxHashSetErr(e)), } } @@ -1327,7 +1329,7 @@ impl<'a> Extension<'a> { if let Ok(pos0) = batch.get_output_pos(&commit) { if let Some(out_mmr) = self.output_pmmr.get_data(pos0) { if out_mmr.commitment() == commit { - return Err(ErrorKind::DuplicateCommitment(commit).into()); + return Err(Error::DuplicateCommitment(commit)); } } } @@ -1335,27 +1337,27 @@ impl<'a> Extension<'a> { let output_pos = self .output_pmmr .push(&out.identifier()) - .map_err(&ErrorKind::TxHashSetErr)?; + .map_err(&Error::TxHashSetErr)?; // push the rangeproof to the MMR. let rproof_pos = self .rproof_pmmr .push(&out.proof()) - .map_err(&ErrorKind::TxHashSetErr)?; + .map_err(&Error::TxHashSetErr)?; // The output and rproof MMRs should be exactly the same size // and we should have inserted to both in exactly the same pos. { if self.output_pmmr.unpruned_size() != self.rproof_pmmr.unpruned_size() { - return Err( - ErrorKind::Other("output vs rproof MMRs different sizes".to_string()).into(), - ); + return Err(Error::Other( + "output vs rproof MMRs different sizes".to_string(), + )); } if output_pos != rproof_pos { - return Err( - ErrorKind::Other("output vs rproof MMRs different pos".to_string()).into(), - ); + return Err(Error::Other( + "output vs rproof MMRs different pos".to_string(), + )); } } Ok(1 + output_pos) @@ -1419,18 +1421,18 @@ impl<'a> Extension<'a> { // Roll back the genesis output self.output_pmmr .rewind(0, &Bitmap::create()) - .map_err(&ErrorKind::TxHashSetErr)?; + .map_err(&Error::TxHashSetErr)?; } self.output_pmmr .push_pruned_subtree(hashes[idx], pos0) - .map_err(&ErrorKind::TxHashSetErr)?; + .map_err(&Error::TxHashSetErr)?; } } OrderedHashLeafNode::Leaf(idx, pos0) => { if pos0 == self.output_pmmr.size { self.output_pmmr .push(&leaf_data[idx]) - .map_err(&ErrorKind::TxHashSetErr)?; + .map_err(&Error::TxHashSetErr)?; } let pmmr_index = pmmr::pmmr_leaf_to_insertion_index(pos0); match pmmr_index { @@ -1463,18 +1465,18 @@ impl<'a> Extension<'a> { // Roll back the genesis output self.rproof_pmmr .rewind(0, &Bitmap::create()) - .map_err(&ErrorKind::TxHashSetErr)?; + .map_err(&Error::TxHashSetErr)?; } self.rproof_pmmr .push_pruned_subtree(hashes[idx], pos0) - .map_err(&ErrorKind::TxHashSetErr)?; + .map_err(&Error::TxHashSetErr)?; } } OrderedHashLeafNode::Leaf(idx, pos0) => { if pos0 == self.rproof_pmmr.size { self.rproof_pmmr .push(&leaf_data[idx]) - .map_err(&ErrorKind::TxHashSetErr)?; + .map_err(&Error::TxHashSetErr)?; } let pmmr_index = pmmr::pmmr_leaf_to_insertion_index(pos0); match pmmr_index { @@ -1517,7 +1519,7 @@ impl<'a> Extension<'a> { for insert in self.sort_pmmr_hashes_and_leaves(vec![], leaf_pos, Some(0)) { match insert { OrderedHashLeafNode::Hash(_, _) => { - return Err(ErrorKind::InvalidSegment( + return Err(Error::InvalidSegment( "Kernel PMMR is non-prunable, should not have hash data".to_string(), ) .into()); @@ -1526,7 +1528,7 @@ impl<'a> Extension<'a> { if pos0 == self.kernel_pmmr.size { self.kernel_pmmr .push(&leaf_data[idx]) - .map_err(&ErrorKind::TxHashSetErr)?; + .map_err(&Error::TxHashSetErr)?; } } } @@ -1539,7 +1541,7 @@ impl<'a> Extension<'a> { let pos = self .kernel_pmmr .push(kernel) - .map_err(&ErrorKind::TxHashSetErr)?; + .map_err(&Error::TxHashSetErr)?; Ok(1 + pos) } @@ -1560,7 +1562,7 @@ impl<'a> Extension<'a> { let merkle_proof = self .output_pmmr .merkle_proof(pos0) - .map_err(&ErrorKind::TxHashSetErr)?; + .map_err(&Error::TxHashSetErr)?; Ok(merkle_proof) } @@ -1572,12 +1574,8 @@ impl<'a> Extension<'a> { /// across). pub fn snapshot(&mut self, batch: &Batch<'_>) -> Result<(), Error> { let header = batch.get_block_header(&self.head.last_block_h)?; - self.output_pmmr - .snapshot(&header) - .map_err(ErrorKind::Other)?; - self.rproof_pmmr - .snapshot(&header) - .map_err(ErrorKind::Other)?; + self.output_pmmr.snapshot(&header).map_err(Error::Other)?; + self.rproof_pmmr.snapshot(&header).map_err(Error::Other)?; Ok(()) } @@ -1712,13 +1710,13 @@ impl<'a> Extension<'a> { let bitmap: Bitmap = spent_pos.iter().map(|x| *x as u32).collect(); self.output_pmmr .rewind(output_pos, &bitmap) - .map_err(&ErrorKind::TxHashSetErr)?; + .map_err(&Error::TxHashSetErr)?; self.rproof_pmmr .rewind(output_pos, &bitmap) - .map_err(&ErrorKind::TxHashSetErr)?; + .map_err(&Error::TxHashSetErr)?; self.kernel_pmmr .rewind(kernel_pos, &Bitmap::create()) - .map_err(&ErrorKind::TxHashSetErr)?; + .map_err(&Error::TxHashSetErr)?; Ok(()) } @@ -1727,20 +1725,11 @@ impl<'a> Extension<'a> { pub fn roots(&self) -> Result { Ok(TxHashSetRoots { output_roots: OutputRoots { - pmmr_root: self - .output_pmmr - .root() - .map_err(|_| ErrorKind::InvalidRoot)?, + pmmr_root: self.output_pmmr.root().map_err(|_| Error::InvalidRoot)?, bitmap_root: self.bitmap_accumulator.root(), }, - rproof_root: self - .rproof_pmmr - .root() - .map_err(|_| ErrorKind::InvalidRoot)?, - kernel_root: self - .kernel_pmmr - .root() - .map_err(|_| ErrorKind::InvalidRoot)?, + rproof_root: self.rproof_pmmr.root().map_err(|_| Error::InvalidRoot)?, + kernel_root: self.kernel_pmmr.root().map_err(|_| Error::InvalidRoot)?, }) } @@ -1763,7 +1752,7 @@ impl<'a> Extension<'a> { header.kernel_mmr_size, ) != self.sizes() { - Err(ErrorKind::InvalidMMRSize.into()) + Err(Error::InvalidMMRSize) } else { Ok(()) } @@ -1774,13 +1763,13 @@ impl<'a> Extension<'a> { // validate all hashes and sums within the trees if let Err(e) = self.output_pmmr.validate() { - return Err(ErrorKind::InvalidTxHashSet(e).into()); + return Err(Error::InvalidTxHashSet(e)); } if let Err(e) = self.rproof_pmmr.validate() { - return Err(ErrorKind::InvalidTxHashSet(e).into()); + return Err(Error::InvalidTxHashSet(e)); } if let Err(e) = self.kernel_pmmr.validate() { - return Err(ErrorKind::InvalidTxHashSet(e).into()); + return Err(Error::InvalidTxHashSet(e)); } debug!( @@ -1856,7 +1845,7 @@ impl<'a> Extension<'a> { )?; if let Some(ref s) = stop_state { if s.is_stopped() { - return Err(ErrorKind::Stopped.into()); + return Err(Error::Stopped.into()); } } @@ -1864,7 +1853,7 @@ impl<'a> Extension<'a> { self.verify_kernel_signatures(status, stop_state.clone())?; if let Some(ref s) = stop_state { if s.is_stopped() { - return Err(ErrorKind::Stopped.into()); + return Err(Error::Stopped.into()); } } } @@ -1925,7 +1914,7 @@ impl<'a> Extension<'a> { let kernel = self .kernel_pmmr .get_data(n) - .ok_or_else(|| ErrorKind::TxKernelNotFound)?; + .ok_or_else(|| Error::TxKernelNotFound)?; tx_kernels.push(kernel); } @@ -1992,8 +1981,8 @@ impl<'a> Extension<'a> { // Output and corresponding rangeproof *must* exist. // It is invalid for either to be missing and we fail immediately in this case. match (output, proof) { - (None, _) => return Err(ErrorKind::OutputNotFound.into()), - (_, None) => return Err(ErrorKind::RangeproofNotFound.into()), + (None, _) => return Err(Error::OutputNotFound), + (_, None) => return Err(Error::RangeproofNotFound), (Some(output), Some(proof)) => { commits.push(output.commit); proofs.push(proof); @@ -2179,7 +2168,7 @@ pub fn txhashset_replace(from: PathBuf, to: PathBuf) -> Result<(), Error> { // rename the 'from' folder as the 'to' folder if let Err(e) = fs::rename(from.join(TXHASHSET_SUBDIR), to.join(TXHASHSET_SUBDIR)) { error!("hashset_replace fail on {}. err: {}", TXHASHSET_SUBDIR, e); - Err(ErrorKind::TxHashSetErr("txhashset replacing fail".to_string()).into()) + Err(Error::TxHashSetErr("txhashset replacing fail".to_string())) } else { Ok(()) } @@ -2237,7 +2226,7 @@ fn apply_kernel_rules(kernel: &TxKernel, pos: CommitPos, batch: &Batch<'_>) -> R pos.height, prev, relative_height ); if diff < relative_height.into() { - return Err(ErrorKind::NRDRelativeHeight.into()); + return Err(Error::NRDRelativeHeight); } } debug!( diff --git a/chain/src/txhashset/utxo_view.rs b/chain/src/txhashset/utxo_view.rs index 279f681e1..f0ccf70b5 100644 --- a/chain/src/txhashset/utxo_view.rs +++ b/chain/src/txhashset/utxo_view.rs @@ -18,7 +18,7 @@ use crate::core::core::hash::{Hash, Hashed}; use crate::core::core::pmmr::{self, ReadablePMMR, ReadonlyPMMR}; use crate::core::core::{Block, BlockHeader, Inputs, Output, OutputIdentifier, Transaction}; use crate::core::global; -use crate::error::{Error, ErrorKind}; +use crate::error::Error; use crate::store::Batch; use crate::types::CommitPos; use crate::util::secp::pedersen::{Commitment, RangeProof}; @@ -104,7 +104,7 @@ impl<'a> UTXOView<'a> { Ok((out, pos)) } else { error!("input mismatch: {:?}, {:?}, {:?}", out, pos, input); - Err(ErrorKind::Other("input mismatch".into()).into()) + Err(Error::Other("input mismatch".into())) } }) }) @@ -129,14 +129,13 @@ impl<'a> UTXOView<'a> { return Ok((out, pos1)); } else { error!("input mismatch: {:?}, {:?}, {:?}", out, pos1, input); - return Err(ErrorKind::Other( + return Err(Error::Other( "input mismatch (output_pos index mismatch?)".into(), - ) - .into()); + )); } } } - Err(ErrorKind::AlreadySpent(input).into()) + Err(Error::AlreadySpent(input)) } // Output is valid if it would not result in a duplicate commitment in the output MMR. @@ -144,7 +143,7 @@ impl<'a> UTXOView<'a> { if let Ok(pos0) = batch.get_output_pos(&output.commitment()) { if let Some(out_mmr) = self.output_pmmr.get_data(pos0) { if out_mmr.commitment() == output.commitment() { - return Err(ErrorKind::DuplicateCommitment(output.commitment()).into()); + return Err(Error::DuplicateCommitment(output.commitment())); } } } @@ -156,9 +155,9 @@ impl<'a> UTXOView<'a> { match self.output_pmmr.get_data(pos0) { Some(output_id) => match self.rproof_pmmr.get_data(pos0) { Some(rproof) => Ok(output_id.into_output(rproof)), - None => Err(ErrorKind::RangeproofNotFound.into()), + None => Err(Error::RangeproofNotFound), }, - None => Err(ErrorKind::OutputNotFound.into()), + None => Err(Error::OutputNotFound), } } @@ -194,7 +193,7 @@ impl<'a> UTXOView<'a> { // If we have not yet reached 1440 blocks then // we can fail immediately as coinbase cannot be mature. if height < global::coinbase_maturity() { - return Err(ErrorKind::ImmatureCoinbase.into()); + return Err(Error::ImmatureCoinbase); } // Find the "cutoff" pos in the output MMR based on the @@ -206,7 +205,7 @@ impl<'a> UTXOView<'a> { // If any output pos exceed the cutoff_pos // we know they have not yet sufficiently matured. if pos > cutoff_pos { - return Err(ErrorKind::ImmatureCoinbase.into()); + return Err(Error::ImmatureCoinbase); } } @@ -231,7 +230,7 @@ impl<'a> UTXOView<'a> { let header = batch.get_block_header(&hash)?; Ok(header) } else { - Err(ErrorKind::Other("get header by height".to_string()).into()) + Err(Error::Other("get header by height".to_string())) } } } diff --git a/chain/src/types.rs b/chain/src/types.rs index 602843e98..7797acc35 100644 --- a/chain/src/types.rs +++ b/chain/src/types.rs @@ -21,7 +21,7 @@ use crate::core::core::hash::{Hash, Hashed, ZERO_HASH}; use crate::core::core::{pmmr, Block, BlockHeader, HeaderVersion, SegmentTypeIdentifier}; use crate::core::pow::Difficulty; use crate::core::ser::{self, PMMRIndexHashable, Readable, Reader, Writeable, Writer}; -use crate::error::{Error, ErrorKind}; +use crate::error::Error; use crate::util::{RwLock, RwLockWriteGuard}; bitflags! { @@ -400,7 +400,7 @@ impl TxHashSetRoots { || header.range_proof_root != self.rproof_root || header.kernel_root != self.kernel_root { - Err(ErrorKind::InvalidRoot.into()) + Err(Error::InvalidRoot) } else { Ok(()) } diff --git a/chain/tests/mine_simple_chain.rs b/chain/tests/mine_simple_chain.rs index 71fb36ac2..257a9dce0 100644 --- a/chain/tests/mine_simple_chain.rs +++ b/chain/tests/mine_simple_chain.rs @@ -954,10 +954,12 @@ fn test_overflow_cached_rangeproof() { let res = chain.process_block(next, chain::Options::SKIP_POW); assert_eq!( - res.unwrap_err().kind(), - chain::ErrorKind::InvalidBlockProof(block::Error::Transaction( - transaction::Error::Secp(util::secp::Error::InvalidRangeProof) - )) + res.unwrap_err(), + chain::Error::InvalidBlockProof { + source: block::Error::Transaction(transaction::Error::Secp( + util::secp::Error::InvalidRangeProof + )) + } ); } clean_output_dir(".grin_overflow"); diff --git a/chain/tests/process_block_cut_through.rs b/chain/tests/process_block_cut_through.rs index d2c121a78..e32b8b7e1 100644 --- a/chain/tests/process_block_cut_through.rs +++ b/chain/tests/process_block_cut_through.rs @@ -136,8 +136,8 @@ fn process_block_cut_through() -> Result<(), chain::Error> { // Transaction will not validate against the chain (utxo). assert_eq!( - chain.validate_tx(&tx).map_err(|e| e.kind()), - Err(chain::ErrorKind::DuplicateCommitment(commit)), + chain.validate_tx(&tx), + Err(chain::Error::DuplicateCommitment(commit)), ); // Build a block with this single invalid transaction. @@ -166,12 +166,12 @@ fn process_block_cut_through() -> Result<(), chain::Error> { let batch = store.batch()?; let mut ctx = chain.new_ctx(Options::NONE, batch, &mut header_pmmr, &mut txhashset)?; - let res = pipe::process_block(&block, &mut ctx).map_err(|e| e.kind()); + let res = pipe::process_block(&block, &mut ctx); assert_eq!( res, - Err(chain::ErrorKind::InvalidBlockProof( - block::Error::Transaction(transaction::Error::CutThrough) - )) + Err(chain::Error::InvalidBlockProof { + source: block::Error::Transaction(transaction::Error::CutThrough) + }) ); } diff --git a/chain/tests/test_block_known.rs b/chain/tests/test_block_known.rs index f9c9f050e..bdab3a818 100644 --- a/chain/tests/test_block_known.rs +++ b/chain/tests/test_block_known.rs @@ -14,7 +14,7 @@ mod chain_test_helper; use self::chain_test_helper::{clean_output_dir, init_chain, mine_chain}; -use chain::ErrorKind; +use chain::Error; use chain::Tip; use grin_chain as chain; use grin_core::core::hash::Hashed; @@ -42,8 +42,8 @@ fn check_known() { let chain = init_chain(chain_dir, genesis.clone()); let res = chain.process_block(latest.clone(), chain::Options::NONE); assert_eq!( - res.unwrap_err().kind(), - ErrorKind::Unfit("duplicate block".to_string()).into() + res.unwrap_err(), + Error::Unfit("duplicate block".to_string()) ); } @@ -52,8 +52,8 @@ fn check_known() { let chain = init_chain(chain_dir, genesis.clone()); let res = chain.process_block(genesis.clone(), chain::Options::NONE); assert_eq!( - res.unwrap_err().kind(), - ErrorKind::Unfit("duplicate block".to_string()).into() + res.unwrap_err(), + Error::Unfit("duplicate block".to_string()) ); } diff --git a/chain/tests/test_coinbase_maturity.rs b/chain/tests/test_coinbase_maturity.rs index 1ba347258..48d1f3a6a 100644 --- a/chain/tests/test_coinbase_maturity.rs +++ b/chain/tests/test_coinbase_maturity.rs @@ -13,7 +13,7 @@ // limitations under the License. use self::chain::types::NoopAdapter; -use self::chain::ErrorKind; +use self::chain::Error; use self::core::core::KernelFeatures; use self::core::global::{self, ChainTypes}; use self::core::libtx::{self, build, ProofBuilder}; @@ -121,8 +121,8 @@ fn test_coinbase_maturity() { // is not valid at the current block height given the current chain state. match chain.verify_coinbase_maturity(&coinbase_txn.inputs()) { Ok(_) => {} - Err(e) => match e.kind() { - ErrorKind::ImmatureCoinbase => {} + Err(e) => match e { + Error::ImmatureCoinbase => {} _ => panic!("Expected transaction error with immature coinbase."), }, } @@ -207,8 +207,8 @@ fn test_coinbase_maturity() { // is not valid at the current block height given the current chain state. match chain.verify_coinbase_maturity(&coinbase_txn.inputs()) { Ok(_) => {} - Err(e) => match e.kind() { - ErrorKind::ImmatureCoinbase => {} + Err(e) => match e { + Error::ImmatureCoinbase => {} _ => panic!("Expected transaction error with immature coinbase."), }, } diff --git a/chain/tests/test_data/chain_compacted/lmdb/data.mdb b/chain/tests/test_data/chain_compacted/lmdb/data.mdb index d1bed4039..9b09de116 100644 Binary files a/chain/tests/test_data/chain_compacted/lmdb/data.mdb and b/chain/tests/test_data/chain_compacted/lmdb/data.mdb differ diff --git a/chain/tests/test_data/chain_raw/lmdb/data.mdb b/chain/tests/test_data/chain_raw/lmdb/data.mdb index d907f73dc..5bee42afd 100644 Binary files a/chain/tests/test_data/chain_raw/lmdb/data.mdb and b/chain/tests/test_data/chain_raw/lmdb/data.mdb differ diff --git a/chain/tests/test_header_weight_validation.rs b/chain/tests/test_header_weight_validation.rs index 3cfc5300d..78630c08e 100644 --- a/chain/tests/test_header_weight_validation.rs +++ b/chain/tests/test_header_weight_validation.rs @@ -19,7 +19,7 @@ use grin_keychain as keychain; mod chain_test_helper; use self::chain_test_helper::{clean_output_dir, mine_chain}; -use crate::chain::{Chain, ErrorKind, Options}; +use crate::chain::{Chain, Error, Options}; use crate::core::{ consensus, core::{block, Block}, @@ -71,12 +71,10 @@ fn test_header_weight_validation() { // Note: We will validate this even if just processing the header. header.output_mmr_size = 1_000; - let res = chain - .process_block_header(&header, Options::NONE) - .map_err(|e| e.kind()); + let res = chain.process_block_header(&header, Options::NONE); // Weight validation is done via transaction body and results in a slightly counter-intuitive tx error. - assert_eq!(res, Err(ErrorKind::Block(block::Error::TooHeavy))); + assert_eq!(res, Err(Error::Block(block::Error::TooHeavy))); clean_output_dir(chain_dir); } diff --git a/core/Cargo.toml b/core/Cargo.toml index 80e289d56..343d519ea 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -14,8 +14,6 @@ blake2 = { package = "blake2-rfc", version = "0.2"} byteorder = "1" croaring = "0.4.6" enum_primitive = "0.1" -failure = "0.1" -failure_derive = "0.1" lazy_static = "1" lru-cache = "0.1" num = "0.2" @@ -24,6 +22,7 @@ rand = "0.6" serde = "1" serde_derive = "1" siphasher = "0.3" +thiserror = "1" log = "0.4" chrono = { version = "0.4.11", features = ["serde"] } zeroize = { version = "1.1", features =["zeroize_derive"] } diff --git a/core/fuzz/Cargo.lock b/core/fuzz/Cargo.lock index b2a18b82b..d5b100f09 100644 --- a/core/fuzz/Cargo.lock +++ b/core/fuzz/Cargo.lock @@ -1,1471 +1,1413 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] -name = "adler32" -version = "1.0.3" +name = "addr2line" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "aho-corasick" -version = "0.7.8" +version = "0.7.18" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" dependencies = [ - "memchr 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr", ] [[package]] name = "ansi_term" -version = "0.11.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" dependencies = [ - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi", ] -[[package]] -name = "antidote" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "arbitrary" -version = "0.1.1" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a7924531f38b1970ff630f03eb20a2fde69db5c590c93b0f3482e95dcc5fd60" [[package]] -name = "arrayref" -version = "0.3.5" +name = "arc-swap" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dabe5a181f83789739c194cbe5a897dde195078fac08568d09221fd6137a7ba8" [[package]] name = "arrayvec" version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06f59fe10306bb78facd90d28c2038ad23ffaaefa85bac43c8a434cde383334f" dependencies = [ - "nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", - "odds 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)", + "nodrop", + "odds", ] [[package]] name = "arrayvec" -version = "0.4.10" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" dependencies = [ - "nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", + "nodrop", ] [[package]] name = "atty" -version = "0.2.11" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "hermit-abi", + "libc", + "winapi", ] [[package]] name = "autocfg" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "backtrace" -version = "0.3.14" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dde43e75fd43e8a1bf86103336bc699aa8d17ad1be60c76c0bdfd4828e19b78" dependencies = [ - "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 1.1.0", ] [[package]] -name = "backtrace-sys" -version = "0.1.28" +name = "autocfg" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "backtrace" +version = "0.3.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11a17d453482a265fd5f8479f2a3f405566e6ca627837aaddb85af8b1ab8ef61" dependencies = [ - "cc 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "addr2line", + "cc", + "cfg-if 1.0.0", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", ] [[package]] name = "base64" -version = "0.9.3" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "safemem 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", -] +checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" + +[[package]] +name = "base64ct" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bdca834647821e0b13d9539a8634eb62d3501b6b6c2cec1722786ee6671b851" [[package]] name = "bindgen" -version = "0.52.0" +version = "0.56.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2da379dbebc0b76ef63ca68d8fc6e71c0f13e59432e0987e508c1820e6ab5239" dependencies = [ - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cexpr 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "clang-sys 0.28.1 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", - "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-hash 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "shlex 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "which 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags", + "cexpr", + "clang-sys", + "clap", + "env_logger", + "lazy_static", + "lazycell", + "log", + "peeking_take_while", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "which", ] [[package]] name = "bitflags" -version = "1.0.4" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "blake2-rfc" version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" dependencies = [ - "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", - "constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "arrayvec 0.4.12", + "constant_time_eq", ] [[package]] name = "block-buffer" -version = "0.3.3" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ - "arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", - "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "generic-array", ] -[[package]] -name = "build_const" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "byte-tools" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "byteorder" -version = "1.3.1" +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 = "cc" -version = "1.0.31" +version = "1.0.73" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" [[package]] name = "cexpr" -version = "0.3.6" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4aedb84272dbe89af497cf81375129abda4fc0a9e7c5d317498c15cc30c0d27" dependencies = [ - "nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "nom", ] [[package]] name = "cfg-if" -version = "0.1.7" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.6" +version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" dependencies = [ - "num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "num-integer", + "num-traits 0.2.15", + "serde", + "time", + "winapi", ] [[package]] name = "clang-sys" -version = "0.28.1" +version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a050e2153c5be08febd6734e29298e844fdb0fa21aeddd63b4eb7baa106c69b" dependencies = [ - "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "libloading 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glob", + "libc", + "libloading", ] [[package]] name = "clap" -version = "2.32.0" +version = "2.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" dependencies = [ - "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ansi_term", + "atty", + "bitflags", + "strsim", + "textwrap", + "unicode-width", + "vec_map", ] [[package]] name = "cloudabi" version = "0.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" dependencies = [ - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags", ] [[package]] name = "constant_time_eq" -version = "0.1.3" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" [[package]] -name = "crc" -version = "1.8.1" +name = "cpufeatures" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b" dependencies = [ - "build_const 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", ] [[package]] name = "crc32fast" -version = "1.2.0" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" dependencies = [ - "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", ] [[package]] name = "croaring" -version = "0.4.4" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a00d14ad7d8cc067d7a5c93e8563791bfec3f7182361db955530db11d94ed63c" dependencies = [ - "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "croaring-sys 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder", + "croaring-sys", + "libc", ] [[package]] name = "croaring-sys" -version = "0.4.4" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5d6a46501bb403a61e43bc7cd19977b4f9c54efd703949b00259cc61afb5a86" dependencies = [ - "bindgen 0.52.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "bindgen", + "cc", + "libc", ] -[[package]] -name = "crossbeam" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "crypto-mac" -version = "0.6.2" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" dependencies = [ - "constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "generic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "generic-array", + "subtle", ] [[package]] name = "digest" -version = "0.7.6" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" dependencies = [ - "generic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "generic-array", ] -[[package]] -name = "dtoa" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "enum_primitive" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4551092f4d519593039259a9ed8daedf0da12e5109c5280338073eaeb81180" dependencies = [ - "num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.1.43", ] [[package]] name = "env_logger" -version = "0.7.1" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a19187fea3ac7e84da7dacf48de0c45d63c6a76f9490dae389aead16c243fce3" dependencies = [ - "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "humantime 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "atty", + "humantime 2.1.0", + "log", + "regex", + "termcolor", ] -[[package]] -name = "failure" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "backtrace 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", - "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "failure_derive" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)", - "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "fake-simd" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "flate2" -version = "1.0.6" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6" dependencies = [ - "crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "miniz-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "miniz_oxide_c_api 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "crc32fast", + "miniz_oxide", ] [[package]] name = "fnv" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fuchsia-cprng" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" [[package]] name = "generic-array" -version = "0.9.0" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" dependencies = [ - "typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "typenum", + "version_check", ] +[[package]] +name = "gimli" +version = "0.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4" + [[package]] name = "glob" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "grin_core" -version = "3.1.0-beta.3" +version = "5.2.0-alpha.1" dependencies = [ - "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "croaring 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", - "enum_primitive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_keychain 3.1.0-beta.3", - "grin_util 3.1.0-beta.3", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "lru-cache 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "num 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num-bigint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "zeroize 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", + "blake2-rfc", + "byteorder", + "bytes", + "chrono", + "croaring", + "enum_primitive", + "grin_keychain", + "grin_util", + "lazy_static", + "log", + "lru-cache", + "num", + "num-bigint", + "rand 0.6.5", + "serde", + "serde_derive", + "siphasher", + "thiserror", + "zeroize", ] [[package]] name = "grin_core-fuzz" version = "0.0.3" dependencies = [ - "grin_core 3.1.0-beta.3", - "grin_keychain 3.1.0-beta.3", - "libfuzzer-sys 0.1.0 (git+https://github.com/rust-fuzz/libfuzzer-sys.git)", + "grin_core", + "grin_keychain", + "libfuzzer-sys", ] [[package]] name = "grin_keychain" -version = "3.1.0-beta.3" +version = "5.2.0-alpha.1" dependencies = [ - "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "digest 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_util 3.1.0-beta.3", - "hmac 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "pbkdf2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "ripemd160 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", - "sha2 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "zeroize 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", + "blake2-rfc", + "byteorder", + "digest", + "grin_util", + "hmac", + "lazy_static", + "log", + "pbkdf2", + "rand 0.6.5", + "ripemd160", + "serde", + "serde_derive", + "serde_json", + "sha2", + "zeroize", ] [[package]] name = "grin_secp256k1zkp" -version = "0.7.7" +version = "0.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3af3c4c4829b3e2e7ee1d9a542833e4244912fbb887fabe44682558159b068a7" dependencies = [ - "arrayvec 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", - "zeroize 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", + "arrayvec 0.3.25", + "cc", + "libc", + "rand 0.5.6", + "rustc-serialize", + "serde", + "serde_json", + "zeroize", ] [[package]] name = "grin_util" -version = "3.1.0-beta.3" +version = "5.2.0-alpha.1" dependencies = [ - "backtrace 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", - "base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_secp256k1zkp 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "log4rs 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "zeroize 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", - "zip 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace", + "base64", + "byteorder", + "grin_secp256k1zkp", + "lazy_static", + "log", + "log4rs", + "parking_lot", + "rand 0.6.5", + "serde", + "serde_derive", + "walkdir", + "zeroize", + "zip", +] + +[[package]] +name = "hashbrown" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db0d4cf898abf0081f964436dc980e96670a0f36863e4b83aaacdb65c9d7ccc3" + +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", ] [[package]] name = "hmac" -version = "0.6.3" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" dependencies = [ - "crypto-mac 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "digest 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)", + "crypto-mac", + "digest", ] [[package]] name = "humantime" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" dependencies = [ - "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "quick-error", +] + +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + +[[package]] +name = "indexmap" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" +dependencies = [ + "autocfg 1.1.0", + "hashbrown", ] [[package]] name = "itoa" -version = "0.4.3" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" [[package]] name = "lazy_static" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "lazycell" -version = "1.2.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.66" +version = "0.2.126" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" [[package]] name = "libfuzzer-sys" -version = "0.1.0" -source = "git+https://github.com/rust-fuzz/libfuzzer-sys.git#4a413199b5cb1bbed6a1d157b2342b925f8464ac" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "336244aaeab6a12df46480dc585802aa743a72d66b11937844c61bbca84c991d" dependencies = [ - "arbitrary 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", + "arbitrary", + "cc", + "once_cell", ] [[package]] name = "libloading" -version = "0.5.0" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "efbc0f03f9a775e9f6aed295c6a1ba2253c5757a9e03d55c6caa46a681abcddd" dependencies = [ - "cc 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "winapi", ] [[package]] name = "linked-hash-map" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "linked-hash-map" -version = "0.5.1" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" [[package]] name = "lock_api" -version = "0.1.5" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" dependencies = [ - "owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "scopeguard", ] [[package]] name = "log" -version = "0.4.8" +version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" dependencies = [ - "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "serde", ] [[package]] name = "log-mdc" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a94d21414c1f4a51209ad204c1776a3d0765002c76c6abcb602a6f09f1e881c7" [[package]] name = "log4rs" -version = "0.8.1" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4d8e6e1d5f89acca713132acc6034f30bad09b961d1338161bdb71c08f6e4fa" dependencies = [ - "antidote 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "flate2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "humantime 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "log-mdc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "serde-value 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_yaml 0.8.8 (registry+https://github.com/rust-lang/crates.io-index)", - "thread-id 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "typemap 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "arc-swap", + "chrono", + "flate2", + "fnv", + "humantime 1.3.0", + "libc", + "log", + "log-mdc", + "parking_lot", + "serde", + "serde-value", + "serde_derive", + "serde_json", + "serde_yaml", + "thread-id", + "typemap", + "winapi", ] [[package]] name = "lru-cache" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" dependencies = [ - "linked-hash-map 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "linked-hash-map", ] [[package]] name = "memchr" -version = "2.3.2" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "miniz-sys" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cc 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", -] +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "miniz_oxide" -version = "0.2.1" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f5c75688da582b8ffc1f1799e9db273f32133c49e048f614d22ec3256773ccc" dependencies = [ - "adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "miniz_oxide_c_api" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cc 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", - "crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "miniz_oxide 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "adler", ] [[package]] name = "nodrop" -version = "0.1.13" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" [[package]] name = "nom" -version = "4.2.3" +version = "5.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffb4262d26ed83a1c0a33a38fe2bb15797329c85770da05e6b828ddb782627af" dependencies = [ - "memchr 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr", + "version_check", ] [[package]] name = "num" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8536030f9fea7127f841b45bb6243b27255787fb4eb83958aa1ef9d2fdc0c36" dependencies = [ - "num-bigint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "num-complex 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", - "num-iter 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", - "num-rational 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "num-bigint", + "num-complex", + "num-integer", + "num-iter", + "num-rational", + "num-traits 0.2.15", ] [[package]] name = "num-bigint" -version = "0.2.2" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" dependencies = [ - "num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 1.1.0", + "num-integer", + "num-traits 0.2.15", ] [[package]] name = "num-complex" -version = "0.2.1" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6b19411a9719e753aff12e5187b74d60d3dc449ec3f4dc21e3989c3f554bc95" dependencies = [ - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 1.1.0", + "num-traits 0.2.15", ] [[package]] name = "num-integer" -version = "0.1.39" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" dependencies = [ - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 1.1.0", + "num-traits 0.2.15", ] [[package]] name = "num-iter" -version = "0.1.37" +version = "0.1.43" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" dependencies = [ - "num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 1.1.0", + "num-integer", + "num-traits 0.2.15", ] [[package]] name = "num-rational" -version = "0.2.1" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" dependencies = [ - "num-bigint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 1.1.0", + "num-bigint", + "num-integer", + "num-traits 0.2.15", ] [[package]] name = "num-traits" version = "0.1.43" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31" dependencies = [ - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.15", ] [[package]] name = "num-traits" -version = "0.2.6" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +dependencies = [ + "autocfg 1.1.0", +] + +[[package]] +name = "object" +version = "0.28.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e42c982f2d955fac81dd7e1d0e1426a7d702acd9c98d19ab01083a6a0328c424" +dependencies = [ + "memchr", +] [[package]] name = "odds" version = "0.2.26" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4eae0151b9dacf24fcc170d9995e511669a082856a91f958a2fe380bfab3fb22" + +[[package]] +name = "once_cell" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1" + +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "ordered-float" -version = "1.0.2" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3305af35278dd29f46fcdd139e0b1fbfae2153f0e5928b39b035542dd31e37b7" dependencies = [ - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "owning_ref" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.15", ] [[package]] name = "parking_lot" -version = "0.6.4" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e" dependencies = [ - "lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lock_api", + "parking_lot_core", ] [[package]] name = "parking_lot_core" -version = "0.3.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3" dependencies = [ - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10", + "cloudabi", + "libc", + "redox_syscall", + "smallvec", + "winapi", +] + +[[package]] +name = "password-hash" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77e0b28ace46c5a396546bcf443bf422b57049617433d8854227352a4a9b24e7" +dependencies = [ + "base64ct", + "rand_core 0.6.3", + "subtle", ] [[package]] name = "pbkdf2" -version = "0.2.3" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d95f5254224e617595d2cc3cc73ff0a5eaf2637519e25f03388154e9378b6ffa" dependencies = [ - "base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "crypto-mac 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "generic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "hmac 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "sha2 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "base64ct", + "crypto-mac", + "hmac", + "password-hash", + "sha2", ] [[package]] name = "peeking_take_while" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "podio" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" [[package]] name = "proc-macro2" -version = "0.4.27" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd96a1e8ed2596c337f8eae5f24924ec83f5ad5ab21ea8e455d3566c69fbcaf7" dependencies = [ - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "proc-macro2" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-ident", ] [[package]] name = "quick-error" -version = "1.2.2" +version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quote" -version = "0.6.11" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804" dependencies = [ - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "quote" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", ] [[package]] name = "rand" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" dependencies = [ - "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cloudabi", + "fuchsia-cprng", + "libc", + "rand_core 0.3.1", + "winapi", ] [[package]] name = "rand" version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" dependencies = [ - "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.8", + "libc", + "rand_chacha", + "rand_core 0.4.2", + "rand_hc", + "rand_isaac", + "rand_jitter", + "rand_os", + "rand_pcg", + "rand_xorshift", + "winapi", ] [[package]] name = "rand_chacha" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" dependencies = [ - "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.8", + "rand_core 0.3.1", ] [[package]] name = "rand_core" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" dependencies = [ - "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2", ] [[package]] name = "rand_core" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" + +[[package]] +name = "rand_core" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" [[package]] name = "rand_hc" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" dependencies = [ - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1", ] [[package]] name = "rand_isaac" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" dependencies = [ - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1", ] [[package]] name = "rand_jitter" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" dependencies = [ - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "rand_core 0.4.2", + "winapi", ] [[package]] name = "rand_os" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" dependencies = [ - "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cloudabi", + "fuchsia-cprng", + "libc", + "rand_core 0.4.2", + "rdrand", + "winapi", ] [[package]] name = "rand_pcg" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" dependencies = [ - "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.8", + "rand_core 0.4.2", ] [[package]] name = "rand_xorshift" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" dependencies = [ - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1", ] [[package]] name = "rdrand" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" dependencies = [ - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1", ] [[package]] name = "redox_syscall" -version = "0.1.51" +version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "redox_termios" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)", -] +checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" [[package]] name = "regex" -version = "1.3.4" +version = "1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d83f127d94bdbcda4c8cc2e50f6f84f4b611f69c902699ca385a39c3a75f9ff1" dependencies = [ - "aho-corasick 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick", + "memchr", + "regex-syntax", ] [[package]] name = "regex-syntax" -version = "0.6.14" +version = "0.6.26" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49b3de9ec5dc0a3417da371aab17d729997c15010e7fd24ff707773a33bddb64" [[package]] name = "ripemd160" -version = "0.7.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2eca4ecc81b7f313189bf73ce724400a07da2a6dac19588b03c8bd76a2dcc251" dependencies = [ - "block-buffer 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "digest 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)", + "block-buffer", + "digest", + "opaque-debug", ] [[package]] name = "rustc-demangle" -version = "0.1.13" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" [[package]] name = "rustc-hash" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustc-serialize" version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "rustc_version" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", -] +checksum = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" [[package]] name = "ryu" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "safemem" -version = "0.3.0" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" [[package]] name = "same-file" -version = "1.0.4" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" dependencies = [ - "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-util", ] [[package]] name = "scopeguard" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "semver" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "semver-parser" -version = "0.7.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "serde" -version = "1.0.89" +version = "1.0.138" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1578c6245786b9d168c5447eeacfb96856573ca56c9d68fdcf394be134882a47" dependencies = [ - "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive", ] [[package]] name = "serde-value" -version = "0.5.3" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a65a7291a8a568adcae4c10a677ebcedbc6c9cec91c054dee2ce40b0e3290eb" dependencies = [ - "ordered-float 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "ordered-float", + "serde", ] [[package]] name = "serde_derive" -version = "1.0.89" +version = "1.0.138" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "023e9b1467aef8a10fb88f25611870ada9800ef7e22afce356bb0d2387b6f27c" dependencies = [ - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote", + "syn", ] [[package]] name = "serde_json" -version = "1.0.39" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82c2c1fdcd807d1098552c5b9a36e425e42e9fbd7c6a37a8425f390f781f7fa7" dependencies = [ - "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa", + "ryu", + "serde", ] [[package]] name = "serde_yaml" -version = "0.8.8" +version = "0.8.24" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "707d15895415db6628332b737c838b88c598522e4dc70647e59b72312924aebc" dependencies = [ - "dtoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "yaml-rust 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "indexmap", + "ryu", + "serde", + "yaml-rust", ] [[package]] name = "sha2" -version = "0.7.1" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" dependencies = [ - "block-buffer 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "digest 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)", - "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "block-buffer", + "cfg-if 1.0.0", + "cpufeatures", + "digest", + "opaque-debug", ] [[package]] name = "shlex" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2" [[package]] name = "siphasher" -version = "0.2.3" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" [[package]] name = "smallvec" -version = "0.6.9" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "stable_deref_trait" -version = "1.1.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1" [[package]] name = "strsim" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" + +[[package]] +name = "subtle" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "syn" -version = "0.15.29" +version = "1.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd" dependencies = [ - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote", + "unicode-ident", ] [[package]] name = "synstructure" -version = "0.10.1" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" dependencies = [ - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote", + "syn", + "unicode-xid", ] [[package]] name = "termcolor" -version = "1.0.4" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" dependencies = [ - "wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "termion" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-util", ] [[package]] name = "textwrap" -version = "0.10.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" dependencies = [ - "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width", +] + +[[package]] +name = "thiserror" +version = "1.0.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" +dependencies = [ + "proc-macro2", + "quote", + "syn", ] [[package]] name = "thread-id" version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7fbf4c9d56b320106cd64fd024dadfa0be7cb4706725fc44a7d7ce952d820c1" dependencies = [ - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "thread_local" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "redox_syscall", + "winapi", ] [[package]] name = "time" -version = "0.1.42" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" dependencies = [ - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "wasi", + "winapi", ] [[package]] name = "traitobject" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079" [[package]] name = "typemap" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "653be63c80a3296da5551e1bfd2cca35227e13cdd08c6668903ae2f4f77aa1f6" dependencies = [ - "unsafe-any 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "unsafe-any", ] [[package]] name = "typenum" -version = "1.10.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" + +[[package]] +name = "unicode-ident" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c" [[package]] name = "unicode-width" -version = "0.1.5" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" [[package]] name = "unicode-xid" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "unicode-xid" -version = "0.2.0" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "957e51f3646910546462e67d5f7599b9e4fb8acdd304b087a6494730f9eebf04" [[package]] name = "unsafe-any" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f30360d7979f5e9c6e6cea48af192ea8fab4afb3cf72597154b8f08935bc9c7f" dependencies = [ - "traitobject 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "traitobject", ] [[package]] name = "vec_map" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" [[package]] name = "version_check" -version = "0.1.5" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "walkdir" -version = "2.2.7" +version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" dependencies = [ - "same-file 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "same-file", + "winapi", + "winapi-util", ] [[package]] -name = "which" -version = "3.1.0" +name = "wasi" +version = "0.10.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" + +[[package]] +name = "which" +version = "3.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d011071ae14a2f6671d0b74080ae0cd8ebf3a6f8c9589a2cd45f23126fe29724" dependencies = [ - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", ] [[package]] name = "winapi" -version = "0.3.6" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ - "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", ] [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.2" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" dependencies = [ - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi", ] [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "wincolor" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", -] +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "yaml-rust" -version = "0.4.3" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" dependencies = [ - "linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "linked-hash-map", ] [[package]] name = "zeroize" -version = "0.9.3" +version = "1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20b578acffd8516a6c3f2a1bdefc1ec37e547bb4e0fb8b6b01a4cafc886b4442" dependencies = [ - "zeroize_derive 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", + "zeroize_derive", ] [[package]] name = "zeroize_derive" -version = "0.9.3" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f8f187641dad4f680d25c4bfc4225b418165984179f26ca76ec4fb6441d3a17" dependencies = [ - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)", - "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote", + "syn", + "synstructure", ] [[package]] name = "zip" -version = "0.5.3" +version = "0.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93ab48844d61251bb3835145c521d88aa4031d7139e8485990f60ca911fa0815" dependencies = [ - "crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "podio 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder", + "crc32fast", + "thiserror", ] - -[metadata] -"checksum adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7e522997b529f05601e05166c07ed17789691f562762c7f3b987263d2dedee5c" -"checksum aho-corasick 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)" = "743ad5a418686aad3b87fd14c43badd828cf26e214a00f92a384291cf22e1811" -"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" -"checksum antidote 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "34fde25430d87a9388dadbe6e34d7f72a462c8b43ac8d309b42b0a8505d7e2a5" -"checksum arbitrary 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6c7d1523aa3a127adf8b27af2404c03c12825b4c4d0698f01648d63fa9df62ee" -"checksum arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0d382e583f07208808f6b1249e60848879ba3543f57c32277bf52d69c2f0f0ee" -"checksum arrayvec 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)" = "06f59fe10306bb78facd90d28c2038ad23ffaaefa85bac43c8a434cde383334f" -"checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71" -"checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" -"checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799" -"checksum backtrace 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "cd5a90e2b463010cd0e0ce9a11d4a9d5d58d9f41d4a6ba3dcaf9e68b466e88b4" -"checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6" -"checksum base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643" -"checksum bindgen 0.52.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f1c85344eb535a31b62f0af37be84441ba9e7f0f4111eb0530f43d15e513fe57" -"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" -"checksum blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" -"checksum block-buffer 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a076c298b9ecdb530ed9d967e74a6027d6a7478924520acddcddc24c1c8ab3ab" -"checksum build_const 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "39092a32794787acd8525ee150305ff051b0aa6cc2abaf193924f5ab05425f39" -"checksum byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" -"checksum byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a019b10a2a7cdeb292db131fc8113e57ea2a908f6e7894b0c3c671893b65dbeb" -"checksum cc 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)" = "c9ce8bb087aacff865633f0bd5aeaed910fe2fe55b55f4739527f2e023a2e53d" -"checksum cexpr 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "fce5b5fb86b0c57c20c834c1b412fd09c77c8a59b9473f86272709e78874cd1d" -"checksum cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "11d43355396e872eefb45ce6342e4374ed7bc2b3a502d1b28e36d6e23c05d1f4" -"checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878" -"checksum clang-sys 0.28.1 (registry+https://github.com/rust-lang/crates.io-index)" = "81de550971c976f176130da4b2978d3b524eaa0fd9ac31f3ceb5ae1231fb4853" -"checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e" -"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -"checksum constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e" -"checksum crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d663548de7f5cca343f1e0a48d14dcfb0e9eb4e079ec58883b7251539fa10aeb" -"checksum crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" -"checksum croaring 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "52e9057c1caf8e9debd6f938a12ff24028f3c7f85d24f502f46f3c9601905464" -"checksum croaring-sys 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b7d3b66d75dc466ec547604de0517eb4e1a51fd79a83eaff4409f81167dacdc8" -"checksum crossbeam 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "24ce9782d4d5c53674646a6a4c1863a21a8fc0cb649b3c94dfc16e45071dea19" -"checksum crypto-mac 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7afa06d05a046c7a47c3a849907ec303504608c927f4e85f7bfff22b7180d971" -"checksum digest 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "03b072242a8cbaf9c145665af9d250c59af3b958f83ed6824e13533cf76d5b90" -"checksum dtoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6d301140eb411af13d3115f9a562c85cc6b541ade9dfa314132244aaee7489dd" -"checksum enum_primitive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "be4551092f4d519593039259a9ed8daedf0da12e5109c5280338073eaeb81180" -"checksum env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" -"checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" -"checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" -"checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" -"checksum flate2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2291c165c8e703ee54ef3055ad6188e3d51108e2ded18e9f2476e774fc5ad3d4" -"checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" -"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" -"checksum generic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ef25c5683767570c2bbd7deba372926a55eaae9982d7726ee2a1050239d45b9d" -"checksum glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" -"checksum grin_secp256k1zkp 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)" = "23027a7673df2c2b20fb9589d742ff400a10a9c3e4c769a77e9fa3bd19586822" -"checksum hmac 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "733e1b3ac906631ca01ebb577e9bb0f5e37a454032b9036b5eaea4013ed6f99a" -"checksum humantime 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" -"checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" -"checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" -"checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" -"checksum libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)" = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558" -"checksum libfuzzer-sys 0.1.0 (git+https://github.com/rust-fuzz/libfuzzer-sys.git)" = "" -"checksum libloading 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3ad660d7cb8c5822cd83d10897b0f1f1526792737a179e73896152f85b88c2" -"checksum linked-hash-map 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7860ec297f7008ff7a1e3382d7f7e1dcd69efc94751a2284bafc3d013c2aa939" -"checksum linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "70fb39025bc7cdd76305867c4eccf2f2dcf6e9a57f5b21a93e1c2d86cd03ec9e" -"checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" -"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" -"checksum log-mdc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a94d21414c1f4a51209ad204c1776a3d0765002c76c6abcb602a6f09f1e881c7" -"checksum log4rs 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "25e0fc8737a634116a2deb38d821e4400ed16ce9dcb0d628a978d399260f5902" -"checksum lru-cache 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4d06ff7ff06f729ce5f4e227876cb88d10bc59cd4ae1e09fbb2bde15c850dc21" -"checksum memchr 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "53445de381a1f436797497c61d851644d0e8e88e6140f22872ad33a704933978" -"checksum miniz-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0300eafb20369952951699b68243ab4334f4b10a88f411c221d444b36c40e649" -"checksum miniz_oxide 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c468f2369f07d651a5d0bb2c9079f8488a66d5466efe42d0c5c6466edcb7f71e" -"checksum miniz_oxide_c_api 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b7fe927a42e3807ef71defb191dc87d4e24479b221e67015fe38ae2b7b447bab" -"checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" -"checksum nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2ad2a91a8e869eeb30b9cb3119ae87773a8f4ae617f41b1eb9c154b2905f7bd6" -"checksum num 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cf4825417e1e1406b3782a8ce92f4d53f26ec055e3622e1881ca8e9f5f9e08db" -"checksum num-bigint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "57450397855d951f1a41305e54851b1a7b8f5d2e349543a02a2effe25459f718" -"checksum num-complex 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "107b9be86cd2481930688277b675b0114578227f034674726605b8a482d8baf8" -"checksum num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea" -"checksum num-iter 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)" = "af3fdbbc3291a5464dc57b03860ec37ca6bf915ed6ee385e7c6c052c422b2124" -"checksum num-rational 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4e96f040177bb3da242b5b1ecf3f54b5d5af3efbbfb18608977a5d2767b22f10" -"checksum num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31" -"checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" -"checksum odds 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)" = "4eae0151b9dacf24fcc170d9995e511669a082856a91f958a2fe380bfab3fb22" -"checksum ordered-float 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "18869315e81473c951eb56ad5558bbc56978562d3ecfb87abb7a1e944cea4518" -"checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13" -"checksum parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f0802bff09003b291ba756dc7e79313e51cc31667e94afbe847def490424cde5" -"checksum parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad7f7e6ebdc79edff6fdcb87a55b620174f7a989e3eb31b65231f4af57f00b8c" -"checksum pbkdf2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0c09cddfbfc98de7f76931acf44460972edb4023eb14d0c6d4018800e552d8e0" -"checksum peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" -"checksum podio 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "780fb4b6698bbf9cf2444ea5d22411cef2953f0824b98f33cf454ec5615645bd" -"checksum proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)" = "4d317f9caece796be1980837fd5cb3dfec5613ebdb04ad0956deea83ce168915" -"checksum proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3acb317c6ff86a4e579dfa00fc5e6cca91ecbb4e7eb2df0468805b674eb88548" -"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" -"checksum quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "cdd8e04bd9c52e0342b406469d494fcb033be4bdbe5c606016defbb1681411e1" -"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" -"checksum rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" -"checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" -"checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" -"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" -"checksum rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d0e7a549d590831370895ab7ba4ea0c1b6b011d106b5ff2da6eee112615e6dc0" -"checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" -"checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" -"checksum rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" -"checksum rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" -"checksum rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" -"checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" -"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" -"checksum redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)" = "423e376fffca3dfa06c9e9790a9ccd282fafb3cc6e6397d01dbf64f9bacc6b85" -"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" -"checksum regex 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "322cf97724bea3ee221b78fe25ac9c46114ebb51747ad5babd51a2fc6a8235a8" -"checksum regex-syntax 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)" = "b28dfe3fe9badec5dbf0a79a9cccad2cfc2ab5484bdb3e44cbd1ae8b3ba2be06" -"checksum ripemd160 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "482aa56cc68aaeccdaaff1cc5a72c247da8bbad3beb174ca5741f274c22883fb" -"checksum rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "adacaae16d02b6ec37fdc7acfcddf365978de76d1983d3ee22afc260e1ca9619" -"checksum rustc-hash 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" -"checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" -"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -"checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7" -"checksum safemem 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8dca453248a96cb0749e36ccdfe2b0b4e54a61bfef89fb97ec621eb8e0a93dd9" -"checksum same-file 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8f20c4be53a8a1ff4c1f1b2bd14570d2f634628709752f0702ecdd2b3f9a5267" -"checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" -"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)" = "92514fb95f900c9b5126e32d020f5c6d40564c27a5ea6d1d7d9f157a96623560" -"checksum serde-value 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7a663f873dedc4eac1a559d4c6bc0d0b2c34dc5ac4702e105014b8281489e44f" -"checksum serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)" = "bb6eabf4b5914e88e24eea240bb7c9f9a2cbc1bbbe8d961d381975ec3c6b806c" -"checksum serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)" = "5a23aa71d4a4d43fdbfaac00eff68ba8a06a51759a89ac3304323e800c4dd40d" -"checksum serde_yaml 0.8.8 (registry+https://github.com/rust-lang/crates.io-index)" = "0887a8e097a69559b56aa2526bf7aff7c3048cf627dff781f0b56a6001534593" -"checksum sha2 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9eb6be24e4c23a84d7184280d2722f7f2731fcdd4a9d886efbfe4413e4847ea0" -"checksum shlex 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2" -"checksum siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac" -"checksum smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c4488ae950c49d403731982257768f48fada354a5203fe81f9bb6f43ca9002be" -"checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" -"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" -"checksum syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)" = "1825685f977249735d510a242a6727b46efe914bb67e38d30c071b1b72b1d5c2" -"checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" -"checksum termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4096add70612622289f2fdcdbd5086dc81c1e2675e6ae58d6c4f62a16c6d7f2f" -"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" -"checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6" -"checksum thread-id 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c7fbf4c9d56b320106cd64fd024dadfa0be7cb4706725fc44a7d7ce952d820c1" -"checksum thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14" -"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" -"checksum traitobject 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079" -"checksum typemap 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "653be63c80a3296da5551e1bfd2cca35227e13cdd08c6668903ae2f4f77aa1f6" -"checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169" -"checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" -"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" -"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" -"checksum unsafe-any 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f30360d7979f5e9c6e6cea48af192ea8fab4afb3cf72597154b8f08935bc9c7f" -"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" -"checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" -"checksum walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "9d9d7ed3431229a144296213105a390676cc49c9b6a72bd19f3176c98e129fa1" -"checksum which 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5475d47078209a02e60614f7ba5e645ef3ed60f771920ac1906d7c1cc65024c8" -"checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" -"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -"checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" -"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -"checksum wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "561ed901ae465d6185fa7864d63fbd5720d0ef718366c9a4dc83cf6170d7e9ba" -"checksum yaml-rust 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "65923dd1784f44da1d2c3dbbc5e822045628c590ba72123e1c73d3c230c4434d" -"checksum zeroize 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "45af6a010d13e4cf5b54c94ba5a2b2eba5596b9e46bf5875612d332a1f2b3f86" -"checksum zeroize_derive 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "080616bd0e31f36095288bb0acdf1f78ef02c2fa15527d7e993f2a6c7591643e" -"checksum zip 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3c21bb410afa2bd823a047f5bda3adb62f51074ac7e06263b2c97ecdd47e9fc6" diff --git a/core/fuzz/Cargo.toml b/core/fuzz/Cargo.toml index d21631978..158391adf 100644 --- a/core/fuzz/Cargo.toml +++ b/core/fuzz/Cargo.toml @@ -3,15 +3,12 @@ name = "grin_core-fuzz" version = "0.0.3" authors = ["Grin Developers "] publish = false - -[package.metadata] -cargo-fuzz = true +edition = "2018" [dependencies] +libfuzzer-sys = "0.4.0" grin_core = { path = ".."} grin_keychain = { path = "../../keychain"} -[dependencies.libfuzzer-sys] -git = "https://github.com/rust-fuzz/libfuzzer-sys.git" # Prevent this from interfering with workspaces [workspace] diff --git a/core/fuzz/fuzz_targets/block_read_v1.rs b/core/fuzz/fuzz_targets/block_read_v1.rs index 27cc418b9..5f24ee33d 100644 --- a/core/fuzz/fuzz_targets/block_read_v1.rs +++ b/core/fuzz/fuzz_targets/block_read_v1.rs @@ -1,12 +1,13 @@ #![no_main] +use libfuzzer_sys::fuzz_target; + extern crate grin_core; -#[macro_use] -extern crate libfuzzer_sys; use grin_core::core::UntrustedBlock; -use grin_core::ser; +use grin_core::ser::{self, DeserializationMode}; fuzz_target!(|data: &[u8]| { let mut d = data.clone(); - let _t: Result = ser::deserialize(&mut d, ser::ProtocolVersion(1)); + let _t: Result = + ser::deserialize(&mut d, ser::ProtocolVersion(1), DeserializationMode::Full); }); diff --git a/core/fuzz/fuzz_targets/block_read_v2.rs b/core/fuzz/fuzz_targets/block_read_v2.rs index 40076b32c..07fe2c444 100644 --- a/core/fuzz/fuzz_targets/block_read_v2.rs +++ b/core/fuzz/fuzz_targets/block_read_v2.rs @@ -1,12 +1,13 @@ #![no_main] +use libfuzzer_sys::fuzz_target; + extern crate grin_core; -#[macro_use] -extern crate libfuzzer_sys; use grin_core::core::UntrustedBlock; -use grin_core::ser; +use grin_core::ser::{self, DeserializationMode}; fuzz_target!(|data: &[u8]| { let mut d = data.clone(); - let _t: Result = ser::deserialize(&mut d, ser::ProtocolVersion(2)); + let _t: Result = + ser::deserialize(&mut d, ser::ProtocolVersion(2), DeserializationMode::Full); }); diff --git a/core/fuzz/fuzz_targets/compact_block_read_v1.rs b/core/fuzz/fuzz_targets/compact_block_read_v1.rs index 2fca2dd0a..f421f4070 100644 --- a/core/fuzz/fuzz_targets/compact_block_read_v1.rs +++ b/core/fuzz/fuzz_targets/compact_block_read_v1.rs @@ -1,13 +1,13 @@ #![no_main] +use libfuzzer_sys::fuzz_target; + extern crate grin_core; -#[macro_use] -extern crate libfuzzer_sys; use grin_core::core::UntrustedCompactBlock; -use grin_core::ser; +use grin_core::ser::{self, DeserializationMode}; fuzz_target!(|data: &[u8]| { let mut d = data.clone(); let _t: Result = - ser::deserialize(&mut d, ser::ProtocolVersion(1)); + ser::deserialize(&mut d, ser::ProtocolVersion(1), DeserializationMode::Full); }); diff --git a/core/fuzz/fuzz_targets/compact_block_read_v2.rs b/core/fuzz/fuzz_targets/compact_block_read_v2.rs index 9cac9a577..a27b76601 100644 --- a/core/fuzz/fuzz_targets/compact_block_read_v2.rs +++ b/core/fuzz/fuzz_targets/compact_block_read_v2.rs @@ -1,13 +1,13 @@ #![no_main] +use libfuzzer_sys::fuzz_target; + extern crate grin_core; -#[macro_use] -extern crate libfuzzer_sys; use grin_core::core::UntrustedCompactBlock; -use grin_core::ser; +use grin_core::ser::{self, DeserializationMode}; fuzz_target!(|data: &[u8]| { let mut d = data.clone(); let _t: Result = - ser::deserialize(&mut d, ser::ProtocolVersion(2)); + ser::deserialize(&mut d, ser::ProtocolVersion(2), DeserializationMode::Full); }); diff --git a/core/fuzz/fuzz_targets/transaction_read_v1.rs b/core/fuzz/fuzz_targets/transaction_read_v1.rs index 4c485ba76..2ef5be19e 100644 --- a/core/fuzz/fuzz_targets/transaction_read_v1.rs +++ b/core/fuzz/fuzz_targets/transaction_read_v1.rs @@ -1,12 +1,13 @@ #![no_main] +use libfuzzer_sys::fuzz_target; + extern crate grin_core; -#[macro_use] -extern crate libfuzzer_sys; use grin_core::core::Transaction; -use grin_core::ser; +use grin_core::ser::{self, DeserializationMode}; fuzz_target!(|data: &[u8]| { let mut d = data.clone(); - let _t: Result = ser::deserialize(&mut d, ser::ProtocolVersion(1)); + let _t: Result = + ser::deserialize(&mut d, ser::ProtocolVersion(1), DeserializationMode::Full); }); diff --git a/core/fuzz/fuzz_targets/transaction_read_v2.rs b/core/fuzz/fuzz_targets/transaction_read_v2.rs index a483c3556..f4c5c7d66 100644 --- a/core/fuzz/fuzz_targets/transaction_read_v2.rs +++ b/core/fuzz/fuzz_targets/transaction_read_v2.rs @@ -1,12 +1,13 @@ #![no_main] +use libfuzzer_sys::fuzz_target; + extern crate grin_core; -#[macro_use] -extern crate libfuzzer_sys; use grin_core::core::Transaction; -use grin_core::ser; +use grin_core::ser::{self, DeserializationMode}; fuzz_target!(|data: &[u8]| { let mut d = data.clone(); - let _t: Result = ser::deserialize(&mut d, ser::ProtocolVersion(2)); + let _t: Result = + ser::deserialize(&mut d, ser::ProtocolVersion(2), DeserializationMode::Full); }); diff --git a/core/src/core.rs b/core/src/core.rs index 847aea465..2f504c7d6 100644 --- a/core/src/core.rs +++ b/core/src/core.rs @@ -36,10 +36,10 @@ pub use self::pmmr::segment::*; pub use self::transaction::*; /// Common errors -#[derive(Fail, Debug)] +#[derive(thiserror::Error, Debug)] pub enum Error { /// Human readable represenation of amount is invalid - #[fail(display = "Amount string was invalid")] + #[error("Amount string was invalid")] InvalidAmountString, } diff --git a/core/src/core/block.rs b/core/src/core/block.rs index b70f013ea..284c65bbd 100644 --- a/core/src/core/block.rs +++ b/core/src/core/block.rs @@ -37,7 +37,7 @@ use util::from_hex; use util::{secp, static_secp_instance}; /// Errors thrown by Block validation -#[derive(Debug, Clone, Eq, PartialEq, Fail)] +#[derive(Debug, Clone, Eq, PartialEq, thiserror::Error)] pub enum Error { /// The sum of output minus input commitments does not /// match the sum of kernel commitments diff --git a/core/src/core/committed.rs b/core/src/core/committed.rs index bd8276d75..dc71792e9 100644 --- a/core/src/core/committed.rs +++ b/core/src/core/committed.rs @@ -14,26 +14,25 @@ //! The Committed trait and associated errors. -use failure::Fail; use keychain::BlindingFactor; use util::secp::key::SecretKey; use util::secp::pedersen::Commitment; use util::{secp, secp_static, static_secp_instance}; /// Errors from summing and verifying kernel excesses via committed trait. -#[derive(Debug, Clone, PartialEq, Eq, Fail, Serialize, Deserialize)] +#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error, Serialize, Deserialize)] pub enum Error { /// Keychain related error. - #[fail(display = "Keychain error {}", _0)] + #[error("Keychain error {0}")] Keychain(keychain::Error), /// Secp related error. - #[fail(display = "Secp error {}", _0)] + #[error("Secp error {0}")] Secp(secp::Error), /// Kernel sums do not equal output sums. - #[fail(display = "Kernel sum mismatch")] + #[error("Kernel sum mismatch")] KernelSumMismatch, /// Committed overage (fee or reward) is invalid - #[fail(display = "Invalid value")] + #[error("Invalid value")] InvalidValue, } diff --git a/core/src/core/pmmr/segment.rs b/core/src/core/pmmr/segment.rs index ef14ee085..148a82773 100644 --- a/core/src/core/pmmr/segment.rs +++ b/core/src/core/pmmr/segment.rs @@ -19,7 +19,7 @@ use crate::core::pmmr::{self, Backend, ReadablePMMR, ReadonlyPMMR}; use crate::ser::{Error, PMMRIndexHashable, PMMRable, Readable, Reader, Writeable, Writer}; use croaring::Bitmap; use std::cmp::min; -use std::fmt::{self, Debug}; +use std::fmt::Debug; #[derive(Clone, Debug, Eq, PartialEq)] /// Possible segment types, according to this desegmenter @@ -54,30 +54,23 @@ impl SegmentTypeIdentifier { } } -#[derive(Clone, Debug, PartialEq, Eq)] +#[derive(Clone, Debug, PartialEq, Eq, thiserror::Error)] /// Error related to segment creation or validation pub enum SegmentError { /// An expected leaf was missing + #[error("Missing leaf at pos {0}")] MissingLeaf(u64), /// An expected hash was missing + #[error("Missing hash at pos {0}")] MissingHash(u64), /// The segment does not exist + #[error("Segment does not exist")] NonExistent, /// Mismatch between expected and actual root hash + #[error("Root hash mismatch")] Mismatch, } -impl fmt::Display for SegmentError { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - SegmentError::MissingLeaf(idx) => write!(f, "Missing leaf at pos {}", idx), - SegmentError::MissingHash(idx) => write!(f, "Missing hash at pos {}", idx), - SegmentError::NonExistent => write!(f, "Segment does not exist"), - SegmentError::Mismatch => write!(f, "Root hash mismatch"), - } - } -} - /// Tuple that defines a segment of a given PMMR #[derive(Copy, Clone, Debug, Eq, PartialEq)] pub struct SegmentIdentifier { diff --git a/core/src/lib.rs b/core/src/lib.rs index bc7434c12..a85dfd5cf 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -30,8 +30,6 @@ extern crate serde_derive; #[macro_use] extern crate log; #[macro_use] -extern crate failure_derive; -#[macro_use] pub mod macros; pub mod consensus; diff --git a/core/src/libtx/aggsig.rs b/core/src/libtx/aggsig.rs index 266c47520..debc422aa 100644 --- a/core/src/libtx/aggsig.rs +++ b/core/src/libtx/aggsig.rs @@ -16,7 +16,7 @@ //! This module interfaces into the underlying //! [Rust Aggsig library](https://github.com/mimblewimble/rust-secp256k1-zkp/blob/master/src/aggsig.rs) -use crate::libtx::error::{Error, ErrorKind}; +use crate::libtx::error::Error; use keychain::{BlindingFactor, Identifier, Keychain, SwitchCommitmentType}; use util::secp::key::{PublicKey, SecretKey}; use util::secp::pedersen::Commitment; @@ -192,7 +192,7 @@ pub fn verify_partial_sig( pubkey_sum, true, ) { - return Err(ErrorKind::Signature("Signature validation error".to_string()).into()); + return Err(Error::Signature("Signature validation error".to_string())); } Ok(()) } @@ -324,7 +324,7 @@ pub fn verify_single_from_commit( ) -> Result<(), Error> { let pubkey = commit.to_pubkey(secp)?; if !verify_single(secp, sig, msg, None, &pubkey, Some(&pubkey), false) { - return Err(ErrorKind::Signature("Signature validation error".to_string()).into()); + return Err(Error::Signature("Signature validation error".to_string())); } Ok(()) } @@ -392,7 +392,7 @@ pub fn verify_completed_sig( msg: &secp::Message, ) -> Result<(), Error> { if !verify_single(secp, sig, msg, None, pubkey, pubkey_sum, true) { - return Err(ErrorKind::Signature("Signature validation error".to_string()).into()); + return Err(Error::Signature("Signature validation error".to_string())); } Ok(()) } diff --git a/core/src/libtx/error.rs b/core/src/libtx/error.rs index 9b2ae16b5..dda757880 100644 --- a/core/src/libtx/error.rs +++ b/core/src/libtx/error.rs @@ -14,96 +14,40 @@ //! libtx specific errors use crate::core::transaction; -use failure::{Backtrace, Context, Fail}; -use std::fmt::{self, Display}; use util::secp; /// Lib tx error definition -#[derive(Debug)] -pub struct Error { - inner: Context, -} - -#[derive(Clone, Debug, Eq, Fail, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, thiserror::Error, PartialEq, Serialize, Deserialize)] /// Libwallet error types -pub enum ErrorKind { +pub enum Error { /// SECP error - #[fail(display = "Secp Error")] - Secp(secp::Error), + #[error("Secp Error")] + Secp { + /// SECP error + #[from] + source: secp::Error, + }, /// Keychain error - #[fail(display = "Keychain Error")] - Keychain(keychain::Error), + #[error("Keychain Error")] + Keychain { + /// Keychain error + #[from] + source: keychain::Error, + }, /// Transaction error - #[fail(display = "Transaction Error")] - Transaction(transaction::Error), + #[error("Transaction Error")] + Transaction { + /// Transaction error + #[from] + source: transaction::Error, + }, /// Signature error - #[fail(display = "Signature Error")] + #[error("Signature Error")] Signature(String), /// Rangeproof error - #[fail(display = "Rangeproof Error")] + #[error("Rangeproof Error")] RangeProof(String), /// Other error - #[fail(display = "Other Error")] + #[error("Other Error")] Other(String), } - -impl Fail for Error { - fn cause(&self) -> Option<&dyn Fail> { - self.inner.cause() - } - - fn backtrace(&self) -> Option<&Backtrace> { - self.inner.backtrace() - } -} - -impl Display for Error { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - Display::fmt(&self.inner, f) - } -} - -impl Error { - /// Return errorkind - pub fn kind(&self) -> ErrorKind { - self.inner.get_context().clone() - } -} - -impl From for Error { - fn from(kind: ErrorKind) -> Error { - Error { - inner: Context::new(kind), - } - } -} - -impl From> for Error { - fn from(inner: Context) -> Error { - Error { inner } - } -} - -impl From for Error { - fn from(error: secp::Error) -> Error { - Error { - inner: Context::new(ErrorKind::Secp(error)), - } - } -} - -impl From for Error { - fn from(error: keychain::Error) -> Error { - Error { - inner: Context::new(ErrorKind::Keychain(error)), - } - } -} - -impl From for Error { - fn from(error: transaction::Error) -> Error { - Error { - inner: Context::new(ErrorKind::Transaction(error)), - } - } -} diff --git a/core/src/libtx/mod.rs b/core/src/libtx/mod.rs index c2786c5ed..51a3601b1 100644 --- a/core/src/libtx/mod.rs +++ b/core/src/libtx/mod.rs @@ -32,7 +32,7 @@ use crate::core::Transaction; use crate::global::get_accept_fee_base; pub use self::proof::ProofBuilder; -pub use crate::libtx::error::{Error, ErrorKind}; +pub use crate::libtx::error::Error; /// Transaction fee calculation given numbers of inputs, outputs, and kernels pub fn tx_fee(input_len: usize, output_len: usize, kernel_len: usize) -> u64 { diff --git a/core/src/libtx/proof.rs b/core/src/libtx/proof.rs index e5e13fc0f..5c98529dd 100644 --- a/core/src/libtx/proof.rs +++ b/core/src/libtx/proof.rs @@ -14,7 +14,7 @@ //! Rangeproof library functions -use crate::libtx::error::{Error, ErrorKind}; +use crate::libtx::error::Error; use blake2::blake2b::blake2b; use keychain::extkey_bip32::BIP32GrinHasher; use keychain::{Identifier, Keychain, SwitchCommitmentType, ViewKey}; @@ -81,7 +81,7 @@ where { let nonce = b .rewind_nonce(secp, &commit) - .map_err(|e| ErrorKind::RangeProof(e.to_string()))?; + .map_err(|e| Error::RangeProof(e.to_string()))?; let info = secp.rewind_bullet_proof(commit, nonce, extra_data, proof); if info.is_err() { return Ok(None); @@ -91,7 +91,7 @@ where let amount = info.value; let check = b .check_output(secp, &commit, amount, info.message) - .map_err(|e| ErrorKind::RangeProof(e.to_string()))?; + .map_err(|e| Error::RangeProof(e.to_string()))?; Ok(check.map(|(id, switch)| (amount, id, switch))) } @@ -164,7 +164,7 @@ where }; let res = blake2b(32, &commit.0, hash); SecretKey::from_slice(self.keychain.secp(), res.as_bytes()) - .map_err(|e| ErrorKind::RangeProof(format!("Unable to create nonce: {:?}", e)).into()) + .map_err(|e| Error::RangeProof(format!("Unable to create nonce: {:?}", e))) } } @@ -277,7 +277,7 @@ where fn nonce(&self, commit: &Commitment) -> Result { let res = blake2b(32, &commit.0, &self.root_hash); SecretKey::from_slice(self.keychain.secp(), res.as_bytes()) - .map_err(|e| ErrorKind::RangeProof(format!("Unable to create nonce: {:?}", e)).into()) + .map_err(|e| Error::RangeProof(format!("Unable to create nonce: {:?}", e))) } } @@ -360,7 +360,7 @@ impl ProofBuild for ViewKey { fn rewind_nonce(&self, secp: &Secp256k1, commit: &Commitment) -> Result { let res = blake2b(32, &commit.0, &self.rewind_hash); SecretKey::from_slice(secp, res.as_bytes()) - .map_err(|e| ErrorKind::RangeProof(format!("Unable to create nonce: {:?}", e)).into()) + .map_err(|e| Error::RangeProof(format!("Unable to create nonce: {:?}", e))) } fn private_nonce(&self, _secp: &Secp256k1, _commit: &Commitment) -> Result { diff --git a/core/src/pow/cuckaroo.rs b/core/src/pow/cuckaroo.rs index ae89763ac..2b99cb449 100644 --- a/core/src/pow/cuckaroo.rs +++ b/core/src/pow/cuckaroo.rs @@ -25,7 +25,7 @@ use crate::global; use crate::pow::common::CuckooParams; -use crate::pow::error::{Error, ErrorKind}; +use crate::pow::error::Error; use crate::pow::siphash::siphash_block; use crate::pow::{PoWContext, Proof}; @@ -39,7 +39,7 @@ pub fn new_cuckaroo_ctx(edge_bits: u8, proof_size: usize) -> Result Result, Error> { - Err(ErrorKind::Verification("no cuckaroo past HardFork4".to_owned()).into()) + Err(Error::Verification("no cuckaroo past HardFork4".to_owned())) } /// Cuckaroo cycle context. Only includes the verifier for now. @@ -64,7 +64,7 @@ impl PoWContext for CuckarooContext { fn verify(&self, proof: &Proof) -> Result<(), Error> { let size = proof.proof_size(); if size != global::proofsize() { - return Err(ErrorKind::Verification("wrong cycle length".to_owned()).into()); + return Err(Error::Verification("wrong cycle length".to_owned()).into()); } let nonces = &proof.nonces; let mut uvs = vec![0u64; 2 * size]; @@ -78,10 +78,10 @@ impl PoWContext for CuckarooContext { for n in 0..size { if nonces[n] > self.params.edge_mask { - return Err(ErrorKind::Verification("edge too big".to_owned()).into()); + return Err(Error::Verification("edge too big".to_owned())); } if n > 0 && nonces[n] <= nonces[n - 1] { - return Err(ErrorKind::Verification("edges not ascending".to_owned()).into()); + return Err(Error::Verification("edges not ascending".to_owned())); } // 21 is standard siphash rotation constant let edge: u64 = siphash_block(&self.params.siphash_keys, nonces[n], 21, false); @@ -102,7 +102,7 @@ impl PoWContext for CuckarooContext { xor1 ^= v; } if xor0 | xor1 != 0 { - return Err(ErrorKind::Verification("endpoints don't match up".to_owned()).into()); + return Err(Error::Verification("endpoints don't match up".to_owned())); } // make prev lists circular for n in 0..size { @@ -130,13 +130,13 @@ impl PoWContext for CuckarooContext { if uvs[k] == uvs[i] { // find other edge endpoint matching one at i if j != i { - return Err(ErrorKind::Verification("branch in cycle".to_owned()).into()); + return Err(Error::Verification("branch in cycle".to_owned())); } j = k; } } if j == i { - return Err(ErrorKind::Verification("cycle dead ends".to_owned()).into()); + return Err(Error::Verification("cycle dead ends".to_owned())); } i = j ^ 1; n += 1; @@ -147,7 +147,7 @@ impl PoWContext for CuckarooContext { if n == size { Ok(()) } else { - Err(ErrorKind::Verification("cycle too short".to_owned()).into()) + Err(Error::Verification("cycle too short".to_owned())) } } } diff --git a/core/src/pow/cuckarood.rs b/core/src/pow/cuckarood.rs index 867308a0a..742dceb6a 100644 --- a/core/src/pow/cuckarood.rs +++ b/core/src/pow/cuckarood.rs @@ -24,7 +24,7 @@ use crate::global; use crate::pow::common::CuckooParams; -use crate::pow::error::{Error, ErrorKind}; +use crate::pow::error::Error; use crate::pow::siphash::siphash_block; use crate::pow::{PoWContext, Proof}; @@ -58,7 +58,7 @@ impl PoWContext for CuckaroodContext { fn verify(&self, proof: &Proof) -> Result<(), Error> { let size = proof.proof_size(); if size != global::proofsize() { - return Err(ErrorKind::Verification("wrong cycle length".to_owned()).into()); + return Err(Error::Verification("wrong cycle length".to_owned())); } let nonces = &proof.nonces; let mut uvs = vec![0u64; 2 * size]; @@ -74,13 +74,13 @@ impl PoWContext for CuckaroodContext { for n in 0..size { let dir = (nonces[n] & 1) as usize; if ndir[dir] >= size / 2 { - return Err(ErrorKind::Verification("edges not balanced".to_owned()).into()); + return Err(Error::Verification("edges not balanced".to_owned())); } if nonces[n] > self.params.edge_mask { - return Err(ErrorKind::Verification("edge too big".to_owned()).into()); + return Err(Error::Verification("edge too big".to_owned())); } if n > 0 && nonces[n] <= nonces[n - 1] { - return Err(ErrorKind::Verification("edges not ascending".to_owned()).into()); + return Err(Error::Verification("edges not ascending".to_owned())); } // cuckarood uses a non-standard siphash rotation constant 25 as anti-ASIC tweak let edge: u64 = siphash_block(&self.params.siphash_keys, nonces[n], 25, false); @@ -103,7 +103,7 @@ impl PoWContext for CuckaroodContext { ndir[dir] += 1; } if xor0 | xor1 != 0 { - return Err(ErrorKind::Verification("endpoints don't match up".to_owned()).into()); + return Err(Error::Verification("endpoints don't match up".to_owned())); } let mut n = 0; let mut i = 0; @@ -120,14 +120,14 @@ impl PoWContext for CuckaroodContext { if uvs[k] == uvs[i] { // find reverse edge endpoint identical to one at i if j != i { - return Err(ErrorKind::Verification("branch in cycle".to_owned()).into()); + return Err(Error::Verification("branch in cycle".to_owned())); } j = k; } k = prev[k]; } if j == i { - return Err(ErrorKind::Verification("cycle dead ends".to_owned()).into()); + return Err(Error::Verification("cycle dead ends".to_owned())); } i = j ^ 1; n += 1; @@ -138,7 +138,7 @@ impl PoWContext for CuckaroodContext { if n == size { Ok(()) } else { - Err(ErrorKind::Verification("cycle too short".to_owned()).into()) + Err(Error::Verification("cycle too short".to_owned())) } } } diff --git a/core/src/pow/cuckaroom.rs b/core/src/pow/cuckaroom.rs index 1ca95d983..3ab59887d 100644 --- a/core/src/pow/cuckaroom.rs +++ b/core/src/pow/cuckaroom.rs @@ -23,7 +23,7 @@ use crate::global; use crate::pow::common::CuckooParams; -use crate::pow::error::{Error, ErrorKind}; +use crate::pow::error::Error; use crate::pow::siphash::siphash_block; use crate::pow::{PoWContext, Proof}; @@ -57,7 +57,7 @@ impl PoWContext for CuckaroomContext { fn verify(&self, proof: &Proof) -> Result<(), Error> { let size = proof.proof_size(); if size != global::proofsize() { - return Err(ErrorKind::Verification("wrong cycle length".to_owned()).into()); + return Err(Error::Verification("wrong cycle length".to_owned())); } let nonces = &proof.nonces; let mut from = vec![0u64; size]; @@ -71,10 +71,10 @@ impl PoWContext for CuckaroomContext { for n in 0..size { if nonces[n] > self.params.edge_mask { - return Err(ErrorKind::Verification("edge too big".to_owned()).into()); + return Err(Error::Verification("edge too big".to_owned())); } if n > 0 && nonces[n] <= nonces[n - 1] { - return Err(ErrorKind::Verification("edges not ascending".to_owned()).into()); + return Err(Error::Verification("edges not ascending".to_owned())); } // 21 is standard siphash rotation constant let edge: u64 = siphash_block(&self.params.siphash_keys, nonces[n], 21, true); @@ -89,7 +89,7 @@ impl PoWContext for CuckaroomContext { xor_to ^= to[n]; } if xor_from != xor_to { - return Err(ErrorKind::Verification("endpoints don't match up".to_owned()).into()); + return Err(Error::Verification("endpoints don't match up".to_owned())); } let mut visited = vec![false; size]; let mut n = 0; @@ -97,13 +97,13 @@ impl PoWContext for CuckaroomContext { loop { // follow cycle if visited[i] { - return Err(ErrorKind::Verification("branch in cycle".to_owned()).into()); + return Err(Error::Verification("branch in cycle".to_owned())); } visited[i] = true; let mut k = head[(to[i] & mask) as usize]; loop { if k == size { - return Err(ErrorKind::Verification("cycle dead ends".to_owned()).into()); + return Err(Error::Verification("cycle dead ends".to_owned())); } if from[k] == to[i] { break; @@ -120,7 +120,7 @@ impl PoWContext for CuckaroomContext { if n == size { Ok(()) } else { - Err(ErrorKind::Verification("cycle too short".to_owned()).into()) + Err(Error::Verification("cycle too short".to_owned())) } } } diff --git a/core/src/pow/cuckarooz.rs b/core/src/pow/cuckarooz.rs index 26f0e2f67..174e833b1 100644 --- a/core/src/pow/cuckarooz.rs +++ b/core/src/pow/cuckarooz.rs @@ -24,7 +24,7 @@ use crate::global; use crate::pow::common::CuckooParams; -use crate::pow::error::{Error, ErrorKind}; +use crate::pow::error::Error; use crate::pow::siphash::siphash_block; use crate::pow::{PoWContext, Proof}; @@ -58,7 +58,7 @@ impl PoWContext for CuckaroozContext { fn verify(&self, proof: &Proof) -> Result<(), Error> { let size = proof.proof_size(); if size != global::proofsize() { - return Err(ErrorKind::Verification("wrong cycle length".to_owned()).into()); + return Err(Error::Verification("wrong cycle length".to_owned())); } let nonces = &proof.nonces; let mut uvs = vec![0u64; 2 * size]; @@ -70,10 +70,10 @@ impl PoWContext for CuckaroozContext { for n in 0..size { if nonces[n] > self.params.edge_mask { - return Err(ErrorKind::Verification("edge too big".to_owned()).into()); + return Err(Error::Verification("edge too big".to_owned())); } if n > 0 && nonces[n] <= nonces[n - 1] { - return Err(ErrorKind::Verification("edges not ascending".to_owned()).into()); + return Err(Error::Verification("edges not ascending".to_owned())); } // 21 is standard siphash rotation constant let edge: u64 = siphash_block(&self.params.siphash_keys, nonces[n], 21, true); @@ -93,7 +93,7 @@ impl PoWContext for CuckaroozContext { xoruv ^= uvs[2 * n] ^ uvs[2 * n + 1]; } if xoruv != 0 { - return Err(ErrorKind::Verification("endpoints don't match up".to_owned()).into()); + return Err(Error::Verification("endpoints don't match up".to_owned())); } // make prev lists circular for n in 0..(2 * size) { @@ -117,13 +117,13 @@ impl PoWContext for CuckaroozContext { if uvs[k] == uvs[i] { // find other edge endpoint matching one at i if j != i { - return Err(ErrorKind::Verification("branch in cycle".to_owned()).into()); + return Err(Error::Verification("branch in cycle".to_owned())); } j = k; } } if j == i { - return Err(ErrorKind::Verification("cycle dead ends".to_owned()).into()); + return Err(Error::Verification("cycle dead ends".to_owned())); } i = j ^ 1; n += 1; @@ -134,7 +134,7 @@ impl PoWContext for CuckaroozContext { if n == self.params.proof_size { Ok(()) } else { - Err(ErrorKind::Verification("cycle too short".to_owned()).into()) + Err(Error::Verification("cycle too short".to_owned())) } } } diff --git a/core/src/pow/cuckatoo.rs b/core/src/pow/cuckatoo.rs index 05c0f71fc..5f7051575 100644 --- a/core/src/pow/cuckatoo.rs +++ b/core/src/pow/cuckatoo.rs @@ -14,7 +14,7 @@ //! Implementation of Cuckatoo Cycle designed by John Tromp. use crate::global; use crate::pow::common::{CuckooParams, Link}; -use crate::pow::error::{Error, ErrorKind}; +use crate::pow::error::Error; use crate::pow::{PoWContext, Proof}; use byteorder::{BigEndian, WriteBytesExt}; use croaring::Bitmap; @@ -46,7 +46,7 @@ impl Graph { /// Create a new graph with given parameters pub fn new(max_edges: u64, max_sols: u32, proof_size: usize) -> Result { if max_edges >= u64::max_value() / 2 { - return Err(ErrorKind::Verification("graph is to big to build".to_string()).into()); + return Err(Error::Verification("graph is to big to build".to_string())); } let max_nodes = 2 * max_edges; Ok(Graph { @@ -79,7 +79,7 @@ impl Graph { /// Add an edge to the graph pub fn add_edge(&mut self, u: u64, mut v: u64) -> Result<(), Error> { if u >= self.max_nodes || v >= self.max_nodes { - return Err(ErrorKind::EdgeAddition.into()); + return Err(Error::EdgeAddition); } v = v + self.max_nodes; let adj_u = self.adj_list[(u ^ 1) as usize]; @@ -92,7 +92,7 @@ impl Graph { let ulink = self.links.len() as u64; let vlink = (self.links.len() + 1) as u64; if vlink == self.nil { - return Err(ErrorKind::EdgeAddition.into()); + return Err(Error::EdgeAddition); } self.links.push(Link { next: self.adj_list[u as usize], @@ -246,7 +246,7 @@ impl CuckatooContext { self.verify_impl(&s)?; } if self.graph.solutions.is_empty() { - Err(ErrorKind::NoSolution.into()) + Err(Error::NoSolution) } else { Ok(self.graph.solutions.clone()) } @@ -257,7 +257,7 @@ impl CuckatooContext { pub fn verify_impl(&self, proof: &Proof) -> Result<(), Error> { let size = proof.proof_size(); if size != global::proofsize() { - return Err(ErrorKind::Verification("wrong cycle length".to_owned()).into()); + return Err(Error::Verification("wrong cycle length".to_owned())); } let nonces = &proof.nonces; let mut uvs = vec![0u64; 2 * size]; @@ -271,10 +271,10 @@ impl CuckatooContext { for n in 0..size { if nonces[n] > self.params.edge_mask { - return Err(ErrorKind::Verification("edge too big".to_owned()).into()); + return Err(Error::Verification("edge too big".to_owned())); } if n > 0 && nonces[n] <= nonces[n - 1] { - return Err(ErrorKind::Verification("edges not ascending".to_owned()).into()); + return Err(Error::Verification("edges not ascending".to_owned())); } let u = self.params.sipnode(nonces[n], 0)?; let v = self.params.sipnode(nonces[n], 1)?; @@ -293,7 +293,7 @@ impl CuckatooContext { xor1 ^= v; } if xor0 | xor1 != 0 { - return Err(ErrorKind::Verification("endpoints don't match up".to_owned()).into()); + return Err(Error::Verification("endpoints don't match up".to_owned())); } // make prev lists circular for n in 0..size { @@ -321,13 +321,13 @@ impl CuckatooContext { if uvs[k] >> 1 == uvs[i] >> 1 { // find other edge endpoint matching one at i if j != i { - return Err(ErrorKind::Verification("branch in cycle".to_owned()).into()); + return Err(Error::Verification("branch in cycle".to_owned())); } j = k; } } if j == i || uvs[j] == uvs[i] { - return Err(ErrorKind::Verification("cycle dead ends".to_owned()).into()); + return Err(Error::Verification("cycle dead ends".to_owned())); } i = j ^ 1; n += 1; @@ -338,7 +338,7 @@ impl CuckatooContext { if n == size { Ok(()) } else { - Err(ErrorKind::Verification("cycle too short".to_owned()).into()) + Err(Error::Verification("cycle too short".to_owned())) } } } diff --git a/core/src/pow/error.rs b/core/src/pow/error.rs index 1dfe55587..c00d22e29 100644 --- a/core/src/pow/error.rs +++ b/core/src/pow/error.rs @@ -13,83 +13,34 @@ // limitations under the License. //! Cuckatoo specific errors -use failure::{Backtrace, Context, Fail}; -use std::fmt::{self, Display}; -use std::io; /// Cuckatoo solver or validation error -#[derive(Debug)] -pub struct Error { - inner: Context, -} - -#[derive(Clone, Debug, Eq, Fail, PartialEq)] +#[derive(Debug, thiserror::Error)] /// Libwallet error types -pub enum ErrorKind { +pub enum Error { /// Verification error - #[fail(display = "Verification Error: {}", _0)] + #[error("Verification Error: {0}")] Verification(String), /// IO Error - #[fail(display = "IO Error")] - IOError, + #[error("IO Error")] + IOError { + /// Io Error Convert + #[from] + source: std::io::Error, + }, /// Unexpected Edge Error - #[fail(display = "Edge Addition Error")] + #[error("Edge Addition Error")] EdgeAddition, /// Path Error - #[fail(display = "Path Error")] + #[error("Path Error")] Path, /// Invalid cycle - #[fail(display = "Invalid Cycle length: {}", _0)] + #[error("Invalid Cycle length: {0}")] InvalidCycle(usize), /// No Cycle - #[fail(display = "No Cycle")] + #[error("No Cycle")] NoCycle, /// No Solution - #[fail(display = "No Solution")] + #[error("No Solution")] NoSolution, } - -impl Fail for Error { - fn cause(&self) -> Option<&dyn Fail> { - self.inner.cause() - } - - fn backtrace(&self) -> Option<&Backtrace> { - self.inner.backtrace() - } -} - -impl Display for Error { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - Display::fmt(&self.inner, f) - } -} - -impl Error { - /// Return errorkind - pub fn kind(&self) -> ErrorKind { - self.inner.get_context().clone() - } -} - -impl From for Error { - fn from(kind: ErrorKind) -> Error { - Error { - inner: Context::new(kind), - } - } -} - -impl From> for Error { - fn from(inner: Context) -> Error { - Error { inner } - } -} - -impl From for Error { - fn from(_error: io::Error) -> Error { - Error { - inner: Context::new(ErrorKind::IOError), - } - } -} diff --git a/p2p/src/peers.rs b/p2p/src/peers.rs index d078e89fe..04174085b 100644 --- a/p2p/src/peers.rs +++ b/p2p/src/peers.rs @@ -501,11 +501,7 @@ impl ChainAdapter for Peers { hash, peer_info.addr, ); self.ban_peer(peer_info.addr, ReasonForBan::BadBlock) - .map_err(|e| { - let err: chain::Error = - chain::ErrorKind::Other(format!("ban peer error :{:?}", e)).into(); - err - })?; + .map_err(|e| chain::Error::Other(format!("ban peer error: {:?}", e)))?; Ok(false) } else { Ok(true) @@ -526,11 +522,7 @@ impl ChainAdapter for Peers { hash, peer_info.addr ); self.ban_peer(peer_info.addr, ReasonForBan::BadCompactBlock) - .map_err(|e| { - let err: chain::Error = - chain::ErrorKind::Other(format!("ban peer error :{:?}", e)).into(); - err - })?; + .map_err(|e| chain::Error::Other(format!("ban peer error: {:?}", e)))?; Ok(false) } else { Ok(true) @@ -546,11 +538,7 @@ impl ChainAdapter for Peers { // if the peer sent us a block header that's intrinsically bad // they are either mistaken or malevolent, both of which require a ban self.ban_peer(peer_info.addr, ReasonForBan::BadBlockHeader) - .map_err(|e| { - let err: chain::Error = - chain::ErrorKind::Other(format!("ban peer error :{:?}", e)).into(); - err - })?; + .map_err(|e| chain::Error::Other(format!("ban peer error: {:?}", e)))?; Ok(false) } else { Ok(true) @@ -566,11 +554,7 @@ impl ChainAdapter for Peers { // if the peer sent us a block header that's intrinsically bad // they are either mistaken or malevolent, both of which require a ban self.ban_peer(peer_info.addr, ReasonForBan::BadBlockHeader) - .map_err(|e| { - let err: chain::Error = - chain::ErrorKind::Other(format!("ban peer error :{:?}", e)).into(); - err - })?; + .map_err(|e| chain::Error::Other(format!("ban peer error: {:?}", e)))?; Ok(false) } else { Ok(true) @@ -609,11 +593,7 @@ impl ChainAdapter for Peers { peer_info.addr ); self.ban_peer(peer_info.addr, ReasonForBan::BadTxHashSet) - .map_err(|e| { - let err: chain::Error = - chain::ErrorKind::Other(format!("ban peer error :{:?}", e)).into(); - err - })?; + .map_err(|e| chain::Error::Other(format!("ban peer error: {:?}", e)))?; Ok(true) } else { Ok(false) diff --git a/pool/Cargo.toml b/pool/Cargo.toml index 62329c9fb..e8771f38c 100644 --- a/pool/Cargo.toml +++ b/pool/Cargo.toml @@ -14,10 +14,9 @@ blake2-rfc = "0.2" rand = "0.6" serde = "1" serde_derive = "1" +thiserror = "1" log = "0.4" chrono = "0.4.11" -failure = "0.1" -failure_derive = "0.1" grin_core = { path = "../core", version = "5.2.0-alpha.1" } grin_keychain = { path = "../keychain", version = "5.2.0-alpha.1" } diff --git a/pool/fuzz/Cargo.lock b/pool/fuzz/Cargo.lock index 42f3ce04a..e38d7c3e7 100644 --- a/pool/fuzz/Cargo.lock +++ b/pool/fuzz/Cargo.lock @@ -1,5 +1,7 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "addr2line" version = "0.13.0" @@ -35,9 +37,9 @@ dependencies = [ [[package]] name = "arbitrary" -version = "0.4.5" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cb544f1057eaaff4b34f8c4dcf56fc3cd04debd291998405d135017a7c3c0f4" +checksum = "5a7924531f38b1970ff630f03eb20a2fde69db5c590c93b0f3482e95dcc5fd60" [[package]] name = "arc-swap" @@ -45,12 +47,6 @@ version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4d25d88fd6b8041580a654f9d0c581a047baee2b3efee13275f2fc392fc75034" -[[package]] -name = "arrayref" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" - [[package]] name = "arrayvec" version = "0.3.25" @@ -100,23 +96,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46254cf2fdcdf1badb5934448c1bcbe046a56537b3987d96c51a7afc5d03f293" dependencies = [ "addr2line", - "cfg-if", + "cfg-if 0.1.10", "libc", "miniz_oxide", "object", "rustc-demangle", ] -[[package]] -name = "base64" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643" -dependencies = [ - "byteorder", - "safemem", -] - [[package]] name = "base64" version = "0.12.3" @@ -124,14 +110,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" [[package]] -name = "bindgen" -version = "0.52.0" +name = "base64ct" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1c85344eb535a31b62f0af37be84441ba9e7f0f4111eb0530f43d15e513fe57" +checksum = "3bdca834647821e0b13d9539a8634eb62d3501b6b6c2cec1722786ee6671b851" + +[[package]] +name = "bindgen" +version = "0.56.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2da379dbebc0b76ef63ca68d8fc6e71c0f13e59432e0987e508c1820e6ab5239" dependencies = [ "bitflags 1.2.1", "cexpr", - "cfg-if", "clang-sys", "clap", "env_logger", @@ -139,8 +130,8 @@ dependencies = [ "lazycell", "log", "peeking_take_while", - "proc-macro2 1.0.18", - "quote 1.0.7", + "proc-macro2", + "quote", "regex", "rustc-hash", "shlex", @@ -177,26 +168,25 @@ dependencies = [ [[package]] name = "block-buffer" -version = "0.3.3" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a076c298b9ecdb530ed9d967e74a6027d6a7478924520acddcddc24c1c8ab3ab" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ - "arrayref", - "byte-tools", + "generic-array", ] -[[package]] -name = "byte-tools" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" - [[package]] name = "byteorder" version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" +[[package]] +name = "bytes" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" + [[package]] name = "cc" version = "1.0.58" @@ -205,9 +195,9 @@ checksum = "f9a06fb2e53271d7c279ec1efea6ab691c35a2ae67ec0d91d7acec0caf13b518" [[package]] name = "cexpr" -version = "0.3.6" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fce5b5fb86b0c57c20c834c1b412fd09c77c8a59b9473f86272709e78874cd1d" +checksum = "f4aedb84272dbe89af497cf81375129abda4fc0a9e7c5d317498c15cc30c0d27" dependencies = [ "nom", ] @@ -218,6 +208,12 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + [[package]] name = "chrono" version = "0.4.13" @@ -232,9 +228,9 @@ dependencies = [ [[package]] name = "clang-sys" -version = "0.28.1" +version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81de550971c976f176130da4b2978d3b524eaa0fd9ac31f3ceb5ae1231fb4853" +checksum = "5a050e2153c5be08febd6734e29298e844fdb0fa21aeddd63b4eb7baa106c69b" dependencies = [ "glob", "libc", @@ -271,31 +267,40 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" +[[package]] +name = "cpufeatures" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b" +dependencies = [ + "libc", +] + [[package]] name = "crc32fast" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", ] [[package]] -name = "croaring-mw" -version = "0.4.5" +name = "croaring" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcdee571ce4bf3e49c382de29c38bd33b9fa871e1358c7749b9dcc5dc2776221" +checksum = "a00d14ad7d8cc067d7a5c93e8563791bfec3f7182361db955530db11d94ed63c" dependencies = [ "byteorder", - "croaring-sys-mw", + "croaring-sys", "libc", ] [[package]] -name = "croaring-sys-mw" -version = "0.4.5" +name = "croaring-sys" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea52c177269fa54c526b054dac8e623721de18143ebfd2ea84ffc023d6c271ee" +checksum = "c5d6a46501bb403a61e43bc7cd19977b4f9c54efd703949b00259cc61afb5a86" dependencies = [ "bindgen", "cc", @@ -304,19 +309,19 @@ dependencies = [ [[package]] name = "crypto-mac" -version = "0.6.2" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7afa06d05a046c7a47c3a849907ec303504608c927f4e85f7bfff22b7180d971" +checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" dependencies = [ - "constant_time_eq", "generic-array", + "subtle", ] [[package]] name = "digest" -version = "0.7.6" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03b072242a8cbaf9c145665af9d250c59af3b958f83ed6824e13533cf76d5b90" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" dependencies = [ "generic-array", ] @@ -338,52 +343,24 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.7.1" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" +checksum = "a19187fea3ac7e84da7dacf48de0c45d63c6a76f9490dae389aead16c243fce3" dependencies = [ "atty", - "humantime", + "humantime 2.1.0", "log", "regex", "termcolor", ] -[[package]] -name = "failure" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86" -dependencies = [ - "backtrace", - "failure_derive", -] - -[[package]] -name = "failure_derive" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4" -dependencies = [ - "proc-macro2 1.0.18", - "quote 1.0.7", - "syn 1.0.34", - "synstructure 0.12.4", -] - -[[package]] -name = "fake-simd" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" - [[package]] name = "flate2" version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68c90b0fc46cf89d227cc78b40e494ff81287a92dd07631e5af0d06fe3cf885e" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "crc32fast", "libc", "miniz_oxide", @@ -409,11 +386,12 @@ checksum = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" [[package]] name = "generic-array" -version = "0.9.0" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef25c5683767570c2bbd7deba372926a55eaae9982d7726ee2a1050239d45b9d" +checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" dependencies = [ "typenum", + "version_check", ] [[package]] @@ -422,7 +400,7 @@ version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "libc", "wasi", ] @@ -441,16 +419,14 @@ checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "grin_chain" -version = "4.2.0-alpha.1" +version = "5.2.0-alpha.1" dependencies = [ "bit-vec", "bitflags 1.2.1", "byteorder", "chrono", - "croaring-mw", + "croaring", "enum_primitive", - "failure", - "failure_derive", "grin_core", "grin_keychain", "grin_store", @@ -460,19 +436,19 @@ dependencies = [ "lru-cache", "serde", "serde_derive", + "thiserror", ] [[package]] name = "grin_core" -version = "4.2.0-alpha.1" +version = "5.2.0-alpha.1" dependencies = [ "blake2-rfc", "byteorder", + "bytes", "chrono", - "croaring-mw", + "croaring", "enum_primitive", - "failure", - "failure_derive", "grin_keychain", "grin_util", "lazy_static", @@ -484,12 +460,13 @@ dependencies = [ "serde", "serde_derive", "siphasher", - "zeroize 1.1.0", + "thiserror", + "zeroize", ] [[package]] name = "grin_keychain" -version = "4.2.0-alpha.1" +version = "5.2.0-alpha.1" dependencies = [ "blake2-rfc", "byteorder", @@ -505,17 +482,15 @@ dependencies = [ "serde_derive", "serde_json", "sha2", - "zeroize 1.1.0", + "zeroize", ] [[package]] name = "grin_pool" -version = "4.2.0-alpha.1" +version = "5.2.0-alpha.1" dependencies = [ "blake2-rfc", "chrono", - "failure", - "failure_derive", "grin_core", "grin_keychain", "grin_util", @@ -523,6 +498,7 @@ dependencies = [ "rand 0.6.5", "serde", "serde_derive", + "thiserror", ] [[package]] @@ -540,9 +516,9 @@ dependencies = [ [[package]] name = "grin_secp256k1zkp" -version = "0.7.9" +version = "0.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c2e7431d1999f02112c2383c9d33e7a6212947abfba92c87ab7283ba667a8b" +checksum = "3af3c4c4829b3e2e7ee1d9a542833e4244912fbb887fabe44682558159b068a7" dependencies = [ "arrayvec 0.3.25", "cc", @@ -551,17 +527,15 @@ dependencies = [ "rustc-serialize", "serde", "serde_json", - "zeroize 0.9.3", + "zeroize", ] [[package]] name = "grin_store" -version = "4.2.0-alpha.1" +version = "5.2.0-alpha.1" dependencies = [ "byteorder", - "croaring-mw", - "failure", - "failure_derive", + "croaring", "grin_core", "grin_util", "libc", @@ -571,14 +545,15 @@ dependencies = [ "serde", "serde_derive", "tempfile", + "thiserror", ] [[package]] name = "grin_util" -version = "4.2.0-alpha.1" +version = "5.2.0-alpha.1" dependencies = [ "backtrace", - "base64 0.12.3", + "base64", "byteorder", "grin_secp256k1zkp", "lazy_static", @@ -589,7 +564,7 @@ dependencies = [ "serde", "serde_derive", "walkdir", - "zeroize 1.1.0", + "zeroize", "zip", ] @@ -604,9 +579,9 @@ dependencies = [ [[package]] name = "hmac" -version = "0.6.3" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "733e1b3ac906631ca01ebb577e9bb0f5e37a454032b9036b5eaea4013ed6f99a" +checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" dependencies = [ "crypto-mac", "digest", @@ -621,6 +596,12 @@ dependencies = [ "quick-error", ] +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + [[package]] name = "itoa" version = "0.4.6" @@ -647,12 +628,13 @@ checksum = "a9f8082297d534141b30c8d39e9b1773713ab50fdbe4ff30f750d063b3bfd701" [[package]] name = "libfuzzer-sys" -version = "0.3.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d718794b8e23533b9069bd2c4597d69e41cc7ab1c02700a502971aca0cdcf24" +checksum = "336244aaeab6a12df46480dc585802aa743a72d66b11937844c61bbca84c991d" dependencies = [ "arbitrary", "cc", + "once_cell", ] [[package]] @@ -667,11 +649,11 @@ dependencies = [ [[package]] name = "libloading" -version = "0.5.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753" +checksum = "efbc0f03f9a775e9f6aed295c6a1ba2253c5757a9e03d55c6caa46a681abcddd" dependencies = [ - "cc", + "cfg-if 1.0.0", "winapi", ] @@ -708,7 +690,7 @@ version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "serde", ] @@ -728,7 +710,7 @@ dependencies = [ "chrono", "flate2", "fnv", - "humantime", + "humantime 1.3.0", "libc", "log", "log-mdc", @@ -785,9 +767,9 @@ checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" [[package]] name = "nom" -version = "4.2.3" +version = "5.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ad2a91a8e869eeb30b9cb3119ae87773a8f4ae617f41b1eb9c154b2905f7bd6" +checksum = "ffb4262d26ed83a1c0a33a38fe2bb15797329c85770da05e6b828ddb782627af" dependencies = [ "memchr", "version_check", @@ -891,6 +873,18 @@ version = "0.2.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4eae0151b9dacf24fcc170d9995e511669a082856a91f958a2fe380bfab3fb22" +[[package]] +name = "once_cell" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1" + +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + [[package]] name = "ordered-float" version = "1.1.0" @@ -916,7 +910,7 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "cloudabi", "libc", "redox_syscall", @@ -925,18 +919,26 @@ dependencies = [ ] [[package]] -name = "pbkdf2" +name = "password-hash" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c09cddfbfc98de7f76931acf44460972edb4023eb14d0c6d4018800e552d8e0" +checksum = "77e0b28ace46c5a396546bcf443bf422b57049617433d8854227352a4a9b24e7" dependencies = [ - "base64 0.9.3", - "byteorder", - "constant_time_eq", + "base64ct", + "rand_core 0.6.3", + "subtle", +] + +[[package]] +name = "pbkdf2" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d95f5254224e617595d2cc3cc73ff0a5eaf2637519e25f03388154e9378b6ffa" +dependencies = [ + "base64ct", "crypto-mac", - "generic-array", "hmac", - "rand 0.5.6", + "password-hash", "sha2", ] @@ -946,12 +948,6 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" -[[package]] -name = "podio" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b18befed8bc2b61abc79a457295e7e838417326da1586050b919414073977f19" - [[package]] name = "ppv-lite86" version = "0.2.8" @@ -960,20 +956,11 @@ checksum = "237a5ed80e274dbc66f86bd59c1e25edc039660be53194b5fe0a482e0f2612ea" [[package]] name = "proc-macro2" -version = "0.4.30" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" +checksum = "dd96a1e8ed2596c337f8eae5f24924ec83f5ad5ab21ea8e455d3566c69fbcaf7" dependencies = [ - "unicode-xid 0.1.0", -] - -[[package]] -name = "proc-macro2" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "beae6331a816b1f65d04c45b078fd8e6c93e8071771f41b8163255bbd8d7c8fa" -dependencies = [ - "unicode-xid 0.2.1", + "unicode-ident", ] [[package]] @@ -982,22 +969,13 @@ version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" -[[package]] -name = "quote" -version = "0.6.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" -dependencies = [ - "proc-macro2 0.4.30", -] - [[package]] name = "quote" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" dependencies = [ - "proc-macro2 1.0.18", + "proc-macro2", ] [[package]] @@ -1089,6 +1067,12 @@ dependencies = [ "getrandom", ] +[[package]] +name = "rand_core" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" + [[package]] name = "rand_hc" version = "0.1.0" @@ -1204,13 +1188,13 @@ dependencies = [ [[package]] name = "ripemd160" -version = "0.7.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "482aa56cc68aaeccdaaff1cc5a72c247da8bbad3beb174ca5741f274c22883fb" +checksum = "2eca4ecc81b7f313189bf73ce724400a07da2a6dac19588b03c8bd76a2dcc251" dependencies = [ "block-buffer", - "byte-tools", "digest", + "opaque-debug", ] [[package]] @@ -1237,12 +1221,6 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" -[[package]] -name = "safemem" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072" - [[package]] name = "same-file" version = "1.0.6" @@ -1283,9 +1261,9 @@ version = "1.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a0be94b04690fbaed37cddffc5c134bf537c8e3329d53e982fe04c374978f8e" dependencies = [ - "proc-macro2 1.0.18", - "quote 1.0.7", - "syn 1.0.34", + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -1313,14 +1291,15 @@ dependencies = [ [[package]] name = "sha2" -version = "0.7.1" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9eb6be24e4c23a84d7184280d2722f7f2731fcdd4a9d886efbfe4413e4847ea0" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" dependencies = [ "block-buffer", - "byte-tools", + "cfg-if 1.0.0", + "cpufeatures", "digest", - "fake-simd", + "opaque-debug", ] [[package]] @@ -1347,6 +1326,12 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" +[[package]] +name = "subtle" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" + [[package]] name = "supercow" version = "0.1.0" @@ -1355,36 +1340,13 @@ checksum = "171758edb47aa306a78dfa4ab9aeb5167405bd4e3dc2b64e88f6a84bbe98bd63" [[package]] name = "syn" -version = "0.15.44" +version = "1.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" +checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd" dependencies = [ - "proc-macro2 0.4.30", - "quote 0.6.13", - "unicode-xid 0.1.0", -] - -[[package]] -name = "syn" -version = "1.0.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "936cae2873c940d92e697597c5eee105fb570cd5689c695806f672883653349b" -dependencies = [ - "proc-macro2 1.0.18", - "quote 1.0.7", - "unicode-xid 0.2.1", -] - -[[package]] -name = "synstructure" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02353edf96d6e4dc81aea2d8490a7e9db177bf8acb0e951c24940bf866cb313f" -dependencies = [ - "proc-macro2 0.4.30", - "quote 0.6.13", - "syn 0.15.44", - "unicode-xid 0.1.0", + "proc-macro2", + "quote", + "unicode-ident", ] [[package]] @@ -1393,10 +1355,10 @@ version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701" dependencies = [ - "proc-macro2 1.0.18", - "quote 1.0.7", - "syn 1.0.34", - "unicode-xid 0.2.1", + "proc-macro2", + "quote", + "syn", + "unicode-xid", ] [[package]] @@ -1405,7 +1367,7 @@ version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "libc", "rand 0.7.3", "redox_syscall", @@ -1431,6 +1393,26 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "thiserror" +version = "1.0.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "thread-id" version = "3.3.0" @@ -1482,18 +1464,18 @@ version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" +[[package]] +name = "unicode-ident" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c" + [[package]] name = "unicode-width" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" -[[package]] -name = "unicode-xid" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" - [[package]] name = "unicode-xid" version = "0.2.1" @@ -1517,9 +1499,9 @@ checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" [[package]] name = "version_check" -version = "0.1.5" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "walkdir" @@ -1587,34 +1569,13 @@ dependencies = [ "linked-hash-map", ] -[[package]] -name = "zeroize" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45af6a010d13e4cf5b54c94ba5a2b2eba5596b9e46bf5875612d332a1f2b3f86" -dependencies = [ - "zeroize_derive 0.9.3", -] - [[package]] name = "zeroize" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3cbac2ed2ba24cc90f5e06485ac8c7c1e5449fe8911aef4d8877218af021a5b8" dependencies = [ - "zeroize_derive 1.0.0", -] - -[[package]] -name = "zeroize_derive" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "080616bd0e31f36095288bb0acdf1f78ef02c2fa15527d7e993f2a6c7591643e" -dependencies = [ - "proc-macro2 0.4.30", - "quote 0.6.13", - "syn 0.15.44", - "synstructure 0.10.2", + "zeroize_derive", ] [[package]] @@ -1623,18 +1584,19 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de251eec69fc7c1bc3923403d18ececb929380e016afe103da75f396704f8ca2" dependencies = [ - "proc-macro2 1.0.18", - "quote 1.0.7", - "syn 1.0.34", - "synstructure 0.12.4", + "proc-macro2", + "quote", + "syn", + "synstructure", ] [[package]] name = "zip" -version = "0.5.6" +version = "0.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58287c28d78507f5f91f2a4cf1e8310e2c76fd4c6932f93ac60fd1ceb402db7d" +checksum = "93ab48844d61251bb3835145c521d88aa4031d7139e8485990f60ca911fa0815" dependencies = [ + "byteorder", "crc32fast", - "podio", + "thiserror", ] diff --git a/pool/fuzz/Cargo.toml b/pool/fuzz/Cargo.toml index 0541050ba..a10d61a7c 100644 --- a/pool/fuzz/Cargo.toml +++ b/pool/fuzz/Cargo.toml @@ -5,12 +5,9 @@ authors = ["Automatically generated"] publish = false edition = "2018" -[package.metadata] -cargo-fuzz = true - [dependencies] chrono = "0.4.11" -libfuzzer-sys = "0.3" +libfuzzer-sys = "0.4.0" grin_chain = { path = "../../chain" } grin_core = { path = "../../core" } grin_keychain = { path = "../../keychain" } diff --git a/pool/fuzz/fuzz_targets/common.rs b/pool/fuzz/fuzz_targets/common.rs index 65b9c8eec..3e404cd4d 100644 --- a/pool/fuzz/fuzz_targets/common.rs +++ b/pool/fuzz/fuzz_targets/common.rs @@ -91,8 +91,8 @@ impl BlockChain for ChainAdapter { fn validate_tx(&self, tx: &Transaction) -> Result<(), pool::PoolError> { self.chain.validate_tx(tx).map_err(|e| match e.kind() { - chain::ErrorKind::Transaction(txe) => txe.into(), - chain::ErrorKind::NRDRelativeHeight => PoolError::NRDKernelRelativeHeight, + chain::Error::Transaction(txe) => txe.into(), + chain::Error::NRDRelativeHeight => PoolError::NRDKernelRelativeHeight, _ => PoolError::Other("failed to validate tx".into()), }) } diff --git a/pool/src/types.rs b/pool/src/types.rs index 4466cfe3d..88a39af2f 100644 --- a/pool/src/types.rs +++ b/pool/src/types.rs @@ -23,7 +23,6 @@ use self::core::core::transaction::{self, Transaction}; use self::core::core::{BlockHeader, BlockSums, Inputs, OutputIdentifier}; use self::core::global::DEFAULT_ACCEPT_FEE_BASE; use chrono::prelude::*; -use failure::Fail; use grin_core as core; use grin_keychain as keychain; @@ -205,53 +204,53 @@ impl TxSource { } /// Possible errors when interacting with the transaction pool. -#[derive(Debug, Fail, PartialEq)] +#[derive(Debug, thiserror::Error, PartialEq)] pub enum PoolError { /// An invalid pool entry caused by underlying tx validation error - #[fail(display = "Invalid Tx {}", _0)] + #[error("Invalid Tx {0}")] InvalidTx(transaction::Error), /// An invalid pool entry caused by underlying block validation error - #[fail(display = "Invalid Block {}", _0)] + #[error("Invalid Block {0}")] InvalidBlock(block::Error), /// Underlying keychain error. - #[fail(display = "Keychain error {}", _0)] + #[error("Keychain error {0}")] Keychain(keychain::Error), /// Underlying "committed" error. - #[fail(display = "Committed error {}", _0)] + #[error("Committed error {0}")] Committed(committed::Error), /// Attempt to add a transaction to the pool with lock_height /// greater than height of current block - #[fail(display = "Immature transaction")] + #[error("Immature transaction")] ImmatureTransaction, /// Attempt to spend a coinbase output before it has sufficiently matured. - #[fail(display = "Immature coinbase")] + #[error("Immature coinbase")] ImmatureCoinbase, /// Problem propagating a stem tx to the next Dandelion relay node. - #[fail(display = "Dandelion error")] + #[error("Dandelion error")] DandelionError, /// Transaction pool is over capacity, can't accept more transactions - #[fail(display = "Over capacity")] + #[error("Over capacity")] OverCapacity, /// Transaction fee is too low given its weight - #[fail(display = "Low fee transaction {}", _0)] + #[error("Low fee transaction {0}")] LowFeeTransaction(u64), /// Attempt to add a duplicate output to the pool. - #[fail(display = "Duplicate commitment")] + #[error("Duplicate commitment")] DuplicateCommitment, /// Attempt to add a duplicate tx to the pool. - #[fail(display = "Duplicate tx")] + #[error("Duplicate tx")] DuplicateTx, /// NRD kernels will not be accepted by the txpool/stempool pre-HF3. - #[fail(display = "NRD kernel pre-HF3")] + #[error("NRD kernel pre-HF3")] NRDKernelPreHF3, /// NRD kernels are not valid if disabled locally via "feature flag". - #[fail(display = "NRD kernel not enabled")] + #[error("NRD kernel not enabled")] NRDKernelNotEnabled, /// NRD kernels are not valid if relative_height rule not met. - #[fail(display = "NRD kernel relative height")] + #[error("NRD kernel relative height")] NRDKernelRelativeHeight, /// Other kinds of error (not yet pulled out into meaningful errors). - #[fail(display = "General pool error {}", _0)] + #[error("General pool error {0}")] Other(String), } diff --git a/pool/tests/common.rs b/pool/tests/common.rs index 76a8b44e1..c3f3ab918 100644 --- a/pool/tests/common.rs +++ b/pool/tests/common.rs @@ -125,9 +125,9 @@ impl BlockChain for ChainAdapter { } fn validate_tx(&self, tx: &Transaction) -> Result<(), pool::PoolError> { - self.chain.validate_tx(tx).map_err(|e| match e.kind() { - chain::ErrorKind::Transaction(txe) => txe.into(), - chain::ErrorKind::NRDRelativeHeight => PoolError::NRDKernelRelativeHeight, + self.chain.validate_tx(tx).map_err(|e| match e { + chain::Error::Transaction { source: txe } => txe.into(), + chain::Error::NRDRelativeHeight => PoolError::NRDKernelRelativeHeight, _ => PoolError::Other("failed to validate tx".into()), }) } diff --git a/servers/src/common/adapters.rs b/servers/src/common/adapters.rs index 72378d62b..8b475007a 100644 --- a/servers/src/common/adapters.rs +++ b/servers/src/common/adapters.rs @@ -205,7 +205,7 @@ where .chain() .process_block_header(&cb.header, chain::Options::NONE) { - debug!("Invalid compact block header {}: {:?}", cb_hash, e.kind()); + debug!("Invalid compact block header {}: {:?}", cb_hash, e); return Ok(!e.is_bad_data()); } @@ -286,11 +286,7 @@ where let res = self.chain().process_block_header(&bh, chain::Options::NONE); if let Err(e) = res { - debug!( - "Block header {} refused by chain: {:?}", - bh.hash(), - e.kind() - ); + debug!("Block header {} refused by chain: {:?}", bh.hash(), e); if e.is_bad_data() { return Ok(false); } else { @@ -480,9 +476,9 @@ where if is_bad_data { self.chain().clean_txhashset_sandbox(); error!("Failed to save txhashset archive: bad data"); - self.sync_state.set_sync_error( - chain::ErrorKind::TxHashSetErr("bad txhashset data".to_string()).into(), - ); + self.sync_state.set_sync_error(chain::Error::TxHashSetErr( + "bad txhashset data".to_string(), + )); } else { info!("Received valid txhashset data for {}.", h); } @@ -511,11 +507,11 @@ where id: SegmentIdentifier, ) -> Result, chain::Error> { if !KERNEL_SEGMENT_HEIGHT_RANGE.contains(&id.height) { - return Err(chain::ErrorKind::InvalidSegmentHeight.into()); + return Err(chain::Error::InvalidSegmentHeight); } let segmenter = self.chain().segmenter()?; if segmenter.header().hash() != hash { - return Err(chain::ErrorKind::SegmenterHeaderMismatch.into()); + return Err(chain::Error::SegmenterHeaderMismatch); } segmenter.kernel_segment(id) } @@ -526,11 +522,11 @@ where id: SegmentIdentifier, ) -> Result<(Segment, Hash), chain::Error> { if !BITMAP_SEGMENT_HEIGHT_RANGE.contains(&id.height) { - return Err(chain::ErrorKind::InvalidSegmentHeight.into()); + return Err(chain::Error::InvalidSegmentHeight); } let segmenter = self.chain().segmenter()?; if segmenter.header().hash() != hash { - return Err(chain::ErrorKind::SegmenterHeaderMismatch.into()); + return Err(chain::Error::SegmenterHeaderMismatch); } segmenter.bitmap_segment(id) } @@ -541,11 +537,11 @@ where id: SegmentIdentifier, ) -> Result<(Segment, Hash), chain::Error> { if !OUTPUT_SEGMENT_HEIGHT_RANGE.contains(&id.height) { - return Err(chain::ErrorKind::InvalidSegmentHeight.into()); + return Err(chain::Error::InvalidSegmentHeight); } let segmenter = self.chain().segmenter()?; if segmenter.header().hash() != hash { - return Err(chain::ErrorKind::SegmenterHeaderMismatch.into()); + return Err(chain::Error::SegmenterHeaderMismatch); } segmenter.output_segment(id) } @@ -556,11 +552,11 @@ where id: SegmentIdentifier, ) -> Result, chain::Error> { if !RANGEPROOF_SEGMENT_HEIGHT_RANGE.contains(&id.height) { - return Err(chain::ErrorKind::InvalidSegmentHeight.into()); + return Err(chain::Error::InvalidSegmentHeight); } let segmenter = self.chain().segmenter()?; if segmenter.header().hash() != hash { - return Err(chain::ErrorKind::SegmenterHeaderMismatch.into()); + return Err(chain::Error::SegmenterHeaderMismatch); } segmenter.rangeproof_segment(id) } @@ -790,8 +786,8 @@ where Ok(false) } Err(e) => { - match e.kind() { - chain::ErrorKind::Orphan => { + match e { + chain::Error::Orphan => { if let Ok(previous) = previous { // make sure we did not miss the parent block if !self.chain().is_orphan(&previous.hash()) @@ -804,11 +800,7 @@ where Ok(true) } _ => { - debug!( - "process_block: block {} refused by chain: {}", - bhash, - e.kind() - ); + debug!("process_block: block {} refused by chain: {}", bhash, e); Ok(true) } } diff --git a/servers/src/grin/sync/state_sync.rs b/servers/src/grin/sync/state_sync.rs index 7e3621462..f0da0d475 100644 --- a/servers/src/grin/sync/state_sync.rs +++ b/servers/src/grin/sync/state_sync.rs @@ -225,10 +225,11 @@ impl StateSync { if let SyncStatus::TxHashsetDownload { .. } = self.sync_state.status() { if download_timeout { error!("state_sync: TxHashsetDownload status timeout in 10 minutes!"); - self.sync_state.set_sync_error( - chain::ErrorKind::SyncError(format!("{:?}", p2p::Error::Timeout)) - .into(), - ); + self.sync_state + .set_sync_error(chain::Error::SyncError(format!( + "{:?}", + p2p::Error::Timeout + ))); } } @@ -240,7 +241,7 @@ impl StateSync { } Err(e) => self .sync_state - .set_sync_error(chain::ErrorKind::SyncError(format!("{:?}", e)).into()), + .set_sync_error(chain::Error::SyncError(format!("{:?}", e))), } self.sync_state @@ -330,7 +331,7 @@ impl StateSync { self.sync_state .update_pibd_progress(true, true, 0, 1, &archive_header); self.sync_state - .set_sync_error(chain::ErrorKind::AbortingPIBDError.into()); + .set_sync_error(chain::Error::AbortingPIBDError); self.set_pibd_aborted(); return false; } diff --git a/servers/src/mining/mine_block.rs b/servers/src/mining/mine_block.rs index 9f43fbc49..198846708 100644 --- a/servers/src/mining/mine_block.rs +++ b/servers/src/mining/mine_block.rs @@ -79,8 +79,8 @@ pub fn get_block( while let Err(e) = result { let mut new_key_id = key_id.to_owned(); match e { - self::Error::Chain(c) => match c.kind() { - chain::ErrorKind::DuplicateCommitment(_) => { + self::Error::Chain(c) => match c { + chain::Error::DuplicateCommitment(_) => { debug!( "Duplicate commit for potential coinbase detected. Trying next derivation." ); @@ -182,20 +182,18 @@ fn build_block( match chain.set_txhashset_roots(&mut b) { Ok(_) => Ok((b, block_fees)), Err(e) => { - match e.kind() { + match e { // If this is a duplicate commitment then likely trying to use // a key that hass already been derived but not in the wallet // for some reason, allow caller to retry. - chain::ErrorKind::DuplicateCommitment(e) => Err(Error::Chain( - chain::ErrorKind::DuplicateCommitment(e).into(), - )), + chain::Error::DuplicateCommitment(e) => { + Err(Error::Chain(chain::Error::DuplicateCommitment(e))) + } // Some other issue, possibly duplicate kernel _ => { error!("Error setting txhashset root to build a block: {:?}", e); - Err(Error::Chain( - chain::ErrorKind::Other(format!("{:?}", e)).into(), - )) + Err(Error::Chain(chain::Error::Other(format!("{:?}", e)))) } } } diff --git a/servers/src/mining/stratumserver.rs b/servers/src/mining/stratumserver.rs index 7236c3f6b..eb9530791 100644 --- a/servers/src/mining/stratumserver.rs +++ b/servers/src/mining/stratumserver.rs @@ -424,7 +424,7 @@ impl Handler { if let Err(e) = res { // Return error status error!( - "(Server ID: {}) Failed to validate solution at height {}, hash {}, edge_bits {}, nonce {}, job_id {}, {}: {}", + "(Server ID: {}) Failed to validate solution at height {}, hash {}, edge_bits {}, nonce {}, job_id {}, {}", self.id, params.height, b.hash(), @@ -432,7 +432,6 @@ impl Handler { params.nonce, params.job_id, e, - e.backtrace().unwrap(), ); self.workers .update_stats(worker_id, |worker_stats| worker_stats.num_rejected += 1); diff --git a/store/Cargo.toml b/store/Cargo.toml index 36f438429..77b69405d 100644 --- a/store/Cargo.toml +++ b/store/Cargo.toml @@ -13,13 +13,12 @@ edition = "2018" byteorder = "1" croaring = "0.4.6" libc = "0.2" -failure = "0.1" -failure_derive = "0.1" lmdb-zero = "0.4.4" memmap = "0.7" tempfile = "3.1" serde = "1" serde_derive = "1" +thiserror = "1" log = "0.4" grin_core = { path = "../core", version = "5.2.0-alpha.1" } diff --git a/store/src/lib.rs b/store/src/lib.rs index 60c827cae..9317cd76e 100644 --- a/store/src/lib.rs +++ b/store/src/lib.rs @@ -23,8 +23,6 @@ #[macro_use] extern crate log; #[macro_use] -extern crate failure_derive; -#[macro_use] extern crate grin_core as core; extern crate grin_util as util; diff --git a/store/src/lmdb.rs b/store/src/lmdb.rs index 938ffe896..38d6b69cb 100644 --- a/store/src/lmdb.rs +++ b/store/src/lmdb.rs @@ -35,22 +35,22 @@ const RESIZE_PERCENT: f32 = 0.9; const RESIZE_MIN_TARGET_PERCENT: f32 = 0.65; /// Main error type for this lmdb -#[derive(Clone, Eq, PartialEq, Debug, Fail)] +#[derive(Clone, Eq, PartialEq, Debug, thiserror::Error)] pub enum Error { /// Couldn't find what we were looking for - #[fail(display = "DB Not Found Error: {}", _0)] + #[error("DB Not Found Error: {0}")] NotFoundErr(String), /// Wraps an error originating from LMDB - #[fail(display = "LMDB error: {} ", _0)] + #[error("LMDB error: {0}")] LmdbErr(lmdb::error::Error), /// Wraps a serialization error for Writeable or Readable - #[fail(display = "Serialization Error: {}", _0)] + #[error("Serialization Error: {0}")] SerErr(ser::Error), /// File handling error - #[fail(display = "File handling Error: {}", _0)] + #[error("File handling Error: {0}")] FileErr(String), /// Other error - #[fail(display = "Other Error: {}", _0)] + #[error("Other Error: {0}")] OtherErr(String), }