-
Notifications
You must be signed in to change notification settings - Fork 710
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
Conversation
xermicus
commented
Oct 26, 2024
- Bound T::Hash to H256
- Implement the block hash API
Signed-off-by: xermicus <[email protected]>
Signed-off-by: xermicus <[email protected]>
Signed-off-by: xermicus <[email protected]>
bot fmt |
@xermicus https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/7648959 was started for your command Comment |
@xermicus Command |
/cmd prdoc --audience runtime_dev --bump major |
bot bench substrate-pallet --pallet=pallet_revive |
@xermicus https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/7649093 was started for your command Comment |
…=dev --target_dir=substrate --features=riscv --pallet=pallet_revive
@xermicus Command |
if block_number < self.block_number.saturating_sub(256u32.into()) { | ||
return None; | ||
} |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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>, |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
.
bot bench substrate-pallet --pallet=pallet_revive |
@xermicus https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/7670410 was started for your command Comment |
…=dev --target_dir=substrate --features=riscv --pallet=pallet_revive
@xermicus Command |
Signed-off-by: Cyrill Leutwiler <[email protected]>
bot fmt |
@xermicus https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/7671144 was started for your command Comment |
@xermicus Command |