Skip to content

Commit 6866f37

Browse files
committed
Update all programs to 0.16.2, update CU numbers
1 parent 146ba2a commit 6866f37

File tree

6 files changed

+33
-33
lines changed

6 files changed

+33
-33
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ address and `invoke_signed` to CPI to the system program.
186186
| Language | CU Usage | CU Usage (minus syscalls) |
187187
| --- | --- | --- |
188188
| Rust | 3698 | 1198 |
189-
| Zig | 2825 | 325 |
189+
| Zig | 2809 | 309 |
190190
| C | 3122 | 622 |
191191
| Rust (pinocchio) | 2816 | 316 |
192192

@@ -202,7 +202,7 @@ on-chain programs, but it can be expensive.
202202
| Language | CU Usage |
203203
| --- | --- |
204204
| Rust | 14 |
205-
| Zig | 19 |
205+
| Zig | 15 |
206206

207207
### Token
208208

@@ -215,39 +215,39 @@ program.
215215
| Language | CU Usage |
216216
| --- | --- |
217217
| Rust | 1115 |
218-
| Zig | 158 |
218+
| Zig | 152 |
219219

220220
* Initialize Account
221221

222222
| Language | CU Usage |
223223
| --- | --- |
224224
| Rust | 2071 |
225-
| Zig | 176 |
225+
| Zig | 175 |
226226

227227
* Mint To
228228

229229
| Language | CU Usage |
230230
| --- | --- |
231231
| Rust | 2189 |
232-
| Zig | 179 |
232+
| Zig | 154 |
233233

234234
* Transfer
235235

236236
| Language | CU Usage |
237237
| --- | --- |
238238
| Rust | 2208 |
239-
| Zig | 148 |
239+
| Zig | 145 |
240240

241241
* Burn
242242

243243
| Language | CU Usage |
244244
| --- | --- |
245245
| Rust | 2045 |
246-
| Zig | 145 |
246+
| Zig | 141 |
247247

248248
* Close Account
249249

250250
| Language | CU Usage |
251251
| --- | --- |
252252
| Rust | 1483 |
253-
| Zig | 130 |
253+
| Zig | 122 |

helloworld/zig/build.zig.zon

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
.hash = "base58-0.14.0-6-CZm81qAAD4JCRHgewcNh8FS0pmnk7-OmwUkosaFKvg",
2222
},
2323
.solana_program_sdk = .{
24-
.url = "https://github.com/joncinque/solana-program-sdk-zig/archive/refs/tags/v0.16.0.tar.gz",
25-
.hash = "solana_program_sdk-0.16.0-wGj9UFDgAAA31EfM9LV-cmDP5BctyNwEVvyEWtZ1QPkj",
24+
.url = "https://github.com/joncinque/solana-program-sdk-zig/archive/refs/tags/v0.16.2.tar.gz",
25+
.hash = "solana_program_sdk-0.16.2-wGj9UHXjAAAK5z6ZdLUJ5uu2SxgE8o7ZJ9Il4EG22IJP",
2626
},
2727
},
2828

pubkey/zig/build.zig.zon

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
// internet connectivity.
1818
.dependencies = .{
1919
.solana_program_sdk = .{
20-
.url = "https://github.com/joncinque/solana-program-sdk-zig/archive/refs/tags/v0.16.0.tar.gz",
21-
.hash = "solana_program_sdk-0.16.0-wGj9UFDgAAA31EfM9LV-cmDP5BctyNwEVvyEWtZ1QPkj",
20+
.url = "https://github.com/joncinque/solana-program-sdk-zig/archive/refs/tags/v0.16.2.tar.gz",
21+
.hash = "solana_program_sdk-0.16.2-wGj9UHXjAAAK5z6ZdLUJ5uu2SxgE8o7ZJ9Il4EG22IJP",
2222
},
2323
},
2424
.paths = .{

token/zig/build.zig.zon

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
// internet connectivity.
1818
.dependencies = .{
1919
.solana_program_sdk = .{
20-
.url = "https://github.com/joncinque/solana-program-sdk-zig/archive/refs/tags/v0.16.0.tar.gz",
21-
.hash = "solana_program_sdk-0.16.0-wGj9UFDgAAA31EfM9LV-cmDP5BctyNwEVvyEWtZ1QPkj",
20+
.url = "https://github.com/joncinque/solana-program-sdk-zig/archive/refs/tags/v0.16.2.tar.gz",
21+
.hash = "solana_program_sdk-0.16.2-wGj9UHXjAAAK5z6ZdLUJ5uu2SxgE8o7ZJ9Il4EG22IJP",
2222
},
2323
},
2424

token/zig/src/instruction.zig

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub const InstructionDiscriminant = enum(u8) {
4242
};
4343

4444
pub fn IxOption(T: type) type {
45-
return packed struct {
45+
return extern struct {
4646
is_some: u8,
4747
value: T,
4848
const Self = @This();
@@ -81,7 +81,7 @@ pub fn IxOption(T: type) type {
8181
};
8282
}
8383

84-
pub const InitializeMintData = packed struct {
84+
pub const InitializeMintData = extern struct {
8585
/// Number of base 10 digits to the right of the decimal place.
8686
decimals: u8,
8787
/// The authority/multisignature to mint tokens.
@@ -90,7 +90,7 @@ pub const InitializeMintData = packed struct {
9090
freeze_authority: IxOption(PublicKey),
9191
};
9292

93-
pub const AmountData = packed struct {
93+
pub const AmountData = extern struct {
9494
/// The amount of tokens to process.
9595
amount: u64,
9696
};
@@ -149,7 +149,7 @@ pub const Instruction = union(InstructionDiscriminant) {
149149
/// 1. `[]` Rent sysvar
150150
/// 2. ..2+N. `[]` The signer accounts, must equal to N where 1 <= N <=
151151
/// 11.
152-
initialize_multisig: packed struct {
152+
initialize_multisig: extern struct {
153153
/// The number of signers (M) required to validate this multisignature
154154
/// account.
155155
m: u8,
@@ -213,7 +213,7 @@ pub const Instruction = union(InstructionDiscriminant) {
213213
/// 0. `[writable]` The mint or account to change the authority of.
214214
/// 1. `[]` The mint's or account's current multisignature authority.
215215
/// 2. ..2+M `[signer]` M signer accounts
216-
set_authority: packed struct {
216+
set_authority: extern struct {
217217
/// The type of authority to update.
218218
authority_type: AuthorityType,
219219
/// The new authority.
@@ -321,7 +321,7 @@ pub const Instruction = union(InstructionDiscriminant) {
321321
/// 2. `[writable]` The destination account.
322322
/// 3. `[]` The source account's multisignature owner/delegate.
323323
/// 4. ..4+M `[signer]` M signer accounts.
324-
transfer_checked: packed struct {
324+
transfer_checked: extern struct {
325325
/// The amount of tokens to transfer.
326326
amount: u64,
327327
/// Expected number of base 10 digits to the right of the decimal place.
@@ -348,7 +348,7 @@ pub const Instruction = union(InstructionDiscriminant) {
348348
/// 2. `[]` The delegate.
349349
/// 3. `[]` The source account's multisignature owner.
350350
/// 4. ..4+M `[signer]` M signer accounts
351-
approve_checked: packed struct {
351+
approve_checked: extern struct {
352352
/// The amount of tokens the delegate is approved for.
353353
amount: u64,
354354
/// Expected number of base 10 digits to the right of the decimal place.
@@ -373,7 +373,7 @@ pub const Instruction = union(InstructionDiscriminant) {
373373
/// 1. `[writable]` The account to mint tokens to.
374374
/// 2. `[]` The mint's multisignature mint-tokens authority.
375375
/// 3. ..3+M `[signer]` M signer accounts.
376-
mint_to_checked: packed struct {
376+
mint_to_checked: extern struct {
377377
/// The amount of new tokens to mint.
378378
amount: u64,
379379
/// Expected number of base 10 digits to the right of the decimal place.
@@ -399,7 +399,7 @@ pub const Instruction = union(InstructionDiscriminant) {
399399
/// 1. `[writable]` The token mint.
400400
/// 2. `[]` The account's multisignature owner/delegate.
401401
/// 3. ..3+M `[signer]` M signer accounts.
402-
burn_checked: packed struct {
402+
burn_checked: extern struct {
403403
/// The amount of tokens to burn.
404404
amount: u64,
405405
/// Expected number of base 10 digits to the right of the decimal place.
@@ -415,7 +415,7 @@ pub const Instruction = union(InstructionDiscriminant) {
415415
/// 0. `[writable]` The account to initialize.
416416
/// 1. `[]` The mint this account will be associated with.
417417
/// 3. `[]` Rent sysvar
418-
initialize_account_2: packed struct {
418+
initialize_account_2: extern struct {
419419
/// The new account's owner/multisignature.
420420
owner_id: PublicKey,
421421
},
@@ -435,7 +435,7 @@ pub const Instruction = union(InstructionDiscriminant) {
435435
///
436436
/// 0. `[writable]` The account to initialize.
437437
/// 1. `[]` The mint this account will be associated with.
438-
initialize_account_3: packed struct {
438+
initialize_account_3: extern struct {
439439
/// The new account's owner/multisignature.
440440
owner_id: PublicKey,
441441
},
@@ -446,7 +446,7 @@ pub const Instruction = union(InstructionDiscriminant) {
446446
/// 0. `[writable]` The multisignature account to initialize.
447447
/// 1. ..1+N. `[]` The signer accounts, must equal to N where 1 <= N <=
448448
/// 11.
449-
initialize_multisig_2: packed struct {
449+
initialize_multisig_2: extern struct {
450450
/// The number of signers (M) required to validate this multisignature
451451
/// account.
452452
m: u8,
@@ -457,7 +457,7 @@ pub const Instruction = union(InstructionDiscriminant) {
457457
///
458458
/// 0. `[writable]` The mint to initialize.
459459
///
460-
initialize_mint_2: packed struct {
460+
initialize_mint_2: extern struct {
461461
/// Number of base 10 digits to the right of the decimal place.
462462
decimals: u8,
463463
/// The authority/multisignature to mint tokens.
@@ -501,7 +501,7 @@ pub const Instruction = union(InstructionDiscriminant) {
501501
/// Accounts expected by this instruction:
502502
///
503503
/// 0. `[]` The mint to calculate for
504-
amount_to_ui_amount: packed struct {
504+
amount_to_ui_amount: extern struct {
505505
/// The amount of tokens to reformat.
506506
amount: u64,
507507
},
@@ -514,7 +514,7 @@ pub const Instruction = union(InstructionDiscriminant) {
514514
/// Accounts expected by this instruction:
515515
///
516516
/// 0. `[]` The mint to calculate for
517-
ui_amount_to_amount: packed struct {
517+
ui_amount_to_amount: extern struct {
518518
/// The ui_amount of tokens to reformat.
519519
ui_amount: [*:0]u8,
520520
},

token/zig/src/state.zig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const std = @import("std");
22
const PublicKey = @import("solana_program_sdk").PublicKey;
33
const TokenError = @import("error.zig").TokenError;
44

5-
pub const Mint = packed struct {
5+
pub const Mint = extern struct {
66
pub const len = 82;
77

88
mint_authority: COption(PublicKey),
@@ -23,7 +23,7 @@ pub const Mint = packed struct {
2323
}
2424
};
2525

26-
pub const Account = packed struct {
26+
pub const Account = extern struct {
2727
pub const len = 165;
2828

2929
pub const State = enum(u8) {
@@ -61,7 +61,7 @@ pub const Account = packed struct {
6161
};
6262

6363
pub fn COption(T: type) type {
64-
return packed struct {
64+
return extern struct {
6565
is_some: u32,
6666
value: T,
6767
const Self = @This();
@@ -94,7 +94,7 @@ pub fn COption(T: type) type {
9494
};
9595
}
9696

97-
pub const Multisig = packed struct {
97+
pub const Multisig = extern struct {
9898
pub const len = 355;
9999
};
100100

0 commit comments

Comments
 (0)