Skip to content

Commit

Permalink
Update comment
Browse files Browse the repository at this point in the history
  • Loading branch information
lrubasze committed Oct 31, 2024
1 parent c591c40 commit fa9576d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 9 additions & 5 deletions radix-engine/src/system/system_modules/costing/fee_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,16 @@ impl FeeTable {
// divider = W / C
// divider = W / (T * c)
//
// From `costing::spin_loop_v2`, it takes T=960 ms to consume W=274,517,401,207 wasm execution
// units (measured at GH benchmark, git rev 1fd85c47ef, EC2 instance type c6a.4xlarge).
// T = 960 ms = 960 * 100,000
// W = 274,517,401,207
// From `costing::spin_loop_v2` it consumes W=438,729,340,586 wasm execution
// units and it should never take more than T = 1s.
// T = 1s = 1000 ms = 1 * 100,000
// W = 438,729,340,586
// Therefore
// divider = 274,517,401,207 / (960 * 100,000) = 2859.556 ~= 3000
// divider = 438,729,340,586 / (1000 * 100,000) = 4387.293 ~= 4500
//
// With divider set to 4500 it takes 524 ms (measured at GH benchmark, git rev c591c4003a,
// With divider set to 4500 it takes 543 ms (measured at GH benchmark, git rev c591c4003a,
// EC2 instance type c6a.4xlarge) which is fine.
SystemVersion::V2 => 4500,
};

Expand Down
2 changes: 1 addition & 1 deletion radix-engine/src/vm/wasm_runtime/scrypto_runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl<'y, Y: SystemApi<RuntimeError>> ScryptoRuntime<'y, Y> {
let wasm_execution_units_base = if scrypto_vm_version < ScryptoVmVersion::cuttlefish() {
0
} else {
// Add 30,000 base units to make sure the we do not undercharge for WASM execution,
// Add 28,000 base units to make sure the we do not undercharge for WASM execution,
// which might lead to system exploitation.
// This is especially important in corner-cases such as `costing::spin_loop_v2` benchmark.
// less frequently.
Expand Down

0 comments on commit fa9576d

Please sign in to comment.