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 block hash API #6246

Merged
merged 12 commits into from
Oct 30, 2024
Merged

[pallet-revive] implement the block hash API #6246

merged 12 commits into from
Oct 30, 2024

Conversation

xermicus
Copy link
Member

  • Bound T::Hash to H256
  • Implement the block hash API

@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 Oct 26, 2024
@xermicus
Copy link
Member Author

bot fmt

@command-bot
Copy link

command-bot bot commented Oct 26, 2024

@xermicus https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/7648959 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 36-bfdd0fad-7df0-40b1-9687-34e1155805de to cancel this command or bot cancel to cancel all commands in this pull request.

@command-bot
Copy link

command-bot bot commented Oct 26, 2024

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

@xermicus
Copy link
Member Author

/cmd prdoc --audience runtime_dev --bump major

@xermicus
Copy link
Member Author

bot bench substrate-pallet --pallet=pallet_revive

@command-bot
Copy link

command-bot bot commented Oct 26, 2024

@xermicus https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/7649093 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" --subcommand=pallet --runtime=dev --target_dir=substrate --features=riscv --pallet=pallet_revive. 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 38-16661b4d-6c58-4612-acf5-c9ab8a861e4c to cancel this command or bot cancel to cancel all commands in this pull request.

…=dev --target_dir=substrate --features=riscv --pallet=pallet_revive
@command-bot
Copy link

command-bot bot commented Oct 26, 2024

@xermicus Command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" --subcommand=pallet --runtime=dev --target_dir=substrate --features=riscv --pallet=pallet_revive has finished. Result: https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/7649093 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/7649093/artifacts/download.

Comment on lines +1344 to +1346
if block_number < self.block_number.saturating_sub(256u32.into()) {
return None;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need this ? why don't we just try t get it with System::::block_hash

Copy link
Member Author

Choose a reason for hiding this comment

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

I implemented it to resemble the semantics of the corresponding EVM opcode

@@ -48,6 +48,7 @@ where
T: Config + pallet_balances::Config,
BalanceOf<T>: Into<U256> + TryFrom<U256>,
MomentOf<T>: Into<U256>,
T::Hash: frame_support::traits::IsType<H256>,
Copy link
Contributor

@pgherveou pgherveou Oct 30, 2024

Choose a reason for hiding this comment

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

wouldn't T::Hash: Into<H256> suffice for all these added constraints?

Copy link
Member Author

Choose a reason for hiding this comment

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

Technically yes. But I think we are splitting hairs here :) I don't see where a runtime would fullfill T::Hash: Into<H256> but T::Hash isn't actually H256.

@xermicus
Copy link
Member Author

bot bench substrate-pallet --pallet=pallet_revive

@command-bot
Copy link

command-bot bot commented Oct 30, 2024

@xermicus https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/7670410 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" --subcommand=pallet --runtime=dev --target_dir=substrate --features=riscv --pallet=pallet_revive. 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 9-48a18acc-ebd6-435a-8f34-9532c4e48354 to cancel this command or bot cancel to cancel all commands in this pull request.

…=dev --target_dir=substrate --features=riscv --pallet=pallet_revive
@command-bot
Copy link

command-bot bot commented Oct 30, 2024

@xermicus Command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" --subcommand=pallet --runtime=dev --target_dir=substrate --features=riscv --pallet=pallet_revive has finished. Result: https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/7670410 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/7670410/artifacts/download.

Signed-off-by: Cyrill Leutwiler <[email protected]>
@xermicus
Copy link
Member Author

bot fmt

@command-bot
Copy link

command-bot bot commented Oct 30, 2024

@xermicus https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/7671144 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 10-e24c8c59-0c50-4731-b8a3-f40f69f0a268 to cancel this command or bot cancel to cancel all commands in this pull request.

@command-bot
Copy link

command-bot bot commented Oct 30, 2024

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

@xermicus xermicus added this pull request to the merge queue Oct 30, 2024
Merged via the queue into master with commit 2b6b696 Oct 30, 2024
196 of 198 checks passed
@xermicus xermicus deleted the cl/blockhash branch October 30, 2024 22:47
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.

4 participants