Skip to content

Conversation

@xermicus
Copy link
Member

This PR implements the gas limit API, returning the maximum ref_time per block. Solidity contracts only know a single weight dimension and can use this method to get the block ref_time limit.

Signed-off-by: Cyrill Leutwiler <[email protected]>
@xermicus xermicus added R0-no-crate-publish-required The change does not require any crates to be re-published. T7-smart_contracts This PR/Issue is related to smart contracts. labels Dec 17, 2024
@xermicus
Copy link
Member Author

bot fmt

@command-bot
Copy link

command-bot bot commented Dec 17, 2024

@xermicus https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/7927502 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/fmt/fmt.sh". Check out https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/pipelines?page=1&scope=all&username=group_605_bot to know what else is being executed currently.

Comment bot cancel 14-7f05abaf-9722-4e2f-a77b-50451dce375e to cancel this command or bot cancel to cancel all commands in this pull request.

@command-bot
Copy link

command-bot bot commented Dec 17, 2024

@xermicus Command "$PIPELINE_SCRIPTS_DIR/commands/fmt/fmt.sh" has finished. Result: https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/7927502 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/7927502/artifacts/download.

@xermicus
Copy link
Member Author

/cmd prdoc --audience runtime_dev --bump major

@xermicus
Copy link
Member Author

/cmd bench --runtime dev --pallet pallet_revive

@github-actions
Copy link
Contributor

Command "bench --runtime dev --pallet pallet_revive" has started 🚀 See logs here


/// Maximum size of events (including topics) and storage values.
pub const PAYLOAD_BYTES: u32 = 512;
pub const PAYLOAD_BYTES: u32 = 384;
Copy link
Member

Choose a reason for hiding this comment

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

This seems unrelated. Why was this changed?

Copy link
Member Author

Choose a reason for hiding this comment

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

Should have pointed out. The integrity checks fail with 2 seconds ref_time and payload bytes of 512 because the max_events_size < storage_size_limit fails. I lowered this because I think we want 2s ref_time per block.

If there is a better solution or the integrity check is incorrect we should fix that, I'm open.

Copy link
Member

Choose a reason for hiding this comment

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

On a parachain you only have 0.5s of execution time. With async backing its 1 second I think. But probably better to lower this ratio in order to future proof.

Copy link
Member

@athei athei Dec 18, 2024

Choose a reason for hiding this comment

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

@github-actions
Copy link
Contributor

Command "bench --runtime dev --pallet pallet_revive" has finished ✅ See logs here

Subweight results:
File Extrinsic Old New Change [%]
cumulus/pallets/collator-selection/src/weights.rs leave_intent - - ERROR
cumulus/pallets/collator-selection/src/weights.rs new_session - - ERROR
cumulus/pallets/collator-selection/src/weights.rs register_as_candidate - - ERROR
cumulus/pallets/collator-selection/src/weights.rs set_invulnerables - - ERROR
cumulus/pallets/collator-selection/src/weights.rs take_candidate_slot - - ERROR
cumulus/pallets/collator-selection/src/weights.rs update_bond - - ERROR
cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/pallet_collator_selection.rs take_candidate_slot - - ERROR
cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/pallet_collator_selection.rs update_bond - - ERROR
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_collator_selection.rs take_candidate_slot - - ERROR
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_collator_selection.rs update_bond - - ERROR
cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_collator_selection.rs take_candidate_slot - - ERROR
cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_collator_selection.rs update_bond - - ERROR
cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/pallet_collator_selection.rs take_candidate_slot - - ERROR
cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/pallet_collator_selection.rs update_bond - - ERROR
cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/pallet_collator_selection.rs take_candidate_slot - - ERROR
cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/pallet_collator_selection.rs update_bond - - ERROR
cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/pallet_core_fellowship_ambassador_core.rs promote_fast - - ERROR
cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/pallet_core_fellowship_fellowship_core.rs promote_fast - - ERROR
cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/pallet_preimage.rs ensure_updated - - ERROR
cumulus/parachains/runtimes/people/people-rococo/src/weights/pallet_collator_selection.rs take_candidate_slot - - ERROR
cumulus/parachains/runtimes/people/people-rococo/src/weights/pallet_collator_selection.rs update_bond - - ERROR
cumulus/parachains/runtimes/people/people-westend/src/weights/pallet_collator_selection.rs take_candidate_slot - - ERROR
cumulus/parachains/runtimes/people/people-westend/src/weights/pallet_collator_selection.rs update_bond - - ERROR
polkadot/runtime/westend/src/weights/pallet_preimage.rs ensure_updated - - ERROR
substrate/frame/election-provider-support/src/weights.rs phragmen - - ERROR
substrate/frame/election-provider-support/src/weights.rs phragmms - - ERROR
substrate/frame/revive/src/weights.rs seal_clear_storage - - ERROR
substrate/frame/revive/src/weights.rs seal_clear_transient_storage - - ERROR
substrate/frame/revive/src/weights.rs seal_contains_storage - - ERROR
substrate/frame/revive/src/weights.rs seal_contains_transient_storage - - ERROR
substrate/frame/revive/src/weights.rs seal_deposit_event - - ERROR
substrate/frame/revive/src/weights.rs seal_get_storage - - ERROR
substrate/frame/revive/src/weights.rs seal_get_transient_storage - - ERROR
substrate/frame/revive/src/weights.rs seal_set_storage - - ERROR
substrate/frame/revive/src/weights.rs seal_set_transient_storage - - ERROR
substrate/frame/revive/src/weights.rs seal_take_storage - - ERROR
substrate/frame/revive/src/weights.rs seal_take_transient_storage - - ERROR
substrate/frame/revive/src/weights.rs seal_balance 4.86us 5.74us +18.09
substrate/frame/revive/src/weights.rs seal_return 53.27us 57.49us +7.91
substrate/frame/revive/src/weights.rs seal_input 30.31us 32.12us +5.98
substrate/frame/revive/src/weights.rs rollback_transient_storage 1.15us 1.22us +5.81
substrate/frame/revive/src/weights.rs instantiate_with_code 2.13ms 2.24ms +5.16
substrate/frame/revive/src/weights.rs seal_minimum_balance 318.00ns 298.00ns -6.29
substrate/frame/revive/src/weights.rs set_transient_storage_empty 1.64us 1.53us -6.52
substrate/frame/revive/src/weights.rs seal_call_data_size 303.00ns 281.00ns -7.26
substrate/frame/revive/src/weights.rs seal_caller_is_root 310.00ns 287.00ns -7.42
substrate/frame/revive/src/weights.rs seal_address 315.00ns 291.00ns -7.62
substrate/frame/revive/src/weights.rs seal_origin 292.00ns 269.00ns -7.88
substrate/frame/revive/src/weights.rs get_transient_storage_full 1.77us 1.62us -8.30
substrate/frame/revive/src/weights.rs seal_value_transferred 299.00ns 260.00ns -13.04
substrate/frame/revive/src/weights.rs seal_caller_is_origin 422.00ns 360.00ns -14.69
substrate/frame/revive/src/weights.rs seal_own_code_hash 318.00ns 267.00ns -16.04
substrate/frame/revive/src/weights.rs seal_gas_limit 304.00ns Added
Command output:

✅ Successful benchmarks of runtimes/pallets:
-- dev: ['pallet_revive']

Comment on lines 375 to 378
pub BlockWeights: frame_system::limits::BlockWeights =
frame_system::limits::BlockWeights::simple_max(
Weight::from_parts(2u64 * WEIGHT_REF_TIME_PER_SECOND, u64::MAX),
Weight::from_parts(2 * WEIGHT_REF_TIME_PER_SECOND, u64::MAX),
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah I think we should have this consistent. But I think it should be the maximum we aim to support. What would that be?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Bumped it a bit further to 448, approaching the 2s limit closely.

@xermicus
Copy link
Member Author

/cmd bench --runtime dev --pallet pallet_revive

@xermicus xermicus enabled auto-merge December 18, 2024 15:59
@xermicus xermicus disabled auto-merge December 18, 2024 15:59
@xermicus xermicus enabled auto-merge December 18, 2024 16:01
@github-actions
Copy link
Contributor

Command "bench --runtime dev --pallet pallet_revive" has started 🚀 See logs here

@xermicus xermicus disabled auto-merge December 18, 2024 16:12
@paritytech-workflow-stopper
Copy link

All GitHub workflows were cancelled due to failure one of the required jobs.
Failed workflow url: https://github.com/paritytech/polkadot-sdk/actions/runs/12396681511
Failed job name: test-linux-stable-no-try-runtime

@xermicus xermicus enabled auto-merge December 18, 2024 16:45
@github-actions
Copy link
Contributor

Command "bench --runtime dev --pallet pallet_revive" has finished ✅ See logs here

Subweight results:
File Extrinsic Old New Change [%]
cumulus/pallets/collator-selection/src/weights.rs leave_intent - - ERROR
cumulus/pallets/collator-selection/src/weights.rs new_session - - ERROR
cumulus/pallets/collator-selection/src/weights.rs register_as_candidate - - ERROR
cumulus/pallets/collator-selection/src/weights.rs set_invulnerables - - ERROR
cumulus/pallets/collator-selection/src/weights.rs take_candidate_slot - - ERROR
cumulus/pallets/collator-selection/src/weights.rs update_bond - - ERROR
cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/pallet_collator_selection.rs take_candidate_slot - - ERROR
cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/pallet_collator_selection.rs update_bond - - ERROR
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_collator_selection.rs take_candidate_slot - - ERROR
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_collator_selection.rs update_bond - - ERROR
cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_collator_selection.rs take_candidate_slot - - ERROR
cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_collator_selection.rs update_bond - - ERROR
cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/pallet_collator_selection.rs take_candidate_slot - - ERROR
cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/pallet_collator_selection.rs update_bond - - ERROR
cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/pallet_collator_selection.rs take_candidate_slot - - ERROR
cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/pallet_collator_selection.rs update_bond - - ERROR
cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/pallet_core_fellowship_ambassador_core.rs promote_fast - - ERROR
cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/pallet_core_fellowship_fellowship_core.rs promote_fast - - ERROR
cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/pallet_preimage.rs ensure_updated - - ERROR
cumulus/parachains/runtimes/people/people-rococo/src/weights/pallet_collator_selection.rs take_candidate_slot - - ERROR
cumulus/parachains/runtimes/people/people-rococo/src/weights/pallet_collator_selection.rs update_bond - - ERROR
cumulus/parachains/runtimes/people/people-westend/src/weights/pallet_collator_selection.rs take_candidate_slot - - ERROR
cumulus/parachains/runtimes/people/people-westend/src/weights/pallet_collator_selection.rs update_bond - - ERROR
polkadot/runtime/westend/src/weights/pallet_preimage.rs ensure_updated - - ERROR
substrate/frame/election-provider-support/src/weights.rs phragmen - - ERROR
substrate/frame/election-provider-support/src/weights.rs phragmms - - ERROR
substrate/frame/revive/src/weights.rs seal_clear_storage - - ERROR
substrate/frame/revive/src/weights.rs seal_clear_transient_storage - - ERROR
substrate/frame/revive/src/weights.rs seal_contains_storage - - ERROR
substrate/frame/revive/src/weights.rs seal_contains_transient_storage - - ERROR
substrate/frame/revive/src/weights.rs seal_deposit_event - - ERROR
substrate/frame/revive/src/weights.rs seal_get_storage - - ERROR
substrate/frame/revive/src/weights.rs seal_get_transient_storage - - ERROR
substrate/frame/revive/src/weights.rs seal_set_storage - - ERROR
substrate/frame/revive/src/weights.rs seal_set_transient_storage - - ERROR
substrate/frame/revive/src/weights.rs seal_take_storage - - ERROR
substrate/frame/revive/src/weights.rs seal_copy_to_contract 54.40us 77.94us +43.29
substrate/frame/revive/src/weights.rs seal_return 55.84us 77.97us +39.62
substrate/frame/revive/src/weights.rs seal_call_data_copy 29.91us 39.57us +32.30
substrate/frame/revive/src/weights.rs seal_debug_message 190.04us 213.97us +12.59
substrate/frame/revive/src/weights.rs seal_weight_to_fee 1.39us 1.50us +8.36
substrate/frame/revive/src/weights.rs seal_ref_time_left 265.00ns 282.00ns +6.42
substrate/frame/revive/src/weights.rs seal_hash_blake2_128 401.07us 426.24us +6.28
substrate/frame/revive/src/weights.rs seal_hash_sha2_256 372.63us 393.84us +5.69
substrate/frame/revive/src/weights.rs seal_hash_blake2_256 401.52us 421.93us +5.08
substrate/frame/revive/src/weights.rs set_transient_storage_empty 1.59us 1.51us -5.15
substrate/frame/revive/src/weights.rs seal_address 304.00ns 287.00ns -5.59
substrate/frame/revive/src/weights.rs seal_call_data_size 271.00ns 252.00ns -7.01
substrate/frame/revive/src/weights.rs seal_return_data_size 268.00ns 245.00ns -8.58
substrate/frame/revive/src/weights.rs seal_caller_is_root 296.00ns 266.00ns -10.14
substrate/frame/revive/src/weights.rs seal_caller 349.00ns 312.00ns -10.60
substrate/frame/revive/src/weights.rs seal_minimum_balance 275.00ns 245.00ns -10.91
substrate/frame/revive/src/weights.rs seal_caller_is_origin 391.00ns 340.00ns -13.04
substrate/frame/revive/src/weights.rs seal_value_transferred 323.00ns 279.00ns -13.62
substrate/frame/revive/src/weights.rs seal_origin 293.00ns 252.00ns -13.99
substrate/frame/revive/src/weights.rs seal_block_number 304.00ns 242.00ns -20.39
substrate/frame/revive/src/weights.rs seal_now 294.00ns 234.00ns -20.41
substrate/frame/revive/src/weights.rs seal_call_data_load 322.00ns 243.00ns -24.53
substrate/frame/revive/src/weights.rs seal_gas_limit 310.00ns Added
Command output:

✅ Successful benchmarks of runtimes/pallets:
-- dev: ['pallet_revive']

@xermicus xermicus added this pull request to the merge queue Dec 18, 2024
Merged via the queue into master with commit ddfc608 Dec 18, 2024
197 of 201 checks passed
@xermicus xermicus deleted the cl/gaslimit branch December 18, 2024 17:55
dudo50 pushed a commit to paraspell-research/polkadot-sdk that referenced this pull request Jan 4, 2025
This PR implements the gas limit API, returning the maximum ref_time per
block. Solidity contracts only know a single weight dimension and can
use this method to get the block ref_time limit.

---------

Signed-off-by: Cyrill Leutwiler <[email protected]>
Signed-off-by: xermicus <[email protected]>
Co-authored-by: command-bot <>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

R0-no-crate-publish-required The change does not require any crates to be re-published. T7-smart_contracts This PR/Issue is related to smart contracts.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants