diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a417ef83738..b94f95430d4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -109,6 +109,22 @@ jobs: - macOS-latest # - windows-latest steps: + - name: Free Disk Space (Ubuntu) + if: runner.os == 'Linux' + uses: jlumbroso/free-disk-space@main + with: + # this might remove tools that are actually needed, + # if set to "true" but frees about 6 GB + tool-cache: false + + # all of these default to true, but feel free to set to + # "false" if necessary for your workflow + android: true + dotnet: true + haskell: true + large-packages: false + docker-images: true + swap-storage: true - uses: ilammy/setup-nasm@v1 - uses: actions/checkout@v3 with: diff --git a/Cargo.lock b/Cargo.lock index 208497e2c4c..a6900b0e321 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -75,15 +75,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "aho-corasick" -version = "0.7.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" -dependencies = [ - "memchr", -] - [[package]] name = "aho-corasick" version = "1.0.2" @@ -125,9 +116,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.71" +version = "1.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" +checksum = "3b13c32d80ecc7ab747b80c3784bce54ee8a7a0cc4fbda9bf4cda2cf6fe90854" [[package]] name = "arrayref" @@ -144,7 +135,7 @@ checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "as-ffi-bindings" version = "0.2.5" -source = "git+https://github.com/massalabs/as-ffi-bindings.git?tag=v0.4.0#7767634dfc22407bd2b0fa0e4fd7432231b10dd7" +source = "git+https://github.com/massalabs/as-ffi-bindings.git?tag=0.5.0#512792515055573e600c0054a4b44bbcbfeb779a" dependencies = [ "anyhow", "wasmer", @@ -176,20 +167,20 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", - "syn 2.0.23", + "proc-macro2 1.0.66", + "quote 1.0.32", + "syn 2.0.27", ] [[package]] name = "async-trait" -version = "0.1.70" +version = "0.1.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79fa67157abdfd688a259b6648808757db9347af834624f27ec646da976aee5d" +checksum = "cc6dde6e4ed435a4c1ee4e73592f5ba9da2151af10076cc04858746af9352d09" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", - "syn 2.0.23", + "proc-macro2 1.0.66", + "quote 1.0.32", + "syn 2.0.27", ] [[package]] @@ -211,9 +202,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "axum" -version = "0.6.18" +version = "0.6.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8175979259124331c1d7bf6586ee7e0da434155e4b2d48ec2c8386281d8df39" +checksum = "a6a1de45611fdb535bfde7b7de4fd54f4fd2b17b1737c0a59b69bf9b92074b8c" dependencies = [ "async-trait", "axum-core", @@ -308,8 +299,8 @@ dependencies = [ "lazy_static", "lazycell", "peeking_take_while", - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "regex", "rustc-hash", "shlex", @@ -392,7 +383,7 @@ dependencies = [ "borsh-derive-internal", "borsh-schema-derive-internal", "proc-macro-crate 0.1.5", - "proc-macro2 1.0.63", + "proc-macro2 1.0.66", "syn 1.0.109", ] @@ -402,8 +393,8 @@ version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "afb438156919598d2c7bad7e1c0adf3d26ed3840dbc010db1a882a65583ca2fb" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", ] @@ -413,8 +404,8 @@ version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "634205cc43f74a1b9046ef87c4540ebda95696ec0f315024860cad7c5b0f5ccd" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", ] @@ -429,9 +420,9 @@ dependencies = [ [[package]] name = "bstr" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a246e68bb43f6cd9db24bea052a53e40405417c5fb372e3d1a8a7f770a564ef5" +checksum = "6798148dccfbff0fae41c7574d2fa8f1ef3492fba0face179de5d8d447d67b05" dependencies = [ "memchr", "serde", @@ -460,8 +451,8 @@ version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7ec4c6f261935ad534c0c22dbef2201b45918860eb1c574b972bd213a76af61" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", ] @@ -983,12 +974,12 @@ dependencies = [ [[package]] name = "darling" -version = "0.20.1" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0558d22a7b463ed0241e993f76f09f30b126687447751a8638587b864e4b3944" +checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e" dependencies = [ - "darling_core 0.20.1", - "darling_macro 0.20.1", + "darling_core 0.20.3", + "darling_macro 0.20.3", ] [[package]] @@ -999,24 +990,24 @@ checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0" dependencies = [ "fnv", "ident_case", - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "strsim 0.10.0", "syn 1.0.109", ] [[package]] name = "darling_core" -version = "0.20.1" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab8bfa2e259f8ee1ce5e97824a3c55ec4404a0d772ca7fa96bf19f0752a046eb" +checksum = "177e3443818124b357d8e76f53be906d60937f0d3a90773a664fa63fa253e621" dependencies = [ "fnv", "ident_case", - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "strsim 0.10.0", - "syn 2.0.23", + "syn 2.0.27", ] [[package]] @@ -1026,29 +1017,29 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e" dependencies = [ "darling_core 0.14.4", - "quote 1.0.29", + "quote 1.0.32", "syn 1.0.109", ] [[package]] name = "darling_macro" -version = "0.20.1" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29a358ff9f12ec09c3e61fef9b5a9902623a695a46a917b07f269bff1445611a" +checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ - "darling_core 0.20.1", - "quote 1.0.29", - "syn 2.0.23", + "darling_core 0.20.3", + "quote 1.0.32", + "syn 2.0.27", ] [[package]] name = "dashmap" -version = "5.4.0" +version = "5.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "907076dfda823b0b36d2a1bb5f90c96660a5bbcd7729e10727f07858f22c4edc" +checksum = "6943ae99c34386c84a470c499d3414f66502a41340aa895406e0d2e4a207b91d" dependencies = [ "cfg-if", - "hashbrown 0.12.3", + "hashbrown 0.14.0", "lock_api", "once_cell", "parking_lot_core", @@ -1060,8 +1051,8 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", ] @@ -1150,9 +1141,9 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", - "syn 2.0.23", + "proc-macro2 1.0.66", + "quote 1.0.32", + "syn 2.0.27", ] [[package]] @@ -1177,8 +1168,8 @@ dependencies = [ "byteorder", "lazy_static", "proc-macro-error", - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", ] @@ -1219,9 +1210,9 @@ dependencies = [ [[package]] name = "either" -version = "1.8.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "encode_unicode" @@ -1250,8 +1241,8 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c134c37760b27a871ba422106eedbb8247da973a09e82558bf26d619c882b159" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", ] @@ -1262,8 +1253,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8ea75f31022cba043afe037940d73684327e915f88f62478e778c3de914cd0a" dependencies = [ "enum_delegate_lib", - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", ] @@ -1273,8 +1264,8 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e1f6c3800b304a6be0012039e2a45a322a093539c45ab818d9e6895a39c90fe" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "rand 0.8.5", "syn 1.0.109", ] @@ -1294,23 +1285,23 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e08b6c6ab82d70f08844964ba10c7babb716de2ecaeab9be5717918a5177d3af" dependencies = [ - "darling 0.20.1", - "proc-macro2 1.0.63", - "quote 1.0.29", - "syn 2.0.23", + "darling 0.20.3", + "proc-macro2 1.0.66", + "quote 1.0.32", + "syn 2.0.27", ] [[package]] name = "equivalent" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88bffebc5d80432c9b140ee17875ff173a8ab62faad5b257da912bd2f6c1c0a1" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "erased-serde" -version = "0.3.27" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f94c0e13118e7d7533271f754a168ae8400e6a1cc043f2bfd53cc7290f1a1de3" +checksum = "da96524cc884f6558f1769b6c46686af2fe8e8b4cd253bd5a3cdba8181b8e070" dependencies = [ "serde", ] @@ -1360,12 +1351,9 @@ checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" [[package]] name = "fastrand" -version = "1.9.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" -dependencies = [ - "instant", -] +checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" [[package]] name = "fd-lock" @@ -1374,7 +1362,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef033ed5e9bad94e55838ca0ca906db0e043f517adda0c8b79c7a8c66c93c1b5" dependencies = [ "cfg-if", - "rustix 0.38.3", + "rustix 0.38.4", "windows-sys 0.48.0", ] @@ -1499,9 +1487,9 @@ version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", - "syn 2.0.23", + "proc-macro2 1.0.66", + "quote 1.0.32", + "syn 2.0.27", ] [[package]] @@ -1620,11 +1608,11 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "globset" -version = "0.4.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "029d74589adefde59de1a0c4f4732695c32805624aec7b68d91503d4dba79afc" +checksum = "1391ab1f92ffcc08911957149833e682aa3fe252b9f45f966d2ef972274c97df" dependencies = [ - "aho-corasick 0.7.20", + "aho-corasick", "bstr", "fnv", "log", @@ -1633,14 +1621,15 @@ dependencies = [ [[package]] name = "gloo-net" -version = "0.2.6" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9902a044653b26b99f7e3693a42f171312d9be8b26b5697bd1e43ad1f8a35e10" +checksum = "a66b4e3c7d9ed8d315fd6b97c8b1f74a7c6ecbbc2320e65ae7ed38b7068cc620" dependencies = [ "futures-channel", "futures-core", "futures-sink", "gloo-utils", + "http", "js-sys", "pin-project", "serde", @@ -1840,9 +1829,9 @@ dependencies = [ [[package]] name = "http-range-header" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bfe8eed0a9285ef776bb792479ea3834e8b94e13d615c2f66d03dd50a435a29" +checksum = "add0ab9360ddbd88cfeb3bd9574a1d85cfdfa14db10b3e21d3700dbc4328758f" [[package]] name = "httparse" @@ -1900,7 +1889,7 @@ dependencies = [ "rustls-native-certs", "tokio", "tokio-rustls", - "webpki-roots", + "webpki-roots 0.23.1", ] [[package]] @@ -1984,15 +1973,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if", -] - [[package]] name = "io-lifetimes" version = "1.0.11" @@ -2015,9 +1995,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b02a5381cc465bd3041d84623d0fa3b66738b52b8e2fc3bab8ad63ab032f4a" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "jobserver" @@ -2050,9 +2030,9 @@ dependencies = [ [[package]] name = "jsonrpsee" -version = "0.18.2" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1822d18e4384a5e79d94dc9e4d1239cfa9fad24e55b44d2efeff5b394c9fece4" +checksum = "e5f3783308bddc49d0218307f66a09330c106fbd792c58bac5c8dc294fdd0f98" dependencies = [ "jsonrpsee-client-transport", "jsonrpsee-core", @@ -2067,9 +2047,9 @@ dependencies = [ [[package]] name = "jsonrpsee-client-transport" -version = "0.18.2" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11aa5766d5c430b89cb26a99b88f3245eb91534be8126102cea9e45ee3891b22" +checksum = "abc5630e4fa0096f00ec7b44d520701fda4504170cb85e22dca603ae5d7ad0d7" dependencies = [ "futures-channel", "futures-util", @@ -2084,14 +2064,14 @@ dependencies = [ "tokio-rustls", "tokio-util", "tracing", - "webpki-roots", + "webpki-roots 0.24.0", ] [[package]] name = "jsonrpsee-core" -version = "0.18.2" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64c6832a55f662b5a6ecc844db24b8b9c387453f923de863062c60ce33d62b81" +checksum = "5aaa4c4d5fb801dcc316d81f76422db259809037a86b3194ae538dd026b05ed7" dependencies = [ "anyhow", "async-lock", @@ -2117,9 +2097,9 @@ dependencies = [ [[package]] name = "jsonrpsee-http-client" -version = "0.18.2" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1705c65069729e3dccff6fd91ee431d5d31cabcf00ce68a62a2c6435ac713af9" +checksum = "aa7165efcbfbc951d180162ff28fe91b657ed81925e37a35e4a396ce12109f96" dependencies = [ "async-trait", "hyper", @@ -2136,22 +2116,22 @@ dependencies = [ [[package]] name = "jsonrpsee-proc-macros" -version = "0.18.2" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6027ac0b197ce9543097d02a290f550ce1d9432bf301524b013053c0b75cc94" +checksum = "21dc12b1d4f16a86e8c522823c4fab219c88c03eb7c924ec0501a64bf12e058b" dependencies = [ "heck 0.4.1", "proc-macro-crate 1.3.1", - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", ] [[package]] name = "jsonrpsee-server" -version = "0.18.2" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f06661d1a6b6e5b85469dc9c29acfbb9b3bb613797a6fd10a3ebb8a70754057" +checksum = "6e79d78cfd5abd8394da10753723093c3ff64391602941c9c4b1d80a3414fd53" dependencies = [ "futures-util", "hyper", @@ -2169,9 +2149,9 @@ dependencies = [ [[package]] name = "jsonrpsee-types" -version = "0.18.2" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e5bf6c75ce2a4217421154adfc65a24d2b46e77286e59bba5d9fa6544ccc8f4" +checksum = "00aa7cc87bc42e04e26c8ac3e7186142f7fd2949c763d9b6a7e64a69672d8fb2" dependencies = [ "anyhow", "beef", @@ -2183,9 +2163,9 @@ dependencies = [ [[package]] name = "jsonrpsee-wasm-client" -version = "0.18.2" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34e6ea7c6d862e60f8baebd946c037b70c6808a4e4e31e792a4029184e3ce13a" +checksum = "0fe953c2801356f214d3f4051f786b3d11134512a46763ee8c39a9e3fa2cc1c0" dependencies = [ "jsonrpsee-client-transport", "jsonrpsee-core", @@ -2194,9 +2174,9 @@ dependencies = [ [[package]] name = "jsonrpsee-ws-client" -version = "0.18.2" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a64b2589680ba1ad7863f279cd2d5083c1dc0a7c0ea959d22924553050f8ab9f" +checksum = "5c71b2597ec1c958c6d5bc94bb61b44d74eb28e69dc421731ab0035706f13882" dependencies = [ "http", "jsonrpsee-client-transport", @@ -2319,9 +2299,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.9" +version = "1.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56ee889ecc9568871456d42f603d6a0ce59ff328d291063a45cbdf0036baf6db" +checksum = "d97137b25e321a73eef1418d1d5d2eda4d77e12813f8e6dead84bc52c5870a7b" dependencies = [ "cc", "pkg-config", @@ -2340,12 +2320,6 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" -[[package]] -name = "linux-raw-sys" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" - [[package]] name = "linux-raw-sys" version = "0.4.3" @@ -2384,7 +2358,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0fbfc88337168279f2e9ae06e157cfed4efd3316e14dc96ed074d4f2e6c5952" dependencies = [ - "quote 1.0.29", + "quote 1.0.32", "syn 1.0.109", ] @@ -2511,7 +2485,7 @@ dependencies = [ [[package]] name = "massa-proto-rs" version = "0.1.0" -source = "git+https://github.com/massalabs/massa-proto-rs?rev=18ec02f#18ec02ff5bccedc64b3788964e9d78ccb9559567" +source = "git+https://github.com/massalabs/massa-proto-rs?rev=32179e2#32179e291bb1ad521d362390318d7dad80c04026" dependencies = [ "glob", "prost", @@ -2524,7 +2498,7 @@ dependencies = [ [[package]] name = "massa-sc-runtime" version = "0.10.0" -source = "git+https://github.com/massalabs/massa-sc-runtime?branch=main#ca2c7f1b4e5fb24764f9f34bd38c70bfd6aa526a" +source = "git+https://github.com/massalabs/massa-sc-runtime?branch=main#a2ad6ea81ee6ad7b217319667529fa17410a07b4" dependencies = [ "anyhow", "as-ffi-bindings", @@ -2535,7 +2509,7 @@ dependencies = [ "glob", "loupe", "more-asserts 0.3.1", - "num_enum", + "num_enum 0.6.1", "parking_lot", "prost", "prost-build", @@ -2544,7 +2518,7 @@ dependencies = [ "regex", "serde", "serde_json", - "serial_test 1.0.0", + "serial_test 2.0.0", "sha2 0.10.6", "thiserror", "tracing", @@ -2663,7 +2637,7 @@ dependencies = [ "mockall", "nom", "num", - "num_enum", + "num_enum 0.5.11", "parking_lot", "rand 0.8.5", "serde", @@ -2934,8 +2908,8 @@ dependencies = [ "futures-util", "h2", "hyper", - "itertools", "massa-proto-rs", + "massa_bootstrap", "massa_channel", "massa_consensus_exports", "massa_execution_exports", @@ -2945,11 +2919,13 @@ dependencies = [ "massa_pos_exports", "massa_protocol_exports", "massa_serialization", + "massa_signature", "massa_storage", "massa_time", "massa_versioning", "massa_wallet", "num", + "parking_lot", "serde", "thiserror", "tokio", @@ -2990,7 +2966,7 @@ dependencies = [ "massa_models", "massa_serialization", "nom", - "num_enum", + "num_enum 0.5.11", "serde", "serde_json", "tempfile", @@ -3050,7 +3026,7 @@ dependencies = [ "massa_time", "nom", "num", - "num_enum", + "num_enum 0.5.11", "rust_decimal", "serde", "serde_with", @@ -3070,7 +3046,7 @@ dependencies = [ "massa_models", "massa_serialization", "nom", - "num_enum", + "num_enum 0.5.11", "rand 0.8.5", "rocksdb", "schnellru", @@ -3195,7 +3171,7 @@ dependencies = [ "massa_versioning", "nom", "num", - "num_enum", + "num_enum 0.5.11", "parking_lot", "peernet", "rand 0.8.5", @@ -3269,6 +3245,7 @@ name = "massa_time" version = "0.24.0" dependencies = [ "displaydoc", + "massa-proto-rs", "massa_serialization", "nom", "serde", @@ -3292,7 +3269,7 @@ dependencies = [ "more-asserts 0.3.1", "nom", "num", - "num_enum", + "num_enum 0.5.11", "parking_lot", "tempfile", "thiserror", @@ -3430,8 +3407,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22ce75669015c4f47b289fd4d4f56e894e4c96003ffdf3ac51313126f94c6cbb" dependencies = [ "cfg-if", - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", ] @@ -3514,9 +3491,9 @@ dependencies = [ [[package]] name = "num" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43db66d1170d347f9a065114077f7dccb00c1b9478c89384490a3425279a4606" +checksum = "b05180d69e3da0e530ba2a1dae5110317e49e3b7f3d41be227dc5f92e49ee7af" dependencies = [ "num-bigint", "num-complex", @@ -3584,9 +3561,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" dependencies = [ "autocfg", "libm", @@ -3608,7 +3585,16 @@ version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" dependencies = [ - "num_enum_derive", + "num_enum_derive 0.5.11", +] + +[[package]] +name = "num_enum" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a015b430d3c108a207fd776d2e2196aaf8b1cf8cf93253e3a097ff3085076a1" +dependencies = [ + "num_enum_derive 0.6.1", ] [[package]] @@ -3618,11 +3604,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799" dependencies = [ "proc-macro-crate 1.3.1", - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", ] +[[package]] +name = "num_enum_derive" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96667db765a921f7b295ffee8b60472b686a51d4f21c2ee4ffdb94c7013b65a6" +dependencies = [ + "proc-macro-crate 1.3.1", + "proc-macro2 1.0.66", + "quote 1.0.32", + "syn 2.0.27", +] + [[package]] name = "object" version = "0.28.4" @@ -3761,8 +3759,8 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f35583365be5d148e959284f42526841917b7bfa09e2d1a7ad5dde2cf0eaa39" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", ] @@ -3814,9 +3812,9 @@ checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pest" -version = "2.7.0" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f73935e4d55e2abf7f130186537b19e7a4abc886a0252380b59248af473a3fc9" +checksum = "0d2d1d55045829d65aad9d389139882ad623b33b904e7c9f1b10c5b8927298e5" dependencies = [ "thiserror", "ucd-trie", @@ -3824,9 +3822,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.7.0" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aef623c9bbfa0eedf5a0efba11a5ee83209c326653ca31ff019bec3a95bfff2b" +checksum = "5f94bca7e7a599d89dea5dfa309e217e7906c3c007fb9c3299c40b10d6a315d3" dependencies = [ "pest", "pest_generator", @@ -3834,22 +3832,22 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.0" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3e8cba4ec22bada7fc55ffe51e2deb6a0e0db2d0b7ab0b103acc80d2510c190" +checksum = "99d490fe7e8556575ff6911e45567ab95e71617f43781e5c05490dc8d75c965c" dependencies = [ "pest", "pest_meta", - "proc-macro2 1.0.63", - "quote 1.0.29", - "syn 2.0.23", + "proc-macro2 1.0.66", + "quote 1.0.32", + "syn 2.0.27", ] [[package]] name = "pest_meta" -version = "2.7.0" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01f71cb40bd8bb94232df14b946909e14660e33fc05db3e50ae2a82d7ea0ca0" +checksum = "2674c66ebb4b4d9036012091b537aae5878970d6999f81a265034d85b136b341" dependencies = [ "once_cell", "pest", @@ -3881,9 +3879,9 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec2e072ecce94ec471b13398d5402c188e76ac03cf74dd1a975161b23a3f6d9c" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", - "syn 2.0.23", + "proc-macro2 1.0.66", + "quote 1.0.32", + "syn 2.0.27", ] [[package]] @@ -3986,7 +3984,7 @@ version = "0.1.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c8646e95016a7a6c4adea95bafa8a16baab64b583356217f2c85db4a39d9a86" dependencies = [ - "proc-macro2 1.0.63", + "proc-macro2 1.0.66", "syn 1.0.109", ] @@ -4016,8 +4014,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" dependencies = [ "proc-macro-error-attr", - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", "version_check", ] @@ -4028,8 +4026,8 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "version_check", ] @@ -4044,9 +4042,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.63" +version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" +checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" dependencies = [ "unicode-ident", ] @@ -4121,8 +4119,8 @@ checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" dependencies = [ "anyhow", "itertools", - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", ] @@ -4156,8 +4154,8 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", ] @@ -4189,11 +4187,11 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.29" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "573015e8ab27661678357f27dc26460738fd2b6c86e46f386fde94cb5d913105" +checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" dependencies = [ - "proc-macro2 1.0.63", + "proc-macro2 1.0.66", ] [[package]] @@ -4367,11 +4365,11 @@ dependencies = [ [[package]] name = "regex" -version = "1.9.0" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89089e897c013b3deb627116ae56a6955a72b8bed395c9526af31c9fe528b484" +checksum = "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575" dependencies = [ - "aho-corasick 1.0.2", + "aho-corasick", "memchr", "regex-automata", "regex-syntax", @@ -4379,20 +4377,20 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.0" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa250384981ea14565685dea16a9ccc4d1c541a13f82b9c168572264d1df8c56" +checksum = "39354c10dd07468c2e73926b23bb9c2caca74c5501e38a35da70406f1d923310" dependencies = [ - "aho-corasick 1.0.2", + "aho-corasick", "memchr", "regex-syntax", ] [[package]] name = "regex-syntax" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ab07dc67230e4a4718e70fd5c20055a4334b121f1f9db8fe63ef39ce9b8c846" +checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" [[package]] name = "region" @@ -4454,8 +4452,8 @@ version = "0.7.42" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2e06b915b5c230a17d7a736d1e2e63ee753c256a8614ef3f5147b13a4f5541d" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", ] @@ -4536,23 +4534,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.37.23" +version = "0.38.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d69718bf81c6127a49dc64e44a742e8bb9213c0ff8869a22c308f84c1d4ab06" -dependencies = [ - "bitflags 1.3.2", - "errno", - "io-lifetimes", - "libc", - "linux-raw-sys 0.3.8", - "windows-sys 0.48.0", -] - -[[package]] -name = "rustix" -version = "0.38.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac5ffa1efe7548069688cd7028f32591853cd7b5b756d41bcffd2353e4fc75b4" +checksum = "0a962918ea88d644592894bc6dc55acc6c0956488adcebbfb6e273506b7fd6e5" dependencies = [ "bitflags 2.3.3", "errno", @@ -4563,13 +4547,13 @@ dependencies = [ [[package]] name = "rustls" -version = "0.21.2" +version = "0.21.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e32ca28af694bc1bbf399c33a516dbdf1c90090b8ab23c2bc24f834aa2247f5f" +checksum = "79ea77c539259495ce8ca47f53e66ae0330a8819f67e23ac96ca02f50e7b7d36" dependencies = [ "log", "ring", - "rustls-webpki", + "rustls-webpki 0.101.2", "sct", ] @@ -4604,11 +4588,21 @@ dependencies = [ "untrusted", ] +[[package]] +name = "rustls-webpki" +version = "0.101.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "513722fd73ad80a71f72b61009ea1b584bcfa1483ca93949c8f290298837fa59" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "rustversion" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc31bd9b61a32c31f9650d18add92aa83a49ba979c143eefd27fe7177b05bd5f" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" [[package]] name = "rustyline" @@ -4639,16 +4633,16 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "107c3d5d7f370ac09efa62a78375f94d94b8a33c61d8c278b96683fb4dbf2d8d" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", ] [[package]] name = "ryu" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe232bdf6be8c8de797b22184ee71118d63780ea42ac85b61d1baa6d3b782ae9" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "same-file" @@ -4681,9 +4675,9 @@ dependencies = [ [[package]] name = "scopeguard" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "sct" @@ -4703,9 +4697,9 @@ checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" [[package]] name = "security-framework" -version = "2.9.1" +version = "2.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fc758eb7bffce5b308734e9b0c1468893cae9ff70ebf13e7090be8dcbcc83a8" +checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" dependencies = [ "bitflags 1.3.2", "core-foundation", @@ -4716,9 +4710,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.9.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f51d0c0d83bec45f16480d0ce0058397a69e48fcdc52d1dc8855fb68acbd31a7" +checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" dependencies = [ "core-foundation-sys", "libc", @@ -4732,9 +4726,9 @@ checksum = "f638d531eccd6e23b980caf34876660d38e265409d8e99b397ab71eb3612fad0" [[package]] name = "serde" -version = "1.0.166" +version = "1.0.175" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d01b7404f9d441d3ad40e6a636a7782c377d2abdbe4fa2440e2edcc2f4f10db8" +checksum = "5d25439cd7397d044e2748a6fe2432b5e85db703d6d097bd014b3c0ad1ebff0b" dependencies = [ "serde_derive", ] @@ -4752,20 +4746,20 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.166" +version = "1.0.175" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dd83d6dde2b6b2d466e14d9d1acce8816dedee94f735eac6395808b3483c6d6" +checksum = "b23f7ade6f110613c0d63858ddb8b94c1041f550eab58a16b371bdf2c9c80ab4" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", - "syn 2.0.23", + "proc-macro2 1.0.66", + "quote 1.0.32", + "syn 2.0.27", ] [[package]] name = "serde_json" -version = "1.0.100" +version = "1.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f1e14e89be7aa4c4b78bdbdc9eb5bf8517829a600ae8eaa39a6e1d960b5185c" +checksum = "d03b412469450d4404fe8499a268edd7f8b79fecb074b0d812ad64ca21f4031b" dependencies = [ "itoa", "ryu", @@ -4805,10 +4799,10 @@ version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "881b6f881b17d13214e5d494c939ebab463d01264ce1811e9d4ac3a882e7695f" dependencies = [ - "darling 0.20.1", - "proc-macro2 1.0.63", - "quote 1.0.29", - "syn 2.0.23", + "darling 0.20.3", + "proc-macro2 1.0.66", + "quote 1.0.32", + "syn 2.0.27", ] [[package]] @@ -4845,8 +4839,8 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "079a83df15f85d89a68d64ae1238f142f172b1fa915d0d76b26a7cba1b659a69" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", ] @@ -4856,9 +4850,9 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91d129178576168c589c9ec973feedf7d3126c01ac2bf08795109aa35b69fb8f" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", - "syn 2.0.23", + "proc-macro2 1.0.66", + "quote 1.0.32", + "syn 2.0.27", ] [[package]] @@ -4967,9 +4961,9 @@ checksum = "826167069c09b99d56f31e9ae5c99049e932a98c9dc2dac47645b08dbbf76ba7" [[package]] name = "smallvec" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" [[package]] name = "socket2" @@ -5053,8 +5047,8 @@ checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0" dependencies = [ "heck 0.3.3", "proc-macro-error", - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", ] @@ -5074,8 +5068,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" dependencies = [ "heck 0.4.1", - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "rustversion", "syn 1.0.109", ] @@ -5085,7 +5079,7 @@ name = "substruct" version = "0.1.0" source = "git+https://github.com/sydhds/substruct#2fb3ae0dc9d913a0566ce6415eaa7a7ca1690fe1" dependencies = [ - "quote 1.0.29", + "quote 1.0.32", "syn 1.0.109", ] @@ -5112,19 +5106,19 @@ version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "unicode-ident", ] [[package]] name = "syn" -version = "2.0.23" +version = "2.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59fb7d6d8281a51045d62b8eb3a7d1ce347b76f312af50cd3dc0af39c87c1737" +checksum = "b60f673f44a8255b9c8c657daf66a596d435f2da81a555b06dc644d080ba45e0" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "unicode-ident", ] @@ -5142,21 +5136,20 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "target-lexicon" -version = "0.12.8" +version = "0.12.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1c7f239eb94671427157bd93b3694320f3668d4e1eff08c7285366fd777fac" +checksum = "1d2faeef5759ab89935255b1a4cd98e0baf99d1085e37d36599c625dac49ae8e" [[package]] name = "tempfile" -version = "3.6.0" +version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" +checksum = "5486094ee78b2e5038a6382ed7645bc084dc2ec433426ca4c3cb61e2007b8998" dependencies = [ - "autocfg", "cfg-if", "fastrand", "redox_syscall 0.3.5", - "rustix 0.37.23", + "rustix 0.38.4", "windows-sys 0.48.0", ] @@ -5183,22 +5176,22 @@ checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" [[package]] name = "thiserror" -version = "1.0.41" +version = "1.0.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c16a64ba9387ef3fdae4f9c1a7f07a0997fce91985c0336f1ddc1822b3b37802" +checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.41" +version = "1.0.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d14928354b01c4d6a4f0e549069adef399a284e7995c7ccca94e8a07a5346c59" +checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", - "syn 2.0.23", + "proc-macro2 1.0.66", + "quote 1.0.32", + "syn 2.0.27", ] [[package]] @@ -5224,9 +5217,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.22" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea9e1b3cf1243ae005d9e74085d4d542f3125458f3a81af210d901dcd7411efd" +checksum = "59e399c068f43a5d116fedaf73b203fa4f9c519f17e2b34f63221d3792f81446" dependencies = [ "itoa", "serde", @@ -5242,9 +5235,9 @@ checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" [[package]] name = "time-macros" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "372950940a5f07bf38dbe211d7283c9e6d7327df53794992d293e534c733d09b" +checksum = "96ba15a897f3c86766b757e5ac7221554c6750054d74d5b28844fce5fb36a6c4" dependencies = [ "time-core", ] @@ -5310,9 +5303,9 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", - "syn 2.0.23", + "proc-macro2 1.0.66", + "quote 1.0.32", + "syn 2.0.27", ] [[package]] @@ -5369,9 +5362,9 @@ checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" [[package]] name = "toml_edit" -version = "0.19.11" +version = "0.19.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266f016b7f039eec8a1a80dfe6156b633d208b9fccca5e4db1d6775b0c4e34a7" +checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" dependencies = [ "indexmap 2.0.0", "toml_datetime", @@ -5417,9 +5410,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a6fdaae4c2c638bb70fe42803a26fbd6fc6ac8c72f5c59f67ecc2a2dcabf4b07" dependencies = [ "prettyplease", - "proc-macro2 1.0.63", + "proc-macro2 1.0.66", "prost-build", - "quote 1.0.29", + "quote 1.0.32", "syn 1.0.109", ] @@ -5492,9 +5485,9 @@ dependencies = [ [[package]] name = "tower-http" -version = "0.4.1" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8bd22a874a2d0b70452d5597b12c537331d49060824a95f49f108994f94aa4c" +checksum = "55ae70283aba8d2a8b411c695c437fe25b8b5e44e23e780662002fc72fb47a82" dependencies = [ "bitflags 2.3.3", "bytes", @@ -5539,9 +5532,9 @@ version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", - "syn 2.0.23", + "proc-macro2 1.0.66", + "quote 1.0.32", + "syn 2.0.27", ] [[package]] @@ -5593,8 +5586,8 @@ version = "0.1.0" source = "git+https://github.com/massalabs/transition.git?rev=93fa3bf82f9f5ff421c78536879b7fd1b948ca75#93fa3bf82f9f5ff421c78536879b7fd1b948ca75" dependencies = [ "darling 0.14.4", - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", "unsigned-varint", ] @@ -5613,9 +5606,9 @@ checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" [[package]] name = "ucd-trie" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81" +checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" [[package]] name = "unicode-bidi" @@ -5625,9 +5618,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22049a19f4a68748a168c0fc439f9516686aa045927ff767eca0a85101fb6e73" +checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" [[package]] name = "unicode-normalization" @@ -5699,9 +5692,9 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "uuid" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d023da39d1fde5a8a3fe1f3e01ca9632ada0a63e9797de55a879d6e2236277be" +checksum = "79daa5ed5740825c40b389c5e50312b9c86df53fccd33f281df655642b43869d" [[package]] name = "valuable" @@ -5777,9 +5770,9 @@ dependencies = [ "bumpalo", "log", "once_cell", - "proc-macro2 1.0.63", - "quote 1.0.29", - "syn 2.0.23", + "proc-macro2 1.0.66", + "quote 1.0.32", + "syn 2.0.27", "wasm-bindgen-shared", ] @@ -5801,8 +5794,8 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c5020cfa87c7cecefef118055d44e3c1fc122c7ec25701d528ee458a0b45f38f" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", ] @@ -5824,7 +5817,7 @@ version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" dependencies = [ - "quote 1.0.29", + "quote 1.0.32", "wasm-bindgen-macro-support", ] @@ -5834,9 +5827,9 @@ version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", - "syn 2.0.23", + "proc-macro2 1.0.66", + "quote 1.0.32", + "syn 2.0.27", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -5849,18 +5842,18 @@ checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "wasm-encoder" -version = "0.29.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18c41dbd92eaebf3612a39be316540b8377c871cb9bde6b064af962984912881" +checksum = "41763f20eafed1399fff1afb466496d3a959f58241436cfdc17e3f5ca954de16" dependencies = [ "leb128", ] [[package]] name = "wasmer" -version = "3.3.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78caedecd8cb71ed47ccca03b68d69414a3d278bb031e6f93f15759344efdd52" +checksum = "ea790bcdfb4e6e9d1e5ddf75b4699aac62b078fcc9f27f44e1748165ceea67bf" dependencies = [ "bytes", "cfg-if", @@ -5886,9 +5879,9 @@ dependencies = [ [[package]] name = "wasmer-compiler" -version = "3.3.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "726a8450541af4a57c34af7b6973fdbfc79f896cc7e733429577dfd1d1687180" +checksum = "f093937725e242e5529fed27e08ff836c011a9ecc22e6819fb818c2ac6ff5f88" dependencies = [ "backtrace", "cfg-if", @@ -5910,9 +5903,9 @@ dependencies = [ [[package]] name = "wasmer-compiler-cranelift" -version = "3.3.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1e5633f90f372563ebbdf3f9799c7b29ba11c90e56cf9b54017112d2e656c95" +checksum = "3b27b1670d27158789ebe14e4da3902c72132174884a1c6a3533ce4fd9dd83db" dependencies = [ "cranelift-codegen", "cranelift-entity", @@ -5929,9 +5922,9 @@ dependencies = [ [[package]] name = "wasmer-compiler-singlepass" -version = "3.3.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4d38957de6f452115c0af3ff08cec268ee248d665b54d4bbf7da60b7453cb97" +checksum = "02509aaab7e302fc551ff03512807514b379ba32136892e96fcaa5b62a3228de" dependencies = [ "byteorder", "dynasm", @@ -5948,21 +5941,21 @@ dependencies = [ [[package]] name = "wasmer-derive" -version = "3.3.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97901fdbaae383dbb90ea162cc3a76a9fa58ac39aec7948b4c0b9bbef9307738" +checksum = "13ae8286cba2acb10065a4dac129c7c7f7bcd24acd6538555d96616eea16bc27" dependencies = [ "proc-macro-error", - "proc-macro2 1.0.63", - "quote 1.0.29", + "proc-macro2 1.0.66", + "quote 1.0.32", "syn 1.0.109", ] [[package]] name = "wasmer-middlewares" -version = "3.3.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e028013811035111beb768074b6ccc09eabd77811b1e01fd099b5471924ca16" +checksum = "3bc8cafe02112ecf21a7fc1d090ac0f0220a86a8d4f561c24e382a4c2ee4addc" dependencies = [ "wasmer", "wasmer-types", @@ -5971,9 +5964,9 @@ dependencies = [ [[package]] name = "wasmer-object" -version = "3.3.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b6a25e04fdd0f2173bebfce2804ac1fba5e45827afed76876bf414e74244aae" +checksum = "bda85dbe7e313fa98a22d11045885db631871e1d17382297da401f2be7e4c957" dependencies = [ "object 0.28.4", "thiserror", @@ -5982,9 +5975,9 @@ dependencies = [ [[package]] name = "wasmer-types" -version = "3.3.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67f1f2839f4f61509550e4ddcd0e658e19f3af862b51c79fda15549d735d659b" +checksum = "918d2f0bb5eaa95a80c06be33f21dee92f40f12cd0982da34490d121a99d244b" dependencies = [ "bytecheck", "enum-iterator", @@ -5998,9 +5991,9 @@ dependencies = [ [[package]] name = "wasmer-vm" -version = "3.3.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "043118ec4f16d1714fed3aab758b502b864bd865e1d5188626c9ad290100563f" +checksum = "a1e000c2cbd4f9805427af5f3b3446574caf89ab3a1e66c2f3579fbde22b072b" dependencies = [ "backtrace", "cc", @@ -6035,9 +6028,9 @@ dependencies = [ [[package]] name = "wast" -version = "60.0.0" +version = "62.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd06cc744b536e30387e72a48fdd492105b9c938bb4f415c39c616a7a0a697ad" +checksum = "b8ae06f09dbe377b889fbd620ff8fa21e1d49d1d9d364983c0cdbf9870cb9f1f" dependencies = [ "leb128", "memchr", @@ -6047,9 +6040,9 @@ dependencies = [ [[package]] name = "wat" -version = "1.0.66" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5abe520f0ab205366e9ac7d3e6b2fc71de44e32a2b58f2ec871b6b575bdcea3b" +checksum = "842e15861d203fb4a96d314b0751cdeaf0f6f8b35e8d81d2953af2af5e44e637" dependencies = [ "wast", ] @@ -6070,7 +6063,16 @@ version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b03058f88386e5ff5310d9111d53f48b17d732b401aeb83a8d5190f2ac459338" dependencies = [ - "rustls-webpki", + "rustls-webpki 0.100.1", +] + +[[package]] +name = "webpki-roots" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b291546d5d9d1eab74f069c77749f2cb8504a12caa20f0f2de93ddbf6f411888" +dependencies = [ + "rustls-webpki 0.101.2", ] [[package]] @@ -6301,9 +6303,9 @@ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "winnow" -version = "0.4.7" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca0ace3845f0d96209f0375e6d367e3eb87eb65d27d445bdc9f1843a26f39448" +checksum = "25b5872fa2e10bd067ae946f927e726d7d603eaeb6e02fa6a350e0722d2b8c11" dependencies = [ "memchr", ] @@ -6341,9 +6343,9 @@ version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ - "proc-macro2 1.0.63", - "quote 1.0.29", - "syn 2.0.23", + "proc-macro2 1.0.66", + "quote 1.0.32", + "syn 2.0.27", ] [[package]] diff --git a/README.md b/README.md index c76e9565fa6..7f9f1bcfe47 100644 --- a/README.md +++ b/README.md @@ -30,9 +30,9 @@ Here is a list of tools to easily build applications on the Massa blockchain: - [JS Client library](https://github.com/massalabs/massa-web3) to connect to the Massa blockchain from your applications. - [AssemblyScript](https://github.com/massalabs/massa-as-sdk) SDKs to write smart contracts. - [Examples of applications](https://github.com/massalabs/massa-sc-examples) built on Massa. -- [Explorer](test.massa.net). +- [Explorer](https://test.massa.net). - [Interactive API specification](https://playground.open-rpc.org/?schemaUrl=https://test.massa.net/api/v2&uiSchema\[appBar\]\[ui:input\]=false&uiSchema\[appBar\]\[ui:inputPlaceholder\]=Enter+Massa+JSON-RPC+server+URL&uiSchema\[appBar\]\[ui:logoUrl\]=https://massa.net/favicons/favicon.ico&uiSchema\[appBar\]\[ui:splitView\]=false&uiSchema\[appBar\]\[ui:darkMode\]=false&uiSchema\[appBar\]\[ui:title\]=Massa&uiSchema\[appBar\]\[ui:examplesDropdown\]=false&uiSchema\[methods\]\[ui:defaultExpanded\]=false&uiSchema\[methods\]\[ui:methodPlugins\]=true&uiSchema\[params\]\[ui:defaultExpanded\]=false). -- [Lots of documentation](docs.massa.net), from [web3 development](https://docs.massa.net/en/latest/web3-dev/smart-contracts.html) +- [Lots of documentation](https://docs.massa.net), from [web3 development](https://docs.massa.net/en/latest/web3-dev/smart-contracts.html) to [Massa's architecture](https://docs.massa.net/en/latest/general-doc/architecture.html). ## Join the Testnet diff --git a/massa-api-exports/Cargo.toml b/massa-api-exports/Cargo.toml index 1aea6b0f2d7..b03510d4a5d 100644 --- a/massa-api-exports/Cargo.toml +++ b/massa-api-exports/Cargo.toml @@ -8,7 +8,7 @@ edition = "2021" paginate = "1.1.11" displaydoc = "0.2" thiserror = "1.0" -jsonrpsee = { version = "0.18.2", features = ["jsonrpsee-core", "jsonrpsee-types"] } +jsonrpsee = { version = "0.19.0", features = ["jsonrpsee-core", "jsonrpsee-types"] } serde = { version = "1.0", features = ["derive"] } strum = { version = "0.24", features = ["derive"] } diff --git a/massa-api/Cargo.toml b/massa-api/Cargo.toml index 3216e174d71..c67e6cffa59 100644 --- a/massa-api/Cargo.toml +++ b/massa-api/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -jsonrpsee = { version = "0.18.2", features = ["server", "macros"] } +jsonrpsee = { version = "0.19.0", features = ["server", "macros"] } futures = "0.3.18" async-trait = "0.1.58" serde = { version = "1.0", features = ["derive"] } diff --git a/massa-api/src/lib.rs b/massa-api/src/lib.rs index 3a8e1c02208..926cedf522d 100644 --- a/massa-api/src/lib.rs +++ b/massa-api/src/lib.rs @@ -160,8 +160,7 @@ async fn serve( } else { BatchRequestConfig::Disabled }) - .ping_interval(api_config.ping_interval.to_duration()) - .custom_tokio_runtime(tokio::runtime::Handle::current()); + .ping_interval(api_config.ping_interval.to_duration()); if api_config.enable_http && !api_config.enable_ws { server_builder = server_builder.http_only(); @@ -186,7 +185,7 @@ async fn serve( .await .expect("failed to build server"); - let server_handler = server.start(api).expect("server start failed"); + let server_handler = server.start(api); let stop_handler = StopHandle { server_handler }; Ok(stop_handler) diff --git a/massa-api/src/public.rs b/massa-api/src/public.rs index 179f4e9ba4b..a4c08b69f85 100644 --- a/massa-api/src/public.rs +++ b/massa-api/src/public.rs @@ -43,7 +43,7 @@ use massa_models::{ output_event::SCOutputEvent, prehash::{PreHashMap, PreHashSet}, secure_share::SecureShareDeserializer, - slot::Slot, + slot::{IndexedSlot, Slot}, timeslots, timeslots::{get_latest_block_slot_at_timestamp, time_range_to_slot_range}, version::Version, @@ -839,13 +839,34 @@ impl MassaRpcServer for API { .saturating_add(self.0.api_settings.draw_lookahead_period_count), cur_slot.thread, ); + let selections = self + .0 + .selector_controller + .get_available_selections_in_range( + cur_slot..=slot_end, + Some(&addresses.iter().copied().collect()), + ) + .unwrap_or_default(); + addresses .iter() .map(|addr| { - self.0 - .selector_controller - .get_address_selections(addr, cur_slot, slot_end) - .unwrap_or_default() + let mut producer_slots = Vec::new(); + let mut endorser_slots = Vec::new(); + for (selection_slot, selection) in &selections { + if selection.producer == *addr { + producer_slots.push(*selection_slot); + } + for (index, endorser) in selection.endorsements.iter().enumerate() { + if endorser == addr { + endorser_slots.push(IndexedSlot { + slot: *selection_slot, + index, + }); + } + } + } + (producer_slots, endorser_slots) }) .collect::>() }; diff --git a/massa-async-pool/Cargo.toml b/massa-async-pool/Cargo.toml index f63dfc3867b..1c35712ec9a 100644 --- a/massa-async-pool/Cargo.toml +++ b/massa-async-pool/Cargo.toml @@ -19,7 +19,7 @@ massa_serialization = { path = "../massa-serialization" } massa_signature = { path = "../massa-signature" } massa_db_exports = { path = "../massa-db-exports" } massa_time = { path = "../massa-time" } -massa-proto-rs = { git = "https://github.com/massalabs/massa-proto-rs", rev = "18ec02f", features = ["tonic"] } +massa-proto-rs = { git = "https://github.com/massalabs/massa-proto-rs", rev = "32179e2", features = ["tonic"] } [dev-dependencies] tempfile = "3.3" diff --git a/massa-async-pool/src/mapping_grpc.rs b/massa-async-pool/src/mapping_grpc.rs index d0adda0e0e8..109ea77c54a 100644 --- a/massa-async-pool/src/mapping_grpc.rs +++ b/massa-async-pool/src/mapping_grpc.rs @@ -13,159 +13,158 @@ impl From for grpc_model::AsyncMessage { destination: value.destination.to_string(), handler: value.handler.to_string(), max_gas: value.max_gas, - fee: value.fee.to_raw(), - coins: value.coins.to_raw(), + fee: Some(value.fee.into()), + coins: Some(value.coins.into()), validity_start: Some(value.validity_start.into()), validity_end: Some(value.validity_start.into()), data: value.data, trigger: value.trigger.map(|trigger| trigger.into()), can_be_executed: value.can_be_executed, - hash: value.hash.to_string(), } } } +//TODO to be checked, use functions impl From for grpc_model::AsyncMessageUpdate { fn from(value: AsyncMessageUpdate) -> Self { grpc_model::AsyncMessageUpdate { emission_slot: match value.emission_slot { SetOrKeep::Set(value) => Some(grpc_model::SetOrKeepSlot { - r#type: grpc_model::AsyncPoolChangeType::Set as i32, - value: Some(value.into()), + change: Some(grpc_model::set_or_keep_slot::Change::Set(value.into())), }), SetOrKeep::Keep => Some(grpc_model::SetOrKeepSlot { - r#type: grpc_model::AsyncPoolChangeType::Delete as i32, - value: None, + change: Some(grpc_model::set_or_keep_slot::Change::Keep( + grpc_model::Empty {}, + )), }), }, emission_index: match value.emission_index { - SetOrKeep::Set(value) => Some(grpc_model::SetOrKeepFixed64 { - r#type: grpc_model::AsyncPoolChangeType::Set as i32, - value: Some(value), + SetOrKeep::Set(value) => Some(grpc_model::SetOrKeepUint64 { + change: Some(grpc_model::set_or_keep_uint64::Change::Set(value)), }), - SetOrKeep::Keep => Some(grpc_model::SetOrKeepFixed64 { - r#type: grpc_model::AsyncPoolChangeType::Delete as i32, - value: None, + SetOrKeep::Keep => Some(grpc_model::SetOrKeepUint64 { + change: Some(grpc_model::set_or_keep_uint64::Change::Keep( + grpc_model::Empty {}, + )), }), }, sender: match value.sender { SetOrKeep::Set(value) => Some(grpc_model::SetOrKeepString { - r#type: grpc_model::AsyncPoolChangeType::Set as i32, - value: Some(value.to_string()), + change: Some(grpc_model::set_or_keep_string::Change::Set( + value.to_string(), + )), }), SetOrKeep::Keep => Some(grpc_model::SetOrKeepString { - r#type: grpc_model::AsyncPoolChangeType::Delete as i32, - value: None, + change: Some(grpc_model::set_or_keep_string::Change::Keep( + grpc_model::Empty {}, + )), }), }, destination: match value.destination { SetOrKeep::Set(value) => Some(grpc_model::SetOrKeepString { - r#type: grpc_model::AsyncPoolChangeType::Set as i32, - value: Some(value.to_string()), + change: Some(grpc_model::set_or_keep_string::Change::Set( + value.to_string(), + )), }), SetOrKeep::Keep => Some(grpc_model::SetOrKeepString { - r#type: grpc_model::AsyncPoolChangeType::Delete as i32, - value: None, + change: Some(grpc_model::set_or_keep_string::Change::Keep( + grpc_model::Empty {}, + )), }), }, handler: match value.handler { SetOrKeep::Set(value) => Some(grpc_model::SetOrKeepString { - r#type: grpc_model::AsyncPoolChangeType::Set as i32, - value: Some(value), + change: Some(grpc_model::set_or_keep_string::Change::Set(value)), }), SetOrKeep::Keep => Some(grpc_model::SetOrKeepString { - r#type: grpc_model::AsyncPoolChangeType::Delete as i32, - value: None, + change: Some(grpc_model::set_or_keep_string::Change::Keep( + grpc_model::Empty {}, + )), }), }, max_gas: match value.max_gas { - SetOrKeep::Set(value) => Some(grpc_model::SetOrKeepFixed64 { - r#type: grpc_model::AsyncPoolChangeType::Set as i32, - value: Some(value), + SetOrKeep::Set(value) => Some(grpc_model::SetOrKeepUint64 { + change: Some(grpc_model::set_or_keep_uint64::Change::Set(value)), }), - SetOrKeep::Keep => Some(grpc_model::SetOrKeepFixed64 { - r#type: grpc_model::AsyncPoolChangeType::Delete as i32, - value: None, + SetOrKeep::Keep => Some(grpc_model::SetOrKeepUint64 { + change: Some(grpc_model::set_or_keep_uint64::Change::Keep( + grpc_model::Empty {}, + )), }), }, + //TODO check Amount usage fee: match value.fee { - SetOrKeep::Set(value) => Some(grpc_model::SetOrKeepFixed64 { - r#type: grpc_model::AsyncPoolChangeType::Set as i32, - value: Some(value.to_raw()), + SetOrKeep::Set(value) => Some(grpc_model::SetOrKeepUint64 { + change: Some(grpc_model::set_or_keep_uint64::Change::Set(value.to_raw())), }), - SetOrKeep::Keep => Some(grpc_model::SetOrKeepFixed64 { - r#type: grpc_model::AsyncPoolChangeType::Delete as i32, - value: None, + SetOrKeep::Keep => Some(grpc_model::SetOrKeepUint64 { + change: Some(grpc_model::set_or_keep_uint64::Change::Keep( + grpc_model::Empty {}, + )), }), }, + //TODO check Amount usage coins: match value.coins { - SetOrKeep::Set(value) => Some(grpc_model::SetOrKeepFixed64 { - r#type: grpc_model::AsyncPoolChangeType::Set as i32, - value: Some(value.to_raw()), + SetOrKeep::Set(value) => Some(grpc_model::SetOrKeepUint64 { + change: Some(grpc_model::set_or_keep_uint64::Change::Set(value.to_raw())), }), - SetOrKeep::Keep => Some(grpc_model::SetOrKeepFixed64 { - r#type: grpc_model::AsyncPoolChangeType::Delete as i32, - value: None, + SetOrKeep::Keep => Some(grpc_model::SetOrKeepUint64 { + change: Some(grpc_model::set_or_keep_uint64::Change::Keep( + grpc_model::Empty {}, + )), }), }, validity_start: match value.validity_start { SetOrKeep::Set(value) => Some(grpc_model::SetOrKeepSlot { - r#type: grpc_model::AsyncPoolChangeType::Set as i32, - value: Some(value.into()), + change: Some(grpc_model::set_or_keep_slot::Change::Set(value.into())), }), SetOrKeep::Keep => Some(grpc_model::SetOrKeepSlot { - r#type: grpc_model::AsyncPoolChangeType::Delete as i32, - value: None, + change: Some(grpc_model::set_or_keep_slot::Change::Keep( + grpc_model::Empty {}, + )), }), }, validity_end: match value.validity_end { SetOrKeep::Set(value) => Some(grpc_model::SetOrKeepSlot { - r#type: grpc_model::AsyncPoolChangeType::Set as i32, - value: Some(value.into()), + change: Some(grpc_model::set_or_keep_slot::Change::Set(value.into())), }), SetOrKeep::Keep => Some(grpc_model::SetOrKeepSlot { - r#type: grpc_model::AsyncPoolChangeType::Delete as i32, - value: None, + change: Some(grpc_model::set_or_keep_slot::Change::Keep( + grpc_model::Empty {}, + )), }), }, data: match value.data { SetOrKeep::Set(value) => Some(grpc_model::SetOrKeepBytes { - r#type: grpc_model::AsyncPoolChangeType::Set as i32, - value: Some(value), + change: Some(grpc_model::set_or_keep_bytes::Change::Set(value)), }), SetOrKeep::Keep => Some(grpc_model::SetOrKeepBytes { - r#type: grpc_model::AsyncPoolChangeType::Delete as i32, - value: None, + change: Some(grpc_model::set_or_keep_bytes::Change::Keep( + grpc_model::Empty {}, + )), }), }, + //TODO remove unwrap trigger: match value.trigger { SetOrKeep::Set(value) => Some(grpc_model::SetOrKeepAsyncMessageTrigger { - r#type: grpc_model::AsyncPoolChangeType::Set as i32, - value: value.map(|trigger| trigger.into()), + change: Some(grpc_model::set_or_keep_async_message_trigger::Change::Set( + value.map(|trigger| trigger.into()).unwrap(), + )), }), SetOrKeep::Keep => Some(grpc_model::SetOrKeepAsyncMessageTrigger { - r#type: grpc_model::AsyncPoolChangeType::Delete as i32, - value: None, + change: Some(grpc_model::set_or_keep_async_message_trigger::Change::Keep( + grpc_model::Empty {}, + )), }), }, can_be_executed: match value.can_be_executed { SetOrKeep::Set(value) => Some(grpc_model::SetOrKeepBool { - r#type: grpc_model::AsyncPoolChangeType::Set as i32, - value: Some(value), + change: Some(grpc_model::set_or_keep_bool::Change::Set(value)), }), SetOrKeep::Keep => Some(grpc_model::SetOrKeepBool { - r#type: grpc_model::AsyncPoolChangeType::Delete as i32, - value: None, - }), - }, - hash: match value.hash { - SetOrKeep::Set(value) => Some(grpc_model::SetOrKeepString { - r#type: grpc_model::AsyncPoolChangeType::Set as i32, - value: Some(value.to_string()), - }), - SetOrKeep::Keep => Some(grpc_model::SetOrKeepString { - r#type: grpc_model::AsyncPoolChangeType::Delete as i32, - value: None, + change: Some(grpc_model::set_or_keep_bool::Change::Keep( + grpc_model::Empty {}, + )), }), }, } diff --git a/massa-bootstrap/src/error.rs b/massa-bootstrap/src/error.rs index f0a26f7c836..439196373db 100644 --- a/massa-bootstrap/src/error.rs +++ b/massa-bootstrap/src/error.rs @@ -25,6 +25,8 @@ pub enum BootstrapError { GeneralError(String), /// deserialization error: {0} DeserializeError(String), + /// serialization error: {0} + SerializationError(String), /// models error: {0} ModelsError(#[from] massa_models::error::ModelsError), /// serialize error: {0} diff --git a/massa-bootstrap/src/lib.rs b/massa-bootstrap/src/lib.rs index 43b986052e9..ff0b7958f20 100644 --- a/massa-bootstrap/src/lib.rs +++ b/massa-bootstrap/src/lib.rs @@ -30,6 +30,8 @@ mod messages; mod server; mod settings; mod tools; +/// white/black list +pub mod white_black_list; pub use client::{get_state, DefaultConnector}; pub use listener::BootstrapTcpListener; diff --git a/massa-bootstrap/src/server.rs b/massa-bootstrap/src/server.rs index 4c22ee6928c..91fb6a6808f 100644 --- a/massa-bootstrap/src/server.rs +++ b/massa-bootstrap/src/server.rs @@ -24,7 +24,6 @@ //! 4. Checks if the client has attempted too recently //! 5. All checks have passed: spawn a thread on which to run the bootstrap session //! This thread creates a new tokio runtime, and runs it with `block_on` -mod white_black_list; use crossbeam::channel::tick; use humantime::format_duration; @@ -50,7 +49,6 @@ use std::{ time::{Duration, Instant}, }; use tracing::{debug, error, info, warn}; -use white_black_list::*; #[cfg(not(test))] use crate::listener::BootstrapTcpListener; @@ -61,6 +59,7 @@ use crate::{ error::BootstrapError, listener::{BootstrapListenerStopHandle, PollEvent}, messages::{BootstrapClientMessage, BootstrapServerMessage}, + white_black_list::SharedWhiteBlackList, BootstrapConfig, }; /// Specifies a common interface that can be used by standard, or mockers @@ -79,6 +78,8 @@ pub struct BootstrapManager { main_handle: thread::JoinHandle>, listener_stopper: BootstrapListenerStopHandle, update_stopper_tx: crossbeam::channel::Sender<()>, + /// shared white/black list + pub white_black_list: SharedWhiteBlackList<'static>, } impl BootstrapManager { @@ -89,12 +90,14 @@ impl BootstrapManager { main_handle: thread::JoinHandle>, update_stopper_tx: crossbeam::channel::Sender<()>, listener_stopper: BootstrapListenerStopHandle, + white_black_list: SharedWhiteBlackList<'static>, ) -> Self { Self { update_handle, main_handle, update_stopper_tx, listener_stopper, + white_black_list, } } @@ -168,6 +171,7 @@ pub fn start_bootstrap_server( }) .expect("in `start_bootstrap_server`, OS failed to spawn list-updater thread"); + let w_b_list = white_black_list.clone(); let main_handle = thread::Builder::new() .name("bs-main-loop".to_string()) .spawn(move || { @@ -176,7 +180,7 @@ pub fn start_bootstrap_server( protocol_controller, final_state, ev_poller, - white_black_list, + white_black_list: w_b_list, keypair, version, ip_hist_map: HashMap::with_capacity(config.ip_list_max_size), @@ -192,6 +196,7 @@ pub fn start_bootstrap_server( main_handle, update_stopper_tx, listener_stopper, + white_black_list, )) } diff --git a/massa-bootstrap/src/server/white_black_list.rs b/massa-bootstrap/src/white_black_list.rs similarity index 61% rename from massa-bootstrap/src/server/white_black_list.rs rename to massa-bootstrap/src/white_black_list.rs index 3afb1cef57f..48fa9f56c63 100644 --- a/massa-bootstrap/src/server/white_black_list.rs +++ b/massa-bootstrap/src/white_black_list.rs @@ -16,7 +16,7 @@ use crate::tools::normalize_ip; /// A wrapper around the white/black lists that allows efficient sharing between threads // TODO: don't clone the path-bufs... #[derive(Clone)] -pub(crate) struct SharedWhiteBlackList<'a> { +pub struct SharedWhiteBlackList<'a> { inner: Arc>, white_path: Cow<'a, Path>, black_path: Cow<'a, Path>, @@ -35,14 +35,89 @@ impl SharedWhiteBlackList<'_> { }) } + /// get the white list + pub fn get_white_list(&self) -> Option> { + self.inner.read().white_list.clone() + } + + /// get the black list + pub fn get_black_list(&self) -> Option> { + self.inner.read().black_list.clone() + } + + /// Add IP address to the black list + pub fn add_ips_to_blacklist(&self, ips: Vec) -> Result<(), BootstrapError> { + let mut write_lock = self.inner.write(); + if let Some(black_list) = &mut write_lock.black_list { + black_list.extend(ips); + } else { + write_lock.black_list = Some(HashSet::from_iter(ips)); + }; + self.write_to_file(&self.black_path, write_lock.black_list.as_ref().unwrap())?; + Ok(()) + } + + /// Remove IPs address from the black list + pub fn remove_ips_from_blacklist(&self, ips: Vec) -> Result<(), BootstrapError> { + let mut write_lock = self.inner.write(); + if let Some(black_list) = &mut write_lock.black_list { + for ip in ips { + black_list.remove(&ip); + } + self.write_to_file(&self.black_path, black_list)?; + } + Ok(()) + } + + /// Add IP address to the white list + pub fn add_ips_to_whitelist(&self, ips: Vec) -> Result<(), BootstrapError> { + let mut write_lock = self.inner.write(); + if let Some(white_list) = &mut write_lock.white_list { + white_list.extend(ips); + } else { + write_lock.white_list = Some(HashSet::from_iter(ips)); + }; + self.write_to_file(&self.white_path, write_lock.white_list.as_ref().unwrap())?; + Ok(()) + } + + /// Remove IPs address from the white list + pub fn remove_ips_from_whitelist(&self, ips: Vec) -> Result<(), BootstrapError> { + let mut write_lock = self.inner.write(); + if let Some(white_list) = &mut write_lock.white_list { + for ip in ips { + white_list.remove(&ip); + } + self.write_to_file(&self.white_path, white_list)?; + } + Ok(()) + } + + /// write list to file + fn write_to_file( + &self, + file_path: &Path, + data: &HashSet, + ) -> Result<(), BootstrapError> { + let list = serde_json::to_string(data).map_err(|e| { + warn!(error = ?e, "failed to serialize list"); + BootstrapError::SerializationError(e.to_string()) + })?; + std::fs::write(file_path, list).map_err(|e| { + warn!(error = ?e, "failed to write list to file"); + BootstrapError::IoError(e) + })?; + Ok(()) + } + /// Checks if the white/black list is up to date with a read-lock /// Creates a new list, and replaces the old one in a write-lock pub(crate) fn update(&mut self) -> Result<(), BootstrapError> { let read_lock = self.inner.read(); - let (new_white, new_black) = + let (new_white_file, new_black_file) = WhiteBlackListInner::update_list(&self.white_path, &self.black_path)?; - let white_delta = new_white != read_lock.white_list; - let black_delta = new_black != read_lock.black_list; + let white_delta = new_white_file != read_lock.white_list; + let black_delta = new_black_file != read_lock.black_list; if white_delta || black_delta { // Ideally this scope would be atomic let mut mut_inner = { @@ -52,11 +127,11 @@ impl SharedWhiteBlackList<'_> { if white_delta { info!("whitelist has updated !"); - mut_inner.white_list = new_white; + mut_inner.white_list = new_white_file; } if black_delta { info!("blacklist has updated !"); - mut_inner.black_list = new_black; + mut_inner.black_list = new_black_file; } } Ok(()) diff --git a/massa-client/Cargo.toml b/massa-client/Cargo.toml index c421644765f..b641c801328 100644 --- a/massa-client/Cargo.toml +++ b/massa-client/Cargo.toml @@ -28,7 +28,6 @@ massa_signature = { path = "../massa-signature" } massa_time = { path = "../massa-time" } massa_sdk = { path = "../massa-sdk" } massa_wallet = { path = "../massa-wallet" } -# massa-proto-rs = { git = "https://github.com/massalabs/massa-proto-rs", rev = "18ec02f", features = ["tonic"] } [dev-dependencies] toml_edit = "0.19" diff --git a/massa-client/base_config/config.toml b/massa-client/base_config/config.toml index 7de719c6990..03942e8fe4e 100644 --- a/massa-client/base_config/config.toml +++ b/massa-client/base_config/config.toml @@ -7,7 +7,8 @@ timeout = 1000 ip = "127.0.0.1" private_port = 33034 public_port = 33035 -grpc_port = 33037 +grpc_public_port = 33037 +grpc_private_port = 33038 [client] # maximum size in bytes of a request diff --git a/massa-client/src/main.rs b/massa-client/src/main.rs index 4bd72599f33..829d8f71dd9 100644 --- a/massa-client/src/main.rs +++ b/massa-client/src/main.rs @@ -33,9 +33,12 @@ struct Args { /// Port to listen on (Massa private API). #[structopt(long)] private_port: Option, - /// Port to listen on (Massa GRPC API). + /// Port to listen on (Massa GRPC Public API). #[structopt(long)] - grpc_port: Option, + grpc_public_port: Option, + /// Port to listen on (Massa GRPC Private API). + #[structopt(long)] + grpc_private_port: Option, /// Address to listen on #[structopt(long)] ip: Option, @@ -129,9 +132,13 @@ async fn run(args: Args) -> Result<()> { Some(private_port) => private_port, None => settings.default_node.private_port, }; - let grpc_port = match args.grpc_port { + let grpc_port = match args.grpc_public_port { + Some(grpc_port) => grpc_port, + None => settings.default_node.grpc_public_port, + }; + let grpc_priv_port = match args.grpc_private_port { Some(grpc_port) => grpc_port, - None => settings.default_node.grpc_port, + None => settings.default_node.grpc_private_port, }; // Setup panic handlers, @@ -145,8 +152,15 @@ async fn run(args: Args) -> Result<()> { })); // Note: grpc handler requires a mut handler - let mut client = - Client::new(address, public_port, private_port, grpc_port, &http_config).await?; + let mut client = Client::new( + address, + public_port, + private_port, + grpc_port, + grpc_priv_port, + &http_config, + ) + .await?; if atty::is(Stream::Stdout) && args.command == Command::help && !args.json { // Interactive mode repl::run(&mut client, &args.wallet, args.password).await?; diff --git a/massa-client/src/settings.rs b/massa-client/src/settings.rs index 53c8fbe9ee9..b621629302d 100644 --- a/massa-client/src/settings.rs +++ b/massa-client/src/settings.rs @@ -24,7 +24,8 @@ pub struct DefaultNode { pub ip: IpAddr, pub private_port: u16, pub public_port: u16, - pub grpc_port: u16, + pub grpc_public_port: u16, + pub grpc_private_port: u16, } /// Client settings diff --git a/massa-consensus-exports/Cargo.toml b/massa-consensus-exports/Cargo.toml index 904d3268717..9f4af7014e2 100644 --- a/massa-consensus-exports/Cargo.toml +++ b/massa-consensus-exports/Cargo.toml @@ -13,7 +13,7 @@ nom = "=7.1" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" thiserror = "1.0" -jsonrpsee = { version = "0.18.2", features = ["server"] } +jsonrpsee = { version = "0.19.0", features = ["server"] } tokio = { version = "1.23", features = ["sync"] } mockall = {version = "0.11.4", features = ["nightly"], optional = true} #custom modules diff --git a/massa-execution-exports/Cargo.toml b/massa-execution-exports/Cargo.toml index 3c3305bf9ae..4fa63989c8b 100644 --- a/massa-execution-exports/Cargo.toml +++ b/massa-execution-exports/Cargo.toml @@ -18,7 +18,7 @@ tokio = { version = "1.23", features = ["sync"] } mockall = { version = "0.11.4", optional = true} # custom modules -massa-proto-rs = { git = "https://github.com/massalabs/massa-proto-rs", rev = "18ec02f", features = ["tonic"] } +massa-proto-rs = { git = "https://github.com/massalabs/massa-proto-rs", rev = "32179e2", features = ["tonic"] } massa_hash = { path = "../massa-hash" } massa_models = { path = "../massa-models" } massa_time = { path = "../massa-time" } diff --git a/massa-execution-exports/src/lib.rs b/massa-execution-exports/src/lib.rs index 367a2097a26..589eb3caa47 100644 --- a/massa-execution-exports/src/lib.rs +++ b/massa-execution-exports/src/lib.rs @@ -48,7 +48,8 @@ mod channels; mod controller_traits; mod error; mod event_store; -mod mapping_grpc; +/// mapping grpc +pub mod mapping_grpc; mod settings; mod types; diff --git a/massa-execution-exports/src/mapping_grpc.rs b/massa-execution-exports/src/mapping_grpc.rs index 382501d625e..966bee9b88b 100644 --- a/massa-execution-exports/src/mapping_grpc.rs +++ b/massa-execution-exports/src/mapping_grpc.rs @@ -1,20 +1,323 @@ // Copyright (c) 2023 MASSA LABS -use crate::{ExecutionOutput, SlotExecutionOutput}; +use std::str::FromStr; + +use crate::{ + ExecutionOutput, ExecutionQueryCycleInfos, ExecutionQueryError, ExecutionQueryExecutionStatus, + ExecutionQueryRequestItem, ExecutionQueryResponseItem, ExecutionQueryStakerInfo, + SlotExecutionOutput, +}; +use grpc_api::execution_query_request_item as exec; +use massa_models::address::Address; +use massa_models::error::ModelsError; +use massa_models::execution::EventFilter; +use massa_models::mapping_grpc::to_denunciation_index; +use massa_models::operation::OperationId; +use massa_models::prehash::{CapacityAllocator, PreHashSet}; +use massa_proto_rs::massa::api::v1 as grpc_api; use massa_proto_rs::massa::model::v1 as grpc_model; +/// Convert a `grpc_api::ScExecutionEventsRequest` to a `ScExecutionEventsRequest` +pub fn to_querystate_filter( + query: grpc_api::ExecutionQueryRequestItem, +) -> Result { + if let Some(item) = query.request_item { + match item { + exec::RequestItem::AddressExistsCandidate(value) => { + Ok(ExecutionQueryRequestItem::AddressExistsCandidate( + Address::from_str(&value.address)?, + )) + } + exec::RequestItem::AddressExistsFinal(value) => Ok( + ExecutionQueryRequestItem::AddressExistsFinal(Address::from_str(&value.address)?), + ), + exec::RequestItem::AddressBalanceCandidate(value) => { + Ok(ExecutionQueryRequestItem::AddressBalanceCandidate( + Address::from_str(&value.address)?, + )) + } + exec::RequestItem::AddressBalanceFinal(value) => Ok( + ExecutionQueryRequestItem::AddressBalanceFinal(Address::from_str(&value.address)?), + ), + exec::RequestItem::AddressBytecodeCandidate(value) => { + Ok(ExecutionQueryRequestItem::AddressBytecodeCandidate( + Address::from_str(&value.address)?, + )) + } + exec::RequestItem::AddressBytecodeFinal(value) => { + Ok(ExecutionQueryRequestItem::AddressBytecodeCandidate( + Address::from_str(&value.address)?, + )) + } + exec::RequestItem::AddressDatastoreKeysCandidate(value) => { + Ok(ExecutionQueryRequestItem::AddressBytecodeCandidate( + Address::from_str(&value.address)?, + )) + } + exec::RequestItem::AddressDatastoreKeysFinal(value) => { + Ok(ExecutionQueryRequestItem::AddressDatastoreKeysFinal { + addr: Address::from_str(&value.address)?, + prefix: value.prefix, + }) + } + exec::RequestItem::AddressDatastoreValueCandidate(value) => { + Ok(ExecutionQueryRequestItem::AddressDatastoreValueCandidate { + addr: Address::from_str(&value.address)?, + key: value.key, + }) + } + exec::RequestItem::AddressDatastoreValueFinal(value) => { + Ok(ExecutionQueryRequestItem::AddressDatastoreValueFinal { + addr: Address::from_str(&value.address)?, + key: value.key, + }) + } + exec::RequestItem::OpExecutionStatusCandidate(value) => { + Ok(ExecutionQueryRequestItem::OpExecutionStatusCandidate( + OperationId::from_str(&value.operation_id)?, + )) + } + exec::RequestItem::OpExecutionStatusFinal(value) => { + Ok(ExecutionQueryRequestItem::OpExecutionStatusFinal( + OperationId::from_str(&value.operation_id)?, + )) + } + //TODO to be improved + exec::RequestItem::DenunciationExecutionStatusCandidate(value) => Ok( + ExecutionQueryRequestItem::DenunciationExecutionStatusCandidate( + to_denunciation_index(value.denunciation_index.ok_or_else(|| { + ModelsError::ErrorRaised("no denounciation index found".to_string()) + })?)?, + ), + ), + //TODO to be improved + exec::RequestItem::DenunciationExecutionStatusFinal(value) => { + Ok(ExecutionQueryRequestItem::DenunciationExecutionStatusFinal( + to_denunciation_index(value.denunciation_index.ok_or_else(|| { + ModelsError::ErrorRaised("no denounciation index found".to_string()) + })?)?, + )) + } + exec::RequestItem::AddressRollsCandidate(value) => { + Ok(ExecutionQueryRequestItem::AddressRollsCandidate( + Address::from_str(&value.address)?, + )) + } + exec::RequestItem::AddressRollsFinal(value) => Ok( + ExecutionQueryRequestItem::AddressRollsFinal(Address::from_str(&value.address)?), + ), + exec::RequestItem::AddressDeferredCreditsCandidate(value) => { + Ok(ExecutionQueryRequestItem::AddressDeferredCreditsCandidate( + Address::from_str(&value.address)?, + )) + } + exec::RequestItem::AddressDeferredCreditsFinal(value) => { + Ok(ExecutionQueryRequestItem::AddressDeferredCreditsFinal( + Address::from_str(&value.address)?, + )) + } + //TODO to be checked + exec::RequestItem::CycleInfos(value) => { + let addreses = value + .restrict_to_addresses + .into_iter() + .map(|address| Address::from_str(&address)) + .collect::, _>>()?; + let mut addresses_set = PreHashSet::with_capacity(addreses.len()); + addresses_set.extend(addreses); + Ok(ExecutionQueryRequestItem::CycleInfos { + cycle: value.cycle, + restrict_to_addresses: Some(addresses_set), + }) + } + exec::RequestItem::Events(value) => { + let event_filter = to_event_filter(value.filters)?; + Ok(ExecutionQueryRequestItem::Events(event_filter)) + } + } + } else { + Err(ModelsError::ErrorRaised("no filter provided".to_string())) + } +} + +/// Convert a vector of `grpc_model::ScExecutionEventsFilter` to a `EventFilter` +pub fn to_event_filter( + sce_filters: Vec, +) -> Result { + let mut event_filter = EventFilter::default(); + for query in sce_filters { + if let Some(filter) = query.filter { + match filter { + grpc_api::sc_execution_events_filter::Filter::SlotRange(slot_range) => { + event_filter.start = slot_range.start_slot.map(|slot| slot.into()); + event_filter.end = slot_range.end_slot.map(|slot| slot.into()); + } + grpc_api::sc_execution_events_filter::Filter::CallerAddress(caller_address) => { + event_filter.original_caller_address = + Some(Address::from_str(&caller_address)?); + } + grpc_api::sc_execution_events_filter::Filter::EmitterAddress(emitter_address) => { + event_filter.emitter_address = Some(Address::from_str(&emitter_address)?); + } + grpc_api::sc_execution_events_filter::Filter::OriginalOperationId(operation_id) => { + event_filter.original_operation_id = + Some(OperationId::from_str(&operation_id)?); + } + grpc_api::sc_execution_events_filter::Filter::IsFailure(is_failure) => { + event_filter.is_error = Some(is_failure); + } + grpc_api::sc_execution_events_filter::Filter::Status(status) => { + // See grpc_model::ScExecutionEventStatus + match status { + 1 => event_filter.is_final = Some(true), + 2 => event_filter.is_final = Some(false), + _ => event_filter.is_final = None, + } + } + } + } + } + + Ok(event_filter) +} + +/// Converts a `ExecutionQueryResponse` to a `grpc_api::ExecutionQueryResponse` +pub fn to_execution_query_response( + value: Result, +) -> grpc_api::ExecutionQueryResponse { + match value { + Ok(item) => grpc_api::ExecutionQueryResponse { + response: Some(grpc_api::execution_query_response::Response::Result( + to_execution_query_result(item), + )), + }, + Err(err) => grpc_api::ExecutionQueryResponse { + response: Some(grpc_api::execution_query_response::Response::Error( + err.into(), + )), + }, + } +} + +// Convertss a `ExecutionQueryResponseItem` to a `grpc_api::ExecutionQueryResponseItem` +fn to_execution_query_result( + value: ExecutionQueryResponseItem, +) -> grpc_api::ExecutionQueryResponseItem { + let response_item = match value { + ExecutionQueryResponseItem::Boolean(result) => { + grpc_api::execution_query_response_item::ResponseItem::Boolean(result) + } + ExecutionQueryResponseItem::RollCount(result) => { + grpc_api::execution_query_response_item::ResponseItem::RollCount(result) + } + ExecutionQueryResponseItem::Amount(result) => { + grpc_api::execution_query_response_item::ResponseItem::Amount(result.into()) + } + ExecutionQueryResponseItem::Bytecode(result) => { + grpc_api::execution_query_response_item::ResponseItem::Bytes(result.0) + } + ExecutionQueryResponseItem::DatastoreValue(result) => { + grpc_api::execution_query_response_item::ResponseItem::Bytes(result) + } + ExecutionQueryResponseItem::KeyList(result) => { + grpc_api::execution_query_response_item::ResponseItem::VecBytes( + grpc_model::ArrayOfBytesWrapper { + items: result.into_iter().collect(), + }, + ) + } + ExecutionQueryResponseItem::DeferredCredits(result) => { + grpc_api::execution_query_response_item::ResponseItem::DeferredCredits( + grpc_api::DeferredCreditsEntryWrapper { + entries: result + .into_iter() + .map(|(slot, amount)| grpc_api::DeferredCreditsEntry { + slot: Some(slot.into()), + amount: Some(amount.into()), + }) + .collect(), + }, + ) + } + ExecutionQueryResponseItem::ExecutionStatus(result) => match result { + ExecutionQueryExecutionStatus::AlreadyExecutedWithSuccess => { + grpc_api::execution_query_response_item::ResponseItem::ExecutionStatus( + grpc_api::ExecutionQueryExecutionStatus::AlreadyExecutedWithSuccess as i32, + ) + } + ExecutionQueryExecutionStatus::AlreadyExecutedWithFailure => { + grpc_api::execution_query_response_item::ResponseItem::ExecutionStatus( + grpc_api::ExecutionQueryExecutionStatus::AlreadyExecutedWithFailure as i32, + ) + } + ExecutionQueryExecutionStatus::ExecutableOrExpired => { + grpc_api::execution_query_response_item::ResponseItem::ExecutionStatus( + grpc_api::ExecutionQueryExecutionStatus::ExecutableOrExpired as i32, + ) + } + }, + ExecutionQueryResponseItem::CycleInfos(result) => { + grpc_api::execution_query_response_item::ResponseItem::CycleInfos(to_cycle_info(result)) + } + ExecutionQueryResponseItem::Events(result) => { + grpc_api::execution_query_response_item::ResponseItem::Events( + grpc_api::ScOutputEventsWrapper { + events: result.into_iter().map(|event| event.into()).collect(), + }, + ) + } + }; + + grpc_api::ExecutionQueryResponseItem { + response_item: Some(response_item), + } +} + +// Convertss a `ExecutionQueryCycleInfos` to a `grpc_api::CycleInfos` +fn to_cycle_info(value: ExecutionQueryCycleInfos) -> grpc_api::ExecutionQueryCycleInfos { + grpc_api::ExecutionQueryCycleInfos { + cycle: value.cycle, + is_final: value.is_final, + staker_infos: value + .staker_infos + .into_iter() + .map(|(address, info)| to_execution_query_staker_info(address, info)) + .collect(), + } +} + +// Convertss a `ExecutionQueryStakerInfo` to a `grpc_api::ExecutionQueryStakerInfo` +fn to_execution_query_staker_info( + address: Address, + info: ExecutionQueryStakerInfo, +) -> grpc_api::ExecutionQueryStakerInfoEntry { + grpc_api::ExecutionQueryStakerInfoEntry { + address: address.to_string(), + info: Some(grpc_api::ExecutionQueryStakerInfo { + active_rolls: info.active_rolls, + production_stats: Some(grpc_api::ExecutionQueryStakerInfoProductionStatsEntry { + address: address.to_string(), + stats: Some(grpc_api::ExecutionQueryStakerInfoProductionStats { + block_success_count: info.production_stats.block_success_count, + block_failure_count: info.production_stats.block_failure_count, + }), + }), + }), + } +} + impl From for grpc_model::SlotExecutionOutput { fn from(value: SlotExecutionOutput) -> Self { match value { SlotExecutionOutput::ExecutedSlot(execution_output) => { grpc_model::SlotExecutionOutput { - status: vec![grpc_model::ExecutionOutputStatus::Candidate as i32], + status: grpc_model::ExecutionOutputStatus::Candidate as i32, execution_output: Some(execution_output.into()), } } SlotExecutionOutput::FinalizedSlot(execution_output) => { grpc_model::SlotExecutionOutput { - status: vec![grpc_model::ExecutionOutputStatus::Final as i32], + status: grpc_model::ExecutionOutputStatus::Final as i32, execution_output: Some(execution_output.into()), } } @@ -37,3 +340,15 @@ impl From for grpc_model::ExecutionOutput { } } } + +impl From for grpc_model::Error { + fn from(value: ExecutionQueryError) -> Self { + match value { + ExecutionQueryError::NotFound(error) => grpc_model::Error { + //TODO to be defined + code: 404, + message: error, + }, + } + } +} diff --git a/massa-final-state/Cargo.toml b/massa-final-state/Cargo.toml index f0d76c6a27c..381c0158730 100644 --- a/massa-final-state/Cargo.toml +++ b/massa-final-state/Cargo.toml @@ -22,7 +22,7 @@ massa_async_pool = { path = "../massa-async-pool" } massa_serialization = { path = "../massa-serialization" } massa_pos_exports = { path = "../massa-pos-exports" } massa_db_exports = { path = "../massa-db-exports" } -massa-proto-rs = { git = "https://github.com/massalabs/massa-proto-rs", rev = "18ec02f", features = ["tonic"] } +massa-proto-rs = { git = "https://github.com/massalabs/massa-proto-rs", rev = "32179e2", features = ["tonic"] } massa_versioning = { path = "../massa-versioning" } massa_time = { path = "../massa-time" } massa_hash = { path = "../massa-hash" } diff --git a/massa-final-state/src/mapping_grpc.rs b/massa-final-state/src/mapping_grpc.rs index 908138fe227..98c6c0986d0 100644 --- a/massa-final-state/src/mapping_grpc.rs +++ b/massa-final-state/src/mapping_grpc.rs @@ -16,9 +16,10 @@ impl From for grpc_model::StateChanges { operation_id: op_id.to_string(), value: Some(grpc_model::ExecutedOpsChangeValue { status: if op_exec_status { - vec![grpc_model::OperationExecutionStatus::Success as i32] + //TODO to be enhanced + grpc_model::OperationExecutionStatus::Success as i32 } else { - vec![grpc_model::OperationExecutionStatus::Failed as i32] + grpc_model::OperationExecutionStatus::Failed as i32 }, slot: Some(op_valid_until_slot.into()), }), diff --git a/massa-grpc/Cargo.toml b/massa-grpc/Cargo.toml index b3735bb5a62..0deba81cabc 100644 --- a/massa-grpc/Cargo.toml +++ b/massa-grpc/Cargo.toml @@ -10,7 +10,7 @@ homepage = "https://massa.net" documentation = "https://docs.massa.net/" [dependencies] -massa-proto-rs = { git = "https://github.com/massalabs/massa-proto-rs", rev = "18ec02f", features = ["tonic"] } +massa-proto-rs = { git = "https://github.com/massalabs/massa-proto-rs", rev = "32179e2", features = ["tonic"] } displaydoc = "0.2" thiserror = "1.0" tonic = { version = "0.9.2", features = ["gzip", "tls"] } @@ -23,9 +23,9 @@ futures-util = "0.3.25" serde = { version = "1.0", features = ["derive"] } tokio = { version = "1.23", features = ["rt-multi-thread", "macros"] } tokio-stream = "0.1.12" -itertools = "0.10" h2 = "0.3.17" tracing = "0.1" +parking_lot = { version = "0.12", features = ["deadlock_detection"] } # custom modules massa_consensus_exports = { path = "../massa-consensus-exports" } massa_hash = { path = "../massa-hash" } @@ -39,6 +39,8 @@ massa_time = { path = "../massa-time" } massa_wallet = { path = "../massa-wallet" } massa_serialization = { path = "../massa-serialization" } massa_versioning = { path = "../massa-versioning" } +massa_signature = { path = "../massa-signature" } +massa_bootstrap = { path = "../massa-bootstrap" } [dev-dependencies] num = "0.4" diff --git a/massa-grpc/src/api.rs b/massa-grpc/src/api.rs deleted file mode 100644 index 105014adae9..00000000000 --- a/massa-grpc/src/api.rs +++ /dev/null @@ -1,650 +0,0 @@ -// Copyright (c) 2023 MASSA LABS - -use crate::error::GrpcError; -use crate::server::MassaGrpc; -use itertools::izip; -use massa_models::address::Address; -use massa_models::block::BlockGraphStatus; -use massa_models::block_id::BlockId; -use massa_models::execution::EventFilter; -use massa_models::operation::{OperationId, SecureShareOperation}; -use massa_models::prehash::PreHashSet; -use massa_models::slot::Slot; -use massa_models::timeslots::{self, get_latest_block_slot_at_timestamp}; -use massa_proto_rs::massa::api::v1 as grpc_api; -use massa_proto_rs::massa::model::v1 as grpc_model; -use massa_time::MassaTime; -use std::str::FromStr; -use tracing::log::warn; - -/// Default offset -const DEFAULT_OFFSET: u64 = 1; -/// Default limit -const DEFAULT_LIMIT: u64 = 50; - -/// Get blocks -pub(crate) fn get_blocks( - grpc: &MassaGrpc, - request: tonic::Request, -) -> Result { - let inner_req = request.into_inner(); - - // Get the block IDs from the request. - let blocks_ids: Vec = inner_req - .queries - .into_iter() - .take(grpc.grpc_config.max_block_ids_per_request as usize + 1) - .map(|query| { - // Get the block ID from the query. - query - .filter - .ok_or_else(|| GrpcError::InvalidArgument("filter is missing".to_string())) - .and_then(|filter| { - BlockId::from_str(filter.id.as_str()).map_err(|_| { - GrpcError::InvalidArgument(format!("invalid block id: {}", filter.id)) - }) - }) - }) - .collect::>()?; - - if blocks_ids.len() as u32 > grpc.grpc_config.max_block_ids_per_request { - return Err(GrpcError::InvalidArgument(format!( - "too many block ids received. Only a maximum of {} block ids are accepted per request", - grpc.grpc_config.max_block_ids_per_request - ))); - } - - // Get the current slot. - let now: MassaTime = MassaTime::now()?; - let current_slot = get_latest_block_slot_at_timestamp( - grpc.grpc_config.thread_count, - grpc.grpc_config.t0, - grpc.grpc_config.genesis_timestamp, - now, - )? - .unwrap_or_else(|| Slot::new(0, 0)); - - // Create the context for the response. - let context = Some(grpc_api::BlocksContext { - slot: Some(current_slot.into()), - }); - - let storage = grpc.storage.clone_without_refs(); - let blocks = blocks_ids - .into_iter() - .filter_map(|id| { - let content = if let Some(wrapped_block) = storage.read_blocks().get(&id) { - wrapped_block.content.clone() - } else { - return None; - }; - - if let Some(graph_status) = grpc - .consensus_controller - .get_block_statuses(&[id]) - .into_iter() - .next() - { - let mut status = Vec::new(); - - if graph_status == BlockGraphStatus::Final { - status.push(grpc_model::BlockStatus::Final.into()); - }; - if graph_status == BlockGraphStatus::ActiveInBlockclique { - status.push(grpc_model::BlockStatus::InBlockclique.into()); - }; - if graph_status == BlockGraphStatus::ActiveInBlockclique - || graph_status == BlockGraphStatus::ActiveInAlternativeCliques - { - status.push(grpc_model::BlockStatus::Candidate.into()); - }; - if graph_status == BlockGraphStatus::Discarded { - status.push(grpc_model::BlockStatus::Discarded.into()); - }; - - return Some(grpc_model::BlockWrapper { - id: id.to_string(), - block: Some(content.into()), - status, - }); - } - - None - }) - .collect::>(); - - Ok(grpc_api::GetBlocksResponse { - id: inner_req.id, - context, - blocks, - }) -} - -/// get blocks by slots -pub(crate) fn get_blocks_by_slots( - grpc: &MassaGrpc, - request: tonic::Request, -) -> Result { - let inner_req = request.into_inner(); - let storage = grpc.storage.clone_without_refs(); - - let mut blocks = Vec::new(); - - for slot in inner_req.slots.into_iter() { - let Some(block_id) = grpc.consensus_controller.get_blockclique_block_at_slot(Slot { - period: slot.period, - thread: slot.thread as u8, - }) else { - continue; - }; - - let res = storage.read_blocks().get(&block_id).map(|b| { - let massa_header = b.clone().content.header; - let operations: Vec = b - .content - .operations - .iter() - .map(|ope| ope.to_string()) - .collect(); - - (massa_header.into(), operations) - }); - - if let Some(block) = res { - blocks.push(grpc_model::Block { - header: Some(block.0), - operations: block.1, - }); - } - } - - Ok(grpc_api::GetBlocksBySlotsResponse { - id: inner_req.id, - blocks, - }) -} - -/// Get multiple datastore entries -pub(crate) fn get_datastore_entries( - grpc: &MassaGrpc, - request: tonic::Request, -) -> Result { - let inner_req = request.into_inner(); - let id = inner_req.id; - - let filters = inner_req - .queries - .into_iter() - .map(|query| match query.filter { - Some(filter) => Address::from_str(filter.address.as_str()) - .map(|address| (address, filter.key)) - .map_err(|e| e.into()), - None => Err(GrpcError::InvalidArgument("filter is missing".to_string())), - }) - .collect::, _>>()?; - - let entries = grpc - .execution_controller - .get_final_and_active_data_entry(filters) - .into_iter() - .map(|output| grpc_api::DatastoreEntry { - final_value: output.0.unwrap_or_default(), - candidate_value: output.1.unwrap_or_default(), - }) - .collect(); - - Ok(grpc_api::GetDatastoreEntriesResponse { id, entries }) -} - -/// Get the largest stakers -pub(crate) fn get_largest_stakers( - grpc: &MassaGrpc, - request: tonic::Request, -) -> Result { - let inner_req = request.into_inner(); - let id = inner_req.id; - - // Parse the query parameters, if provided. - let query_res: Result<(u64, u64, Option), GrpcError> = - inner_req - .query - .map_or(Ok((DEFAULT_OFFSET, DEFAULT_LIMIT, None)), |query| { - let limit = if query.limit == 0 { - DEFAULT_LIMIT - } else { - query.limit - }; - let filter = query.filter; - // If the filter is provided, validate the minimum and maximum roll counts. - let filter_opt = filter - .map(|filter| { - if let Some(min_rolls) = filter.min_rolls { - if min_rolls == 0 { - return Err(GrpcError::InvalidArgument( - "min_rolls should be a positive number".into(), - )); - } - if let Some(max_rolls) = filter.max_rolls { - if max_rolls == 0 { - return Err(GrpcError::InvalidArgument( - "max_rolls should be a positive number".into(), - )); - } - if min_rolls > max_rolls { - return Err(GrpcError::InvalidArgument(format!( - "min_rolls {} cannot be greater than max_rolls {}", - min_rolls, max_rolls - ))); - } - } - } - - Ok(filter) - }) - .transpose()?; // Convert `Option` to `Result