introduce inherent handler in pallet revive#10140
Draft
dharjeezy wants to merge 6 commits intoparitytech:masterfrom
Draft
introduce inherent handler in pallet revive#10140dharjeezy wants to merge 6 commits intoparitytech:masterfrom
dharjeezy wants to merge 6 commits intoparitytech:masterfrom
Conversation
…rent-handler-in-pallet-revive # Conflicts: # substrate/frame/revive/rpc/src/receipt_extractor.rs
…rent-handler-in-pallet-revive # Conflicts: # substrate/frame/revive/rpc/src/receipt_extractor.rs
Wizdave97
reviewed
Nov 4, 2025
| fn validate_unsigned(_source: TransactionSource, call: &Self::Call) -> TransactionValidity { | ||
| if let Call::system_log_dispatch { message } = call { | ||
| ensure!(T::InherentHandlers::is_valid_handler(&message.handler_name), InvalidTransaction::Call); | ||
|
|
Contributor
There was a problem hiding this comment.
We are meant to execute the inherent so only valid ones end up in the block
bkontur
reviewed
Nov 4, 2025
| /// | ||
| /// Pallets implementing this trait register themselves as potential handlers for messages | ||
| /// identified by a unique `name`. | ||
| pub trait InherentHandler { |
Contributor
There was a problem hiding this comment.
Maybe, could we find a different naming around InherentHandler?
Just to avoid confusion with existing Inherent concept - extrinsics that are inherently added to each block. (InherentData, InherentIdentifier, ProvideInherent, ...)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces modification to
pallet-revivefor handling System Log messages as Inherent. It also provides some modification topallet-revive-eth-rpcfor processingSystemLogDispatchextrinsics and extractingContractEmmittedevent from it.pallet-reviveModifications:inherent_handlers.rsdefining two traits:InherentHandler: Implemented by pallets that can process system messages. It Requireshandler_name()andhandle_message().InherentHandlers: Implemented for tuples ofInherentHandlers (usingimpl_for_tuples) to provide dispatching logic. Requiresis_valid_handler()anddispatch_message().SystemLogMessagestruct (handler_name,raw_message) topallet-revive.system_log_dispatch(message: SystemLogMessage)topallet-revive.ValidateUnsignedforpallet-reviveto validatesystem_log_dispatchcalls by checkingT::InherentHandlers::is_valid_handler(&message.handler_name).type InherentHandlerstopallet-revive::Config. The runtime configures this with a tuple containing the handler pallets (e.g.,(pallet_hyperbridge_verifier::Pallet<Runtime>,)).pallet-revive-eth-rpc(receipt_extractor.rs) Modifications:extract_from_system_logfunction specifically forSystemLogDispatchextrinsics. This function:ContractEmittedlogs from the events using the same logic asextract_from_extrinsic.ReceiptInfo(paired with a defaultTransactionSigned).extract_from_blockto iterate through extrinsics, attempt to decode first asEthTransact(callingextract_from_extrinsic), and if that fails, attempt to decode asSystemLogDispatch(callingextract_from_system_log).extract_from_transactionsimilarly to handle both extrinsic types based on index.