Support multi-validator in script context accept test.
This commit is contained in:
@@ -49,11 +49,11 @@ pub enum Error {
|
||||
#[error("can't eval without redeemers")]
|
||||
NoRedeemers,
|
||||
#[error(
|
||||
"mismatch in expected redeemers\n{:>13} {}\n{:>13} {}",
|
||||
"missing and/or unexpected validator(s) and/or redeemer(s)\n{:>13} {}\n{:>13} {}",
|
||||
"Missing",
|
||||
if .missing.is_empty() { "ø".to_string() } else { .missing.join(&format!("\n{:>13}", "")) },
|
||||
if .missing.is_empty() { "ø".to_string() } else { .missing.join(&format!("\n{:>14}", "")) },
|
||||
"Unexpected",
|
||||
if .extra.is_empty() { "ø".to_string() } else { .extra.join(&format!("\n{:>13}", "")) },
|
||||
if .extra.is_empty() { "ø".to_string() } else { .extra.join(&format!("\n{:>14}", "")) },
|
||||
)]
|
||||
RequiredRedeemersMismatch {
|
||||
missing: Vec<String>,
|
||||
@@ -87,7 +87,7 @@ pub enum Error {
|
||||
MissingRequiredInlineDatumOrHash,
|
||||
#[error("redeemer points to an unsupported certificate type")]
|
||||
UnsupportedCertificateType,
|
||||
#[error("failed script execution\n{:>13} {}", format!("{}({})", tag, index), err)]
|
||||
#[error("failed script execution\n{:>13} {}", format!("{}[{}]", tag, index), err)]
|
||||
RedeemerError {
|
||||
tag: String,
|
||||
index: u32,
|
||||
|
||||
@@ -44,7 +44,7 @@ pub fn eval_redeemer(
|
||||
}
|
||||
.apply_data(redeemer.data.clone())
|
||||
.apply_data(script_context.to_plutus_data()),
|
||||
ScriptContext::V3 { .. } => {
|
||||
ScriptContext::V3 { .. } if datum.is_some() => {
|
||||
program
|
||||
// FIXME: Temporary, but needed until https://github.com/aiken-lang/aiken/pull/977
|
||||
// is implemented.
|
||||
@@ -52,6 +52,13 @@ pub fn eval_redeemer(
|
||||
.apply_data(Data::constr(0, vec![]))
|
||||
.apply_data(script_context.to_plutus_data())
|
||||
}
|
||||
ScriptContext::V3 { .. } => {
|
||||
program
|
||||
// FIXME: Temporary, but needed until https://github.com/aiken-lang/aiken/pull/977
|
||||
// is implemented.
|
||||
.apply_data(Data::constr(0, vec![]))
|
||||
.apply_data(script_context.to_plutus_data())
|
||||
}
|
||||
};
|
||||
|
||||
let mut eval_result = if let Some(costs) = cost_mdl_opt {
|
||||
|
||||
@@ -185,7 +185,7 @@ pub fn has_exact_set_of_redeemers(
|
||||
let missing: Vec<_> = redeemers_needed
|
||||
.into_iter()
|
||||
.filter(|x| !wits_redeemer_keys.contains(&&x.0))
|
||||
.map(|x| format!("{} (key: {:?}, purpose: {:?})", x.2, x.0, x.1,))
|
||||
.map(|x| format!("{:?}[{:?}] -> {}", x.0.tag, x.0.index, x.2))
|
||||
.collect();
|
||||
|
||||
let extra: Vec<_> = wits_redeemer_keys
|
||||
|
||||
Reference in New Issue
Block a user