Closed tao-stones closed 2 years ago
need to be careful about race condition where you accidentally build block too big, but this seems better
Regarding transaction's estimated and actual execution units:
execution_cost
by summing up all programs' units in transaction, including built-in programs (which are constants defined at block_cost_limits.rs), and BPF programs. estimated units
are the sum of execution_cost
and few other const cost, defined here.With these, my initial thought of bring actual units
to banking_stage to apply to cost_tracker is: instead of returning each transaction's execution units from bank.execute_loaded_transaction
(which would only include BPF programs), rather iterating each transaction's programs after execution to pick built-in units from constant def and BPF from execute_and_commit_timings.execute_timings.executeAccessoryTimings.per_program_timings
to sum up the actual units
.
The drawback is there will be one additional iteration of instructions per executed-and-recorded transactions.
What's your thoughts on this? @ckamm @carllin @jstarry
I was hoping we could sum up the compute_units_consumed
directly in MessageProcessor::process_message()
and communicate them outward in ProcessedMessageInfo
and further.
The direct path via the invoke context's data should also include built-in programs, since it reads the user-visible compute limit?
Builtin programs don't consume units at the moment (they may at some point), the accumulated execution units from process_message()
are for BPF programs only. For the purpose of this issue, can do:
actual_bpf_execution_units
;communicate them outward in
ProcessedMessageInfo
and further.
Mmm, looks like ProcessedMessageInfo
is only for successful execution. To include failed execution, can compare ExecuteTimings
before/after.
Problem
To make cost tracking more accurate, can apply transactions actual execution units after successful execution.
Proposed Solution
Potentially can include actual execution units in
So successfully executed Transaction can have that info ready for
QosService::update_or_remove_transaction_costs()
Side note: The unsuccessfully executed transaction still consumes execution units, which will also be aggregated and reflected in
estimated units
.