Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unified error type for sendTx #214

Open
j-mueller opened this issue Oct 14, 2024 · 0 comments
Open

Unified error type for sendTx #214

j-mueller opened this issue Oct 14, 2024 · 0 comments

Comments

@j-mueller
Copy link
Owner

j-mueller commented Oct 14, 2024

MonadBlockchain.sendTx returns an Either (ValidationError era) TxId. ValidationError looks like this:

data ValidationError era =
  ValidationErrorInMode !C.TxValidationErrorInCardanoMode
  | VExUnits !(ExUnitsError era)
  | PredicateFailures ![CollectError (C.ShelleyLedgerEra era)]
  | ApplyTxFailure !(ApplyTxError (C.ShelleyLedgerEra era))
  deriving anyclass Exception

The ValidationErrorInMode constructor is only used in the MonadBlockchain instance for MonadBlockchainCardanoNodeT. The other constructors are only used in the MockchainT instance. This means that

  • Clients can discover which implementation is used (breaking the MonadBlockchain abstraction)
  • Clients need to handle the same error in two different ways - once for the ValidationErrorInMode constructor, and then also for the other three constructors

To fix this we need to inspect the TxValidationErrorInCardanoMode that's returned from the node (MonadBlockchainCardanoNodeT) and try to extract the underlying reason.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant