Skip to content

Commit 18d0ca0

Browse files
jamie-osecdeanmlittleswaroop-osec
authored
feat: Use solana-invoke insteam of solana_cpi::invoke (#3900)
* Use `solana-invoke` insteam of `solana_cpi::invoke` Co-authored-by: deanmlittle <dean@bitping.com> * chore(bench): Update benchmarks --------- Co-authored-by: deanmlittle <dean@bitping.com> Co-authored-by: swaroop-osec <swaroop@osec.io>
1 parent 8dff73e commit 18d0ca0

File tree

7 files changed

+166
-119
lines changed

7 files changed

+166
-119
lines changed

Cargo.lock

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bench/COMPUTE_UNITS.md

Lines changed: 89 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -16,95 +16,95 @@ The programs and their tests are located in [/tests/bench](https://github.com/co
1616

1717
Solana version: 2.1.0
1818

19-
| Instruction | Compute Units | - |
20-
| --------------------------- | ------------- | --- |
21-
| accountInfo1 | 571 | - |
22-
| accountInfo2 | 895 | - |
23-
| accountInfo4 | 1,553 | - |
24-
| accountInfo8 | 2,923 | - |
25-
| accountEmptyInit1 | 5,083 | - |
26-
| accountEmpty1 | 645 | - |
27-
| accountEmptyInit2 | 9,301 | - |
28-
| accountEmpty2 | 1,007 | - |
29-
| accountEmptyInit4 | 17,764 | - |
30-
| accountEmpty4 | 1,724 | - |
31-
| accountEmptyInit8 | 34,723 | - |
32-
| accountEmpty8 | 3,163 | - |
33-
| accountSizedInit1 | 5,192 | - |
34-
| accountSized1 | 693 | - |
35-
| accountSizedInit2 | 9,489 | - |
36-
| accountSized2 | 1,075 | - |
37-
| accountSizedInit4 | 18,170 | - |
38-
| accountSized4 | 1,848 | - |
39-
| accountSizedInit8 | 35,433 | - |
40-
| accountSized8 | 3,387 | - |
41-
| accountUnsizedInit1 | 5,305 | - |
42-
| accountUnsized1 | 746 | - |
43-
| accountUnsizedInit2 | 9,759 | - |
44-
| accountUnsized2 | 1,163 | - |
45-
| accountUnsizedInit4 | 18,603 | - |
46-
| accountUnsized4 | 2,002 | - |
47-
| accountUnsizedInit8 | 35,993 | - |
48-
| accountUnsized8 | 3,673 | - |
49-
| boxedAccountEmptyInit1 | 5,175 | - |
50-
| boxedAccountEmpty1 | 734 | - |
51-
| boxedAccountEmptyInit2 | 9,414 | - |
52-
| boxedAccountEmpty2 | 1,116 | - |
53-
| boxedAccountEmptyInit4 | 17,918 | - |
54-
| boxedAccountEmpty4 | 1,872 | - |
55-
| boxedAccountEmptyInit8 | 34,953 | - |
56-
| boxedAccountEmpty8 | 3,401 | - |
57-
| boxedAccountSizedInit1 | 5,271 | - |
58-
| boxedAccountSized1 | 783 | - |
59-
| boxedAccountSizedInit2 | 9,583 | - |
60-
| boxedAccountSized2 | 1,190 | - |
61-
| boxedAccountSizedInit4 | 18,230 | - |
62-
| boxedAccountSized4 | 1,996 | - |
63-
| boxedAccountSizedInit8 | 35,553 | - |
64-
| boxedAccountSized8 | 3,628 | - |
65-
| boxedAccountUnsizedInit1 | 5,371 | - |
66-
| boxedAccountUnsized1 | 836 | - |
67-
| boxedAccountUnsizedInit2 | 9,759 | - |
68-
| boxedAccountUnsized2 | 1,270 | - |
69-
| boxedAccountUnsizedInit4 | 18,558 | - |
70-
| boxedAccountUnsized4 | 2,132 | - |
71-
| boxedAccountUnsizedInit8 | 36,185 | - |
72-
| boxedAccountUnsized8 | 3,881 | - |
73-
| boxedInterfaceAccountMint1 | 1,351 | - |
74-
| boxedInterfaceAccountMint2 | 2,123 | - |
75-
| boxedInterfaceAccountMint4 | 3,656 | - |
76-
| boxedInterfaceAccountMint8 | 6,738 | - |
77-
| boxedInterfaceAccountToken1 | 2,011 | - |
78-
| boxedInterfaceAccountToken2 | 3,431 | - |
79-
| boxedInterfaceAccountToken4 | 6,260 | - |
80-
| boxedInterfaceAccountToken8 | 11,934 | - |
81-
| interfaceAccountMint1 | 1,476 | - |
82-
| interfaceAccountMint2 | 2,489 | - |
83-
| interfaceAccountMint4 | 4,511 | - |
84-
| interfaceAccountMint8 | 8,550 | - |
85-
| interfaceAccountToken1 | 2,111 | - |
86-
| interfaceAccountToken2 | 3,729 | - |
87-
| interfaceAccountToken4 | 6,955 | - |
88-
| interface1 | 769 | - |
89-
| interface2 | 912 | - |
90-
| interface4 | 1,189 | - |
91-
| interface8 | 1,748 | - |
92-
| program1 | 779 | - |
93-
| program2 | 920 | - |
94-
| program4 | 1,193 | - |
95-
| program8 | 1,744 | - |
96-
| signer1 | 774 | - |
97-
| signer2 | 1,064 | - |
98-
| signer4 | 1,637 | - |
99-
| signer8 | 2,788 | - |
100-
| systemAccount1 | 796 | - |
101-
| systemAccount2 | 1,096 | - |
102-
| systemAccount4 | 1,689 | - |
103-
| systemAccount8 | 2,880 | - |
104-
| uncheckedAccount1 | 783 | - |
105-
| uncheckedAccount2 | 1,056 | - |
106-
| uncheckedAccount4 | 1,594 | - |
107-
| uncheckedAccount8 | 2,679 | - |
19+
| Instruction | Compute Units | - |
20+
| --------------------------- | ------------- | --------------------- |
21+
| accountInfo1 | 571 | - |
22+
| accountInfo2 | 895 | - |
23+
| accountInfo4 | 1,553 | - |
24+
| accountInfo8 | 2,923 | - |
25+
| accountEmptyInit1 | 4,829 | 🟢 **-254 (5.00%)** |
26+
| accountEmpty1 | 645 | - |
27+
| accountEmptyInit2 | 8,793 | 🟢 **-508 (5.46%)** |
28+
| accountEmpty2 | 1,007 | - |
29+
| accountEmptyInit4 | 16,748 | 🟢 **-1,016 (5.72%)** |
30+
| accountEmpty4 | 1,724 | - |
31+
| accountEmptyInit8 | 32,691 | 🟢 **-2,032 (5.85%)** |
32+
| accountEmpty8 | 3,163 | - |
33+
| accountSizedInit1 | 4,938 | 🟢 **-254 (4.89%)** |
34+
| accountSized1 | 693 | - |
35+
| accountSizedInit2 | 8,981 | 🟢 **-508 (5.35%)** |
36+
| accountSized2 | 1,075 | - |
37+
| accountSizedInit4 | 17,154 | 🟢 **-1,016 (5.59%)** |
38+
| accountSized4 | 1,848 | - |
39+
| accountSizedInit8 | 33,401 | 🟢 **-2,032 (5.73%)** |
40+
| accountSized8 | 3,387 | - |
41+
| accountUnsizedInit1 | 5,051 | 🟢 **-254 (4.79%)** |
42+
| accountUnsized1 | 746 | - |
43+
| accountUnsizedInit2 | 9,251 | 🟢 **-508 (5.21%)** |
44+
| accountUnsized2 | 1,163 | - |
45+
| accountUnsizedInit4 | 17,587 | 🟢 **-1,016 (5.46%)** |
46+
| accountUnsized4 | 2,002 | - |
47+
| accountUnsizedInit8 | 33,961 | 🟢 **-2,032 (5.65%)** |
48+
| accountUnsized8 | 3,673 | - |
49+
| boxedAccountEmptyInit1 | 4,921 | 🟢 **-254 (4.91%)** |
50+
| boxedAccountEmpty1 | 734 | - |
51+
| boxedAccountEmptyInit2 | 8,906 | 🟢 **-508 (5.40%)** |
52+
| boxedAccountEmpty2 | 1,116 | - |
53+
| boxedAccountEmptyInit4 | 16,902 | 🟢 **-1,016 (5.67%)** |
54+
| boxedAccountEmpty4 | 1,872 | - |
55+
| boxedAccountEmptyInit8 | 32,921 | 🟢 **-2,032 (5.81%)** |
56+
| boxedAccountEmpty8 | 3,401 | - |
57+
| boxedAccountSizedInit1 | 5,017 | 🟢 **-254 (4.82%)** |
58+
| boxedAccountSized1 | 783 | - |
59+
| boxedAccountSizedInit2 | 9,075 | 🟢 **-508 (5.30%)** |
60+
| boxedAccountSized2 | 1,190 | - |
61+
| boxedAccountSizedInit4 | 17,214 | 🟢 **-1,016 (5.57%)** |
62+
| boxedAccountSized4 | 1,996 | - |
63+
| boxedAccountSizedInit8 | 33,521 | 🟢 **-2,032 (5.72%)** |
64+
| boxedAccountSized8 | 3,628 | - |
65+
| boxedAccountUnsizedInit1 | 5,117 | 🟢 **-254 (4.73%)** |
66+
| boxedAccountUnsized1 | 836 | - |
67+
| boxedAccountUnsizedInit2 | 9,251 | 🟢 **-508 (5.21%)** |
68+
| boxedAccountUnsized2 | 1,270 | - |
69+
| boxedAccountUnsizedInit4 | 17,542 | 🟢 **-1,016 (5.47%)** |
70+
| boxedAccountUnsized4 | 2,132 | - |
71+
| boxedAccountUnsizedInit8 | 34,153 | 🟢 **-2,032 (5.62%)** |
72+
| boxedAccountUnsized8 | 3,881 | - |
73+
| boxedInterfaceAccountMint1 | 1,351 | - |
74+
| boxedInterfaceAccountMint2 | 2,123 | - |
75+
| boxedInterfaceAccountMint4 | 3,656 | - |
76+
| boxedInterfaceAccountMint8 | 6,738 | - |
77+
| boxedInterfaceAccountToken1 | 2,011 | - |
78+
| boxedInterfaceAccountToken2 | 3,431 | - |
79+
| boxedInterfaceAccountToken4 | 6,260 | - |
80+
| boxedInterfaceAccountToken8 | 11,934 | - |
81+
| interfaceAccountMint1 | 1,476 | - |
82+
| interfaceAccountMint2 | 2,489 | - |
83+
| interfaceAccountMint4 | 4,511 | - |
84+
| interfaceAccountMint8 | 8,550 | - |
85+
| interfaceAccountToken1 | 2,111 | - |
86+
| interfaceAccountToken2 | 3,729 | - |
87+
| interfaceAccountToken4 | 6,955 | - |
88+
| interface1 | 769 | - |
89+
| interface2 | 912 | - |
90+
| interface4 | 1,189 | - |
91+
| interface8 | 1,748 | - |
92+
| program1 | 779 | - |
93+
| program2 | 920 | - |
94+
| program4 | 1,193 | - |
95+
| program8 | 1,744 | - |
96+
| signer1 | 774 | - |
97+
| signer2 | 1,064 | - |
98+
| signer4 | 1,637 | - |
99+
| signer8 | 2,788 | - |
100+
| systemAccount1 | 796 | - |
101+
| systemAccount2 | 1,096 | - |
102+
| systemAccount4 | 1,689 | - |
103+
| systemAccount8 | 2,880 | - |
104+
| uncheckedAccount1 | 783 | - |
105+
| uncheckedAccount2 | 1,056 | - |
106+
| uncheckedAccount4 | 1,594 | - |
107+
| uncheckedAccount8 | 2,679 | - |
108108

109109
### Notable changes
110110

lang/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ solana-define-syscall = "2"
6363
solana-feature-gate-interface = "2"
6464
solana-instruction = "2"
6565
solana-instructions-sysvar = "2"
66+
solana-invoke = "0.4.0"
6667
solana-loader-v3-interface = { version = "3", features = ["bincode"] }
6768
solana-msg = "2"
6869
solana-program-entrypoint = "2"

lang/src/lib.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,12 @@ pub mod solana_program {
6767
pub use solana_feature_gate_interface as feature;
6868

6969
pub use {
70-
solana_account_info as account_info, solana_clock as clock, solana_cpi as program,
71-
solana_msg::msg, solana_program_entrypoint as entrypoint,
72-
solana_program_entrypoint::entrypoint, solana_program_error as program_error,
73-
solana_program_memory as program_memory, solana_program_option as program_option,
74-
solana_program_pack as program_pack, solana_pubkey as pubkey,
75-
solana_sdk_ids::system_program, solana_system_interface::instruction as system_instruction,
70+
solana_account_info as account_info, solana_clock as clock, solana_msg::msg,
71+
solana_program_entrypoint as entrypoint, solana_program_entrypoint::entrypoint,
72+
solana_program_error as program_error, solana_program_memory as program_memory,
73+
solana_program_option as program_option, solana_program_pack as program_pack,
74+
solana_pubkey as pubkey, solana_sdk_ids::system_program,
75+
solana_system_interface::instruction as system_instruction,
7676
};
7777
pub mod instruction {
7878
pub use solana_instruction::*;
@@ -94,6 +94,10 @@ pub mod solana_program {
9494
pub mod rent {
9595
pub use solana_sysvar::rent::*;
9696
}
97+
pub mod program {
98+
pub use solana_cpi::*;
99+
pub use solana_invoke::{invoke, invoke_signed, invoke_signed_unchecked, invoke_unchecked};
100+
}
97101

98102
pub mod bpf_loader_upgradeable {
99103
#[allow(deprecated)]

tests/auction-house/Cargo.lock

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/bench/bench.json

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1312,53 +1312,53 @@
13121312
"accountInfo2": 895,
13131313
"accountInfo4": 1553,
13141314
"accountInfo8": 2923,
1315-
"accountEmptyInit1": 5083,
1315+
"accountEmptyInit1": 4829,
13161316
"accountEmpty1": 645,
1317-
"accountEmptyInit2": 9301,
1317+
"accountEmptyInit2": 8793,
13181318
"accountEmpty2": 1007,
1319-
"accountEmptyInit4": 17764,
1319+
"accountEmptyInit4": 16748,
13201320
"accountEmpty4": 1724,
1321-
"accountEmptyInit8": 34723,
1321+
"accountEmptyInit8": 32691,
13221322
"accountEmpty8": 3163,
1323-
"accountSizedInit1": 5192,
1323+
"accountSizedInit1": 4938,
13241324
"accountSized1": 693,
1325-
"accountSizedInit2": 9489,
1325+
"accountSizedInit2": 8981,
13261326
"accountSized2": 1075,
1327-
"accountSizedInit4": 18170,
1327+
"accountSizedInit4": 17154,
13281328
"accountSized4": 1848,
1329-
"accountSizedInit8": 35433,
1329+
"accountSizedInit8": 33401,
13301330
"accountSized8": 3387,
1331-
"accountUnsizedInit1": 5305,
1331+
"accountUnsizedInit1": 5051,
13321332
"accountUnsized1": 746,
1333-
"accountUnsizedInit2": 9759,
1333+
"accountUnsizedInit2": 9251,
13341334
"accountUnsized2": 1163,
1335-
"accountUnsizedInit4": 18603,
1335+
"accountUnsizedInit4": 17587,
13361336
"accountUnsized4": 2002,
1337-
"accountUnsizedInit8": 35993,
1337+
"accountUnsizedInit8": 33961,
13381338
"accountUnsized8": 3673,
1339-
"boxedAccountEmptyInit1": 5175,
1339+
"boxedAccountEmptyInit1": 4921,
13401340
"boxedAccountEmpty1": 734,
1341-
"boxedAccountEmptyInit2": 9414,
1341+
"boxedAccountEmptyInit2": 8906,
13421342
"boxedAccountEmpty2": 1116,
1343-
"boxedAccountEmptyInit4": 17918,
1343+
"boxedAccountEmptyInit4": 16902,
13441344
"boxedAccountEmpty4": 1872,
1345-
"boxedAccountEmptyInit8": 34953,
1345+
"boxedAccountEmptyInit8": 32921,
13461346
"boxedAccountEmpty8": 3401,
1347-
"boxedAccountSizedInit1": 5271,
1347+
"boxedAccountSizedInit1": 5017,
13481348
"boxedAccountSized1": 783,
1349-
"boxedAccountSizedInit2": 9583,
1349+
"boxedAccountSizedInit2": 9075,
13501350
"boxedAccountSized2": 1190,
1351-
"boxedAccountSizedInit4": 18230,
1351+
"boxedAccountSizedInit4": 17214,
13521352
"boxedAccountSized4": 1996,
1353-
"boxedAccountSizedInit8": 35553,
1353+
"boxedAccountSizedInit8": 33521,
13541354
"boxedAccountSized8": 3628,
1355-
"boxedAccountUnsizedInit1": 5371,
1355+
"boxedAccountUnsizedInit1": 5117,
13561356
"boxedAccountUnsized1": 836,
1357-
"boxedAccountUnsizedInit2": 9759,
1357+
"boxedAccountUnsizedInit2": 9251,
13581358
"boxedAccountUnsized2": 1270,
1359-
"boxedAccountUnsizedInit4": 18558,
1359+
"boxedAccountUnsizedInit4": 17542,
13601360
"boxedAccountUnsized4": 2132,
1361-
"boxedAccountUnsizedInit8": 36185,
1361+
"boxedAccountUnsizedInit8": 34153,
13621362
"boxedAccountUnsized8": 3881,
13631363
"boxedInterfaceAccountMint1": 1351,
13641364
"boxedInterfaceAccountMint2": 2123,

tests/spl/metadata/Cargo.lock

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)