diff --git a/CHANGELOG.md b/CHANGELOG.md index fa1070387a..0fe4a071c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,17 +13,25 @@ The minor version will be incremented upon a breaking change and the patch versi ### Features - cli: Allow force `init` and `new` ([#2698](https://github.com/coral-xyz/anchor/pull/2698)). +- cli: Add verifiable option when `deploy` ([#2705](https://github.com/coral-xyz/anchor/pull/2705)). +- cli: Add support for passing arguments to the underlying `solana program deploy` command with `anchor deploy` ([#2709](https://github.com/coral-xyz/anchor/pull/2709)). ### Fixes - syn: Add missing `new_from_array` method to `Hash` ([#2682](https://github.com/coral-xyz/anchor/pull/2682)). - cli: Switch to Cargo feature resolver(`resolver = "2"`) ([#2676](https://github.com/coral-xyz/anchor/pull/2676)). - cli: Fix using user specific path for `provider.wallet` in `Anchor.toml` ([#2696](https://github.com/coral-xyz/anchor/pull/2696)). +- syn: Fix IDL constant seeds parsing ([#2699](https://github.com/coral-xyz/anchor/pull/2699)). - cli: Display errors if toolchain override restoration fails ([#2700](https://github.com/coral-xyz/anchor/pull/2700)). +- cli: Fix commit based `anchor_version` override ([#2704](https://github.com/coral-xyz/anchor/pull/2704)). +- spl: Fix compilation with `shmem` feature enabled ([#2722](https://github.com/coral-xyz/anchor/pull/2722)). +- cli: Localhost default test validator address changes from `localhost` to `127.0.0.1`, NodeJS 17 IP resolution changes for IPv6 ([#2725](https://github.com/coral-xyz/anchor/pull/2725)). ### Breaking - cli: Make `cargo build-sbf` the default build command ([#2694](https://github.com/coral-xyz/anchor/pull/2694)). +- cli: Require explicit `overflow-checks` flag ([#2716](https://github.com/coral-xyz/anchor/pull/2716)). +- ts: Remove `anchor-deprecated-state` feature ([#2717](https://github.com/coral-xyz/anchor/pull/2717)). ## [0.29.0] - 2023-10-16 diff --git a/bench/BINARY_SIZE.md b/bench/BINARY_SIZE.md index 5583289c2d..ef36554168 100644 --- a/bench/BINARY_SIZE.md +++ b/bench/BINARY_SIZE.md @@ -16,9 +16,9 @@ The programs and their tests are located in [/tests/bench](https://github.com/co Solana version: 1.17.0 -| Program | Binary Size | - | -| ------- | ----------- | --- | -| bench | 735,800 | - | +| Program | Binary Size | - | +| ------- | ----------- | ------------------- | +| bench | 743,208 | 🔴 **+152 (0.02%)** | ### Notable changes @@ -30,7 +30,7 @@ Solana version: 1.17.0 | Program | Binary Size | +/- | | ------- | ----------- | ------------------------ | -| bench | 735,800 | 🟢 **-417,936 (36.22%)** | +| bench | 743,056 | 🟢 **-417,904 (36.00%)** | ### Notable changes @@ -46,7 +46,7 @@ Solana version: 1.16.0 | Program | Binary Size | +/- | | ------- | ----------- | ---------------------- | -| bench | 1,153,736 | 🔴 **+35,000 (3.13%)** | +| bench | 1,160,960 | 🔴 **+23,272 (2.05%)** | ### Notable changes @@ -60,6 +60,6 @@ Solana version: 1.14.16 | Program | Binary Size | +/- | | ------- | ----------- | --- | -| bench | 1,118,736 | N/A | +| bench | 1,137,688 | N/A | --- diff --git a/bench/COMPUTE_UNITS.md b/bench/COMPUTE_UNITS.md index 1e6a9ecaa5..9c969678b4 100644 --- a/bench/COMPUTE_UNITS.md +++ b/bench/COMPUTE_UNITS.md @@ -18,93 +18,93 @@ Solana version: 1.17.0 | Instruction | Compute Units | - | | --------------------------- | ------------- | --- | -| accountInfo1 | 584 | - | -| accountInfo2 | 824 | - | -| accountInfo4 | 1,319 | - | -| accountInfo8 | 2,531 | - | -| accountEmptyInit1 | 4,899 | - | -| accountEmpty1 | 708 | - | -| accountEmptyInit2 | 9,325 | - | -| accountEmpty2 | 1,064 | - | -| accountEmptyInit4 | 17,821 | - | -| accountEmpty4 | 1,766 | - | -| accountEmptyInit8 | 34,855 | - | -| accountEmpty8 | 3,179 | - | -| accountSizedInit1 | 4,988 | - | -| accountSized1 | 732 | - | -| accountSizedInit2 | 9,499 | - | -| accountSized2 | 1,106 | - | -| accountSizedInit4 | 18,219 | - | -| accountSized4 | 1,863 | - | -| accountSizedInit8 | 35,574 | - | -| accountSized8 | 3,374 | - | -| accountUnsizedInit1 | 5,075 | - | -| accountUnsized1 | 759 | - | -| accountUnsizedInit2 | 9,736 | - | -| accountUnsized2 | 1,168 | - | -| accountUnsizedInit4 | 18,622 | - | -| accountUnsized4 | 2,000 | - | -| accountUnsizedInit8 | 36,119 | - | -| accountUnsized8 | 3,667 | - | -| boxedAccountEmptyInit1 | 4,952 | - | -| boxedAccountEmpty1 | 745 | - | -| boxedAccountEmptyInit2 | 9,426 | - | -| boxedAccountEmpty2 | 1,136 | - | -| boxedAccountEmptyInit4 | 18,020 | - | -| boxedAccountEmpty4 | 1,913 | - | -| boxedAccountEmptyInit8 | 35,248 | - | -| boxedAccountEmpty8 | 3,500 | - | -| boxedAccountSizedInit1 | 5,027 | - | -| boxedAccountSized1 | 767 | - | -| boxedAccountSizedInit2 | 9,582 | - | -| boxedAccountSized2 | 1,183 | - | -| boxedAccountSizedInit4 | 18,332 | - | -| boxedAccountSized4 | 2,002 | - | -| boxedAccountSizedInit8 | 35,868 | - | -| boxedAccountSized8 | 3,682 | - | -| boxedAccountUnsizedInit1 | 5,109 | - | -| boxedAccountUnsized1 | 797 | - | -| boxedAccountUnsizedInit2 | 9,746 | - | -| boxedAccountUnsized2 | 1,246 | - | -| boxedAccountUnsizedInit4 | 18,658 | - | -| boxedAccountUnsized4 | 2,135 | - | -| boxedAccountUnsizedInit8 | 36,525 | - | -| boxedAccountUnsized8 | 3,948 | - | -| boxedInterfaceAccountMint1 | 2,085 | - | -| boxedInterfaceAccountMint2 | 3,726 | - | -| boxedInterfaceAccountMint4 | 6,991 | - | -| boxedInterfaceAccountMint8 | 13,562 | - | -| boxedInterfaceAccountToken1 | 2,015 | - | -| boxedInterfaceAccountToken2 | 3,585 | - | -| boxedInterfaceAccountToken4 | 6,712 | - | -| boxedInterfaceAccountToken8 | 13,003 | - | -| interfaceAccountMint1 | 2,174 | - | -| interfaceAccountMint2 | 4,057 | - | -| interfaceAccountMint4 | 7,823 | - | -| interfaceAccountMint8 | 15,357 | - | -| interfaceAccountToken1 | 2,101 | - | -| interfaceAccountToken2 | 3,909 | - | -| interfaceAccountToken4 | 7,522 | - | -| interface1 | 630 | - | -| interface2 | 813 | - | -| interface4 | 1,174 | - | -| interface8 | 1,905 | - | -| program1 | 630 | - | -| program2 | 813 | - | -| program4 | 1,176 | - | -| program8 | 1,905 | - | -| signer1 | 564 | - | -| signer2 | 776 | - | -| signer4 | 1,195 | - | -| signer8 | 2,035 | - | -| systemAccount1 | 618 | - | -| systemAccount2 | 882 | - | -| systemAccount4 | 1,406 | - | -| systemAccount8 | 2,460 | - | -| uncheckedAccount1 | 546 | - | -| uncheckedAccount2 | 738 | - | -| uncheckedAccount4 | 1,115 | - | -| uncheckedAccount8 | 1,877 | - | +| accountInfo1 | 695 | - | +| accountInfo2 | 1,035 | - | +| accountInfo4 | 1,730 | - | +| accountInfo8 | 3,342 | - | +| accountEmptyInit1 | 5,552 | - | +| accountEmpty1 | 819 | - | +| accountEmptyInit2 | 10,421 | - | +| accountEmpty2 | 1,275 | - | +| accountEmptyInit4 | 19,803 | - | +| accountEmpty4 | 2,177 | - | +| accountEmptyInit8 | 38,609 | - | +| accountEmpty8 | 3,990 | - | +| accountSizedInit1 | 5,647 | - | +| accountSized1 | 843 | - | +| accountSizedInit2 | 10,607 | - | +| accountSized2 | 1,317 | - | +| accountSizedInit4 | 20,225 | - | +| accountSized4 | 2,274 | - | +| accountSizedInit8 | 39,376 | - | +| accountSized8 | 4,185 | - | +| accountUnsizedInit1 | 5,740 | - | +| accountUnsized1 | 870 | - | +| accountUnsizedInit2 | 10,856 | - | +| accountUnsized2 | 1,379 | - | +| accountUnsizedInit4 | 20,652 | - | +| accountUnsized4 | 2,411 | - | +| accountUnsizedInit8 | 39,969 | - | +| accountUnsized8 | 4,478 | - | +| boxedAccountEmptyInit1 | 5,605 | - | +| boxedAccountEmpty1 | 856 | - | +| boxedAccountEmptyInit2 | 10,522 | - | +| boxedAccountEmpty2 | 1,347 | - | +| boxedAccountEmptyInit4 | 20,002 | - | +| boxedAccountEmpty4 | 2,324 | - | +| boxedAccountEmptyInit8 | 39,002 | - | +| boxedAccountEmpty8 | 4,311 | - | +| boxedAccountSizedInit1 | 5,686 | - | +| boxedAccountSized1 | 878 | - | +| boxedAccountSizedInit2 | 10,690 | - | +| boxedAccountSized2 | 1,394 | - | +| boxedAccountSizedInit4 | 20,338 | - | +| boxedAccountSized4 | 2,413 | - | +| boxedAccountSizedInit8 | 39,670 | - | +| boxedAccountSized8 | 4,493 | - | +| boxedAccountUnsizedInit1 | 5,774 | - | +| boxedAccountUnsized1 | 908 | - | +| boxedAccountUnsizedInit2 | 10,866 | - | +| boxedAccountUnsized2 | 1,457 | - | +| boxedAccountUnsizedInit4 | 20,688 | - | +| boxedAccountUnsized4 | 2,546 | - | +| boxedAccountUnsizedInit8 | 40,375 | - | +| boxedAccountUnsized8 | 4,759 | - | +| boxedInterfaceAccountMint1 | 2,196 | - | +| boxedInterfaceAccountMint2 | 3,847 | - | +| boxedInterfaceAccountMint4 | 7,132 | - | +| boxedInterfaceAccountMint8 | 13,743 | - | +| boxedInterfaceAccountToken1 | 2,126 | - | +| boxedInterfaceAccountToken2 | 3,706 | - | +| boxedInterfaceAccountToken4 | 6,853 | - | +| boxedInterfaceAccountToken8 | 13,184 | - | +| interfaceAccountMint1 | 2,285 | - | +| interfaceAccountMint2 | 4,178 | - | +| interfaceAccountMint4 | 7,964 | - | +| interfaceAccountMint8 | 15,538 | - | +| interfaceAccountToken1 | 2,212 | - | +| interfaceAccountToken2 | 4,030 | - | +| interfaceAccountToken4 | 7,663 | - | +| interface1 | 741 | - | +| interface2 | 934 | - | +| interface4 | 1,315 | - | +| interface8 | 2,086 | - | +| program1 | 741 | - | +| program2 | 934 | - | +| program4 | 1,317 | - | +| program8 | 2,086 | - | +| signer1 | 675 | - | +| signer2 | 987 | - | +| signer4 | 1,606 | - | +| signer8 | 2,846 | - | +| systemAccount1 | 729 | - | +| systemAccount2 | 1,093 | - | +| systemAccount4 | 1,817 | - | +| systemAccount8 | 3,271 | - | +| uncheckedAccount1 | 657 | - | +| uncheckedAccount2 | 949 | - | +| uncheckedAccount4 | 1,526 | - | +| uncheckedAccount8 | 2,688 | - | ### Notable changes @@ -116,93 +116,93 @@ Solana version: 1.17.0 | Instruction | Compute Units | +/- | | --------------------------- | ------------- | ---------------------- | -| accountInfo1 | 584 | 🟢 **-431 (42.46%)** | -| accountInfo2 | 824 | 🟢 **-651 (44.14%)** | -| accountInfo4 | 1,319 | 🟢 **-645 (32.84%)** | -| accountInfo8 | 2,531 | 🟢 **-1,310 (34.11%)** | -| accountEmptyInit1 | 4,899 | 🟢 **-918 (15.78%)** | -| accountEmpty1 | 708 | 🟢 **-441 (38.38%)** | -| accountEmptyInit2 | 9,325 | 🟢 **-1,077 (10.35%)** | -| accountEmpty2 | 1,064 | 🟢 **-690 (39.34%)** | -| accountEmptyInit4 | 17,821 | 🟢 **-1,687 (8.65%)** | -| accountEmpty4 | 1,766 | 🟢 **-774 (30.47%)** | -| accountEmptyInit8 | 34,855 | 🟢 **-2,410 (6.47%)** | -| accountEmpty8 | 3,179 | 🟢 **-1,837 (36.62%)** | -| accountSizedInit1 | 4,988 | 🟢 **-936 (15.80%)** | -| accountSized1 | 732 | 🟢 **-482 (39.70%)** | -| accountSizedInit2 | 9,499 | 🟢 **-1,181 (11.06%)** | -| accountSized2 | 1,106 | 🟢 **-767 (40.95%)** | -| accountSizedInit4 | 18,219 | 🟢 **-1,751 (8.77%)** | -| accountSized4 | 1,863 | 🟢 **-899 (32.55%)** | -| accountSizedInit8 | 35,574 | 🟢 **-2,548 (6.68%)** | -| accountSized8 | 3,374 | 🟢 **-1,979 (36.97%)** | -| accountUnsizedInit1 | 5,075 | 🟢 **-977 (16.14%)** | -| accountUnsized1 | 759 | 🟢 **-579 (43.27%)** | -| accountUnsizedInit2 | 9,736 | 🟢 **-1,193 (10.92%)** | -| accountUnsized2 | 1,168 | 🟢 **-610 (34.31%)** | -| accountUnsizedInit4 | 18,622 | 🟢 **-1,717 (8.44%)** | -| accountUnsized4 | 2,000 | 🟢 **-1,136 (36.22%)** | -| accountUnsizedInit8 | 36,119 | 🟢 **-2,977 (7.61%)** | -| accountUnsized8 | 3,667 | 🟢 **-2,285 (38.39%)** | -| boxedAccountEmptyInit1 | 4,952 | 🟢 **-1,082 (17.93%)** | -| boxedAccountEmpty1 | 745 | 🟢 **-143 (16.10%)** | -| boxedAccountEmptyInit2 | 9,426 | 🟢 **-1,207 (11.35%)** | -| boxedAccountEmpty2 | 1,136 | 🟢 **-265 (18.92%)** | -| boxedAccountEmptyInit4 | 18,020 | 🟢 **-1,291 (6.69%)** | -| boxedAccountEmpty4 | 1,913 | 🟢 **-511 (21.08%)** | -| boxedAccountEmptyInit8 | 35,248 | 🟢 **-1,888 (5.08%)** | -| boxedAccountEmpty8 | 3,500 | 🟢 **-1,159 (24.88%)** | -| boxedAccountSizedInit1 | 5,027 | 🟢 **-1,103 (17.99%)** | -| boxedAccountSized1 | 767 | 🟢 **-150 (16.36%)** | -| boxedAccountSizedInit2 | 9,582 | 🟢 **-1,246 (11.51%)** | -| boxedAccountSized2 | 1,183 | 🟢 **-280 (19.14%)** | -| boxedAccountSizedInit4 | 18,332 | 🟢 **-1,371 (6.96%)** | -| boxedAccountSized4 | 2,002 | 🟢 **-541 (21.27%)** | -| boxedAccountSizedInit8 | 35,868 | 🟢 **-2,051 (5.41%)** | -| boxedAccountSized8 | 3,682 | 🟢 **-1,216 (24.83%)** | -| boxedAccountUnsizedInit1 | 5,109 | 🟢 **-1,131 (18.13%)** | -| boxedAccountUnsized1 | 797 | 🟢 **-175 (18.00%)** | -| boxedAccountUnsizedInit2 | 9,746 | 🟢 **-1,302 (11.78%)** | -| boxedAccountUnsized2 | 1,246 | 🟢 **-324 (20.64%)** | -| boxedAccountUnsizedInit4 | 18,658 | 🟢 **-1,480 (7.35%)** | -| boxedAccountUnsized4 | 2,135 | 🟢 **-633 (22.87%)** | -| boxedAccountUnsizedInit8 | 36,525 | 🟢 **-2,275 (5.86%)** | -| boxedAccountUnsized8 | 3,948 | 🟢 **-1,399 (26.16%)** | -| boxedInterfaceAccountMint1 | 2,085 | 🟢 **-211 (9.19%)** | -| boxedInterfaceAccountMint2 | 3,726 | 🟢 **-403 (9.76%)** | -| boxedInterfaceAccountMint4 | 6,991 | 🟢 **-792 (10.18%)** | -| boxedInterfaceAccountMint8 | 13,562 | 🟢 **-1,719 (11.25%)** | -| boxedInterfaceAccountToken1 | 2,015 | 🟢 **-8 (0.40%)** | -| boxedInterfaceAccountToken2 | 3,585 | 🔴 **+3 (0.08%)** | -| boxedInterfaceAccountToken4 | 6,712 | 🔴 **+20 (0.30%)** | -| boxedInterfaceAccountToken8 | 13,003 | 🟢 **-95 (0.73%)** | -| interfaceAccountMint1 | 2,174 | 🟢 **-190 (8.04%)** | -| interfaceAccountMint2 | 4,057 | 🟢 **-973 (19.34%)** | -| interfaceAccountMint4 | 7,823 | 🟢 **-1,980 (20.20%)** | -| interfaceAccountMint8 | 15,357 | 🟢 **-3,043 (16.54%)** | -| interfaceAccountToken1 | 2,101 | 🔴 **+10 (0.48%)** | -| interfaceAccountToken2 | 3,909 | 🟢 **-39 (0.99%)** | -| interfaceAccountToken4 | 7,522 | 🟢 **-25 (0.33%)** | -| interface1 | 630 | 🟢 **-429 (40.51%)** | -| interface2 | 813 | 🟢 **-666 (45.03%)** | -| interface4 | 1,174 | 🟢 **-726 (38.21%)** | -| interface8 | 1,905 | 🟢 **-1,741 (47.75%)** | -| program1 | 630 | 🟢 **-423 (40.17%)** | -| program2 | 813 | 🟢 **-654 (44.58%)** | -| program4 | 1,176 | 🟢 **-702 (37.38%)** | -| program8 | 1,905 | 🟢 **-1,693 (47.05%)** | -| signer1 | 564 | 🟢 **-454 (44.60%)** | -| signer2 | 776 | 🟢 **-708 (47.71%)** | -| signer4 | 1,195 | 🟢 **-789 (39.77%)** | -| signer8 | 2,035 | 🟢 **-1,845 (47.55%)** | -| systemAccount1 | 618 | 🟢 **-454 (42.35%)** | -| systemAccount2 | 882 | 🟢 **-708 (44.53%)** | -| systemAccount4 | 1,406 | 🟢 **-789 (35.95%)** | -| systemAccount8 | 2,460 | 🟢 **-1,845 (42.86%)** | -| uncheckedAccount1 | 546 | 🟢 **-468 (46.15%)** | -| uncheckedAccount2 | 738 | 🟢 **-737 (49.97%)** | -| uncheckedAccount4 | 1,115 | 🟢 **-850 (43.26%)** | -| uncheckedAccount8 | 1,877 | 🟢 **-1,964 (51.13%)** | +| accountInfo1 | 695 | 🟢 **-431 (38.28%)** | +| accountInfo2 | 1,035 | 🟢 **-651 (38.61%)** | +| accountInfo4 | 1,730 | 🟢 **-645 (27.16%)** | +| accountInfo8 | 3,342 | 🟢 **-1,310 (28.16%)** | +| accountEmptyInit1 | 5,552 | 🟢 **-919 (14.20%)** | +| accountEmpty1 | 819 | 🟢 **-441 (35.00%)** | +| accountEmptyInit2 | 10,421 | 🟢 **-1,079 (9.38%)** | +| accountEmpty2 | 1,275 | 🟢 **-690 (35.11%)** | +| accountEmptyInit4 | 19,803 | 🟢 **-1,691 (7.87%)** | +| accountEmpty4 | 2,177 | 🟢 **-774 (26.23%)** | +| accountEmptyInit8 | 38,609 | 🟢 **-2,418 (5.89%)** | +| accountEmpty8 | 3,990 | 🟢 **-1,837 (31.53%)** | +| accountSizedInit1 | 5,647 | 🟢 **-937 (14.23%)** | +| accountSized1 | 843 | 🟢 **-482 (36.38%)** | +| accountSizedInit2 | 10,607 | 🟢 **-1,183 (10.03%)** | +| accountSized2 | 1,317 | 🟢 **-767 (36.80%)** | +| accountSizedInit4 | 20,225 | 🟢 **-1,755 (7.98%)** | +| accountSized4 | 2,274 | 🟢 **-899 (28.33%)** | +| accountSizedInit8 | 39,376 | 🟢 **-2,556 (6.10%)** | +| accountSized8 | 4,185 | 🟢 **-1,979 (32.11%)** | +| accountUnsizedInit1 | 5,740 | 🟢 **-978 (14.56%)** | +| accountUnsized1 | 870 | 🟢 **-579 (39.96%)** | +| accountUnsizedInit2 | 10,856 | 🟢 **-1,195 (9.92%)** | +| accountUnsized2 | 1,379 | 🟢 **-610 (30.67%)** | +| accountUnsizedInit4 | 20,652 | 🟢 **-1,721 (7.69%)** | +| accountUnsized4 | 2,411 | 🟢 **-1,136 (32.03%)** | +| accountUnsizedInit8 | 39,969 | 🟢 **-2,985 (6.95%)** | +| accountUnsized8 | 4,478 | 🟢 **-2,285 (33.79%)** | +| boxedAccountEmptyInit1 | 5,605 | 🟢 **-1,083 (16.19%)** | +| boxedAccountEmpty1 | 856 | 🟢 **-143 (14.31%)** | +| boxedAccountEmptyInit2 | 10,522 | 🟢 **-1,209 (10.31%)** | +| boxedAccountEmpty2 | 1,347 | 🟢 **-265 (16.44%)** | +| boxedAccountEmptyInit4 | 20,002 | 🟢 **-1,295 (6.08%)** | +| boxedAccountEmpty4 | 2,324 | 🟢 **-511 (18.02%)** | +| boxedAccountEmptyInit8 | 39,002 | 🟢 **-1,896 (4.64%)** | +| boxedAccountEmpty8 | 4,311 | 🟢 **-1,159 (21.19%)** | +| boxedAccountSizedInit1 | 5,686 | 🟢 **-1,104 (16.26%)** | +| boxedAccountSized1 | 878 | 🟢 **-150 (14.59%)** | +| boxedAccountSizedInit2 | 10,690 | 🟢 **-1,248 (10.45%)** | +| boxedAccountSized2 | 1,394 | 🟢 **-280 (16.73%)** | +| boxedAccountSizedInit4 | 20,338 | 🟢 **-1,375 (6.33%)** | +| boxedAccountSized4 | 2,413 | 🟢 **-541 (18.31%)** | +| boxedAccountSizedInit8 | 39,670 | 🟢 **-2,059 (4.93%)** | +| boxedAccountSized8 | 4,493 | 🟢 **-1,216 (21.30%)** | +| boxedAccountUnsizedInit1 | 5,774 | 🟢 **-1,132 (16.39%)** | +| boxedAccountUnsized1 | 908 | 🟢 **-175 (16.16%)** | +| boxedAccountUnsizedInit2 | 10,866 | 🟢 **-1,304 (10.71%)** | +| boxedAccountUnsized2 | 1,457 | 🟢 **-324 (18.19%)** | +| boxedAccountUnsizedInit4 | 20,688 | 🟢 **-1,484 (6.69%)** | +| boxedAccountUnsized4 | 2,546 | 🟢 **-633 (19.91%)** | +| boxedAccountUnsizedInit8 | 40,375 | 🟢 **-2,274 (5.33%)** | +| boxedAccountUnsized8 | 4,759 | 🟢 **-1,399 (22.72%)** | +| boxedInterfaceAccountMint1 | 2,196 | 🟢 **-211 (8.77%)** | +| boxedInterfaceAccountMint2 | 3,847 | 🟢 **-403 (9.48%)** | +| boxedInterfaceAccountMint4 | 7,132 | 🟢 **-792 (9.99%)** | +| boxedInterfaceAccountMint8 | 13,743 | 🟢 **-1,719 (11.12%)** | +| boxedInterfaceAccountToken1 | 2,126 | 🟢 **-8 (0.37%)** | +| boxedInterfaceAccountToken2 | 3,706 | 🔴 **+3 (0.08%)** | +| boxedInterfaceAccountToken4 | 6,853 | 🔴 **+20 (0.29%)** | +| boxedInterfaceAccountToken8 | 13,184 | 🟢 **-95 (0.72%)** | +| interfaceAccountMint1 | 2,285 | 🟢 **-190 (7.68%)** | +| interfaceAccountMint2 | 4,178 | 🟢 **-973 (18.89%)** | +| interfaceAccountMint4 | 7,964 | 🟢 **-1,980 (19.91%)** | +| interfaceAccountMint8 | 15,538 | 🟢 **-3,043 (16.38%)** | +| interfaceAccountToken1 | 2,212 | 🔴 **+10 (0.45%)** | +| interfaceAccountToken2 | 4,030 | 🟢 **-39 (0.96%)** | +| interfaceAccountToken4 | 7,663 | 🟢 **-25 (0.33%)** | +| interface1 | 741 | 🟢 **-429 (36.67%)** | +| interface2 | 934 | 🟢 **-666 (41.63%)** | +| interface4 | 1,315 | 🟢 **-726 (35.57%)** | +| interface8 | 2,086 | 🟢 **-1,741 (45.49%)** | +| program1 | 741 | 🟢 **-423 (36.34%)** | +| program2 | 934 | 🟢 **-654 (41.18%)** | +| program4 | 1,317 | 🟢 **-702 (34.77%)** | +| program8 | 2,086 | 🟢 **-1,693 (44.80%)** | +| signer1 | 675 | 🟢 **-454 (40.21%)** | +| signer2 | 987 | 🟢 **-708 (41.77%)** | +| signer4 | 1,606 | 🟢 **-789 (32.94%)** | +| signer8 | 2,846 | 🟢 **-1,845 (39.33%)** | +| systemAccount1 | 729 | 🟢 **-454 (38.38%)** | +| systemAccount2 | 1,093 | 🟢 **-708 (39.31%)** | +| systemAccount4 | 1,817 | 🟢 **-789 (30.28%)** | +| systemAccount8 | 3,271 | 🟢 **-1,845 (36.06%)** | +| uncheckedAccount1 | 657 | 🟢 **-468 (41.60%)** | +| uncheckedAccount2 | 949 | 🟢 **-737 (43.71%)** | +| uncheckedAccount4 | 1,526 | 🟢 **-850 (35.77%)** | +| uncheckedAccount8 | 2,688 | 🟢 **-1,964 (42.22%)** | ### Notable changes @@ -218,93 +218,93 @@ Solana version: 1.16.0 | Instruction | Compute Units | +/- | | --------------------------- | ------------- | ---------------------- | -| accountInfo1 | 1,015 | 🔴 **+61 (6.39%)** | -| accountInfo2 | 1,475 | 🟢 **-92 (5.87%)** | -| accountInfo4 | 1,964 | 🟢 **-95 (4.61%)** | -| accountInfo8 | 3,841 | 🟢 **-15 (0.39%)** | -| accountEmptyInit1 | 5,817 | 🟢 **-141 (2.37%)** | -| accountEmpty1 | 1,149 | 🔴 **+59 (5.41%)** | -| accountEmptyInit2 | 10,402 | 🟢 **-172 (1.63%)** | -| accountEmpty2 | 1,754 | 🟢 **-98 (5.29%)** | -| accountEmptyInit4 | 19,508 | 🟢 **-49 (0.25%)** | -| accountEmpty4 | 2,540 | 🟢 **-106 (4.01%)** | -| accountEmptyInit8 | 37,265 | 🟢 **-276 (0.74%)** | -| accountEmpty8 | 5,016 | 🟢 **-27 (0.54%)** | -| accountSizedInit1 | 5,924 | 🟢 **-139 (2.29%)** | -| accountSized1 | 1,214 | 🔴 **+79 (6.96%)** | -| accountSizedInit2 | 10,680 | 🟢 **-103 (0.96%)** | -| accountSized2 | 1,873 | 🟢 **-93 (4.73%)** | -| accountSizedInit4 | 19,970 | 🟢 **-5 (0.03%)** | -| accountSized4 | 2,762 | 🟢 **-25 (0.90%)** | -| accountSizedInit8 | 38,122 | 🟢 **-259 (0.67%)** | -| accountSized8 | 5,353 | 🟢 **-6 (0.11%)** | -| accountUnsizedInit1 | 6,052 | 🟢 **-141 (2.28%)** | -| accountUnsized1 | 1,338 | 🔴 **+95 (7.64%)** | -| accountUnsizedInit2 | 10,929 | 🟢 **-113 (1.02%)** | -| accountUnsized2 | 1,778 | 🟢 **-115 (6.08%)** | -| accountUnsizedInit4 | 20,339 | 🟢 **-156 (0.76%)** | -| accountUnsized4 | 3,136 | 🔴 **+32 (1.03%)** | -| accountUnsizedInit8 | 39,096 | 🟢 **-323 (0.82%)** | -| accountUnsized8 | 5,952 | 🟢 **-99 (1.64%)** | -| boxedAccountEmptyInit1 | 6,034 | 🟢 **-126 (2.05%)** | -| boxedAccountEmpty1 | 888 | 🟢 **-88 (9.02%)** | -| boxedAccountEmptyInit2 | 10,633 | 🟢 **-151 (1.40%)** | -| boxedAccountEmpty2 | 1,401 | 🟢 **-98 (6.54%)** | -| boxedAccountEmptyInit4 | 19,311 | 🟢 **-189 (0.97%)** | -| boxedAccountEmpty4 | 2,424 | 🟢 **-106 (4.19%)** | -| boxedAccountEmptyInit8 | 37,136 | 🟢 **-279 (0.75%)** | -| boxedAccountEmpty8 | 4,659 | 🟢 **-121 (2.53%)** | -| boxedAccountSizedInit1 | 6,130 | 🟢 **-126 (2.01%)** | -| boxedAccountSized1 | 917 | 🟢 **-86 (8.57%)** | -| boxedAccountSizedInit2 | 10,828 | 🟢 **-147 (1.34%)** | -| boxedAccountSized2 | 1,463 | 🟢 **-91 (5.86%)** | -| boxedAccountSizedInit4 | 19,703 | 🟢 **-181 (0.91%)** | -| boxedAccountSized4 | 2,543 | 🟢 **-99 (3.75%)** | -| boxedAccountSizedInit8 | 37,919 | 🟢 **-263 (0.69%)** | -| boxedAccountSized8 | 4,898 | 🟢 **-105 (2.10%)** | -| boxedAccountUnsizedInit1 | 6,240 | 🟢 **-134 (2.10%)** | -| boxedAccountUnsized1 | 972 | 🟢 **-97 (9.07%)** | -| boxedAccountUnsizedInit2 | 11,048 | 🟢 **-163 (1.45%)** | -| boxedAccountUnsized2 | 1,570 | 🟢 **-109 (6.49%)** | -| boxedAccountUnsizedInit4 | 20,138 | 🟢 **-213 (1.05%)** | -| boxedAccountUnsized4 | 2,768 | 🟢 **-131 (4.52%)** | -| boxedAccountUnsizedInit8 | 38,800 | 🟢 **-318 (0.81%)** | -| boxedAccountUnsized8 | 5,347 | 🟢 **-170 (3.08%)** | -| boxedInterfaceAccountMint1 | 2,296 | 🟢 **-3 (0.13%)** | -| boxedInterfaceAccountMint2 | 4,129 | 🔴 **+76 (1.88%)** | -| boxedInterfaceAccountMint4 | 7,783 | 🔴 **+245 (3.25%)** | -| boxedInterfaceAccountMint8 | 15,281 | 🔴 **+582 (3.96%)** | -| boxedInterfaceAccountToken1 | 2,023 | 🔴 **+286 (16.47%)** | -| boxedInterfaceAccountToken2 | 3,582 | 🔴 **+654 (22.34%)** | -| boxedInterfaceAccountToken4 | 6,692 | 🔴 **+1,401 (26.48%)** | -| boxedInterfaceAccountToken8 | 13,098 | 🔴 **+2,893 (28.35%)** | -| interfaceAccountMint1 | 2,364 | 🟢 **-166 (6.56%)** | -| interfaceAccountMint2 | 5,030 | 🔴 **+304 (6.43%)** | -| interfaceAccountMint4 | 9,803 | 🔴 **+372 (3.94%)** | -| interfaceAccountMint8 | 18,400 | 🔴 **+691 (3.90%)** | -| interfaceAccountToken1 | 2,091 | 🔴 **+336 (19.15%)** | -| interfaceAccountToken2 | 3,948 | 🔴 **+737 (22.95%)** | -| interfaceAccountToken4 | 7,547 | 🔴 **+1,541 (25.66%)** | -| interface1 | 1,059 | 🔴 **+60 (6.01%)** | -| interface2 | 1,479 | 🟢 **-95 (6.04%)** | -| interface4 | 1,900 | 🟢 **-96 (4.81%)** | -| interface8 | 3,646 | 🟢 **-5 (0.14%)** | -| program1 | 1,053 | 🔴 **+54 (5.41%)** | -| program2 | 1,467 | 🟢 **-106 (6.74%)** | -| program4 | 1,878 | 🟢 **-120 (6.01%)** | -| program8 | 3,598 | 🟢 **-53 (1.45%)** | -| signer1 | 1,018 | 🔴 **+60 (6.26%)** | -| signer2 | 1,484 | 🟢 **-92 (5.84%)** | -| signer4 | 1,984 | 🟢 **-95 (4.57%)** | -| signer8 | 3,880 | 🟢 **-15 (0.39%)** | -| systemAccount1 | 1,072 | 🔴 **+59 (5.82%)** | -| systemAccount2 | 1,590 | 🟢 **-96 (5.69%)** | -| systemAccount4 | 2,195 | 🟢 **-103 (4.48%)** | -| systemAccount8 | 4,305 | 🟢 **-31 (0.71%)** | -| uncheckedAccount1 | 1,014 | 🔴 **+61 (6.40%)** | -| uncheckedAccount2 | 1,475 | 🟢 **-92 (5.87%)** | -| uncheckedAccount4 | 1,965 | 🟢 **-95 (4.61%)** | -| uncheckedAccount8 | 3,841 | 🟢 **-14 (0.36%)** | +| accountInfo1 | 1,126 | 🔴 **+63 (5.93%)** | +| accountInfo2 | 1,686 | 🟢 **-88 (4.96%)** | +| accountInfo4 | 2,375 | 🟢 **-87 (3.53%)** | +| accountInfo8 | 4,652 | 🔴 **+1 (0.02%)** | +| accountEmptyInit1 | 6,471 | 🟢 **-177 (2.66%)** | +| accountEmpty1 | 1,260 | 🔴 **+61 (5.09%)** | +| accountEmptyInit2 | 11,500 | 🟢 **-247 (2.10%)** | +| accountEmpty2 | 1,965 | 🟢 **-94 (4.57%)** | +| accountEmptyInit4 | 21,494 | 🟢 **-202 (0.93%)** | +| accountEmpty4 | 2,951 | 🟢 **-98 (3.21%)** | +| accountEmptyInit8 | 41,027 | 🟢 **-585 (1.41%)** | +| accountEmpty8 | 5,827 | 🟢 **-11 (0.19%)** | +| accountSizedInit1 | 6,584 | 🟢 **-175 (2.59%)** | +| accountSized1 | 1,325 | 🔴 **+81 (6.51%)** | +| accountSizedInit2 | 11,790 | 🟢 **-178 (1.49%)** | +| accountSized2 | 2,084 | 🟢 **-89 (4.10%)** | +| accountSizedInit4 | 21,980 | 🟢 **-158 (0.71%)** | +| accountSized4 | 3,173 | 🟢 **-17 (0.53%)** | +| accountSizedInit8 | 41,932 | 🟢 **-568 (1.34%)** | +| accountSized8 | 6,164 | 🔴 **+10 (0.16%)** | +| accountUnsizedInit1 | 6,718 | 🟢 **-177 (2.57%)** | +| accountUnsized1 | 1,449 | 🔴 **+97 (7.17%)** | +| accountUnsizedInit2 | 12,051 | 🟢 **-188 (1.54%)** | +| accountUnsized2 | 1,989 | 🟢 **-111 (5.29%)** | +| accountUnsizedInit4 | 22,373 | 🟢 **-309 (1.36%)** | +| accountUnsized4 | 3,547 | 🔴 **+40 (1.14%)** | +| accountUnsizedInit8 | 42,954 | 🟢 **-632 (1.45%)** | +| accountUnsized8 | 6,763 | 🟢 **-83 (1.21%)** | +| boxedAccountEmptyInit1 | 6,688 | 🟢 **-162 (2.36%)** | +| boxedAccountEmpty1 | 999 | 🟢 **-86 (7.93%)** | +| boxedAccountEmptyInit2 | 11,731 | 🟢 **-226 (1.89%)** | +| boxedAccountEmpty2 | 1,612 | 🟢 **-94 (5.51%)** | +| boxedAccountEmptyInit4 | 21,297 | 🟢 **-342 (1.58%)** | +| boxedAccountEmpty4 | 2,835 | 🟢 **-98 (3.34%)** | +| boxedAccountEmptyInit8 | 40,898 | 🟢 **-588 (1.42%)** | +| boxedAccountEmpty8 | 5,470 | 🟢 **-105 (1.88%)** | +| boxedAccountSizedInit1 | 6,790 | 🟢 **-162 (2.33%)** | +| boxedAccountSized1 | 1,028 | 🟢 **-84 (7.55%)** | +| boxedAccountSizedInit2 | 11,938 | 🟢 **-222 (1.83%)** | +| boxedAccountSized2 | 1,674 | 🟢 **-87 (4.94%)** | +| boxedAccountSizedInit4 | 21,713 | 🟢 **-334 (1.51%)** | +| boxedAccountSized4 | 2,954 | 🟢 **-91 (2.99%)** | +| boxedAccountSizedInit8 | 41,729 | 🟢 **-572 (1.35%)** | +| boxedAccountSized8 | 5,709 | 🟢 **-89 (1.54%)** | +| boxedAccountUnsizedInit1 | 6,906 | 🟢 **-170 (2.40%)** | +| boxedAccountUnsized1 | 1,083 | 🟢 **-95 (8.06%)** | +| boxedAccountUnsizedInit2 | 12,170 | 🟢 **-238 (1.92%)** | +| boxedAccountUnsized2 | 1,781 | 🟢 **-105 (5.57%)** | +| boxedAccountUnsizedInit4 | 22,172 | 🟢 **-366 (1.62%)** | +| boxedAccountUnsized4 | 3,179 | 🟢 **-123 (3.73%)** | +| boxedAccountUnsizedInit8 | 42,649 | 🟢 **-636 (1.47%)** | +| boxedAccountUnsized8 | 6,158 | 🟢 **-154 (2.44%)** | +| boxedInterfaceAccountMint1 | 2,407 | 🟢 **-1 (0.04%)** | +| boxedInterfaceAccountMint2 | 4,250 | 🔴 **+74 (1.77%)** | +| boxedInterfaceAccountMint4 | 7,924 | 🔴 **+235 (3.06%)** | +| boxedInterfaceAccountMint8 | 15,462 | 🔴 **+556 (3.73%)** | +| boxedInterfaceAccountToken1 | 2,134 | 🔴 **+288 (15.60%)** | +| boxedInterfaceAccountToken2 | 3,703 | 🔴 **+652 (21.37%)** | +| boxedInterfaceAccountToken4 | 6,833 | 🔴 **+1,391 (25.56%)** | +| boxedInterfaceAccountToken8 | 13,279 | 🔴 **+2,867 (27.54%)** | +| interfaceAccountMint1 | 2,475 | 🟢 **-164 (6.21%)** | +| interfaceAccountMint2 | 5,151 | 🔴 **+302 (6.23%)** | +| interfaceAccountMint4 | 9,944 | 🔴 **+362 (3.78%)** | +| interfaceAccountMint8 | 18,581 | 🔴 **+665 (3.71%)** | +| interfaceAccountToken1 | 2,202 | 🔴 **+338 (18.13%)** | +| interfaceAccountToken2 | 4,069 | 🔴 **+735 (22.05%)** | +| interfaceAccountToken4 | 7,688 | 🔴 **+1,531 (24.87%)** | +| interface1 | 1,170 | 🔴 **+62 (5.60%)** | +| interface2 | 1,600 | 🟢 **-97 (5.72%)** | +| interface4 | 2,041 | 🟢 **-106 (4.94%)** | +| interface8 | 3,827 | 🟢 **-31 (0.80%)** | +| program1 | 1,164 | 🔴 **+56 (5.05%)** | +| program2 | 1,588 | 🟢 **-108 (6.37%)** | +| program4 | 2,019 | 🟢 **-130 (6.05%)** | +| program8 | 3,779 | 🟢 **-79 (2.05%)** | +| signer1 | 1,129 | 🔴 **+62 (5.81%)** | +| signer2 | 1,695 | 🟢 **-88 (4.94%)** | +| signer4 | 2,395 | 🟢 **-87 (3.51%)** | +| signer8 | 4,691 | 🔴 **+1 (0.02%)** | +| systemAccount1 | 1,183 | 🔴 **+61 (5.44%)** | +| systemAccount2 | 1,801 | 🟢 **-92 (4.86%)** | +| systemAccount4 | 2,606 | 🟢 **-95 (3.52%)** | +| systemAccount8 | 5,116 | 🟢 **-15 (0.29%)** | +| uncheckedAccount1 | 1,125 | 🔴 **+63 (5.93%)** | +| uncheckedAccount2 | 1,686 | 🟢 **-88 (4.96%)** | +| uncheckedAccount4 | 2,376 | 🟢 **-87 (3.53%)** | +| uncheckedAccount8 | 4,652 | 🔴 **+2 (0.04%)** | ### Notable changes @@ -318,92 +318,92 @@ Solana version: 1.14.16 | Instruction | Compute Units | +/- | | --------------------------- | ------------- | --- | -| accountInfo1 | 954 | N/A | -| accountInfo2 | 1,567 | N/A | -| accountInfo4 | 2,059 | N/A | -| accountInfo8 | 3,856 | N/A | -| accountEmptyInit1 | 5,958 | N/A | -| accountEmpty1 | 1,090 | N/A | -| accountEmptyInit2 | 10,574 | N/A | -| accountEmpty2 | 1,852 | N/A | -| accountEmptyInit4 | 19,557 | N/A | -| accountEmpty4 | 2,646 | N/A | -| accountEmptyInit8 | 37,541 | N/A | -| accountEmpty8 | 5,043 | N/A | -| accountSizedInit1 | 6,063 | N/A | -| accountSized1 | 1,135 | N/A | -| accountSizedInit2 | 10,783 | N/A | -| accountSized2 | 1,966 | N/A | -| accountSizedInit4 | 19,975 | N/A | -| accountSized4 | 2,787 | N/A | -| accountSizedInit8 | 38,381 | N/A | -| accountSized8 | 5,359 | N/A | -| accountUnsizedInit1 | 6,193 | N/A | -| accountUnsized1 | 1,243 | N/A | -| accountUnsizedInit2 | 11,042 | N/A | -| accountUnsized2 | 1,893 | N/A | -| accountUnsizedInit4 | 20,495 | N/A | -| accountUnsized4 | 3,104 | N/A | -| accountUnsizedInit8 | 39,419 | N/A | -| accountUnsized8 | 6,051 | N/A | -| boxedAccountEmptyInit1 | 6,160 | N/A | -| boxedAccountEmpty1 | 976 | N/A | -| boxedAccountEmptyInit2 | 10,784 | N/A | -| boxedAccountEmpty2 | 1,499 | N/A | -| boxedAccountEmptyInit4 | 19,500 | N/A | -| boxedAccountEmpty4 | 2,530 | N/A | -| boxedAccountEmptyInit8 | 37,415 | N/A | -| boxedAccountEmpty8 | 4,780 | N/A | -| boxedAccountSizedInit1 | 6,256 | N/A | -| boxedAccountSized1 | 1,003 | N/A | -| boxedAccountSizedInit2 | 10,975 | N/A | -| boxedAccountSized2 | 1,554 | N/A | -| boxedAccountSizedInit4 | 19,884 | N/A | -| boxedAccountSized4 | 2,642 | N/A | -| boxedAccountSizedInit8 | 38,182 | N/A | -| boxedAccountSized8 | 5,003 | N/A | -| boxedAccountUnsizedInit1 | 6,374 | N/A | -| boxedAccountUnsized1 | 1,069 | N/A | -| boxedAccountUnsizedInit2 | 11,211 | N/A | -| boxedAccountUnsized2 | 1,679 | N/A | -| boxedAccountUnsizedInit4 | 20,351 | N/A | -| boxedAccountUnsized4 | 2,899 | N/A | -| boxedAccountUnsizedInit8 | 39,118 | N/A | -| boxedAccountUnsized8 | 5,517 | N/A | -| boxedInterfaceAccountMint1 | 2,299 | N/A | -| boxedInterfaceAccountMint2 | 4,053 | N/A | -| boxedInterfaceAccountMint4 | 7,538 | N/A | -| boxedInterfaceAccountMint8 | 14,699 | N/A | -| boxedInterfaceAccountToken1 | 1,737 | N/A | -| boxedInterfaceAccountToken2 | 2,928 | N/A | -| boxedInterfaceAccountToken4 | 5,291 | N/A | -| boxedInterfaceAccountToken8 | 10,205 | N/A | -| interfaceAccountMint1 | 2,530 | N/A | -| interfaceAccountMint2 | 4,726 | N/A | -| interfaceAccountMint4 | 9,431 | N/A | -| interfaceAccountMint8 | 17,709 | N/A | -| interfaceAccountToken1 | 1,755 | N/A | -| interfaceAccountToken2 | 3,211 | N/A | -| interfaceAccountToken4 | 6,006 | N/A | -| interface1 | 999 | N/A | -| interface2 | 1,574 | N/A | -| interface4 | 1,996 | N/A | -| interface8 | 3,651 | N/A | -| program1 | 999 | N/A | -| program2 | 1,573 | N/A | -| program4 | 1,998 | N/A | -| program8 | 3,651 | N/A | -| signer1 | 958 | N/A | -| signer2 | 1,576 | N/A | -| signer4 | 2,079 | N/A | -| signer8 | 3,895 | N/A | -| systemAccount1 | 1,013 | N/A | -| systemAccount2 | 1,686 | N/A | -| systemAccount4 | 2,298 | N/A | -| systemAccount8 | 4,336 | N/A | -| uncheckedAccount1 | 953 | N/A | -| uncheckedAccount2 | 1,567 | N/A | -| uncheckedAccount4 | 2,060 | N/A | -| uncheckedAccount8 | 3,855 | N/A | +| accountInfo1 | 1,063 | N/A | +| accountInfo2 | 1,774 | N/A | +| accountInfo4 | 2,462 | N/A | +| accountInfo8 | 4,651 | N/A | +| accountEmptyInit1 | 6,648 | N/A | +| accountEmpty1 | 1,199 | N/A | +| accountEmptyInit2 | 11,747 | N/A | +| accountEmpty2 | 2,059 | N/A | +| accountEmptyInit4 | 21,696 | N/A | +| accountEmpty4 | 3,049 | N/A | +| accountEmptyInit8 | 41,612 | N/A | +| accountEmpty8 | 5,838 | N/A | +| accountSizedInit1 | 6,759 | N/A | +| accountSized1 | 1,244 | N/A | +| accountSizedInit2 | 11,968 | N/A | +| accountSized2 | 2,173 | N/A | +| accountSizedInit4 | 22,138 | N/A | +| accountSized4 | 3,190 | N/A | +| accountSizedInit8 | 42,500 | N/A | +| accountSized8 | 6,154 | N/A | +| accountUnsizedInit1 | 6,895 | N/A | +| accountUnsized1 | 1,352 | N/A | +| accountUnsizedInit2 | 12,239 | N/A | +| accountUnsized2 | 2,100 | N/A | +| accountUnsizedInit4 | 22,682 | N/A | +| accountUnsized4 | 3,507 | N/A | +| accountUnsizedInit8 | 43,586 | N/A | +| accountUnsized8 | 6,846 | N/A | +| boxedAccountEmptyInit1 | 6,850 | N/A | +| boxedAccountEmpty1 | 1,085 | N/A | +| boxedAccountEmptyInit2 | 11,957 | N/A | +| boxedAccountEmpty2 | 1,706 | N/A | +| boxedAccountEmptyInit4 | 21,639 | N/A | +| boxedAccountEmpty4 | 2,933 | N/A | +| boxedAccountEmptyInit8 | 41,486 | N/A | +| boxedAccountEmpty8 | 5,575 | N/A | +| boxedAccountSizedInit1 | 6,952 | N/A | +| boxedAccountSized1 | 1,112 | N/A | +| boxedAccountSizedInit2 | 12,160 | N/A | +| boxedAccountSized2 | 1,761 | N/A | +| boxedAccountSizedInit4 | 22,047 | N/A | +| boxedAccountSized4 | 3,045 | N/A | +| boxedAccountSizedInit8 | 42,301 | N/A | +| boxedAccountSized8 | 5,798 | N/A | +| boxedAccountUnsizedInit1 | 7,076 | N/A | +| boxedAccountUnsized1 | 1,178 | N/A | +| boxedAccountUnsizedInit2 | 12,408 | N/A | +| boxedAccountUnsized2 | 1,886 | N/A | +| boxedAccountUnsizedInit4 | 22,538 | N/A | +| boxedAccountUnsized4 | 3,302 | N/A | +| boxedAccountUnsizedInit8 | 43,285 | N/A | +| boxedAccountUnsized8 | 6,312 | N/A | +| boxedInterfaceAccountMint1 | 2,408 | N/A | +| boxedInterfaceAccountMint2 | 4,176 | N/A | +| boxedInterfaceAccountMint4 | 7,689 | N/A | +| boxedInterfaceAccountMint8 | 14,906 | N/A | +| boxedInterfaceAccountToken1 | 1,846 | N/A | +| boxedInterfaceAccountToken2 | 3,051 | N/A | +| boxedInterfaceAccountToken4 | 5,442 | N/A | +| boxedInterfaceAccountToken8 | 10,412 | N/A | +| interfaceAccountMint1 | 2,639 | N/A | +| interfaceAccountMint2 | 4,849 | N/A | +| interfaceAccountMint4 | 9,582 | N/A | +| interfaceAccountMint8 | 17,916 | N/A | +| interfaceAccountToken1 | 1,864 | N/A | +| interfaceAccountToken2 | 3,334 | N/A | +| interfaceAccountToken4 | 6,157 | N/A | +| interface1 | 1,108 | N/A | +| interface2 | 1,697 | N/A | +| interface4 | 2,147 | N/A | +| interface8 | 3,858 | N/A | +| program1 | 1,108 | N/A | +| program2 | 1,696 | N/A | +| program4 | 2,149 | N/A | +| program8 | 3,858 | N/A | +| signer1 | 1,067 | N/A | +| signer2 | 1,783 | N/A | +| signer4 | 2,482 | N/A | +| signer8 | 4,690 | N/A | +| systemAccount1 | 1,122 | N/A | +| systemAccount2 | 1,893 | N/A | +| systemAccount4 | 2,701 | N/A | +| systemAccount8 | 5,131 | N/A | +| uncheckedAccount1 | 1,062 | N/A | +| uncheckedAccount2 | 1,774 | N/A | +| uncheckedAccount4 | 2,463 | N/A | +| uncheckedAccount8 | 4,650 | N/A | --- diff --git a/cli/src/checks.rs b/cli/src/checks.rs new file mode 100644 index 0000000000..feda97f71e --- /dev/null +++ b/cli/src/checks.rs @@ -0,0 +1,22 @@ +use std::path::Path; + +use anyhow::{anyhow, Result}; + +use crate::config::Manifest; + +/// Check whether `overflow-checks` codegen option is enabled. +/// +/// https://doc.rust-lang.org/rustc/codegen-options/index.html#overflow-checks +pub fn check_overflow(cargo_toml_path: impl AsRef) -> Result { + Manifest::from_path(cargo_toml_path)? + .profile + .release + .as_ref() + .and_then(|profile| profile.overflow_checks) + .ok_or(anyhow!( + "`overflow-checks` is not enabled. To enable, add:\n\n\ + [profile.release]\n\ + overflow-checks = true\n\n\ + in workspace root Cargo.toml.", + )) +} diff --git a/cli/src/config.rs b/cli/src/config.rs index 375b22d973..4bed3a9ee6 100644 --- a/cli/src/config.rs +++ b/cli/src/config.rs @@ -125,12 +125,11 @@ impl Manifest { format!("Error reading the directory with path: {}", cwd.display()) })? .path(); - if let Some(filename) = p.file_name() { - if filename.to_str() == Some("Cargo.toml") { - let m = WithPath::new(Manifest::from_path(&p)?, p); - return Ok(Some(m)); + if let Some(filename) = p.file_name().and_then(|name| name.to_str()) { + if filename == "Cargo.toml" { + return Ok(Some(WithPath::new(Manifest::from_path(&p)?, p))); } - if filename.to_str() == Some("Anchor.toml") { + if filename == "Anchor.toml" { anchor_toml = true; } } @@ -1257,10 +1256,16 @@ impl Program { Ok(WithPath::new(file, path)) } - pub fn binary_path(&self) -> PathBuf { + pub fn binary_path(&self, verifiable: bool) -> PathBuf { + let path = if verifiable { + format!("target/verifiable/{}.so", self.lib_name) + } else { + format!("target/deploy/{}.so", self.lib_name) + }; + std::env::current_dir() .expect("Must have current dir") - .join(format!("target/deploy/{}.so", self.lib_name)) + .join(path) } } diff --git a/cli/src/lib.rs b/cli/src/lib.rs index e90af058f0..f901b85081 100644 --- a/cli/src/lib.rs +++ b/cli/src/lib.rs @@ -11,6 +11,7 @@ use anchor_syn::idl::types::{ IdlTypeDefinitionTy, }; use anyhow::{anyhow, Context, Result}; +use checks::check_overflow; use clap::Parser; use dirs::home_dir; use flate2::read::GzDecoder; @@ -44,11 +45,12 @@ use std::ffi::OsString; use std::fs::{self, File}; use std::io::prelude::*; use std::path::{Path, PathBuf}; -use std::process::{Child, ExitStatus, Stdio}; +use std::process::{Child, Stdio}; use std::str::FromStr; use std::string::ToString; use tar::Archive; +mod checks; pub mod config; pub mod rust_template; pub mod solidity_template; @@ -246,6 +248,12 @@ pub enum Command { /// Keypair of the program (filepath) (requires program-name) #[clap(long, requires = "program_name")] program_keypair: Option, + /// If true, deploy from path target/verifiable + #[clap(short, long)] + verifiable: bool, + /// Arguments to pass to the underlying `solana program deploy` command. + #[clap(required = false, last = true)] + solana_args: Vec, }, /// Runs the deploy migration script. Migrate, @@ -488,7 +496,7 @@ fn override_toolchain(cfg_override: &ConfigOverride) -> Result Result { - let output: std::process::Output = std::process::Command::new(cmd_name) + let output = std::process::Command::new(cmd_name) .arg("--version") .output()?; let output_version = std::str::from_utf8(&output.stdout)?; @@ -511,7 +519,7 @@ fn override_toolchain(cfg_override: &ConfigOverride) -> Result std::io::Result { + fn override_solana_version(version: String) -> std::io::Result { std::process::Command::new("solana-install") .arg("init") .arg(&version) @@ -519,16 +527,17 @@ fn override_toolchain(cfg_override: &ConfigOverride) -> Result restore_cbs.push(Box::new(|| { - match override_solana_version(current_version)?.success() { + match override_solana_version(solana_version.to_owned())? { + true => restore_cbs.push(Box::new(|| { + match override_solana_version(current_version)? { true => Ok(()), false => Err(anyhow!("Failed to restore `solana` version")), } })), - Err(_) => { + false => { eprintln!( "Failed to override `solana` version to {solana_version}, \ using {current_version} instead" @@ -540,16 +549,31 @@ fn override_toolchain(cfg_override: &ConfigOverride) -> Result()? + .file_name() + .and_then(|name| name.to_str()) + .expect("File name should be valid Unicode") + .split_once(ANCHOR_BINARY_PREFIX) + .map(|(_, version)| version) + .unwrap_or(VERSION) + .to_owned(); + if anchor_version != ¤t_version { let binary_path = home_dir() .unwrap() .join(".avm") .join("bin") - .join(format!("anchor-{anchor_version}")); + .join(format!("{ANCHOR_BINARY_PREFIX}{anchor_version}")); if !binary_path.exists() { - println!( + eprintln!( "`anchor` {anchor_version} is not installed with `avm`. Installing...\n" ); @@ -559,7 +583,7 @@ fn override_toolchain(cfg_override: &ConfigOverride) -> Result Result<()> { Command::Deploy { program_name, program_keypair, - } => deploy(&opts.cfg_override, program_name, program_keypair), + verifiable, + solana_args, + } => deploy( + &opts.cfg_override, + program_name, + program_keypair, + verifiable, + solana_args, + ), Command::Expand { program_name, cargo_args, @@ -1154,15 +1186,13 @@ pub fn build( } let cfg = Config::discover(cfg_override)?.expect("Not in workspace."); - let build_config = BuildConfig { - verifiable, - solana_version: solana_version.or_else(|| cfg.toolchain.solana_version.clone()), - docker_image: docker_image.unwrap_or_else(|| cfg.docker()), - bootstrap, - }; let cfg_parent = cfg.path().parent().expect("Invalid Anchor.toml"); - let cargo = Manifest::discover()?; + // Require overflow checks + let workspace_cargo_toml_path = cfg_parent.join("Cargo.toml"); + if workspace_cargo_toml_path.exists() { + check_overflow(workspace_cargo_toml_path)?; + } let idl_out = match idl { Some(idl) => Some(PathBuf::from(idl)), @@ -1176,10 +1206,17 @@ pub fn build( }; fs::create_dir_all(idl_ts_out.as_ref().unwrap())?; - if !&cfg.workspace.types.is_empty() { + if !cfg.workspace.types.is_empty() { fs::create_dir_all(cfg_parent.join(&cfg.workspace.types))?; }; + let cargo = Manifest::discover()?; + let build_config = BuildConfig { + verifiable, + solana_version: solana_version.or_else(|| cfg.toolchain.solana_version.clone()), + docker_image: docker_image.unwrap_or_else(|| cfg.docker()), + bootstrap, + }; match cargo { // No Cargo.toml so build the entire workspace. None => build_all( @@ -3027,7 +3064,7 @@ fn test( // In either case, skip the deploy if the user specifies. let is_localnet = cfg.provider.cluster == Cluster::Localnet; if (!is_localnet || skip_local_validator) && !skip_deploy { - deploy(cfg_override, None, None)?; + deploy(cfg_override, None, None, false, vec![])?; } let mut is_first_suite = true; if cfg.scripts.get("test").is_some() { @@ -3189,7 +3226,8 @@ fn validator_flags( let mut flags = Vec::new(); for mut program in cfg.read_all_programs()? { - let binary_path = program.binary_path().display().to_string(); + let verifiable = false; + let binary_path = program.binary_path(verifiable).display().to_string(); // Use the [programs.cluster] override and fallback to the keypair // files if no override is given. @@ -3476,7 +3514,7 @@ fn test_validator_rpc_url(test_validator: &Option) -> String { validator: Some(validator), .. }) => format!("http://{}:{}", validator.bind_address, validator.rpc_port), - _ => "http://localhost:8899".to_string(), + _ => "http://127.0.0.1:8899".to_string(), } } @@ -3559,6 +3597,8 @@ fn deploy( cfg_override: &ConfigOverride, program_name: Option, program_keypair: Option, + verifiable: bool, + solana_args: Vec, ) -> Result<()> { // Execute the code within the workspace with_workspace(cfg_override, |cfg| { @@ -3570,7 +3610,7 @@ fn deploy( println!("Upgrade authority: {}", keypair); for mut program in cfg.get_programs(program_name)? { - let binary_path = program.binary_path().display().to_string(); + let binary_path = program.binary_path(verifiable).display().to_string(); println!("Deploying program {:?}...", program.lib_name); println!("Program path: {}...", binary_path); @@ -3599,6 +3639,7 @@ fn deploy( .arg("--program-id") .arg(strip_workspace_prefix(program_keypair_filepath)) .arg(strip_workspace_prefix(binary_path)) + .args(&solana_args) .stdout(Stdio::inherit()) .stderr(Stdio::inherit()) .output() diff --git a/client/src/lib.rs b/client/src/lib.rs index 4a49b2c7b7..1fc4e886f0 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -320,7 +320,7 @@ impl Iterator for ProgramAccountsIterator { } } -fn handle_program_log( +pub fn handle_program_log( self_program_str: &str, l: &str, ) -> Result<(Option, Option, bool), ClientError> { @@ -364,7 +364,7 @@ fn handle_program_log( } } -fn handle_system_log(this_program_str: &str, log: &str) -> (Option, bool) { +pub fn handle_system_log(this_program_str: &str, log: &str) -> (Option, bool) { if log.starts_with(&format!("Program {this_program_str} log:")) { (Some(this_program_str.to_string()), false) } else if log.contains("invoke") { @@ -379,7 +379,7 @@ fn handle_system_log(this_program_str: &str, log: &str) -> (Option, bool } } -struct Execution { +pub struct Execution { stack: Vec, } diff --git a/docs/public/solpg-anchor.png b/docs/public/solpg-anchor.png new file mode 100644 index 0000000000..6f0ec0b7e9 Binary files /dev/null and b/docs/public/solpg-anchor.png differ diff --git a/docs/public/solpg-build-deploy.png b/docs/public/solpg-build-deploy.png new file mode 100644 index 0000000000..0e417c6b5f Binary files /dev/null and b/docs/public/solpg-build-deploy.png differ diff --git a/docs/public/solpg-github.png b/docs/public/solpg-github.png new file mode 100644 index 0000000000..b0a49365c3 Binary files /dev/null and b/docs/public/solpg-github.png differ diff --git a/docs/public/solpg-import.png b/docs/public/solpg-import.png new file mode 100644 index 0000000000..573c389006 Binary files /dev/null and b/docs/public/solpg-import.png differ diff --git a/docs/public/solpg-test.png b/docs/public/solpg-test.png new file mode 100644 index 0000000000..abd8cb7489 Binary files /dev/null and b/docs/public/solpg-test.png differ diff --git a/docs/public/solpg-wallet.png b/docs/public/solpg-wallet.png new file mode 100644 index 0000000000..4b7d420815 Binary files /dev/null and b/docs/public/solpg-wallet.png differ diff --git a/docs/src/pages/_app.jsx b/docs/src/pages/_app.jsx index 1f6dbcd260..57c831ac5d 100644 --- a/docs/src/pages/_app.jsx +++ b/docs/src/pages/_app.jsx @@ -26,6 +26,7 @@ const navigation = [ title: 'Getting Started', links: [ { title: 'Introduction', href: '/' }, + { title: 'Quickstart', href: '/docs/solana-playground' }, { title: 'Installation', href: '/docs/installation' }, { title: 'Hello World', href: '/docs/hello-world' }, { title: 'Intro to Solana', href: '/docs/intro-to-solana' }, @@ -67,6 +68,8 @@ const navigation = [ { title: 'References', links: [ + { title: 'Account Constraints', href: '/docs/account-constraints' }, + { title: 'Account Types', href: '/docs/account-types' }, { title: 'Anchor.toml', href: '/docs/manifest' }, { title: 'CLI', href: '/docs/cli' }, { title: 'AVM', href: '/docs/avm' }, diff --git a/docs/src/pages/docs/account-constraints.md b/docs/src/pages/docs/account-constraints.md new file mode 100644 index 0000000000..cc90ee2123 --- /dev/null +++ b/docs/src/pages/docs/account-constraints.md @@ -0,0 +1,331 @@ +--- +title: Account Constraints +description: Anchor Account Constraint Examples +--- + +Minimal reference examples for Anchor account [constraints](https://docs.rs/anchor-lang/latest/anchor_lang/derive.Accounts.html). + +## Instruction Attribute + +{% table %} + +- Attribute +- Example +- Description + +--- + +- ```rust + #[derive(Accounts)] + #[instruction(...)] + pub struct Initialize<'info> { + ... + } + ``` + +- [Github](https://github.com/solana-developers/anchor-examples/tree/main/account-constraints/instruction) + [Solpg](https://beta.solpg.io/https://github.com/solana-developers/anchor-examples/tree/main/account-constraints/instruction) +- You can access the instruction’s arguments with the #[instruction(..)] attribute. + You have to list them in the same order as in the instruction but you can omit all arguments after the last one you need. + +{% /table %} + +## Normal Constraints + +{% table %} + +- Attribute +- Example +- Description + +--- + +- ```rust + #[account(signer)] + #[account(signer @ )] + ``` + +- [Github](https://github.com/solana-developers/anchor-examples/tree/main/account-constraints/signer) + [Solpg](https://beta.solpg.io/https://github.com/solana-developers/anchor-examples/tree/main/account-constraints/signer) +- Checks the given account signed the transaction. Custom errors are supported via @. Consider using the Signer type if you would only have this constraint on the account. + +--- + +- ```rust + #[account(mut)] + #[account(mut @ )] + ``` + +- [Github](https://github.com/solana-developers/anchor-examples/tree/main/account-constraints/mut) + [Solpg](https://beta.solpg.io/https://github.com/solana-developers/anchor-examples/tree/main/account-constraints/mut) +- Checks the given account is mutable. + Makes anchor persist any state changes. + Custom errors are supported via @. + +--- + +- ```rust + #[account( + init, + payer = , + space = + )] + ``` + +- [Github](https://github.com/solana-developers/anchor-examples/tree/main/account-constraints/init) + [Solpg](https://beta.solpg.io/https://github.com/solana-developers/anchor-examples/tree/main/account-constraints/init) +- Creates the account via a CPI to the system program and initializes it (sets its account discriminator). + +--- + +- ```rust + #[account( + init_if_needed, + payer = + )] + + #[account( + init_if_needed, + payer = , + space = + )] + ``` + +- [Github](https://github.com/solana-developers/anchor-examples/tree/main/account-constraints/init_if_needed) + [Solpg](https://beta.solpg.io/https://github.com/solana-developers/anchor-examples/tree/main/account-constraints/init_if_needed) +- Exact same functionality as the init constraint but only runs if the account does not exist yet. + + This feature should be used with care and is therefore behind a feature flag. You can enable it by importing anchor-lang with the init-if-needed cargo feature. + When using init_if_needed, you need to make sure you properly protect yourself against re-initialization attacks. + +--- + +- ```rust + #[account( + seeds = , + bump + )] + + #[account( + seeds = , + bump, + seeds::program = + )] + + #[account( + seeds = , + bump = + )] + + #[account( + seeds = , + bump = , + seeds::program = + )] + ``` + +- [Github](https://github.com/solana-developers/anchor-examples/tree/main/account-constraints/seed-bump) + [Solpg](https://beta.solpg.io/https://github.com/solana-developers/anchor-examples/tree/main/account-constraints/seed-bump) +- Checks that given account is a PDA derived from the currently executing program, the seeds, and if provided, the bump. + If not provided, anchor uses the canonical bump. + Add seeds::program = to derive the PDA from a different program than the currently executing one. + +--- + +- ```rust + #[account( + has_one = + )] + + #[account( + has_one = @ + )] + ``` + +- [Github](https://github.com/solana-developers/anchor-examples/tree/main/account-constraints/has_one) + [Solpg](https://beta.solpg.io/https://github.com/solana-developers/anchor-examples/tree/main/account-constraints/has_one) +- Checks the target_account field on the account matches the key of the target_account field in the Accounts struct. + Custom errors are supported via @. + +--- + +- ```rust + #[account(address = )] + #[account(address = @ )] + ``` + +- [Github](https://github.com/solana-developers/anchor-examples/tree/main/account-constraints/address) + [Solpg](https://beta.solpg.io/https://github.com/solana-developers/anchor-examples/tree/main/account-constraints/address) +- Checks the account key matches the pubkey. + Custom errors are supported via @. + +--- + +- ```rust + #[account(owner = )] + #[account(owner = @ )] + ``` + +- [Github](https://github.com/solana-developers/anchor-examples/tree/main/account-constraints/owner) + [Solpg](https://beta.solpg.io/https://github.com/solana-developers/anchor-examples/tree/main/account-constraints/owner) +- Checks the account owner matches expr. + Custom errors are supported via @. + +--- + +- ```rust + #[account(executable)] + ``` + +- [Github](https://github.com/solana-developers/anchor-examples/tree/main/account-constraints/executable) + [Solpg](https://beta.solpg.io/https://github.com/solana-developers/anchor-examples/tree/main/account-constraints/executable) +- Checks the account is executable (i.e. the account is a program). + You may want to use the Program type instead. + +--- + +- ```rust + #[account(rent_exempt = skip)] + #[account(rent_exempt = enforce)] + ``` + +- Github + Solpg +- Enforces rent exemption with = enforce. + Skips rent exemption check that would normally be done through other constraints with = skip, e.g. when used with the zero constraint + +--- + +- ```rust + #[account(zero)] + ``` + +- [Github](https://github.com/solana-developers/anchor-examples/tree/main/account-constraints/zero) + [Solpg](https://beta.solpg.io/https://github.com/solana-developers/anchor-examples/tree/main/account-constraints/zero) +- Checks the account discriminator is zero. + + Use this constraint if you want to create an account in a previous instruction and then initialize it in your instruction instead of using init. This is necessary for accounts that are larger than 10 Kibibyte because those accounts cannot be created via a CPI (which is what init would do). + +--- + +- ```rust + #[account(close = )] + ``` + +- [Github](https://github.com/solana-developers/anchor-examples/tree/main/account-constraints/close) + [Solpg](https://beta.solpg.io/https://github.com/solana-developers/anchor-examples/tree/main/account-constraints/close) +- Marks the account as closed at the end of the instruction’s execution (sets its discriminator to the CLOSED_ACCOUNT_DISCRIMINATOR) and sends its lamports to the specified account. + + Setting the discriminator to a special variant makes account revival attacks (where a subsequent instruction adds the rent exemption lamports again) impossible. + + Requires mut to exist on the account. + +--- + +- ```rust + #[account(constraint = )] + #[account( + constraint = @ + )] + ``` + +- [Github](https://github.com/solana-developers/anchor-examples/tree/main/account-constraints/constraint) + [Solpg](https://beta.solpg.io/https://github.com/solana-developers/anchor-examples/tree/main/account-constraints/constraint) +- Constraint that checks whether the given expression evaluates to true. + Use this when no other constraint fits your use case. + +--- + +- ```rust + #[account( + realloc = , + realloc::payer = , + realloc::zero = + )] + ``` + +- [Github](https://github.com/solana-developers/anchor-examples/tree/main/account-constraints/realloc) + [Solpg](https://beta.solpg.io/https://github.com/solana-developers/anchor-examples/tree/main/account-constraints/realloc) +- Used to realloc program account space at the beginning of an instruction. + +{% /table %} + +## SPL Constraints + +{% table %} + +- Attribute +- Example +- Description + +--- + +- ```rust + #[account( + token::mint = , + token::authority = + )] + + #[account( + token::mint = , + token::authority = , + token::token_program = + )] + ``` + +- [Github](https://github.com/solana-developers/anchor-examples/tree/main/account-constraints/token) + [Solpg](https://beta.solpg.io/https://github.com/solana-developers/anchor-examples/tree/main/account-constraints/token) +- Can be used as a check or with init to create a token account with the given mint address and authority. + When used as a check, it's possible to only specify a subset of the constraints. + +--- + +- ```rust + #[account( + mint::authority = , + mint::decimals = + )] + + #[account( + mint::authority = , + mint::decimals = , + mint::freeze_authority = + )] + ``` + +- [Github](https://github.com/solana-developers/anchor-examples/tree/main/account-constraints/mint) + [Solpg](https://beta.solpg.io/https://github.com/solana-developers/anchor-examples/tree/main/account-constraints/mint) +- Can be used as a check or with init to create a mint account with the given mint decimals and mint authority. + The freeze authority is optional when used with init. + When used as a check, it's possible to only specify a subset of the constraints. + +--- + +- ```rust + #[account( + associated_token::mint = , + associated_token::authority = + )] + + #[account( + associated_token::mint = , + associated_token::authority = , + associated_token::token_program = + )] + ``` + +- [Github](https://github.com/solana-developers/anchor-examples/tree/main/account-constraints/associated_token) + [Solpg](https://beta.solpg.io/https://github.com/solana-developers/anchor-examples/tree/main/account-constraints/associated_token) +- Can be used as a standalone as a check or with init to create an associated token account with the given mint address and authority. + +--- + +- ```rust + #[account(*::token_program = )] + ``` + +- [Github](https://github.com/solana-developers/anchor-examples/tree/main/account-constraints/token_program) + [Solpg](https://beta.solpg.io/https://github.com/solana-developers/anchor-examples/tree/main/account-constraints/token_program) +- The token_program can optionally be overridden. + +{% /table %} diff --git a/docs/src/pages/docs/account-types.md b/docs/src/pages/docs/account-types.md new file mode 100644 index 0000000000..4280702e01 --- /dev/null +++ b/docs/src/pages/docs/account-types.md @@ -0,0 +1,135 @@ +--- +title: Account Types +description: Anchor Account Type Examples +--- + +Minimal reference examples for Anchor [account types](https://docs.rs/anchor-lang/latest/anchor_lang/accounts/index.html). + +{% table %} + +- Type +- Example +- Description + +--- + +- ```rust + Account<'info, T> + ``` + +- [Github](https://github.com/solana-developers/anchor-examples/tree/main/account-types/Account) + [Solpg](https://beta.solpg.io/https://github.com/solana-developers/anchor-examples/tree/main/account-types/Account) +- Account container that checks ownership on deserialization + +--- + +- ```rust + AccountInfo<'info> + ``` + +- [Github](https://github.com/solana-developers/anchor-examples/tree/main/account-types/AccountInfo) + [Solpg](https://beta.solpg.io/https://github.com/solana-developers/anchor-examples/tree/main/account-types/AccountInfo) +- AccountInfo can be used as a type but Unchecked Account should be used instead + +--- + +- ```rust + AccountLoader<'info, T> + ``` + +- [Github](https://github.com/solana-developers/anchor-examples/tree/main/account-types/AccountLoader) + [Solpg](https://beta.solpg.io/https://github.com/solana-developers/anchor-examples/tree/main/account-types/AccountLoader) +- Type facilitating on demand zero copy deserialization + +--- + +- ```rust + Box> + Box> + ``` + +- [Github](https://github.com/solana-developers/anchor-examples/tree/main/account-types/Box) + [Solpg](https://beta.solpg.io/https://github.com/solana-developers/anchor-examples/tree/main/account-types/Box) +- Box type to save stack space + +--- + +- ```rust + Interface<'info, T> + ``` + +- [Github](https://github.com/solana-developers/anchor-examples/tree/main/account-types/Interface) + [Solpg](https://beta.solpg.io/https://github.com/solana-developers/anchor-examples/tree/main/account-types/Interface) +- Type validating that the account is one of a set of given Programs + +--- + +- ```rust + InterfaceAccount<'info, T> + ``` + +- [Github](https://github.com/solana-developers/anchor-examples/tree/main/account-types/InterfaceAccount) + [Solpg](https://beta.solpg.io/https://github.com/solana-developers/anchor-examples/tree/main/account-types/InterfaceAccount) +- Account container that checks ownership on deserialization + +--- + +- ```rust + Option> + ``` + +- [Github](https://github.com/solana-developers/anchor-examples/tree/main/account-types/Option) + [Solpg](https://beta.solpg.io/https://github.com/solana-developers/anchor-examples/tree/main/account-types/Option) +- Option type for optional accounts + +--- + +- ```rust + Program<'info, T> + ``` + +- [Github](https://github.com/solana-developers/anchor-examples/tree/main/account-types/Program) + [Solpg](https://beta.solpg.io/https://github.com/solana-developers/anchor-examples/tree/main/account-types/Program) +- Type validating that the account is the given Program + +--- + +- ```rust + Signer<'info> + ``` + +- [Github](https://github.com/solana-developers/anchor-examples/tree/main/account-types/Signer) + [Solpg](https://beta.solpg.io/https://github.com/solana-developers/anchor-examples/tree/main/account-types/Signer) +- Type validating that the account signed the transaction + +--- + +- ```rust + SystemAccount<'info> + ``` + +- [Github](https://github.com/solana-developers/anchor-examples/tree/main/account-types/SystemAccount) + [Solpg](https://beta.solpg.io/https://github.com/solana-developers/anchor-examples/tree/main/account-types/SystemAccount) +- Type validating that the account is owned by the system program + +--- + +- ```rust + Sysvar<'info, T> + ``` + +- [Github](https://github.com/solana-developers/anchor-examples/tree/main/account-types/Sysvar) + [Solpg](https://beta.solpg.io/https://github.com/solana-developers/anchor-examples/tree/main/account-types/Sysvar) +- Type validating that the account is a sysvar and deserializing it + +--- + +- ```rust + UncheckedAccount<'info> + ``` + +- [Github](https://github.com/solana-developers/anchor-examples/tree/main/account-types/UncheckedAccount) + [Solpg](https://beta.solpg.io/https://github.com/solana-developers/anchor-examples/tree/main/account-types/UncheckedAccount) +- Explicit wrapper for AccountInfo types to emphasize that no checks are performed + +{% /table %} diff --git a/docs/src/pages/docs/cross-program-invocations.md b/docs/src/pages/docs/cross-program-invocations.md index 3c9613529c..beefab1e93 100644 --- a/docs/src/pages/docs/cross-program-invocations.md +++ b/docs/src/pages/docs/cross-program-invocations.md @@ -61,7 +61,7 @@ pub struct Data { There's nothing special happening here. It's a pretty simple program! The interesting part is how it interacts with the next program we are going to create. -Run +Still inside the project, initialize a new `puppet-master` program using, ```shell anchor new puppet-master diff --git a/docs/src/pages/docs/solana-playground.md b/docs/src/pages/docs/solana-playground.md new file mode 100644 index 0000000000..9093d033e2 --- /dev/null +++ b/docs/src/pages/docs/solana-playground.md @@ -0,0 +1,164 @@ +--- +title: Quickstart +description: Getting Started with Solana Playground +--- + +## Solana Playground + +Solana Playground (Solpg) is a browser based IDE that allows you to quickly develop, deploy, and test Solana programs! + +To get started, go to [https://beta.solpg.io/](https://beta.solpg.io/). + +### Create Playground Wallet + +If it is your first time using Solana Playground, you'll first need to create a Playground Wallet. + +Click on the red status indicator button labeled "Not connected" at the bottom left of the screen, (optionally) save your wallet's keypair file to your computer for backup, then click "Continue". + +![solpg-wallet](/solpg-wallet.png) + +After your Playground Wallet is created, you will notice the bottom of the window now states your wallet's address, your SOL balance, and the Solana cluster you are connected to (devnet by default). + +{% callout type="warning" %} +Your Playground Wallet will be saved in your browser's local storage. Clearing your browser cache will remove your saved wallet. +{% /callout %} + +To fund your Playground wallet with devnet SOL, run the following command in the Playground terminal: + +``` +solana airdrop 5 +``` + +Alternatively, you can use this [devnet faucet](https://faucet.solana.com/). + +### Create Anchor Project + +Next, click the "Create a new project" button on the left-side panel. + +Enter a project name, select Anchor as the framework, then click the "Create" button. + +![solpg-anchor](/solpg-anchor.png) + +This will create a basic Anchor program that can be found in the `src/lib.rs` file. +You can learn more about the details of an Anchor program in the Core concepts section of the docs. + +```rust +use anchor_lang::prelude::*; + +// This is your program's public key and it will update +// automatically when you build the project. +declare_id!("11111111111111111111111111111111"); + +#[program] +mod hello_anchor { + use super::*; + pub fn initialize(ctx: Context, data: u64) -> Result<()> { + ctx.accounts.new_account.data = data; + msg!("Changed data to: {}!", data); // Message will show up in the tx logs + Ok(()) + } +} + +#[derive(Accounts)] +pub struct Initialize<'info> { + // We must specify the space in order to initialize an account. + // First 8 bytes are default account discriminator, + // next 8 bytes come from NewAccount.data being type u64. + // (u64 = 64 bits unsigned integer = 8 bytes) + #[account(init, payer = signer, space = 8 + 8)] + pub new_account: Account<'info, NewAccount>, + #[account(mut)] + pub signer: Signer<'info>, + pub system_program: Program<'info, System>, +} + +#[account] +pub struct NewAccount { + data: u64 +} +``` + +### Build and Deploy Program + +To build the program, simply run `build` in the terminal. Building the program will update the program address in `declare_id!()`. This is the on-chain address of your program. + +Once the program is built, run `deploy` in the terminal to deploy the program to the cluster (devnet by default). +To deploy a program, SOL must be allocated to the on-chain account that stores the program. If you do not have enough SOL, you may need to first request an airdrop. + +You can also use the `Build` and `Deploy` buttons on the left-side panel. + +![solpg-build-deploy](/solpg-build-deploy.png) + +### Test Program + +Included with the starter code is a test file found in `tests/anchor.test.ts`. +This file demonstrates how to interact with the program from the client. + +```javascript +// No imports needed: web3, anchor, pg and more are globally available + +describe('Test', () => { + it('initialize', async () => { + // Generate keypair for the new account + const newAccountKp = new web3.Keypair() + + // Send transaction + const data = new BN(42) + const txHash = await pg.program.methods + .initialize(data) + .accounts({ + newAccount: newAccountKp.publicKey, + signer: pg.wallet.publicKey, + systemProgram: web3.SystemProgram.programId, + }) + .signers([newAccountKp]) + .rpc() + console.log(`Use 'solana confirm -v ${txHash}' to see the logs`) + + // Confirm transaction + await pg.connection.confirmTransaction(txHash) + + // Fetch the created account + const newAccount = await pg.program.account.newAccount.fetch( + newAccountKp.publicKey + ) + + console.log('On-chain data is:', newAccount.data.toString()) + + // Check whether the data on-chain is equal to local 'data' + assert(data.eq(newAccount.data)) + }) +}) +``` + +To run the test file once the program is deployed, run `test` in the terminal. + +You can also use the `Test` button on the left-side panel. + +![solpg-test](/solpg-test.png) + +Lastly, the SOL allocated to the on-chain program can be fully recovered by closing the program. + +You can close a program by running the following command and specifying the program ID found in `declare_id!()`: + +``` +solana program close +``` + +Congratulations! You've just built and deployed your first Solana program using the Anchor framework! + +### Import from Github + +Solana Playground offers a convenient feature allowing you to import or view projects using their GitHub URLs. + +Open this [Solpg link](https://beta.solpg.io/https://github.com/solana-developers/anchor-examples/tree/main/quickstart) to view the Anchor project from this [Github repo](https://github.com/solana-developers/anchor-examples/tree/main/quickstart). + +Click the `Import` button and enter a name for the project to add it to your list of projects in Solana Playground. + +![solpg-import](/solpg-import.png) + +Once a project is imported, all changes are automatically saved and persisted within the Playground environment. + +Additionally, you have the option to import projects directly by clicking the Github icon on the left-side panel. + +![solpg-github](/solpg-github.png) diff --git a/examples/tutorial/basic-0/Cargo.toml b/examples/tutorial/basic-0/Cargo.toml index 3fc1846852..b645dd5ca7 100644 --- a/examples/tutorial/basic-0/Cargo.toml +++ b/examples/tutorial/basic-0/Cargo.toml @@ -2,3 +2,6 @@ members = [ "programs/*" ] + +[profile.release] +overflow-checks = true diff --git a/examples/tutorial/basic-1/Cargo.toml b/examples/tutorial/basic-1/Cargo.toml index 3fc1846852..b645dd5ca7 100644 --- a/examples/tutorial/basic-1/Cargo.toml +++ b/examples/tutorial/basic-1/Cargo.toml @@ -2,3 +2,6 @@ members = [ "programs/*" ] + +[profile.release] +overflow-checks = true diff --git a/examples/tutorial/basic-2/Cargo.toml b/examples/tutorial/basic-2/Cargo.toml index 3fc1846852..b645dd5ca7 100644 --- a/examples/tutorial/basic-2/Cargo.toml +++ b/examples/tutorial/basic-2/Cargo.toml @@ -2,3 +2,6 @@ members = [ "programs/*" ] + +[profile.release] +overflow-checks = true diff --git a/examples/tutorial/basic-3/Cargo.toml b/examples/tutorial/basic-3/Cargo.toml index a60de986d3..61ab23b005 100644 --- a/examples/tutorial/basic-3/Cargo.toml +++ b/examples/tutorial/basic-3/Cargo.toml @@ -2,3 +2,6 @@ members = [ "programs/*" ] + +[profile.release] +overflow-checks = true diff --git a/examples/tutorial/basic-4/Cargo.toml b/examples/tutorial/basic-4/Cargo.toml index a60de986d3..61ab23b005 100644 --- a/examples/tutorial/basic-4/Cargo.toml +++ b/examples/tutorial/basic-4/Cargo.toml @@ -2,3 +2,6 @@ members = [ "programs/*" ] + +[profile.release] +overflow-checks = true diff --git a/examples/tutorial/basic-5/Cargo.toml b/examples/tutorial/basic-5/Cargo.toml index 7aa6203805..61ab23b005 100644 --- a/examples/tutorial/basic-5/Cargo.toml +++ b/examples/tutorial/basic-5/Cargo.toml @@ -1,4 +1,7 @@ [workspace] members = [ "programs/*" -] \ No newline at end of file +] + +[profile.release] +overflow-checks = true diff --git a/lang/syn/src/codegen/program/idl.rs b/lang/syn/src/codegen/program/idl.rs index 451f8ea018..757a2097e5 100644 --- a/lang/syn/src/codegen/program/idl.rs +++ b/lang/syn/src/codegen/program/idl.rs @@ -226,7 +226,7 @@ pub fn idl_accounts_and_functions() -> proc_macro2::TokenStream { accounts.system_program.to_account_info(), anchor_lang::system_program::Transfer { from: accounts.authority.to_account_info(), - to: accounts.idl.to_account_info().clone(), + to: accounts.idl.to_account_info(), }, ), new_rent_minimum diff --git a/lang/syn/src/idl/parse/pda.rs b/lang/syn/src/idl/parse/pda.rs index d475dab431..d9561c29c1 100644 --- a/lang/syn/src/idl/parse/pda.rs +++ b/lang/syn/src/idl/parse/pda.rs @@ -5,7 +5,7 @@ use crate::ConstraintSeedsGroup; use crate::{AccountsStruct, Field}; use std::collections::HashMap; use std::str::FromStr; -use syn::{Expr, ExprLit, Lit}; +use syn::{Expr, ExprLit, Lit, Path}; // Parses a seeds constraint, extracting the IdlSeed types. // @@ -135,6 +135,7 @@ impl<'a> PdaParser<'a> { let seed_path: SeedPath = SeedPath(lit_byte_str.token().to_string(), Vec::new()); self.parse_str_literal(&seed_path) } + Expr::Path(expr_path) => self.parse_const_path(&expr_path.path), // Unknown type. Please file an issue. _ => { println!("WARNING: unexpected seed: {seed:?}"); @@ -151,6 +152,25 @@ impl<'a> PdaParser<'a> { })) } + fn parse_const_path(&self, path: &Path) -> Option { + let ident = &path.segments.first().unwrap().ident; + + let const_item = self.ctx.consts().find(|c| c.ident == *ident).unwrap(); + let idl_ty = IdlType::from_str(&parser::tts_to_string(&const_item.ty)).ok()?; + + let idl_ty_value = parser::tts_to_string(&const_item.expr); + let idl_ty_value: String = str_lit_to_array(&idl_ty, &idl_ty_value); + + let seed_path: SeedPath = SeedPath(idl_ty_value, Vec::new()); + + if self.is_str_literal(&seed_path) { + self.parse_str_literal(&seed_path) + } else { + println!("WARNING: unexpected constant path value: {seed_path:?}"); + None + } + } + fn parse_const(&self, seed_path: &SeedPath) -> Option { // Pull in the constant value directly into the IDL. assert!(seed_path.components().is_empty()); diff --git a/spl/src/shmem.rs b/spl/src/shmem.rs index 450c6806fb..81a9f15869 100644 --- a/spl/src/shmem.rs +++ b/spl/src/shmem.rs @@ -1,13 +1,13 @@ //! CPI API for interacting with the SPL shared memory //! [program](https://github.com/solana-labs/solana-program-library/tree/master/shared-memory). -use anchor_lang::ToAccountInfo; use anchor_lang::{context::CpiContext, Accounts}; use solana_program::account_info::AccountInfo; use solana_program::declare_id; use solana_program::entrypoint::ProgramResult; use solana_program::instruction::{AccountMeta, Instruction}; use solana_program::program; +use solana_program::pubkey::Pubkey; // TODO: update this once the final shared memory program gets released. // shmem4EWT2sPdVGvTZCzXXRAURL9G5vpPxNwSeKhHUL. diff --git a/tests/auction-house/Cargo.toml b/tests/auction-house/Cargo.toml index 946f3922e5..97d6280542 100644 --- a/tests/auction-house/Cargo.toml +++ b/tests/auction-house/Cargo.toml @@ -3,3 +3,6 @@ members = [ "programs/*" ] resolver = "2" + +[profile.release] +overflow-checks = true diff --git a/tests/bench/Cargo.toml b/tests/bench/Cargo.toml index 946f3922e5..97d6280542 100644 --- a/tests/bench/Cargo.toml +++ b/tests/bench/Cargo.toml @@ -3,3 +3,6 @@ members = [ "programs/*" ] resolver = "2" + +[profile.release] +overflow-checks = true diff --git a/tests/bench/bench.json b/tests/bench/bench.json index e19182182e..0636ac40c6 100644 --- a/tests/bench/bench.json +++ b/tests/bench/bench.json @@ -3,96 +3,96 @@ "solanaVersion": "1.14.16", "result": { "binarySize": { - "bench": 1118736 + "bench": 1137688 }, "computeUnits": { - "accountInfo1": 954, - "accountInfo2": 1567, - "accountInfo4": 2059, - "accountInfo8": 3856, - "accountEmptyInit1": 5958, - "accountEmpty1": 1090, - "accountEmptyInit2": 10574, - "accountEmpty2": 1852, - "accountEmptyInit4": 19557, - "accountEmpty4": 2646, - "accountEmptyInit8": 37541, - "accountEmpty8": 5043, - "accountSizedInit1": 6063, - "accountSized1": 1135, - "accountSizedInit2": 10783, - "accountSized2": 1966, - "accountSizedInit4": 19975, - "accountSized4": 2787, - "accountSizedInit8": 38381, - "accountSized8": 5359, - "accountUnsizedInit1": 6193, - "accountUnsized1": 1243, - "accountUnsizedInit2": 11042, - "accountUnsized2": 1893, - "accountUnsizedInit4": 20495, - "accountUnsized4": 3104, - "accountUnsizedInit8": 39419, - "accountUnsized8": 6051, - "boxedAccountEmptyInit1": 6160, - "boxedAccountEmpty1": 976, - "boxedAccountEmptyInit2": 10784, - "boxedAccountEmpty2": 1499, - "boxedAccountEmptyInit4": 19500, - "boxedAccountEmpty4": 2530, - "boxedAccountEmptyInit8": 37415, - "boxedAccountEmpty8": 4780, - "boxedAccountSizedInit1": 6256, - "boxedAccountSized1": 1003, - "boxedAccountSizedInit2": 10975, - "boxedAccountSized2": 1554, - "boxedAccountSizedInit4": 19884, - "boxedAccountSized4": 2642, - "boxedAccountSizedInit8": 38182, - "boxedAccountSized8": 5003, - "boxedAccountUnsizedInit1": 6374, - "boxedAccountUnsized1": 1069, - "boxedAccountUnsizedInit2": 11211, - "boxedAccountUnsized2": 1679, - "boxedAccountUnsizedInit4": 20351, - "boxedAccountUnsized4": 2899, - "boxedAccountUnsizedInit8": 39118, - "boxedAccountUnsized8": 5517, - "boxedInterfaceAccountMint1": 2299, - "boxedInterfaceAccountMint2": 4053, - "boxedInterfaceAccountMint4": 7538, - "boxedInterfaceAccountMint8": 14699, - "boxedInterfaceAccountToken1": 1737, - "boxedInterfaceAccountToken2": 2928, - "boxedInterfaceAccountToken4": 5291, - "boxedInterfaceAccountToken8": 10205, - "interfaceAccountMint1": 2530, - "interfaceAccountMint2": 4726, - "interfaceAccountMint4": 9431, - "interfaceAccountMint8": 17709, - "interfaceAccountToken1": 1755, - "interfaceAccountToken2": 3211, - "interfaceAccountToken4": 6006, - "interface1": 999, - "interface2": 1574, - "interface4": 1996, - "interface8": 3651, - "program1": 999, - "program2": 1573, - "program4": 1998, - "program8": 3651, - "signer1": 958, - "signer2": 1576, - "signer4": 2079, - "signer8": 3895, - "systemAccount1": 1013, - "systemAccount2": 1686, - "systemAccount4": 2298, - "systemAccount8": 4336, - "uncheckedAccount1": 953, - "uncheckedAccount2": 1567, - "uncheckedAccount4": 2060, - "uncheckedAccount8": 3855 + "accountInfo1": 1063, + "accountInfo2": 1774, + "accountInfo4": 2462, + "accountInfo8": 4651, + "accountEmptyInit1": 6648, + "accountEmpty1": 1199, + "accountEmptyInit2": 11747, + "accountEmpty2": 2059, + "accountEmptyInit4": 21696, + "accountEmpty4": 3049, + "accountEmptyInit8": 41612, + "accountEmpty8": 5838, + "accountSizedInit1": 6759, + "accountSized1": 1244, + "accountSizedInit2": 11968, + "accountSized2": 2173, + "accountSizedInit4": 22138, + "accountSized4": 3190, + "accountSizedInit8": 42500, + "accountSized8": 6154, + "accountUnsizedInit1": 6895, + "accountUnsized1": 1352, + "accountUnsizedInit2": 12239, + "accountUnsized2": 2100, + "accountUnsizedInit4": 22682, + "accountUnsized4": 3507, + "accountUnsizedInit8": 43586, + "accountUnsized8": 6846, + "boxedAccountEmptyInit1": 6850, + "boxedAccountEmpty1": 1085, + "boxedAccountEmptyInit2": 11957, + "boxedAccountEmpty2": 1706, + "boxedAccountEmptyInit4": 21639, + "boxedAccountEmpty4": 2933, + "boxedAccountEmptyInit8": 41486, + "boxedAccountEmpty8": 5575, + "boxedAccountSizedInit1": 6952, + "boxedAccountSized1": 1112, + "boxedAccountSizedInit2": 12160, + "boxedAccountSized2": 1761, + "boxedAccountSizedInit4": 22047, + "boxedAccountSized4": 3045, + "boxedAccountSizedInit8": 42301, + "boxedAccountSized8": 5798, + "boxedAccountUnsizedInit1": 7076, + "boxedAccountUnsized1": 1178, + "boxedAccountUnsizedInit2": 12408, + "boxedAccountUnsized2": 1886, + "boxedAccountUnsizedInit4": 22538, + "boxedAccountUnsized4": 3302, + "boxedAccountUnsizedInit8": 43285, + "boxedAccountUnsized8": 6312, + "boxedInterfaceAccountMint1": 2408, + "boxedInterfaceAccountMint2": 4176, + "boxedInterfaceAccountMint4": 7689, + "boxedInterfaceAccountMint8": 14906, + "boxedInterfaceAccountToken1": 1846, + "boxedInterfaceAccountToken2": 3051, + "boxedInterfaceAccountToken4": 5442, + "boxedInterfaceAccountToken8": 10412, + "interfaceAccountMint1": 2639, + "interfaceAccountMint2": 4849, + "interfaceAccountMint4": 9582, + "interfaceAccountMint8": 17916, + "interfaceAccountToken1": 1864, + "interfaceAccountToken2": 3334, + "interfaceAccountToken4": 6157, + "interface1": 1108, + "interface2": 1697, + "interface4": 2147, + "interface8": 3858, + "program1": 1108, + "program2": 1696, + "program4": 2149, + "program8": 3858, + "signer1": 1067, + "signer2": 1783, + "signer4": 2482, + "signer8": 4690, + "systemAccount1": 1122, + "systemAccount2": 1893, + "systemAccount4": 2701, + "systemAccount8": 5131, + "uncheckedAccount1": 1062, + "uncheckedAccount2": 1774, + "uncheckedAccount4": 2463, + "uncheckedAccount8": 4650 }, "stackMemory": { "account_info1": 248, @@ -189,96 +189,96 @@ "solanaVersion": "1.16.0", "result": { "binarySize": { - "bench": 1153736 + "bench": 1160960 }, "computeUnits": { - "accountInfo1": 1015, - "accountInfo2": 1475, - "accountInfo4": 1964, - "accountInfo8": 3841, - "accountEmptyInit1": 5817, - "accountEmpty1": 1149, - "accountEmptyInit2": 10402, - "accountEmpty2": 1754, - "accountEmptyInit4": 19508, - "accountEmpty4": 2540, - "accountEmptyInit8": 37265, - "accountEmpty8": 5016, - "accountSizedInit1": 5924, - "accountSized1": 1214, - "accountSizedInit2": 10680, - "accountSized2": 1873, - "accountSizedInit4": 19970, - "accountSized4": 2762, - "accountSizedInit8": 38122, - "accountSized8": 5353, - "accountUnsizedInit1": 6052, - "accountUnsized1": 1338, - "accountUnsizedInit2": 10929, - "accountUnsized2": 1778, - "accountUnsizedInit4": 20339, - "accountUnsized4": 3136, - "accountUnsizedInit8": 39096, - "accountUnsized8": 5952, - "boxedAccountEmptyInit1": 6034, - "boxedAccountEmpty1": 888, - "boxedAccountEmptyInit2": 10633, - "boxedAccountEmpty2": 1401, - "boxedAccountEmptyInit4": 19311, - "boxedAccountEmpty4": 2424, - "boxedAccountEmptyInit8": 37136, - "boxedAccountEmpty8": 4659, - "boxedAccountSizedInit1": 6130, - "boxedAccountSized1": 917, - "boxedAccountSizedInit2": 10828, - "boxedAccountSized2": 1463, - "boxedAccountSizedInit4": 19703, - "boxedAccountSized4": 2543, - "boxedAccountSizedInit8": 37919, - "boxedAccountSized8": 4898, - "boxedAccountUnsizedInit1": 6240, - "boxedAccountUnsized1": 972, - "boxedAccountUnsizedInit2": 11048, - "boxedAccountUnsized2": 1570, - "boxedAccountUnsizedInit4": 20138, - "boxedAccountUnsized4": 2768, - "boxedAccountUnsizedInit8": 38800, - "boxedAccountUnsized8": 5347, - "boxedInterfaceAccountMint1": 2296, - "boxedInterfaceAccountMint2": 4129, - "boxedInterfaceAccountMint4": 7783, - "boxedInterfaceAccountMint8": 15281, - "boxedInterfaceAccountToken1": 2023, - "boxedInterfaceAccountToken2": 3582, - "boxedInterfaceAccountToken4": 6692, - "boxedInterfaceAccountToken8": 13098, - "interfaceAccountMint1": 2364, - "interfaceAccountMint2": 5030, - "interfaceAccountMint4": 9803, - "interfaceAccountMint8": 18400, - "interfaceAccountToken1": 2091, - "interfaceAccountToken2": 3948, - "interfaceAccountToken4": 7547, - "interface1": 1059, - "interface2": 1479, - "interface4": 1900, - "interface8": 3646, - "program1": 1053, - "program2": 1467, - "program4": 1878, - "program8": 3598, - "signer1": 1018, - "signer2": 1484, - "signer4": 1984, - "signer8": 3880, - "systemAccount1": 1072, - "systemAccount2": 1590, - "systemAccount4": 2195, - "systemAccount8": 4305, - "uncheckedAccount1": 1014, - "uncheckedAccount2": 1475, - "uncheckedAccount4": 1965, - "uncheckedAccount8": 3841 + "accountInfo1": 1126, + "accountInfo2": 1686, + "accountInfo4": 2375, + "accountInfo8": 4652, + "accountEmptyInit1": 6471, + "accountEmpty1": 1260, + "accountEmptyInit2": 11500, + "accountEmpty2": 1965, + "accountEmptyInit4": 21494, + "accountEmpty4": 2951, + "accountEmptyInit8": 41027, + "accountEmpty8": 5827, + "accountSizedInit1": 6584, + "accountSized1": 1325, + "accountSizedInit2": 11790, + "accountSized2": 2084, + "accountSizedInit4": 21980, + "accountSized4": 3173, + "accountSizedInit8": 41932, + "accountSized8": 6164, + "accountUnsizedInit1": 6718, + "accountUnsized1": 1449, + "accountUnsizedInit2": 12051, + "accountUnsized2": 1989, + "accountUnsizedInit4": 22373, + "accountUnsized4": 3547, + "accountUnsizedInit8": 42954, + "accountUnsized8": 6763, + "boxedAccountEmptyInit1": 6688, + "boxedAccountEmpty1": 999, + "boxedAccountEmptyInit2": 11731, + "boxedAccountEmpty2": 1612, + "boxedAccountEmptyInit4": 21297, + "boxedAccountEmpty4": 2835, + "boxedAccountEmptyInit8": 40898, + "boxedAccountEmpty8": 5470, + "boxedAccountSizedInit1": 6790, + "boxedAccountSized1": 1028, + "boxedAccountSizedInit2": 11938, + "boxedAccountSized2": 1674, + "boxedAccountSizedInit4": 21713, + "boxedAccountSized4": 2954, + "boxedAccountSizedInit8": 41729, + "boxedAccountSized8": 5709, + "boxedAccountUnsizedInit1": 6906, + "boxedAccountUnsized1": 1083, + "boxedAccountUnsizedInit2": 12170, + "boxedAccountUnsized2": 1781, + "boxedAccountUnsizedInit4": 22172, + "boxedAccountUnsized4": 3179, + "boxedAccountUnsizedInit8": 42649, + "boxedAccountUnsized8": 6158, + "boxedInterfaceAccountMint1": 2407, + "boxedInterfaceAccountMint2": 4250, + "boxedInterfaceAccountMint4": 7924, + "boxedInterfaceAccountMint8": 15462, + "boxedInterfaceAccountToken1": 2134, + "boxedInterfaceAccountToken2": 3703, + "boxedInterfaceAccountToken4": 6833, + "boxedInterfaceAccountToken8": 13279, + "interfaceAccountMint1": 2475, + "interfaceAccountMint2": 5151, + "interfaceAccountMint4": 9944, + "interfaceAccountMint8": 18581, + "interfaceAccountToken1": 2202, + "interfaceAccountToken2": 4069, + "interfaceAccountToken4": 7688, + "interface1": 1170, + "interface2": 1600, + "interface4": 2041, + "interface8": 3827, + "program1": 1164, + "program2": 1588, + "program4": 2019, + "program8": 3779, + "signer1": 1129, + "signer2": 1695, + "signer4": 2395, + "signer8": 4691, + "systemAccount1": 1183, + "systemAccount2": 1801, + "systemAccount4": 2606, + "systemAccount8": 5116, + "uncheckedAccount1": 1125, + "uncheckedAccount2": 1686, + "uncheckedAccount4": 2376, + "uncheckedAccount8": 4652 }, "stackMemory": { "account_info1": 328, @@ -375,96 +375,96 @@ "solanaVersion": "1.17.0", "result": { "binarySize": { - "bench": 735800 + "bench": 743056 }, "computeUnits": { - "accountInfo1": 584, - "accountInfo2": 824, - "accountInfo4": 1319, - "accountInfo8": 2531, - "accountEmptyInit1": 4899, - "accountEmpty1": 708, - "accountEmptyInit2": 9325, - "accountEmpty2": 1064, - "accountEmptyInit4": 17821, - "accountEmpty4": 1766, - "accountEmptyInit8": 34855, - "accountEmpty8": 3179, - "accountSizedInit1": 4988, - "accountSized1": 732, - "accountSizedInit2": 9499, - "accountSized2": 1106, - "accountSizedInit4": 18219, - "accountSized4": 1863, - "accountSizedInit8": 35574, - "accountSized8": 3374, - "accountUnsizedInit1": 5075, - "accountUnsized1": 759, - "accountUnsizedInit2": 9736, - "accountUnsized2": 1168, - "accountUnsizedInit4": 18622, - "accountUnsized4": 2000, - "accountUnsizedInit8": 36119, - "accountUnsized8": 3667, - "boxedAccountEmptyInit1": 4952, - "boxedAccountEmpty1": 745, - "boxedAccountEmptyInit2": 9426, - "boxedAccountEmpty2": 1136, - "boxedAccountEmptyInit4": 18020, - "boxedAccountEmpty4": 1913, - "boxedAccountEmptyInit8": 35248, - "boxedAccountEmpty8": 3500, - "boxedAccountSizedInit1": 5027, - "boxedAccountSized1": 767, - "boxedAccountSizedInit2": 9582, - "boxedAccountSized2": 1183, - "boxedAccountSizedInit4": 18332, - "boxedAccountSized4": 2002, - "boxedAccountSizedInit8": 35868, - "boxedAccountSized8": 3682, - "boxedAccountUnsizedInit1": 5109, - "boxedAccountUnsized1": 797, - "boxedAccountUnsizedInit2": 9746, - "boxedAccountUnsized2": 1246, - "boxedAccountUnsizedInit4": 18658, - "boxedAccountUnsized4": 2135, - "boxedAccountUnsizedInit8": 36525, - "boxedAccountUnsized8": 3948, - "boxedInterfaceAccountMint1": 2085, - "boxedInterfaceAccountMint2": 3726, - "boxedInterfaceAccountMint4": 6991, - "boxedInterfaceAccountMint8": 13562, - "boxedInterfaceAccountToken1": 2015, - "boxedInterfaceAccountToken2": 3585, - "boxedInterfaceAccountToken4": 6712, - "boxedInterfaceAccountToken8": 13003, - "interfaceAccountMint1": 2174, - "interfaceAccountMint2": 4057, - "interfaceAccountMint4": 7823, - "interfaceAccountMint8": 15357, - "interfaceAccountToken1": 2101, - "interfaceAccountToken2": 3909, - "interfaceAccountToken4": 7522, - "interface1": 630, - "interface2": 813, - "interface4": 1174, - "interface8": 1905, - "program1": 630, - "program2": 813, - "program4": 1176, - "program8": 1905, - "signer1": 564, - "signer2": 776, - "signer4": 1195, - "signer8": 2035, - "systemAccount1": 618, - "systemAccount2": 882, - "systemAccount4": 1406, - "systemAccount8": 2460, - "uncheckedAccount1": 546, - "uncheckedAccount2": 738, - "uncheckedAccount4": 1115, - "uncheckedAccount8": 1877 + "accountInfo1": 695, + "accountInfo2": 1035, + "accountInfo4": 1730, + "accountInfo8": 3342, + "accountEmptyInit1": 5552, + "accountEmpty1": 819, + "accountEmptyInit2": 10421, + "accountEmpty2": 1275, + "accountEmptyInit4": 19803, + "accountEmpty4": 2177, + "accountEmptyInit8": 38609, + "accountEmpty8": 3990, + "accountSizedInit1": 5647, + "accountSized1": 843, + "accountSizedInit2": 10607, + "accountSized2": 1317, + "accountSizedInit4": 20225, + "accountSized4": 2274, + "accountSizedInit8": 39376, + "accountSized8": 4185, + "accountUnsizedInit1": 5740, + "accountUnsized1": 870, + "accountUnsizedInit2": 10856, + "accountUnsized2": 1379, + "accountUnsizedInit4": 20652, + "accountUnsized4": 2411, + "accountUnsizedInit8": 39969, + "accountUnsized8": 4478, + "boxedAccountEmptyInit1": 5605, + "boxedAccountEmpty1": 856, + "boxedAccountEmptyInit2": 10522, + "boxedAccountEmpty2": 1347, + "boxedAccountEmptyInit4": 20002, + "boxedAccountEmpty4": 2324, + "boxedAccountEmptyInit8": 39002, + "boxedAccountEmpty8": 4311, + "boxedAccountSizedInit1": 5686, + "boxedAccountSized1": 878, + "boxedAccountSizedInit2": 10690, + "boxedAccountSized2": 1394, + "boxedAccountSizedInit4": 20338, + "boxedAccountSized4": 2413, + "boxedAccountSizedInit8": 39670, + "boxedAccountSized8": 4493, + "boxedAccountUnsizedInit1": 5774, + "boxedAccountUnsized1": 908, + "boxedAccountUnsizedInit2": 10866, + "boxedAccountUnsized2": 1457, + "boxedAccountUnsizedInit4": 20688, + "boxedAccountUnsized4": 2546, + "boxedAccountUnsizedInit8": 40375, + "boxedAccountUnsized8": 4759, + "boxedInterfaceAccountMint1": 2196, + "boxedInterfaceAccountMint2": 3847, + "boxedInterfaceAccountMint4": 7132, + "boxedInterfaceAccountMint8": 13743, + "boxedInterfaceAccountToken1": 2126, + "boxedInterfaceAccountToken2": 3706, + "boxedInterfaceAccountToken4": 6853, + "boxedInterfaceAccountToken8": 13184, + "interfaceAccountMint1": 2285, + "interfaceAccountMint2": 4178, + "interfaceAccountMint4": 7964, + "interfaceAccountMint8": 15538, + "interfaceAccountToken1": 2212, + "interfaceAccountToken2": 4030, + "interfaceAccountToken4": 7663, + "interface1": 741, + "interface2": 934, + "interface4": 1315, + "interface8": 2086, + "program1": 741, + "program2": 934, + "program4": 1317, + "program8": 2086, + "signer1": 675, + "signer2": 987, + "signer4": 1606, + "signer8": 2846, + "systemAccount1": 729, + "systemAccount2": 1093, + "systemAccount4": 1817, + "systemAccount8": 3271, + "uncheckedAccount1": 657, + "uncheckedAccount2": 949, + "uncheckedAccount4": 1526, + "uncheckedAccount8": 2688 }, "stackMemory": { "account_info1": 128, @@ -561,96 +561,96 @@ "solanaVersion": "1.17.0", "result": { "binarySize": { - "bench": 735800 + "bench": 743208 }, "computeUnits": { - "accountInfo1": 584, - "accountInfo2": 824, - "accountInfo4": 1319, - "accountInfo8": 2531, - "accountEmptyInit1": 4899, - "accountEmpty1": 708, - "accountEmptyInit2": 9325, - "accountEmpty2": 1064, - "accountEmptyInit4": 17821, - "accountEmpty4": 1766, - "accountEmptyInit8": 34855, - "accountEmpty8": 3179, - "accountSizedInit1": 4988, - "accountSized1": 732, - "accountSizedInit2": 9499, - "accountSized2": 1106, - "accountSizedInit4": 18219, - "accountSized4": 1863, - "accountSizedInit8": 35574, - "accountSized8": 3374, - "accountUnsizedInit1": 5075, - "accountUnsized1": 759, - "accountUnsizedInit2": 9736, - "accountUnsized2": 1168, - "accountUnsizedInit4": 18622, - "accountUnsized4": 2000, - "accountUnsizedInit8": 36119, - "accountUnsized8": 3667, - "boxedAccountEmptyInit1": 4952, - "boxedAccountEmpty1": 745, - "boxedAccountEmptyInit2": 9426, - "boxedAccountEmpty2": 1136, - "boxedAccountEmptyInit4": 18020, - "boxedAccountEmpty4": 1913, - "boxedAccountEmptyInit8": 35248, - "boxedAccountEmpty8": 3500, - "boxedAccountSizedInit1": 5027, - "boxedAccountSized1": 767, - "boxedAccountSizedInit2": 9582, - "boxedAccountSized2": 1183, - "boxedAccountSizedInit4": 18332, - "boxedAccountSized4": 2002, - "boxedAccountSizedInit8": 35868, - "boxedAccountSized8": 3682, - "boxedAccountUnsizedInit1": 5109, - "boxedAccountUnsized1": 797, - "boxedAccountUnsizedInit2": 9746, - "boxedAccountUnsized2": 1246, - "boxedAccountUnsizedInit4": 18658, - "boxedAccountUnsized4": 2135, - "boxedAccountUnsizedInit8": 36525, - "boxedAccountUnsized8": 3948, - "boxedInterfaceAccountMint1": 2085, - "boxedInterfaceAccountMint2": 3726, - "boxedInterfaceAccountMint4": 6991, - "boxedInterfaceAccountMint8": 13562, - "boxedInterfaceAccountToken1": 2015, - "boxedInterfaceAccountToken2": 3585, - "boxedInterfaceAccountToken4": 6712, - "boxedInterfaceAccountToken8": 13003, - "interfaceAccountMint1": 2174, - "interfaceAccountMint2": 4057, - "interfaceAccountMint4": 7823, - "interfaceAccountMint8": 15357, - "interfaceAccountToken1": 2101, - "interfaceAccountToken2": 3909, - "interfaceAccountToken4": 7522, - "interface1": 630, - "interface2": 813, - "interface4": 1174, - "interface8": 1905, - "program1": 630, - "program2": 813, - "program4": 1176, - "program8": 1905, - "signer1": 564, - "signer2": 776, - "signer4": 1195, - "signer8": 2035, - "systemAccount1": 618, - "systemAccount2": 882, - "systemAccount4": 1406, - "systemAccount8": 2460, - "uncheckedAccount1": 546, - "uncheckedAccount2": 738, - "uncheckedAccount4": 1115, - "uncheckedAccount8": 1877 + "accountInfo1": 695, + "accountInfo2": 1035, + "accountInfo4": 1730, + "accountInfo8": 3342, + "accountEmptyInit1": 5552, + "accountEmpty1": 819, + "accountEmptyInit2": 10421, + "accountEmpty2": 1275, + "accountEmptyInit4": 19803, + "accountEmpty4": 2177, + "accountEmptyInit8": 38609, + "accountEmpty8": 3990, + "accountSizedInit1": 5647, + "accountSized1": 843, + "accountSizedInit2": 10607, + "accountSized2": 1317, + "accountSizedInit4": 20225, + "accountSized4": 2274, + "accountSizedInit8": 39376, + "accountSized8": 4185, + "accountUnsizedInit1": 5740, + "accountUnsized1": 870, + "accountUnsizedInit2": 10856, + "accountUnsized2": 1379, + "accountUnsizedInit4": 20652, + "accountUnsized4": 2411, + "accountUnsizedInit8": 39969, + "accountUnsized8": 4478, + "boxedAccountEmptyInit1": 5605, + "boxedAccountEmpty1": 856, + "boxedAccountEmptyInit2": 10522, + "boxedAccountEmpty2": 1347, + "boxedAccountEmptyInit4": 20002, + "boxedAccountEmpty4": 2324, + "boxedAccountEmptyInit8": 39002, + "boxedAccountEmpty8": 4311, + "boxedAccountSizedInit1": 5686, + "boxedAccountSized1": 878, + "boxedAccountSizedInit2": 10690, + "boxedAccountSized2": 1394, + "boxedAccountSizedInit4": 20338, + "boxedAccountSized4": 2413, + "boxedAccountSizedInit8": 39670, + "boxedAccountSized8": 4493, + "boxedAccountUnsizedInit1": 5774, + "boxedAccountUnsized1": 908, + "boxedAccountUnsizedInit2": 10866, + "boxedAccountUnsized2": 1457, + "boxedAccountUnsizedInit4": 20688, + "boxedAccountUnsized4": 2546, + "boxedAccountUnsizedInit8": 40375, + "boxedAccountUnsized8": 4759, + "boxedInterfaceAccountMint1": 2196, + "boxedInterfaceAccountMint2": 3847, + "boxedInterfaceAccountMint4": 7132, + "boxedInterfaceAccountMint8": 13743, + "boxedInterfaceAccountToken1": 2126, + "boxedInterfaceAccountToken2": 3706, + "boxedInterfaceAccountToken4": 6853, + "boxedInterfaceAccountToken8": 13184, + "interfaceAccountMint1": 2285, + "interfaceAccountMint2": 4178, + "interfaceAccountMint4": 7964, + "interfaceAccountMint8": 15538, + "interfaceAccountToken1": 2212, + "interfaceAccountToken2": 4030, + "interfaceAccountToken4": 7663, + "interface1": 741, + "interface2": 934, + "interface4": 1315, + "interface8": 2086, + "program1": 741, + "program2": 934, + "program4": 1317, + "program8": 2086, + "signer1": 675, + "signer2": 987, + "signer4": 1606, + "signer8": 2846, + "systemAccount1": 729, + "systemAccount2": 1093, + "systemAccount4": 1817, + "systemAccount8": 3271, + "uncheckedAccount1": 657, + "uncheckedAccount2": 949, + "uncheckedAccount4": 1526, + "uncheckedAccount8": 2688 }, "stackMemory": { "account_info1": 128, diff --git a/tests/bpf-upgradeable-state/Cargo.toml b/tests/bpf-upgradeable-state/Cargo.toml index 946f3922e5..97d6280542 100644 --- a/tests/bpf-upgradeable-state/Cargo.toml +++ b/tests/bpf-upgradeable-state/Cargo.toml @@ -3,3 +3,6 @@ members = [ "programs/*" ] resolver = "2" + +[profile.release] +overflow-checks = true diff --git a/tests/cashiers-check/Cargo.toml b/tests/cashiers-check/Cargo.toml index 946f3922e5..97d6280542 100644 --- a/tests/cashiers-check/Cargo.toml +++ b/tests/cashiers-check/Cargo.toml @@ -3,3 +3,6 @@ members = [ "programs/*" ] resolver = "2" + +[profile.release] +overflow-checks = true diff --git a/tests/cashiers-check/programs/cashiers-check/src/lib.rs b/tests/cashiers-check/programs/cashiers-check/src/lib.rs index 9cdae60d7d..6943fe17f1 100644 --- a/tests/cashiers-check/programs/cashiers-check/src/lib.rs +++ b/tests/cashiers-check/programs/cashiers-check/src/lib.rs @@ -22,8 +22,8 @@ pub mod cashiers_check { ) -> Result<()> { // Transfer funds to the check. let cpi_accounts = Transfer { - from: ctx.accounts.from.to_account_info().clone(), - to: ctx.accounts.vault.to_account_info().clone(), + from: ctx.accounts.from.to_account_info(), + to: ctx.accounts.vault.to_account_info(), authority: ctx.accounts.owner.clone(), }; let cpi_program = ctx.accounts.token_program.clone(); @@ -50,8 +50,8 @@ pub mod cashiers_check { ]; let signer = &[&seeds[..]]; let cpi_accounts = Transfer { - from: ctx.accounts.vault.to_account_info().clone(), - to: ctx.accounts.to.to_account_info().clone(), + from: ctx.accounts.vault.to_account_info(), + to: ctx.accounts.to.to_account_info(), authority: ctx.accounts.check_signer.clone(), }; let cpi_program = ctx.accounts.token_program.clone(); @@ -70,8 +70,8 @@ pub mod cashiers_check { ]; let signer = &[&seeds[..]]; let cpi_accounts = Transfer { - from: ctx.accounts.vault.to_account_info().clone(), - to: ctx.accounts.from.to_account_info().clone(), + from: ctx.accounts.vault.to_account_info(), + to: ctx.accounts.from.to_account_info(), authority: ctx.accounts.check_signer.clone(), }; let cpi_program = ctx.accounts.token_program.clone(); diff --git a/tests/cfo/Cargo.toml b/tests/cfo/Cargo.toml index 99bba92391..e0a06a74a4 100644 --- a/tests/cfo/Cargo.toml +++ b/tests/cfo/Cargo.toml @@ -8,3 +8,6 @@ exclude = [ "deps/swap" ] resolver = "2" + +[profile.release] +overflow-checks = true diff --git a/tests/chat/Cargo.toml b/tests/chat/Cargo.toml index 946f3922e5..97d6280542 100644 --- a/tests/chat/Cargo.toml +++ b/tests/chat/Cargo.toml @@ -3,3 +3,6 @@ members = [ "programs/*" ] resolver = "2" + +[profile.release] +overflow-checks = true diff --git a/tests/composite/Cargo.toml b/tests/composite/Cargo.toml index 946f3922e5..97d6280542 100644 --- a/tests/composite/Cargo.toml +++ b/tests/composite/Cargo.toml @@ -3,3 +3,6 @@ members = [ "programs/*" ] resolver = "2" + +[profile.release] +overflow-checks = true diff --git a/tests/cpi-returns/Cargo.toml b/tests/cpi-returns/Cargo.toml index 946f3922e5..97d6280542 100644 --- a/tests/cpi-returns/Cargo.toml +++ b/tests/cpi-returns/Cargo.toml @@ -3,3 +3,6 @@ members = [ "programs/*" ] resolver = "2" + +[profile.release] +overflow-checks = true diff --git a/tests/custom-coder/Cargo.toml b/tests/custom-coder/Cargo.toml index 946f3922e5..97d6280542 100644 --- a/tests/custom-coder/Cargo.toml +++ b/tests/custom-coder/Cargo.toml @@ -3,3 +3,6 @@ members = [ "programs/*" ] resolver = "2" + +[profile.release] +overflow-checks = true diff --git a/tests/declare-id/Cargo.toml b/tests/declare-id/Cargo.toml index 946f3922e5..97d6280542 100644 --- a/tests/declare-id/Cargo.toml +++ b/tests/declare-id/Cargo.toml @@ -3,3 +3,6 @@ members = [ "programs/*" ] resolver = "2" + +[profile.release] +overflow-checks = true diff --git a/tests/docs/Cargo.toml b/tests/docs/Cargo.toml index 946f3922e5..97d6280542 100644 --- a/tests/docs/Cargo.toml +++ b/tests/docs/Cargo.toml @@ -3,3 +3,6 @@ members = [ "programs/*" ] resolver = "2" + +[profile.release] +overflow-checks = true diff --git a/tests/errors/Cargo.toml b/tests/errors/Cargo.toml index 946f3922e5..97d6280542 100644 --- a/tests/errors/Cargo.toml +++ b/tests/errors/Cargo.toml @@ -3,3 +3,6 @@ members = [ "programs/*" ] resolver = "2" + +[profile.release] +overflow-checks = true diff --git a/tests/escrow/Cargo.toml b/tests/escrow/Cargo.toml index 946f3922e5..97d6280542 100644 --- a/tests/escrow/Cargo.toml +++ b/tests/escrow/Cargo.toml @@ -3,3 +3,6 @@ members = [ "programs/*" ] resolver = "2" + +[profile.release] +overflow-checks = true diff --git a/tests/escrow/programs/escrow/src/lib.rs b/tests/escrow/programs/escrow/src/lib.rs index 7476dcb94c..79a21494c7 100644 --- a/tests/escrow/programs/escrow/src/lib.rs +++ b/tests/escrow/programs/escrow/src/lib.rs @@ -197,7 +197,7 @@ impl<'info> From<&mut InitializeEscrow<'info>> .initializer_deposit_token_account .to_account_info() .clone(), - current_authority: accounts.initializer.to_account_info().clone(), + current_authority: accounts.initializer.to_account_info(), }; let cpi_program = accounts.token_program.to_account_info(); CpiContext::new(cpi_program, cpi_accounts) @@ -207,7 +207,7 @@ impl<'info> From<&mut InitializeEscrow<'info>> impl<'info> CancelEscrow<'info> { fn into_set_authority_context(&self) -> CpiContext<'_, '_, '_, 'info, SetAuthority<'info>> { let cpi_accounts = SetAuthority { - account_or_mint: self.pda_deposit_token_account.to_account_info().clone(), + account_or_mint: self.pda_deposit_token_account.to_account_info(), current_authority: self.pda_account.clone(), }; let cpi_program = self.token_program.to_account_info(); @@ -218,7 +218,7 @@ impl<'info> CancelEscrow<'info> { impl<'info> Exchange<'info> { fn into_set_authority_context(&self) -> CpiContext<'_, '_, '_, 'info, SetAuthority<'info>> { let cpi_accounts = SetAuthority { - account_or_mint: self.pda_deposit_token_account.to_account_info().clone(), + account_or_mint: self.pda_deposit_token_account.to_account_info(), current_authority: self.pda_account.clone(), }; let cpi_program = self.receive_token_program.to_account_info(); @@ -231,9 +231,9 @@ impl<'info> Exchange<'info> { &self, ) -> CpiContext<'_, '_, '_, 'info, TransferChecked<'info>> { let cpi_accounts = TransferChecked { - from: self.pda_deposit_token_account.to_account_info().clone(), - mint: self.receive_mint.to_account_info().clone(), - to: self.taker_receive_token_account.to_account_info().clone(), + from: self.pda_deposit_token_account.to_account_info(), + mint: self.receive_mint.to_account_info(), + to: self.taker_receive_token_account.to_account_info(), authority: self.pda_account.clone(), }; let cpi_program = self.receive_token_program.to_account_info(); @@ -246,8 +246,8 @@ impl<'info> Exchange<'info> { &self, ) -> CpiContext<'_, '_, '_, 'info, TransferChecked<'info>> { let cpi_accounts = TransferChecked { - from: self.taker_deposit_token_account.to_account_info().clone(), - mint: self.deposit_mint.to_account_info().clone(), + from: self.taker_deposit_token_account.to_account_info(), + mint: self.deposit_mint.to_account_info(), to: self .initializer_receive_token_account .to_account_info() diff --git a/tests/events/Cargo.toml b/tests/events/Cargo.toml index 946f3922e5..97d6280542 100644 --- a/tests/events/Cargo.toml +++ b/tests/events/Cargo.toml @@ -3,3 +3,6 @@ members = [ "programs/*" ] resolver = "2" + +[profile.release] +overflow-checks = true diff --git a/tests/floats/Cargo.toml b/tests/floats/Cargo.toml index 946f3922e5..97d6280542 100644 --- a/tests/floats/Cargo.toml +++ b/tests/floats/Cargo.toml @@ -3,3 +3,6 @@ members = [ "programs/*" ] resolver = "2" + +[profile.release] +overflow-checks = true diff --git a/tests/ido-pool/Cargo.toml b/tests/ido-pool/Cargo.toml index 946f3922e5..97d6280542 100644 --- a/tests/ido-pool/Cargo.toml +++ b/tests/ido-pool/Cargo.toml @@ -3,3 +3,6 @@ members = [ "programs/*" ] resolver = "2" + +[profile.release] +overflow-checks = true diff --git a/tests/lockup/Cargo.toml b/tests/lockup/Cargo.toml index 946f3922e5..97d6280542 100644 --- a/tests/lockup/Cargo.toml +++ b/tests/lockup/Cargo.toml @@ -3,3 +3,6 @@ members = [ "programs/*" ] resolver = "2" + +[profile.release] +overflow-checks = true diff --git a/tests/lockup/programs/lockup/Cargo.toml b/tests/lockup/programs/lockup/Cargo.toml index 9cec093b96..976757f2b8 100644 --- a/tests/lockup/programs/lockup/Cargo.toml +++ b/tests/lockup/programs/lockup/Cargo.toml @@ -12,8 +12,7 @@ name = "lockup" [features] no-entrypoint = [] cpi = ["no-entrypoint"] -anchor-deprecated-state = [] -default = ["anchor-deprecated-state"] +default = [] [dependencies] anchor-lang = { path = "../../../../lang" } diff --git a/tests/lockup/programs/registry/Cargo.toml b/tests/lockup/programs/registry/Cargo.toml index fbed1b76ea..d3bc74fa49 100644 --- a/tests/lockup/programs/registry/Cargo.toml +++ b/tests/lockup/programs/registry/Cargo.toml @@ -12,8 +12,7 @@ name = "registry" [features] no-entrypoint = [] cpi = ["no-entrypoint"] -anchor-deprecated-state = [] -default = ["anchor-deprecated-state"] +default = [] [dependencies] anchor-lang = { path = "../../../../lang" } diff --git a/tests/lockup/programs/registry/src/lib.rs b/tests/lockup/programs/registry/src/lib.rs index b3fdaea5cb..20db9ed694 100644 --- a/tests/lockup/programs/registry/src/lib.rs +++ b/tests/lockup/programs/registry/src/lib.rs @@ -1248,7 +1248,7 @@ impl<'a, 'b, 'c, 'info> From<&mut DepositLocked<'info>> let cpi_accounts = Transfer { from: accounts.vesting_vault.clone(), to: accounts.member_vault.to_account_info(), - authority: accounts.depositor_authority.to_account_info().clone(), + authority: accounts.depositor_authority.to_account_info(), }; let cpi_program = accounts.token_program.clone(); CpiContext::new(cpi_program, cpi_accounts) diff --git a/tests/lockup/tests/lockup.js b/tests/lockup/tests/lockup.js index ace3104737..ab3c717803 100644 --- a/tests/lockup/tests/lockup.js +++ b/tests/lockup/tests/lockup.js @@ -2,11 +2,9 @@ const anchor = require("@coral-xyz/anchor"); const serumCmn = require("@project-serum/common"); const { TOKEN_PROGRAM_ID } = require("@solana/spl-token"); const utils = require("./utils"); -const { assert, expect } = require("chai"); +const { assert } = require("chai"); const nativeAssert = require("assert"); -anchor.utils.features.set("anchor-deprecated-state"); - describe("Lockup and Registry", () => { // Read the provider from the configured environmnet. const provider = anchor.AnchorProvider.env(); diff --git a/tests/misc/Anchor.toml b/tests/misc/Anchor.toml index d5eace4c72..e169d907e7 100644 --- a/tests/misc/Anchor.toml +++ b/tests/misc/Anchor.toml @@ -7,6 +7,7 @@ init_if_needed = "BZoppwWi6jMnydnUBEJzotgEXHwLr3b3NramJgZtWeF2" lamports = "Lamports11111111111111111111111111111111111" misc = "3TEqcc8xhrhdspwbvoamUJe2borm4Nr72JxL66k6rgrh" misc_optional = "FNqz6pqLAwvMSds2FYjR4nKV3moVpPNtvkfGFrqLKrgG" +overflow_checks = "overf1owChecks11111111111111111111111111111" remaining_accounts = "RemainingAccounts11111111111111111111111111" [workspace] diff --git a/tests/misc/Cargo.toml b/tests/misc/Cargo.toml index 946f3922e5..97d6280542 100644 --- a/tests/misc/Cargo.toml +++ b/tests/misc/Cargo.toml @@ -3,3 +3,6 @@ members = [ "programs/*" ] resolver = "2" + +[profile.release] +overflow-checks = true diff --git a/tests/misc/programs/overflow-checks/Cargo.toml b/tests/misc/programs/overflow-checks/Cargo.toml new file mode 100644 index 0000000000..a328d4af42 --- /dev/null +++ b/tests/misc/programs/overflow-checks/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "overflow-checks" +version = "0.1.0" +description = "Created with Anchor" +edition = "2021" + +[lib] +crate-type = ["cdylib", "lib"] +name = "overflow_checks" + +[features] +no-entrypoint = [] +no-idl = [] +no-log-ix-name = [] +cpi = ["no-entrypoint"] +default = [] + +[dependencies] +anchor-lang = "0.29.0" diff --git a/tests/misc/programs/overflow-checks/Xargo.toml b/tests/misc/programs/overflow-checks/Xargo.toml new file mode 100644 index 0000000000..475fb71ed1 --- /dev/null +++ b/tests/misc/programs/overflow-checks/Xargo.toml @@ -0,0 +1,2 @@ +[target.bpfel-unknown-unknown.dependencies.std] +features = [] diff --git a/tests/misc/programs/overflow-checks/src/lib.rs b/tests/misc/programs/overflow-checks/src/lib.rs new file mode 100644 index 0000000000..c032b00d3e --- /dev/null +++ b/tests/misc/programs/overflow-checks/src/lib.rs @@ -0,0 +1,138 @@ +use anchor_lang::prelude::*; + +declare_id!("overf1owChecks11111111111111111111111111111"); + +#[program] +pub mod overflow_checks { + use super::*; + + pub fn initialize(ctx: Context) -> Result<()> { + *ctx.accounts.account = OverflowAccount { + i8_left: i8::MIN, + i8_right: i8::MAX, + i16_left: i16::MIN, + i16_right: i16::MAX, + i32_left: i32::MIN, + i32_right: i32::MAX, + i64_left: i64::MIN, + i64_right: i64::MAX, + i128_left: i128::MIN, + i128_right: i128::MAX, + u8_left: u8::MIN, + u8_right: u8::MAX, + u16_left: u16::MIN, + u16_right: u16::MAX, + u32_left: u32::MIN, + u32_right: u32::MAX, + u64_left: u64::MIN, + u64_right: u64::MAX, + u128_left: u128::MIN, + u128_right: u128::MAX, + }; + + Ok(()) + } + + pub fn test_overflow_add(ctx: Context) -> Result<()> { + let account = &mut ctx.accounts.account; + account.i8_right += 1; + account.i16_right += 1; + account.i32_right += 1; + account.i64_right += 1; + account.i128_right += 1; + + account.u8_right += 1; + account.u16_right += 1; + account.u32_right += 1; + account.u64_right += 1; + account.u128_right += 1; + + Ok(()) + } + + pub fn test_overflow_sub(ctx: Context) -> Result<()> { + let account = &mut ctx.accounts.account; + account.i8_left -= 1; + account.i16_left -= 1; + account.i32_left -= 1; + account.i64_left -= 1; + account.i128_left -= 1; + + account.u8_left -= 1; + account.u16_left -= 1; + account.u32_left -= 1; + account.u64_left -= 1; + account.u128_left -= 1; + + Ok(()) + } + + pub fn test_overflow_mul(ctx: Context) -> Result<()> { + let account = &mut ctx.accounts.account; + account.i8_right *= 2; + account.i16_right *= 2; + account.i32_right *= 2; + account.i64_right *= 2; + account.i128_right *= 2; + + account.u8_right *= 2; + account.u16_right *= 2; + account.u32_right *= 2; + account.u64_right *= 2; + account.u128_right *= 2; + + Ok(()) + } +} + +#[derive(Accounts)] +pub struct Initialize<'info> { + #[account(init, payer = payer, space = 8 + OverflowAccount::INIT_SPACE)] + pub account: Account<'info, OverflowAccount>, + #[account(mut)] + pub payer: Signer<'info>, + pub system_program: Program<'info, System>, +} + +#[derive(Accounts)] +pub struct TestOverflowAdd<'info> { + #[account(mut)] + pub account: Account<'info, OverflowAccount>, +} + +#[derive(Accounts)] +pub struct TestOverflowSub<'info> { + #[account(mut)] + pub account: Account<'info, OverflowAccount>, +} + +#[derive(Accounts)] +pub struct TestOverflowMul<'info> { + #[account(mut)] + pub account: Account<'info, OverflowAccount>, +} + +#[account] +#[derive(InitSpace)] +pub struct OverflowAccount { + pub i8_left: i8, + pub i8_right: i8, + pub i16_left: i16, + pub i16_right: i16, + pub i32_left: i32, + pub i32_right: i32, + pub i64_left: i64, + pub i64_right: i64, + pub i128_left: i128, + pub i128_right: i128, + pub u8_left: u8, + pub u8_right: u8, + pub u16_left: u16, + pub u16_right: u16, + pub u32_left: u32, + pub u32_right: u32, + pub u64_left: u64, + pub u64_right: u64, + pub u128_left: u128, + pub u128_right: u128, +} diff --git a/tests/misc/tests/overflow-checks/Test.toml b/tests/misc/tests/overflow-checks/Test.toml new file mode 100644 index 0000000000..c3ab60a025 --- /dev/null +++ b/tests/misc/tests/overflow-checks/Test.toml @@ -0,0 +1,2 @@ +[scripts] +test = "yarn run ts-mocha -t 1000000 ./tests/overflow-checks/*.ts" diff --git a/tests/misc/tests/overflow-checks/overflow-checks.ts b/tests/misc/tests/overflow-checks/overflow-checks.ts new file mode 100644 index 0000000000..8d08c271d2 --- /dev/null +++ b/tests/misc/tests/overflow-checks/overflow-checks.ts @@ -0,0 +1,79 @@ +import * as anchor from "@coral-xyz/anchor"; + +import { OverflowChecks, IDL } from "../../target/types/overflow_checks"; + +describe(IDL.name, () => { + anchor.setProvider(anchor.AnchorProvider.env()); + + const program = anchor.workspace + .OverflowChecks as anchor.Program; + + const accountKp = anchor.web3.Keypair.generate(); + const testOverflow = async (method: keyof typeof program["methods"]) => { + try { + await program.methods[method]() + .accounts({ + account: accountKp.publicKey, + }) + .rpc(); + } catch (e) { + if (e.logs.some((log) => log.includes("with overflow"))) return; + throw e; + } + + throw new Error("Did not panic on overflow"); + }; + + before(async () => { + await program.methods + .initialize() + .accounts({ + account: accountKp.publicKey, + payer: program.provider.publicKey, + }) + .signers([accountKp]) + .rpc(); + }); + + it("Panics on overflow add", async () => { + await testOverflow("testOverflowAdd"); + }); + + it("Panics on overflow sub", async () => { + await testOverflow("testOverflowSub"); + }); + + it("Panics on overflow mul", async () => { + await testOverflow("testOverflowMul"); + }); + + it("Fails to build when `overflow-checks` is not explicitly specified", async () => { + const fs = await import("fs/promises"); + const cargoToml = await fs.readFile("Cargo.toml", { encoding: "utf8" }); + const CHECK = "overflow-checks = true"; + const COMMENTED_CHECK = "#" + CHECK; + await fs.writeFile("Cargo.toml", cargoToml.replace(CHECK, COMMENTED_CHECK)); + + const { spawnSync } = await import("child_process"); + const { stderr, status } = spawnSync("anchor", ["build"]); + + try { + if (status === 0) { + throw new Error( + "Did not fail even though `overflow-checks` is not specified" + ); + } + + if (!stderr.includes("Error: `overflow-checks` is not enabled")) { + throw new Error(`Did not throw the correct overflow error:\n${stderr}`); + } + } catch (e) { + throw e; + } finally { + await fs.writeFile( + "Cargo.toml", + cargoToml.replace(COMMENTED_CHECK, CHECK) + ); + } + }); +}); diff --git a/tests/multiple-suites-run-single/Cargo.toml b/tests/multiple-suites-run-single/Cargo.toml index 946f3922e5..97d6280542 100644 --- a/tests/multiple-suites-run-single/Cargo.toml +++ b/tests/multiple-suites-run-single/Cargo.toml @@ -3,3 +3,6 @@ members = [ "programs/*" ] resolver = "2" + +[profile.release] +overflow-checks = true diff --git a/tests/multiple-suites/Cargo.toml b/tests/multiple-suites/Cargo.toml index 946f3922e5..97d6280542 100644 --- a/tests/multiple-suites/Cargo.toml +++ b/tests/multiple-suites/Cargo.toml @@ -3,3 +3,6 @@ members = [ "programs/*" ] resolver = "2" + +[profile.release] +overflow-checks = true diff --git a/tests/multisig/Cargo.toml b/tests/multisig/Cargo.toml index 946f3922e5..97d6280542 100644 --- a/tests/multisig/Cargo.toml +++ b/tests/multisig/Cargo.toml @@ -3,3 +3,6 @@ members = [ "programs/*" ] resolver = "2" + +[profile.release] +overflow-checks = true diff --git a/tests/optional/Cargo.toml b/tests/optional/Cargo.toml index 946f3922e5..97d6280542 100644 --- a/tests/optional/Cargo.toml +++ b/tests/optional/Cargo.toml @@ -3,3 +3,6 @@ members = [ "programs/*" ] resolver = "2" + +[profile.release] +overflow-checks = true diff --git a/tests/pda-derivation/Cargo.toml b/tests/pda-derivation/Cargo.toml index 946f3922e5..97d6280542 100644 --- a/tests/pda-derivation/Cargo.toml +++ b/tests/pda-derivation/Cargo.toml @@ -3,3 +3,6 @@ members = [ "programs/*" ] resolver = "2" + +[profile.release] +overflow-checks = true diff --git a/tests/pyth/Cargo.toml b/tests/pyth/Cargo.toml index 946f3922e5..97d6280542 100644 --- a/tests/pyth/Cargo.toml +++ b/tests/pyth/Cargo.toml @@ -3,3 +3,6 @@ members = [ "programs/*" ] resolver = "2" + +[profile.release] +overflow-checks = true diff --git a/tests/realloc/Cargo.toml b/tests/realloc/Cargo.toml index 946f3922e5..97d6280542 100644 --- a/tests/realloc/Cargo.toml +++ b/tests/realloc/Cargo.toml @@ -3,3 +3,6 @@ members = [ "programs/*" ] resolver = "2" + +[profile.release] +overflow-checks = true diff --git a/tests/relations-derivation/Cargo.toml b/tests/relations-derivation/Cargo.toml index 946f3922e5..97d6280542 100644 --- a/tests/relations-derivation/Cargo.toml +++ b/tests/relations-derivation/Cargo.toml @@ -3,3 +3,6 @@ members = [ "programs/*" ] resolver = "2" + +[profile.release] +overflow-checks = true diff --git a/tests/relations-derivation/programs/relations-derivation/src/lib.rs b/tests/relations-derivation/programs/relations-derivation/src/lib.rs index c36cabd840..c2bf74af0f 100644 --- a/tests/relations-derivation/programs/relations-derivation/src/lib.rs +++ b/tests/relations-derivation/programs/relations-derivation/src/lib.rs @@ -5,6 +5,8 @@ use anchor_lang::prelude::*; declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"); +pub const SEED: &[u8] = b"contant-seed"; + #[program] pub mod relations_derivation { use super::*; @@ -17,6 +19,9 @@ pub mod relations_derivation { pub fn test_relation(_ctx: Context) -> Result<()> { Ok(()) } + pub fn test_seed_constant(_ctx: Context) -> Result<()> { + Ok(()) + } } #[derive(Accounts)] @@ -60,6 +65,21 @@ pub struct TestRelation<'info> { nested: Nested<'info>, } +#[derive(Accounts)] +pub struct TestSeedConstant<'info> { + #[account(mut)] + my_account: Signer<'info>, + #[account( + init, + payer = my_account, + seeds = [SEED], + space = 100, + bump, + )] + account: Account<'info, MyAccount>, + system_program: Program<'info, System>, +} + #[account] pub struct MyAccount { pub my_account: Pubkey, diff --git a/tests/relations-derivation/tests/typescript.spec.ts b/tests/relations-derivation/tests/typescript.spec.ts index 786e271051..f5d326f974 100644 --- a/tests/relations-derivation/tests/typescript.spec.ts +++ b/tests/relations-derivation/tests/typescript.spec.ts @@ -40,4 +40,8 @@ describe("typescript", () => { await tx.rpc(); }); + + it("Can use relations derivation with seed constant", async () => { + await program.methods.testSeedConstant().accounts({}).rpc(); + }); }); diff --git a/tests/safety-checks/Cargo.toml b/tests/safety-checks/Cargo.toml index 946f3922e5..97d6280542 100644 --- a/tests/safety-checks/Cargo.toml +++ b/tests/safety-checks/Cargo.toml @@ -3,3 +3,6 @@ members = [ "programs/*" ] resolver = "2" + +[profile.release] +overflow-checks = true diff --git a/tests/spl/token-proxy/Cargo.toml b/tests/spl/token-proxy/Cargo.toml index 946f3922e5..97d6280542 100644 --- a/tests/spl/token-proxy/Cargo.toml +++ b/tests/spl/token-proxy/Cargo.toml @@ -3,3 +3,6 @@ members = [ "programs/*" ] resolver = "2" + +[profile.release] +overflow-checks = true diff --git a/tests/spl/token-proxy/programs/token-proxy/src/lib.rs b/tests/spl/token-proxy/programs/token-proxy/src/lib.rs index 90ae59365d..8f8d6710ed 100644 --- a/tests/spl/token-proxy/programs/token-proxy/src/lib.rs +++ b/tests/spl/token-proxy/programs/token-proxy/src/lib.rs @@ -25,9 +25,9 @@ mod token_proxy { if let Some(token_program) = &ctx.accounts.token_program { if let Some(mint) = &ctx.accounts.mint { let cpi_accounts = TransferChecked { - from: ctx.accounts.from.to_account_info().clone(), - mint: mint.to_account_info().clone(), - to: ctx.accounts.to.to_account_info().clone(), + from: ctx.accounts.from.to_account_info(), + mint: mint.to_account_info(), + to: ctx.accounts.to.to_account_info(), authority: ctx.accounts.authority.clone(), }; let cpi_program = token_program.to_account_info(); @@ -35,8 +35,8 @@ mod token_proxy { token_interface::transfer_checked(cpi_context, amount, mint.decimals) } else { let cpi_accounts = Transfer { - from: ctx.accounts.from.to_account_info().clone(), - to: ctx.accounts.to.to_account_info().clone(), + from: ctx.accounts.from.to_account_info(), + to: ctx.accounts.to.to_account_info(), authority: ctx.accounts.authority.clone(), }; let cpi_program = token_program.to_account_info(); @@ -208,8 +208,8 @@ impl<'a, 'b, 'c, 'info> From<&mut ProxyTransfer<'info>> { fn from(accounts: &mut ProxyTransfer<'info>) -> CpiContext<'a, 'b, 'c, 'info, Transfer<'info>> { let cpi_accounts = Transfer { - from: accounts.from.to_account_info().clone(), - to: accounts.to.to_account_info().clone(), + from: accounts.from.to_account_info(), + to: accounts.to.to_account_info(), authority: accounts.authority.clone(), }; let cpi_program = accounts.token_program.to_account_info(); @@ -222,8 +222,8 @@ impl<'a, 'b, 'c, 'info> From<&mut ProxyMintTo<'info>> { fn from(accounts: &mut ProxyMintTo<'info>) -> CpiContext<'a, 'b, 'c, 'info, MintTo<'info>> { let cpi_accounts = MintTo { - mint: accounts.mint.to_account_info().clone(), - to: accounts.to.to_account_info().clone(), + mint: accounts.mint.to_account_info(), + to: accounts.to.to_account_info(), authority: accounts.authority.clone(), }; let cpi_program = accounts.token_program.to_account_info(); @@ -234,8 +234,8 @@ impl<'a, 'b, 'c, 'info> From<&mut ProxyMintTo<'info>> impl<'a, 'b, 'c, 'info> From<&mut ProxyBurn<'info>> for CpiContext<'a, 'b, 'c, 'info, Burn<'info>> { fn from(accounts: &mut ProxyBurn<'info>) -> CpiContext<'a, 'b, 'c, 'info, Burn<'info>> { let cpi_accounts = Burn { - mint: accounts.mint.to_account_info().clone(), - from: accounts.from.to_account_info().clone(), + mint: accounts.mint.to_account_info(), + from: accounts.from.to_account_info(), authority: accounts.authority.clone(), }; let cpi_program = accounts.token_program.to_account_info(); diff --git a/tests/spl/token-wrapper/Cargo.toml b/tests/spl/token-wrapper/Cargo.toml index 946f3922e5..97d6280542 100644 --- a/tests/spl/token-wrapper/Cargo.toml +++ b/tests/spl/token-wrapper/Cargo.toml @@ -3,3 +3,6 @@ members = [ "programs/*" ] resolver = "2" + +[profile.release] +overflow-checks = true diff --git a/tests/swap/Cargo.toml b/tests/swap/Cargo.toml index c0e75bd2ec..f18651139d 100644 --- a/tests/swap/Cargo.toml +++ b/tests/swap/Cargo.toml @@ -6,3 +6,6 @@ exclude = [ "deps/openbook-dex" ] resolver = "2" + +[profile.release] +overflow-checks = true diff --git a/tests/system-accounts/Cargo.toml b/tests/system-accounts/Cargo.toml index 946f3922e5..97d6280542 100644 --- a/tests/system-accounts/Cargo.toml +++ b/tests/system-accounts/Cargo.toml @@ -3,3 +3,6 @@ members = [ "programs/*" ] resolver = "2" + +[profile.release] +overflow-checks = true diff --git a/tests/sysvars/Cargo.toml b/tests/sysvars/Cargo.toml index 946f3922e5..97d6280542 100644 --- a/tests/sysvars/Cargo.toml +++ b/tests/sysvars/Cargo.toml @@ -3,3 +3,6 @@ members = [ "programs/*" ] resolver = "2" + +[profile.release] +overflow-checks = true diff --git a/tests/tictactoe/Cargo.toml b/tests/tictactoe/Cargo.toml index 946f3922e5..97d6280542 100644 --- a/tests/tictactoe/Cargo.toml +++ b/tests/tictactoe/Cargo.toml @@ -3,3 +3,6 @@ members = [ "programs/*" ] resolver = "2" + +[profile.release] +overflow-checks = true diff --git a/tests/typescript/Cargo.toml b/tests/typescript/Cargo.toml index 946f3922e5..97d6280542 100644 --- a/tests/typescript/Cargo.toml +++ b/tests/typescript/Cargo.toml @@ -3,3 +3,6 @@ members = [ "programs/*" ] resolver = "2" + +[profile.release] +overflow-checks = true diff --git a/tests/validator-clone/Cargo.toml b/tests/validator-clone/Cargo.toml index 946f3922e5..97d6280542 100644 --- a/tests/validator-clone/Cargo.toml +++ b/tests/validator-clone/Cargo.toml @@ -3,3 +3,6 @@ members = [ "programs/*" ] resolver = "2" + +[profile.release] +overflow-checks = true diff --git a/tests/zero-copy/Cargo.toml b/tests/zero-copy/Cargo.toml index 946f3922e5..97d6280542 100644 --- a/tests/zero-copy/Cargo.toml +++ b/tests/zero-copy/Cargo.toml @@ -3,3 +3,6 @@ members = [ "programs/*" ] resolver = "2" + +[profile.release] +overflow-checks = true diff --git a/ts/packages/anchor/src/provider.ts b/ts/packages/anchor/src/provider.ts index c0b2a58e9f..0731732ebb 100644 --- a/ts/packages/anchor/src/provider.ts +++ b/ts/packages/anchor/src/provider.ts @@ -89,7 +89,7 @@ export class AnchorProvider implements Provider { } opts = opts ?? AnchorProvider.defaultOptions(); const connection = new Connection( - url ?? "http://localhost:8899", + url ?? "http://127.0.0.1:8899", opts.preflightCommitment ); const NodeWallet = require("./nodewallet.js").default; diff --git a/ts/packages/anchor/src/utils/features.ts b/ts/packages/anchor/src/utils/features.ts index 246b2b99aa..2dae4fc368 100644 --- a/ts/packages/anchor/src/utils/features.ts +++ b/ts/packages/anchor/src/utils/features.ts @@ -1,4 +1,4 @@ -const _AVAILABLE_FEATURES = new Set(["anchor-deprecated-state", "debug-logs"]); +const _AVAILABLE_FEATURES = new Set(["debug-logs"]); const _FEATURES = new Map();