IntersectMBO / IntersectMBO/cardano-ledger
Interface for answering phase2 validation
- Dominant language
- Haskell
- Stars
- 295
- Forks
- 179
- Avg merge
- 4d 7h
- Merged PRs (30d)
- 29
Description
There is a specific use case for validation when we need to answer a question in an era agnostic fashion:
"Did phase2 validation outcome match the `isValid` flag?"
In other words was there `ValidationTagMismatch` predicate failure and was it the only validation failure.
There is a similar interface [already exists in consensus](https://github.com/IntersectMBO/ouroboros-consensus/blob/0323fce39dd610ac4787e4d9015f86400b806e42/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Eras.hs#L319)
However, it is quite dangerous to do specific pattern matching on the predicate failure, since there are unfortunately sometimes multiple paths on how a failure can be constructed. In order to make it safer we need to implement #4170 first.
This is how it could look like in ledger:
```haskell
class EraTwoPhaseValidation era where
isValidationTagMismatch :: EraRuleFailure "LEDGER" era -> Maybe TagMismatchDescription
```
Two comments on differences with consensus interface:
* Instead of `Bool` we would return `Maybe TagMismatchDescription`
* Instead of `PredicateFailure` we can use `EraRuleFailure`, which is better for type inference
Contributor guide
Assessment
This issue has not been assessed yet.