Skip to content

Commit

Permalink
feat: update gas costs, to better reflect the costs post-memtrie
Browse files Browse the repository at this point in the history
  • Loading branch information
Ekleog committed Sep 10, 2024
1 parent 3718df6 commit 98eaea4
Show file tree
Hide file tree
Showing 69 changed files with 387 additions and 115 deletions.
13 changes: 7 additions & 6 deletions core/parameters/res/runtime_configs/61.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Compute costs to allow for flat storage read-only MVP.
# See https://github.com/near/nearcore/issues/8006
wasm_touching_trie_node: { old: 16_101_955_926, new: { gas: 16_101_955_926, compute: 110_000_000_000 } }
wasm_storage_write_base: { old: 64_196_736_000, new: { gas: 64_196_736_000, compute: 200_000_000_000 } }
wasm_storage_remove_base: { old: 53_473_030_500, new: { gas: 53_473_030_500, compute: 200_000_000_000 } }
wasm_storage_read_base: { old: 56_356_845_750, new: { gas: 56_356_845_750, compute: 200_000_000_000 } }
wasm_storage_has_key_base: { old: 54_039_896_625, new: { gas: 54_039_896_625, compute: 200_000_000_000 } }
flat_storage_reads: { old: false, new: true }
wasm_touching_trie_node: { old: 16_101_955_926, new: { gas: 16_101_955_926, compute: 110_000_000_000 } }
wasm_storage_write_base: { old: 64_196_736_000, new: { gas: 64_196_736_000, compute: 200_000_000_000 } }
wasm_storage_remove_base: { old: 53_473_030_500, new: { gas: 53_473_030_500, compute: 200_000_000_000 } }
wasm_storage_read_base: { old: 56_356_845_750, new: { gas: 56_356_845_750, compute: 200_000_000_000 } }
wasm_storage_small_read_base: { old: 56_356_845_750, new: { gas: 56_356_845_750, compute: 200_000_000_000 } }
wasm_storage_has_key_base: { old: 54_039_896_625, new: { gas: 54_039_896_625, compute: 200_000_000_000 } }
flat_storage_reads: { old: false, new: true }
8 changes: 7 additions & 1 deletion core/parameters/res/runtime_configs/72.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
main_storage_proof_size_soft_limit: {old: 3_000_000, new: 4_000_000}
main_storage_proof_size_soft_limit: {old: 3_000_000, new: 4_000_000}
wasm_storage_has_key_base: { old: { gas: 54_039_896_625, compute: 200_000_000_000 }, new: { gas: 54_039_896_625, compute: 8_000_000_000 } }
wasm_storage_has_key_byte: { old: 30_790_845, new: { gas: 30_790_845, compute: 9_000_000 } }
wasm_storage_small_read_base: { old: { gas: 56_356_845_750, compute: 200_000_000_000 }, new: { gas: 56_356_845_750, compute: 159_000_000_000 } }
wasm_storage_small_read_key_byte: { old: 30_952_533, new: { gas: 30_952_533, compute: 10_000_000 } }
wasm_storage_small_read_value_byte: { old: 5_611_005, new: { gas: 5_611_005, compute: 2_500_000 } }
wasm_touching_trie_node: { old: { gas: 16_101_955_926, compute: 110_000_000_000 }, new: { gas: 16_101_955_926, compute: 20_000_000_000 } }
9 changes: 6 additions & 3 deletions core/parameters/res/runtime_configs/parameters.snap
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,14 @@ wasm_storage_write_evicted_byte 32_117_307
wasm_storage_read_base 56_356_845_750, compute: 200_000_000_000
wasm_storage_read_key_byte 30_952_533
wasm_storage_read_value_byte 5_611_005
wasm_storage_small_read_base 56_356_845_750, compute: 159_000_000_000
wasm_storage_small_read_key_byte 30_952_533, compute: 10_000_000
wasm_storage_small_read_value_byte 5_611_005, compute: 2_500_000
wasm_storage_remove_base 53_473_030_500, compute: 200_000_000_000
wasm_storage_remove_key_byte 38_220_384
wasm_storage_remove_ret_value_byte 11_531_556
wasm_storage_has_key_base 54_039_896_625, compute: 200_000_000_000
wasm_storage_has_key_byte 30_790_845
wasm_storage_has_key_base 54_039_896_625, compute: 8_000_000_000
wasm_storage_has_key_byte 30_790_845, compute: 9_000_000
wasm_storage_iter_create_prefix_base 0
wasm_storage_iter_create_prefix_byte 0
wasm_storage_iter_create_range_base 0
Expand All @@ -129,7 +132,7 @@ wasm_storage_iter_create_to_byte 0
wasm_storage_iter_next_base 0
wasm_storage_iter_next_key_byte 0
wasm_storage_iter_next_value_byte 0
wasm_touching_trie_node 16_101_955_926, compute: 110_000_000_000
wasm_touching_trie_node 16_101_955_926, compute: 20_000_000_000
wasm_read_cached_trie_node 2_280_000_000
wasm_promise_and_base 1_465_013_400
wasm_promise_and_per_promise 5_452_176
Expand Down
3 changes: 3 additions & 0 deletions core/parameters/res/runtime_configs/parameters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ wasm_storage_write_evicted_byte: 32_117_307
wasm_storage_read_base: 56_356_845_750
wasm_storage_read_key_byte: 30_952_533
wasm_storage_read_value_byte: 5_611_005
wasm_storage_small_read_base: 56_356_845_750
wasm_storage_small_read_key_byte: 30_952_533
wasm_storage_small_read_value_byte: 5_611_005
wasm_storage_remove_base: 53_473_030_500
wasm_storage_remove_key_byte: 38_220_384
wasm_storage_remove_ret_value_byte: 11_531_556
Expand Down
3 changes: 3 additions & 0 deletions core/parameters/res/runtime_configs/parameters_testnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ wasm_storage_write_evicted_byte: 32_117_307
wasm_storage_read_base: 56_356_845_750
wasm_storage_read_key_byte: 30_952_533
wasm_storage_read_value_byte: 5_611_005
wasm_storage_small_read_base: 56_356_845_750
wasm_storage_small_read_key_byte: 30_952_533
wasm_storage_small_read_value_byte: 5_611_005
wasm_storage_remove_base: 53_473_030_500
wasm_storage_remove_key_byte: 38_220_384
wasm_storage_remove_ret_value_byte: 11_531_556
Expand Down
9 changes: 9 additions & 0 deletions core/parameters/src/cost.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ impl ExtCostsConfig {
ExtCosts::storage_read_base => SAFETY_MULTIPLIER * 18785615250,
ExtCosts::storage_read_key_byte => SAFETY_MULTIPLIER * 10317511,
ExtCosts::storage_read_value_byte => SAFETY_MULTIPLIER * 1870335,
ExtCosts::storage_small_read_base => SAFETY_MULTIPLIER * 18785615250,
ExtCosts::storage_small_read_key_byte => SAFETY_MULTIPLIER * 10317511,
ExtCosts::storage_small_read_value_byte => SAFETY_MULTIPLIER * 1870335,
ExtCosts::storage_remove_base => SAFETY_MULTIPLIER * 17824343500,
ExtCosts::storage_remove_key_byte => SAFETY_MULTIPLIER * 12740128,
ExtCosts::storage_remove_ret_value_byte => SAFETY_MULTIPLIER * 3843852,
Expand Down Expand Up @@ -268,6 +271,9 @@ pub enum ExtCosts {
bls12381_p1_decompress_element = 80,
bls12381_p2_decompress_base = 81,
bls12381_p2_decompress_element = 82,
storage_small_read_base = 83,
storage_small_read_key_byte = 84,
storage_small_read_value_byte = 85,
}

// Type of an action, used in fees logic.
Expand Down Expand Up @@ -351,6 +357,9 @@ impl ExtCosts {
ExtCosts::storage_read_base => Parameter::WasmStorageReadBase,
ExtCosts::storage_read_key_byte => Parameter::WasmStorageReadKeyByte,
ExtCosts::storage_read_value_byte => Parameter::WasmStorageReadValueByte,
ExtCosts::storage_small_read_base => Parameter::WasmStorageSmallReadBase,
ExtCosts::storage_small_read_key_byte => Parameter::WasmStorageSmallReadKeyByte,
ExtCosts::storage_small_read_value_byte => Parameter::WasmStorageSmallReadValueByte,
ExtCosts::storage_remove_base => Parameter::WasmStorageRemoveBase,
ExtCosts::storage_remove_key_byte => Parameter::WasmStorageRemoveKeyByte,
ExtCosts::storage_remove_ret_value_byte => Parameter::WasmStorageRemoveRetValueByte,
Expand Down
3 changes: 3 additions & 0 deletions core/parameters/src/parameter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ pub enum Parameter {
WasmStorageReadBase,
WasmStorageReadKeyByte,
WasmStorageReadValueByte,
WasmStorageSmallReadBase,
WasmStorageSmallReadKeyByte,
WasmStorageSmallReadValueByte,
WasmStorageRemoveBase,
WasmStorageRemoveKeyByte,
WasmStorageRemoveRetValueByte,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ expression: config_view
"storage_read_base": 56356845750,
"storage_read_key_byte": 30952533,
"storage_read_value_byte": 5611005,
"storage_small_read_base": 56356845750,
"storage_small_read_key_byte": 30952533,
"storage_small_read_value_byte": 5611005,
"storage_remove_base": 53473030500,
"storage_remove_key_byte": 38220384,
"storage_remove_ret_value_byte": 11531556,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ expression: config_view
"storage_read_base": 56356845750,
"storage_read_key_byte": 30952533,
"storage_read_value_byte": 5611005,
"storage_small_read_base": 56356845750,
"storage_small_read_key_byte": 30952533,
"storage_small_read_value_byte": 5611005,
"storage_remove_base": 53473030500,
"storage_remove_key_byte": 38220384,
"storage_remove_ret_value_byte": 11531556,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ expression: config_view
"storage_read_base": 56356845750,
"storage_read_key_byte": 30952533,
"storage_read_value_byte": 5611005,
"storage_small_read_base": 56356845750,
"storage_small_read_key_byte": 30952533,
"storage_small_read_value_byte": 5611005,
"storage_remove_base": 53473030500,
"storage_remove_key_byte": 38220384,
"storage_remove_ret_value_byte": 11531556,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ expression: config_view
"storage_read_base": 56356845750,
"storage_read_key_byte": 30952533,
"storage_read_value_byte": 5611005,
"storage_small_read_base": 56356845750,
"storage_small_read_key_byte": 30952533,
"storage_small_read_value_byte": 5611005,
"storage_remove_base": 53473030500,
"storage_remove_key_byte": 38220384,
"storage_remove_ret_value_byte": 11531556,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ expression: config_view
"storage_read_base": 56356845750,
"storage_read_key_byte": 30952533,
"storage_read_value_byte": 5611005,
"storage_small_read_base": 56356845750,
"storage_small_read_key_byte": 30952533,
"storage_small_read_value_byte": 5611005,
"storage_remove_base": 53473030500,
"storage_remove_key_byte": 38220384,
"storage_remove_ret_value_byte": 11531556,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ expression: config_view
"storage_read_base": 56356845750,
"storage_read_key_byte": 30952533,
"storage_read_value_byte": 5611005,
"storage_small_read_base": 56356845750,
"storage_small_read_key_byte": 30952533,
"storage_small_read_value_byte": 5611005,
"storage_remove_base": 53473030500,
"storage_remove_key_byte": 38220384,
"storage_remove_ret_value_byte": 11531556,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ expression: config_view
"storage_read_base": 56356845750,
"storage_read_key_byte": 30952533,
"storage_read_value_byte": 5611005,
"storage_small_read_base": 56356845750,
"storage_small_read_key_byte": 30952533,
"storage_small_read_value_byte": 5611005,
"storage_remove_base": 53473030500,
"storage_remove_key_byte": 38220384,
"storage_remove_ret_value_byte": 11531556,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ expression: config_view
"storage_read_base": 56356845750,
"storage_read_key_byte": 30952533,
"storage_read_value_byte": 5611005,
"storage_small_read_base": 56356845750,
"storage_small_read_key_byte": 30952533,
"storage_small_read_value_byte": 5611005,
"storage_remove_base": 53473030500,
"storage_remove_key_byte": 38220384,
"storage_remove_ret_value_byte": 11531556,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ expression: config_view
"storage_read_base": 56356845750,
"storage_read_key_byte": 30952533,
"storage_read_value_byte": 5611005,
"storage_small_read_base": 56356845750,
"storage_small_read_key_byte": 30952533,
"storage_small_read_value_byte": 5611005,
"storage_remove_base": 53473030500,
"storage_remove_key_byte": 38220384,
"storage_remove_ret_value_byte": 11531556,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ expression: config_view
"storage_read_base": 56356845750,
"storage_read_key_byte": 30952533,
"storage_read_value_byte": 5611005,
"storage_small_read_base": 56356845750,
"storage_small_read_key_byte": 30952533,
"storage_small_read_value_byte": 5611005,
"storage_remove_base": 53473030500,
"storage_remove_key_byte": 38220384,
"storage_remove_ret_value_byte": 11531556,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ expression: config_view
"storage_read_base": 56356845750,
"storage_read_key_byte": 30952533,
"storage_read_value_byte": 5611005,
"storage_small_read_base": 56356845750,
"storage_small_read_key_byte": 30952533,
"storage_small_read_value_byte": 5611005,
"storage_remove_base": 53473030500,
"storage_remove_key_byte": 38220384,
"storage_remove_ret_value_byte": 11531556,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ expression: config_view
"storage_read_base": 56356845750,
"storage_read_key_byte": 30952533,
"storage_read_value_byte": 5611005,
"storage_small_read_base": 56356845750,
"storage_small_read_key_byte": 30952533,
"storage_small_read_value_byte": 5611005,
"storage_remove_base": 53473030500,
"storage_remove_key_byte": 38220384,
"storage_remove_ret_value_byte": 11531556,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ expression: config_view
"storage_read_base": 56356845750,
"storage_read_key_byte": 30952533,
"storage_read_value_byte": 5611005,
"storage_small_read_base": 56356845750,
"storage_small_read_key_byte": 30952533,
"storage_small_read_value_byte": 5611005,
"storage_remove_base": 53473030500,
"storage_remove_key_byte": 38220384,
"storage_remove_ret_value_byte": 11531556,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ expression: config_view
"storage_read_base": 56356845750,
"storage_read_key_byte": 30952533,
"storage_read_value_byte": 5611005,
"storage_small_read_base": 56356845750,
"storage_small_read_key_byte": 30952533,
"storage_small_read_value_byte": 5611005,
"storage_remove_base": 53473030500,
"storage_remove_key_byte": 38220384,
"storage_remove_ret_value_byte": 11531556,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ expression: config_view
"storage_read_base": 56356845750,
"storage_read_key_byte": 30952533,
"storage_read_value_byte": 5611005,
"storage_small_read_base": 56356845750,
"storage_small_read_key_byte": 30952533,
"storage_small_read_value_byte": 5611005,
"storage_remove_base": 53473030500,
"storage_remove_key_byte": 38220384,
"storage_remove_ret_value_byte": 11531556,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ expression: config_view
"storage_read_base": 56356845750,
"storage_read_key_byte": 30952533,
"storage_read_value_byte": 5611005,
"storage_small_read_base": 56356845750,
"storage_small_read_key_byte": 30952533,
"storage_small_read_value_byte": 5611005,
"storage_remove_base": 53473030500,
"storage_remove_key_byte": 38220384,
"storage_remove_ret_value_byte": 11531556,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ expression: config_view
"storage_read_base": 56356845750,
"storage_read_key_byte": 30952533,
"storage_read_value_byte": 5611005,
"storage_small_read_base": 56356845750,
"storage_small_read_key_byte": 30952533,
"storage_small_read_value_byte": 5611005,
"storage_remove_base": 53473030500,
"storage_remove_key_byte": 38220384,
"storage_remove_ret_value_byte": 11531556,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ expression: config_view
"storage_read_base": 56356845750,
"storage_read_key_byte": 30952533,
"storage_read_value_byte": 5611005,
"storage_small_read_base": 56356845750,
"storage_small_read_key_byte": 30952533,
"storage_small_read_value_byte": 5611005,
"storage_remove_base": 53473030500,
"storage_remove_key_byte": 38220384,
"storage_remove_ret_value_byte": 11531556,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ expression: config_view
"storage_read_base": 56356845750,
"storage_read_key_byte": 30952533,
"storage_read_value_byte": 5611005,
"storage_small_read_base": 56356845750,
"storage_small_read_key_byte": 30952533,
"storage_small_read_value_byte": 5611005,
"storage_remove_base": 53473030500,
"storage_remove_key_byte": 38220384,
"storage_remove_ret_value_byte": 11531556,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ expression: config_view
"storage_read_base": 56356845750,
"storage_read_key_byte": 30952533,
"storage_read_value_byte": 5611005,
"storage_small_read_base": 56356845750,
"storage_small_read_key_byte": 30952533,
"storage_small_read_value_byte": 5611005,
"storage_remove_base": 53473030500,
"storage_remove_key_byte": 38220384,
"storage_remove_ret_value_byte": 11531556,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ expression: config_view
"storage_read_base": 56356845750,
"storage_read_key_byte": 30952533,
"storage_read_value_byte": 5611005,
"storage_small_read_base": 56356845750,
"storage_small_read_key_byte": 30952533,
"storage_small_read_value_byte": 5611005,
"storage_remove_base": 53473030500,
"storage_remove_key_byte": 38220384,
"storage_remove_ret_value_byte": 11531556,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ expression: config_view
"storage_read_base": 56356845750,
"storage_read_key_byte": 30952533,
"storage_read_value_byte": 5611005,
"storage_small_read_base": 56356845750,
"storage_small_read_key_byte": 30952533,
"storage_small_read_value_byte": 5611005,
"storage_remove_base": 53473030500,
"storage_remove_key_byte": 38220384,
"storage_remove_ret_value_byte": 11531556,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ expression: config_view
"storage_read_base": 56356845750,
"storage_read_key_byte": 30952533,
"storage_read_value_byte": 5611005,
"storage_small_read_base": 56356845750,
"storage_small_read_key_byte": 30952533,
"storage_small_read_value_byte": 5611005,
"storage_remove_base": 53473030500,
"storage_remove_key_byte": 38220384,
"storage_remove_ret_value_byte": 11531556,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ expression: config_view
"storage_read_base": 56356845750,
"storage_read_key_byte": 30952533,
"storage_read_value_byte": 5611005,
"storage_small_read_base": 56356845750,
"storage_small_read_key_byte": 30952533,
"storage_small_read_value_byte": 5611005,
"storage_remove_base": 53473030500,
"storage_remove_key_byte": 38220384,
"storage_remove_ret_value_byte": 11531556,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ expression: config_view
"storage_read_base": 56356845750,
"storage_read_key_byte": 30952533,
"storage_read_value_byte": 5611005,
"storage_small_read_base": 56356845750,
"storage_small_read_key_byte": 30952533,
"storage_small_read_value_byte": 5611005,
"storage_remove_base": 53473030500,
"storage_remove_key_byte": 38220384,
"storage_remove_ret_value_byte": 11531556,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ expression: config_view
"storage_read_base": 56356845750,
"storage_read_key_byte": 30952533,
"storage_read_value_byte": 5611005,
"storage_small_read_base": 56356845750,
"storage_small_read_key_byte": 30952533,
"storage_small_read_value_byte": 5611005,
"storage_remove_base": 53473030500,
"storage_remove_key_byte": 38220384,
"storage_remove_ret_value_byte": 11531556,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ expression: config_view
"storage_read_base": 56356845750,
"storage_read_key_byte": 30952533,
"storage_read_value_byte": 5611005,
"storage_small_read_base": 56356845750,
"storage_small_read_key_byte": 30952533,
"storage_small_read_value_byte": 5611005,
"storage_remove_base": 53473030500,
"storage_remove_key_byte": 38220384,
"storage_remove_ret_value_byte": 11531556,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ expression: config_view
"storage_read_base": 56356845750,
"storage_read_key_byte": 30952533,
"storage_read_value_byte": 5611005,
"storage_small_read_base": 56356845750,
"storage_small_read_key_byte": 30952533,
"storage_small_read_value_byte": 5611005,
"storage_remove_base": 53473030500,
"storage_remove_key_byte": 38220384,
"storage_remove_ret_value_byte": 11531556,
Expand Down
Loading

0 comments on commit 98eaea4

Please sign in to comment.