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

[pallet-revive] implement the ref_time_left API #6908

Merged
merged 11 commits into from
Dec 18, 2024
Merged

Conversation

xermicus
Copy link
Member

This PR implements the ref_time_left API method. Solidity knows only a single "gas" dimension; Solidity contracts will use this to query the gas left.

Signed-off-by: xermicus <[email protected]>
@xermicus xermicus added R0-silent Changes should not be mentioned in any release notes T7-smart_contracts This PR/Issue is related to smart contracts. labels Dec 16, 2024
@xermicus
Copy link
Member Author

bot fmt

@command-bot
Copy link

command-bot bot commented Dec 16, 2024

@xermicus https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/7923861 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 11-9372e99b-b051-4d59-babd-4503bd3c935a to cancel this command or bot cancel to cancel all commands in this pull request.

@command-bot
Copy link

command-bot bot commented Dec 16, 2024

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

@xermicus
Copy link
Member Author

/cmd prdoc --audience runtime_dev --bump minor

@xermicus
Copy link
Member Author

/cmd bench --runtime dev --pallet pallet_revive

Copy link

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

Copy link

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_return 53.27us 77.79us +46.02
substrate/frame/revive/src/weights.rs seal_input 30.31us 39.11us +29.02
substrate/frame/revive/src/weights.rs seal_balance 4.86us 5.89us +21.26
substrate/frame/revive/src/weights.rs seal_debug_message 190.45us 211.40us +11.00
substrate/frame/revive/src/weights.rs seal_hash_sha2_256 370.16us 393.31us +6.25
substrate/frame/revive/src/weights.rs seal_block_number 296.00ns 314.00ns +6.08
substrate/frame/revive/src/weights.rs seal_address 315.00ns 332.00ns +5.40
substrate/frame/revive/src/weights.rs seal_own_code_hash 318.00ns 302.00ns -5.03
substrate/frame/revive/src/weights.rs seal_minimum_balance 318.00ns 299.00ns -5.97
substrate/frame/revive/src/weights.rs set_transient_storage_empty 1.64us 1.54us -6.39
substrate/frame/revive/src/weights.rs get_transient_storage_full 1.77us 1.63us -8.01
substrate/frame/revive/src/weights.rs seal_call_data_load 295.00ns 270.00ns -8.47
substrate/frame/revive/src/weights.rs seal_caller_is_origin 422.00ns 345.00ns -18.25
substrate/frame/revive/src/weights.rs seal_ref_time_left 263.00ns Added
Command output:

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

@@ -388,6 +388,9 @@ pub trait HostFn: private::Sealed {
/// - `offset`: Byte offset into the returned data
fn return_data_copy(output: &mut &mut [u8], offset: u32);

/// Returns the amount of ref_time left.
fn ref_time_left() -> u64;
Copy link
Contributor

Choose a reason for hiding this comment

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

I am thinking, it would be nice to get links to https://www.evm.codes/?fork=cancun#37gas for all these evm apis

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 why not, I will make a followup up for it :)

@xermicus
Copy link
Member Author

/cmd bench --runtime dev --pallet pallet_revive

@xermicus
Copy link
Member Author

/cmd bench --runtime dev --pallet pallet_revive

Copy link

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

Copy link

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

Copy link

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_call_data_copy 30.01us 39.16us +30.49
substrate/frame/revive/src/weights.rs seal_balance 4.86us 5.92us +21.77
substrate/frame/revive/src/weights.rs seal_copy_to_contract 52.97us 62.69us +18.35
substrate/frame/revive/src/weights.rs seal_return 53.27us 62.60us +17.51
substrate/frame/revive/src/weights.rs seal_caller 326.00ns 355.00ns +8.90
substrate/frame/revive/src/weights.rs seal_caller_is_root 310.00ns 331.00ns +6.77
substrate/frame/revive/src/weights.rs seal_caller_is_origin 422.00ns 391.00ns -7.35
substrate/frame/revive/src/weights.rs seal_minimum_balance 318.00ns 292.00ns -8.18
substrate/frame/revive/src/weights.rs noop_host_fn 281.18us 256.69us -8.71
substrate/frame/revive/src/weights.rs seal_ref_time_left 306.00ns Added
Command output:

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

Copy link

Command "bench --runtime dev --pallet pallet_revive" has failed ❌! See logs here

Command output:

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

@xermicus xermicus enabled auto-merge December 18, 2024 11:57
@xermicus xermicus added this pull request to the merge queue Dec 18, 2024
Merged via the queue into master with commit 6ad7488 Dec 18, 2024
197 of 201 checks passed
@xermicus xermicus deleted the cl/reftimeleft branch December 18, 2024 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
R0-silent Changes should not be mentioned in any release notes T7-smart_contracts This PR/Issue is related to smart contracts.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants