From 49ddcccd12d4ed6ad21a74cb2939aad3b3ab2a32 Mon Sep 17 00:00:00 2001 From: KtorZ Date: Thu, 1 Aug 2024 16:48:08 +0200 Subject: [PATCH] Revert checking for negative constr on bool It is impossible to serialize/deserialize a Data with a negative constructor. So the only way this can happen is by programmatically construct a value using builtin constr_data. While possible, it is entirely at the responsibility of the programmer, but not malleable from an attacker who can only provide values as 'Data' (and thus, must be decoded like others). --- crates/uplc/src/builder.rs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/crates/uplc/src/builder.rs b/crates/uplc/src/builder.rs index 0147a294..5b354c0e 100644 --- a/crates/uplc/src/builder.rs +++ b/crates/uplc/src/builder.rs @@ -600,17 +600,11 @@ impl Term { .apply(Term::fst_pair().apply(Term::Var(pair.clone()))) .if_then_else( otherwise.clone(), - Term::less_than_integer() - .apply(Term::fst_pair().apply(Term::Var(pair.clone()))) - .apply(Term::integer(0.into())) - .if_then_else( - otherwise.clone(), - callback( - Term::equals_integer() - .apply(Term::integer(1.into())) - .apply(Term::fst_pair().apply(Term::Var(pair))), - ), - ), + callback( + Term::equals_integer() + .apply(Term::integer(1.into())) + .apply(Term::fst_pair().apply(Term::Var(pair))), + ), ), otherwise.clone(), )