Skip to content

Commit

Permalink
[wip]: Remove executable check of program data on client side
Browse files Browse the repository at this point in the history
This is super weird but it appears to always be true for program data on local net and false on other chains.
  • Loading branch information
lorisleiva committed Jan 20, 2025
1 parent 56a421b commit b549c7a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 22 deletions.
29 changes: 14 additions & 15 deletions clients/js/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,34 +35,33 @@ const LOCALHOST_URL = 'http://127.0.0.1:8899';
const LOCALHOST_WEBSOCKET_URL = 'ws://127.0.0.1:8900';

// Define the CLI program.
type GlobalOptions = {
keypair?: string;
payer?: string;
rpc?: string;
priorityFees?: string;
};
const program = new Command();
program
.name('program-metadata')
.description('CLI to manage Solana program metadata and IDLs')
.version(__VERSION__)
.option(
'-k, --keypair <path>',
'Path to keypair file (default: solana config)'
'Path to keypair file. (default: solana config)'
)
.option(
'-p, --payer <path>',
'Path to keypair file of transaction fee and storage payer (default: keypair)'
'Path to keypair file of transaction fee and storage payer. (default: keypair)'
)
.option('--rpc <string>', 'RPC URL (default: solana config or localhost)')
.option('--rpc <string>', 'RPC URL. (default: solana config or localhost)')
// TODO: Support priority fees.
.option(
'--priority-fees <number>',
'Priority fees per compute unit for sending transactions',
'100000'
);

type GlobalOptions = {
keypair?: string;
payer?: string;
rpc?: string;
priorityFees?: string;
};

// Upload metadata command.
type UploadOptions = GlobalOptions & {
thirdParty: boolean;
Expand Down Expand Up @@ -95,28 +94,28 @@ program
)
.option(
'--account-offset <number>',
'The offset in which the data start on the provided account (default to 0).'
'The offset in which the data start on the provided account. (default: 0)'
)
.option(
'--account-length <number>',
'The length of the data on the provided account (default: the rest of the data).'
'The length of the data on the provided account. (default: the rest of the data)'
)
.addOption(
new Option(
'--format <format>',
'The format of the provided data (default: the file extension or "none").'
'The format of the provided data. (default: the file extension or "none")'
).choices(['none', 'json', 'yaml', 'toml'])
)
.addOption(
new Option(
'--encoding <encoding>',
'Describes how to encode the data (default: "utf8").'
'Describes how to encode the data. (default: "utf8")'
).choices(['none', 'utf8', 'base58', 'base64'])
)
.addOption(
new Option(
'--compression <compression>',
'Describes how to compress the data (default: "zlib").'
'Describes how to compress the data. (default: "zlib")'
).choices(['none', 'gzip', 'zlib'])
)
// TODO: Support buffer-only uploads.
Expand Down
7 changes: 0 additions & 7 deletions clients/js/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,6 @@ 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);
Expand Down

0 comments on commit b549c7a

Please sign in to comment.