Skip to content

Commit 72d6f9f

Browse files
authored
[static ptb] More gas tweaks (#24449)
## Description - More gas tweaks based on tests ## Test plan - Updated snapshots --- ## Release notes Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required. For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates. - [ ] Protocol: - [ ] Nodes (Validators and Full nodes): - [ ] gRPC: - [ ] JSON-RPC: - [ ] GraphQL: - [ ] CLI: - [ ] Rust SDK: - [ ] Indexing Framework:
1 parent 7af7b91 commit 72d6f9f

File tree

6 files changed

+26
-20
lines changed

6 files changed

+26
-20
lines changed

crates/sui-adapter-transactional-tests/tests/size_limits/object_runtime_limits.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ task 3, line 30:
2222
//# run a::m::add_n_items --sender A --args 1000 --gas-budget 1000000000000 --summarize
2323
created: 2000
2424
mutated: 1
25-
gas summary: computation_cost: 224000000, storage_cost: 2691388000, storage_rebate: 978120, non_refundable_storage_fee: 9880
25+
gas summary: computation_cost: 168000000, storage_cost: 2691388000, storage_rebate: 978120, non_refundable_storage_fee: 9880
2626

2727
task 4, line 32:
2828
//# run a::m::add_n_items --sender A --args 1025 --gas-budget 1000000000000

crates/sui-protocol-config/src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4264,9 +4264,15 @@ impl ProtocolConfig {
42644264
cfg.gas_model_version = Some(11);
42654265
cfg.feature_flags.abstract_size_in_object_runtime = true;
42664266
cfg.feature_flags.object_runtime_charge_cache_load_gas = true;
4267+
cfg.dynamic_field_hash_type_and_key_cost_base = Some(52);
4268+
cfg.dynamic_field_add_child_object_cost_base = Some(52);
42674269
cfg.dynamic_field_add_child_object_value_cost_per_byte = Some(1);
4270+
cfg.dynamic_field_borrow_child_object_cost_base = Some(52);
42684271
cfg.dynamic_field_borrow_child_object_child_ref_cost_per_byte = Some(1);
4272+
cfg.dynamic_field_remove_child_object_cost_base = Some(52);
42694273
cfg.dynamic_field_remove_child_object_child_cost_per_byte = Some(1);
4274+
cfg.dynamic_field_has_child_object_cost_base = Some(52);
4275+
cfg.dynamic_field_has_child_object_with_ty_cost_base = Some(52);
42704276
cfg.feature_flags.enable_ptb_execution_v2 = true;
42714277

42724278
cfg.poseidon_bn254_cost_base = Some(260);

crates/sui-protocol-config/src/snapshots/sui_protocol_config__test__Mainnet_version_104.snap

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -223,22 +223,22 @@ address_to_u256_cost_base: 52
223223
address_from_u256_cost_base: 52
224224
config_read_setting_impl_cost_base: 100
225225
config_read_setting_impl_cost_per_byte: 40
226-
dynamic_field_hash_type_and_key_cost_base: 100
226+
dynamic_field_hash_type_and_key_cost_base: 52
227227
dynamic_field_hash_type_and_key_type_cost_per_byte: 2
228228
dynamic_field_hash_type_and_key_value_cost_per_byte: 2
229229
dynamic_field_hash_type_and_key_type_tag_cost_per_byte: 2
230-
dynamic_field_add_child_object_cost_base: 100
230+
dynamic_field_add_child_object_cost_base: 52
231231
dynamic_field_add_child_object_type_cost_per_byte: 10
232232
dynamic_field_add_child_object_value_cost_per_byte: 1
233233
dynamic_field_add_child_object_struct_tag_cost_per_byte: 10
234-
dynamic_field_borrow_child_object_cost_base: 100
234+
dynamic_field_borrow_child_object_cost_base: 52
235235
dynamic_field_borrow_child_object_child_ref_cost_per_byte: 1
236236
dynamic_field_borrow_child_object_type_cost_per_byte: 10
237-
dynamic_field_remove_child_object_cost_base: 100
237+
dynamic_field_remove_child_object_cost_base: 52
238238
dynamic_field_remove_child_object_child_cost_per_byte: 1
239239
dynamic_field_remove_child_object_type_cost_per_byte: 2
240-
dynamic_field_has_child_object_cost_base: 100
241-
dynamic_field_has_child_object_with_ty_cost_base: 100
240+
dynamic_field_has_child_object_cost_base: 52
241+
dynamic_field_has_child_object_with_ty_cost_base: 52
242242
dynamic_field_has_child_object_with_ty_type_cost_per_byte: 2
243243
dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte: 2
244244
event_emit_cost_base: 52

crates/sui-protocol-config/src/snapshots/sui_protocol_config__test__Testnet_version_104.snap

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -224,22 +224,22 @@ address_to_u256_cost_base: 52
224224
address_from_u256_cost_base: 52
225225
config_read_setting_impl_cost_base: 100
226226
config_read_setting_impl_cost_per_byte: 40
227-
dynamic_field_hash_type_and_key_cost_base: 100
227+
dynamic_field_hash_type_and_key_cost_base: 52
228228
dynamic_field_hash_type_and_key_type_cost_per_byte: 2
229229
dynamic_field_hash_type_and_key_value_cost_per_byte: 2
230230
dynamic_field_hash_type_and_key_type_tag_cost_per_byte: 2
231-
dynamic_field_add_child_object_cost_base: 100
231+
dynamic_field_add_child_object_cost_base: 52
232232
dynamic_field_add_child_object_type_cost_per_byte: 10
233233
dynamic_field_add_child_object_value_cost_per_byte: 1
234234
dynamic_field_add_child_object_struct_tag_cost_per_byte: 10
235-
dynamic_field_borrow_child_object_cost_base: 100
235+
dynamic_field_borrow_child_object_cost_base: 52
236236
dynamic_field_borrow_child_object_child_ref_cost_per_byte: 1
237237
dynamic_field_borrow_child_object_type_cost_per_byte: 10
238-
dynamic_field_remove_child_object_cost_base: 100
238+
dynamic_field_remove_child_object_cost_base: 52
239239
dynamic_field_remove_child_object_child_cost_per_byte: 1
240240
dynamic_field_remove_child_object_type_cost_per_byte: 2
241-
dynamic_field_has_child_object_cost_base: 100
242-
dynamic_field_has_child_object_with_ty_cost_base: 100
241+
dynamic_field_has_child_object_cost_base: 52
242+
dynamic_field_has_child_object_with_ty_cost_base: 52
243243
dynamic_field_has_child_object_with_ty_type_cost_per_byte: 2
244244
dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte: 2
245245
event_emit_cost_base: 52

crates/sui-protocol-config/src/snapshots/sui_protocol_config__test__version_104.snap

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -227,22 +227,22 @@ address_to_u256_cost_base: 52
227227
address_from_u256_cost_base: 52
228228
config_read_setting_impl_cost_base: 100
229229
config_read_setting_impl_cost_per_byte: 40
230-
dynamic_field_hash_type_and_key_cost_base: 100
230+
dynamic_field_hash_type_and_key_cost_base: 52
231231
dynamic_field_hash_type_and_key_type_cost_per_byte: 2
232232
dynamic_field_hash_type_and_key_value_cost_per_byte: 2
233233
dynamic_field_hash_type_and_key_type_tag_cost_per_byte: 2
234-
dynamic_field_add_child_object_cost_base: 100
234+
dynamic_field_add_child_object_cost_base: 52
235235
dynamic_field_add_child_object_type_cost_per_byte: 10
236236
dynamic_field_add_child_object_value_cost_per_byte: 1
237237
dynamic_field_add_child_object_struct_tag_cost_per_byte: 10
238-
dynamic_field_borrow_child_object_cost_base: 100
238+
dynamic_field_borrow_child_object_cost_base: 52
239239
dynamic_field_borrow_child_object_child_ref_cost_per_byte: 1
240240
dynamic_field_borrow_child_object_type_cost_per_byte: 10
241-
dynamic_field_remove_child_object_cost_base: 100
241+
dynamic_field_remove_child_object_cost_base: 52
242242
dynamic_field_remove_child_object_child_cost_per_byte: 1
243243
dynamic_field_remove_child_object_type_cost_per_byte: 2
244-
dynamic_field_has_child_object_cost_base: 100
245-
dynamic_field_has_child_object_with_ty_cost_base: 100
244+
dynamic_field_has_child_object_cost_base: 52
245+
dynamic_field_has_child_object_with_ty_cost_base: 52
246246
dynamic_field_has_child_object_with_ty_type_cost_per_byte: 2
247247
dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte: 2
248248
event_emit_cost_base: 52

sui-execution/latest/sui-move-natives/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1399,7 +1399,7 @@ macro_rules! charge_cache_or_load_gas {
13991399
let config = get_extension!($context, ObjectRuntime)?.protocol_config;
14001400
if config.object_runtime_charge_cache_load_gas() {
14011401
let bytes = bytes_opt.unwrap_or(SUI_ADDRESS_LENGTH as usize);
1402-
let cost = 2 * bytes * config.obj_access_cost_read_per_byte() as usize;
1402+
let cost = bytes * config.obj_access_cost_read_per_byte() as usize;
14031403
native_charge_gas_early_exit!($context, InternalGas::new(cost as u64));
14041404
}
14051405
}

0 commit comments

Comments
 (0)