Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump platform-tools to v1.39 #33804

Merged
merged 1 commit into from
Oct 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions programs/sbf/rust/invoke/src/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1131,10 +1131,11 @@ fn process_instruction(
#[rustversion::attr(since(1.72), allow(invalid_reference_casting))]
fn overwrite_account_key(account: &AccountInfo, key: *const Pubkey) {
unsafe {
*mem::transmute::<_, *mut *const Pubkey>(&account.key) = key;
let ptr = mem::transmute::<_, *mut *const Pubkey>(&account.key);
std::ptr::write_volatile(ptr, key);
}
}
overwrite_account_key(account, key as *const Pubkey);
overwrite_account_key(&accounts[ARGUMENT_INDEX], key as *const Pubkey);
let callee_program_id = accounts[CALLEE_PROGRAM_INDEX].key;

invoke(
Expand Down Expand Up @@ -1181,7 +1182,8 @@ fn process_instruction(
#[rustversion::attr(since(1.72), allow(invalid_reference_casting))]
fn overwrite_account_owner(account: &AccountInfo, owner: *const Pubkey) {
unsafe {
*mem::transmute::<_, *mut *const Pubkey>(&account.owner) = owner;
let ptr = mem::transmute::<_, *mut *const Pubkey>(&account.owner);
std::ptr::write_volatile(ptr, owner);
}
}
overwrite_account_owner(account, owner as *const Pubkey);
Expand Down Expand Up @@ -1309,7 +1311,7 @@ struct RcBox<T> {

#[rustversion::attr(since(1.72), allow(invalid_reference_casting))]
unsafe fn overwrite_account_data(account: &AccountInfo, data: Rc<RefCell<&mut [u8]>>) {
std::ptr::write(
std::ptr::write_volatile(
&account.data as *const _ as usize as *mut Rc<RefCell<&mut [u8]>>,
data,
);
Expand Down
3 changes: 1 addition & 2 deletions programs/sbf/rust/ro_modify/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,7 @@ fn process_instruction(
// Not sure how to get a const data length in an Rc<RefCell<&mut [u8]>>
}
3 => {
let mut new_accounts =
&mut [READONLY_ACCOUNTS[0].clone(), READONLY_ACCOUNTS[1].clone()];
let new_accounts = &mut [READONLY_ACCOUNTS[0].clone(), READONLY_ACCOUNTS[1].clone()];
new_accounts[1].owner_addr = &PUBKEY as *const _ as u64;
let system_instruction = system_instruction::assign(accounts[1].key, program_id);
let metas = &[SolAccountMeta {
Expand Down
8 changes: 4 additions & 4 deletions programs/sbf/tests/programs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1403,17 +1403,17 @@ fn assert_instruction_count() {
{
programs.extend_from_slice(&[
("solana_sbf_rust_128bit", 1218),
("solana_sbf_rust_alloc", 5067),
("solana_sbf_rust_alloc", 5077),
("solana_sbf_rust_custom_heap", 398),
("solana_sbf_rust_dep_crate", 2),
("solana_sbf_rust_iter", 1013),
("solana_sbf_rust_iter", 1514),
("solana_sbf_rust_many_args", 1289),
("solana_sbf_rust_mem", 2067),
("solana_sbf_rust_membuiltins", 1539),
("solana_sbf_rust_noop", 275),
("solana_sbf_rust_param_passing", 146),
("solana_sbf_rust_rand", 378),
("solana_sbf_rust_sanity", 51931),
("solana_sbf_rust_sanity", 51953),
("solana_sbf_rust_secp256k1_recover", 91185),
("solana_sbf_rust_sha", 24059),
]);
Expand Down Expand Up @@ -1465,7 +1465,7 @@ fn assert_instruction_count() {
diff,
100.0_f64 * consumption as f64 / *expected_consumption as f64 - 100.0_f64,
);
assert_eq!(consumption, *expected_consumption);
assert!(consumption <= *expected_consumption);
},
);
}
Expand Down
2 changes: 1 addition & 1 deletion sdk/bpf/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ if [[ ! -e criterion-$version.md || ! -e criterion ]]; then
fi

# Install Rust-BPF
version=v1.37
version=v1.39
if [[ ! -e bpf-tools-$version.md || ! -e bpf-tools ]]; then
(
set -e
Expand Down
4 changes: 2 additions & 2 deletions sdk/cargo-build-sbf/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ where
.iter()
.map(|arg| arg.as_ref().to_str().unwrap_or("?"))
.join(" ");
info!("spawn: {}", msg);
info!("spawn: {:?} {}", program, msg);

let child = Command::new(program)
.args(args)
Expand Down Expand Up @@ -911,7 +911,7 @@ fn main() {

// The following line is scanned by CI configuration script to
// separate cargo caches according to the version of platform-tools.
let platform_tools_version = String::from("v1.37");
let platform_tools_version = String::from("v1.39");
let rust_base_version = get_base_rust_version(platform_tools_version.as_str());
let version = format!(
"{}\nplatform-tools {}\n{}",
Expand Down
2 changes: 1 addition & 1 deletion sdk/program/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repository = { workspace = true }
homepage = { workspace = true }
license = { workspace = true }
edition = { workspace = true }
rust-version = "1.68.0" # solana platform-tools rust version
rust-version = "1.72.0" # solana platform-tools rust version

[dependencies]
bincode = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion sdk/sbf/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ if [[ ! -e criterion-$version.md || ! -e criterion ]]; then
fi

# Install platform tools
version=v1.37
version=v1.39
if [[ ! -e platform-tools-$version.md || ! -e platform-tools ]]; then
(
set -e
Expand Down