From 5281720afab8d7a39eab649d2c938d00de00dabf Mon Sep 17 00:00:00 2001 From: Jean Marchand Date: Fri, 5 May 2023 10:09:18 +0200 Subject: [PATCH] Squashed commit of the following: commit ac86e15756b8bde5d15fde5ebe0f46f47bcb5049 Author: Matthew Callens Date: Wed May 3 17:53:46 2023 -0500 spl: remove mpl `create_metadata_account_v2` wrapper that were removed from program (#2480) * remove mpl ix wrappers that were removed from program * update changelog commit c1667120e6d44d4a9a2ed4d49f20443ca99ce41e Author: acheron <98934430+acheroncrypto@users.noreply.github.com> Date: Wed May 3 09:09:41 2023 +0200 bench: Add a script to sync benchmark results for all versions (#2477) commit a195106117ebaa6ab97e8963b7f1d66225eee4bc Author: acheron <98934430+acheroncrypto@users.noreply.github.com> Date: Mon May 1 13:39:50 2023 +0200 spl: Use fixed version for `winnow` crate to fix new builds (#2478) commit 03b1e4df6b3b70895b3ce29118f8b3c7c483ce12 Author: acheron <98934430+acheroncrypto@users.noreply.github.com> Date: Thu Apr 27 12:10:23 2023 +0200 Upgrade `clap` to 4.2.4 (#2474) commit 876ef416107355b4ac4c0a31b8048c471ae09675 Author: Proph3t Date: Thu Apr 27 08:53:04 2023 +0000 docs: fix broken links in `AccountLoader` docs (#2473) commit c14ae6b4f8ac284c155cb146436c6de6e59c4603 Author: Tuan Pham Minh Date: Wed Apr 26 00:07:39 2023 +0700 Fix typo of `is_signer` field in intro-to-solana docs page (#2469) --- CHANGELOG.md | 1 + Cargo.lock | 455 +++++++++++------- avm/Cargo.lock | 338 +++++++++---- avm/Cargo.toml | 6 +- cli/Cargo.toml | 2 +- client/example/Cargo.toml | 2 +- docs/src/pages/docs/intro-to-solana.md | 2 +- lang/src/accounts/account_loader.rs | 4 +- spl/Cargo.toml | 7 +- spl/src/metadata.rs | 59 +-- tests/bench/Anchor.toml | 7 +- tests/bench/README.md | 14 +- tests/bench/programs/bench/Cargo.toml | 5 + tests/bench/programs/bench/src/lib.rs | 4 +- .../{update-bench.ts => sync-markdown.ts} | 28 +- tests/bench/scripts/sync.ts | 66 +++ tests/bench/scripts/utils.ts | 140 +++++- tests/bench/tests/compute-units.ts | 20 +- 18 files changed, 787 insertions(+), 373 deletions(-) rename tests/bench/scripts/{update-bench.ts => sync-markdown.ts} (68%) create mode 100644 tests/bench/scripts/sync.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 74220ebece..9817b2d820 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ The minor version will be incremented upon a breaking change and the patch versi - lang: Remove the use of `AccountInfo` in the context of the accounts. Use `UncheckedAccount` instead ([#2470](https://github.com/coral-xyz/anchor/pull/2470)). - lang: Identifiers that are intended for internal usage(`program_id`, `accounts`, `ix_data`, `remaining_accounts`) have been renamed with `__` prefix ([#2464](https://github.com/coral-xyz/anchor/pull/2464)) +- spl: Remove the `metadata::create_metadata_account_v2` deprecated wrapper since it was removed from token metadata program ([#2480](https://github.com/coral-xyz/anchor/pull/2480)) ## [0.27.0] - 2023-03-08 diff --git a/Cargo.lock b/Cargo.lock index a8fb158eb4..a56e49d6c6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -101,8 +101,8 @@ version = "0.27.0" dependencies = [ "anchor-syn", "anyhow", - "proc-macro2 1.0.47", - "quote 1.0.21", + "proc-macro2 1.0.56", + "quote 1.0.26", "regex", "syn 1.0.109", ] @@ -114,8 +114,8 @@ dependencies = [ "anchor-syn", "anyhow", "bs58 0.4.0", - "proc-macro2 1.0.47", - "quote 1.0.21", + "proc-macro2 1.0.56", + "quote 1.0.26", "rustversion", "syn 1.0.109", ] @@ -125,7 +125,7 @@ name = "anchor-attribute-constant" version = "0.27.0" dependencies = [ "anchor-syn", - "proc-macro2 1.0.47", + "proc-macro2 1.0.56", "syn 1.0.109", ] @@ -134,8 +134,8 @@ name = "anchor-attribute-error" version = "0.27.0" dependencies = [ "anchor-syn", - "proc-macro2 1.0.47", - "quote 1.0.21", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.109", ] @@ -145,8 +145,8 @@ version = "0.27.0" dependencies = [ "anchor-syn", "anyhow", - "proc-macro2 1.0.47", - "quote 1.0.21", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.109", ] @@ -156,8 +156,8 @@ version = "0.27.0" dependencies = [ "anchor-syn", "anyhow", - "proc-macro2 1.0.47", - "quote 1.0.21", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.109", ] @@ -171,7 +171,7 @@ dependencies = [ "anyhow", "cargo_toml", "chrono", - "clap 4.0.26", + "clap 4.2.4", "dirs", "flate2", "heck 0.4.0", @@ -216,8 +216,8 @@ version = "0.27.0" dependencies = [ "anchor-syn", "anyhow", - "proc-macro2 1.0.47", - "quote 1.0.21", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.109", ] @@ -225,8 +225,8 @@ dependencies = [ name = "anchor-derive-space" version = "0.27.0" dependencies = [ - "proc-macro2 1.0.47", - "quote 1.0.21", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.109", ] @@ -263,6 +263,7 @@ dependencies = [ "spl-associated-token-account", "spl-token", "spl-token-2022", + "winnow", ] [[package]] @@ -272,8 +273,8 @@ dependencies = [ "anyhow", "bs58 0.3.1", "heck 0.3.3", - "proc-macro2 1.0.47", - "quote 1.0.21", + "proc-macro2 1.0.56", + "quote 1.0.26", "serde", "serde_json", "sha2 0.9.9", @@ -299,6 +300,55 @@ dependencies = [ "winapi", ] +[[package]] +name = "anstream" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6342bd4f5a1205d7f41e94a41a901f5647c938cdfa96036338e8533c9d6c2450" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is-terminal", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d" + +[[package]] +name = "anstyle-parse" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e765fd216e48e067936442276d1d57399e37bce53c264d6fefbe298080cb57ee" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +dependencies = [ + "windows-sys 0.48.0", +] + +[[package]] +name = "anstyle-wincon" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" +dependencies = [ + "anstyle", + "windows-sys 0.48.0", +] + [[package]] name = "anyhow" version = "1.0.66" @@ -354,7 +404,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "db02d390bf6643fb404d3d22d31aee1c4bc4459600aef9113833d17e786c6e44" dependencies = [ - "quote 1.0.21", + "quote 1.0.26", "syn 1.0.109", ] @@ -366,7 +416,7 @@ checksum = "db2fd794a08ccb318058009eefdf15bcaaaaf6f8161eb3345f907222bac38b20" dependencies = [ "num-bigint 0.4.3", "num-traits", - "quote 1.0.21", + "quote 1.0.26", "syn 1.0.109", ] @@ -445,8 +495,8 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "726535892e8eae7e70657b4c8ea93d26b8553afb1ce617caee529ef96d7dee6c" dependencies = [ - "proc-macro2 1.0.47", - "quote 1.0.21", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.109", "synstructure", ] @@ -457,8 +507,8 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2777730b2039ac0f95f093556e61b6d26cebed5393ca6f152717777cec3a42ed" dependencies = [ - "proc-macro2 1.0.47", - "quote 1.0.21", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.109", ] @@ -497,8 +547,8 @@ version = "0.1.58" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e805d94e6b5001b651426cf4cd446b1ab5f319d27bab5c644f61de0a804360c" dependencies = [ - "proc-macro2 1.0.47", - "quote 1.0.21", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.109", ] @@ -634,7 +684,7 @@ dependencies = [ "borsh-derive-internal", "borsh-schema-derive-internal", "proc-macro-crate 0.1.5", - "proc-macro2 1.0.47", + "proc-macro2 1.0.56", "syn 1.0.109", ] @@ -644,8 +694,8 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5449c28a7b352f2d1e592a8a28bf139bc71afb0764a14f3c02500935d8c44065" dependencies = [ - "proc-macro2 1.0.47", - "quote 1.0.21", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.109", ] @@ -655,8 +705,8 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdbd5696d8bfa21d53d9fe39a714a18538bad11492a42d066dbbc395fb1951c0" dependencies = [ - "proc-macro2 1.0.47", - "quote 1.0.21", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.109", ] @@ -724,8 +774,8 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b9e1f5fa78f69496407a27ae9ed989e3c3b072310286f5ef385525e4cbc24a9" dependencies = [ - "proc-macro2 1.0.47", - "quote 1.0.21", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.109", ] @@ -844,30 +894,38 @@ dependencies = [ [[package]] name = "clap" -version = "4.0.26" +version = "4.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2148adefda54e14492fb9bddcc600b4344c5d1a3123bd666dcb939c6f0e0e57e" +checksum = "956ac1f6381d8d82ab4684768f89c0ea3afe66925ceadb4eeb3fc452ffc55d62" dependencies = [ - "atty", - "bitflags", + "clap_builder", "clap_derive", - "clap_lex 0.3.0", "once_cell", +] + +[[package]] +name = "clap_builder" +version = "4.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84080e799e54cff944f4b4a4b0e71630b0e0443b25b985175c7dddc1a859b749" +dependencies = [ + "anstream", + "anstyle", + "bitflags", + "clap_lex 0.4.1", "strsim 0.10.0", - "termcolor", ] [[package]] name = "clap_derive" -version = "4.0.21" +version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0177313f9f02afc995627906bbd8967e2be069f5261954222dac78290c2b9014" +checksum = "3f9644cd56d6b87dbe899ef8b053e331c0637664e9e21a33dfcdc36093f5c5c4" dependencies = [ "heck 0.4.0", - "proc-macro-error", - "proc-macro2 1.0.47", - "quote 1.0.21", - "syn 1.0.109", + "proc-macro2 1.0.56", + "quote 1.0.26", + "syn 2.0.15", ] [[package]] @@ -881,12 +939,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.3.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d4198f73e42b4936b35b5bb248d81d2b595ecb170da0bac7655c54eedfa8da8" -dependencies = [ - "os_str_bytes", -] +checksum = "8a2dd5a6fe8c6e3502f568a6353e5273bbb15193ad9a89e457b9970798efbea1" [[package]] name = "codespan-reporting" @@ -898,6 +953,12 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "colorchoice" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" + [[package]] name = "combine" version = "3.8.1" @@ -1104,8 +1165,8 @@ dependencies = [ "cc", "codespan-reporting", "once_cell", - "proc-macro2 1.0.47", - "quote 1.0.21", + "proc-macro2 1.0.56", + "quote 1.0.26", "scratch", "syn 1.0.109", ] @@ -1122,8 +1183,8 @@ version = "1.0.80" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "309e4fb93eed90e1e14bea0da16b209f81813ba9fc7830c20ed151dd7bc0a4d7" dependencies = [ - "proc-macro2 1.0.47", - "quote 1.0.21", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.109", ] @@ -1145,8 +1206,8 @@ checksum = "001d80444f28e193f30c2f293455da62dcf9a6b29918a4253152ae2b1de592cb" dependencies = [ "fnv", "ident_case", - "proc-macro2 1.0.47", - "quote 1.0.21", + "proc-macro2 1.0.56", + "quote 1.0.26", "strsim 0.10.0", "syn 1.0.109", ] @@ -1158,7 +1219,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b36230598a2d5de7ec1c6f51f72d8a99a9208daff41de2084d06e3fd3ea56685" dependencies = [ "darling_core", - "quote 1.0.21", + "quote 1.0.26", "syn 1.0.109", ] @@ -1203,8 +1264,8 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" dependencies = [ - "proc-macro2 1.0.47", - "quote 1.0.21", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.109", ] @@ -1292,8 +1353,8 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3bf95dc3f046b9da4f2d51833c0d3547d8564ef6910f5c1ed130306a75b92886" dependencies = [ - "proc-macro2 1.0.47", - "quote 1.0.21", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.109", ] @@ -1406,8 +1467,8 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "355f93763ef7b0ae1c43c4d8eccc9d5848d84ad1a1d8ce61c421d1ac85a19d05" dependencies = [ - "proc-macro2 1.0.47", - "quote 1.0.21", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.109", ] @@ -1418,8 +1479,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eb359f1476bf611266ac1f5355bc14aeca37b299d0ebccc038ee7058891c9cb" dependencies = [ "once_cell", - "proc-macro2 1.0.47", - "quote 1.0.21", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.109", ] @@ -1438,8 +1499,8 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "946ee94e3dbf58fdd324f9ce245c7b238d46a66f00e86a020b71996349e46cce" dependencies = [ - "proc-macro2 1.0.47", - "quote 1.0.21", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.109", ] @@ -1458,13 +1519,13 @@ dependencies = [ [[package]] name = "errno" -version = "0.2.8" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" +checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" dependencies = [ "errno-dragonfly", "libc", - "winapi", + "windows-sys 0.48.0", ] [[package]] @@ -1605,8 +1666,8 @@ version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d" dependencies = [ - "proc-macro2 1.0.47", - "quote 1.0.21", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.109", ] @@ -1770,12 +1831,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.2.6" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" -dependencies = [ - "libc", -] +checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" [[package]] name = "histogram" @@ -1988,12 +2046,13 @@ dependencies = [ [[package]] name = "io-lifetimes" -version = "1.0.4" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7d6c6f8c91b4b9ed43484ad1a938e393caf35960fce7f82a040497207bd8e9e" +checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220" dependencies = [ + "hermit-abi 0.3.1", "libc", - "windows-sys 0.42.0", + "windows-sys 0.48.0", ] [[package]] @@ -2004,14 +2063,14 @@ checksum = "879d54834c8c76457ef4293a689b2a8c59b076067ad77b15efafbb05f92a592b" [[package]] name = "is-terminal" -version = "0.4.2" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189" +checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" dependencies = [ - "hermit-abi 0.2.6", + "hermit-abi 0.3.1", "io-lifetimes", "rustix", - "windows-sys 0.42.0", + "windows-sys 0.48.0", ] [[package]] @@ -2117,9 +2176,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.137" +version = "0.2.142" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" +checksum = "6a987beff54b60ffa6d51982e1aa1146bc42f19bd26be28b0586f252fccf5317" [[package]] name = "libloading" @@ -2190,9 +2249,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.1.4" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" +checksum = "36eb31c1778188ae1e64398743890d0877fef36d11521ac60406b42016e8c2cf" [[package]] name = "lock_api" @@ -2321,9 +2380,9 @@ dependencies = [ [[package]] name = "mpl-token-metadata" -version = "1.9.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8831a402e72f24052d019a83d72b70c38673caaf198e6e345575a77f98166b1" +checksum = "aed414104154928aa995a44a0a474c449d04ce5a4ee6c975ad41c5d2912f0dfe" dependencies = [ "arrayref", "borsh", @@ -2345,15 +2404,15 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12989bc45715b0ee91944855130131479f9c772e198a910c3eb0ea327d5bffc3" dependencies = [ - "quote 1.0.21", + "quote 1.0.26", "syn 1.0.109", ] [[package]] name = "mpl-utils" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fc48e64c50dba956acb46eec86d6968ef0401ef37031426da479f1f2b592066" +checksum = "822133b6cba8f9a43e5e0e189813be63dd795858f54155c729833be472ffdb51" dependencies = [ "arrayref", "borsh", @@ -2443,8 +2502,8 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" dependencies = [ - "proc-macro2 1.0.47", - "quote 1.0.21", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.109", ] @@ -2516,8 +2575,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b0498641e53dd6ac1a4f22547548caa6864cc4933784319cd1775271c5a46ce" dependencies = [ "proc-macro-crate 1.2.1", - "proc-macro2 1.0.47", - "quote 1.0.21", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.109", ] @@ -2694,8 +2753,8 @@ checksum = "92aacdc5f16768709a569e913f7451034034178b05bdc8acda226659a3dccc66" dependencies = [ "phf_generator", "phf_shared 0.11.1", - "proc-macro2 1.0.47", - "quote 1.0.21", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.109", ] @@ -2811,30 +2870,6 @@ dependencies = [ "toml", ] -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2 1.0.47", - "quote 1.0.21", - "syn 1.0.109", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2 1.0.47", - "quote 1.0.21", - "version_check", -] - [[package]] name = "proc-macro2" version = "0.4.30" @@ -2846,9 +2881,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.47" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" +checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" dependencies = [ "unicode-ident", ] @@ -2923,11 +2958,11 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.21" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" +checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" dependencies = [ - "proc-macro2 1.0.47", + "proc-macro2 1.0.56", ] [[package]] @@ -3233,16 +3268,16 @@ dependencies = [ [[package]] name = "rustix" -version = "0.36.7" +version = "0.37.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4fdebc4b395b7fbb9ab11e462e20ed9051e7b16e42d24042c776eca0ac81b03" +checksum = "a0661814f891c57c930a610266415528da53c4933e6dea5fb350cbfe048a9ece" dependencies = [ "bitflags", "errno", "io-lifetimes", "libc", "linux-raw-sys", - "windows-sys 0.42.0", + "windows-sys 0.48.0", ] [[package]] @@ -3342,8 +3377,8 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bdbda6ac5cd1321e724fa9cee216f3a61885889b896f073b8f82322789c5250e" dependencies = [ - "proc-macro2 1.0.47", - "quote 1.0.21", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.109", ] @@ -3428,8 +3463,8 @@ version = "1.0.154" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fc80d722935453bcafdc2c9a73cd6fac4dc1938f0346035d84bf99fa9e33217" dependencies = [ - "proc-macro2 1.0.47", - "quote 1.0.21", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.109", ] @@ -3473,8 +3508,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1966009f3c05f095697c537312f5415d1e3ed31ce0a56942bac4c771c5c335e" dependencies = [ "darling", - "proc-macro2 1.0.47", - "quote 1.0.21", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.109", ] @@ -3586,8 +3621,8 @@ version = "0.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "63927d22a1e8b74bda98cc6e151fcdf178b7abb0dc6c4f81e0bbf5ffe2fc4ec8" dependencies = [ - "proc-macro2 1.0.47", - "quote 1.0.21", + "proc-macro2 1.0.56", + "quote 1.0.26", "shank_macro_impl", "syn 1.0.109", ] @@ -3599,8 +3634,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40ce03403df682f80f4dc1efafa87a4d0cb89b03726d0565e6364bdca5b9a441" dependencies = [ "anyhow", - "proc-macro2 1.0.47", - "quote 1.0.21", + "proc-macro2 1.0.56", + "quote 1.0.26", "serde", "syn 1.0.109", ] @@ -3883,8 +3918,8 @@ version = "1.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06395428329810ade1d2518a7e75d8a6f02d01fe548aabb60ff1ba6a2eaebbe5" dependencies = [ - "proc-macro2 1.0.47", - "quote 1.0.21", + "proc-macro2 1.0.56", + "quote 1.0.26", "rustc_version 0.4.0", "syn 1.0.109", ] @@ -4258,8 +4293,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f809319358d5da7c3a0ac08ebf4d87b21170d928dbb7260254e8f3061f7f9e0e" dependencies = [ "bs58 0.4.0", - "proc-macro2 1.0.47", - "quote 1.0.21", + "proc-macro2 1.0.56", + "quote 1.0.26", "rustversion", "syn 1.0.109", ] @@ -4608,8 +4643,19 @@ version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ - "proc-macro2 1.0.47", - "quote 1.0.21", + "proc-macro2 1.0.56", + "quote 1.0.26", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822" +dependencies = [ + "proc-macro2 1.0.56", + "quote 1.0.26", "unicode-ident", ] @@ -4619,8 +4665,8 @@ version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" dependencies = [ - "proc-macro2 1.0.47", - "quote 1.0.21", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.109", "unicode-xid 0.2.4", ] @@ -4710,8 +4756,8 @@ version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb" dependencies = [ - "proc-macro2 1.0.47", - "quote 1.0.21", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.109", ] @@ -4824,8 +4870,8 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484" dependencies = [ - "proc-macro2 1.0.47", - "quote 1.0.21", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.109", ] @@ -4914,8 +4960,8 @@ version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a" dependencies = [ - "proc-macro2 1.0.47", - "quote 1.0.21", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.109", ] @@ -5089,6 +5135,12 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" +[[package]] +name = "utf8parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" + [[package]] name = "vec_map" version = "0.8.2" @@ -5165,8 +5217,8 @@ dependencies = [ "bumpalo", "log", "once_cell", - "proc-macro2 1.0.47", - "quote 1.0.21", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.109", "wasm-bindgen-shared", ] @@ -5189,7 +5241,7 @@ version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" dependencies = [ - "quote 1.0.21", + "quote 1.0.26", "wasm-bindgen-macro-support", ] @@ -5199,8 +5251,8 @@ version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" dependencies = [ - "proc-macro2 1.0.47", - "quote 1.0.21", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.109", "wasm-bindgen-backend", "wasm-bindgen-shared", @@ -5291,21 +5343,51 @@ version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" dependencies = [ - "windows_aarch64_gnullvm", + "windows_aarch64_gnullvm 0.42.0", "windows_aarch64_msvc 0.42.0", "windows_i686_gnu 0.42.0", "windows_i686_msvc 0.42.0", "windows_x86_64_gnu 0.42.0", - "windows_x86_64_gnullvm", + "windows_x86_64_gnullvm 0.42.0", "windows_x86_64_msvc 0.42.0", ] +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +dependencies = [ + "windows_aarch64_gnullvm 0.48.0", + "windows_aarch64_msvc 0.48.0", + "windows_i686_gnu 0.48.0", + "windows_i686_msvc 0.48.0", + "windows_x86_64_gnu 0.48.0", + "windows_x86_64_gnullvm 0.48.0", + "windows_x86_64_msvc 0.48.0", +] + [[package]] name = "windows_aarch64_gnullvm" version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" + [[package]] name = "windows_aarch64_msvc" version = "0.36.1" @@ -5318,6 +5400,12 @@ version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" + [[package]] name = "windows_i686_gnu" version = "0.36.1" @@ -5330,6 +5418,12 @@ version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" +[[package]] +name = "windows_i686_gnu" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" + [[package]] name = "windows_i686_msvc" version = "0.36.1" @@ -5342,6 +5436,12 @@ version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" +[[package]] +name = "windows_i686_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" + [[package]] name = "windows_x86_64_gnu" version = "0.36.1" @@ -5354,12 +5454,24 @@ version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" + [[package]] name = "windows_x86_64_gnullvm" version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" + [[package]] name = "windows_x86_64_msvc" version = "0.36.1" @@ -5372,6 +5484,21 @@ version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" + +[[package]] +name = "winnow" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae8970b36c66498d8ff1d66685dc86b91b29db0c7739899012f63a63814b4b28" +dependencies = [ + "memchr", +] + [[package]] name = "winreg" version = "0.10.1" @@ -5442,8 +5569,8 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f8f187641dad4f680d25c4bfc4225b418165984179f26ca76ec4fb6441d3a17" dependencies = [ - "proc-macro2 1.0.47", - "quote 1.0.21", + "proc-macro2 1.0.56", + "quote 1.0.26", "syn 1.0.109", "synstructure", ] diff --git a/avm/Cargo.lock b/avm/Cargo.lock index 6ec821b121..f47d50f177 100644 --- a/avm/Cargo.lock +++ b/avm/Cargo.lock @@ -3,22 +3,60 @@ version = 3 [[package]] -name = "anyhow" -version = "1.0.66" +name = "anstream" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6" +checksum = "6342bd4f5a1205d7f41e94a41a901f5647c938cdfa96036338e8533c9d6c2450" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is-terminal", + "utf8parse", +] [[package]] -name = "atty" -version = "0.2.14" +name = "anstyle" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d" + +[[package]] +name = "anstyle-parse" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e765fd216e48e067936442276d1d57399e37bce53c264d6fefbe298080cb57ee" dependencies = [ - "hermit-abi", - "libc", - "winapi", + "utf8parse", ] +[[package]] +name = "anstyle-query" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +dependencies = [ + "windows-sys 0.48.0", +] + +[[package]] +name = "anstyle-wincon" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" +dependencies = [ + "anstyle", + "windows-sys 0.48.0", +] + +[[package]] +name = "anyhow" +version = "1.0.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6" + [[package]] name = "autocfg" version = "1.1.0" @@ -86,40 +124,51 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "4.0.26" +version = "4.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2148adefda54e14492fb9bddcc600b4344c5d1a3123bd666dcb939c6f0e0e57e" +checksum = "956ac1f6381d8d82ab4684768f89c0ea3afe66925ceadb4eeb3fc452ffc55d62" dependencies = [ - "atty", - "bitflags", + "clap_builder", "clap_derive", - "clap_lex", "once_cell", +] + +[[package]] +name = "clap_builder" +version = "4.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84080e799e54cff944f4b4a4b0e71630b0e0443b25b985175c7dddc1a859b749" +dependencies = [ + "anstream", + "anstyle", + "bitflags", + "clap_lex", "strsim", - "termcolor", ] [[package]] name = "clap_derive" -version = "4.0.21" +version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0177313f9f02afc995627906bbd8967e2be069f5261954222dac78290c2b9014" +checksum = "3f9644cd56d6b87dbe899ef8b053e331c0637664e9e21a33dfcdc36093f5c5c4" dependencies = [ "heck", - "proc-macro-error", "proc-macro2", "quote", - "syn", + "syn 2.0.15", ] [[package]] name = "clap_lex" -version = "0.3.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d4198f73e42b4936b35b5bb248d81d2b595ecb170da0bac7655c54eedfa8da8" -dependencies = [ - "os_str_bytes", -] +checksum = "8a2dd5a6fe8c6e3502f568a6353e5273bbb15193ad9a89e457b9970798efbea1" + +[[package]] +name = "colorchoice" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" [[package]] name = "dirs" @@ -150,6 +199,27 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "errno" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" +dependencies = [ + "errno-dragonfly", + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "fastrand" version = "1.8.0" @@ -273,6 +343,12 @@ dependencies = [ "libc", ] +[[package]] +name = "hermit-abi" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" + [[package]] name = "http" version = "0.2.8" @@ -373,12 +449,35 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "io-lifetimes" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220" +dependencies = [ + "hermit-abi 0.3.1", + "libc", + "windows-sys 0.48.0", +] + [[package]] name = "ipnet" version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f88c5561171189e69df9d98bcf18fd5f9558300f7ea7b801eb8a0fd748bd8745" +[[package]] +name = "is-terminal" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" +dependencies = [ + "hermit-abi 0.3.1", + "io-lifetimes", + "rustix", + "windows-sys 0.48.0", +] + [[package]] name = "itoa" version = "1.0.4" @@ -396,9 +495,15 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.137" +version = "0.2.142" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a987beff54b60ffa6d51982e1aa1146bc42f19bd26be28b0586f252fccf5317" + +[[package]] +name = "linux-raw-sys" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" +checksum = "36eb31c1778188ae1e64398743890d0877fef36d11521ac60406b42016e8c2cf" [[package]] name = "log" @@ -430,7 +535,7 @@ dependencies = [ "libc", "log", "wasi", - "windows-sys", + "windows-sys 0.42.0", ] [[package]] @@ -439,7 +544,7 @@ version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5" dependencies = [ - "hermit-abi", + "hermit-abi 0.1.19", "libc", ] @@ -449,12 +554,6 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" -[[package]] -name = "os_str_bytes" -version = "6.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" - [[package]] name = "percent-encoding" version = "2.2.0" @@ -473,44 +572,20 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] - [[package]] name = "proc-macro2" -version = "1.0.47" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" +checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.21" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" +checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" dependencies = [ "proc-macro2", ] @@ -598,6 +673,20 @@ dependencies = [ "winapi", ] +[[package]] +name = "rustix" +version = "0.37.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0661814f891c57c930a610266415528da53c4933e6dea5fb350cbfe048a9ece" +dependencies = [ + "bitflags", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys", + "windows-sys 0.48.0", +] + [[package]] name = "rustls" version = "0.20.8" @@ -658,7 +747,7 @@ checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.103", ] [[package]] @@ -726,6 +815,17 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "syn" +version = "2.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "tempfile" version = "3.3.0" @@ -740,15 +840,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "termcolor" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" -dependencies = [ - "winapi-util", -] - [[package]] name = "thiserror" version = "1.0.37" @@ -766,7 +857,7 @@ checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.103", ] [[package]] @@ -798,7 +889,7 @@ dependencies = [ "num_cpus", "pin-project-lite", "socket2", - "windows-sys", + "windows-sys 0.42.0", ] [[package]] @@ -897,10 +988,10 @@ dependencies = [ ] [[package]] -name = "version_check" -version = "0.9.4" +name = "utf8parse" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "want" @@ -939,7 +1030,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn", + "syn 1.0.103", "wasm-bindgen-shared", ] @@ -973,7 +1064,7 @@ checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.103", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -1029,15 +1120,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -[[package]] -name = "winapi-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -dependencies = [ - "winapi", -] - [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" @@ -1050,13 +1132,37 @@ version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_aarch64_gnullvm 0.42.0", + "windows_aarch64_msvc 0.42.0", + "windows_i686_gnu 0.42.0", + "windows_i686_msvc 0.42.0", + "windows_x86_64_gnu 0.42.0", + "windows_x86_64_gnullvm 0.42.0", + "windows_x86_64_msvc 0.42.0", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +dependencies = [ + "windows_aarch64_gnullvm 0.48.0", + "windows_aarch64_msvc 0.48.0", + "windows_i686_gnu 0.48.0", + "windows_i686_msvc 0.48.0", + "windows_x86_64_gnu 0.48.0", + "windows_x86_64_gnullvm 0.48.0", + "windows_x86_64_msvc 0.48.0", ] [[package]] @@ -1065,42 +1171,84 @@ version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" + [[package]] name = "windows_aarch64_msvc" version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" + [[package]] name = "windows_i686_gnu" version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" +[[package]] +name = "windows_i686_gnu" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" + [[package]] name = "windows_i686_msvc" version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" +[[package]] +name = "windows_i686_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" + [[package]] name = "windows_x86_64_gnu" version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" + [[package]] name = "windows_x86_64_gnullvm" version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" + [[package]] name = "windows_x86_64_msvc" version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" + [[package]] name = "winreg" version = "0.10.1" diff --git a/avm/Cargo.toml b/avm/Cargo.toml index 40ddf76067..dc314cdec0 100644 --- a/avm/Cargo.toml +++ b/avm/Cargo.toml @@ -13,16 +13,16 @@ name = "anchor" path = "src/anchor/main.rs" [dependencies] -clap = { version = "4.0.26", features = [ "derive" ]} +clap = { version = "4.2.4", features = ["derive"]} cfg-if = "1.0.0" anyhow = "1.0.32" dirs = "4.0.0" semver = "1.0.4" -serde = { version = "1.0.136", features = [ "derive" ]} +serde = { version = "1.0.136", features = ["derive"] } serde_json = "1.0.78" thiserror = "1.0.30" once_cell = { version = "1.8.0" } -reqwest = { version = "0.11.9", default-features = false, features = ['blocking', 'json', 'rustls-tls'] } +reqwest = { version = "0.11.9", default-features = false, features = ["blocking", "json", "rustls-tls"] } tempfile = "3.3.0" [workspace] diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 6daa019eca..63537baf59 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -17,7 +17,7 @@ dev = [] default = [] [dependencies] -clap = { version = "4.0.26", features = ["derive"] } +clap = { version = "4.2.4", features = ["derive"] } anyhow = "1.0.32" syn = { version = "1.0.60", features = ["full", "extra-traits"] } anchor-lang = { path = "../lang", version = "0.27.0" } diff --git a/client/example/Cargo.toml b/client/example/Cargo.toml index 5af6efd894..56768daab0 100644 --- a/client/example/Cargo.toml +++ b/client/example/Cargo.toml @@ -16,5 +16,5 @@ optional = { path = "../../tests/optional/programs/optional", features = ["no-en events = { path = "../../tests/events/programs/events", features = ["no-entrypoint"] } shellexpand = "2.1.0" anyhow = "1.0.32" -clap = { version = "4.0.26", features = ["derive"] } +clap = { version = "4.2.4", features = ["derive"] } solana-sdk = "1.14.16" diff --git a/docs/src/pages/docs/intro-to-solana.md b/docs/src/pages/docs/intro-to-solana.md index dd0e4b52d7..a491e0270e 100644 --- a/docs/src/pages/docs/intro-to-solana.md +++ b/docs/src/pages/docs/intro-to-solana.md @@ -31,7 +31,7 @@ The first point means that even if in theory the program may read and write to a > This design is partly responsible for Solana’s high throughput. The runtime can look at all the incoming transactions of a program (and even across programs) and can check whether the memory regions in the first argument of the transactions overlap. If they don’t, the runtime can run these transactions in parallel because they don’t conflict with each other. Even better, if the runtime sees that two transactions access overlapping memory regions but only read and don’t write, it can also parallelize those transactions because they do not conflict with each other. -How exactly can a transaction specify a memory region/account? To answer that, we need to look deeper into what properties an account has ([docs here](https://docs.rs/solana-program/latest/solana_program/account_info/struct.AccountInfo.html)). This is the data structure for an account in a transaction. The `is_signer` and `is_writable` fields are set per transaction (e.g. `is_signed` is set if the corresponding private key of the account's `key` field signed the transaction) and are not part of the metadata that is saved in the heap). In front of the user data that the account can store (in the `data` field) , there is some metadata connected to each account. First, it has a key property which is a ed25519 public key and serves as the address of the account. This is how the transaction can specify which accounts the program may access in the transaction. +How exactly can a transaction specify a memory region/account? To answer that, we need to look deeper into what properties an account has ([docs here](https://docs.rs/solana-program/latest/solana_program/account_info/struct.AccountInfo.html)). This is the data structure for an account in a transaction. The `is_signer` and `is_writable` fields are set per transaction (e.g. `is_signer` is set if the corresponding private key of the account's `key` field signed the transaction) and are not part of the metadata that is saved in the heap). In front of the user data that the account can store (in the `data` field) , there is some metadata connected to each account. First, it has a key property which is a ed25519 public key and serves as the address of the account. This is how the transaction can specify which accounts the program may access in the transaction. ![Transaction](/transaction.svg) diff --git a/lang/src/accounts/account_loader.rs b/lang/src/accounts/account_loader.rs index 322b41faaa..50f544ed16 100644 --- a/lang/src/accounts/account_loader.rs +++ b/lang/src/accounts/account_loader.rs @@ -22,7 +22,7 @@ use std::ops::DerefMut; /// Type facilitating on demand zero copy deserialization. /// /// Note that using accounts in this way is distinctly different from using, -/// for example, the [`Account`](./struct.Account.html). Namely, +/// for example, the [`Account`](crate::accounts::account::Account). Namely, /// one must call /// - `load_init` after initializing an account (this will ignore the missing /// account discriminator that gets added only after the user's instruction code) @@ -30,7 +30,7 @@ use std::ops::DerefMut; /// - `load_mut` when the account is mutable /// /// For more details on zero-copy-deserialization, see the -/// [`account`](./attr.account.html) attribute. +/// [`account`](crate::account) attribute. ///

/// ⚠️ When using this type it's important to be mindful /// of any calls to the load functions so as not to diff --git a/spl/Cargo.toml b/spl/Cargo.toml index 0c4f21af13..3d4b200632 100644 --- a/spl/Cargo.toml +++ b/spl/Cargo.toml @@ -28,4 +28,9 @@ solana-program = "1.14.16" spl-token = { version = "3.5.0", features = ["no-entrypoint"], optional = true } spl-token-2022 = { version = "0.5.0", features = ["no-entrypoint"], optional = true } spl-associated-token-account = { version = "1.1.1", features = ["no-entrypoint"], optional = true } -mpl-token-metadata = { version = "^1.9.0", optional = true, features = ["no-entrypoint"] } +mpl-token-metadata = { version = "^1.11.0", optional = true, features = ["no-entrypoint"] } + +# TODO: Remove after updating to latest version of platform-tools. +# Latest solana version(1.14.17) as of 2023-05-01 comes with rustc 1.62.0-dev but MSRV for latest +# version of this crate is 1.64.0. See https://github.com/solana-labs/solana/pull/31418 +winnow = "=0.4.1" diff --git a/spl/src/metadata.rs b/spl/src/metadata.rs index 296c853ba1..151afd81eb 100644 --- a/spl/src/metadata.rs +++ b/spl/src/metadata.rs @@ -1,7 +1,6 @@ use anchor_lang::{ - context::CpiContext, - prelude::{ErrorCode, UncheckedAccount}, - Accounts, Result, ToAccountInfos, + context::CpiContext, error::ErrorCode, prelude::UncheckedAccount, Accounts, Result, + ToAccountInfos, }; use mpl_token_metadata::{ state::{CollectionDetails, DataV2, TokenMetadataAccount}, @@ -54,7 +53,6 @@ pub fn bubblegum_set_collection_size<'info>( pub fn burn_edition_nft<'info>( ctx: CpiContext<'_, '_, '_, 'info, BurnEditionNft<'info>>, - collection_metadata: Option, ) -> Result<()> { let ix = mpl_token_metadata::instruction::burn_edition_nft( ID, @@ -99,47 +97,6 @@ pub fn burn_nft<'info>( .map_err(Into::into) } -#[deprecated(note = "internal instructions deprecated by Metaplex")] -pub fn create_metadata_accounts_v2<'info>( - ctx: CpiContext<'_, '_, '_, 'info, CreateMetadataAccountsV2<'info>>, - data: DataV2, - is_mutable: bool, - update_authority_is_signer: bool, -) -> Result<()> { - let DataV2 { - name, - symbol, - uri, - creators, - seller_fee_basis_points, - collection, - uses, - } = data; - let ix = mpl_token_metadata::instruction::create_metadata_accounts_v2( - ID, - *ctx.accounts.metadata.key, - *ctx.accounts.mint.key, - *ctx.accounts.mint_authority.key, - *ctx.accounts.payer.key, - *ctx.accounts.update_authority.key, - name, - symbol, - uri, - creators, - seller_fee_basis_points, - update_authority_is_signer, - is_mutable, - collection, - uses, - ); - solana_program::program::invoke_signed( - &ix, - &ToAccountInfos::to_account_infos(&ctx), - ctx.signer_seeds, - ) - .map_err(Into::into) -} - pub fn create_metadata_accounts_v3<'info>( ctx: CpiContext<'_, '_, '_, 'info, CreateMetadataAccountsV3<'info>>, data: DataV2, @@ -599,18 +556,6 @@ pub struct BurnNft<'info> { pub spl_token: UncheckedAccount<'info>, } -#[deprecated(note = "internal instructions deprecated by Metaplex")] -#[derive(Accounts)] -pub struct CreateMetadataAccountsV2<'info> { - pub metadata: UncheckedAccount<'info>, - pub mint: UncheckedAccount<'info>, - pub mint_authority: UncheckedAccount<'info>, - pub payer: UncheckedAccount<'info>, - pub update_authority: UncheckedAccount<'info>, - pub system_program: UncheckedAccount<'info>, - pub rent: UncheckedAccount<'info>, -} - #[derive(Accounts)] pub struct CreateMetadataAccountsV3<'info> { pub metadata: UncheckedAccount<'info>, diff --git a/tests/bench/Anchor.toml b/tests/bench/Anchor.toml index 8e0cf1d521..661873a265 100644 --- a/tests/bench/Anchor.toml +++ b/tests/bench/Anchor.toml @@ -3,13 +3,14 @@ cluster = "localnet" wallet = "~/.config/solana/id.json" [programs.localnet] -bench = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS" +bench = "Bench11111111111111111111111111111111111111" [workspace] members = ["programs/bench"] [scripts] -test = "yarn run ts-mocha -t 1000000 -p ./tsconfig.json -t 1000000 tests/**/*.ts" -update-bench = "yarn run ts-node scripts/update-bench.ts" +test = "yarn run ts-mocha -t 1000000 -p ./tsconfig.json tests/**/*.ts" +sync = "yarn run ts-node scripts/sync.ts" +sync-markdown = "yarn run ts-node scripts/sync-markdown.ts" generate-ix = "yarn run ts-node scripts/generate-ix.ts" bump-version = "yarn run ts-node scripts/bump-version.ts" diff --git a/tests/bench/README.md b/tests/bench/README.md index b57b50d0f8..061e1d54ac 100644 --- a/tests/bench/README.md +++ b/tests/bench/README.md @@ -4,21 +4,25 @@ The bench program and its tests are used to measure the performance of Anchor pr ## How -Create a program -> Write tests that measure usage -> Compare the results -> Save the new result - -The script will check whether there is a difference between the current result and the last saved result(in `bench.json`) at the end of the tests. If the difference between the results is greater than 1%, the new data will be saved in `bench.json` and Markdown files in [/bench](https://github.com/coral-xyz/anchor/tree/master/bench) will be updated accordingly. +We run the same tests that measure some metric for each Anchor version starting from `0.27.0`. If the difference between the results is greater than 1%, the new data will be saved in `bench.json` and Markdown files in [/bench](https://github.com/coral-xyz/anchor/tree/master/bench) will be updated accordingly. ## Scripts +| :memo: TL;DR | +| :----------------------------------------------------------------------------------------------------------------------------- | +| If you've made changes to programs or tests in this directory, run `anchor run sync`, otherwise run `anchor test --skip-lint`. | + `anchor test --skip-lint`: Run all tests and update benchmark files when necessary. This is the only command that needs to be run for most use cases. --- The following scripts are useful when making changes to how benchmarking works. -`anchor run update-bench`: Update Markdown files in [/bench](https://github.com/coral-xyz/anchor/tree/master/bench) based on the data from `bench.json`. +`anchor run sync`: Sync all benchmark files by running tests for each version. If you've made changes to the bench program or its tests, you should run this command to sync the results. + +`anchor run sync-markdown`: Sync Markdown files in [/bench](https://github.com/coral-xyz/anchor/tree/master/bench) based on the data from `bench.json`. -`anchor run generate-ix`: Generate instructions with repetitive accounts. +`anchor run generate-ix`: Generate program instructions with repetitive accounts. --- diff --git a/tests/bench/programs/bench/Cargo.toml b/tests/bench/programs/bench/Cargo.toml index d7b162620b..1d21010acf 100644 --- a/tests/bench/programs/bench/Cargo.toml +++ b/tests/bench/programs/bench/Cargo.toml @@ -14,3 +14,8 @@ cpi = ["no-entrypoint"] [dependencies] anchor-lang = { path = "../../../../lang" } anchor-spl = { path = "../../../../spl" } + +# TODO: Remove this and store lock files for each version instead. +# Latest solana version(1.14.17) as of 2023-05-01 comes with rustc 1.62.0-dev but MSRV for latest +# version of this crate is 1.64.0. See https://github.com/solana-labs/solana/pull/31418 +winnow = "=0.4.1" diff --git a/tests/bench/programs/bench/src/lib.rs b/tests/bench/programs/bench/src/lib.rs index 263b471286..dc171590fd 100644 --- a/tests/bench/programs/bench/src/lib.rs +++ b/tests/bench/programs/bench/src/lib.rs @@ -1,9 +1,11 @@ //! This program is used to measure the performance of Anchor programs. +//! +//! If you are making a change to this program, run `anchor run sync`. use anchor_lang::prelude::*; use anchor_spl::token_interface::{Mint, TokenAccount, TokenInterface}; -declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"); +declare_id!("Bench11111111111111111111111111111111111111"); #[program] pub mod bench { diff --git a/tests/bench/scripts/update-bench.ts b/tests/bench/scripts/sync-markdown.ts similarity index 68% rename from tests/bench/scripts/update-bench.ts rename to tests/bench/scripts/sync-markdown.ts index 9b6cd063bb..1c8e1eab3d 100644 --- a/tests/bench/scripts/update-bench.ts +++ b/tests/bench/scripts/sync-markdown.ts @@ -1,4 +1,4 @@ -/** Update Markdown files in /bench */ +/** Sync Markdown files in /bench based on the data from bench.json */ import { BenchData, Markdown } from "./utils"; @@ -33,19 +33,27 @@ import { BenchData, Markdown } from "./utils"; bench.compareComputeUnits( newComputeUnitsResult, oldComputeUnitsResult, - (ixName, newComputeUnits, oldComputeUnits) => { - const percentChange = ( - (newComputeUnits / oldComputeUnits - 1) * - 100 - ).toFixed(2); + ({ ixName, newComputeUnits, oldComputeUnits }) => { + if (newComputeUnits === null) { + // Deleted instruction + return; + } let changeText; - if (isNaN(oldComputeUnits)) { + if (oldComputeUnits === null) { + // New instruction changeText = "N/A"; - } else if (+percentChange > 0) { - changeText = `🔴 **+${percentChange}%**`; } else { - changeText = `🟢 **${percentChange}%**`; + const percentChange = ( + (newComputeUnits / oldComputeUnits - 1) * + 100 + ).toFixed(2); + + if (+percentChange > 0) { + changeText = `🔴 **+${percentChange}%**`; + } else { + changeText = `🟢 **${percentChange}%**`; + } } table.insert(ixName, newComputeUnits.toString(), changeText); diff --git a/tests/bench/scripts/sync.ts b/tests/bench/scripts/sync.ts new file mode 100644 index 0000000000..b535921d18 --- /dev/null +++ b/tests/bench/scripts/sync.ts @@ -0,0 +1,66 @@ +/** + * Sync all saved data by re-running the tests for each version. + * + * This script should be used when the bench program or its tests has changed + * and all data needs to be updated. + */ + +import path from "path"; +import { spawnSync } from "child_process"; + +import { ANCHOR_VERSION_ARG, BenchData, Toml } from "./utils"; + +(async () => { + const bench = await BenchData.open(); + + const cargoToml = await Toml.open( + path.join("..", "programs", "bench", "Cargo.toml") + ); + const anchorToml = await Toml.open(path.join("..", "Anchor.toml")); + + for (const version of bench.getVersions()) { + console.log(`Updating '${version}'...`); + + const isUnreleased = version === "unreleased"; + + // Update the anchor dependency versions + for (const dependency of ["lang", "spl"]) { + cargoToml.replaceValue(`anchor-${dependency}`, () => { + return isUnreleased + ? `{ path = "../../../../${dependency}" }` + : `"${version}"`; + }); + } + + // Save Cargo.toml + await cargoToml.save(); + + // Update `anchor test` command to pass version in Anchor.toml + anchorToml.replaceValue( + "test", + (cmd) => { + return cmd.includes(ANCHOR_VERSION_ARG) + ? cmd.replace( + new RegExp(`\\s*${ANCHOR_VERSION_ARG}\\s+(.+)`), + (arg, ver) => (isUnreleased ? "" : arg.replace(ver, version)) + ) + : `${cmd} ${ANCHOR_VERSION_ARG} ${version}`; + }, + { insideQuotes: true } + ); + + // Save Anchor.toml + await anchorToml.save(); + + // Run the command to update the current version's results + const result = spawnSync("anchor", ["test", "--skip-lint"]); + console.log(result.output.toString()); + + // Check for failure + if (result.status !== 0) { + console.error("Please fix the error and re-run this command."); + process.exitCode = 1; + return; + } + } +})(); diff --git a/tests/bench/scripts/utils.ts b/tests/bench/scripts/utils.ts index 8350cbbb61..02bd38804d 100644 --- a/tests/bench/scripts/utils.ts +++ b/tests/bench/scripts/utils.ts @@ -2,6 +2,9 @@ import * as fs from "fs/promises"; import path from "path"; import { spawnSync } from "child_process"; +/** Version that is used in bench data file */ +export type Version = "unreleased" | (`${number}.${number}.${number}` & {}); + /** Persistent benchmark data(mapping of `Version -> Data`) */ type Bench = { [key: string]: { @@ -21,7 +24,10 @@ export type ComputeUnits = { [key: string]: number }; export const THRESHOLD_PERCENTAGE = 1; /** Path to the benchmark Markdown files */ -export const BENCH_DIR_PATH = "../../bench"; +export const BENCH_DIR_PATH = path.join("..", "..", "bench"); + +/** Command line argument for Anchor version */ +export const ANCHOR_VERSION_ARG = "--anchor-version"; /** Utility class to handle benchmark data related operations */ export class BenchData { @@ -56,43 +62,74 @@ export class BenchData { } /** Get the stored results based on version */ - get(version: string) { + get(version: Version) { return this.#data[version]; } - /** Get unreleased version results */ - getUnreleased() { - return this.get("unreleased"); - } - /** Get all versions */ getVersions() { - return Object.keys(this.#data); + return Object.keys(this.#data) as Version[]; } /** Compare and update compute units changes */ compareComputeUnits( newComputeUnitsResult: ComputeUnits, oldComputeUnitsResult: ComputeUnits, - changeCb: ( - ixName: string, - newComputeUnits: number, - oldComputeUnits: number - ) => void, + changeCb: (args: { + ixName: string; + newComputeUnits: number | null; + oldComputeUnits: number | null; + }) => void, noChangeCb?: (ixName: string, computeUnits: number) => void ) { let needsUpdate = false; + const checkIxs = ( + comparedFrom: ComputeUnits, + comparedTo: ComputeUnits, + cb: (ixName: string, computeUnits: number) => void + ) => { + for (const ixName in comparedFrom) { + if (comparedTo[ixName] === undefined) { + cb(ixName, comparedFrom[ixName]); + } + } + }; + + // New instruction + checkIxs( + newComputeUnitsResult, + oldComputeUnitsResult, + (ixName, computeUnits) => { + console.log(`New instruction '${ixName}'`); + changeCb({ + ixName, + newComputeUnits: computeUnits, + oldComputeUnits: null, + }); + needsUpdate = true; + } + ); + + // Deleted instruction + checkIxs( + oldComputeUnitsResult, + newComputeUnitsResult, + (ixName, computeUnits) => { + console.log(`Deleted instruction '${ixName}'`); + changeCb({ + ixName, + newComputeUnits: null, + oldComputeUnits: computeUnits, + }); + needsUpdate = true; + } + ); + // Compare compute units changes for (const ixName in newComputeUnitsResult) { const oldComputeUnits = oldComputeUnitsResult[ixName]; const newComputeUnits = newComputeUnitsResult[ixName]; - if (!oldComputeUnits) { - console.log(`New instruction '${ixName}'`); - needsUpdate = true; - changeCb(ixName, newComputeUnits, NaN); - continue; - } const percentage = THRESHOLD_PERCENTAGE / 100; const oldMaximumAllowedDelta = oldComputeUnits * percentage; @@ -119,8 +156,12 @@ export class BenchData { `Compute units change '${ixName}' (${oldComputeUnits} -> ${newComputeUnits})` ); + changeCb({ + ixName, + newComputeUnits, + oldComputeUnits, + }); needsUpdate = true; - changeCb(ixName, newComputeUnits, oldComputeUnits); } else { noChangeCb?.(ixName, newComputeUnits); } @@ -131,14 +172,14 @@ export class BenchData { /** Bump benchmark data version to the given version */ bumpVersion(newVersion: string) { - const versions = Object.keys(this.#data); - const unreleasedVersion = versions[versions.length - 1]; - if (this.#data[newVersion]) { console.error(`Version '${newVersion}' already exists!`); process.exit(1); } + const versions = this.getVersions(); + const unreleasedVersion = versions[versions.length - 1]; + // Add the new version this.#data[newVersion] = this.get(unreleasedVersion); @@ -296,3 +337,56 @@ class MarkdownTable { ); } } + +/** Utility class to handle TOML related operations */ +export class Toml { + /** TOML filepath */ + #path: string; + + /** TOML text */ + #text: string; + + constructor(path: string, text: string) { + this.#path = path; + this.#text = text; + } + + /** Open the TOML file */ + static async open(tomlPath: string) { + tomlPath = path.join(__dirname, tomlPath); + const text = await fs.readFile(tomlPath, { + encoding: "utf8", + }); + return new Toml(tomlPath, text); + } + + /** Save the TOML file */ + async save() { + await fs.writeFile(this.#path, this.#text); + } + + /** Replace the value for the given key */ + replaceValue( + key: string, + cb: (previous: string) => string, + opts?: { insideQuotes: boolean } + ) { + this.#text = this.#text.replace( + new RegExp(`${key}\\s*=\\s*${opts?.insideQuotes ? `"(.*)"` : "(.*)"}`), + (line, value) => line.replace(value, cb(value)) + ); + } +} + +/** + * Get Anchor version from the passed arguments. + * + * Defaults to `unreleased`. + */ +export const getVersionFromArgs = () => { + const args = process.argv; + const anchorVersionArgIndex = args.indexOf(ANCHOR_VERSION_ARG); + return anchorVersionArgIndex === -1 + ? "unreleased" + : (args[anchorVersionArgIndex + 1] as Version); +}; diff --git a/tests/bench/tests/compute-units.ts b/tests/bench/tests/compute-units.ts index 9b589733fa..bf96b0a710 100644 --- a/tests/bench/tests/compute-units.ts +++ b/tests/bench/tests/compute-units.ts @@ -3,7 +3,7 @@ import * as token from "@coral-xyz/spl-token"; import { spawnSync } from "child_process"; import { Bench, IDL } from "../target/types/bench"; -import { BenchData, ComputeUnits } from "../scripts/utils"; +import { BenchData, ComputeUnits, getVersionFromArgs } from "../scripts/utils"; describe(IDL.name, () => { // Configure the client to use the local cluster @@ -222,12 +222,17 @@ describe(IDL.name, () => { const bench = await BenchData.open(); // Compare and update compute units changes - const oldComputeUnits = bench.getUnreleased().computeUnits; + const version = getVersionFromArgs(); + const oldComputeUnits = bench.get(version).computeUnits; const { needsUpdate } = bench.compareComputeUnits( computeUnits, oldComputeUnits, - (ixName, newComputeUnits) => { - oldComputeUnits[ixName] = newComputeUnits; + ({ ixName, newComputeUnits: newValue }) => { + if (newValue === null) { + delete oldComputeUnits[ixName]; + } else { + oldComputeUnits[ixName] = newValue; + } } ); @@ -235,10 +240,13 @@ describe(IDL.name, () => { console.log("Updating benchmark files..."); // Save bench data file - // (needs to happen before running the `update-bench` script) + // (needs to happen before running the `sync-markdown` script) await bench.save(); - spawnSync("anchor", ["run", "update-bench"]); + // Only update markdown files on `unreleased` version + if (version === "unreleased") { + spawnSync("anchor", ["run", "sync-markdown"]); + } } }); });