kabocha-network/pallet_supersig

Unfliter deposit_event so that successful proposals BUT failed txs are visible to the user.

decentration opened this issue · 0 comments

git checkout polkadot-v0.9.37

in ./src/lib.rs

let total_votes = Self::votes(supersig_id, call_id);
			if total_votes >= (Self::total_members(supersig_id) / 2 + 1) {
				if let Some(preimage) = Self::calls(supersig_id, call_id) {
					// free storage and unreserve deposit
					Self::unchecked_remove_call_from_storages(supersig_id, call_id);
					T::Currency::unreserve(&preimage.provider, preimage.deposit);

					// Try to decode and execute the call
					let res = if let Ok(call) = <T as Config>::Call::decode(&mut &preimage.data[..])
					{
						Ok(call
							.dispatch(
								frame_system::RawOrigin::Signed(supersig_account.clone()).into(),
							)
							.map(|_| ())
							.map_err(|_| Error::<T>::TxFailed)?)
					} else {
						Err(Error::<T>::BadEncodedCall.into())
					} ;

					Self::deposit_event(Event::<T>::CallExecutionAttempted(
						supersig_account,
						call_id,
						res,
					));
				}
			}

			Ok(())
		}
  • .map_err(|_| Error::<T>::TxFailed)?) has been added, but perhaps as mentioned better to add errors into response so not all responses are just OK.

Screenshot 2023-02-07 at 12 05 48