Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion frame/support/src/inherent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,10 @@ mod tests {
fn create_inherent(_: &InherentData) -> Option<Self::Call> {
Some(CallTest2::Something)
}

fn is_inherent_required(_: &InherentData) -> Result<Option<Self::Error>, Self::Error> {
Ok(Some(().into()))
}
}

type Block = testing::Block<Extrinsic>;
Expand Down Expand Up @@ -260,7 +264,7 @@ mod tests {
fn check_inherents_works() {
let block = Block::new(
Header::new_from_number(1),
vec![Extrinsic { function: Call::Test(CallTest::Something) }],
vec![Extrinsic { function: Call::Test2(CallTest2::Something) }],
Comment thread
goozang-records marked this conversation as resolved.
Outdated
);

assert!(InherentData::new().check_extrinsics(&block).ok());
Expand All @@ -272,4 +276,14 @@ mod tests {

Comment thread
gui1117 marked this conversation as resolved.
assert!(InherentData::new().check_extrinsics(&block).fatal_error());
}

#[test]
fn required_inherents_enforced() {
let block = Block::new(
Header::new_from_number(1),
vec![Extrinsic { function: Call::Test(CallTest::Something) }],
);

assert!(InherentData::new().check_extrinsics(&block).fatal_error());
}
}