Assessment reports>Initia>Discussion>Charge before using values

Charge before using values

As noted in the code comments, in several places in table.rs, consider charging the gas cost before using the values for potentially expensive operations.

table.rs:    // TODO(Gas): Figure out a way to charge this earlier.
table.rs-    context.charge(key_cost + value_cost)?;
--
table.rs:    // TODO(Gas): Figure out a way to charge this earlier.
table.rs-    context.charge(key_cost + value_cost)?;
--
table.rs:    // TODO(Gas): Figure out a way to charge this earlier.
table.rs-    context.charge(key_cost + value_cost)?;
--
table.rs:    // TODO(Gas): Figure out a way to charge this earlier.
table.rs-    context.charge(key_cost + value_cost)?;
Zellic © 2024Back to top ↑