Open steveluscher opened 3 weeks ago
Except for SyscallError
all other errors are consolidated into InstructionError::ProgramFailedToComplete
here:
https://github.com/anza-xyz/agave/blob/8eef73da38f36b686a42ecd081da42820551b643/program-runtime/src/invoke_context.rs#L547
Feel free to submit a PR, a feature gate is technically not necessary but I would recommend one so it becomes clear when one can start relying on it.
Thanks for that pointer! I think I will.
Was this the impetus for this test modification, @joncinque?
We found that the test was flaky, and would throw one error or the other, but I never did any digging to find out exactly why that was happening.
Problem
Consider this transaction that exceeds its compute budget of 15000 CUs:
https://explorer.solana.com/tx/inspector?signatures=%255B%25225dUfY9k28HHNUuvpSuhdzx53EteMyfGCgqF9iqMtuvRY8DcP3PxXvse1R7RfANGe7jYLejL6coxrn4EEi6C56HPZ%2522%255D&message=AQACAze8vCh%252Fupx58A684jj8N7Heb37vwHzBicyyHW7x1udtAwZGb%252BUhFzL%252F7K26csOb57yM5bvF9xJrLEObOkAAAAAFSlNamSkhBk0k6HFg2jh8fDW13bySu4HkH6hAQQVEjf3GzDQNAqXWZstR2XFW1lbegc7g9QpKLW1sb8qETlE6AwEABQKYOgAAAQAJA4gTAAAAAAAAAgAJTmVhdCDwn5O4&cluster=testnet
In simulation, I would expect that transaction to throw
InstructionError::ComputationalBudgetExceeded
, but instead it throws the more abstractInstructionError::ProgramFailedToComplete
and appears to log the message fromEbpfError::ExceededMaxInstructions
from solana-labs/rbpf.Proposed Solution
Throw
InstructionError::ComputationalBudgetExceeded
instead, so that applications/clients can catch that error and show mitigation advice to the user (eg. ‘you need to budget at least X CUs’) or automatically retry with a higher CU budget.