Skip to content

Commit

Permalink
Error out early if sim exceeds rate-limit
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Garfield committed Oct 31, 2022
1 parent e71ac0f commit 35c4150
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions plugin/src/builders/thread_exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,19 @@ fn build_thread_exec_tx(
if let Some(account) = ui_account.decode::<Account>() {
if let Ok(sim_thread) = Thread::try_from(account.data) {
if sim_thread.next_instruction.is_some() {
ixs.push(build_exec_ix(
sim_thread,
signatory_pubkey,
worker_id,
));
if let Some(exec_context) = sim_thread.exec_context {
if exec_context.execs_since_slot.lt(&sim_thread.rate_limit)
{
ixs.push(build_exec_ix(
sim_thread,
signatory_pubkey,
worker_id,
));
} else {
// Exit early if the thread has reached its rate limit.
break;
}
}
} else {
break;
}
Expand Down

0 comments on commit 35c4150

Please sign in to comment.