Provide default annotation to validators (incl. fallback)

Without that, we may encounter weird error messages when writing
  validators without an explicit `else`. Since we automatically fill it
  with a `fail`; without annotation, it unifies to a generic parameter.

  The existing check that would look for the body being an error term is
  ill-advised as it doesn't work as soon as one adds tracing, or make
  the validator a parameterized validator. Plus, it may simply trigger
  the wrong behavior as one can now annotate a validator with _whatever_
  and get pass the type-checker by plucking a `fail` keyword as body.
This commit is contained in:
KtorZ
2024-08-25 17:08:46 +02:00
parent 1198d7a5ae
commit af9a785d65
3 changed files with 36 additions and 34 deletions

View File

@@ -100,9 +100,7 @@ pub fn eval_phase_two_raw(
.or_else(|_| MultiEraTx::decode_for_era(Era::Babbage, tx_bytes))
.or_else(|_| MultiEraTx::decode_for_era(Era::Alonzo, tx_bytes))?;
let cost_mdls = cost_mdls_bytes
.map(|x| CostMdls::decode_fragment(x))
.transpose()?;
let cost_mdls = cost_mdls_bytes.map(CostMdls::decode_fragment).transpose()?;
let budget = ExBudget {
cpu: initial_budget.0 as i64,