diff --git a/substrate/in-instructions/pallet/src/lib.rs b/substrate/in-instructions/pallet/src/lib.rs index f81bdd09..a536f5c0 100644 --- a/substrate/in-instructions/pallet/src/lib.rs +++ b/substrate/in-instructions/pallet/src/lib.rs @@ -71,13 +71,17 @@ pub mod pallet { StorageMap<_, Blake2_256, NetworkId, BlockHash, OptionQuery>; impl Pallet { - fn execute(instruction: InInstructionWithBalance) -> Result<(), ()> { + // Use a dedicated transaction layer when executing this InInstruction + // This lets it individually error without causing any storage modifications + #[frame_support::transactional] + fn execute(instruction: InInstructionWithBalance) -> Result<(), DispatchError> { match instruction.instruction { InInstruction::Transfer(address) => { - Coins::::mint(address.into(), instruction.balance).map_err(|_| ()) + Coins::::mint(address.into(), instruction.balance)?; } _ => panic!("unsupported instruction"), } + Ok(()) } }