Skip to content

Commit 7b12ec5

Browse files
committed
Bump platform tools version to v1.47 (Rust 1.84.1) (#5811)
* Bump platform tools version * Regenerate C headers with SBPFv3 for static syscalls * Update toml files * Tune CU consumption test
1 parent 23a7199 commit 7b12ec5

File tree

22 files changed

+64
-41
lines changed

22 files changed

+64
-41
lines changed

platform-tools-sdk/cargo-build-sbf/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use {
2121
tar::Archive,
2222
};
2323

24-
const DEFAULT_PLATFORM_TOOLS_VERSION: &str = "v1.46";
24+
const DEFAULT_PLATFORM_TOOLS_VERSION: &str = "v1.47";
2525

2626
#[derive(Debug)]
2727
struct Config<'a> {

platform-tools-sdk/cargo-build-sbf/tests/crates/noop/Cargo.toml

+6
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,10 @@ solana-pubkey = "=2.2.0"
1818
[lib]
1919
crate-type = ["cdylib"]
2020

21+
[lints.rust.unexpected_cfgs]
22+
level = "warn"
23+
check-cfg = [
24+
'cfg(feature, values("custom-panic", "custom-heap"))'
25+
]
26+
2127
[workspace]

platform-tools-sdk/cargo-build-sbf/tests/crates/package-metadata/Cargo.toml

+7-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ edition = "2021"
1010
publish = false
1111

1212
[package.metadata.solana]
13-
tools-version = "v1.46"
13+
tools-version = "v1.47"
1414
program-id = "MyProgram1111111111111111111111111111111111"
1515

1616
[dependencies]
@@ -23,4 +23,10 @@ solana-pubkey = "=2.2.0"
2323
[lib]
2424
crate-type = ["cdylib"]
2525

26+
[lints.rust.unexpected_cfgs]
27+
level = "warn"
28+
check-cfg = [
29+
'cfg(feature, values("custom-panic", "custom-heap"))'
30+
]
31+
2632
[workspace]

platform-tools-sdk/cargo-build-sbf/tests/crates/workspace-metadata/Cargo.toml

+7-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,13 @@ solana-pubkey = "=2.2.0"
1818
[lib]
1919
crate-type = ["cdylib"]
2020

21+
[lints.rust.unexpected_cfgs]
22+
level = "warn"
23+
check-cfg = [
24+
'cfg(feature, values("custom-panic", "custom-heap"))'
25+
]
26+
2127
[workspace]
2228

2329
[workspace.metadata.solana]
24-
tools-version = "v1.46"
30+
tools-version = "v1.47"

platform-tools-sdk/sbf/c/inc/sol/alt_bn128.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ extern "C" {
5454
* @return 0 if executed successfully
5555
*/
5656
/* DO NOT MODIFY THIS GENERATED FILE. INSTEAD CHANGE platform-tools-sdk/sbf/c/inc/sol/inc/alt_bn128.inc AND RUN `cargo run --bin gen-headers` */
57-
#ifndef SOL_SBFV2
57+
#ifndef SOL_SBPFV3
5858
uint64_t sol_alt_bn128_group_op(const uint64_t, const uint8_t *, const uint64_t, uint8_t *);
5959
#else
6060
typedef uint64_t(*sol_alt_bn128_group_op_pointer_type)(const uint64_t, const uint8_t *, const uint64_t, uint8_t *);

platform-tools-sdk/sbf/c/inc/sol/alt_bn128_compression.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ extern "C" {
5959
* @return 0 if executed successfully
6060
*/
6161
/* DO NOT MODIFY THIS GENERATED FILE. INSTEAD CHANGE platform-tools-sdk/sbf/c/inc/sol/inc/alt_bn128_compression.inc AND RUN `cargo run --bin gen-headers` */
62-
#ifndef SOL_SBFV2
62+
#ifndef SOL_SBPFV3
6363
uint64_t sol_alt_bn128_compression(
6464
const uint64_t op,
6565
const uint8_t *input,

platform-tools-sdk/sbf/c/inc/sol/assert.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ extern "C" {
1717
* the SBF VM to immediately halt execution. No accounts' data are updated
1818
*/
1919
/* DO NOT MODIFY THIS GENERATED FILE. INSTEAD CHANGE platform-tools-sdk/sbf/c/inc/sol/inc/assert.inc AND RUN `cargo run --bin gen-headers` */
20-
#ifndef SOL_SBFV2
20+
#ifndef SOL_SBPFV3
2121
void sol_panic_(const char *, uint64_t, uint64_t, uint64_t);
2222
#else
2323
typedef void(*sol_panic__pointer_type)(const char *, uint64_t, uint64_t, uint64_t);

platform-tools-sdk/sbf/c/inc/sol/big_mod_exp.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ extern "C" {
1515
* @return 0 if executed successfully
1616
*/
1717
/* DO NOT MODIFY THIS GENERATED FILE. INSTEAD CHANGE platform-tools-sdk/sbf/c/inc/sol/inc/big_mod_exp.inc AND RUN `cargo run --bin gen-headers` */
18-
#ifndef SOL_SBFV2
18+
#ifndef SOL_SBPFV3
1919
uint64_t sol_big_mod_exp(const uint8_t *, uint8_t *);
2020
#else
2121
typedef uint64_t(*sol_big_mod_exp_pointer_type)(const uint8_t *, uint8_t *);

platform-tools-sdk/sbf/c/inc/sol/blake3.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ extern "C" {
2222
* @param result 32 byte array to hold the result
2323
*/
2424
/* DO NOT MODIFY THIS GENERATED FILE. INSTEAD CHANGE platform-tools-sdk/sbf/c/inc/sol/inc/blake3.inc AND RUN `cargo run --bin gen-headers` */
25-
#ifndef SOL_SBFV2
25+
#ifndef SOL_SBPFV3
2626
uint64_t sol_blake3(const SolBytes *, int, const uint8_t *);
2727
#else
2828
typedef uint64_t(*sol_blake3_pointer_type)(const SolBytes *, int, const uint8_t *);

platform-tools-sdk/sbf/c/inc/sol/compute_units.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ extern "C" {
1515
* Prints a string to stdout
1616
*/
1717
/* DO NOT MODIFY THIS GENERATED FILE. INSTEAD CHANGE platform-tools-sdk/sbf/c/inc/sol/inc/compute_units.inc AND RUN `cargo run --bin gen-headers` */
18-
#ifndef SOL_SBFV2
18+
#ifndef SOL_SBPFV3
1919
uint64_t sol_remaining_compute_units();
2020
#else
2121
typedef uint64_t(*sol_remaining_compute_units_pointer_type)();

platform-tools-sdk/sbf/c/inc/sol/cpi.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ typedef struct {
5757
* Internal cross-program invocation function
5858
*/
5959
/* DO NOT MODIFY THIS GENERATED FILE. INSTEAD CHANGE platform-tools-sdk/sbf/c/inc/sol/inc/cpi.inc AND RUN `cargo run --bin gen-headers` */
60-
#ifndef SOL_SBFV2
60+
#ifndef SOL_SBPFV3
6161
uint64_t sol_invoke_signed_c(
6262
const SolInstruction *,
6363
const SolAccountInfo *,

platform-tools-sdk/sbf/c/inc/sol/keccak.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ extern "C" {
2222
* @param result 32 byte array to hold the result
2323
*/
2424
/* DO NOT MODIFY THIS GENERATED FILE. INSTEAD CHANGE platform-tools-sdk/sbf/c/inc/sol/inc/keccak.inc AND RUN `cargo run --bin gen-headers` */
25-
#ifndef SOL_SBFV2
25+
#ifndef SOL_SBPFV3
2626
uint64_t sol_keccak256(const SolBytes *, int, uint8_t *);
2727
#else
2828
typedef uint64_t(*sol_keccak256_pointer_type)(const SolBytes *, int, uint8_t *);

platform-tools-sdk/sbf/c/inc/sol/last_restart_slot.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ extern "C" {
1313
* Get Last Restart Slot
1414
*/
1515
/* DO NOT MODIFY THIS GENERATED FILE. INSTEAD CHANGE platform-tools-sdk/sbf/c/inc/sol/inc/last_restart_slot.inc AND RUN `cargo run --bin gen-headers` */
16-
#ifndef SOL_SBFV2
16+
#ifndef SOL_SBPFV3
1717
u64 sol_get_last_restart_slot(uint8_t *result);
1818
#else
1919
typedef u64(*sol_get_last_restart_slot_pointer_type)(uint8_t *result);

platform-tools-sdk/sbf/c/inc/sol/log.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ extern "C" {
1515
* Prints a string to stdout
1616
*/
1717
/* DO NOT MODIFY THIS GENERATED FILE. INSTEAD CHANGE platform-tools-sdk/sbf/c/inc/sol/inc/log.inc AND RUN `cargo run --bin gen-headers` */
18-
#ifndef SOL_SBFV2
18+
#ifndef SOL_SBPFV3
1919
void sol_log_(const char *, uint64_t);
2020
#else
2121
typedef void(*sol_log__pointer_type)(const char *, uint64_t);
@@ -30,7 +30,7 @@ static void sol_log_(const char * arg1, uint64_t arg2) {
3030
* Prints a 64 bit values represented in hexadecimal to stdout
3131
*/
3232
/* DO NOT MODIFY THIS GENERATED FILE. INSTEAD CHANGE platform-tools-sdk/sbf/c/inc/sol/inc/log.inc AND RUN `cargo run --bin gen-headers` */
33-
#ifndef SOL_SBFV2
33+
#ifndef SOL_SBPFV3
3434
void sol_log_64_(uint64_t, uint64_t, uint64_t, uint64_t, uint64_t);
3535
#else
3636
typedef void(*sol_log_64__pointer_type)(uint64_t, uint64_t, uint64_t, uint64_t, uint64_t);
@@ -45,7 +45,7 @@ static void sol_log_64_(uint64_t arg1, uint64_t arg2, uint64_t arg3, uint64_t ar
4545
* Prints the current compute unit consumption to stdout
4646
*/
4747
/* DO NOT MODIFY THIS GENERATED FILE. INSTEAD CHANGE platform-tools-sdk/sbf/c/inc/sol/inc/log.inc AND RUN `cargo run --bin gen-headers` */
48-
#ifndef SOL_SBFV2
48+
#ifndef SOL_SBPFV3
4949
void sol_log_compute_units_();
5050
#else
5151
typedef void(*sol_log_compute_units__pointer_type)();
@@ -71,7 +71,7 @@ static void sol_log_array(const uint8_t *array, int len) {
7171
* Print the base64 representation of some arrays.
7272
*/
7373
/* DO NOT MODIFY THIS GENERATED FILE. INSTEAD CHANGE platform-tools-sdk/sbf/c/inc/sol/inc/log.inc AND RUN `cargo run --bin gen-headers` */
74-
#ifndef SOL_SBFV2
74+
#ifndef SOL_SBPFV3
7575
void sol_log_data(SolBytes *, uint64_t);
7676
#else
7777
typedef void(*sol_log_data_pointer_type)(SolBytes *, uint64_t);

platform-tools-sdk/sbf/c/inc/sol/poseidon.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ extern "C" {
4848
* @param result 32 byte array to hold the result
4949
*/
5050
/* DO NOT MODIFY THIS GENERATED FILE. INSTEAD CHANGE platform-tools-sdk/sbf/c/inc/sol/inc/poseidon.inc AND RUN `cargo run --bin gen-headers` */
51-
#ifndef SOL_SBFV2
51+
#ifndef SOL_SBPFV3
5252
uint64_t sol_poseidon(
5353
const uint64_t parameters,
5454
const uint64_t endianness,

platform-tools-sdk/sbf/c/inc/sol/pubkey.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ typedef struct {
2727
* @param key The public key to print
2828
*/
2929
/* DO NOT MODIFY THIS GENERATED FILE. INSTEAD CHANGE platform-tools-sdk/sbf/c/inc/sol/inc/pubkey.inc AND RUN `cargo run --bin gen-headers` */
30-
#ifndef SOL_SBFV2
30+
#ifndef SOL_SBPFV3
3131
void sol_log_pubkey(const SolPubkey *);
3232
#else
3333
typedef void(*sol_log_pubkey_pointer_type)(const SolPubkey *);
@@ -79,7 +79,7 @@ typedef struct {
7979
* @param program_address Program address created, filled on return
8080
*/
8181
/* DO NOT MODIFY THIS GENERATED FILE. INSTEAD CHANGE platform-tools-sdk/sbf/c/inc/sol/inc/pubkey.inc AND RUN `cargo run --bin gen-headers` */
82-
#ifndef SOL_SBFV2
82+
#ifndef SOL_SBPFV3
8383
uint64_t sol_create_program_address(const SolSignerSeed *, int, const SolPubkey *, SolPubkey *);
8484
#else
8585
typedef uint64_t(*sol_create_program_address_pointer_type)(const SolSignerSeed *, int, const SolPubkey *, SolPubkey *);
@@ -99,7 +99,7 @@ static uint64_t sol_create_program_address(const SolSignerSeed * arg1, int arg2,
9999
* @param bump_seed Bump seed required to create a valid program address
100100
*/
101101
/* DO NOT MODIFY THIS GENERATED FILE. INSTEAD CHANGE platform-tools-sdk/sbf/c/inc/sol/inc/pubkey.inc AND RUN `cargo run --bin gen-headers` */
102-
#ifndef SOL_SBFV2
102+
#ifndef SOL_SBPFV3
103103
uint64_t sol_try_find_program_address(const SolSignerSeed *, int, const SolPubkey *, SolPubkey *, uint8_t *);
104104
#else
105105
typedef uint64_t(*sol_try_find_program_address_pointer_type)(const SolSignerSeed *, int, const SolPubkey *, SolPubkey *, uint8_t *);

platform-tools-sdk/sbf/c/inc/sol/return_data.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ extern "C"
2323
* @param bytes_len length of byte array. This may not exceed MAX_RETURN_DATA.
2424
*/
2525
/* DO NOT MODIFY THIS GENERATED FILE. INSTEAD CHANGE platform-tools-sdk/sbf/c/inc/sol/inc/return_data.inc AND RUN `cargo run --bin gen-headers` */
26-
#ifndef SOL_SBFV2
26+
#ifndef SOL_SBPFV3
2727
void sol_set_return_data(const uint8_t *, uint64_t);
2828
#else
2929
typedef void(*sol_set_return_data_pointer_type)(const uint8_t *, uint64_t);
@@ -42,7 +42,7 @@ static void sol_set_return_data(const uint8_t * arg1, uint64_t arg2) {
4242
* @param result length of return data (may exceed bytes_len if the return data is longer)
4343
*/
4444
/* DO NOT MODIFY THIS GENERATED FILE. INSTEAD CHANGE platform-tools-sdk/sbf/c/inc/sol/inc/return_data.inc AND RUN `cargo run --bin gen-headers` */
45-
#ifndef SOL_SBFV2
45+
#ifndef SOL_SBPFV3
4646
uint64_t sol_get_return_data(uint8_t *, uint64_t, SolPubkey *);
4747
#else
4848
typedef uint64_t(*sol_get_return_data_pointer_type)(uint8_t *, uint64_t, SolPubkey *);

platform-tools-sdk/sbf/c/inc/sol/secp256k1.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ extern "C" {
3333
* @return 0 if executed successfully
3434
*/
3535
/* DO NOT MODIFY THIS GENERATED FILE. INSTEAD CHANGE platform-tools-sdk/sbf/c/inc/sol/inc/secp256k1.inc AND RUN `cargo run --bin gen-headers` */
36-
#ifndef SOL_SBFV2
36+
#ifndef SOL_SBPFV3
3737
uint64_t sol_secp256k1_recover(const uint8_t *, uint64_t, const uint8_t *, uint8_t *);
3838
#else
3939
typedef uint64_t(*sol_secp256k1_recover_pointer_type)(const uint8_t *, uint64_t, const uint8_t *, uint8_t *);

platform-tools-sdk/sbf/c/inc/sol/sha.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ extern "C" {
2222
* @param result 32 byte array to hold the result
2323
*/
2424
/* DO NOT MODIFY THIS GENERATED FILE. INSTEAD CHANGE platform-tools-sdk/sbf/c/inc/sol/inc/sha.inc AND RUN `cargo run --bin gen-headers` */
25-
#ifndef SOL_SBFV2
25+
#ifndef SOL_SBPFV3
2626
uint64_t sol_sha256(const SolBytes *, int, uint8_t *);
2727
#else
2828
typedef uint64_t(*sol_sha256_pointer_type)(const SolBytes *, int, uint8_t *);

platform-tools-sdk/sbf/scripts/install.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ if [[ ! -e criterion-$version.md || ! -e criterion ]]; then
109109
fi
110110

111111
# Install platform tools
112-
version=v1.46
112+
version=v1.47
113113
if [[ ! -e platform-tools-$version.md || ! -e platform-tools ]]; then
114114
(
115115
set -e

programs/sbf/other/v0-pro.tar.gz

29.9 MB
Binary file not shown.

programs/sbf/tests/programs.rs

+21-16
Original file line numberDiff line numberDiff line change
@@ -1284,20 +1284,20 @@ fn assert_instruction_count() {
12841284
#[cfg(feature = "sbf_rust")]
12851285
{
12861286
programs.extend_from_slice(&[
1287-
("solana_sbf_rust_128bit", 967),
1288-
("solana_sbf_rust_alloc", 4940),
1289-
("solana_sbf_rust_custom_heap", 286),
1287+
("solana_sbf_rust_128bit", 969),
1288+
("solana_sbf_rust_alloc", 5077),
1289+
("solana_sbf_rust_custom_heap", 304),
12901290
("solana_sbf_rust_dep_crate", 2),
12911291
("solana_sbf_rust_iter", 1514),
1292-
("solana_sbf_rust_many_args", 1289),
1293-
("solana_sbf_rust_mem", 2067),
1294-
("solana_sbf_rust_membuiltins", 1539),
1295-
("solana_sbf_rust_noop", 275),
1296-
("solana_sbf_rust_param_passing", 146),
1297-
("solana_sbf_rust_rand", 378),
1298-
("solana_sbf_rust_sanity", 51953),
1299-
("solana_sbf_rust_secp256k1_recover", 91185),
1300-
("solana_sbf_rust_sha", 24059),
1292+
("solana_sbf_rust_many_args", 1290),
1293+
("solana_sbf_rust_mem", 1302),
1294+
("solana_sbf_rust_membuiltins", 331),
1295+
("solana_sbf_rust_noop", 314),
1296+
("solana_sbf_rust_param_passing", 108),
1297+
("solana_sbf_rust_rand", 278),
1298+
("solana_sbf_rust_sanity", 51325),
1299+
("solana_sbf_rust_secp256k1_recover", 89388),
1300+
("solana_sbf_rust_sha", 22855),
13011301
]);
13021302
}
13031303

@@ -1694,10 +1694,15 @@ fn test_program_sbf_invoke_in_same_tx_as_deployment() {
16941694
);
16951695
} else {
16961696
let (result, _, _, _) = process_transaction_and_record_inner(&bank, tx);
1697-
assert_eq!(
1698-
result.unwrap_err(),
1699-
TransactionError::InstructionError(37, InstructionError::UnsupportedProgramId),
1700-
);
1697+
if let TransactionError::InstructionError(instr_no, ty) = result.unwrap_err() {
1698+
// Asserting the instruction number as an upper bound, since the quantity of
1699+
// instructions depends on the program size, which in turn depends on the SBPF
1700+
// versions.
1701+
assert!(instr_no <= 41);
1702+
assert_eq!(ty, InstructionError::UnsupportedProgramId);
1703+
} else {
1704+
panic!("Invalid error type");
1705+
}
17011706
}
17021707
}
17031708
}

0 commit comments

Comments
 (0)