Skip to content

Commit

Permalink
Use the conversion (and add clearer logs)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshOrndorff committed Apr 22, 2024
1 parent 2992564 commit d8c91aa
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions tuxedo-core/src/executive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,15 @@ where
extrinsics.push(extrinsic.encode());
sp_io::storage::set(EXTRINSIC_KEY, &extrinsics.encode());

// Now actually
Self::apply_tuxedo_transaction(extrinsic)
.map_err(|_| TransactionValidityError::Invalid(InvalidTransaction::Custom(0)))?;
// Now actually apply the extrinsic
Self::apply_tuxedo_transaction(extrinsic).map_err(|e| {
log::warn!(
target: LOG_TARGET,
"Tuxedo Transaction did not apply successfully: {:?}",
e,
);
TransactionValidityError::Invalid(e.into())
})?;

Ok(Ok(()))
}
Expand Down Expand Up @@ -401,16 +407,13 @@ where
let r = if tx.checker.is_inherent() {
Err(TransactionValidityError::Invalid(InvalidTransaction::Call))
} else {
// TODO, we need a good way to map our UtxoError into the supposedly generic InvalidTransaction
// https://paritytech.github.io/substrate/master/sp_runtime/transaction_validity/enum.InvalidTransaction.html
// For now, I just make them all custom zero, and log the error variant
Self::validate_tuxedo_transaction(&tx).map_err(|e| {
log::warn!(
target: LOG_TARGET,
"Tuxedo Transaction did not validate (in the pool): {:?}",
e,
);
TransactionValidityError::Invalid(InvalidTransaction::Custom(0))
TransactionValidityError::Invalid(e.into())
})
};

Expand Down

0 comments on commit d8c91aa

Please sign in to comment.