From 809817cbf351b0ec5342fddbf5e6adac34c0afc6 Mon Sep 17 00:00:00 2001 From: Loris Leiva Date: Wed, 22 Jan 2025 14:25:14 +0100 Subject: [PATCH] [wip]: Bring back executable check on program data account This was fixed on the latest patch versions of `2.1`. --- Cargo.toml | 2 +- clients/js/src/utils.ts | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index fc2e73c..9a61797 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ resolver = "2" members = ["program"] [workspace.metadata.cli] -solana = "2.1.0" +solana = "2.1.9" # Specify Rust toolchains for rustfmt, clippy, and build. # Any unprovided toolchains default to stable. diff --git a/clients/js/src/utils.ts b/clients/js/src/utils.ts index 4548c7a..cb6175f 100644 --- a/clients/js/src/utils.ts +++ b/clients/js/src/utils.ts @@ -118,6 +118,13 @@ async function getProgramAuthorityForLoaderV3( const programDataAccount = await fetchEncodedAccount(rpc, programData); assertAccountExists(programDataAccount); + // Ensure the program data account is not executable. + if (programDataAccount.executable) { + throw Error( + 'The data account associated with the program account must not be executable' + ); + } + // Decode the program and program data accounts. const [programDecoder, programDataDecoder] = getLoaderV3Decoders(); const programAccountData = programDecoder.decode(programAccount.data);