From b7a26ea853827b3df1c7925765e24739ce606da6 Mon Sep 17 00:00:00 2001 From: lukacan Date: Fri, 18 Oct 2024 12:22:01 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Review=20updates=20+=20minor=20vers?= =?UTF-8?q?ions=20updates?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.lock | 407 ++++++++++-------- Cargo.toml | 2 + crates/cli/Cargo.toml | 6 +- crates/cli/src/command/fuzz.rs | 4 +- crates/cli/src/command/init.rs | 11 +- crates/cli/src/howto.md | 13 +- crates/cli/src/lib.rs | 16 +- crates/client/Cargo.toml | 42 +- crates/client/build.rs | 15 - crates/client/src/commander/honggfuzz.rs | 1 - .../fuzz_instructions_generator.rs | 16 +- .../trident-tests/Cargo_fuzz.toml.tmpl | 2 - crates/client/src/utils.rs | 221 ++++++---- .../expected_fuzz_instructions.rs | 37 +- crates/fuzz/Cargo.toml | 21 +- documentation/docs/commands/commands.md | 8 +- documentation/docs/features/arbitrary-data.md | 25 -- .../docs/features/fuzz-instructions.md | 30 ++ .../docs/features/trident-manifest.md | 106 ++--- .../docs/installation/installation.md | 18 +- .../writing-fuzz-test/writing-fuzz-test.md | 61 +-- 21 files changed, 529 insertions(+), 533 deletions(-) delete mode 100644 crates/client/build.rs diff --git a/Cargo.lock b/Cargo.lock index f569dd94a..7c546c089 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -65,9 +65,9 @@ dependencies = [ [[package]] name = "afl" -version = "0.15.10" +version = "0.15.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c21e10b6947189c5ff61343b5354e9ad1c1722bd47b69cd0a6b49e5fa7f7ecf6" +checksum = "80bb240a3b9ff18002142c1a736e98046461d51a694d687c3e7329b456ab0fe4" dependencies = [ "home", "libc", @@ -333,16 +333,16 @@ dependencies = [ [[package]] name = "anstream" -version = "0.3.2" +version = "0.6.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" +checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", - "is-terminal", + "is_terminal_polyfill", "utf8parse", ] @@ -372,19 +372,19 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "1.0.2" +version = "3.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c677ab05e09154296dd37acecd46420c17b9713e8366facafa8fc0885167cf4c" +checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" dependencies = [ "anstyle", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "anyhow" -version = "1.0.89" +version = "1.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" +checksum = "37bf3594c4c988a53154954629820791dde498571819ae4ca50ca811e060cc95" [[package]] name = "aquamarine" @@ -602,9 +602,9 @@ dependencies = [ [[package]] name = "async-compression" -version = "0.4.14" +version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "998282f8f49ccd6116b0ed8a4de0fbd3151697920e7c7533416d6e25e76434a7" +checksum = "0cb8f1d480b0ea3783ab015936d2a55c87e219676f0c0b7dec61494043f21857" dependencies = [ "brotli", "flate2", @@ -631,7 +631,7 @@ checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -828,7 +828,7 @@ dependencies = [ "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", "syn_derive", ] @@ -930,9 +930,9 @@ dependencies = [ [[package]] name = "bytemuck" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94bbb0ad554ad961ddc5da507a12a29b14e4ae5bda06b19f575a3e6079d2e2ae" +checksum = "8334215b81e418a0a7bdb8ef0849474f40bb10c8b71f1c4ed315cff49f32494d" dependencies = [ "bytemuck_derive", ] @@ -945,7 +945,7 @@ checksum = "bcfcc3cd946cb52f0bbfdbbcfa2f4e24f75ebb6c0e1002f7c25904fada18b9ec" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -1011,9 +1011,9 @@ dependencies = [ [[package]] name = "cargo_metadata" -version = "0.17.0" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7daec1a2a2129eeba1644b220b4647ec537b0b5d4bfd6876fcc5a540056b592" +checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" dependencies = [ "camino", "cargo-platform", @@ -1025,9 +1025,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.29" +version = "1.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58e804ac3194a48bb129643eb1d62fcc20d18c6b8c181704489353d13120bcd1" +checksum = "c2e7962b54006dcfcc61cb72735f4d89bb97061dd6a7ed882ec6b8ee53714c6f" dependencies = [ "jobserver", "libc", @@ -1112,37 +1112,36 @@ dependencies = [ [[package]] name = "clap" -version = "4.3.19" +version = "4.5.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fd304a20bff958a57f04c4e96a2e7594cc4490a0e809cbd48bb6437edaa452d" +checksum = "b97f376d85a664d5837dbae44bf546e6477a679ff6610010f17276f686d867e8" dependencies = [ "clap_builder", "clap_derive", - "once_cell", ] [[package]] name = "clap_builder" -version = "4.3.19" +version = "4.5.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01c6a3f08f1fe5662a35cfe393aec09c4df95f60ee93b7556505260f75eee9e1" +checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54" dependencies = [ "anstream", "anstyle", - "clap_lex 0.5.1", - "strsim 0.10.0", + "clap_lex 0.7.2", + "strsim 0.11.1", ] [[package]] name = "clap_derive" -version = "4.3.12" +version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54a9bb5758fc5dfe728d1019941681eccaf0cf8a4189b692a0ee2f2ecf90a050" +checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" dependencies = [ - "heck 0.4.1", + "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -1156,9 +1155,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.5.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961" +checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" [[package]] name = "colorchoice" @@ -1483,7 +1482,7 @@ dependencies = [ "proc-macro2", "quote", "strsim 0.11.1", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -1494,7 +1493,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -1574,7 +1573,7 @@ checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -1659,7 +1658,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -1682,7 +1681,7 @@ checksum = "a6cbae11b3de8fce2a456e8ea3dada226b35fe791f0dc1d360c0941f0bb681f3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -1788,7 +1787,7 @@ checksum = "a1ab991c1362ac86c61ab6f556cff143daa22e5a15e4e189df818b2fd19fe65b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -1801,7 +1800,7 @@ dependencies = [ "num-traits", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -1979,7 +1978,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -2158,6 +2157,12 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + [[package]] name = "hermit-abi" version = "0.1.19" @@ -2278,9 +2283,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.30" +version = "0.14.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a152ddd61dfaec7273fe8419ab357f33aee0d914c5f4efbf0d96fa749eea5ec9" +checksum = "8c08302e8fa335b151b788c775ff56e7a03ae64ff85c548ee820fecb70356e85" dependencies = [ "bytes", "futures-channel", @@ -2453,6 +2458,12 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "is_terminal_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" + [[package]] name = "itertools" version = "0.10.5" @@ -2530,7 +2541,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -2541,9 +2552,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.159" +version = "0.2.161" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" +checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" [[package]] name = "libredox" @@ -2910,7 +2921,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -2991,7 +3002,7 @@ dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -3003,7 +3014,7 @@ dependencies = [ "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -3127,9 +3138,9 @@ checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "pathdiff" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" +checksum = "d61c5ce1153ab5b689d0c074c4e7fc613e942dfb7dd9eea5ab202d2ad91fe361" [[package]] name = "pbkdf2" @@ -3190,7 +3201,7 @@ checksum = "a4502d8515ca9f32f1fb543d987f63d95a14934883db45bdb48060b6b69257f8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -3321,7 +3332,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" dependencies = [ - "toml", + "toml 0.5.11", ] [[package]] @@ -3369,9 +3380,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.87" +version = "1.0.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3e4daa0dcf6feba26f985457cdf104d4b4256fc5a09547140f3631bb076b19a" +checksum = "7c3a7fc5db1e57d5a779a352c8cdb57b29aa4c40cc69c3a68a7fedc815fbf2f9" dependencies = [ "unicode-ident", ] @@ -3393,7 +3404,7 @@ checksum = "9e2e25ee72f5b24d773cae88422baddefff7714f97aab68d96fe2b6fc4a28fb2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -3797,9 +3808,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" +checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" [[package]] name = "ryu" @@ -3848,7 +3859,7 @@ checksum = "1db149f81d46d2deba7cd3c50772474707729550221e69588478ebf9ada425ae" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -3928,14 +3939,14 @@ checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] name = "serde_json" -version = "1.0.128" +version = "1.0.132" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" +checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03" dependencies = [ "itoa", "memchr", @@ -3943,6 +3954,15 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_spanned" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" +dependencies = [ + "serde", +] + [[package]] name = "serde_urlencoded" version = "0.7.1" @@ -3974,7 +3994,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -4134,9 +4154,9 @@ dependencies = [ [[package]] name = "solana-account-decoder" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e356283399b2c951de982eb62cc1675709b74347ba213dee385258c40bf6edd" +checksum = "b109fd3a106e079005167e5b0e6f6d2c88bbedec32530837b584791a8b5abf36" dependencies = [ "Inflector", "base64 0.21.7", @@ -4159,9 +4179,9 @@ dependencies = [ [[package]] name = "solana-accounts-db" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "230bfd49eb42d6b351819dceb5c6ad88343c95470aa5454a42f30358553a286d" +checksum = "ec9829d10d521f3ed5e50c12d2b62784e2901aa484a92c2aa3924151da046139" dependencies = [ "arrayref", "bincode", @@ -4220,9 +4240,9 @@ dependencies = [ [[package]] name = "solana-address-lookup-table-program" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed8aab3582ef7422bd8936f23b2e275f2046450497c7d9363f94b4038792c7c9" +checksum = "f3527a26138b5deb126f13c27743f3d95ac533abee5979e4113f6d59ef919cc6" dependencies = [ "bincode", "bytemuck", @@ -4241,9 +4261,9 @@ dependencies = [ [[package]] name = "solana-banks-client" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39224a595abc172ce3988c4a8a86ee0160c42e866a596c2b11e339af8eb53dd8" +checksum = "e58fa66e1e240097665e7f87b267aa8e976ea3fcbd86918c8fd218c875395ada" dependencies = [ "borsh 1.5.1", "futures", @@ -4258,9 +4278,9 @@ dependencies = [ [[package]] name = "solana-banks-interface" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15c10d280d300a2842e61496bddadf36bc6ff905b82c023c60cab1e06e8e9b81" +checksum = "f54d0a4334c153eadaa0326296a47a92d110c1cc975075fd6e1a7b67067f9812" dependencies = [ "serde", "solana-sdk", @@ -4269,9 +4289,9 @@ dependencies = [ [[package]] name = "solana-banks-server" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6adac8fca8711cde097e04212e1b40aa29dce914615fdeff716aa92e4a59fbda" +checksum = "8cbe287a0f859362de9b155fabd44e479eba26d5d80e07a7d021297b7b06ecba" dependencies = [ "bincode", "crossbeam-channel", @@ -4289,9 +4309,9 @@ dependencies = [ [[package]] name = "solana-bpf-loader-program" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c52233e6e755f8e373e98360fdcb7c1be2f687dd77f28fee1b729dbb4dcca5c" +checksum = "a8cc27ceda9a22804d73902f5d718ff1331aa53990c2665c90535f6b182db259" dependencies = [ "bincode", "byteorder", @@ -4308,9 +4328,9 @@ dependencies = [ [[package]] name = "solana-bucket-map" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48a53e2c48ddc4228a68e948b2b16667baf34aecb9965c6657a3f0ac06cbacc8" +checksum = "ca55ec9b8d01d2e3bba9fad77b27c9a8fd51fe12475549b93a853d921b653139" dependencies = [ "bv", "bytemuck", @@ -4326,9 +4346,9 @@ dependencies = [ [[package]] name = "solana-clap-utils" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c24c90a1269fa8183c1ad0278ba9dd5c852e8123783c5ece8b09bd8b4d66e2b" +checksum = "074ef478856a45d5627270fbc6b331f91de9aae7128242d9e423931013fb8a2a" dependencies = [ "chrono", "clap 2.34.0", @@ -4343,9 +4363,9 @@ dependencies = [ [[package]] name = "solana-client" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54b4ae9862e933cb25f562a86845b1cef9e69afcaa8ff20649ef62a41720f67e" +checksum = "24a9f32c42402c4b9484d5868ac74b7e0a746e3905d8bfd756e1203e50cbb87e" dependencies = [ "async-trait", "bincode", @@ -4376,9 +4396,9 @@ dependencies = [ [[package]] name = "solana-compute-budget-program" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15bd6622368e53d2ce779c86b1f4b6c3d7d9bff9fa349d46d5395db041d76e43" +checksum = "6af050a6e0b402e322aa21f5441c7e27cdd52624a2d659f455b68afd7cda218c" dependencies = [ "solana-program-runtime", "solana-sdk", @@ -4386,9 +4406,9 @@ dependencies = [ [[package]] name = "solana-config-program" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d168e532a44f8651b533904df5ac8ad94db6ffc6e7353fdee148151cbbbbf97" +checksum = "9d75b803860c0098e021a26f0624129007c15badd5b0bc2fbd9f0e1a73060d3b" dependencies = [ "bincode", "chrono", @@ -4400,9 +4420,9 @@ dependencies = [ [[package]] name = "solana-connection-cache" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2afec309b7eea9056d3987afbb0cbdbeba15f694e3d8180ce698fc50a8f1940a" +checksum = "b9306ede13e8ceeab8a096bcf5fa7126731e44c201ca1721ea3c38d89bcd4111" dependencies = [ "async-trait", "bincode", @@ -4422,9 +4442,9 @@ dependencies = [ [[package]] name = "solana-cost-model" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf05970fc6b353bed731b3a64d72423b67894b23800864abc6b50ab0152a77cf" +checksum = "c852790063f7646a1c5199234cc82e1304b55a3b3fb8055a0b5c8b0393565c1c" dependencies = [ "lazy_static", "log", @@ -4446,9 +4466,9 @@ dependencies = [ [[package]] name = "solana-frozen-abi" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45478bad85abd8cc291775463e15bc1031fdbf973d48e2568e8defee3d842a3a" +checksum = "03ab2c30c15311b511c0d1151e4ab6bc9a3e080a37e7c6e7c2d96f5784cf9434" dependencies = [ "block-buffer 0.10.4", "bs58 0.4.0", @@ -4471,21 +4491,21 @@ dependencies = [ [[package]] name = "solana-frozen-abi-macro" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5cb05f9051446226cd26ea17f6fbe5e28e922ad6a846166db7fb17865090fcb" +checksum = "c142f779c3633ac83c84d04ff06c70e1f558c876f13358bed77ba629c7417932" dependencies = [ "proc-macro2", "quote", "rustc_version", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] name = "solana-loader-v4-program" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "305a01a37cb1d61bc17d4fbac110fa8ae67f2d8009f73533abe30a08c931e07b" +checksum = "78b58f70f5883b0f26a6011ed23f76c493a3f22df63aec46cfe8e1b9bf82b5cc" dependencies = [ "log", "solana-measure", @@ -4496,9 +4516,9 @@ dependencies = [ [[package]] name = "solana-logger" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cbcde62a32962c3f80aebe0047476dcb2b693b5d47110071af0d23561c3aa0c" +checksum = "121d36ffb3c6b958763312cbc697fbccba46ee837d3a0aa4fc0e90fcb3b884f3" dependencies = [ "env_logger", "lazy_static", @@ -4507,9 +4527,9 @@ dependencies = [ [[package]] name = "solana-measure" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98d4d5a65011530f2cfb0d349e00cc18d73c80cec7a3d35a49cd8ceaa627cb54" +checksum = "5c01a7f9cdc9d9d37a3d5651b2fe7ec9d433c2a3470b9f35897e373b421f0737" dependencies = [ "log", "solana-sdk", @@ -4517,9 +4537,9 @@ dependencies = [ [[package]] name = "solana-metrics" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08e6fc813645eb514ce038fb66785f2a75bbe54d963f27e2bdcf72e351146e6" +checksum = "71e36052aff6be1536bdf6f737c6e69aca9dbb6a2f3f582e14ecb0ddc0cd66ce" dependencies = [ "crossbeam-channel", "gethostname", @@ -4532,9 +4552,9 @@ dependencies = [ [[package]] name = "solana-net-utils" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7813329d0cf9db238d8c731959869a969761d10cc043f0bb2ee6e2581f59e3e7" +checksum = "2a1f5c6be9c5b272866673741e1ebc64b2ea2118e5c6301babbce526fdfb15f4" dependencies = [ "bincode", "clap 3.2.25", @@ -4560,9 +4580,9 @@ checksum = "8b8a731ed60e89177c8a7ab05fe0f1511cedd3e70e773f288f9de33a9cfdc21e" [[package]] name = "solana-perf" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97143e2d6f887b3caebf25adef9f6d7532c1dbf86057213573c7f6adf8bbe16c" +checksum = "28acaf22477566a0fbddd67249ea5d859b39bacdb624aff3fadd3c5745e2643c" dependencies = [ "ahash 0.8.11", "bincode", @@ -4589,9 +4609,9 @@ dependencies = [ [[package]] name = "solana-program" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a52f4c424433a18b57ae88a35b677c548879a9c4ca1e27e108d1597ff12b95ac" +checksum = "c10f4588cefd716b24a1a40dd32c278e43a560ab8ce4de6b5805c9d113afdfa1" dependencies = [ "ark-bn254", "ark-ec", @@ -4644,9 +4664,9 @@ dependencies = [ [[package]] name = "solana-program-runtime" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eebd6ed32dfa7b69aeca65d1f971abc1f7211b4e386a6fb89d514d97d0a01d1c" +checksum = "fbf0c3eab2a80f514289af1f422c121defb030937643c43b117959d6f1932fb5" dependencies = [ "base64 0.21.7", "bincode", @@ -4672,9 +4692,9 @@ dependencies = [ [[package]] name = "solana-program-test" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9b2afc6ce58c42ba74f055e3b3e2c4b78cd123ae81e7afe14565d7bd7f15cf2" +checksum = "c1382a5768ff738e283770ee331d0a4fa04aa1aceed8eb820a97094c93d53b72" dependencies = [ "assert_matches", "async-trait", @@ -4702,9 +4722,9 @@ dependencies = [ [[package]] name = "solana-pubsub-client" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fee72bfa134d5737792915a013fb149e0d9b61fc13567c534d991cda2ebd8ccb" +checksum = "b064e76909d33821b80fdd826e6757251934a52958220c92639f634bea90366d" dependencies = [ "crossbeam-channel", "futures-util", @@ -4727,9 +4747,9 @@ dependencies = [ [[package]] name = "solana-quic-client" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f35db43502fb78b0f47324924d67d701999f870622de8f3aa515ca2a5c1ed97" +checksum = "5a90e40ee593f6e9ddd722d296df56743514ae804975a76d47e7afed4e3da244" dependencies = [ "async-mutex", "async-trait", @@ -4754,9 +4774,9 @@ dependencies = [ [[package]] name = "solana-rayon-threadlimit" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c395a20626d440fe5377fc48e8aed0d4d995250bbf7239e651e7f4a6c7f1a3a9" +checksum = "66468f9c014992167de10cc68aad6ac8919a8c8ff428dc88c0d2b4da8c02b8b7" dependencies = [ "lazy_static", "num_cpus", @@ -4764,9 +4784,9 @@ dependencies = [ [[package]] name = "solana-remote-wallet" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aeaeee9f5c950e31daa273a446ad0cb46b5bf7ce579fc9d33f6d528930ac5246" +checksum = "c191019f4d4f84281a6d0dd9a43181146b33019627fc394e42e08ade8976b431" dependencies = [ "console", "dialoguer", @@ -4783,9 +4803,9 @@ dependencies = [ [[package]] name = "solana-rpc-client" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39c5a1f2465f8ecff7f1ef8026ee45ddd4e26790785fd56214193b7e4f53d69c" +checksum = "36ed4628e338077c195ddbf790693d410123d17dec0a319b5accb4aaee3fb15c" dependencies = [ "async-trait", "base64 0.21.7", @@ -4809,9 +4829,9 @@ dependencies = [ [[package]] name = "solana-rpc-client-api" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87eb2c3106e48bc02d61a8f5df98956b7cfb370391dd0aa55bba63142e066519" +checksum = "83c913551faa4a1ae4bbfef6af19f3a5cf847285c05b4409e37c8993b3444229" dependencies = [ "base64 0.21.7", "bs58 0.4.0", @@ -4831,9 +4851,9 @@ dependencies = [ [[package]] name = "solana-rpc-client-nonce-utils" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aefdec90fbee3c1bc845b1f2c99271707532bd336e55b4a2362843c0d93cfb9f" +checksum = "1a47b6bb1834e6141a799db62bbdcf80d17a7d58d7bc1684c614e01a7293d7cf" dependencies = [ "clap 2.34.0", "solana-clap-utils", @@ -4844,9 +4864,9 @@ dependencies = [ [[package]] name = "solana-runtime" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "873dc299dd99af8431f28a2ff5e99291ecd5132394b7f07dcd3023c22288a23f" +checksum = "73a12e1270121e1ca6a4e86d6d0f5c339f0811a8435161d9eee54cbb0a083859" dependencies = [ "aquamarine", "arrayref", @@ -4921,9 +4941,9 @@ dependencies = [ [[package]] name = "solana-sdk" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02bfb6b467e755620f4d3f8eefd1e5bdfb812ec7076d237e0280d7c988f16f02" +checksum = "580ad66c2f7a4c3cb3244fe21440546bd500f5ecb955ad9826e92a78dded8009" dependencies = [ "assert_matches", "base64 0.21.7", @@ -4976,15 +4996,15 @@ dependencies = [ [[package]] name = "solana-sdk-macro" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed90de8086a0e114ab63454a9d066e0f08eb2c9c8aea149ff60e8a492f165fc" +checksum = "1b75d0f193a27719257af19144fdaebec0415d1c9e9226ae4bd29b791be5e9bd" dependencies = [ "bs58 0.4.0", "proc-macro2", "quote", "rustversion", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -4995,9 +5015,9 @@ checksum = "468aa43b7edb1f9b7b7b686d5c3aeb6630dc1708e86e31343499dd5c4d775183" [[package]] name = "solana-send-transaction-service" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32debecc6ec07dff24ae78303597cd50d752a40815ef4c05ddeb0215d7ba7399" +checksum = "3218f670f582126a3859c4fd152e922b93b3748a636bb143f970391925723577" dependencies = [ "crossbeam-channel", "log", @@ -5011,9 +5031,9 @@ dependencies = [ [[package]] name = "solana-stake-program" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "764b9acc6d994f650d9f8a6b8714e9e3827c70e3156d3d103739e3191dbba7d6" +checksum = "eeb3e0d2dc7080b9fa61b34699b176911684f5e04e8df4b565b2b6c962bb4321" dependencies = [ "bincode", "log", @@ -5026,9 +5046,9 @@ dependencies = [ [[package]] name = "solana-streamer" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9760ce926b15511f3eacbd465bf221a2f0aa3f5ff7320e978b4ad87c1a8c00e" +checksum = "f8476e41ad94fe492e8c06697ee35912cf3080aae0c9e9ac6430835256ccf056" dependencies = [ "async-channel", "bytes", @@ -5059,9 +5079,9 @@ dependencies = [ [[package]] name = "solana-system-program" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9a7c1fc46057d971a7daaf45051f35d8beef15b71986caac362b489afeba80c" +checksum = "26f31e04f5baad7cbc2281fea312c4e48277da42a93a0ba050b74edc5a74d63c" dependencies = [ "bincode", "log", @@ -5073,9 +5093,9 @@ dependencies = [ [[package]] name = "solana-thin-client" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "242cb2a51e362fd4726aa99ac35b79591d5fe6266babe51a1ca2394164452844" +checksum = "d8c02245d0d232430e79dc0d624aa42d50006097c3aec99ac82ac299eaa3a73f" dependencies = [ "bincode", "log", @@ -5088,9 +5108,9 @@ dependencies = [ [[package]] name = "solana-tpu-client" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd8bed20fc73d3ff987bd61f944286676979476440d6b4712eceb3840d1c27cf" +checksum = "67251506ed03de15f1347b46636b45c47da6be75015b4a13f0620b21beb00566" dependencies = [ "async-trait", "bincode", @@ -5112,9 +5132,9 @@ dependencies = [ [[package]] name = "solana-transaction-status" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a05c9059ee5e9a5e9ae86819ccc3e8d464e128011c586ecb3be696ebba81ac34" +checksum = "2d3d36db1b2ab2801afd5482aad9fb15ed7959f774c81a77299fdd0ddcf839d4" dependencies = [ "Inflector", "base64 0.21.7", @@ -5137,9 +5157,9 @@ dependencies = [ [[package]] name = "solana-udp-client" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5bf19b261fa8995700507c71687fa4c401000df687602b07189460cf16e803a" +checksum = "3a754a3c2265eb02e0c35aeaca96643951f03cee6b376afe12e0cf8860ffccd1" dependencies = [ "async-trait", "solana-connection-cache", @@ -5152,9 +5172,9 @@ dependencies = [ [[package]] name = "solana-version" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5318c8f6e0bd979dd36b3e15a9c341dfba7e4414dc9fff6ae23d41cbda6ba41" +checksum = "f44776bd685cc02e67ba264384acc12ef2931d01d1a9f851cb8cdbd3ce455b9e" dependencies = [ "log", "rustc_version", @@ -5168,9 +5188,9 @@ dependencies = [ [[package]] name = "solana-vote" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a4adb8233c50952389ad749741f9a2475326d09924c145970e91dd91f18b49d" +checksum = "b5983370c95b615dc5f5d0e85414c499f05380393c578749bcd14c114c77c9bc" dependencies = [ "crossbeam-channel", "itertools", @@ -5187,9 +5207,9 @@ dependencies = [ [[package]] name = "solana-vote-program" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c451e38f9e64205837eadd69b9928763d167ef93177f3eeb86059b21ed83fcbc" +checksum = "25810970c91feb579bd3f67dca215fce971522e42bfd59696af89c5dfebd997c" dependencies = [ "bincode", "log", @@ -5209,9 +5229,9 @@ dependencies = [ [[package]] name = "solana-zk-token-proof-program" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "142bc5ea7581c04de926871d361cc0f295561fdd849292d923524079a6d96fcf" +checksum = "1be1c15d4aace575e2de73ebeb9b37bac455e89bee9a8c3531f47ac5066b33e1" dependencies = [ "bytemuck", "num-derive 0.4.2", @@ -5223,9 +5243,9 @@ dependencies = [ [[package]] name = "solana-zk-token-sdk" -version = "1.18.25" +version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7569e85e3b1c8abc089ec06153b4ded577bc94bf383f607d5017082497f53665" +checksum = "7cbdf4249b6dfcbba7d84e2b53313698043f60f8e22ce48286e6fbe8a17c8d16" dependencies = [ "aes-gcm-siv", "base64 0.21.7", @@ -5326,7 +5346,7 @@ checksum = "07fd7858fc4ff8fb0e34090e41d7eb06a823e1057945c26d480bfc21d2338a93" dependencies = [ "quote", "spl-discriminator-syn", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -5338,7 +5358,7 @@ dependencies = [ "proc-macro2", "quote", "sha2 0.10.8", - "syn 2.0.79", + "syn 2.0.82", "thiserror", ] @@ -5386,7 +5406,7 @@ dependencies = [ "proc-macro2", "quote", "sha2 0.10.8", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -5575,9 +5595,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.79" +version = "2.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" +checksum = "83540f837a8afc019423a8edb95b52a8effe46957ee402287f4292fae35be021" dependencies = [ "proc-macro2", "quote", @@ -5593,7 +5613,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -5754,7 +5774,7 @@ dependencies = [ "cfg-if", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -5765,7 +5785,7 @@ checksum = "5c89e72a01ed4c579669add59014b9a524d609c0c88c6a585ce37485879f6ffb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", "test-case-core", ] @@ -5801,7 +5821,7 @@ checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -5905,7 +5925,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -5994,15 +6014,30 @@ version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" dependencies = [ - "indexmap 1.9.3", "serde", ] +[[package]] +name = "toml" +version = "0.8.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" +dependencies = [ + "indexmap 2.6.0", + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit 0.22.22", +] + [[package]] name = "toml_datetime" version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" +dependencies = [ + "serde", +] [[package]] name = "toml_edit" @@ -6022,6 +6057,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ "indexmap 2.6.0", + "serde", + "serde_spanned", "toml_datetime", "winnow 0.6.20", ] @@ -6052,7 +6089,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -6094,7 +6131,7 @@ name = "trident-cli" version = "0.7.0" dependencies = [ "anyhow", - "clap 4.3.19", + "clap 4.5.20", "fehler", "termimad", "tokio", @@ -6112,28 +6149,23 @@ dependencies = [ "anyhow", "arbitrary", "bincode", - "borsh 0.10.4", "cargo_metadata", "convert_case", "fehler", "futures", "honggfuzz", - "indicatif", - "log", "pathdiff", "pretty_assertions", - "proc-macro2", "quinn-proto", "quote", - "regex", "serde", "serde_json", "solana-program-test", "solana-sdk", - "syn 1.0.109", + "syn 2.0.82", "thiserror", "tokio", - "toml", + "toml 0.8.19", "trident-derive-displayix", "trident-derive-fuzz-test-executor", "trident-fuzz", @@ -6167,7 +6199,6 @@ dependencies = [ "fehler", "prettytable", "rand 0.8.5", - "regex", "serde", "serde_json", "solana-banks-client", @@ -6177,7 +6208,7 @@ dependencies = [ "spl-token", "thiserror", "tokio", - "toml", + "toml 0.8.19", ] [[package]] @@ -6393,7 +6424,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", "wasm-bindgen-shared", ] @@ -6427,7 +6458,7 @@ checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -6747,7 +6778,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -6767,7 +6798,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 0a38a1579..238e829de 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,6 +10,8 @@ anchor-syn = "0.30.1" anchor-lang = "0.30.1" anchor-lang-idl-spec = "0.1.0" +# ARBITRARY +arbitrary = { version = "1.3.0", features = ["derive"] } # SOLANA solana-sdk = "1.17.4" diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 23988cd05..85f09eff6 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -12,8 +12,8 @@ description = "Trident is Rust based testing framework providing several conveni trident-client = { path = "../client", version = "0.7.0" } # MISC -clap = { version = "=4.3.19", features = ["derive"] } +clap = { version = "4", features = ["derive"] } tokio = { version = "1" } -anyhow = { version = "1.0.45" } -fehler = { version = "1.0.0" } +anyhow = { version = "1" } +fehler = { version = "1" } termimad = "0.30.0" diff --git a/crates/cli/src/command/fuzz.rs b/crates/cli/src/command/fuzz.rs index 14feb88b0..f2da6d1a4 100644 --- a/crates/cli/src/command/fuzz.rs +++ b/crates/cli/src/command/fuzz.rs @@ -58,7 +58,7 @@ pub enum FuzzCommand { \n \x1b[1m\x1b[4m:\x1b[0m Path to the crash found during fuzzing.\ \n\n\x1b[1m\x1b[4mHINT:\x1b[0m By default crashfiles will be stored in the following folders:\ \n \x1b[1m\x1b[4mHonggfuzz:\x1b[0m trident-tests/fuzz_tests/fuzzing/honggfuzz/hfuzz_workspace/\ - \n \x1b[1m\x1b[4mAFL:\x1b[0m trident-tests/fuzz_tests/fuzzing/afl/afl_workspace/default/crashes\ + \n \x1b[1m\x1b[4mAFL:\x1b[0m trident-tests/fuzz_tests/fuzzing/afl/afl_workspace/out/default/crashes\ \n\n\x1b[1m\x1b[4mEXAMPLE:\x1b[0m\ \n trident fuzz debug-afl fuzz_0 trident-tests/fuzz_tests/fuzzing/afl/afl_workspace/out/default/crashes/id...\ \n\n\x1b[1m\x1b[33mWarning\x1b[0m:\ @@ -81,7 +81,7 @@ pub enum FuzzCommand { \n \x1b[1m\x1b[4m:\x1b[0m Path to the crash found during fuzzing.\ \n\n\x1b[1m\x1b[4mHINT:\x1b[0m By default crashfiles will be stored in the following folders:\ \n \x1b[1m\x1b[4mHonggfuzz:\x1b[0m trident-tests/fuzz_tests/fuzzing/honggfuzz/hfuzz_workspace/\ - \n \x1b[1m\x1b[4mAFL:\x1b[0m trident-tests/fuzz_tests/fuzzing/afl/afl_workspace/default/crashes\ + \n \x1b[1m\x1b[4mAFL:\x1b[0m trident-tests/fuzz_tests/fuzzing/afl/afl_workspace/out/default/crashes\ \n\n\x1b[1m\x1b[4mEXAMPLE:\x1b[0m\ \n trident fuzz debug-hfuzz fuzz_0 trident-tests/fuzz_tests/fuzzing/honggfuzz/hfuzz_workspace/fuzz_0/SIGAR...\ \n\n\x1b[1m\x1b[33mWarning\x1b[0m:\ diff --git a/crates/cli/src/command/init.rs b/crates/cli/src/command/init.rs index efe4b470c..330dbd132 100644 --- a/crates/cli/src/command/init.rs +++ b/crates/cli/src/command/init.rs @@ -23,14 +23,19 @@ pub async fn init(force: bool) { if force { generator.initialize().await?; + show_howto(); } else { let root_path = Path::new(&root).join(TRIDENT_TOML); if root_path.exists() { - println!("{SKIP} It looks like Trident is already initialized as the Trident.toml was found in {} directory.",root); + println!( + "{SKIP}: It looks like Trident is already initialized.\n\ + Trident.toml was found in {} directory.\n\ + In case you want to reinitialize the workspace use --force/-f flag.", + root + ); } else { generator.initialize().await?; + show_howto(); } } - - show_howto(); } diff --git a/crates/cli/src/howto.md b/crates/cli/src/howto.md index d421ce782..a74e802bc 100644 --- a/crates/cli/src/howto.md +++ b/crates/cli/src/howto.md @@ -4,6 +4,15 @@ ## To start fuzzing, follow these steps: +- Install ***Honggfuzz*** + +```bash +cargo install honggfuzz +``` + +For supported versions check https://ackee.xyz/trident/docs/latest/getting-started/getting-started/#supported-versions + + - Initialize ***Trident*** using ```bash @@ -34,11 +43,11 @@ type InitializeFnSnapshot<'info> = InitializeContextAlias<'info>; - Run fuzzing with ***Honggfuzz*** or ***AFL*** ```bash -trident fuzz run-hfuzz +trident fuzz run-hfuzz ``` ```bash -trident fuzz run-afl +trident fuzz run-afl ``` ### For more details, refer to the Trident documentation: https://ackee.xyz/trident/docs/dev/ diff --git a/crates/cli/src/lib.rs b/crates/cli/src/lib.rs index 3a0241e43..b3a04f115 100644 --- a/crates/cli/src/lib.rs +++ b/crates/cli/src/lib.rs @@ -19,7 +19,6 @@ macro_rules! load_template { #[derive(Parser)] #[command( name = "Trident", - version = "0.7.0", about = "Trident is Rust based fuzzer for Solana programs written using Anchor framework." )] struct Cli { @@ -33,16 +32,14 @@ enum Command { How, #[command( about = "Initialize Trident in the current Anchor workspace.", - override_usage = "\nTrident will skip initialization if Trident.toml already exists.\ - \nIf you are sure that you want to proceed with initialization even though the Trident.toml already exists,\ - \ncall trident init -f / --force." + override_usage = "\nTrident will skip initialization if Trident.toml already exists." )] Init { #[arg( short, long, required = false, - help = "Force Trident Initialization. Trident dependencies will be updated based on the version of Trident." + help = "Force Trident initialization. Trident dependencies will be updated based on the version of Trident CLI." )] force: bool, }, @@ -51,15 +48,18 @@ enum Command { override_usage = "With fuzz subcommands you can add new fuzz test \ template or you can run fuzz test on already initialzied one.\ \n\n\x1b[1m\x1b[4mEXAMPLE:\x1b[0m\ - \n trident add\n trident fuzz run-afl fuzz_0\ - \n trident fuzz debug-hfuzz \x1b[92m\x1b[0m \x1b[92m\x1b[0m" + \n trident add\ + \n trident fuzz run-afl fuzz_0\ + \n trident fuzz run-hfuzz fuzz_0\ + \n trident fuzz debug-hfuzz fuzz_0 \x1b[92m\x1b[0m\ + \n trident fuzz debug-afl fuzz_0 \x1b[92m\x1b[0m" )] Fuzz { #[clap(subcommand)] subcmd: FuzzCommand, }, #[command( - about = "Clean build targets of AFL and Honggfuzz, additionally perform `anchor build`" + about = "Clean build targets of AFL and Honggfuzz, additionally perform `anchor clean`" )] Clean, } diff --git a/crates/client/Cargo.toml b/crates/client/Cargo.toml index d3f583935..50d5acff4 100644 --- a/crates/client/Cargo.toml +++ b/crates/client/Cargo.toml @@ -7,11 +7,6 @@ license-file = "../../LICENSE" readme = "../../README.md" description = "The trident_client crate helps you build and deploy an Anchor program to a local cluster and run a test suite against it." -[build-dependencies] -anyhow = { version = "1.0.45", features = ["std"], default-features = false } - -[dev-dependencies] -pretty_assertions = "1.1.0" [dependencies] # TRIDENT @@ -38,27 +33,26 @@ honggfuzz = { version = "0.5.55" } afl = { version = "0.15.10" } # ARBITRARY -arbitrary = { version = "1.3.0", features = ["derive"] } +arbitrary = { workspace = true } # MISC tokio = "1" -serde_json = "1.0.72" -serde = { version = "1.0.136", default-features = false } -bincode = "1.3.3" -borsh = "0.10.3" -futures = "0.3.18" -fehler = "1.0.0" -thiserror = "1.0.30" -anyhow = { version = "1.0.45" } -cargo_metadata = "0.17.0" -syn = { version = "1.0.109", features = ["visit"] } -quote = "1.0.14" -toml = { version = "0.5.8", features = ["preserve_order"] } -log = "0.4" -proc-macro2 = { version = "1.0.66", default-features = false } +serde_json = "1" +serde = { version = "1", default-features = false } +bincode = "1" +futures = "0.3" +fehler = "1" +thiserror = "1" +anyhow = "1" +cargo_metadata = "0.18" quinn-proto = { version = "0.10.6", features = ["arbitrary"] } -pathdiff = "0.2.1" -indicatif = "0.17.8" -regex = "1.10.3" -convert_case = "0.6.0" +syn = { version = "2", features = ["visit", "full"] } +quote = "1" +toml = { version = "0.8", features = ["preserve_order"] } +pathdiff = "0.2" +convert_case = "0.6" + + +[dev-dependencies] +pretty_assertions = "1.1.0" diff --git a/crates/client/build.rs b/crates/client/build.rs deleted file mode 100644 index 6ebcd410c..000000000 --- a/crates/client/build.rs +++ /dev/null @@ -1,15 +0,0 @@ -use anyhow::Result; -// todo: use vergen before you want to uncomment comments in `generate_program_client_deps` -// (commander.rs lines 198 - 207) -// - this code is commented because of a problem with vergen's `git` feature during publishing the crate -// - the problem was: it wasn't able to find the repository (commit hashes) because the published crate -// does not contain the .git folder (make sure this is fixed before the publish) -// - before you uncomment the mentioned code, don't forget to add the `git` feature to Cargo.toml -// use vergen::{vergen, Config}; - -fn main() -> Result<()> { - // `vergen` creates env variables with info about - // the current commit hash or the crate version. - // vergen(Config::default()) - Ok(()) -} diff --git a/crates/client/src/commander/honggfuzz.rs b/crates/client/src/commander/honggfuzz.rs index 47393cfcd..5d6882c24 100644 --- a/crates/client/src/commander/honggfuzz.rs +++ b/crates/client/src/commander/honggfuzz.rs @@ -41,7 +41,6 @@ impl Commander { } } - println!("{}", cargo_target_dir); match config.get_fuzzing_with_stats() { true => { // enforce keep output to be true diff --git a/crates/client/src/source_code_generators/fuzz_instructions_generator.rs b/crates/client/src/source_code_generators/fuzz_instructions_generator.rs index 707bb0272..951ac7f73 100644 --- a/crates/client/src/source_code_generators/fuzz_instructions_generator.rs +++ b/crates/client/src/source_code_generators/fuzz_instructions_generator.rs @@ -34,10 +34,7 @@ pub fn generate_source_code(idls: &[Idl]) -> String { use trident_client::fuzzing::*; /// Link the relevant Account Context Alias from the program. - /// Aliases are generated by the `AccountsSnapshots` macro and stored in - /// a module named `trident_fuzz__snapshot::`. - /// Example: `use hello_world::trident_fuzz_initialize_context_snapshot::InitializeContextAlias;` - /// For more complex programs, you may need to find the appropriate module. + /// Aliases are generated by the `AccountsSnapshots` macro. #(#all_snapshot_types)* @@ -304,13 +301,13 @@ fn get_instruction_ixops( type IxAccounts = FuzzAccounts; type IxSnapshot = #ix_snapshot<'info>; - /// The `get_program_id()` function specifies the program ID that the Instruction is associated with. + /// Definition of the program ID that the Instruction is associated with. fn get_program_id(&self) -> solana_sdk::pubkey::Pubkey { #module_name::ID } - /// The `get_data()` function specifies the structure of the Instruction data. - /// You can utilize randomly generated data from the fuzzer using `self.data.arg_name` + /// Definition of the Instruction data. + /// Use randomly generated data from the fuzzer using `self.data.arg_name` /// or customize the data as needed. /// For more details, visit: https://ackee.xyz/trident/docs/dev/features/fuzz-instructions/#get-data fn get_data( @@ -324,9 +321,10 @@ fn get_instruction_ixops( Ok(data) } - /// The `get_accounts()` function specifies the structure of the accounts required by the Instruction. + /// Definition of of the accounts required by the Instruction. /// To utilize accounts stored in `FuzzAccounts`, use `fuzz_accounts.account_name.get_or_create_account()`. - /// This method will either create a new account or return an existing one. + /// If no signers are required, leave the vector empty. + /// For AccountMetas use ::accounts:: /// For more details, see: https://ackee.xyz/trident/docs/dev/features/fuzz-instructions/#get-accounts fn get_accounts( &self, diff --git a/crates/client/src/templates/trident-tests/Cargo_fuzz.toml.tmpl b/crates/client/src/templates/trident-tests/Cargo_fuzz.toml.tmpl index 5103f5e6d..0a039451a 100644 --- a/crates/client/src/templates/trident-tests/Cargo_fuzz.toml.tmpl +++ b/crates/client/src/templates/trident-tests/Cargo_fuzz.toml.tmpl @@ -4,8 +4,6 @@ version = "0.1.0" description = "Created with Trident" edition = "2021" -# Dependencies specific to Fuzz test [dependencies] -# ... your dependencies here arbitrary = "1.3.0" assert_matches = "1.4.0" diff --git a/crates/client/src/utils.rs b/crates/client/src/utils.rs index e7b6ce44a..a268f18a5 100644 --- a/crates/client/src/utils.rs +++ b/crates/client/src/utils.rs @@ -1,6 +1,7 @@ use crate::test_generator::Error; use crate::versions_config::TridentVersionsConfig; +use crate::constants::*; use cargo_metadata::Package; use fehler::{throw, throws}; use std::path::Path; @@ -9,8 +10,6 @@ use std::{fs::OpenOptions, io, path::PathBuf}; use tokio::fs; use toml::{value::Table, Value}; -use crate::constants::*; - #[macro_export] macro_rules! construct_path { ($root:expr, $($component:expr),*) => { @@ -145,7 +144,7 @@ pub fn ensure_table<'a>(content: &'a mut Value, table_name: &str) -> Result<&'a .as_table_mut() .ok_or(Error::ParsingCargoTomlDependenciesFailed)? .entry(table_name) - .or_insert(Value::Table(Table::new())) + .or_insert(Value::Table(toml::Table::new())) .as_table_mut() .ok_or(Error::ParsingCargoTomlDependenciesFailed) } @@ -156,41 +155,49 @@ pub async fn initialize_package_metadata( ) { for package in packages { let manifest_path = package.manifest_path.as_std_path(); - let mut cargo_toml_content: Value = fs::read_to_string(&manifest_path).await?.parse()?; + let cargo_toml_content = fs::read_to_string(&manifest_path).await?; + let mut cargo_toml: Value = toml::from_str(&cargo_toml_content)?; // Ensure the 'trident-fuzzing' feature exists with the required dependency. - let features_table = ensure_table(&mut cargo_toml_content, "features")?; + let features_table = ensure_table(&mut cargo_toml, "features")?; - features_table.insert("trident-fuzzing".to_owned(), { - Value::Array(vec![Value::String("dep:trident-fuzz".to_string())]) - }); + features_table.insert( + "trident-fuzzing".to_string(), + Value::Array(vec![Value::String("dep:trident-fuzz".to_string())]), + ); // Ensure the required dependencies are present in the 'dependencies' section. - let dependencies_table = ensure_table(&mut cargo_toml_content, "dependencies")?; + let dependencies_table = ensure_table(&mut cargo_toml, "dependencies")?; // Add 'trident-derive-accounts-snapshots' dependency in table format. - dependencies_table.insert("trident-derive-accounts-snapshots".to_owned(), { - let mut snapshots_table = Table::new(); - snapshots_table.insert( - "version".to_string(), - Value::String(versions_config.trident_derive_accounts_snapshots.clone()), - ); - Value::Table(snapshots_table) - }); + dependencies_table.insert( + "trident-derive-accounts-snapshots".to_string(), + Value::Table({ + let mut snapshots_table = toml::Table::new(); + snapshots_table.insert( + "version".to_string(), + Value::String(versions_config.trident_derive_accounts_snapshots.clone()), + ); + snapshots_table + }), + ); // Add 'trident-fuzz' dependency with specified attributes if not present. - dependencies_table.insert("trident-fuzz".to_owned(), { - let mut trident_fuzz_table = Table::new(); - trident_fuzz_table.insert( - "version".to_string(), - Value::String(versions_config.trident_fuzz.clone()), - ); - trident_fuzz_table.insert("optional".to_string(), Value::Boolean(true)); - Value::Table(trident_fuzz_table) - }); + dependencies_table.insert( + "trident-fuzz".to_string(), + Value::Table({ + let mut trident_fuzz_table = toml::Table::new(); + trident_fuzz_table.insert( + "version".to_string(), + Value::String(versions_config.trident_fuzz.clone()), + ); + trident_fuzz_table.insert("optional".to_string(), Value::Boolean(true)); + trident_fuzz_table + }), + ); // Write the updated Cargo.toml back to the file. - fs::write(&manifest_path, cargo_toml_content.to_string()).await?; + fs::write(&manifest_path, toml::to_string(&cargo_toml).unwrap()).await?; } } @@ -201,38 +208,41 @@ pub async fn update_package_metadata( ) { for package in packages { let manifest_path = package.manifest_path.as_std_path(); - let mut cargo_toml_content: Value = fs::read_to_string(&manifest_path).await?.parse()?; + let cargo_toml_content = fs::read_to_string(&manifest_path).await?; + let mut cargo_toml: Value = toml::from_str(&cargo_toml_content)?; // Ensure the 'trident-fuzzing' feature exists with the required dependency. - let features_table = ensure_table(&mut cargo_toml_content, "features")?; + let features_table = ensure_table(&mut cargo_toml, "features")?; if features_table.contains_key("trident-fuzzing") { println!( "{SKIP} 'trident-fuzzing' feature already exists in package: {}", package.name ); } else { - features_table.entry("trident-fuzzing").or_insert_with(|| { - Value::Array(vec![Value::String("dep:trident-fuzz".to_string())]) - }); + features_table.insert( + "trident-fuzzing".to_string(), + Value::Array(vec![Value::String("dep:trident-fuzz".to_string())]), + ); } // Ensure the required dependencies are present in the 'dependencies' section. - let dependencies_table = ensure_table(&mut cargo_toml_content, "dependencies")?; + let dependencies_table = ensure_table(&mut cargo_toml, "dependencies")?; // Add 'trident-derive-accounts-snapshots' dependency in table format. if dependencies_table.contains_key("trident-derive-accounts-snapshots") { println!("{SKIP} 'trident-derive-accounts-snapshots' dependency already exists in package: {}", package.name); } else { - dependencies_table - .entry("trident-derive-accounts-snapshots") - .or_insert_with(|| { - let mut snapshots_table = Table::new(); + dependencies_table.insert( + "trident-derive-accounts-snapshots".to_string(), + Value::Table({ + let mut snapshots_table = toml::Table::new(); snapshots_table.insert( "version".to_string(), Value::String(versions_config.trident_derive_accounts_snapshots.clone()), ); - Value::Table(snapshots_table) - }); + snapshots_table + }), + ); } // Add 'trident-fuzz' dependency with specified attributes if not present. @@ -242,51 +252,55 @@ pub async fn update_package_metadata( package.name ); } else { - dependencies_table.entry("trident-fuzz").or_insert_with(|| { - let mut trident_fuzz_table = Table::new(); - trident_fuzz_table.insert( - "version".to_string(), - Value::String(versions_config.trident_fuzz.clone()), - ); - trident_fuzz_table.insert("optional".to_string(), Value::Boolean(true)); - Value::Table(trident_fuzz_table) - }); + dependencies_table.insert( + "trident-fuzz".to_string(), + Value::Table({ + let mut trident_fuzz_table = toml::Table::new(); + trident_fuzz_table.insert( + "version".to_string(), + Value::String(versions_config.trident_fuzz.clone()), + ); + trident_fuzz_table.insert("optional".to_string(), Value::Boolean(true)); + trident_fuzz_table + }), + ); } // Write the updated Cargo.toml back to the file. - fs::write(&manifest_path, cargo_toml_content.to_string()).await?; + fs::write(&manifest_path, toml::to_string(&cargo_toml).unwrap()).await?; } } #[throws] -pub async fn add_workspace_member(root: &PathBuf, member: &str) { +pub async fn add_workspace_member(root: &Path, member: &str) { // Construct the path to the Cargo.toml file - let cargo = construct_path!(root, CARGO_TOML); + let cargo = root.join("Cargo.toml"); // Read and parse the Cargo.toml file - let mut cargo_toml_content: Value = fs::read_to_string(&cargo).await?.parse()?; - let new_member = Value::String(String::from(member)); + let cargo_toml_content = fs::read_to_string(&cargo).await?; + let mut cargo_toml: Value = toml::from_str(&cargo_toml_content)?; // Ensure that the 'workspace' table exists - let workspace_table = ensure_table(&mut cargo_toml_content, "workspace")?; + let workspace_table = ensure_table(&mut cargo_toml, "workspace")?; // Ensure that the 'members' array exists within the 'workspace' table let members = workspace_table .entry("members") - .or_insert(Value::Array(vec![])) + .or_insert(Value::Array(Vec::new())) .as_array_mut() .ok_or(Error::CannotParseCargoToml)?; // Check if the new member already exists in the 'members' array - if members.iter().any(|x| x.eq(&new_member)) { - println!("{SKIP} [{CARGO_TOML}], already contains [{member}]"); - } else { + if !members.iter().any(|x| x.as_str() == Some(member)) { // Add the new member to the 'members' array - members.push(new_member); + members.push(Value::String(member.to_string())); println!("{FINISH} [{CARGO_TOML}] updated with [{member}]"); // Write the updated Cargo.toml back to the file - fs::write(cargo, cargo_toml_content.to_string()).await?; + let updated_toml = toml::to_string(&cargo_toml).unwrap(); + fs::write(cargo, updated_toml).await?; + } else { + println!("{SKIP} [{CARGO_TOML}], already contains [{member}]"); } } @@ -294,7 +308,7 @@ pub async fn add_workspace_member(root: &PathBuf, member: &str) { pub async fn add_bin_target(cargo_path: &PathBuf, name: &str, path: &str) { // Read the existing Cargo.toml file let cargo_toml_content = fs::read_to_string(cargo_path).await?; - let mut cargo_toml: Value = cargo_toml_content.parse()?; + let mut cargo_toml: Value = toml::from_str(&cargo_toml_content)?; // Create a new bin table let mut bin_table = Table::new(); @@ -302,21 +316,29 @@ pub async fn add_bin_target(cargo_path: &PathBuf, name: &str, path: &str) { bin_table.insert("path".to_string(), Value::String(path.to_string())); // Add the new [[bin]] section to the [[bin]] array - if let Some(bin_array) = cargo_toml.as_table_mut().and_then(|t| t.get_mut("bin")) { + if let Some(bin_array) = cargo_toml.get_mut("bin") { if let Value::Array(bin_array) = bin_array { bin_array.push(Value::Table(bin_table)); + } else { + // If "bin" exists but is not an array, replace it with an array + let bin_array = vec![Value::Table(bin_table)]; + cargo_toml + .as_table_mut() + .unwrap() + .insert("bin".to_string(), Value::Array(bin_array)); } } else { // If there is no existing [[bin]] array, create one - let bin_array = Value::Array(vec![Value::Table(bin_table)]); + let bin_array = vec![Value::Table(bin_table)]; cargo_toml .as_table_mut() .unwrap() - .insert("bin".to_string(), bin_array); + .insert("bin".to_string(), Value::Array(bin_array)); } // Write the updated Cargo.toml file - fs::write(cargo_path, cargo_toml.to_string()).await?; + let updated_toml = toml::to_string(&cargo_toml).unwrap(); + fs::write(cargo_path, updated_toml).await?; } #[throws] @@ -325,22 +347,26 @@ pub async fn initialize_fuzz_tests_manifest( packages: &[Package], cargo_dir: &PathBuf, ) { - let cargo_path = construct_path!(cargo_dir, "Cargo.toml"); + let cargo_path = cargo_dir.join("Cargo.toml"); - let mut cargo_toml_content: Value = fs::read_to_string(&cargo_path).await?.parse()?; + let cargo_toml_content = fs::read_to_string(&cargo_path).await?; + let mut cargo_toml: Value = toml::from_str(&cargo_toml_content)?; // Ensure the required dependencies are present in the 'dependencies' section. - let dependencies_table = ensure_table(&mut cargo_toml_content, "dependencies")?; + let dependencies_table = ensure_table(&mut cargo_toml, "dependencies")?; // Add 'trident-client' dependency in table format. - dependencies_table.insert("trident-client".to_owned(), { - let mut trident_client = Table::new(); - trident_client.insert( - "version".to_string(), - Value::String(versions_config.trident_client.clone()), - ); - Value::Table(trident_client) - }); + dependencies_table.insert( + "trident-client".to_string(), + Value::Table({ + let mut trident_client = toml::Table::new(); + trident_client.insert( + "version".to_string(), + Value::String(versions_config.trident_client.clone()), + ); + trident_client + }), + ); for package in packages { let manifest_path = package.manifest_path.parent().unwrap().as_std_path(); @@ -348,21 +374,25 @@ pub async fn initialize_fuzz_tests_manifest( let relative_path_str = relative_path.to_str().unwrap_or_default(); - dependencies_table.entry(&package.name).or_insert_with(|| { - let mut package_entry = Table::new(); - package_entry.insert( - "path".to_string(), - Value::String(relative_path_str.to_owned()), - ); - package_entry.insert( - "features".to_string(), - Value::Array(vec![Value::String("trident-fuzzing".to_string())]), - ); - Value::Table(package_entry) - }); + let package_name = package.name.clone(); + dependencies_table.insert( + package_name, + Value::Table({ + let mut package_entry = toml::Table::new(); + package_entry.insert( + "path".to_string(), + Value::String(relative_path_str.to_owned()), + ); + package_entry.insert( + "features".to_string(), + Value::Array(vec![Value::String("trident-fuzzing".to_string())]), + ); + package_entry + }), + ); } - fs::write(cargo_path, cargo_toml_content.to_string()).await?; + fs::write(cargo_path, toml::to_string(&cargo_toml).unwrap()).await?; } #[throws] @@ -371,18 +401,19 @@ pub async fn update_fuzz_tests_manifest( packages: &[Package], cargo_dir: &PathBuf, ) { - let cargo_path = construct_path!(cargo_dir, "Cargo.toml"); + let cargo_path = cargo_dir.join("Cargo.toml"); - let mut cargo_toml_content: Value = fs::read_to_string(&cargo_path).await?.parse()?; + let cargo_toml_content = fs::read_to_string(&cargo_path).await?; + let mut cargo_toml: Value = toml::from_str(&cargo_toml_content)?; // Ensure the required dependencies are present in the 'dependencies' section. - let dependencies_table = ensure_table(&mut cargo_toml_content, "dependencies")?; + let dependencies_table = ensure_table(&mut cargo_toml, "dependencies")?; // Add 'trident-client' dependency in table format. dependencies_table .entry("trident-client") .or_insert_with(|| { - let mut trident_client = Table::new(); + let mut trident_client = toml::Table::new(); trident_client.insert( "version".to_string(), Value::String(versions_config.trident_client.clone()), @@ -397,7 +428,7 @@ pub async fn update_fuzz_tests_manifest( let relative_path_str = relative_path.to_str().unwrap_or_default(); dependencies_table.entry(&package.name).or_insert_with(|| { - let mut package_entry = Table::new(); + let mut package_entry = toml::Table::new(); package_entry.insert( "path".to_string(), Value::String(relative_path_str.to_owned()), @@ -410,5 +441,5 @@ pub async fn update_fuzz_tests_manifest( }); } - fs::write(cargo_path, cargo_toml_content.to_string()).await?; + fs::write(cargo_path, toml::to_string(&cargo_toml).unwrap()).await?; } diff --git a/crates/client/tests/expected_source_codes/expected_fuzz_instructions.rs b/crates/client/tests/expected_source_codes/expected_fuzz_instructions.rs index 007c55543..08208d17e 100644 --- a/crates/client/tests/expected_source_codes/expected_fuzz_instructions.rs +++ b/crates/client/tests/expected_source_codes/expected_fuzz_instructions.rs @@ -1,11 +1,6 @@ use trident_client::fuzzing::*; /// Link the relevant Account Context Alias from the program. -/// Aliases are generated by the `AccountsSnapshots` macro and stored in -/// a module named `trident_fuzz__snapshot::`. -/// Example: `use -/// hello_world::trident_fuzz_initialize_context_snapshot::InitializeContextAlias; -/// ` -/// For more complex programs, you may need to find the appropriate module. +/// Aliases are generated by the `AccountsSnapshots` macro. type InitializeIxDummy2Snapshot<'info> = InitializeIxDummy2Alias<'info>; type InitializeIxDummyExampleSnapshot<'info> = InitializeIxDummyExampleAlias<'info>; /// FuzzInstruction contains all available Instructions. @@ -109,15 +104,12 @@ impl<'info> IxOps<'info> for InitializeIxDummy2 { type IxData = dummy_2::instruction::InitializeIx; type IxAccounts = FuzzAccounts; type IxSnapshot = InitializeIxDummy2Snapshot<'info>; - /// The `get_program_id()` function specifies the program ID that the - /// Instruction is associated with. + /// Definition of the program ID that the Instruction is associated with. fn get_program_id(&self) -> solana_sdk::pubkey::Pubkey { dummy_2::ID } - /// The `get_data()` function specifies the structure of the Instruction - /// data. - /// You can utilize randomly generated data from the fuzzer using - /// `self.data.arg_name` + /// Definition of the Instruction data. + /// Use randomly generated data from the fuzzer using `self.data.arg_name` /// or customize the data as needed. /// For more details, visit: https://ackee.xyz/trident/docs/dev/features/fuzz-instructions/#get-data fn get_data( @@ -151,11 +143,11 @@ impl<'info> IxOps<'info> for InitializeIxDummy2 { }; Ok(data) } - /// The `get_accounts()` function specifies the structure of the accounts - /// required by the Instruction. + /// Definition of of the accounts required by the Instruction. /// To utilize accounts stored in `FuzzAccounts`, use /// `fuzz_accounts.account_name.get_or_create_account()`. - /// This method will either create a new account or return an existing one. + /// If no signers are required, leave the vector empty. + /// For AccountMetas use ::accounts:: /// For more details, see: https://ackee.xyz/trident/docs/dev/features/fuzz-instructions/#get-accounts fn get_accounts( &self, @@ -173,15 +165,12 @@ impl<'info> IxOps<'info> for InitializeIxDummyExample { type IxData = dummy_example::instruction::InitializeIx; type IxAccounts = FuzzAccounts; type IxSnapshot = InitializeIxDummyExampleSnapshot<'info>; - /// The `get_program_id()` function specifies the program ID that the - /// Instruction is associated with. + /// Definition of the program ID that the Instruction is associated with. fn get_program_id(&self) -> solana_sdk::pubkey::Pubkey { dummy_example::ID } - /// The `get_data()` function specifies the structure of the Instruction - /// data. - /// You can utilize randomly generated data from the fuzzer using - /// `self.data.arg_name` + /// Definition of the Instruction data. + /// Use randomly generated data from the fuzzer using `self.data.arg_name` /// or customize the data as needed. /// For more details, visit: https://ackee.xyz/trident/docs/dev/features/fuzz-instructions/#get-data fn get_data( @@ -215,11 +204,11 @@ impl<'info> IxOps<'info> for InitializeIxDummyExample { }; Ok(data) } - /// The `get_accounts()` function specifies the structure of the accounts - /// required by the Instruction. + /// Definition of of the accounts required by the Instruction. /// To utilize accounts stored in `FuzzAccounts`, use /// `fuzz_accounts.account_name.get_or_create_account()`. - /// This method will either create a new account or return an existing one. + /// If no signers are required, leave the vector empty. + /// For AccountMetas use ::accounts:: /// For more details, see: https://ackee.xyz/trident/docs/dev/features/fuzz-instructions/#get-accounts fn get_accounts( &self, diff --git a/crates/fuzz/Cargo.toml b/crates/fuzz/Cargo.toml index bcadf863f..79c09e436 100644 --- a/crates/fuzz/Cargo.toml +++ b/crates/fuzz/Cargo.toml @@ -7,8 +7,6 @@ license-file = "../../LICENSE" readme = "../../README.md" description = "The trident_fuzz crate helps you to write Rust Fuzz Tests for your programs with Trident." -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - [dependencies] # SOLANA solana-sdk = { workspace = true } @@ -21,16 +19,15 @@ solana-program-test = { workspace = true } anchor-lang = { workspace = true, features = ["init-if-needed"] } # ARBITRARY -arbitrary = { version = "1.3.0", features = ["derive"] } +arbitrary = { workspace = true } # MISC -thiserror = "1.0.30" -regex = "1.10.3" -prettytable = "0.10.0" -serde = { version = "1.0.136", default-features = false } -serde_json = "1.0.72" +thiserror = "1" +prettytable = "0.10" +serde = { version = "1", default-features = false } +serde_json = "1" tokio = "1" -anyhow = "1.0.45" -fehler = "1.0.0" -toml = { version = "0.5.8", features = ["preserve_order"] } -rand = "0.8.5" +anyhow = "1" +fehler = "1" +toml = { version = "0.8", features = ["preserve_order"] } +rand = "0.8" diff --git a/documentation/docs/commands/commands.md b/documentation/docs/commands/commands.md index d94c4b641..eadc14c17 100644 --- a/documentation/docs/commands/commands.md +++ b/documentation/docs/commands/commands.md @@ -28,9 +28,15 @@ project-root --- +## trident how + + - Print How To message about how to start writting fuzz tests. + +--- + ## trident fuzz -- This command behavior depends on the subcommands. +- Behavior depends on the subcommands. ### trident fuzz run-afl diff --git a/documentation/docs/features/arbitrary-data.md b/documentation/docs/features/arbitrary-data.md index b4e9aadcc..2823e83fd 100644 --- a/documentation/docs/features/arbitrary-data.md +++ b/documentation/docs/features/arbitrary-data.md @@ -91,31 +91,6 @@ impl<'a> Arbitrary<'a> for InitVestingData { } ``` -## Custom Data Types - -If you use Custom Types as Instruction data arguments, you may encounter a problem that the Custom Type does not implement - -- [Debug](https://doc.rust-lang.org/std/fmt/trait.Debug.html) trait -- [Arbitrary](https://docs.rs/arbitrary/latest/arbitrary/trait.Arbitrary.html) trait - -### Derive Debug and Arbitrary traits inside the Fuzz Test - -You can redefine the custom type within the `fuzz_instructions.rs` file, along with all the necessary traits. - -```rust -// Redefine the Custom Type inside the fuzz_instructions.rs, -// but this time with all of the required traits. -#[derive(Arbitrary,Debug, Clone, Copy)] -pub enum CustomEnumInputFuzz { - InputVariant1, - InputVariant2, - InputVariant3, -} -``` - - -Then, you would also need to implement the [`std::convert::From`](https://doc.rust-lang.org/std/convert/trait.From.html) trait to enable conversion between the newly defined Custom Type and the Custom Type used within your program. - !!! tip Consider checking the [Examples](../examples/examples.md) section for more tips. diff --git a/documentation/docs/features/fuzz-instructions.md b/documentation/docs/features/fuzz-instructions.md index 590ae9513..9cea29906 100644 --- a/documentation/docs/features/fuzz-instructions.md +++ b/documentation/docs/features/fuzz-instructions.md @@ -75,6 +75,36 @@ fn get_data( Or you can customize the Data using the Arbitrary crate. Check [Arbitrary Data](./arbitrary-data.md). + +### Custom Data Types + +If you use Custom Types as Instruction data arguments, you may encounter a problem that the Custom Type does not implement + +- [Debug](https://doc.rust-lang.org/std/fmt/trait.Debug.html) trait +- [Arbitrary](https://docs.rs/arbitrary/latest/arbitrary/trait.Arbitrary.html) trait + +### Derive Debug and Arbitrary traits inside the Fuzz Test + +You can redefine the custom type within the `fuzz_instructions.rs` file, along with all the necessary traits. + +```rust +// Redefine the Custom Type inside the fuzz_instructions.rs, +// but this time with all of the required traits. +#[derive(Arbitrary,Debug, Clone, Copy)] +pub enum CustomEnumInputFuzz { + InputVariant1, + InputVariant2, + InputVariant3, +} +``` + + +Then, you would also need to implement the [`std::convert::From`](https://doc.rust-lang.org/std/convert/trait.From.html) trait to enable conversion between the newly defined Custom Type and the Custom Type used within your program. + +!!! tip + + Consider checking the [Examples](../examples/examples.md) section for more tips. + ## Get Accounts This method specifies how the **Accounts** for the corresponding Instruction should be resolved. You can use accounts stored within the **FuzzAccounts Account Storages**, or you can define custom Account using the **client**. diff --git a/documentation/docs/features/trident-manifest.md b/documentation/docs/features/trident-manifest.md index a4b2d7885..cf0555b14 100644 --- a/documentation/docs/features/trident-manifest.md +++ b/documentation/docs/features/trident-manifest.md @@ -2,6 +2,59 @@ You can pass supported parameters via the **{{ config.site_name }}.toml** configuration file: +## [fuzz] + +#### programs +- Trident allows you to specify genesis programs (SBF targets) that will be included in the fuzzing environment in order to perform all desired Cross-Program-Invocations. + +- Including these types of programs will lead to performance decline of Trident. + +```toml +[[fuzz.programs]] +address = "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s" +program = "metaplex-program/metaplex-token-metadata.so" +``` + +--- + +#### accounts +- Trident allwos you to specify genesis accounts to inlcude in the fuzzing environment. In most cases it is helpful to dump some accounts from mainnet and use then during testing. + +```toml +[[fuzz.accounts]] +address = "6YG3J7PaxyMnnbU67ifyrgF3BzNzc7cD8hPkqK6ATweE" +filename = "tests/accounts/core_bridge_mainnet/guardian_set_5_mock.json" +``` + +--- + +#### allow_duplicate_txs +- Allow processing of duplicate transactions. Setting to true might speed up fuzzing but can cause false positive crashes (default: false) + +```toml +[fuzz] +# Allow processing of duplicate transactions. +# Setting to true might speed up fuzzing but can cause +# false positive crashes (default: false) +allow_duplicate_txs = false +``` + +--- + +#### fuzzing_with_stats +- Trident will show statistics after the fuzzing session. This option forces use of honggfuzz parameter `keep_output` as true in order to be able to catch fuzzer stdout. (default: false) + +```toml +[fuzz] +# Trident will show statistics after the fuzzing session. +# This option forces use of honggfuzz parameter +# `keep_output` as true in order to be able to catch fuzzer stdout. +# (default: false) +fuzzing_with_stats = true +``` + +--- + ## [honggfuzz] #### timeout @@ -235,59 +288,6 @@ bytes_count = 20 --- -## [fuzz] - -#### programs -- Trident allows you to specify genesis programs (SBF targets) that will be included in the fuzzing environment in order to perform all desired Cross-Program-Invocations. - -- Including these types of programs will lead to performance decline of Trident. - -```toml -[[fuzz.programs]] -address = "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s" -program = "metaplex-program/metaplex-token-metadata.so" -``` - ---- - -#### accounts -- Trident allwos you to specify genesis accounts to inlcude in the fuzzing environment. In most cases it is helpful to dump some accounts from mainnet and use then during testing. - -```toml -[[fuzz.accounts]] -address = "6YG3J7PaxyMnnbU67ifyrgF3BzNzc7cD8hPkqK6ATweE" -filename = "tests/accounts/core_bridge_mainnet/guardian_set_5_mock.json" -``` - ---- - -#### allow_duplicate_txs -- Allow processing of duplicate transactions. Setting to true might speed up fuzzing but can cause false positive crashes (default: false) - -```toml -[fuzz] -# Allow processing of duplicate transactions. -# Setting to true might speed up fuzzing but can cause -# false positive crashes (default: false) -allow_duplicate_txs = false -``` - ---- - -#### fuzzing_with_stats -- Trident will show statistics after the fuzzing session. This option forces use of honggfuzz parameter `keep_output` as true in order to be able to catch fuzzer stdout. (default: false) - -```toml -[fuzz] -# Trident will show statistics after the fuzzing session. -# This option forces use of honggfuzz parameter -# `keep_output` as true in order to be able to catch fuzzer stdout. -# (default: false) -fuzzing_with_stats = true -``` - ---- - !!! tip Consider checking the [Examples](../examples/examples.md) section for more tips. diff --git a/documentation/docs/installation/installation.md b/documentation/docs/installation/installation.md index 36d0d155d..5e3b50653 100644 --- a/documentation/docs/installation/installation.md +++ b/documentation/docs/installation/installation.md @@ -65,15 +65,15 @@ cargo install trident-cli ## Supported versions -| {{ config.site_name }} CLI | Anchor | Solana | Rust | Honggfuzz | AFL | -|-|-|-|-|-|-| -| `develop` | `0.30.1` | `^1.17.4` | `nightly` | `0.5.56` | `0.15.10` | -| `v0.7.0` | `>=0.29.*`1 | `^1.17.4` | `nightly` | `0.5.56` | - | -| `v0.6.0` | `>=0.29.*`1 | `^1.17` | `nightly` | `0.5.55` | - | -| `v0.5.0` | `~0.28.*` | `=1.16.6` | - | - | - | -| `v0.4.0` | `~0.27.*` | `>=1.15` | - | - | - | -| `v0.3.0` | `~0.25.*` | `>=1.10` | - | - | - | -| `v0.2.0` | `~0.24.*` | `>=1.9` | - | - | - | +| ***{{ config.site_name }} CLI*** | ***Anchor*** | ***Solana*** | ***Rust*** | ***Honggfuzz*** | ***AFL*** | +|-:|-:|-:|-:|-:|-:| +| :material-developer-board: ***`develop`*** | `0.30.1` | `^1.17.4` | `nightly` | `0.5.56` | `0.15.10` | +| :material-tag: ***`0.7.0`*** | `>=0.29.*`1 | `^1.17.4` | `nightly` | `0.5.56` | - | +| :material-tag: ***`0.6.0`*** | `>=0.29.*`1 | `^1.17` | `nightly` | `0.5.55` | - | +| :material-tag: ***`0.5.0`*** | `~0.28.*` | `=1.16.6` | - | - | - | +| :material-tag: ***`0.4.0`*** | `~0.27.*` | `>=1.15` | - | - | - | +| :material-tag: ***`0.3.0`*** | `~0.25.*` | `>=1.10` | - | - | - | +| :material-tag: ***`0.2.0`*** | `~0.24.*` | `>=1.9` | - | - | - | 1. To use Trident with Anchor 0.29.0, run the following commands from your project's root directory after Trident initialization: ```bash diff --git a/documentation/docs/writing-fuzz-test/writing-fuzz-test.md b/documentation/docs/writing-fuzz-test/writing-fuzz-test.md index 219203265..6aec430b8 100644 --- a/documentation/docs/writing-fuzz-test/writing-fuzz-test.md +++ b/documentation/docs/writing-fuzz-test/writing-fuzz-test.md @@ -3,9 +3,7 @@ hide: - navigation --- -## Initialization - -### Initialize Fuzz Test +## Initialize Trident Initialize Trident in the Anchor-based workspace. @@ -21,17 +19,9 @@ trident init - Reads the generated IDL. - Based on the IDL creates the fuzzing template. -### Add new Fuzz Test - -!!! info - - This step is optional, `trident init` will generate the first fuzz test template. Use `trident fuzz add` in case you want to add additional Template. - -Add new Fuzz Test if Trident is already initialized. +!!! tip -```bash -trident fuzz add -``` + If you have Trident already initialized, you can add new fuzz test using `trident fuzz add`. ## Fill the Fuzz test Template @@ -39,49 +29,6 @@ trident fuzz add ### Derive AccountsSnapshots -In the `Cargo.toml` file of each of the Anchor-based program within the workspace, define the required dependencies and feature as shown in the example below. - -!!! important - - Please pay attention only to the: - - - `trident-fuzzing = ["dep:trident-fuzz"]`. - - `trident-derive-accounts-snapshots = "version goes here"`. - - `trident-fuzz = { version = "version goes here", optional = true }`. - - If you are unsure what versions to use check the [Supported Versions](../installation/installation.md/#supported-versions). - -!!! tip - - The feature `trident-fuzzing = ["dep:trident-fuzz"]` ensures that the `AccountsSnapshots` are used only with the Trident. - -```toml -[package] -name = "..." -version = "0.1.0" -description = "Created with Anchor" -edition = "2021" - -[lib] -crate-type = ["cdylib", "lib"] -name = "..." - -[features] -default = [] -cpi = ["no-entrypoint"] -no-entrypoint = [] -no-idl = [] -no-log-ix-name = [] -idl-build = ["anchor-lang/idl-build"] -trident-fuzzing = ["dep:trident-fuzz"] # !!!! - -[dependencies] -trident-derive-accounts-snapshots = "version goes here" # !!!! -trident-fuzz = { version = "version goes here", optional = true } # !!!! - - -# ... -``` - For every Account Context specified in the Anchor project derive `AccountsSnapshots` such as: ```rust @@ -113,7 +60,7 @@ pub struct InitializeContext<'info> { ### Link the AccountsSnapshots -Fuzz Instructions use the derived `AccountsSnapshots`. In this case we need to link the derived `AccountsSnapshots` to the corresponding aliases. +Fuzz Instructions use the derived `AccountsSnapshots`. You need to link the derived `AccountsSnapshots` to the corresponding aliases. !!! important