diff --git a/Cargo.lock b/Cargo.lock index b31028a..dcade27 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,18 +1,12 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] -name = "adler" -version = "1.0.2" +name = "adler2" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "android-tzdata" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" [[package]] name = "android_system_properties" @@ -25,9 +19,9 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.1.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" [[package]] name = "bitflags" @@ -35,17 +29,23 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" + [[package]] name = "bumpalo" -version = "3.14.0" +version = "3.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +checksum = "5dd9dc738b7a8311c7ade152424974d8115f2cdad61e8dab8dac9f2362298510" [[package]] name = "bytemuck" -version = "1.14.0" +version = "1.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6" +checksum = "c8efb64bd706a16a1bdde310ae86b351e4d21550d98d056f22f8a7f7a2183fec" [[package]] name = "byteorder" @@ -55,40 +55,31 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "cc" -version = "1.0.83" +version = "1.2.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +checksum = "47b26a0954ae34af09b50f0de26458fa95369a0d478d8236d3f93082b219bd29" dependencies = [ - "libc", + "find-msvc-tools", + "shlex", ] [[package]] name = "cfg-if" -version = "1.0.0" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] name = "chrono" -version = "0.4.31" +version = "0.4.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" +checksum = "fac4744fb15ae8337dc853fee7fb3f4e48c0fbaa23d0afe49c447b4fab126118" dependencies = [ - "android-tzdata", "iana-time-zone", "js-sys", "num-traits", "wasm-bindgen", - "windows-targets", -] - -[[package]] -name = "cmake" -version = "0.1.50" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31c789563b815f77f4250caee12365734369f942439b7defd71e18a48197130" -dependencies = [ - "cc", + "windows-link", ] [[package]] @@ -97,17 +88,11 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" -[[package]] -name = "const-cstr" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed3d0b5ff30645a68f35ece8cea4556ca14ef8a1651455f789a099a0513532a6" - [[package]] name = "core-foundation" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" dependencies = [ "core-foundation-sys", "libc", @@ -115,17 +100,17 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.4" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "core-graphics" -version = "0.22.3" +version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb" +checksum = "c07782be35f9e1140080c6b96f0d44b739e2278479f64e02fdab4e32dfd8b081" dependencies = [ - "bitflags", + "bitflags 1.3.2", "core-foundation", "core-graphics-types", "foreign-types", @@ -134,20 +119,20 @@ dependencies = [ [[package]] name = "core-graphics-types" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bb142d41022986c1d8ff29103a1411c8a3dfad3552f87a4f8dc50d61d4f4e33" +checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" dependencies = [ - "bitflags", + "bitflags 1.3.2", "core-foundation", "libc", ] [[package]] name = "core-text" -version = "19.2.0" +version = "20.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99d74ada66e07c1cefa18f8abfba765b486f250de2e4a999e5727fc0dd4b4a25" +checksum = "c9d2790b5c08465d49f8dc05c8bcae9fea467855947db39b0f8145c091aaced5" dependencies = [ "core-foundation", "core-graphics", @@ -157,32 +142,32 @@ dependencies = [ [[package]] name = "crc32fast" -version = "1.3.2" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" dependencies = [ "cfg-if", ] [[package]] -name = "dirs-next" -version = "2.0.0" +name = "dirs" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" +checksum = "c3e8aa94d75141228480295a7d0e7feb620b1a5ad9f12bc40be62411e38cce4e" dependencies = [ - "cfg-if", - "dirs-sys-next", + "dirs-sys", ] [[package]] -name = "dirs-sys-next" -version = "0.1.2" +name = "dirs-sys" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" +checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab" dependencies = [ "libc", + "option-ext", "redox_users", - "winapi", + "windows-sys", ] [[package]] @@ -196,9 +181,9 @@ dependencies = [ [[package]] name = "dwrote" -version = "0.11.0" +version = "0.11.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439a1c2ba5611ad3ed731280541d36d2e9c4ac5e7fb818a27b604bdc5a6aa65b" +checksum = "9e1b35532432acc8b19ceed096e35dfa088d3ea037fe4f3c085f1f97f33b4d02" dependencies = [ "lazy_static", "libc", @@ -208,18 +193,24 @@ dependencies = [ [[package]] name = "fdeflate" -version = "0.3.0" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d329bdeac514ee06249dabc27877490f17f5d371ec693360768b838e19f3ae10" +checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c" dependencies = [ "simd-adler32", ] +[[package]] +name = "find-msvc-tools" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" + [[package]] name = "flate2" -version = "1.0.27" +version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010" +checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c" dependencies = [ "crc32fast", "miniz_oxide", @@ -227,25 +218,25 @@ dependencies = [ [[package]] name = "float-ord" -version = "0.2.0" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bad48618fdb549078c333a7a8528acb57af271d0433bdecd523eb620628364e" +checksum = "8ce81f49ae8a0482e4c55ea62ebbd7e5a686af544c00b9d090bba3ff9be97b3d" [[package]] name = "font-kit" -version = "0.11.0" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21fe28504d371085fae9ac7a3450f0b289ab71e07c8e57baa3fb68b9e57d6ce5" +checksum = "2c7e611d49285d4c4b2e1727b72cf05353558885cc5252f93707b845dfcaf3d3" dependencies = [ - "bitflags", + "bitflags 2.10.0", "byteorder", "core-foundation", "core-graphics", "core-text", - "dirs-next", + "dirs", "dwrote", "float-ord", - "freetype", + "freetype-sys", "lazy_static", "libc", "log", @@ -258,45 +249,47 @@ dependencies = [ [[package]] name = "foreign-types" -version = "0.3.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" dependencies = [ + "foreign-types-macros", "foreign-types-shared", ] [[package]] -name = "foreign-types-shared" -version = "0.1.1" +name = "foreign-types-macros" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" +checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] [[package]] -name = "freetype" -version = "0.7.0" +name = "foreign-types-shared" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bee38378a9e3db1cc693b4f88d166ae375338a0ff75cb8263e1c601d51f35dc6" -dependencies = [ - "freetype-sys", - "libc", -] +checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" [[package]] name = "freetype-sys" -version = "0.13.1" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a37d4011c0cc628dfa766fcc195454f4b068d7afdc2adfd28861191d866e731a" +checksum = "0e7edc5b9669349acfda99533e9e0bcf26a51862ab43b08ee7745c55d28eb134" dependencies = [ - "cmake", + "cc", "libc", "pkg-config", ] [[package]] name = "getrandom" -version = "0.2.10" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" dependencies = [ "cfg-if", "libc", @@ -315,16 +308,17 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.57" +version = "0.1.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", + "log", "wasm-bindgen", - "windows", + "windows-core", ] [[package]] @@ -338,107 +332,102 @@ dependencies = [ [[package]] name = "image" -version = "0.24.7" +version = "0.24.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f3dfdbdd72063086ff443e297b61695500514b1e41095b6fb9a5ab48a70a711" +checksum = "5690139d2f55868e080017335e4b94cb7414274c74f1669c84fb5feba2c9f69d" dependencies = [ "bytemuck", "byteorder", "color_quant", "jpeg-decoder", - "num-rational", "num-traits", "png", ] [[package]] name = "jpeg-decoder" -version = "0.3.0" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc0000e42512c92e31c2252315bda326620a4e034105e900c98ec492fa077b3e" +checksum = "00810f1d8b74be64b13dbf3db89ac67740615d6c891f0e7b6179326533011a07" [[package]] name = "js-sys" -version = "0.3.64" +version = "0.3.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" +checksum = "8c942ebf8e95485ca0d52d97da7c5a2c387d0e7f0ba4c35e93bfcaee045955b3" dependencies = [ + "once_cell", "wasm-bindgen", ] [[package]] name = "lazy_static" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.149" +version = "0.2.180" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" +checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc" [[package]] name = "libloading" -version = "0.8.1" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c571b676ddfc9a8c12f1f3d3085a7b163966a8fd8098a90640953ce5f6170161" +checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" dependencies = [ "cfg-if", - "windows-sys", + "windows-link", ] [[package]] -name = "log" -version = "0.4.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" - -[[package]] -name = "miniz_oxide" -version = "0.7.1" +name = "libredox" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "3d0b95e02c851351f877147b7deea7b1afb1df71b63aa5f8270716e0c5720616" dependencies = [ - "adler", - "simd-adler32", + "bitflags 2.10.0", + "libc", ] [[package]] -name = "num-integer" -version = "0.1.45" +name = "log" +version = "0.4.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" -dependencies = [ - "autocfg", - "num-traits", -] +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" [[package]] -name = "num-rational" -version = "0.4.1" +name = "miniz_oxide" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" dependencies = [ - "autocfg", - "num-integer", - "num-traits", + "adler2", + "simd-adler32", ] [[package]] name = "num-traits" -version = "0.2.17" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] [[package]] name = "once_cell" -version = "1.18.0" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "option-ext" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" [[package]] name = "pathfinder_geometry" @@ -452,24 +441,24 @@ dependencies = [ [[package]] name = "pathfinder_simd" -version = "0.5.2" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0444332826c70dc47be74a7c6a5fc44e23a7905ad6858d4162b658320455ef93" +checksum = "bf9027960355bf3afff9841918474a81a5f972ac6d226d518060bba758b5ad57" dependencies = [ "rustc_version", ] [[package]] name = "pkg-config" -version = "0.3.27" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" [[package]] name = "plotters" -version = "0.3.5" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2c224ba00d7cadd4d5c660deaf2098e5e80e07846537c51f9cfa4be50c1fd45" +checksum = "5aeb6f403d7a4911efb1e33402027fc44f29b5bf6def3effcc22d7bb75f2b747" dependencies = [ "chrono", "font-kit", @@ -487,15 +476,15 @@ dependencies = [ [[package]] name = "plotters-backend" -version = "0.3.5" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e76628b4d3a7581389a35d5b6e2139607ad7c75b17aed325f210aa91f4a9609" +checksum = "df42e13c12958a16b3f7f4386b9ab1f3e7933914ecea48da7139435263a4172a" [[package]] name = "plotters-bitmap" -version = "0.3.3" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cebbe1f70205299abc69e8b295035bb52a6a70ee35474ad10011f0a4efb8543" +checksum = "72ce181e3f6bf82d6c1dc569103ca7b1bd964c60ba03d7e6cdfbb3e3eb7f7405" dependencies = [ "gif", "image", @@ -504,20 +493,20 @@ dependencies = [ [[package]] name = "plotters-svg" -version = "0.3.5" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38f6d39893cca0701371e3c27294f09797214b86f1fb951b89ade8ec04e2abab" +checksum = "51bae2ac328883f7acdfea3d66a7c35751187f870bc81f94563733a154d7a670" dependencies = [ "plotters-backend", ] [[package]] name = "png" -version = "0.17.10" +version = "0.17.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd75bf2d8dd3702b9707cdbc56a5b9ef42cec752eb8b3bafc01234558442aa64" +checksum = "82151a2fc869e011c153adc57cf2789ccb8d9906ce52c0b39a6b5697749d7526" dependencies = [ - "bitflags", + "bitflags 1.3.2", "crc32fast", "fdeflate", "flate2", @@ -526,51 +515,48 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.69" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.33" +version = "1.0.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4" dependencies = [ "proc-macro2", ] -[[package]] -name = "redox_syscall" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" -dependencies = [ - "bitflags", -] - [[package]] name = "redox_users" -version = "0.4.3" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" +checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac" dependencies = [ "getrandom", - "redox_syscall", + "libredox", "thiserror", ] [[package]] name = "rustc_version" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ "semver", ] +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + [[package]] name = "same-file" version = "1.0.6" @@ -582,21 +568,27 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.20" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" +checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "simd-adler32" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" +checksum = "e320a6c5ad31d271ad523dcf3ad13e2767ad8b1cb8f047f75a8aeaf8da139da2" [[package]] name = "syn" -version = "2.0.38" +version = "2.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" +checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a" dependencies = [ "proc-macro2", "quote", @@ -605,18 +597,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.49" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1177e8c6d7ede7afde3585fd2513e611227efd6481bd78d2e82ba1ce16557ed4" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.49" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10712f02019e9288794769fba95cd6847df9874d49d871d062172f9dd41bc4cc" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" dependencies = [ "proc-macro2", "quote", @@ -625,21 +617,21 @@ dependencies = [ [[package]] name = "ttf-parser" -version = "0.17.1" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "375812fa44dab6df41c195cd2f7fecb488f6c09fbaafb62807488cefab642bff" +checksum = "17f77d76d837a7830fe1d4f12b7b4ba4192c1888001c7164257e4bc6d21d96b4" [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" [[package]] name = "walkdir" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" dependencies = [ "same-file", "winapi-util", @@ -647,40 +639,28 @@ dependencies = [ [[package]] name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" +version = "0.11.1+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" [[package]] name = "wasm-bindgen" -version = "0.2.87" +version = "0.2.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +checksum = "64024a30ec1e37399cf85a7ffefebdb72205ca1c972291c51512360d90bd8566" dependencies = [ "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" -dependencies = [ - "bumpalo", - "log", "once_cell", - "proc-macro2", - "quote", - "syn", + "rustversion", + "wasm-bindgen-macro", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.87" +version = "0.2.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +checksum = "008b239d9c740232e71bd39e8ef6429d27097518b6b30bdf9086833bd5b6d608" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -688,28 +668,31 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.87" +version = "0.2.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +checksum = "5256bae2d58f54820e6490f9839c49780dff84c65aeab9e772f15d5f0e913a55" dependencies = [ + "bumpalo", "proc-macro2", "quote", "syn", - "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.87" +version = "0.2.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" +checksum = "1f01b580c9ac74c8d8f0c0e4afb04eeef2acf145458e52c03845ee9cd23e3d12" +dependencies = [ + "unicode-ident", +] [[package]] name = "web-sys" -version = "0.3.64" +version = "0.3.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +checksum = "312e32e551d92129218ea9a2452120f4aabc03529ef03e4d0d82fb2780608598" dependencies = [ "js-sys", "wasm-bindgen", @@ -717,9 +700,9 @@ dependencies = [ [[package]] name = "weezl" -version = "0.1.7" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb" +checksum = "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88" [[package]] name = "winapi" @@ -739,11 +722,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.6" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "winapi", + "windows-sys", ] [[package]] @@ -753,79 +736,72 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] -name = "windows" -version = "0.48.0" +name = "windows-core" +version = "0.62.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" dependencies = [ - "windows-targets", + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", ] [[package]] -name = "windows-sys" -version = "0.48.0" +name = "windows-implement" +version = "0.60.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" dependencies = [ - "windows-targets", + "proc-macro2", + "quote", + "syn", ] [[package]] -name = "windows-targets" -version = "0.48.5" +name = "windows-interface" +version = "0.59.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "proc-macro2", + "quote", + "syn", ] [[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.5" +name = "windows-link" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" [[package]] -name = "windows_i686_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.5" +name = "windows-result" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] [[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.5" +name = "windows-strings" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", +] [[package]] -name = "windows_x86_64_msvc" -version = "0.48.5" +name = "windows-sys" +version = "0.61.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] [[package]] name = "wio" @@ -838,11 +814,10 @@ dependencies = [ [[package]] name = "yeslogic-fontconfig-sys" -version = "3.2.0" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2bbd69036d397ebbff671b1b8e4d918610c181c5a16073b96f984a38d08c386" +checksum = "503a066b4c037c440169d995b869046827dbc71263f6e8f3be6d77d4f3229dbd" dependencies = [ - "const-cstr", "dlib", "once_cell", "pkg-config", diff --git a/README.md b/README.md index 2170507..76f8a62 100644 --- a/README.md +++ b/README.md @@ -1,167 +1,179 @@ -# Zcash Sustainaiblity Fund simulator +# Network Sustainability Mechanism simulator -This short Rust program simulates Zcash Block Rewards (aka Block Subsidies) assuming Zcash Sustainability Fund backed smoothing out of the issuance curve will be implemented (https://github.com/zcash/zips/pull/706). +This short Rust program simulates Zcash Block Subsidies, assuming that smoothing of the +issuance curve in line with the Network Sustainability Mechanism will be implemented as +specified in [ZIP 234](https://zips.z.cash/zip-0234). ## Running -### Devenv -You can use [devenv.sh](https://devenv.sh/) to setup a development environment. Otherwise follow the instructions below. - ### Manual setup -To run the program, you need to have Rust installed. You'll also need some extra libraries to enable plotting, on Ubuntu do: +To run the program, you need to have Rust installed. You'll also need some extra libraries +to enable plotting, on Ubuntu do: ``` sudo apt install pkg-config libfreetype6-dev libfontconfig1-dev ``` - Then, clone this repository and run: +Then, clone this repository and run: ``` cargo run ``` +## Disclaimer + +This fork of Eiger's "[ZSF simulator](https://github.com/eigerco/zsf-simulator)" has been +significantly modified by me, Daira-Emma Hopwood. Any errors in the interpretation of +ZIP 234 are my own. + ## Output -The program will output the final block that subsidies will be paid out from: +The program will output the final block that subsidies would be paid out from +according to ZIP 234: ``` -Last block is 47917869 in ~113.88 years -Final block subsidy: 1 (~0 ZEC) -Final ZSF balance: 0 (~0 ZEC) +DEPLOYMENT_BLOCK_HEIGHT = 3662982 (2.23 years after 2nd halving) +Last block with non-zero subsidy is at height 50788960 in ~114.23 years after the 2nd halving. +Final block subsidy: 1 (~0.00000001 ZEC) +Final NSM balance: 0 (~0 ZEC) ``` -As well as a summary of subsidies paid out during 4 year periods in between halvings in comparison with the current -issuance scheme: +It also gives a summary of subsidies that would be paid out during 4-year periods +after NSM deployment in comparison with the current issuance scheme. (Note that +these periods do not line up with halving periods under the current scheme.) ``` -Halvings: -Halving 1 at block 1680000: - ZSF subsidies: 262523884819889 (~ 2625238.848 ZEC, 1.563 ZEC per block) - legacy subsidies: 262500000000000 (~ 2625000.000 ZEC, 1.562 ZEC per block) - difference: 23884819889 (~ 238 ZEC), ZSF/legacy: 1.0001 -Halving 2 at block 3360000: - ZSF subsidies: 131259082555273 (~ 1312590.826 ZEC, 0.781 ZEC per block) - legacy subsidies: 131250000000000 (~ 1312500.000 ZEC, 0.781 ZEC per block) - difference: 9082555273 (~ 90 ZEC), ZSF/legacy: 1.0001 -Halving 3 at block 5040000: - ZSF subsidies: 65628165536456 (~ 656281.655 ZEC, 0.391 ZEC per block) - legacy subsidies: 65625000000000 (~ 656250.000 ZEC, 0.391 ZEC per block) - difference: 3165536456 (~ 31 ZEC), ZSF/legacy: 1.0000 -Halving 4 at block 6720000: - ZSF subsidies: 32813394913130 (~ 328133.949 ZEC, 0.195 ZEC per block) - legacy subsidies: 32812500000000 (~ 328125.000 ZEC, 0.195 ZEC per block) - difference: 894913130 (~ 8 ZEC), ZSF/legacy: 1.0000 -Halving 5 at block 8400000: - ZSF subsidies: 16406353535358 (~ 164063.535 ZEC, 0.098 ZEC per block) - legacy subsidies: 16406250000000 (~ 164062.500 ZEC, 0.098 ZEC per block) - difference: 103535358 (~ 1 ZEC), ZSF/legacy: 1.0000 -Halving 6 at block 10080000: - ZSF subsidies: 8203004810267 (~ 82030.048 ZEC, 0.049 ZEC per block) - legacy subsidies: 8203124160000 (~ 82031.242 ZEC, 0.049 ZEC per block) - difference: -119349733 (~ -1 ZEC), ZSF/legacy: 1.0000 -Halving 7 at block 11760000: - ZSF subsidies: 4101416429306 (~ 41014.164 ZEC, 0.024 ZEC per block) - legacy subsidies: 4101562080000 (~ 41015.621 ZEC, 0.024 ZEC per block) - difference: -145650694 (~ -1 ZEC), ZSF/legacy: 1.0000 -Halving 8 at block 13440000: - ZSF subsidies: 2050665226986 (~ 20506.652 ZEC, 0.012 ZEC per block) - legacy subsidies: 2050781040000 (~ 20507.810 ZEC, 0.012 ZEC per block) - difference: -115813014 (~ -1 ZEC), ZSF/legacy: 0.9999 -Halving 9 at block 15120000: - ZSF subsidies: 1025311119937 (~ 10253.111 ZEC, 0.006 ZEC per block) - legacy subsidies: 1025389680000 (~ 10253.897 ZEC, 0.006 ZEC per block) - difference: -78560063 (~ 0 ZEC), ZSF/legacy: 0.9999 -Halving 10 at block 16800000: - ZSF subsidies: 512644813724 (~ 5126.448 ZEC, 0.003 ZEC per block) - legacy subsidies: 512694000000 (~ 5126.940 ZEC, 0.003 ZEC per block) - difference: -49186276 (~ 0 ZEC), ZSF/legacy: 0.9999 -Halving 11 at block 18480000: - ZSF subsidies: 256317033772 (~ 2563.170 ZEC, 0.002 ZEC per block) - legacy subsidies: 256346160000 (~ 2563.462 ZEC, 0.002 ZEC per block) - difference: -29126228 (~ 0 ZEC), ZSF/legacy: 0.9999 -Halving 12 at block 20160000: - ZSF subsidies: 128155830300 (~ 1281.558 ZEC, 0.001 ZEC per block) - legacy subsidies: 128172240000 (~ 1281.722 ZEC, 0.001 ZEC per block) - difference: -16409700 (~ 0 ZEC), ZSF/legacy: 0.9999 -Halving 13 at block 21840000: - ZSF subsidies: 64076572065 (~ 640.766 ZEC, 0.000 ZEC per block) - legacy subsidies: 64085280000 (~ 640.853 ZEC, 0.000 ZEC per block) - difference: -8707935 (~ 0 ZEC), ZSF/legacy: 0.9999 -Halving 14 at block 23520000: - ZSF subsidies: 32037614417 (~ 320.376 ZEC, 0.000 ZEC per block) - legacy subsidies: 32042640000 (~ 320.426 ZEC, 0.000 ZEC per block) - difference: -5025583 (~ 0 ZEC), ZSF/legacy: 0.9998 -Halving 15 at block 25200000: - ZSF subsidies: 16018471375 (~ 160.185 ZEC, 0.000 ZEC per block) - legacy subsidies: 16020480000 (~ 160.205 ZEC, 0.000 ZEC per block) - difference: -2008625 (~ 0 ZEC), ZSF/legacy: 0.9999 -Halving 16 at block 26880000: - ZSF subsidies: 8009067846 (~ 80.091 ZEC, 0.000 ZEC per block) - legacy subsidies: 8010240000 (~ 80.102 ZEC, 0.000 ZEC per block) - difference: -1172154 (~ 0 ZEC), ZSF/legacy: 0.9999 -Halving 17 at block 28560000: - ZSF subsidies: 4004449844 (~ 40.044 ZEC, 0.000 ZEC per block) - legacy subsidies: 4005120000 (~ 40.051 ZEC, 0.000 ZEC per block) - difference: -670156 (~ 0 ZEC), ZSF/legacy: 0.9998 -Halving 18 at block 30240000: - ZSF subsidies: 2002182886 (~ 20.022 ZEC, 0.000 ZEC per block) - legacy subsidies: 2002560000 (~ 20.026 ZEC, 0.000 ZEC per block) - difference: -377114 (~ 0 ZEC), ZSF/legacy: 0.9998 -Halving 19 at block 31920000: - ZSF subsidies: 1001070275 (~ 10.011 ZEC, 0.000 ZEC per block) - legacy subsidies: 1001280000 (~ 10.013 ZEC, 0.000 ZEC per block) - difference: -209725 (~ 0 ZEC), ZSF/legacy: 0.9998 -Halving 20 at block 33600000: - ZSF subsidies: 500525701 (~ 5.005 ZEC, 0.000 ZEC per block) - legacy subsidies: 500640000 (~ 5.006 ZEC, 0.000 ZEC per block) - difference: -114299 (~ 0 ZEC), ZSF/legacy: 0.9998 -Halving 21 at block 35280000: - ZSF subsidies: 250255480 (~ 2.503 ZEC, 0.000 ZEC per block) - legacy subsidies: 250320000 (~ 2.503 ZEC, 0.000 ZEC per block) - difference: -64520 (~ 0 ZEC), ZSF/legacy: 0.9997 -Halving 22 at block 36960000: - ZSF subsidies: 125126575 (~ 1.251 ZEC, 0.000 ZEC per block) - legacy subsidies: 124320000 (~ 1.243 ZEC, 0.000 ZEC per block) - difference: 806575 (~ 0 ZEC), ZSF/legacy: 1.0065 -Halving 23 at block 38640000: - ZSF subsidies: 62556140 (~ 0.626 ZEC, 0.000 ZEC per block) - legacy subsidies: 62160000 (~ 0.622 ZEC, 0.000 ZEC per block) - difference: 396140 (~ 0 ZEC), ZSF/legacy: 1.0064 -Halving 24 at block 40320000: - ZSF subsidies: 31271589 (~ 0.313 ZEC, 0.000 ZEC per block) - legacy subsidies: 30240000 (~ 0.302 ZEC, 0.000 ZEC per block) - difference: 1031589 (~ 0 ZEC), ZSF/legacy: 1.0341 -Halving 25 at block 42000000: - ZSF subsidies: 15660304 (~ 0.157 ZEC, 0.000 ZEC per block) - legacy subsidies: 15120000 (~ 0.151 ZEC, 0.000 ZEC per block) - difference: 540304 (~ 0 ZEC), ZSF/legacy: 1.0357 -Halving 26 at block 43680000: - ZSF subsidies: 7766952 (~ 0.078 ZEC, 0.000 ZEC per block) - legacy subsidies: 6720000 (~ 0.067 ZEC, 0.000 ZEC per block) - difference: 1046952 (~ 0 ZEC), ZSF/legacy: 1.1558 -Halving 27 at block 45360000: - ZSF subsidies: 3962388 (~ 0.040 ZEC, 0.000 ZEC per block) - legacy subsidies: 3360000 (~ 0.034 ZEC, 0.000 ZEC per block) - difference: 602388 (~ 0 ZEC), ZSF/legacy: 1.1793 -Halving 28 at block 47040000: - ZSF subsidies: 1814216 (~ 0.018 ZEC, 0.000 ZEC per block) - legacy subsidies: 1680000 (~ 0.017 ZEC, 0.000 ZEC per block) - difference: 134216 (~ 0 ZEC), ZSF/legacy: 1.0799 +Four-year periods: +Years 0.. 4 at heights 3662982.. 5342982: + NSM subsidies: 189352008356142 (~ 1893520.084 ZEC, 1.12709529 ZEC per block) + no-NSM subsidies: 189329609375000 (~ 1893296.094 ZEC, 1.12696196 ZEC per block) + difference: 22398981142 (~ 223.990 ZEC), NSM/no-NSM: 1.0001 +Years 4.. 8 at heights 5342982.. 7022982: + NSM subsidies: 94673941434973 (~ 946739.414 ZEC, 0.56353537 ZEC per block) + no-NSM subsidies: 94664726562500 (~ 946647.266 ZEC, 0.56348052 ZEC per block) + difference: 9214872473 (~ 92.149 ZEC), NSM/no-NSM: 1.0001 +Years 8.. 12 at heights 7022982.. 8702982: + NSM subsidies: 47335978429372 (~ 473359.784 ZEC, 0.28176178 ZEC per block) + no-NSM subsidies: 47332363281250 (~ 473323.633 ZEC, 0.28174026 ZEC per block) + difference: 3615148122 (~ 36.151 ZEC), NSM/no-NSM: 1.0001 +Years 12.. 16 at heights 8702982..10382982: + NSM subsidies: 23667493081637 (~ 236674.931 ZEC, 0.14087794 ZEC per block) + no-NSM subsidies: 23666181640625 (~ 236661.816 ZEC, 0.14087013 ZEC per block) + difference: 1311441012 (~ 13.114 ZEC), NSM/no-NSM: 1.0001 +Years 16.. 20 at heights 10382982..12062982: + NSM subsidies: 11833498478705 (~ 118334.985 ZEC, 0.07043749 ZEC per block) + no-NSM subsidies: 11833090352021 (~ 118330.904 ZEC, 0.07043506 ZEC per block) + difference: 408126684 (~ 4.081 ZEC), NSM/no-NSM: 1.0000 +Years 20.. 24 at heights 12062982..13742982: + NSM subsidies: 5916625210905 (~ 59166.252 ZEC, 0.03521801 ZEC per block) + no-NSM subsidies: 5916544804302 (~ 59165.448 ZEC, 0.03521753 ZEC per block) + difference: 80406603 (~ 0.804 ZEC), NSM/no-NSM: 1.0000 +Years 24.. 28 at heights 13742982..15422982: + NSM subsidies: 2958250593150 (~ 29582.506 ZEC, 0.01760863 ZEC per block) + no-NSM subsidies: 2958272402151 (~ 29582.724 ZEC, 0.01760876 ZEC per block) + difference: -21809001 (~ -0.218 ZEC), NSM/no-NSM: 1.0000 +Years 28.. 32 at heights 15422982..17102982: + NSM subsidies: 1479094290614 (~ 14790.943 ZEC, 0.00880413 ZEC per block) + no-NSM subsidies: 1479135732784 (~ 14791.357 ZEC, 0.00880438 ZEC per block) + difference: -41442170 (~ -0.414 ZEC), NSM/no-NSM: 1.0000 +Years 32.. 36 at heights 17102982..18782982: + NSM subsidies: 739531642870 (~ 7395.316 ZEC, 0.00440197 ZEC per block) + no-NSM subsidies: 739567026392 (~ 7395.670 ZEC, 0.00440218 ZEC per block) + difference: -35383522 (~ -0.354 ZEC), NSM/no-NSM: 1.0000 +Years 36.. 40 at heights 18782982..20462982: + NSM subsidies: 369758070268 (~ 3697.581 ZEC, 0.00220094 ZEC per block) + no-NSM subsidies: 369782673196 (~ 3697.827 ZEC, 0.00220109 ZEC per block) + difference: -24602928 (~ -0.246 ZEC), NSM/no-NSM: 0.9999 +Years 40.. 44 at heights 20462982..22142982: + NSM subsidies: 184875159527 (~ 1848.752 ZEC, 0.00110045 ZEC per block) + no-NSM subsidies: 184890496598 (~ 1848.905 ZEC, 0.00110054 ZEC per block) + difference: -15337071 (~ -0.153 ZEC), NSM/no-NSM: 0.9999 +Years 44.. 48 at heights 22142982..23822982: + NSM subsidies: 92435642223 (~ 924.356 ZEC, 0.00055021 ZEC per block) + no-NSM subsidies: 92444408299 (~ 924.444 ZEC, 0.00055026 ZEC per block) + difference: -8766076 (~ -0.088 ZEC), NSM/no-NSM: 0.9999 +Years 48.. 52 at heights 23822982..25502982: + NSM subsidies: 46216852306 (~ 462.169 ZEC, 0.00027510 ZEC per block) + no-NSM subsidies: 46221832441 (~ 462.218 ZEC, 0.00027513 ZEC per block) + difference: -4980135 (~ -0.050 ZEC), NSM/no-NSM: 0.9999 +Years 52.. 56 at heights 25502982..27182982: + NSM subsidies: 23107941677 (~ 231.079 ZEC, 0.00013755 ZEC per block) + no-NSM subsidies: 23110447929 (~ 231.104 ZEC, 0.00013756 ZEC per block) + difference: -2506252 (~ -0.025 ZEC), NSM/no-NSM: 0.9999 +Years 56.. 60 at heights 27182982..28862982: + NSM subsidies: 11553728657 (~ 115.537 ZEC, 0.00006877 ZEC per block) + no-NSM subsidies: 11554852256 (~ 115.549 ZEC, 0.00006878 ZEC per block) + difference: -1123599 (~ -0.011 ZEC), NSM/no-NSM: 0.9999 +Years 60.. 64 at heights 28862982..30542982: + NSM subsidies: 5776743256 (~ 57.767 ZEC, 0.00003439 ZEC per block) + no-NSM subsidies: 5777426128 (~ 57.774 ZEC, 0.00003439 ZEC per block) + difference: -682872 (~ -0.007 ZEC), NSM/no-NSM: 0.9999 +Years 64.. 68 at heights 30542982..32222982: + NSM subsidies: 2888311019 (~ 28.883 ZEC, 0.00001719 ZEC per block) + no-NSM subsidies: 2888713064 (~ 28.887 ZEC, 0.00001719 ZEC per block) + difference: -402045 (~ -0.004 ZEC), NSM/no-NSM: 0.9999 +Years 68.. 72 at heights 32222982..33902982: + NSM subsidies: 1444125052 (~ 14.441 ZEC, 0.00000860 ZEC per block) + no-NSM subsidies: 1444356532 (~ 14.444 ZEC, 0.00000860 ZEC per block) + difference: -231480 (~ -0.002 ZEC), NSM/no-NSM: 0.9998 +Years 72.. 76 at heights 33902982..35582982: + NSM subsidies: 722047128 (~ 7.220 ZEC, 0.00000430 ZEC per block) + no-NSM subsidies: 722178266 (~ 7.222 ZEC, 0.00000430 ZEC per block) + difference: -131138 (~ -0.001 ZEC), NSM/no-NSM: 0.9998 +Years 76.. 80 at heights 35582982..37262982: + NSM subsidies: 361015488 (~ 3.610 ZEC, 0.00000215 ZEC per block) + no-NSM subsidies: 361089133 (~ 3.611 ZEC, 0.00000215 ZEC per block) + difference: -73645 (~ -0.001 ZEC), NSM/no-NSM: 0.9998 +Years 80.. 84 at heights 37262982..38942982: + NSM subsidies: 180506560 (~ 1.805 ZEC, 0.00000107 ZEC per block) + no-NSM subsidies: 180076275 (~ 1.801 ZEC, 0.00000107 ZEC per block) + difference: 430285 (~ 0.004 ZEC), NSM/no-NSM: 1.0024 +Years 84.. 88 at heights 38942982..40622982: + NSM subsidies: 90245698 (~ 0.902 ZEC, 0.00000054 ZEC per block) + no-NSM subsidies: 89666429 (~ 0.897 ZEC, 0.00000053 ZEC per block) + difference: 579269 (~ 0.006 ZEC), NSM/no-NSM: 1.0065 +Years 88.. 92 at heights 40622982..42302982: + NSM subsidies: 45126662 (~ 0.451 ZEC, 0.00000027 ZEC per block) + no-NSM subsidies: 44364923 (~ 0.444 ZEC, 0.00000026 ZEC per block) + difference: 761739 (~ 0.008 ZEC), NSM/no-NSM: 1.0172 +Years 92.. 96 at heights 42302982..43982982: + NSM subsidies: 22552905 (~ 0.226 ZEC, 0.00000013 ZEC per block) + no-NSM subsidies: 21810753 (~ 0.218 ZEC, 0.00000013 ZEC per block) + difference: 742152 (~ 0.007 ZEC), NSM/no-NSM: 1.0340 +Years 96..100 at heights 43982982..45662982: + NSM subsidies: 11280615 (~ 0.113 ZEC, 0.00000007 ZEC per block) + no-NSM subsidies: 10437085 (~ 0.104 ZEC, 0.00000006 ZEC per block) + difference: 843530 (~ 0.008 ZEC), NSM/no-NSM: 1.0808 +Years 100..104 at heights 45662982..47342982: + NSM subsidies: 5609808 (~ 0.056 ZEC, 0.00000003 ZEC per block) + no-NSM subsidies: 4846834 (~ 0.048 ZEC, 0.00000003 ZEC per block) + difference: 762974 (~ 0.008 ZEC), NSM/no-NSM: 1.1574 +Years 104..108 at heights 47342982..49022982: + NSM subsidies: 2702325 (~ 0.027 ZEC, 0.00000002 ZEC per block) + no-NSM subsidies: 2423417 (~ 0.024 ZEC, 0.00000001 ZEC per block) + difference: 278908 (~ 0.003 ZEC), NSM/no-NSM: 1.1151 +Years 108..112 at heights 49022982..50702982: + NSM subsidies: 1680000 (~ 0.017 ZEC, 0.00000001 ZEC per block) + no-NSM subsidies: 743417 (~ 0.007 ZEC, 0.00000000 ZEC per block) + difference: 936583 (~ 0.009 ZEC), NSM/no-NSM: 2.2598 ``` The program will also output PNG files with plots of the issuance curve in `plots/`: -![ZSF balance simulation](plots/zsf_balance.png) -![ZSF block subsidy simulation](plots/zsf_block_subsidy.png) +![NSM balance simulation](plots/nsm_balance.png) +![NSM block subsidy simulation](plots/nsm_block_subsidy.png) ## About this repo -This simulator is part of our larger efforts to implement the Zcash Sustainability Fund, watch the presentation [here](https://www.youtube.com/watch?v=_QSYgvDV33k) +This simulator is part of our larger efforts to implement the Network Sustainability Mechanism. +They are described in a ZconV presentation by Eiger and Shielded Labs (from when it was called the +Zcash Sustainability Fund) that is available [here](https://www.youtube.com/watch?v=_QSYgvDV33k). ## About [Eiger](https://www.eiger.co) -We are engineers. We contribute to various ecosystems by building low level implementations and core components. We believe in Zcash because privacy is critical to a well functioning society. +We are engineers. We contribute to various ecosystems by building low level implementations and +core components. We believe in Zcash because privacy is critical to a well functioning society. Contact us at hello@eiger.co Follow us on [X/Twitter](https://x.com/eiger_co) diff --git a/plots/nsm_balance.png b/plots/nsm_balance.png new file mode 100644 index 0000000..131600a Binary files /dev/null and b/plots/nsm_balance.png differ diff --git a/plots/nsm_block_subsidy.png b/plots/nsm_block_subsidy.png new file mode 100644 index 0000000..cfc26c6 Binary files /dev/null and b/plots/nsm_block_subsidy.png differ diff --git a/plots/zsf_balance.png b/plots/zsf_balance.png deleted file mode 100644 index 9f0e8e5..0000000 Binary files a/plots/zsf_balance.png and /dev/null differ diff --git a/plots/zsf_block_subsidy.png b/plots/zsf_block_subsidy.png deleted file mode 100644 index 435d8fc..0000000 Binary files a/plots/zsf_block_subsidy.png and /dev/null differ diff --git a/src/main.rs b/src/main.rs index e81c687..511684c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,134 +1,193 @@ use crate::plots::{generate_plots, PLOT_SAMPLING}; -pub const MAX_MONEY: i64 = 21_000_000; -const BLOCKS_PER_YEAR: u32 = 420_768; -const ZATOSHIS_PER_ZEC: i64 = 100_000_000; -// predicted ZEC supply at the next halving (block 2726400) -const INITIAL_SUPPLY: i64 = 1_574_963_454_129_680; -const INITIAL_SUBSIDIES: i64 = MAX_MONEY * ZATOSHIS_PER_ZEC - INITIAL_SUPPLY; +mod plots; -const BLOCK_SUBSIDY_NUMERATOR: i64 = 4126; -const BLOCK_SUBSIDY_DENOMINATOR: i64 = 10_000_000_000; +type Height = i64; // or height interval +type Zats = i64; -const POST_BLOSSOM_HALVING_INTERVAL: u32 = 1_680_000; -// block subsidy starting at the next halving (block 2726400) -const INITIAL_LEGACY_BLOCK_SUBSIDY: i64 = 50 * ZATOSHIS_PER_ZEC / 32; +pub const MAX_MONEY: Zats = 21_000_000; +const BLOCKS_PER_YEAR: i64 = 420_768; +const ZATOSHIS_PER_ZEC: Zats = 1_0000_0000; -mod plots; +const INITIAL_HALVING: usize = 2; +const INITIAL_HALVING_HEIGHT: Height = 2726400; -fn main() { - let (block, balance_points, zsf_reward_points, legacy_reward_points, halvings) = simulate(); +/// ZEC supply at INITIAL_HALVING. +/// The maximum possible supply at the second halving was 1_575_000_000_000_000. +/// The value below takes into account unclaimed mining rewards up to the second halving, +/// according to `zcash-cli getblock 2726399 | jq '.chainSupply'`. After the second +/// halving, which coincides with NU6 and activation of ZIP 236, there can be no further +/// unclaimed mining rewards. +const INITIAL_SUPPLY: Zats = 1_574_963_141_554_480; + +const INITIAL_SUBSIDIES: Zats = MAX_MONEY * ZATOSHIS_PER_ZEC - INITIAL_SUPPLY; - print_halving(halvings); +const NSM_BLOCK_SUBSIDY_NUMERATOR: i64 = 4126; +const NSM_BLOCK_SUBSIDY_DENOMINATOR: i64 = 10_000_000_000; - let years = block as f64 / BLOCKS_PER_YEAR as f64; +const POST_BLOSSOM_HALVING_INTERVAL: Height = 1_680_000; +// Block subsidy at INITIAL_HALVING_HEIGHT. +const INITIAL_NO_NSM_BLOCK_SUBSIDY: Zats = 12_5000_0000 / 8; + +fn to_zec(zatoshis: Zats) -> f64 { + zatoshis as f64 / ZATOSHIS_PER_ZEC as f64 +} + +fn years_after_initial(height: Height) -> f64 { + (height - INITIAL_HALVING_HEIGHT) as f64 / BLOCKS_PER_YEAR as f64 +} + +fn no_nsm_block_subsidy_for_height(height: Height) -> Zats { + assert!(height >= INITIAL_HALVING_HEIGHT); + let halving_after_initial = (height - INITIAL_HALVING_HEIGHT) / POST_BLOSSOM_HALVING_INTERVAL; + INITIAL_NO_NSM_BLOCK_SUBSIDY >> std::cmp::min(halving_after_initial, 63) +} + +struct Stats { + pub index: i64, + pub end_height: i64, + pub nsm_subsidies: i64, + pub no_nsm_subsidies: i64, +} + +impl Stats { + fn summary(self: &Stats) -> String { + let difference = self.nsm_subsidies - self.no_nsm_subsidies; + let ratio = self.nsm_subsidies as f64 / self.no_nsm_subsidies as f64; + let end_year = self.index * 4; + format!( + "Years {:>3}..{:>3} at heights {:>8}..{:>8}:\n \ + NSM subsidies: {:>15} (~{:>12.3} ZEC, {:>12.8} ZEC per block)\n \ + no-NSM subsidies: {:>15} (~{:>12.3} ZEC, {:>12.8} ZEC per block)\n \ + difference: {:>15} (~{:>12.3} ZEC), NSM/no-NSM: {:.4}", + end_year - 4, + end_year, + self.end_height - POST_BLOSSOM_HALVING_INTERVAL, + self.end_height, + self.nsm_subsidies, + to_zec(self.nsm_subsidies), + self.nsm_subsidies as f64 + / POST_BLOSSOM_HALVING_INTERVAL as f64 + / ZATOSHIS_PER_ZEC as f64, + self.no_nsm_subsidies, + to_zec(self.no_nsm_subsidies), + self.no_nsm_subsidies as f64 + / POST_BLOSSOM_HALVING_INTERVAL as f64 + / ZATOSHIS_PER_ZEC as f64, + difference, + to_zec(difference), + ratio + ) + } +} + +fn main() { + let (end_height, balance_points, nsm_reward_points, no_nsm_reward_points, four_year_stats) = + simulate(); + + print_four_year_stats(&four_year_stats); generate_plots( balance_points, - zsf_reward_points, - legacy_reward_points, - years, + nsm_reward_points, + no_nsm_reward_points, + years_after_initial(end_height), ); } +#[allow(clippy::type_complexity)] fn simulate() -> ( - u32, + Height, Vec<(f64, f64)>, Vec<(f64, f64)>, Vec<(f64, f64)>, - Vec, + Vec, ) { - let mut available_subsidies: i64 = INITIAL_SUBSIDIES; - let mut block: u32 = 0; + let mut available_subsidies: Zats = INITIAL_SUBSIDIES; + let mut height: Height = INITIAL_HALVING_HEIGHT; let mut balance_points: Vec<(f64, f64)> = Vec::new(); - let mut zsf_reward_points: Vec<(f64, f64)> = Vec::new(); - let mut legacy_reward_points: Vec<(f64, f64)> = Vec::new(); - let mut halvings: Vec = Vec::new(); - let mut halving_subsidies: i64 = 0; + let mut nsm_reward_points: Vec<(f64, f64)> = Vec::new(); + let mut no_nsm_reward_points: Vec<(f64, f64)> = Vec::new(); + let mut four_year_stats: Vec = Vec::new(); + let mut four_year_nsm_subsidies: Zats = 0; + let mut four_year_no_nsm_subsidies: Zats = 0; + let mut nsm_deployment_height: Option = None; while available_subsidies > 0 { - let block_subsidy = (available_subsidies * BLOCK_SUBSIDY_NUMERATOR - + (BLOCK_SUBSIDY_DENOMINATOR - 1)) - / BLOCK_SUBSIDY_DENOMINATOR; + let years = years_after_initial(height); + let nsm_block_subsidy = (available_subsidies * NSM_BLOCK_SUBSIDY_NUMERATOR + + (NSM_BLOCK_SUBSIDY_DENOMINATOR - 1)) + / NSM_BLOCK_SUBSIDY_DENOMINATOR; + + let no_nsm_block_subsidy = no_nsm_block_subsidy_for_height(height); + + if nsm_deployment_height.is_none() && nsm_block_subsidy < no_nsm_block_subsidy { + nsm_deployment_height = Some(height); + println!("DEPLOYMENT_BLOCK_HEIGHT = {height} ({years:.2} years after {INITIAL_HALVING}nd halving)"); + } + + let block_subsidy = if nsm_deployment_height.is_some() { + four_year_nsm_subsidies += nsm_block_subsidy; + four_year_no_nsm_subsidies += no_nsm_block_subsidy; + nsm_block_subsidy + } else { + no_nsm_block_subsidy + }; available_subsidies -= block_subsidy; - halving_subsidies += block_subsidy; if available_subsidies == 0 { println!( - "Last block is {} in ~{:.2} years\nFinal block subsidy: {} (~{} ZEC)\nFinal ZSF balance: {} (~{} ZEC)", - block, // current block - block as f64 / BLOCKS_PER_YEAR as f64, // ~ current year - block_subsidy, // block subsidy in zatoshis - block_subsidy / ZATOSHIS_PER_ZEC, // block subsidy in ZEC - available_subsidies, // available subsidies in zatoshis - available_subsidies / ZATOSHIS_PER_ZEC // available subsidies in ZEC + "Last block with non-zero subsidy is at height {} in ~{:.2} years after the {}nd halving.\n\ + Final block subsidy: {} (~{} ZEC)\n\ + Final NSM balance: {} (~{} ZEC)", + height, // current height + years, // ~ current year after initial halving + INITIAL_HALVING, // initial halving ordinal + block_subsidy, // block subsidy in zatoshis + to_zec(block_subsidy), // block subsidy in ZEC + available_subsidies, // available subsidies in zatoshis + to_zec(available_subsidies) // available subsidies in ZEC ); } - if block % PLOT_SAMPLING == 0 { - let block_float = block as f64 / BLOCKS_PER_YEAR as f64; - balance_points.push(( - block_float, - available_subsidies as f64 / ZATOSHIS_PER_ZEC as f64, - )); - - zsf_reward_points.push((block_float, block_subsidy as f64 / ZATOSHIS_PER_ZEC as f64)); - - legacy_reward_points.push(( - block_float, - ((INITIAL_LEGACY_BLOCK_SUBSIDY / 2_i64.pow(block / POST_BLOSSOM_HALVING_INTERVAL)) - as f64) - / ZATOSHIS_PER_ZEC as f64, - )); + if ((height - INITIAL_HALVING_HEIGHT) as u32) % PLOT_SAMPLING == 0 { + balance_points.push((years, to_zec(available_subsidies))); + nsm_reward_points.push((years, to_zec(block_subsidy))); + no_nsm_reward_points.push((years, to_zec(no_nsm_block_subsidy))); } - if block > 0 && block % POST_BLOSSOM_HALVING_INTERVAL == 0 { - halvings.push(halving_subsidies); - halving_subsidies = 0; + if let Some(h) = nsm_deployment_height { + if height > h && (height - h) % POST_BLOSSOM_HALVING_INTERVAL == 0 { + four_year_stats.push(Stats { + index: (height - h) / POST_BLOSSOM_HALVING_INTERVAL, + end_height: height, + nsm_subsidies: four_year_nsm_subsidies, + no_nsm_subsidies: four_year_no_nsm_subsidies, + }); + four_year_nsm_subsidies = 0; + four_year_no_nsm_subsidies = 0; + } } - block += 1; + height += 1; } ( - block, + height, balance_points, - zsf_reward_points, - legacy_reward_points, - halvings, + nsm_reward_points, + no_nsm_reward_points, + four_year_stats, ) } -fn print_halving(halvings: Vec) { +fn print_four_year_stats(four_year_stats: &Vec) { println!("#############################################"); - println!("Halvings:"); - - for (i, zsf_halving_subsidies) in halvings.iter().enumerate() { - let legacy_subsidy_per_block = INITIAL_LEGACY_BLOCK_SUBSIDY / 2_i64.pow(i as u32); - let legacy_halving_subsidies = legacy_subsidies_for_halving(i as u32); - let difference = zsf_halving_subsidies - legacy_halving_subsidies; - let ratio = *zsf_halving_subsidies as f64 / legacy_halving_subsidies as f64; - - println!( - "Halving {:>2} at block {:>8}:\n ZSF subsidies: {:>15} (~{:>12.3} ZEC, {:>12.3} ZEC per block)\n legacy subsidies: {:>15} (~{:>12.3} ZEC, {:>12.3} ZEC per block)\n difference: {:>15} (~{:>12.3} ZEC), ZSF/legacy: {:.4}", - i + 1, - (i + 1) as u32 * POST_BLOSSOM_HALVING_INTERVAL, - zsf_halving_subsidies, - *zsf_halving_subsidies as f64 / ZATOSHIS_PER_ZEC as f64, - *zsf_halving_subsidies as f64 / POST_BLOSSOM_HALVING_INTERVAL as f64 / ZATOSHIS_PER_ZEC as f64, - legacy_halving_subsidies, - legacy_halving_subsidies as f64 / ZATOSHIS_PER_ZEC as f64, - legacy_subsidy_per_block as f64 / ZATOSHIS_PER_ZEC as f64, - difference, - difference / ZATOSHIS_PER_ZEC, - ratio - ); + println!("Four-year periods:"); + + for stats in four_year_stats { + println!("{}", stats.summary()); } println!("#############################################"); } - -fn legacy_subsidies_for_halving(halving: u32) -> i64 { - let subsidy_for_halving = INITIAL_LEGACY_BLOCK_SUBSIDY / 2_i64.pow(halving); - POST_BLOSSOM_HALVING_INTERVAL as i64 * subsidy_for_halving -} diff --git a/src/plots.rs b/src/plots.rs index de08381..2d2c33a 100644 --- a/src/plots.rs +++ b/src/plots.rs @@ -4,17 +4,17 @@ use plotters::{ style::*, }; -use crate::MAX_MONEY; +use crate::INITIAL_HALVING; -const BALANCE_PLOT_PATH: &str = "plots/zsf_balance.png"; -const BLOCK_SUBSIDY_PLOT_PATH: &str = "plots/zsf_block_subsidy.png"; +const BALANCE_PLOT_PATH: &str = "plots/nsm_balance.png"; +const BLOCK_SUBSIDY_PLOT_PATH: &str = "plots/nsm_block_subsidy.png"; const PLOT_ZOOM: usize = 5; pub const PLOT_SAMPLING: u32 = 1000; pub fn generate_plots( balance_points: Vec<(f64, f64)>, - zsf_reward_points: Vec<(f64, f64)>, - legacy_reward_points: Vec<(f64, f64)>, + nsm_reward_points: Vec<(f64, f64)>, + no_nsm_reward_points: Vec<(f64, f64)>, years: f64, ) { balance_plot( @@ -23,8 +23,8 @@ pub fn generate_plots( ); block_subsidy_plot( - &zsf_reward_points[0..(balance_points.len() / PLOT_ZOOM)], - &legacy_reward_points[0..(balance_points.len() / PLOT_ZOOM)], + &nsm_reward_points[0..(balance_points.len() / PLOT_ZOOM)], + &no_nsm_reward_points[0..(balance_points.len() / PLOT_ZOOM)], years / PLOT_ZOOM as f64, ); } @@ -35,18 +35,18 @@ fn balance_plot(points: &[(f64, f64)], years: f64) { root.fill(&WHITE).unwrap(); let mut chart = ChartBuilder::on(&root) - .caption("ZSF balance", ("sans-serif", 50).into_font()) + .caption("NSM balance", ("sans-serif", 50).into_font()) .margin(50) .x_label_area_size(50) .y_label_area_size(50) - .build_cartesian_2d(0f64..years, 0f64..(MAX_MONEY as f64)) + .build_cartesian_2d(0f64..years, 0f64..6_000_000_f64) .unwrap(); chart .configure_mesh() .bold_line_style(WHITE.mix(0.3)) - .y_desc("ZSF balance in ZEC") - .x_desc("Years from activation") + .y_desc("NSM balance in ZEC") + .x_desc(format!("Years from {INITIAL_HALVING}nd halving")) .axis_desc_style(("sans-serif", 15)) .y_label_formatter(&|x| format!("{}M", x / 1_000_000_f64)) .draw() @@ -62,8 +62,8 @@ fn balance_plot(points: &[(f64, f64)], years: f64) { } fn block_subsidy_plot( - zsf_reward_points: &[(f64, f64)], - legacy_reward_points: &[(f64, f64)], + nsm_reward_points: &[(f64, f64)], + no_nsm_reward_points: &[(f64, f64)], years: f64, ) { let root = BitMapBackend::new(BLOCK_SUBSIDY_PLOT_PATH, (1024, 768)).into_drawing_area(); @@ -72,35 +72,35 @@ fn block_subsidy_plot( let mut chart = ChartBuilder::on(&root) .caption( - "Block subsidies - ZSF vs current", + "Block subsidies - NSM vs current", ("sans-serif", 50).into_font(), ) .margin(50) .x_label_area_size(50) .y_label_area_size(50) - .build_cartesian_2d(0f64..years, 0f64..5f64) + .build_cartesian_2d(0f64..years, 0f64..2f64) .unwrap(); chart .configure_mesh() .bold_line_style(WHITE.mix(0.3)) .y_desc("Block subsidy in ZEC") - .x_desc("Years from activation") + .x_desc(format!("Years from {INITIAL_HALVING}nd halving")) .axis_desc_style(("sans-serif", 15)) .draw() .unwrap(); - let zsf_series = LineSeries::new(zsf_reward_points.to_owned(), &RED); - let legacy_series = LineSeries::new(legacy_reward_points.to_owned(), &BLUE); + let nsm_series = LineSeries::new(nsm_reward_points.to_owned(), &RED); + let no_nsm_series = LineSeries::new(no_nsm_reward_points.to_owned(), &BLUE); chart - .draw_series(zsf_series) + .draw_series(nsm_series) .unwrap() - .label("ZSF Smooth Issuance") + .label("NSM Smooth Issuance") .legend(|(x, y)| PathElement::new(vec![(x, y), (x + 20, y)], RED)); chart - .draw_series(legacy_series) + .draw_series(no_nsm_series) .unwrap() .label("Current issuance") .legend(|(x, y)| PathElement::new(vec![(x, y), (x + 20, y)], BLUE));