Skip to content

[WIP] pallet-revive: cold/hot storage access pricing for call opcodes#12673

Open
marian-radu wants to merge 6 commits into
masterfrom
mr/revive-cold-hot-call-opcodes
Open

[WIP] pallet-revive: cold/hot storage access pricing for call opcodes#12673
marian-radu wants to merge 6 commits into
masterfrom
mr/revive-cold-hot-call-opcodes

Conversation

@marian-radu

Copy link
Copy Markdown
Contributor

Summary

Extends the per-transaction cold/hot pricing from #12104 to the storage reads performed by the call opcodes in pallet-revive. The first access to each storage item within a transaction is billed "cold"; any later access to the same item is "hot".

Description

Covered operations

Cold/hot storage access pricing now also applies to:

  • the EVM CALL / STATICCALL / DELEGATECALL opcodes,
  • the PVM call and delegate-call host functions,
  • contract code loads, including instantiating from an already-uploaded code hash.

Access entries

The access list tracks one entry per storage item, so each opcode is priced by exactly what it reads:

  • a plain call reads the target's account state and contract metadata,
  • a delegate call reads only the target's contract metadata,
  • a code load reads the code metadata and the code blob.

@marian-radu
marian-radu requested a review from a team as a code owner July 17, 2026 11:54
@marian-radu marian-radu added the T7-smart_contracts This PR/Issue is related to smart contracts. label Jul 17, 2026
@marian-radu

Copy link
Copy Markdown
Contributor Author

/cmd bench --runtime asset-hub-westend dev --pallet pallet_revive --clean

@github-actions

Copy link
Copy Markdown
Contributor

Command "bench --runtime asset-hub-westend dev --pallet pallet_revive --clean" has started 🚀 See logs here

…t-hub-westend dev --pallet pallet_revive --clean'
@github-actions

Copy link
Copy Markdown
Contributor

Command "bench --runtime asset-hub-westend dev --pallet pallet_revive --clean" has finished ✅ See logs here

Details

Subweight results:
File Extrinsic Old New Change [%]
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_revive.rs seal_call_data_copy 122.75us 159.85us +30.22
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_revive.rs identity 121.94us 158.41us +29.90
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_revive.rs seal_copy_to_contract 217.70us 255.45us +17.34
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_revive.rs seal_return 27.13us 31.74us +16.98
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_revive.rs access_list_rollback_amortization 4.66us 5.37us +15.29
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_revive.rs extcodecopy 211.29us 239.38us +13.30
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_revive.rs seal_ecdsa_to_eth_address 13.72us 15.48us +12.82
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_revive.rs seal_caller 553.00ns 621.00ns +12.30
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_revive.rs seal_deposit_event 94.17us 105.45us +11.98
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_revive.rs caller_is_root 1.90us 2.12us +11.19
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_revive.rs caller_is_origin 2.00us 2.20us +10.22
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_revive.rs overlay_probe_empty 1.78ms 1.96ms +9.76
substrate/frame/revive/src/weights.rs rollback_transient_storage 1.33us 1.43us +7.69
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_revive.rs weight_left 1.97us 2.12us +7.52
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_revive.rs access_list_touch_cold_empty 556.00ns 586.00ns +5.40
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_revive.rs deposit_eth_extrinsic_revert_event 3.51us 3.70us +5.38
substrate/frame/revive/src/weights.rs deposit_eth_extrinsic_revert_event 3.15us 3.32us +5.29
substrate/frame/revive/src/weights.rs own_code_hash 3.94us 3.74us -5.05
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_revive.rs seal_gas_price 1.57us 1.49us -5.23
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_revive.rs seal_base_fee 1.59us 1.50us -5.42
substrate/frame/revive/src/weights.rs seal_base_fee 1.25us 1.18us -5.44
substrate/frame/revive/src/weights.rs caller_is_origin 1.55us 1.45us -6.83
substrate/frame/revive/src/weights.rs seal_deposit_event 98.55us 91.73us -6.93
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_revive.rs seal_call_data_load 520.00ns 483.00ns -7.12
substrate/frame/revive/src/weights.rs weight_left 1.53us 1.41us -7.53
substrate/frame/revive/src/weights.rs instr 950.34us 873.40us -8.10
substrate/frame/revive/src/weights.rs seal_caller 463.00ns 425.00ns -8.21
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_revive.rs seal_call_data_size 501.00ns 458.00ns -8.58
substrate/frame/revive/src/weights.rs seal_block_number 396.00ns 360.00ns -9.09
substrate/frame/revive/src/weights.rs seal_value_transferred 396.00ns 356.00ns -10.10
substrate/frame/revive/src/weights.rs seal_gas_limit 398.00ns 356.00ns -10.55
substrate/frame/revive/src/weights.rs seal_now 388.00ns 346.00ns -10.82
substrate/frame/revive/src/weights.rs seal_address 445.00ns 392.00ns -11.91
substrate/frame/revive/src/weights.rs seal_call_data_size 381.00ns 334.00ns -12.34
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_revive.rs seal_call 465.38us 407.34us -12.47
substrate/frame/revive/src/weights.rs seal_call 443.28us 387.47us -12.59
substrate/frame/revive/src/weights.rs seal_return_data_size 389.00ns 335.00ns -13.88
substrate/frame/revive/src/weights.rs seal_call_data_load 399.00ns 341.00ns -14.54
substrate/frame/revive/src/weights.rs seal_origin 445.00ns 380.00ns -14.61
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_revive.rs instr 931.70us 774.79us -16.84
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_revive.rs seal_delegate_call 114.80us 58.72us -48.85
substrate/frame/revive/src/weights.rs seal_delegate_call 105.59us 51.16us -51.54
substrate/frame/revive/src/weights.rs seal_delegate_call_hot 23.95us Added
substrate/frame/revive/src/weights.rs seal_call_hot 25.31us Added
substrate/frame/revive/src/weights.rs code_load 63.49us Added
substrate/frame/revive/src/weights.rs call_with_pvm_code_per_byte_hot 193.95us Added
substrate/frame/revive/src/weights.rs call_with_evm_code_per_byte_hot 38.68us Added
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_revive.rs seal_delegate_call_hot 31.20us Added
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_revive.rs seal_call_hot 32.72us Added
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_revive.rs code_load 63.59us Added
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_revive.rs call_with_pvm_code_per_byte_hot 223.90us Added
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_revive.rs call_with_evm_code_per_byte_hot 47.01us Added
Command output:

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

@paritytech-workflow-stopper

Copy link
Copy Markdown

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T7-smart_contracts This PR/Issue is related to smart contracts.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant