mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 14:01:06 +00:00
Add DefensiveTruncateFrom (#12515)
* Add DefensiveTruncateFrom Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Add tests Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Fix tests Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Map_err in preimage Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Map_err in beefy Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Make test dependant in debug-assertions Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: parity-processbot <>
This commit is contained in:
committed by
GitHub
parent
92d2977292
commit
48a02bb056
@@ -342,6 +342,7 @@ impl<T: Config> Pallet<T> {
|
||||
|
||||
fn insert(hash: &T::Hash, preimage: Cow<[u8]>) -> Result<(), ()> {
|
||||
BoundedSlice::<u8, ConstU32<MAX_SIZE>>::try_from(preimage.as_ref())
|
||||
.map_err(|_| ())
|
||||
.map(|s| PreimageFor::<T>::insert((hash, s.len() as u32), s))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user