michaelhly / solana-py

Solana Python SDK
https://michaelhly.github.io/solana-py
MIT License
1.04k stars 273 forks source link

Compute budget program #379

Closed kamda-cyrial closed 10 months ago

kamda-cyrial commented 10 months ago

In this PR I attempt to create the necessary instructions to interact with the compute_budget_program which also resolves #293

[CAVEAT]: SetComputeUnitPrice and SetComputeUnitPrice work just fine, but, SetLoadedAccountsDataSizeLimit and SetLoadedAccountsDataSizeLimit seem to throw abstract errors despite the payload matching and deserializing to the expected payload. Not quite sure if it is because of a lack of a feature activation.

the 2 latter instructions throw the errors: Error processing Instruction 0: invalid instruction data and LoadedAccountsDataSizeLimit set for transaction must be greater than 0.

tried digging deep but couldn't find the exact cause of the errors, can someone point me towards some plausible hypothesis for the errors?

kevinheavey commented 10 months ago

Solders covers this https://kevinheavey.github.io/solders/api_reference/compute_budget.html

Though it's missing a set_loaded_accounts_data_size_limit wrapper if you want to add it to solders :)