Skip to content

Commit

Permalink
impl missing Checkable trait method (paritytech#973)
Browse files Browse the repository at this point in the history
  • Loading branch information
abhijeetbhagat authored Jan 13, 2023
1 parent 6b0db41 commit 1b84a5c
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
3 changes: 3 additions & 0 deletions primitives/self-contained/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@ std = [
"frame-support/std",
"sp-runtime/std",
]
try-runtime = [
"sp-runtime/try-runtime",
]
32 changes: 32 additions & 0 deletions primitives/self-contained/src/unchecked_extrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,38 @@ where
})
}
}

#[cfg(feature = "try-runtime")]
fn unchecked_into_checked_i_know_what_i_am_doing(
self,
lookup: &Lookup,
) -> Result<Self::Checked, TransactionValidityError> {
if self.0.function.is_self_contained() {
match self.0.function.check_self_contained() {
Some(signed_info) => Ok(CheckedExtrinsic {
signed: match signed_info {
Ok(info) => CheckedSignature::SelfContained(info),
_ => CheckedSignature::Unsigned,
},
function: self.0.function,
}),
None => Ok(CheckedExtrinsic {
signed: CheckedSignature::Unsigned,
function: self.0.function,
}),
}
} else {
let checked =
Checkable::<Lookup>::unchecked_into_checked_i_know_what_i_am_doing(self.0, lookup)?;
Ok(CheckedExtrinsic {
signed: match checked.signed {
Some((id, extra)) => CheckedSignature::Signed(id, extra),
None => CheckedSignature::Unsigned,
},
function: checked.function,
})
}
}
}

impl<Address, Call, Signature, Extra> ExtrinsicMetadata
Expand Down

0 comments on commit 1b84a5c

Please sign in to comment.