diff --git a/Cargo.lock b/Cargo.lock index b13849cfff..932c5f0c70 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -93,13 +93,33 @@ dependencies = [ "alloc-no-stdlib", ] +[[package]] +name = "andrew" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b7f09f89872c2b6b29e319377b1fbe91c6f5947df19a25596e121cf19a7b35e" +dependencies = [ + "bitflags 1.3.2", + "line_drawing", + "rusttype 0.7.9", + "walkdir", + "xdg", + "xml-rs", +] + +[[package]] +name = "android_glue" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "000444226fcff248f2bc4c7625be32c63caccfecc2723a2b9f78a7487a49c407" + [[package]] name = "ansi_term" version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" dependencies = [ - "winapi", + "winapi 0.3.9", ] [[package]] @@ -157,6 +177,24 @@ version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" +[[package]] +name = "approx" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0e60b75072ecd4168020818c0107f2857bb6c4e64252d8d3983f6263b40a5c3" +dependencies = [ + "num-traits", +] + +[[package]] +name = "approx" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6" +dependencies = [ + "num-traits", +] + [[package]] name = "aquamarine" version = "0.1.12" @@ -234,7 +272,7 @@ checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ "hermit-abi 0.1.19", "libc", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -336,9 +374,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.3.2" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dbe3c979c178231552ecba20214a8272df4e09f232a87aef4320cf06539aded" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" [[package]] name = "blake2" @@ -359,6 +397,12 @@ dependencies = [ "casper-types", ] +[[package]] +name = "block" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" + [[package]] name = "block-buffer" version = "0.10.4" @@ -416,6 +460,12 @@ version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +[[package]] +name = "bytemuck" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6" + [[package]] name = "byteorder" version = "1.4.3" @@ -436,6 +486,17 @@ dependencies = [ "casper-types", ] +[[package]] +name = "calloop" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7aa2097be53a00de9e8fc349fea6d76221f398f5c4fa550d420669906962d160" +dependencies = [ + "mio 0.6.23", + "mio-extras", + "nix", +] + [[package]] name = "casper-contract" version = "4.0.0" @@ -826,6 +887,15 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "cgl" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ced0551234e87afee12411d535648dd89d2e7f34c78b753395567aff3d447ff" +dependencies = [ + "libc", +] + [[package]] name = "clap" version = "2.34.0" @@ -924,6 +994,15 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a2dd5a6fe8c6e3502f568a6353e5273bbb15193ad9a89e457b9970798efbea1" +[[package]] +name = "cloudabi" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +dependencies = [ + "bitflags 1.3.2", +] + [[package]] name = "clru" version = "0.6.1" @@ -939,6 +1018,21 @@ dependencies = [ "cc", ] +[[package]] +name = "cocoa" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29f7768b2d1be17b96158e3285951d366b40211320fb30826a76cb7a0da6400" +dependencies = [ + "bitflags 1.3.2", + "block", + "core-foundation 0.6.4", + "core-graphics 0.17.3", + "foreign-types", + "libc", + "objc", +] + [[package]] name = "colorchoice" version = "1.0.0" @@ -981,22 +1075,91 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" +[[package]] +name = "core-foundation" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25b9e03f145fd4f2bf705e07b900cd41fc636598fe5dc452fd0db1441c3f496d" +dependencies = [ + "core-foundation-sys 0.6.2", + "libc", +] + +[[package]] +name = "core-foundation" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57d24c7a13c43e870e37c1556b74555437870a04514f7685f5b354e090567171" +dependencies = [ + "core-foundation-sys 0.7.0", + "libc", +] + [[package]] name = "core-foundation" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" dependencies = [ - "core-foundation-sys", + "core-foundation-sys 0.8.4", "libc", ] +[[package]] +name = "core-foundation-sys" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b" + +[[package]] +name = "core-foundation-sys" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac" + [[package]] name = "core-foundation-sys" version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" +[[package]] +name = "core-graphics" +version = "0.17.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56790968ab1c8a1202a102e6de05fc6e1ec87da99e4e93e9a7d13efbfc1e95a9" +dependencies = [ + "bitflags 1.3.2", + "core-foundation 0.6.4", + "foreign-types", + "libc", +] + +[[package]] +name = "core-graphics" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3889374e6ea6ab25dba90bb5d96202f61108058361f6dc72e8b03e6f8bbe923" +dependencies = [ + "bitflags 1.3.2", + "core-foundation 0.7.0", + "foreign-types", + "libc", +] + +[[package]] +name = "core-video-sys" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34ecad23610ad9757664d644e369246edde1803fcb43ed72876565098a5d3828" +dependencies = [ + "cfg-if 0.1.10", + "core-foundation-sys 0.7.0", + "core-graphics 0.19.2", + "libc", + "objc", +] + [[package]] name = "counter-installer" version = "0.1.0" @@ -1297,6 +1460,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "cty" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35" + [[package]] name = "curve25519-dalek" version = "4.0.0" @@ -1471,6 +1640,21 @@ dependencies = [ "casper-types", ] +[[package]] +name = "dispatch" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" + +[[package]] +name = "dlib" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b11f15d1e3268f140f68d390637d5e76d849782d971ae7063e0da69fe9709a76" +dependencies = [ + "libloading 0.6.7", +] + [[package]] name = "do-nothing" version = "0.1.0" @@ -1901,6 +2085,12 @@ dependencies = [ "instant", ] +[[package]] +name = "fastrand" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" + [[package]] name = "faucet" version = "0.1.0" @@ -1940,7 +2130,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12d741e2415d4e2e5bd1c1d00409d1a8865a57892c2d689b504365655d237d43" dependencies = [ - "winapi", + "winapi 0.3.9", ] [[package]] @@ -2003,6 +2193,17 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "freetype-sys" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a37d4011c0cc628dfa766fcc195454f4b068d7afdc2adfd28861191d866e731a" +dependencies = [ + "cmake", + "libc", + "pkg-config", +] + [[package]] name = "fs2" version = "0.4.3" @@ -2010,7 +2211,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" dependencies = [ "libc", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -2019,6 +2220,22 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" +[[package]] +name = "fuchsia-zircon" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" +dependencies = [ + "bitflags 1.3.2", + "fuchsia-zircon-sys", +] + +[[package]] +name = "fuchsia-zircon-sys" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" + [[package]] name = "futures" version = "0.3.28" @@ -2375,9 +2592,9 @@ dependencies = [ [[package]] name = "gix-command" -version = "0.2.5" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f6141b70cfb21255223e42f3379855037cbbe8673b58dd8318d2f09b516fad1" +checksum = "3c576cfbf577f72c097b5f88aedea502cd62952bdc1fb3adcab4531d5525a4c7" dependencies = [ "bstr", ] @@ -2406,11 +2623,11 @@ dependencies = [ [[package]] name = "gix-config-value" -version = "0.12.1" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f216df1c33e6e1555923eff0096858a879e8aaadd35b5d788641e4e8064c892" +checksum = "6e874f41437441c02991dcea76990b9058fadfc54b02ab4dd06ab2218af43897" dependencies = [ - "bitflags 2.3.2", + "bitflags 2.4.1", "bstr", "gix-path", "libc", @@ -2504,7 +2721,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c07c98204529ac3f24b34754540a852593d2a4c7349008df389240266627a72a" dependencies = [ - "bitflags 2.3.2", + "bitflags 2.4.1", "bstr", "gix-features", "gix-path", @@ -2512,9 +2729,9 @@ dependencies = [ [[package]] name = "gix-hash" -version = "0.11.2" +version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee181c85d3955f54c4426e6bfaeeada4428692e1a39b8788c2ac7785fc301dd8" +checksum = "4b422ff2ad9a0628baaad6da468cf05385bf3f5ab495ad5a33cce99b9f41092f" dependencies = [ "hex", "thiserror", @@ -2522,12 +2739,12 @@ dependencies = [ [[package]] name = "gix-hashtable" -version = "0.2.1" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd259bd0d96e6153e357a8cdaca76c48e103fd34208b6c0ce77b1ad995834bd2" +checksum = "385f4ce6ecf3692d313ca3aa9bd3b3d8490de53368d6d94bedff3af8b6d9c58d" dependencies = [ "gix-hash", - "hashbrown 0.13.2", + "hashbrown 0.14.3", "parking_lot 0.12.1", ] @@ -2549,7 +2766,7 @@ version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f39c1ccc8f1912cbbd5191efc28dbc5f0d0598042aa56bc09427b7c34efab3ba" dependencies = [ - "bitflags 2.3.2", + "bitflags 2.4.1", "bstr", "btoi", "filetime", @@ -2648,11 +2865,12 @@ dependencies = [ [[package]] name = "gix-path" -version = "0.8.1" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1226f2e50adeb4d76c754c1856c06f13a24cad1624801653fbf09b869e5b808" +checksum = "18609c8cbec8508ea97c64938c33cd305b75dfc04a78d0c3b78b8b3fd618a77c" dependencies = [ "bstr", + "gix-trace", "home", "once_cell", "thiserror", @@ -2660,22 +2878,22 @@ dependencies = [ [[package]] name = "gix-prompt" -version = "0.5.1" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e15fe57fa48572b7d3bf465d6a2a0351cd3c55cba74fd5f0b9c23689f9c1a31e" +checksum = "2c22decaf4a063ccae2b2108820c8630c01bd6756656df3fe464b32b8958a5ea" dependencies = [ "gix-command", "gix-config-value", "parking_lot 0.12.1", - "rustix", + "rustix 0.38.21", "thiserror", ] [[package]] name = "gix-quote" -version = "0.4.4" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29d59489bff95b06dcdabe763b7266d3dc0a628cac1ac1caf65a7ca0a43eeae0" +checksum = "475c86a97dd0127ba4465fbb239abac9ea10e68301470c9791a6dd5351cdc905" dependencies = [ "bstr", "btoi", @@ -2732,11 +2950,11 @@ dependencies = [ [[package]] name = "gix-sec" -version = "0.8.1" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2b7b38b766eb95dcc5350a9c450030b69892c0902fa35f4a6d0809273bd9dae" +checksum = "9615cbd6b456898aeb942cd75e5810c382fbfc48dbbff2fa23ebd2d33dcbe9c7" dependencies = [ - "bitflags 2.3.2", + "bitflags 2.4.1", "gix-path", "libc", "windows", @@ -2757,6 +2975,12 @@ dependencies = [ "tempfile", ] +[[package]] +name = "gix-trace" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96b6d623a1152c3facb79067d6e2ecdae48130030cf27d6eb21109f13bd7b836" + [[package]] name = "gix-traverse" version = "0.25.0" @@ -2785,18 +3009,18 @@ dependencies = [ [[package]] name = "gix-utils" -version = "0.1.2" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbcfcb150c7ef553d76988467d223254045bdcad0dc6724890f32fbe96415da5" +checksum = "b85d89dc728613e26e0ed952a19583744e7f5240fcd4aa30d6c824ffd8b52f0f" dependencies = [ - "fastrand", + "fastrand 2.0.1", ] [[package]] name = "gix-validate" -version = "0.7.5" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57ea5845b506c7728b9d89f4227cc369a5fc5a1d5b26c3add0f0d323413a3a60" +checksum = "ba9b3737b2cef3dcd014633485f0034b0f1a931ee54aeb7d8f87f177f3c89040" dependencies = [ "bstr", "thiserror", @@ -2823,6 +3047,43 @@ dependencies = [ "thiserror", ] +[[package]] +name = "gl_generator" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a95dfc23a2b4a9a2f5ab41d194f8bfda3cabec42af4e39f08c339eb2a0c124d" +dependencies = [ + "khronos_api", + "log", + "xml-rs", +] + +[[package]] +name = "glium" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a46e88b2c64cfa63d54ed54dc2a0d25136470eb1721e10be49d857ab583f8663" +dependencies = [ + "backtrace", + "fnv", + "gl_generator", + "glutin", + "lazy_static", + "memoffset 0.5.6", + "smallvec", + "takeable-option", +] + +[[package]] +name = "glium_text_rusttype" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9445ad33b59789364fb2dac28e7e79e89d25203fc80bd77f553c2e75d7ede905" +dependencies = [ + "glium", + "rusttype 0.8.3", +] + [[package]] name = "glob" version = "0.2.11" @@ -2852,6 +3113,78 @@ dependencies = [ "toml", ] +[[package]] +name = "glutin" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf22d4e90c55d9be9f2ad52410e7a2c0d7e9c99d93a13df73a672e7ef4e8c7f7" +dependencies = [ + "android_glue", + "cgl", + "cocoa", + "core-foundation 0.6.4", + "core-graphics 0.17.3", + "glutin_egl_sys", + "glutin_emscripten_sys", + "glutin_gles2_sys", + "glutin_glx_sys", + "glutin_wgl_sys", + "lazy_static", + "libloading 0.5.2", + "log", + "objc", + "osmesa-sys", + "parking_lot 0.10.2", + "wayland-client", + "winapi 0.3.9", + "winit", +] + +[[package]] +name = "glutin_egl_sys" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68900f84b471f31ea1d1355567eb865a2cf446294f06cef8d653ed7bcf5f013d" +dependencies = [ + "gl_generator", + "winapi 0.3.9", +] + +[[package]] +name = "glutin_emscripten_sys" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80de4146df76e8a6c32b03007bc764ff3249dcaeb4f675d68a06caf1bac363f1" + +[[package]] +name = "glutin_gles2_sys" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8094e708b730a7c8a1954f4f8a31880af00eb8a1c5b5bf85d28a0a3c6d69103" +dependencies = [ + "gl_generator", + "objc", +] + +[[package]] +name = "glutin_glx_sys" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d93d0575865098580c5b3a423188cd959419912ea60b1e48e8b3b526f6d02468" +dependencies = [ + "gl_generator", + "x11-dl", +] + +[[package]] +name = "glutin_wgl_sys" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3da5951a1569dbab865c6f2a863efafff193a93caf05538d193e9e3816d21696" +dependencies = [ + "gl_generator", +] + [[package]] name = "group" version = "0.13.0" @@ -2902,12 +3235,6 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" -[[package]] -name = "hashbrown" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" - [[package]] name = "hashbrown" version = "0.14.3" @@ -3034,6 +3361,24 @@ dependencies = [ "serde", ] +[[package]] +name = "highway-state-grapher" +version = "0.1.0" +dependencies = [ + "bincode", + "casper-hashing", + "casper-node", + "casper-types", + "clap 4.2.7", + "flate2", + "freetype-sys", + "glium", + "glium_text_rusttype", + "libc", + "nalgebra", + "serde", +] + [[package]] name = "hmac" version = "0.12.1" @@ -3077,7 +3422,7 @@ checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" dependencies = [ "libc", "match_cfg", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -3228,7 +3573,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9cadcf447f06744f8ce713d2d6239bb5bde2c357a452397a9ed90c625da390bc" dependencies = [ "libc", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -3242,6 +3587,15 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "iovec" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" +dependencies = [ + "libc", +] + [[package]] name = "ipnet" version = "2.7.2" @@ -3265,7 +3619,7 @@ checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" dependencies = [ "hermit-abi 0.3.3", "io-lifetimes", - "rustix", + "rustix 0.37.18", "windows-sys 0.48.0", ] @@ -3315,13 +3669,29 @@ dependencies = [ ] [[package]] -name = "key-management-thresholds" -version = "0.1.0" +name = "kernel32-sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +dependencies = [ + "winapi 0.2.8", + "winapi-build", +] + +[[package]] +name = "key-management-thresholds" +version = "0.1.0" dependencies = [ "casper-contract", "casper-types", ] +[[package]] +name = "khronos_api" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" + [[package]] name = "kstring" version = "2.0.0" @@ -3337,6 +3707,12 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +[[package]] +name = "lazycell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" + [[package]] name = "leb128" version = "0.2.5" @@ -3345,9 +3721,29 @@ checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" [[package]] name = "libc" -version = "0.2.142" +version = "0.2.149" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a987beff54b60ffa6d51982e1aa1146bc42f19bd26be28b0586f252fccf5317" +checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" + +[[package]] +name = "libloading" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753" +dependencies = [ + "cc", + "winapi 0.3.9", +] + +[[package]] +name = "libloading" +version = "0.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "351a32417a12d5f7e82c368a66781e307834dae04c6ce0cd4456d52989229883" +dependencies = [ + "cfg-if 1.0.0", + "winapi 0.3.9", +] [[package]] name = "libm" @@ -3355,6 +3751,15 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" +[[package]] +name = "line_drawing" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cc7ad3d82c845bdb5dde34ffdcc7a5fb4d2996e1e1ee0f19c33bc80e15196b9" +dependencies = [ + "num-traits", +] + [[package]] name = "linked-hash-map" version = "0.5.6" @@ -3367,6 +3772,12 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b64f40e5e03e0d54f03845c8197d0291253cdbedfb1cb46b13c2c117554a9f4c" +[[package]] +name = "linux-raw-sys" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" + [[package]] name = "list-authorization-keys" version = "0.1.0" @@ -3406,6 +3817,15 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "lock_api" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" +dependencies = [ + "scopeguard", +] + [[package]] name = "lock_api" version = "0.4.9" @@ -3444,6 +3864,15 @@ dependencies = [ "casper-types", ] +[[package]] +name = "malloc_buf" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" +dependencies = [ + "libc", +] + [[package]] name = "manage-groups" version = "0.1.0" @@ -3467,6 +3896,16 @@ dependencies = [ "regex-automata", ] +[[package]] +name = "matrixmultiply" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "090126dc04f95dc0d1c1c91f61bdd474b3930ca064c1edc8a849da2c6cbe1e77" +dependencies = [ + "autocfg", + "rawpointer", +] + [[package]] name = "maybe-uninit" version = "2.0.0" @@ -3487,6 +3926,16 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +[[package]] +name = "memmap" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b" +dependencies = [ + "libc", + "winapi 0.3.9", +] + [[package]] name = "memmap2" version = "0.5.10" @@ -3576,6 +4025,25 @@ dependencies = [ "casper-types", ] +[[package]] +name = "mio" +version = "0.6.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4" +dependencies = [ + "cfg-if 0.1.10", + "fuchsia-zircon", + "fuchsia-zircon-sys", + "iovec", + "kernel32-sys", + "libc", + "log", + "miow", + "net2", + "slab", + "winapi 0.2.8", +] + [[package]] name = "mio" version = "0.8.6" @@ -3588,6 +4056,30 @@ dependencies = [ "windows-sys 0.45.0", ] +[[package]] +name = "mio-extras" +version = "2.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52403fe290012ce777c4626790c8951324a2b9e3316b3143779c72b029742f19" +dependencies = [ + "lazycell", + "log", + "mio 0.6.23", + "slab", +] + +[[package]] +name = "miow" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d" +dependencies = [ + "kernel32-sys", + "net2", + "winapi 0.2.8", + "ws2_32-sys", +] + [[package]] name = "multer" version = "2.1.0" @@ -3614,6 +4106,33 @@ dependencies = [ "casper-types", ] +[[package]] +name = "nalgebra" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "307ed9b18cc2423f29e83f84fd23a8e73628727990181f18641a8b5dc2ab1caa" +dependencies = [ + "approx 0.5.1", + "matrixmultiply", + "nalgebra-macros", + "num-complex", + "num-rational", + "num-traits", + "simba", + "typenum", +] + +[[package]] +name = "nalgebra-macros" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91761aed67d03ad966ef783ae962ef9bbaca728d2dd7ceb7939ec110fffad998" +dependencies = [ + "proc-macro2 1.0.56", + "quote 1.0.26", + "syn 1.0.109", +] + [[package]] name = "named-dictionary-test" version = "0.1.0" @@ -3680,6 +4199,17 @@ dependencies = [ "casper-types", ] +[[package]] +name = "net2" +version = "0.2.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b13b648036a2339d06de780866fbdfda0dde886de7b3af2ddeba8b14f4ee34ac" +dependencies = [ + "cfg-if 0.1.10", + "libc", + "winapi 0.3.9", +] + [[package]] name = "new-named-uref" version = "0.1.0" @@ -3687,6 +4217,19 @@ dependencies = [ "casper-contract", ] +[[package]] +name = "nix" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c722bee1037d430d0f8e687bbdbf222f27cc6e4e68d5caf630857bb2b6dbdce" +dependencies = [ + "bitflags 1.3.2", + "cc", + "cfg-if 0.1.10", + "libc", + "void", +] + [[package]] name = "nom" version = "7.1.3" @@ -3712,7 +4255,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" dependencies = [ "overload", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -3823,6 +4366,15 @@ dependencies = [ "libc", ] +[[package]] +name = "objc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" +dependencies = [ + "malloc_buf", +] + [[package]] name = "object" version = "0.30.3" @@ -3904,6 +4456,15 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "ordered-float" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3305af35278dd29f46fcdd139e0b1fbfae2153f0e5928b39b035542dd31e37b7" +dependencies = [ + "num-traits", +] + [[package]] name = "ordered-transforms" version = "0.1.0" @@ -3918,13 +4479,22 @@ version = "6.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ceedf44fb00f2d1984b0bc98102627ce622e083e49a5bacdb3e514fa4238e267" +[[package]] +name = "osmesa-sys" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88cfece6e95d2e717e0872a7f53a8684712ad13822a7979bc760b9c77ec0013b" +dependencies = [ + "shared_library", +] + [[package]] name = "output_vt100" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "628223faebab4e3e40667ee0b2336d34a5b960ff60ea743ddfdbcf7770bcfb66" dependencies = [ - "winapi", + "winapi 0.3.9", ] [[package]] @@ -3941,6 +4511,16 @@ dependencies = [ "casper-types", ] +[[package]] +name = "parking_lot" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e" +dependencies = [ + "lock_api 0.3.4", + "parking_lot_core 0.7.3", +] + [[package]] name = "parking_lot" version = "0.11.2" @@ -3948,7 +4528,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" dependencies = [ "instant", - "lock_api", + "lock_api 0.4.9", "parking_lot_core 0.8.6", ] @@ -3958,10 +4538,24 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ - "lock_api", + "lock_api 0.4.9", "parking_lot_core 0.9.8", ] +[[package]] +name = "parking_lot_core" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b93f386bb233083c799e6e642a9d73db98c24a5deeb95ffc85bf281255dffc98" +dependencies = [ + "cfg-if 0.1.10", + "cloudabi", + "libc", + "redox_syscall 0.1.57", + "smallvec", + "winapi 0.3.9", +] + [[package]] name = "parking_lot_core" version = "0.8.6" @@ -3973,7 +4567,7 @@ dependencies = [ "libc", "redox_syscall 0.2.16", "smallvec", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -4124,7 +4718,7 @@ dependencies = [ "libc", "pnet_base", "pnet_sys", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -4167,7 +4761,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9a3f32b0df45515befd19eed04616f6b56a488da92afc61164ef455e955f07f" dependencies = [ "libc", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -4359,7 +4953,7 @@ dependencies = [ "mach", "once_cell", "raw-cpuid", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -4465,6 +5059,31 @@ dependencies = [ "bitflags 1.3.2", ] +[[package]] +name = "raw-window-handle" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e28f55143d0548dad60bb4fbdc835a3d7ac6acc3324506450c5fdd6e42903a76" +dependencies = [ + "libc", + "raw-window-handle 0.4.3", +] + +[[package]] +name = "raw-window-handle" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b800beb9b6e7d2df1fe337c9e3d04e3af22a124460fb4c30fcc22c9117cefb41" +dependencies = [ + "cty", +] + +[[package]] +name = "rawpointer" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" + [[package]] name = "rayon" version = "1.7.0" @@ -4503,6 +5122,12 @@ dependencies = [ "casper-types", ] +[[package]] +name = "redox_syscall" +version = "0.1.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" + [[package]] name = "redox_syscall" version = "0.2.16" @@ -4801,7 +5426,20 @@ dependencies = [ "errno", "io-lifetimes", "libc", - "linux-raw-sys", + "linux-raw-sys 0.3.6", + "windows-sys 0.48.0", +] + +[[package]] +name = "rustix" +version = "0.38.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3" +dependencies = [ + "bitflags 2.4.1", + "errno", + "libc", + "linux-raw-sys 0.4.10", "windows-sys 0.48.0", ] @@ -4814,6 +5452,26 @@ dependencies = [ "base64 0.21.0", ] +[[package]] +name = "rusttype" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "310942406a39981bed7e12b09182a221a29e0990f3e7e0c971f131922ed135d5" +dependencies = [ + "rusttype 0.8.3", +] + +[[package]] +name = "rusttype" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f61411055101f7b60ecf1041d87fb74205fb20b0c7a723f07ef39174cf6b4c0" +dependencies = [ + "approx 0.3.2", + "ordered-float", + "stb_truetype", +] + [[package]] name = "rustversion" version = "1.0.12" @@ -4838,6 +5496,15 @@ version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" +[[package]] +name = "safe_arch" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f398075ce1e6a179b46f51bd88d0598b92b00d3551f1a2d4ac49e771b56ac354" +dependencies = [ + "bytemuck", +] + [[package]] name = "same-file" version = "1.0.6" @@ -4913,8 +5580,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" dependencies = [ "bitflags 1.3.2", - "core-foundation", - "core-foundation-sys", + "core-foundation 0.9.3", + "core-foundation-sys 0.8.4", "libc", "security-framework-sys", ] @@ -4925,7 +5592,7 @@ version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" dependencies = [ - "core-foundation-sys", + "core-foundation-sys 0.8.4", "libc", ] @@ -5083,6 +5750,16 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "shared_library" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a9e7e0f2bfae24d8a5b5a66c5b257a83c7412304311512a0c054cd5e619da11" +dependencies = [ + "lazy_static", + "libc", +] + [[package]] name = "shlex" version = "1.3.0" @@ -5124,6 +5801,19 @@ dependencies = [ "rand_core", ] +[[package]] +name = "simba" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "061507c94fc6ab4ba1c9a0305018408e312e17c041eb63bef8aa726fa33aceae" +dependencies = [ + "approx 0.5.1", + "num-complex", + "num-traits", + "paste", + "wide", +] + [[package]] name = "simple-transfer" version = "0.1.0" @@ -5150,6 +5840,22 @@ dependencies = [ "serde", ] +[[package]] +name = "smithay-client-toolkit" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "421c8dc7acf5cb205b88160f8b4cc2c5cfabe210e43b2f80f009f4c1ef910f1d" +dependencies = [ + "andrew", + "bitflags 1.3.2", + "dlib", + "lazy_static", + "memmap", + "nix", + "wayland-client", + "wayland-protocols", +] + [[package]] name = "socket2" version = "0.4.9" @@ -5157,7 +5863,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" dependencies = [ "libc", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -5202,6 +5908,15 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c0e04424e733e69714ca1bbb9204c1a57f09f5493439520f9f68c132ad25eec" +[[package]] +name = "stb_truetype" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f77b6b07e862c66a9f3e62a07588fee67cd90a9135a2b942409f195507b4fb51" +dependencies = [ + "byteorder", +] + [[package]] name = "storage-costs" version = "0.1.0" @@ -5325,6 +6040,12 @@ dependencies = [ "casper-types", ] +[[package]] +name = "takeable-option" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36ae8932fcfea38b7d3883ae2ab357b0d57a02caaa18ebb4f5ece08beaec4aa0" + [[package]] name = "tempfile" version = "3.5.0" @@ -5332,9 +6053,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998" dependencies = [ "cfg-if 1.0.0", - "fastrand", + "fastrand 1.9.0", "redox_syscall 0.3.5", - "rustix", + "rustix 0.37.18", "windows-sys 0.45.0", ] @@ -5353,7 +6074,7 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e6bf6f19e9f8ed8d4048dc22981458ebcf406d67e94cd422e5ecd73d63b3237" dependencies = [ - "rustix", + "rustix 0.37.18", "windows-sys 0.48.0", ] @@ -5473,7 +6194,7 @@ dependencies = [ "autocfg", "bytes", "libc", - "mio", + "mio 0.8.6", "num_cpus", "pin-project-lite", "socket2", @@ -6052,6 +6773,12 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "void" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" + [[package]] name = "wabt" version = "0.10.0" @@ -6294,6 +7021,66 @@ dependencies = [ "wast", ] +[[package]] +name = "wayland-client" +version = "0.23.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af1080ebe0efabcf12aef2132152f616038f2d7dcbbccf7b2d8c5270fe14bcda" +dependencies = [ + "bitflags 1.3.2", + "calloop", + "downcast-rs", + "libc", + "mio 0.6.23", + "nix", + "wayland-commons", + "wayland-scanner", + "wayland-sys", +] + +[[package]] +name = "wayland-commons" +version = "0.23.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb66b0d1a27c39bbce712b6372131c6e25149f03ffb0cd017cf8f7de8d66dbdb" +dependencies = [ + "nix", + "wayland-sys", +] + +[[package]] +name = "wayland-protocols" +version = "0.23.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6cc286643656742777d55dc8e70d144fa4699e426ca8e9d4ef454f4bf15ffcf9" +dependencies = [ + "bitflags 1.3.2", + "wayland-client", + "wayland-commons", + "wayland-scanner", +] + +[[package]] +name = "wayland-scanner" +version = "0.23.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93b02247366f395b9258054f964fe293ddd019c3237afba9be2ccbe9e1651c3d" +dependencies = [ + "proc-macro2 0.4.30", + "quote 0.6.13", + "xml-rs", +] + +[[package]] +name = "wayland-sys" +version = "0.23.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d94e89a86e6d6d7c7c9b19ebf48a03afaac4af6bc22ae570e9a24124b75358f4" +dependencies = [ + "dlib", + "lazy_static", +] + [[package]] name = "web-sys" version = "0.3.64" @@ -6313,7 +7100,7 @@ dependencies = [ "cfg-if 0.1.10", "libc", "memory_units", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -6322,6 +7109,22 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62945bc99a6a121cb2759c7bfa7b779ddf0e69b68bb35a9b23ab72276cfdcd3c" +[[package]] +name = "wide" +version = "0.7.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa469ffa65ef7e0ba0f164183697b89b854253fd31aeb92358b7b6155177d62f" +dependencies = [ + "bytemuck", + "safe_arch", +] + +[[package]] +name = "winapi" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" + [[package]] name = "winapi" version = "0.3.9" @@ -6332,6 +7135,12 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu", ] +[[package]] +name = "winapi-build" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" + [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" @@ -6344,7 +7153,7 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" dependencies = [ - "winapi", + "winapi 0.3.9", ] [[package]] @@ -6494,13 +7303,42 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" +[[package]] +name = "winit" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65a5c1a5ef76ac31cc97ad29489acdbed2178f3fc12ca00ee6cb11d60adb5a3a" +dependencies = [ + "android_glue", + "bitflags 1.3.2", + "cocoa", + "core-foundation 0.6.4", + "core-graphics 0.17.3", + "core-video-sys", + "dispatch", + "instant", + "lazy_static", + "libc", + "log", + "mio 0.6.23", + "mio-extras", + "objc", + "parking_lot 0.10.2", + "percent-encoding", + "raw-window-handle 0.3.4", + "smithay-client-toolkit", + "wayland-client", + "winapi 0.3.9", + "x11-dl", +] + [[package]] name = "winreg" version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" dependencies = [ - "winapi", + "winapi 0.3.9", ] [[package]] @@ -6511,6 +7349,39 @@ dependencies = [ "casper-types", ] +[[package]] +name = "ws2_32-sys" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" +dependencies = [ + "winapi 0.2.8", + "winapi-build", +] + +[[package]] +name = "x11-dl" +version = "2.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38735924fedd5314a6e548792904ed8c6de6636285cb9fec04d5b1db85c1516f" +dependencies = [ + "libc", + "once_cell", + "pkg-config", +] + +[[package]] +name = "xdg" +version = "2.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "213b7324336b53d2414b2db8537e56544d981803139155afa84f76eeebb7a546" + +[[package]] +name = "xml-rs" +version = "0.8.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fcb9cbac069e033553e8bb871be2fbdffcab578eb25bd0f7c508cedc6dcd75a" + [[package]] name = "zeroize" version = "1.6.0" diff --git a/Cargo.toml b/Cargo.toml index fbd748d22d..2dac867eba 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,6 +13,7 @@ members = [ "utils/global-state-update-gen", "utils/validation", "utils/highway-rewards-analysis", + "utils/highway-state-grapher", ] default-members = [ @@ -27,6 +28,7 @@ default-members = [ "utils/global-state-update-gen", "utils/validation", "utils/highway-rewards-analysis", + "utils/highway-state-grapher", ] exclude = ["utils/nctl/remotes/casper-client-rs"] diff --git a/utils/highway-state-grapher/Cargo.toml b/utils/highway-state-grapher/Cargo.toml new file mode 100644 index 0000000000..b396ae7ccb --- /dev/null +++ b/utils/highway-state-grapher/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "highway-state-grapher" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +bincode = "1" +clap = { version = "4", features = ["derive"] } +casper-hashing = { path = "../../hashing" } +casper-node = { path = "../../node" } +casper-types = { path = "../../types" } +flate2 = "1" +freetype-sys = "0.13" +glium = "0.26" +glium_text_rusttype = "0.3" +libc = "0.2" +nalgebra = "0.32" +serde = "1" diff --git a/utils/highway-state-grapher/DejaVuSans.ttf b/utils/highway-state-grapher/DejaVuSans.ttf new file mode 100644 index 0000000000..e5f7eecce4 Binary files /dev/null and b/utils/highway-state-grapher/DejaVuSans.ttf differ diff --git a/utils/highway-state-grapher/src/main.rs b/utils/highway-state-grapher/src/main.rs new file mode 100644 index 0000000000..617f8f2e2d --- /dev/null +++ b/utils/highway-state-grapher/src/main.rs @@ -0,0 +1,614 @@ +mod renderer; + +use std::{ + collections::{BTreeMap, BTreeSet, HashMap, HashSet, VecDeque}, + fmt::{self, Debug}, + fs::File, + io::Read, + ops::RangeBounds, +}; + +use casper_hashing::Digest; +use casper_node::consensus::{ + highway_core::{ + finality_detector::{assigned_weight_and_latest_unit, find_max_quora}, + Panorama, State, + }, + utils::{ValidatorIndex, ValidatorMap}, + ClContext, +}; +use casper_types::{EraId, PublicKey, Timestamp, U512}; + +use clap::Parser; +use flate2::read::GzDecoder; +use glium::{ + glutin::{ + event::{ElementState, Event, MouseButton, MouseScrollDelta, VirtualKeyCode, WindowEvent}, + event_loop::{ControlFlow, EventLoop}, + window::WindowBuilder, + ContextBuilder, + }, + Display, +}; +use serde::{Deserialize, Serialize}; + +use crate::renderer::Renderer; + +#[derive(Parser, Debug)] +#[command(author, version, about, long_about = None)] +struct Args { + filename: String, +} + +/// Debug dump of era used for serialization. +#[derive(Debug, Serialize, Deserialize)] +pub(crate) struct EraDump { + /// The era that is being dumped. + pub id: EraId, + + /// The scheduled starting time of this era. + pub start_time: Timestamp, + /// The height of this era's first block. + pub start_height: u64, + + // omitted: pending blocks + /// Validators that have been faulty in any of the recent BONDED_ERAS switch blocks. This + /// includes `new_faulty`. + pub faulty: HashSet, + /// Validators that are excluded from proposing new blocks. + pub cannot_propose: HashSet, + /// Accusations collected in this era so far. + pub accusations: HashSet, + /// The validator weights. + pub validators: BTreeMap, + + /// The state of the highway instance associated with the era. + pub highway_state: State, +} + +/// Helper struct for sorting the units with regards to the implicit partial ordering in the DAG. +struct Units { + set: HashSet, + order: Vec, +} + +impl Units { + /// Collects all the unit hashes and orders them roughly from the newest to the oldest. + fn do_collect_ancestor_units( + &mut self, + state: &State, + panorama: &Panorama, + ) { + let hashes_to_add: Vec<_> = panorama.iter_correct_hashes().collect(); + let mut hashes_to_proceed_with = vec![]; + for hash in hashes_to_add { + if self.set.insert(*hash) { + self.order.push(*hash); + hashes_to_proceed_with.push(*hash); + } + } + for hash in hashes_to_proceed_with { + let unit = state.unit(&hash); + self.do_collect_ancestor_units(state, &unit.panorama); + } + } + + /// Reorders the units in self.order so that every unit comes after all its dependencies. + fn reorder(&mut self, state: &State) { + let mut new_order_set = HashSet::new(); + let mut new_order = vec![]; + let mut queue: VecDeque<_> = std::mem::take(&mut self.order).into_iter().rev().collect(); + loop { + if queue.is_empty() { + break; + } + let unit = queue.pop_front().unwrap(); + if state + .unit(&unit) + .panorama + .iter_correct_hashes() + .all(|cited| new_order_set.contains(cited)) + { + new_order_set.insert(unit); + new_order.push(unit) + } else { + queue.push_back(unit); + } + } + self.order = new_order; + } + + /// Collects all the unit hashes and orders them so that every unit comes after all its + /// dependencies. + fn collect_ancestor_units(&mut self, state: &State) { + self.do_collect_ancestor_units(state, state.panorama()); + self.reorder(state); + } +} + +/// A more readable unit ID: the validator index together with the height in that validator's +/// swimlane +#[derive(Clone, Copy, PartialEq, Eq, Hash)] +pub struct UnitId(ValidatorIndex, usize); + +impl Debug for UnitId { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "V{}_{}", self.0 .0, self.1) + } +} + +/// A more readable block id. The first field is the block height, the second is the number of the +/// block among all the blocks at that height (if there are no orphan blocks, all the block IDs will +/// have 0s in the second field). +#[derive(Clone, Copy, PartialEq, Eq, Hash)] +pub struct BlockId(u64, u8); + +impl Debug for BlockId { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "B{}", self.0)?; + for _ in 0..self.1 { + write!(f, "'")?; + } + Ok(()) + } +} + +/// A helper struct for coloring units based on the validator's max quorum. +/// `max_rank` is the number of distinct values of max quorum. `rank` is the index relative to the +/// maximum value (ie. the largest max quorum has rank 0, the second largest has rank 1 etc.) +#[derive(Clone, Copy)] +pub struct Quorum { + pub rank: usize, + pub max_rank: usize, + pub weight_percent: f32, +} + +impl Debug for Quorum { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{:3.1}", self.weight_percent) + } +} + +/// A representation of the protocol state unit for the purpose of drawing it on the screen. +/// `graph_height` is the maximum of graph heights of the cited units, plus 1 - drawing based on +/// graph height guarantees that every unit will appear higher than all its dependencies. +#[derive(Clone)] +pub struct GraphUnit { + pub id: UnitId, + pub creator: ValidatorIndex, + pub vote: BlockId, + pub is_proposal: bool, + pub cited_units: Vec, + pub height: usize, + pub graph_height: usize, + pub timestamp: u64, + pub round_num: u64, + pub round_id: Timestamp, + pub round_exp: u8, + pub max_quorum: Option, +} + +impl Debug for GraphUnit { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_struct("GraphUnit") + .field("id", &self.id) + .field("creator", &format!("V{}", self.creator.0)) + .field("height", &self.height) + .field("graph_height", &self.graph_height) + .field("vote", &self.vote) + .field("is_proposal", &self.is_proposal) + .field("timestamp", &self.timestamp) + .field("round_num", &self.round_num) + .field("round_id", &self.round_id) + .field("round_exp", &self.round_exp) + .field("max_quorum", &self.max_quorum) + .field("cited_units", &self.cited_units) + .finish() + } +} + +/// A struct helping in assigning readable IDs to blocks. +#[derive(Clone, Debug)] +struct BlockMapper { + hash_to_id: HashMap, + id_to_hash: HashMap, + last_id_by_height: HashMap, +} + +impl BlockMapper { + fn new() -> Self { + Self { + hash_to_id: HashMap::new(), + id_to_hash: HashMap::new(), + last_id_by_height: HashMap::new(), + } + } + + /// Inserts the new ID, updating the mappings as necessary. + fn insert(&mut self, hash: Digest, id: BlockId) { + self.hash_to_id.insert(hash, id); + self.id_to_hash.insert(id, hash); + let entry = self.last_id_by_height.entry(id.0).or_insert(id.1); + *entry = (*entry).max(id.1); + } + + /// Returns the block ID for the next block at the given height. + /// Usually, there will only be one block at a given height, but in some cases forks are + /// possible - in those cases, blocks at the same height will get sequential IDs. + fn next_id_for_height(&self, height: u64) -> BlockId { + BlockId( + height, + self.last_id_by_height + .get(&height) + .map(|idx| *idx + 1) + .unwrap_or(0), + ) + } + + /// Gets the readable block ID corresponding to the given hash. + fn get(&self, hash: &Digest) -> Option { + self.hash_to_id.get(hash).copied() + } + + /// Gets the block hash corresponding to the given ID. + #[allow(unused)] // Will be useful if we add features related to the blocks + fn get_by_id(&self, id: &BlockId) -> Option { + self.id_to_hash.get(id).copied() + } +} + +/// All the data needed for drawing the unit DAG. +#[derive(Clone, Debug)] +pub struct Graph { + units: ValidatorMap>, + reverse_edges: HashMap>, + #[allow(unused)] // Will be useful if we add features related to the blocks + blocks: BlockMapper, + weight_percentages: ValidatorMap, +} + +impl Graph { + /// Creates a `Graph` based on the `state`. + fn new(state: &State, start_time: Timestamp) -> Self { + let mut units: BTreeMap> = state + .weights() + .iter() + .enumerate() + .map(|(idx, _)| (ValidatorIndex::from(idx as u32), vec![])) + .collect(); + let mut reverse_edges: HashMap> = HashMap::new(); + let mut unit_ids_by_hash: HashMap = HashMap::new(); + let mut blocks = BlockMapper::new(); + + let mut units_set = Units { + set: HashSet::new(), + order: vec![], + }; + + units_set.collect_ancestor_units(state); + + eprintln!("num units: {}", units_set.order.len()); + + let max_round_exp = (state.params().max_round_length().millis() + / state.params().min_round_length().millis()) + .trailing_zeros(); + let max_round_length = state.params().min_round_length().millis() << max_round_exp; + let rounded_era_start = + Timestamp::from((start_time.millis() / max_round_length) * max_round_length); + + let mut highest_block: Option<(u64, Digest)> = None; + + for unit_hash in &units_set.order { + let unit = state.unit(unit_hash); + let block = state.block(&unit.block); + if highest_block.map_or(true, |(height, _)| height < block.height) { + highest_block = Some((block.height, unit.block)); + } + let block_id = if let Some(b_id) = blocks.get(&unit.block) { + b_id + } else { + let b_id = blocks.next_id_for_height(block.height); + blocks.insert(unit.block, b_id); + b_id + }; + let is_proposal = unit + .panorama + .iter_correct_hashes() + .all(|hash| state.unit(hash).block != unit.block); + let cited_units: Vec = unit + .panorama + .iter_correct_hashes() + .map(|hash| *unit_ids_by_hash.get(hash).unwrap()) + .collect(); + let graph_height = cited_units + .iter() + .map(|unit_id| &units.get(&unit_id.0).unwrap()[unit_id.1]) + .map(|g_unit| g_unit.graph_height) + .max() + .map(|max_height| max_height + 1) + .unwrap_or(0); + let unit_id = UnitId(unit.creator, units.get(&unit.creator).unwrap().len()); + + for cited_unit_id in &cited_units { + reverse_edges + .entry(*cited_unit_id) + .or_default() + .push(unit_id); + } + + let time_since_era_start = unit.timestamp.saturating_diff(rounded_era_start).millis(); + let round_num = time_since_era_start / state.params().min_round_length().millis(); + + let graph_unit = GraphUnit { + id: unit_id, + creator: unit.creator, + vote: block_id, + is_proposal, + cited_units, + height: unit.seq_number as usize, + graph_height, + timestamp: time_since_era_start, + round_num, + round_id: unit.round_id(), + round_exp: (unit.round_len().millis() / state.params().min_round_length().millis()) + .trailing_zeros() as u8, + max_quorum: None, + }; + unit_ids_by_hash.insert(*unit_hash, unit_id); + units.get_mut(&unit.creator).unwrap().push(graph_unit); + } + + // fill in max quora + if let Some((_hb_height, hb_hash)) = highest_block { + let hb_unit = state.unit(&hb_hash); + for bhash in state.ancestor_hashes(&hb_hash) { + let proposal_unit = state.unit(bhash); + let r_id = proposal_unit.round_id(); + + let (assigned_weight, latest) = + assigned_weight_and_latest_unit(state, &hb_unit.panorama, r_id); + + let max_quora = find_max_quora(state, bhash, &latest); + // deduplicate and sort max quora + let max_quora_set: BTreeSet<_> = max_quora.iter().copied().collect(); + let max_quora_rank_map: BTreeMap<_, _> = max_quora_set + .into_iter() + .rev() + .enumerate() + .map(|(rank, quorum)| (quorum, rank)) + .collect(); + + for unit in latest.iter().flatten() { + let gunit_id = unit_ids_by_hash.get(*unit).unwrap(); + let gunit = &mut units.get_mut(&gunit_id.0).unwrap()[gunit_id.1]; + let quorum_w = max_quora[gunit.creator]; + let rank = max_quora_rank_map[&quorum_w]; + let weight_percent = quorum_w.0 as f32 / assigned_weight.0 as f32 * 100.0; + gunit.max_quorum = Some(Quorum { + rank, + max_rank: max_quora_rank_map.len(), + weight_percent, + }); + } + } + } + + let weight_percentages: ValidatorMap = state + .weights() + .iter() + .map(|weight| weight.0 as f32 / state.total_weight().0 as f32 * 100.0) + .collect(); + + Self { + units: units.into_values().collect(), + reverse_edges, + blocks, + weight_percentages, + } + } + + /// Returns the unit under the given `unit_id`. + pub fn get(&self, unit_id: &UnitId) -> Option<&GraphUnit> { + self.units + .get(unit_id.0) + .and_then(|swimlane| swimlane.get(unit_id.1)) + } + + /// Returns the validator weights. + pub fn validator_weights(&self) -> &ValidatorMap { + &self.weight_percentages + } + + /// Iterates over all the units created by validators within `range_vid` and with graph heights + /// within `range_graph_height`. + pub fn iter_range( + &self, + range_vid: R1, + range_graph_height: R2, + ) -> impl Iterator + where + R1: RangeBounds + Clone, + R2: RangeBounds + Clone, + { + let range_vid_clone = range_vid.clone(); + self.units + .iter() + .enumerate() + .skip_while(move |(vid, _)| !range_vid.contains(vid)) + .take_while(move |(vid, _)| range_vid_clone.contains(vid)) + .flat_map(move |(_, swimlane)| { + let range_graph_height_clone1 = range_graph_height.clone(); + let range_graph_height_clone2 = range_graph_height.clone(); + swimlane + .iter() + .skip_while(move |unit| !range_graph_height_clone1.contains(&unit.graph_height)) + .take_while(move |unit| range_graph_height_clone2.contains(&unit.graph_height)) + }) + } +} + +fn main() { + let args = Args::parse(); + + let mut data = vec![]; + let mut file = File::open(&args.filename).unwrap(); + + if args.filename.ends_with(".gz") { + let mut gz = GzDecoder::new(file); + gz.read_to_end(&mut data).unwrap(); + } else { + file.read_to_end(&mut data).unwrap(); + } + + let dump: EraDump = bincode::deserialize(&data).unwrap(); + + eprintln!("{}", dump.id); + + let graph = Graph::new(&dump.highway_state, dump.start_time); + + for (index, (pub_key, _)) in dump.validators.iter().enumerate() { + eprintln!("{}: {}", index, pub_key); + } + + start_rendering(graph); +} + +/// Struct keeping the current state of some keys (the events only report the current state, so we +/// need to store the old state to know when it changes). +#[derive(Clone, Copy)] +struct KeyboardState { + /// State of the 'E' key. + e_state: bool, +} + +impl KeyboardState { + fn e_pressed(&mut self) -> bool { + let was_pressed = self.e_state; + self.e_state = true; + !was_pressed + } + + fn e_released(&mut self) { + self.e_state = false; + } +} + +/// Enum keeping the state of mouse input. +#[derive(Clone, Copy)] +enum MouseState { + /// Mouse is freely moving. + Free { position: (f64, f64) }, + /// The user is dragging something. + Dragging { last_position: (f64, f64) }, +} + +impl MouseState { + /// Handles a mouse move event. + /// Returns `Some(delta_x, delta_y)` if dragging is in progress. + fn handle_move(&mut self, new_position: (f64, f64)) -> Option<(f32, f32)> { + match self { + Self::Free { position } => { + *position = new_position; + None + } + Self::Dragging { last_position } => { + let delta_x = (new_position.0 - last_position.0) as f32; + let delta_y = (new_position.1 - last_position.1) as f32; + *last_position = new_position; + Some((delta_x, delta_y)) + } + } + } + + /// Switches between `Free` and `Dragging` based on the button presses. + fn handle_button(&mut self, button_down: bool) { + match (*self, button_down) { + (Self::Free { position }, true) => { + *self = Self::Dragging { + last_position: position, + }; + } + (Self::Dragging { last_position }, false) => { + *self = Self::Free { + position: last_position, + }; + } + _ => (), + } + } + + /// Returns the current position of the cursor. + fn cursor(&self) -> (f32, f32) { + match self { + Self::Free { position } => (position.0 as f32, position.1 as f32), + Self::Dragging { last_position } => (last_position.0 as f32, last_position.1 as f32), + } + } +} + +/// The main loop of the program. +fn start_rendering(graph: Graph) { + let event_loop = EventLoop::new(); + + let wb = WindowBuilder::new() + .with_title("Consensus Graph Visualization") + .with_maximized(true) + .with_resizable(true); + let cb = ContextBuilder::new(); + let display = Display::new(wb, cb, &event_loop).unwrap(); + + let mut renderer = Renderer::new(&display); + let mut mouse_state = MouseState::Free { + position: (0.0, 0.0), + }; + let mut keyboard_state = KeyboardState { e_state: false }; + + event_loop.run(move |ev, _, control_flow| { + match ev { + Event::WindowEvent { event, .. } => match event { + WindowEvent::CloseRequested => { + *control_flow = ControlFlow::Exit; + return; + } + WindowEvent::MouseWheel { delta, .. } => match delta { + MouseScrollDelta::LineDelta(_, vertical) => { + renderer.mouse_scroll(vertical); + } + MouseScrollDelta::PixelDelta(pixels) => { + renderer.mouse_scroll(pixels.y as f32 / 30.0); + } + }, + WindowEvent::KeyboardInput { input, .. } => { + match (input.virtual_keycode, input.state) { + (Some(VirtualKeyCode::E), ElementState::Pressed) => { + if keyboard_state.e_pressed() { + renderer.toggle_edges(); + } + } + (Some(VirtualKeyCode::E), ElementState::Released) => { + keyboard_state.e_released(); + } + _ => (), + } + } + WindowEvent::MouseInput { state, button, .. } => { + if let (state, MouseButton::Left) = (state, button) { + mouse_state.handle_button(matches!(state, ElementState::Pressed)); + } + } + WindowEvent::CursorMoved { position, .. } => { + if let Some(delta) = mouse_state.handle_move((position.x, position.y)) { + renderer.pan(delta.0, delta.1); + } + } + _ => (), + }, + Event::MainEventsCleared => { + let (cursor_x, cursor_y) = mouse_state.cursor(); + renderer.draw(&display, &graph, cursor_x, cursor_y); + } + _ => (), + } + *control_flow = ControlFlow::Poll; + }); +} diff --git a/utils/highway-state-grapher/src/renderer.rs b/utils/highway-state-grapher/src/renderer.rs new file mode 100644 index 0000000000..efbc712e0d --- /dev/null +++ b/utils/highway-state-grapher/src/renderer.rs @@ -0,0 +1,450 @@ +mod matrix; + +use std::{collections::HashSet, f32::consts::PI}; + +use casper_node::consensus::utils::ValidatorMap; +use glium::{ + implement_vertex, index, uniform, Display, DrawParameters, Frame, Program, Surface, + VertexBuffer, +}; +use glium_text_rusttype::{self, FontTexture, TextDisplay, TextSystem}; +use nalgebra::Vector2; + +use crate::{renderer::matrix::Matrix, Graph, GraphUnit, UnitId}; + +const VERTEX_SHADER_SRC: &str = r#" + #version 140 + + in vec2 position; + + uniform mat4 matrix; + uniform vec3 color; + out vec3 in_color; + + void main() { + gl_Position = matrix * vec4(position, 0.0, 1.0); + in_color = color; + } +"#; + +const FRAGMENT_SHADER_SRC: &str = r#" + #version 140 + + in vec3 in_color; + out vec4 color; + + void main() { + color = vec4(in_color, 1.0); + } +"#; + +const FONT_FILE: &[u8] = include_bytes!("../DejaVuSans.ttf"); + +#[derive(Debug, Clone, Copy)] +struct Vertex { + position: [f32; 2], +} + +implement_vertex!(Vertex, position); + +/// Rendering-specific data. +pub struct Renderer { + /// The coordinates at the center of the screen. + center: Vector2, + /// The width of the window, in pixels. + window_width: f32, + /// The current width of the viewport. + width: f32, + /// The shading program. + program: Program, + /// Stuff for rendering text. + text_system: TextSystem, + font: FontTexture, + + /// Pre-generated vertices for a unit. + unit_vertex_buffer: VertexBuffer, + interior_indices: index::NoIndices, + frame_indices: index::IndexBuffer, + + /// `True` if we're drawing edges. + edges_enabled: bool, +} + +const UNIT_WIDTH: f32 = 0.5; +const UNIT_HEIGHT: f32 = 0.4; +const CORNER_RADIUS: f32 = 0.05; +const LINE_WIDTH: f32 = 0.015; + +impl Renderer { + pub fn new(display: &Display) -> Self { + let text_system = TextSystem::new(display); + let font = + FontTexture::new(display, FONT_FILE, 32, FontTexture::ascii_character_list()).unwrap(); + + let (unit_vertex_buffer, interior_indices, frame_indices) = + Self::unit_vertex_buffer(display); + + Renderer { + center: Vector2::new(3.5, 2.5), + window_width: 3000.0, // will get updated on first frame draw + width: 8.0, + program: Program::from_source(display, VERTEX_SHADER_SRC, FRAGMENT_SHADER_SRC, None) + .unwrap(), + text_system, + font, + + unit_vertex_buffer, + interior_indices, + frame_indices, + edges_enabled: true, + } + } + + /// Creates vertices for a rounded rectangle. + fn unit_vertex_buffer( + display: &Display, + ) -> ( + VertexBuffer, + index::NoIndices, + index::IndexBuffer, + ) { + let mut shape = vec![]; + let n_vertices_corner = 8; + + let corner_radius = CORNER_RADIUS; + let width = UNIT_WIDTH; + let height = UNIT_HEIGHT; + + let corners = [ + ( + width / 2.0 - corner_radius, + height / 2.0 - corner_radius, + 0.0, + ), + ( + -width / 2.0 + corner_radius, + height / 2.0 - corner_radius, + PI * 0.5, + ), + ( + -width / 2.0 + corner_radius, + -height / 2.0 + corner_radius, + PI, + ), + ( + width / 2.0 - corner_radius, + -height / 2.0 + corner_radius, + PI * 1.5, + ), + ]; + + shape.push(Vertex { + position: [0.0, 0.0], + }); + for (x, y, phase) in corners { + for i in 0..n_vertices_corner { + let ang = 0.5 * PI * (i as f32) / n_vertices_corner as f32 + phase; + shape.push(Vertex { + position: [corner_radius * ang.cos() + x, corner_radius * ang.sin() + y], + }); + } + } + shape.push(shape[1]); + + ( + VertexBuffer::new(display, &shape).unwrap(), + index::NoIndices(index::PrimitiveType::TriangleFan), + index::IndexBuffer::new( + display, + index::PrimitiveType::LineLoop, + &(1..(shape.len() - 1) as u32).collect::>(), + ) + .unwrap(), + ) + } + + /// Draws the graph. + pub fn draw(&mut self, display: &Display, graph: &Graph, cursor_x: f32, cursor_y: f32) { + let mut target = display.draw(); + + let (size_x, size_y) = target.get_dimensions(); + self.window_width = size_x as f32; + + let (cursor_x, cursor_y) = self.convert_cursor(cursor_x, cursor_y, size_x, size_y); + + let aspect = (size_y as f32) / (size_x as f32); + + let height = self.width * aspect; + + let max_graph_height = (self.center.y + height / 2.0 + 1.0) as usize; + let min_graph_height = (self.center.y - height / 2.0 - 1.0).max(0.0) as usize; + + let max_validator_index = (self.center.x + self.width / 2.0 + 1.0) as usize; + let min_validator_index = (self.center.x - self.width / 2.0 - 1.0).max(0.0) as usize; + + target.clear_color(0.0, 0.0, 0.2, 1.0); + + let matrix = Matrix::translation(-self.center.x, -self.center.y) + * Matrix::scale(2.0 / self.width, 2.0 / height); + + let mut edges_to_draw = HashSet::new(); + let mut highlighted_edges_to_draw = HashSet::new(); + + for unit in graph.iter_range( + min_validator_index..=max_validator_index, + min_graph_height..=max_graph_height, + ) { + let set_to_insert = if Self::unit_contains_cursor(unit, cursor_x, cursor_y) { + &mut highlighted_edges_to_draw + } else { + &mut edges_to_draw + }; + for cited_unit in &unit.cited_units { + set_to_insert.insert((unit.id, *cited_unit)); + } + for dependent_unit in graph.reverse_edges.get(&unit.id).into_iter().flatten() { + set_to_insert.insert((*dependent_unit, unit.id)); + } + } + + // draw edges first, so that the units are drawn over them + if self.edges_enabled { + self.draw_edges(display, &mut target, &matrix, graph, edges_to_draw, false); + } + self.draw_edges( + display, + &mut target, + &matrix, + graph, + highlighted_edges_to_draw, + true, + ); + + for unit in graph.iter_range( + min_validator_index..=max_validator_index, + min_graph_height..=max_graph_height, + ) { + self.draw_unit(&mut target, unit, graph.validator_weights(), &matrix); + } + + target.finish().unwrap(); + } + + /// Converts the cursor coordinates in pixels into the scene coordinates. + fn convert_cursor(&self, cursor_x: f32, cursor_y: f32, size_x: u32, size_y: u32) -> (f32, f32) { + let size_x = size_x as f32; + let size_y = size_y as f32; + let delta_x = (cursor_x / size_x - 0.5) * self.width; + let delta_y = (0.5 - cursor_y / size_y) * self.width * size_y / size_x; + (self.center.x + delta_x, self.center.y + delta_y) + } + + /// Checks whether the cursor hovers over a unit. + fn unit_contains_cursor(unit: &GraphUnit, cursor_x: f32, cursor_y: f32) -> bool { + let (unit_x, unit_y) = Self::unit_pos(unit); + (unit_x - cursor_x).abs() < UNIT_WIDTH / 2.0 + && (unit_y - cursor_y).abs() < UNIT_HEIGHT / 2.0 + } + + /// Draws a unit. + fn draw_unit( + &mut self, + target: &mut Frame, + unit: &GraphUnit, + weights: &ValidatorMap, + view: &Matrix, + ) { + let (x, y) = Self::unit_pos(unit); + + let matrix2 = Matrix::translation(x, y) * *view; + + let color = match (unit.is_proposal, unit.max_quorum.as_ref()) { + (false, Some(quorum)) => { + if quorum.max_rank <= 1 { + Self::quorum_color_spectrum(0.0) + } else { + let frac = quorum.rank as f32 / (quorum.max_rank - 1) as f32; + Self::quorum_color_spectrum(frac) + } + } + (true, _) => [0.0_f32, 0.5, 0.5], + _ => [0.0_f32, 0.0, 0.2], + }; + + let uniforms = uniform! { + matrix: matrix2.inner(), + color: color, + }; + + target + .draw( + &self.unit_vertex_buffer, + self.interior_indices, + &self.program, + &uniforms, + &Default::default(), + ) + .unwrap(); + + let uniforms = uniform! { + matrix: matrix2.inner(), + color: [ 1.0_f32, 1.0, 0.0 ], + }; + + let draw_params = DrawParameters { + line_width: Some(LINE_WIDTH), + ..Default::default() + }; + + target + .draw( + &self.unit_vertex_buffer, + &self.frame_indices, + &self.program, + &uniforms, + &draw_params, + ) + .unwrap(); + + if self.width < 10.0 { + let text1 = format!("{:?}", unit.id); + let text2 = format!( + "Creator weight: {:3.1}%", + weights.get(unit.creator).unwrap() + ); + let text3 = format!("Vote: {:?}", unit.vote); + let text4 = format!("round_exp: {}", unit.round_exp); + let text5 = format!("round_id: {}", unit.round_id); + let text6 = format!("timestamp: {} (round {})", unit.timestamp, unit.round_num); + let text7 = if let Some(quorum) = unit.max_quorum.as_ref() { + format!("max quorum: {:3.1}%", quorum.weight_percent) + } else { + "".to_string() + }; + self.draw_text(target, -0.4, 0.7, &text1, 1.3, &matrix2); + self.draw_text(target, -0.8, 0.46, &text2, 0.8, &matrix2); + self.draw_text(target, -0.8, 0.22, &text3, 0.8, &matrix2); + self.draw_text(target, -0.8, -0.02, &text4, 0.8, &matrix2); + self.draw_text(target, -0.8, -0.26, &text5, 0.8, &matrix2); + self.draw_text(target, -0.8, -0.5, &text6, 0.8, &matrix2); + self.draw_text(target, -0.8, -0.74, &text7, 0.8, &matrix2); + } else { + let text = format!("{:?}", unit.id); + self.draw_text(target, -0.4, -0.15, &text, 3.0, &matrix2); + } + } + + /// Renders a string. + fn draw_text( + &self, + target: &mut Frame, + x: f32, + y: f32, + text: &str, + scale: f32, + matrix: &Matrix, + ) { + let basic_scale = UNIT_HEIGHT / 12.0; + let scale = basic_scale * scale; + let matrix = Matrix::scale(scale, scale) + * Matrix::translation(x * UNIT_WIDTH / 2.0, y * UNIT_HEIGHT / 2.0) + * *matrix; + let text = TextDisplay::new(&self.text_system, &self.font, text); + + glium_text_rusttype::draw( + &text, + &self.text_system, + target, + matrix.inner(), + (1.0, 1.0, 1.0, 1.0), + ) + .unwrap(); + } + + /// Draws the edges between units. + fn draw_edges( + &mut self, + display: &Display, + target: &mut Frame, + view: &Matrix, + graph: &Graph, + edges: HashSet<(UnitId, UnitId)>, + highlight: bool, + ) { + let mut vertices = vec![]; + + for (unit1, unit2) in edges { + let pos1 = Self::unit_pos(graph.get(&unit1).unwrap()); + let pos2 = Self::unit_pos(graph.get(&unit2).unwrap()); + + vertices.push(Vertex { + position: [pos1.0, pos1.1], + }); + vertices.push(Vertex { + position: [pos2.0, pos2.1], + }); + } + + let vertex_buffer = VertexBuffer::new(display, &vertices).unwrap(); + let indices = index::NoIndices(index::PrimitiveType::LinesList); + + let color = if highlight { + [1.0_f32, 1.0, 1.0] + } else { + [1.0_f32, 1.0, 0.0] + }; + + let uniforms = uniform! { + matrix: view.inner(), + color: color, + }; + + let draw_parameters = DrawParameters { + line_width: Some(if highlight { + LINE_WIDTH * 2.0 + } else { + LINE_WIDTH + }), + ..Default::default() + }; + + target + .draw( + &vertex_buffer, + indices, + &self.program, + &uniforms, + &draw_parameters, + ) + .unwrap(); + } + + /// Returns the position of the units in scene coordinates. + fn unit_pos(unit: &GraphUnit) -> (f32, f32) { + let x = unit.creator.0 as f32; + let y = unit.graph_height as f32; + (x, y) + } + + /// Handles a mouse scroll event (zooms in or out). + pub fn mouse_scroll(&mut self, lines: f32) { + self.width *= 2.0_f32.powf(lines / 3.0); + } + + /// Handles a dragging event (pans the screen). + pub fn pan(&mut self, delta_x: f32, delta_y: f32) { + let scale = self.width / self.window_width; + self.center += Vector2::new(-delta_x * scale, delta_y * scale); + } + + pub fn toggle_edges(&mut self) { + self.edges_enabled = !self.edges_enabled; + } + + /// Returns a color for the max quorum based on its rank. + fn quorum_color_spectrum(frac: f32) -> [f32; 3] { + let r = if frac < 0.5 { frac } else { 1.0 }; + let g = if frac < 0.5 { 1.0 } else { 1.0 - frac }; + [r * 0.5, g * 0.5, 0.0] + } +} diff --git a/utils/highway-state-grapher/src/renderer/matrix.rs b/utils/highway-state-grapher/src/renderer/matrix.rs new file mode 100644 index 0000000000..ed2575869e --- /dev/null +++ b/utils/highway-state-grapher/src/renderer/matrix.rs @@ -0,0 +1,84 @@ +use std::ops; + +#[derive(Clone, Copy)] +pub struct Matrix { + coords: [[f32; 4]; 4], +} + +impl Matrix { + pub fn identity() -> Matrix { + Matrix { + coords: [ + [1.0, 0.0, 0.0, 0.0], + [0.0, 1.0, 0.0, 0.0], + [0.0, 0.0, 1.0, 0.0], + [0.0, 0.0, 0.0, 1.0], + ], + } + } + + pub fn inner(self) -> [[f32; 4]; 4] { + self.coords + } + + pub fn translation(x: f32, y: f32) -> Matrix { + let mut result = Matrix::identity(); + result.coords[3][0] = x; + result.coords[3][1] = y; + result + } + + pub fn scale(x: f32, y: f32) -> Matrix { + Matrix { + coords: [ + [x, 0.0, 0.0, 0.0], + [0.0, y, 0.0, 0.0], + [0.0, 0.0, 1.0, 0.0], + [0.0, 0.0, 0.0, 1.0], + ], + } + } +} + +impl ops::Add for Matrix { + type Output = Matrix; + + fn add(mut self, other: Matrix) -> Matrix { + for i in 0..4 { + for j in 0..4 { + self.coords[i][j] += other.coords[i][j]; + } + } + self + } +} + +impl ops::Sub for Matrix { + type Output = Matrix; + + fn sub(mut self, other: Matrix) -> Matrix { + for i in 0..4 { + for j in 0..4 { + self.coords[i][j] -= other.coords[i][j]; + } + } + self + } +} + +impl ops::Mul for Matrix { + type Output = Matrix; + + #[allow(clippy::needless_range_loop)] + fn mul(self, other: Matrix) -> Matrix { + let mut new_coords = [[0.0; 4]; 4]; + for i in 0..4 { + for j in 0..4 { + for k in 0..4 { + new_coords[i][j] += self.coords[i][k] * other.coords[k][j]; + } + } + } + Matrix { coords: new_coords } + } +}