Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yield_resume: fix resume per-byte cost #12192

Merged
merged 1 commit into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/parameters/res/runtime_configs/67.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ yield_resume: { old: false, new: true }
wasm_yield_create_base: { old: 300_000_000_000_000, new: 153_411_779_276 }
wasm_yield_create_byte: { old: 300_000_000_000_000, new: 15_643_988 }
wasm_yield_resume_base: { old: 300_000_000_000_000, new: 1_195_627_285_210 }
wasm_yield_resume_byte: { old: 300_000_000_000_000, new: 17_212_011 }
wasm_yield_resume_byte: { old: 300_000_000_000_000, new: 1_195_627_285_210 }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you modify an old config? Even if unused it seems like a bad practice.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC we were processing this config file the wrong way because of the bug in core/parameters/src/cost.rs. Now that we process it correctly we need to change the old file to maintain correct replayability.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As described. The fee for byte between 67 and 73 was factually 1.195Tg and this change reflects the reality. I could have added a new parameter altogether, but that would have required a change in 67 anyway (though it would have been entirely additive.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

omg, of course, thanks for clarifying

4 changes: 0 additions & 4 deletions core/parameters/res/runtime_configs/69.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,3 @@ data_receipt_creation_per_byte: {
execution: 17_212_011,
}
}
wasm_yield_resume_byte: {
old: 17_212_011,
new: 47_683_715
}
1 change: 1 addition & 0 deletions core/parameters/res/runtime_configs/73.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
wasm_yield_resume_byte: { old: 1_195_627_285_210 , new: 47_683_715 }
2 changes: 1 addition & 1 deletion core/parameters/res/runtime_configs/parameters.snap
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ wasm_alt_bn128_g1_sum_element 5_000_000_000
wasm_yield_create_base 153_411_779_276
wasm_yield_create_byte 15_643_988
wasm_yield_resume_base 1_195_627_285_210
wasm_yield_resume_byte 47_683_715
wasm_yield_resume_byte 1_195_627_285_210
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this right? Perhaps I don't understand what parameters.snap is supposed to do.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, this is a snapshot of the parameters that we have at the current stable protocol version. I hadn't updated the protocol version in the previous revision, but I have done so now so the snapshot has been updated.

wasm_bls12381_p1_sum_base 16_500_000_000
wasm_bls12381_p1_sum_element 6_000_000_000
wasm_bls12381_p2_sum_base 18_600_000_000
Expand Down
1 change: 1 addition & 0 deletions core/parameters/src/config_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ static CONFIG_DIFFS: &[(ProtocolVersion, &str)] = &[
(70, include_config!("70.yaml")),
// Increase main_storage_proof_size_soft_limit and introduces StateStoredReceipt
(72, include_config!("72.yaml")),
(73, include_config!("73.yaml")),
(129, include_config!("129.yaml")),
];

Expand Down
2 changes: 1 addition & 1 deletion core/parameters/src/cost.rs
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ impl ExtCosts {
ExtCosts::yield_create_base => Parameter::WasmYieldCreateBase,
ExtCosts::yield_create_byte => Parameter::WasmYieldCreateByte,
ExtCosts::yield_resume_base => Parameter::WasmYieldResumeBase,
ExtCosts::yield_resume_byte => Parameter::WasmYieldResumeBase,
Copy link
Collaborator

@saketh-are saketh-are Oct 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh 🥲

ExtCosts::yield_resume_byte => Parameter::WasmYieldResumeByte,
ExtCosts::bls12381_p1_sum_base => Parameter::WasmBls12381P1SumBase,
ExtCosts::bls12381_p1_sum_element => Parameter::WasmBls12381P1SumElement,
ExtCosts::bls12381_p2_sum_base => Parameter::WasmBls12381P2SumBase,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ expression: config_view
"yield_create_base": 153411779276,
"yield_create_byte": 15643988,
"yield_resume_base": 1195627285210,
"yield_resume_byte": 1195627285210,
"yield_resume_byte": 47683715,
"bls12381_p1_sum_base": 16500000000,
"bls12381_p1_sum_element": 6000000000,
"bls12381_p2_sum_base": 18600000000,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,267 @@
---
source: core/parameters/src/config_store.rs
expression: config_view
---
{
"storage_amount_per_byte": "10000000000000000000",
"transaction_costs": {
"action_receipt_creation_config": {
"send_sir": 108059500000,
"send_not_sir": 108059500000,
"execution": 108059500000
},
"data_receipt_creation_config": {
"base_cost": {
"send_sir": 36486732312,
"send_not_sir": 36486732312,
"execution": 36486732312
},
"cost_per_byte": {
"send_sir": 17212011,
"send_not_sir": 47683715,
"execution": 17212011
}
},
"action_creation_config": {
"create_account_cost": {
"send_sir": 3850000000000,
"send_not_sir": 3850000000000,
"execution": 3850000000000
},
"deploy_contract_cost": {
"send_sir": 184765750000,
"send_not_sir": 184765750000,
"execution": 184765750000
},
"deploy_contract_cost_per_byte": {
"send_sir": 6812999,
"send_not_sir": 47683715,
"execution": 64572944
},
"function_call_cost": {
"send_sir": 200000000000,
"send_not_sir": 200000000000,
"execution": 780000000000
},
"function_call_cost_per_byte": {
"send_sir": 2235934,
"send_not_sir": 47683715,
"execution": 2235934
},
"transfer_cost": {
"send_sir": 115123062500,
"send_not_sir": 115123062500,
"execution": 115123062500
},
"stake_cost": {
"send_sir": 141715687500,
"send_not_sir": 141715687500,
"execution": 102217625000
},
"add_key_cost": {
"full_access_cost": {
"send_sir": 101765125000,
"send_not_sir": 101765125000,
"execution": 101765125000
},
"function_call_cost": {
"send_sir": 102217625000,
"send_not_sir": 102217625000,
"execution": 102217625000
},
"function_call_cost_per_byte": {
"send_sir": 1925331,
"send_not_sir": 47683715,
"execution": 1925331
}
},
"delete_key_cost": {
"send_sir": 94946625000,
"send_not_sir": 94946625000,
"execution": 94946625000
},
"delete_account_cost": {
"send_sir": 147489000000,
"send_not_sir": 147489000000,
"execution": 147489000000
},
"delegate_cost": {
"send_sir": 200000000000,
"send_not_sir": 200000000000,
"execution": 200000000000
}
},
"storage_usage_config": {
"num_bytes_account": 100,
"num_extra_bytes_record": 40
},
"burnt_gas_reward": [
3,
10
],
"pessimistic_gas_price_inflation_ratio": [
103,
100
]
},
"wasm_config": {
"ext_costs": {
"base": 264768111,
"contract_loading_base": 35445963,
"contract_loading_bytes": 1089295,
"read_memory_base": 2609863200,
"read_memory_byte": 3801333,
"write_memory_base": 2803794861,
"write_memory_byte": 2723772,
"read_register_base": 2517165186,
"read_register_byte": 98562,
"write_register_base": 2865522486,
"write_register_byte": 3801564,
"utf8_decoding_base": 3111779061,
"utf8_decoding_byte": 291580479,
"utf16_decoding_base": 3543313050,
"utf16_decoding_byte": 163577493,
"sha256_base": 4540970250,
"sha256_byte": 24117351,
"keccak256_base": 5879491275,
"keccak256_byte": 21471105,
"keccak512_base": 5811388236,
"keccak512_byte": 36649701,
"ripemd160_base": 853675086,
"ripemd160_block": 680107584,
"ed25519_verify_base": 210000000000,
"ed25519_verify_byte": 9000000,
"ecrecover_base": 278821988457,
"log_base": 3543313050,
"log_byte": 13198791,
"storage_write_base": 64196736000,
"storage_write_key_byte": 70482867,
"storage_write_value_byte": 31018539,
"storage_write_evicted_byte": 32117307,
"storage_read_base": 56356845749,
"storage_read_key_byte": 30952533,
"storage_read_value_byte": 5611004,
"storage_large_read_overhead_base": 1,
"storage_large_read_overhead_byte": 1,
"storage_remove_base": 53473030500,
"storage_remove_key_byte": 38220384,
"storage_remove_ret_value_byte": 11531556,
"storage_has_key_base": 54039896625,
"storage_has_key_byte": 30790845,
"storage_iter_create_prefix_base": 0,
"storage_iter_create_prefix_byte": 0,
"storage_iter_create_range_base": 0,
"storage_iter_create_from_byte": 0,
"storage_iter_create_to_byte": 0,
"storage_iter_next_base": 0,
"storage_iter_next_key_byte": 0,
"storage_iter_next_value_byte": 0,
"touching_trie_node": 16101955926,
"read_cached_trie_node": 2280000000,
"promise_and_base": 1465013400,
"promise_and_per_promise": 5452176,
"promise_return": 560152386,
"validator_stake_base": 911834726400,
"validator_total_stake_base": 911834726400,
"contract_compile_base": 0,
"contract_compile_bytes": 0,
"alt_bn128_g1_multiexp_base": 713000000000,
"alt_bn128_g1_multiexp_element": 320000000000,
"alt_bn128_g1_sum_base": 3000000000,
"alt_bn128_g1_sum_element": 5000000000,
"alt_bn128_pairing_check_base": 9686000000000,
"alt_bn128_pairing_check_element": 5102000000000,
"yield_create_base": 153411779276,
"yield_create_byte": 15643988,
"yield_resume_base": 1195627285210,
"yield_resume_byte": 47683715,
"bls12381_p1_sum_base": 16500000000,
"bls12381_p1_sum_element": 6000000000,
"bls12381_p2_sum_base": 18600000000,
"bls12381_p2_sum_element": 15000000000,
"bls12381_g1_multiexp_base": 16500000000,
"bls12381_g1_multiexp_element": 930000000000,
"bls12381_g2_multiexp_base": 18600000000,
"bls12381_g2_multiexp_element": 1995000000000,
"bls12381_map_fp_to_g1_base": 1500000000,
"bls12381_map_fp_to_g1_element": 252000000000,
"bls12381_map_fp2_to_g2_base": 1500000000,
"bls12381_map_fp2_to_g2_element": 900000000000,
"bls12381_pairing_base": 2130000000000,
"bls12381_pairing_element": 2130000000000,
"bls12381_p1_decompress_base": 15000000000,
"bls12381_p1_decompress_element": 81000000000,
"bls12381_p2_decompress_base": 15000000000,
"bls12381_p2_decompress_element": 165000000000
},
"grow_mem_cost": 1,
"regular_op_cost": 822756,
"vm_kind": "<REDACTED>",
"disable_9393_fix": false,
"discard_custom_sections": true,
"storage_get_mode": "FlatStorage",
"fix_contract_loading_cost": false,
"implicit_account_creation": true,
"math_extension": true,
"ed25519_verify": true,
"alt_bn128": true,
"function_call_weight": true,
"eth_implicit_accounts": true,
"yield_resume_host_functions": true,
"limit_config": {
"max_gas_burnt": 300000000000000,
"max_stack_height": 262144,
"contract_prepare_version": 2,
"initial_memory_pages": 1024,
"max_memory_pages": 2048,
"registers_memory_limit": 1073741824,
"max_register_size": 104857600,
"max_number_registers": 100,
"max_number_logs": 100,
"max_total_log_length": 16384,
"max_total_prepaid_gas": 300000000000000,
"max_actions_per_receipt": 100,
"max_number_bytes_method_names": 2000,
"max_length_method_name": 256,
"max_arguments_length": 4194304,
"max_length_returned_data": 4194304,
"max_contract_size": 4194304,
"max_transaction_size": 1572864,
"max_receipt_size": 4194304,
"max_length_storage_key": 2048,
"max_length_storage_value": 4194304,
"max_promises_per_function_call_action": 1024,
"max_number_input_data_dependencies": 128,
"max_functions_number_per_contract": 10000,
"wasmer2_stack_limit": 204800,
"max_locals_per_contract": 1000000,
"account_id_validity_rules_version": 1,
"yield_timeout_length_in_blocks": 200,
"max_yield_payload_size": 1024,
"per_receipt_storage_proof_size_limit": 4000000
}
},
"account_creation_config": {
"min_allowed_top_level_account_length": 65,
"registrar_account_id": "registrar"
},
"congestion_control_config": {
"max_congestion_incoming_gas": 20000000000000000,
"max_congestion_outgoing_gas": 10000000000000000,
"max_congestion_memory_consumption": 1000000000,
"max_congestion_missed_chunks": 5,
"max_outgoing_gas": 300000000000000000,
"min_outgoing_gas": 1000000000000000,
"allowed_shard_outgoing_gas": 1000000000000000,
"max_tx_gas": 500000000000000,
"min_tx_gas": 20000000000000,
"reject_tx_congestion_threshold": 0.5,
"outgoing_receipts_usual_size_limit": 102400,
"outgoing_receipts_big_size_limit": 4718592
},
"witness_config": {
"main_storage_proof_size_soft_limit": 4000000,
"combined_transactions_size_limit": 4194304,
"new_transactions_validation_state_size_soft_limit": 572864
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ expression: config_view
"yield_create_base": 153411779276,
"yield_create_byte": 15643988,
"yield_resume_base": 1195627285210,
"yield_resume_byte": 1195627285210,
"yield_resume_byte": 47683715,
"bls12381_p1_sum_base": 16500000000,
"bls12381_p1_sum_element": 6000000000,
"bls12381_p2_sum_base": 18600000000,
Expand Down
Loading
Loading