Selaa lähdekoodia

cli: Require explicit `overflow-checks` flag (#2716)

acheron 1 vuosi sitten
vanhempi
sitoutus
a423f7855b
55 muutettua tiedostoa jossa 1116 lisäystä ja 720 poistoa
  1. 1 0
      CHANGELOG.md
  2. 6 6
      bench/BINARY_SIZE.md
  3. 348 348
      bench/COMPUTE_UNITS.md
  4. 22 0
      cli/src/checks.rs
  5. 4 5
      cli/src/config.rs
  6. 15 8
      cli/src/lib.rs
  7. 3 0
      examples/tutorial/basic-0/Cargo.toml
  8. 3 0
      examples/tutorial/basic-1/Cargo.toml
  9. 3 0
      examples/tutorial/basic-2/Cargo.toml
  10. 3 0
      examples/tutorial/basic-3/Cargo.toml
  11. 3 0
      examples/tutorial/basic-4/Cargo.toml
  12. 4 1
      examples/tutorial/basic-5/Cargo.toml
  13. 3 0
      tests/auction-house/Cargo.toml
  14. 3 0
      tests/bench/Cargo.toml
  15. 352 352
      tests/bench/bench.json
  16. 3 0
      tests/bpf-upgradeable-state/Cargo.toml
  17. 3 0
      tests/cashiers-check/Cargo.toml
  18. 3 0
      tests/cfo/Cargo.toml
  19. 3 0
      tests/chat/Cargo.toml
  20. 3 0
      tests/composite/Cargo.toml
  21. 3 0
      tests/cpi-returns/Cargo.toml
  22. 3 0
      tests/custom-coder/Cargo.toml
  23. 3 0
      tests/declare-id/Cargo.toml
  24. 3 0
      tests/docs/Cargo.toml
  25. 3 0
      tests/errors/Cargo.toml
  26. 3 0
      tests/escrow/Cargo.toml
  27. 3 0
      tests/events/Cargo.toml
  28. 3 0
      tests/floats/Cargo.toml
  29. 3 0
      tests/ido-pool/Cargo.toml
  30. 3 0
      tests/lockup/Cargo.toml
  31. 1 0
      tests/misc/Anchor.toml
  32. 3 0
      tests/misc/Cargo.toml
  33. 19 0
      tests/misc/programs/overflow-checks/Cargo.toml
  34. 2 0
      tests/misc/programs/overflow-checks/Xargo.toml
  35. 138 0
      tests/misc/programs/overflow-checks/src/lib.rs
  36. 2 0
      tests/misc/tests/overflow-checks/Test.toml
  37. 79 0
      tests/misc/tests/overflow-checks/overflow-checks.ts
  38. 3 0
      tests/multiple-suites-run-single/Cargo.toml
  39. 3 0
      tests/multiple-suites/Cargo.toml
  40. 3 0
      tests/multisig/Cargo.toml
  41. 3 0
      tests/optional/Cargo.toml
  42. 3 0
      tests/pda-derivation/Cargo.toml
  43. 3 0
      tests/pyth/Cargo.toml
  44. 3 0
      tests/realloc/Cargo.toml
  45. 3 0
      tests/relations-derivation/Cargo.toml
  46. 3 0
      tests/safety-checks/Cargo.toml
  47. 3 0
      tests/spl/token-proxy/Cargo.toml
  48. 3 0
      tests/spl/token-wrapper/Cargo.toml
  49. 3 0
      tests/swap/Cargo.toml
  50. 3 0
      tests/system-accounts/Cargo.toml
  51. 3 0
      tests/sysvars/Cargo.toml
  52. 3 0
      tests/tictactoe/Cargo.toml
  53. 3 0
      tests/typescript/Cargo.toml
  54. 3 0
      tests/validator-clone/Cargo.toml
  55. 3 0
      tests/zero-copy/Cargo.toml

+ 1 - 0
CHANGELOG.md

@@ -28,6 +28,7 @@ The minor version will be incremented upon a breaking change and the patch versi
 ### 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)).
 
 ## [0.29.0] - 2023-10-16
 

+ 6 - 6
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 |
 
 ---

+ 348 - 348
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 |
 
 ---

+ 22 - 0
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<Path>) -> Result<bool> {
+    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.",
+        ))
+}

+ 4 - 5
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;
                     }
                 }

+ 15 - 8
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;
@@ -49,6 +50,7 @@ use std::str::FromStr;
 use std::string::ToString;
 use tar::Archive;
 
+mod checks;
 pub mod config;
 pub mod rust_template;
 pub mod solidity_template;
@@ -1183,15 +1185,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)),
@@ -1205,10 +1205,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(

+ 3 - 0
examples/tutorial/basic-0/Cargo.toml

@@ -2,3 +2,6 @@
 members = [
   "programs/*"
 ]
+
+[profile.release]
+overflow-checks = true

+ 3 - 0
examples/tutorial/basic-1/Cargo.toml

@@ -2,3 +2,6 @@
 members = [
   "programs/*"
 ]
+
+[profile.release]
+overflow-checks = true

+ 3 - 0
examples/tutorial/basic-2/Cargo.toml

@@ -2,3 +2,6 @@
 members = [
   "programs/*"
 ]
+
+[profile.release]
+overflow-checks = true

+ 3 - 0
examples/tutorial/basic-3/Cargo.toml

@@ -2,3 +2,6 @@
 members = [
     "programs/*"
 ]
+
+[profile.release]
+overflow-checks = true

+ 3 - 0
examples/tutorial/basic-4/Cargo.toml

@@ -2,3 +2,6 @@
 members = [
     "programs/*"
 ]
+
+[profile.release]
+overflow-checks = true

+ 4 - 1
examples/tutorial/basic-5/Cargo.toml

@@ -1,4 +1,7 @@
 [workspace]
 members = [
     "programs/*"
-]
+]
+
+[profile.release]
+overflow-checks = true

+ 3 - 0
tests/auction-house/Cargo.toml

@@ -3,3 +3,6 @@ members = [
     "programs/*"
 ]
 resolver = "2"
+
+[profile.release]
+overflow-checks = true

+ 3 - 0
tests/bench/Cargo.toml

@@ -3,3 +3,6 @@ members = [
     "programs/*"
 ]
 resolver = "2"
+
+[profile.release]
+overflow-checks = true

+ 352 - 352
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,

+ 3 - 0
tests/bpf-upgradeable-state/Cargo.toml

@@ -3,3 +3,6 @@ members = [
     "programs/*"
 ]
 resolver = "2"
+
+[profile.release]
+overflow-checks = true

+ 3 - 0
tests/cashiers-check/Cargo.toml

@@ -3,3 +3,6 @@ members = [
     "programs/*"
 ]
 resolver = "2"
+
+[profile.release]
+overflow-checks = true

+ 3 - 0
tests/cfo/Cargo.toml

@@ -8,3 +8,6 @@ exclude = [
     "deps/swap"
 ]
 resolver = "2"
+
+[profile.release]
+overflow-checks = true

+ 3 - 0
tests/chat/Cargo.toml

@@ -3,3 +3,6 @@ members = [
     "programs/*"
 ]
 resolver = "2"
+
+[profile.release]
+overflow-checks = true

+ 3 - 0
tests/composite/Cargo.toml

@@ -3,3 +3,6 @@ members = [
     "programs/*"
 ]
 resolver = "2"
+
+[profile.release]
+overflow-checks = true

+ 3 - 0
tests/cpi-returns/Cargo.toml

@@ -3,3 +3,6 @@ members = [
     "programs/*"
 ]
 resolver = "2"
+
+[profile.release]
+overflow-checks = true

+ 3 - 0
tests/custom-coder/Cargo.toml

@@ -3,3 +3,6 @@ members = [
     "programs/*"
 ]
 resolver = "2"
+
+[profile.release]
+overflow-checks = true

+ 3 - 0
tests/declare-id/Cargo.toml

@@ -3,3 +3,6 @@ members = [
     "programs/*"
 ]
 resolver = "2"
+
+[profile.release]
+overflow-checks = true

+ 3 - 0
tests/docs/Cargo.toml

@@ -3,3 +3,6 @@ members = [
     "programs/*"
 ]
 resolver = "2"
+
+[profile.release]
+overflow-checks = true

+ 3 - 0
tests/errors/Cargo.toml

@@ -3,3 +3,6 @@ members = [
     "programs/*"
 ]
 resolver = "2"
+
+[profile.release]
+overflow-checks = true

+ 3 - 0
tests/escrow/Cargo.toml

@@ -3,3 +3,6 @@ members = [
     "programs/*"
 ]
 resolver = "2"
+
+[profile.release]
+overflow-checks = true

+ 3 - 0
tests/events/Cargo.toml

@@ -3,3 +3,6 @@ members = [
     "programs/*"
 ]
 resolver = "2"
+
+[profile.release]
+overflow-checks = true

+ 3 - 0
tests/floats/Cargo.toml

@@ -3,3 +3,6 @@ members = [
     "programs/*"
 ]
 resolver = "2"
+
+[profile.release]
+overflow-checks = true

+ 3 - 0
tests/ido-pool/Cargo.toml

@@ -3,3 +3,6 @@ members = [
     "programs/*"
 ]
 resolver = "2"
+
+[profile.release]
+overflow-checks = true

+ 3 - 0
tests/lockup/Cargo.toml

@@ -3,3 +3,6 @@ members = [
     "programs/*"
 ]
 resolver = "2"
+
+[profile.release]
+overflow-checks = true

+ 1 - 0
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]

+ 3 - 0
tests/misc/Cargo.toml

@@ -3,3 +3,6 @@ members = [
     "programs/*"
 ]
 resolver = "2"
+
+[profile.release]
+overflow-checks = true

+ 19 - 0
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"

+ 2 - 0
tests/misc/programs/overflow-checks/Xargo.toml

@@ -0,0 +1,2 @@
+[target.bpfel-unknown-unknown.dependencies.std]
+features = []

+ 138 - 0
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<Initialize>) -> 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<TestOverflowAdd>) -> 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<TestOverflowSub>) -> 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<TestOverflowMul>) -> 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,
+}

+ 2 - 0
tests/misc/tests/overflow-checks/Test.toml

@@ -0,0 +1,2 @@
+[scripts]
+test = "yarn run ts-mocha -t 1000000 ./tests/overflow-checks/*.ts"

+ 79 - 0
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<OverflowChecks>;
+
+  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)
+      );
+    }
+  });
+});

+ 3 - 0
tests/multiple-suites-run-single/Cargo.toml

@@ -3,3 +3,6 @@ members = [
     "programs/*"
 ]
 resolver = "2"
+
+[profile.release]
+overflow-checks = true

+ 3 - 0
tests/multiple-suites/Cargo.toml

@@ -3,3 +3,6 @@ members = [
     "programs/*"
 ]
 resolver = "2"
+
+[profile.release]
+overflow-checks = true

+ 3 - 0
tests/multisig/Cargo.toml

@@ -3,3 +3,6 @@ members = [
     "programs/*"
 ]
 resolver = "2"
+
+[profile.release]
+overflow-checks = true

+ 3 - 0
tests/optional/Cargo.toml

@@ -3,3 +3,6 @@ members = [
     "programs/*"
 ]
 resolver = "2"
+
+[profile.release]
+overflow-checks = true

+ 3 - 0
tests/pda-derivation/Cargo.toml

@@ -3,3 +3,6 @@ members = [
     "programs/*"
 ]
 resolver = "2"
+
+[profile.release]
+overflow-checks = true

+ 3 - 0
tests/pyth/Cargo.toml

@@ -3,3 +3,6 @@ members = [
     "programs/*"
 ]
 resolver = "2"
+
+[profile.release]
+overflow-checks = true

+ 3 - 0
tests/realloc/Cargo.toml

@@ -3,3 +3,6 @@ members = [
     "programs/*"
 ]
 resolver = "2"
+
+[profile.release]
+overflow-checks = true

+ 3 - 0
tests/relations-derivation/Cargo.toml

@@ -3,3 +3,6 @@ members = [
     "programs/*"
 ]
 resolver = "2"
+
+[profile.release]
+overflow-checks = true

+ 3 - 0
tests/safety-checks/Cargo.toml

@@ -3,3 +3,6 @@ members = [
     "programs/*"
 ]
 resolver = "2"
+
+[profile.release]
+overflow-checks = true

+ 3 - 0
tests/spl/token-proxy/Cargo.toml

@@ -3,3 +3,6 @@ members = [
     "programs/*"
 ]
 resolver = "2"
+
+[profile.release]
+overflow-checks = true

+ 3 - 0
tests/spl/token-wrapper/Cargo.toml

@@ -3,3 +3,6 @@ members = [
     "programs/*"
 ]
 resolver = "2"
+
+[profile.release]
+overflow-checks = true

+ 3 - 0
tests/swap/Cargo.toml

@@ -6,3 +6,6 @@ exclude = [
     "deps/openbook-dex"
 ]
 resolver = "2"
+
+[profile.release]
+overflow-checks = true

+ 3 - 0
tests/system-accounts/Cargo.toml

@@ -3,3 +3,6 @@ members = [
     "programs/*"
 ]
 resolver = "2"
+
+[profile.release]
+overflow-checks = true

+ 3 - 0
tests/sysvars/Cargo.toml

@@ -3,3 +3,6 @@ members = [
     "programs/*"
 ]
 resolver = "2"
+
+[profile.release]
+overflow-checks = true

+ 3 - 0
tests/tictactoe/Cargo.toml

@@ -3,3 +3,6 @@ members = [
     "programs/*"
 ]
 resolver = "2"
+
+[profile.release]
+overflow-checks = true

+ 3 - 0
tests/typescript/Cargo.toml

@@ -3,3 +3,6 @@ members = [
     "programs/*"
 ]
 resolver = "2"
+
+[profile.release]
+overflow-checks = true

+ 3 - 0
tests/validator-clone/Cargo.toml

@@ -3,3 +3,6 @@ members = [
     "programs/*"
 ]
 resolver = "2"
+
+[profile.release]
+overflow-checks = true

+ 3 - 0
tests/zero-copy/Cargo.toml

@@ -3,3 +3,6 @@ members = [
     "programs/*"
 ]
 resolver = "2"
+
+[profile.release]
+overflow-checks = true