Skip to content

Commit

Permalink
[hardening] disable conservation checks in dev inspect mode
Browse files Browse the repository at this point in the history
Dev inspect mode can violate SUI conservation by turning bytes into coins. This is expected and ok because this is a test-only mode, not code that can ever run on a validator. Skip these checks in dev-inspect mode so we don't fail unexpectedly during dev inspect calls.
  • Loading branch information
sblackshear committed Mar 23, 2023
1 parent 12e2bca commit 9629845
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions crates/sui-adapter/src/execution_engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,12 @@ fn execute_transaction<
if !is_system {
#[cfg(debug_assertions)]
{
// ensure that this transaction did not create or destroy SUI
temporary_store.check_sui_conserved().unwrap();
if !Mode::allow_arbitrary_values() {
// ensure that this transaction did not create or destroy SUI
temporary_store.check_sui_conserved().unwrap();
}
// else, we're in dev-inspect mode, which lets you turn bytes into arbitrary
// objects (including coins). this can violate conservation, but it's expected
}
}
let cost_summary = gas_status.summary();
Expand Down

0 comments on commit 9629845

Please sign in to comment.