use aiken/collection/list
use cardano/transaction.{OutputReference, Transaction, NoDatum, Input, InlineDatum, Output}
use cardano/assets.{PolicyId}
use cardano/assets
use aiken/collection/dict
use aiken/crypto.{VerificationKeyHash}
use cardano/address.{Address, Script}
use aiken/interval
CODE
validator statemachine(threadtoken: PolicyId) {
spend(
datum_opt: Option<StateMachineDatum>,
redeemer: StateMachineInput,
own_ref: OutputReference,
transaction: Transaction,
) -> Bool {
expect Some(datum) = datum_opt
when (datum, redeemer) is {
(StateMachineDatum { state, buyer, seller, price, collateral, accept_range }, Return) -> {
let must_be_state = state == 0
let must_be_signed =
list.has(transaction.extra_signatories, buyer)
//One of the transaction inputs belongs to the statemachine.
expect Some(sm_input) =
list.find(transaction.inputs, fn(input) { input.output_reference == own_ref })
//One of the transaction outputs contains the threadtoken addressed to the statemachine itself - 1.
expect Some(sm_output) =
list.find(transaction.outputs, fn(output) { output.address == sm_input.output.address })
//One of the transaction outputs contains the threadtoken addressed to the statemachine itself - 2.
let must_be_policy = list.has(assets.policies(sm_output.value), threadtoken)
//verification of the new datum - 1.
let new_data: Data = StateMachineDatum {
state : -1,
buyer: buyer,
seller : seller,
collateral : collateral,
price: price,
accept_range: accept_range
}
//verification of the new datum - 2.
let must_be_datum = InlineDatum(new_data) == sm_output.datum
and {
must_be_state?,
must_be_signed?,
must_be_policy?,
must_be_datum?
}
}
_ -> False
}
}
}
Some kind of error is not displayed. The error is not coming from the validator, since without the cancel() test it works. The cancel() test has worked before when plutus was V2. But this time it throws an unknown error or bug.
What Git revision are you using?
v2.1.0
What operating system are you using, and which version?
Describe what the problem is?
ERROR
Compiling aiken-lang/contracts 0.0.0 (.) Compiling aiken-lang/stdlib v2.1.0 (./build/packages/aiken-lang-stdlib)
aiken::fatal::error Whoops! You found a bug in the Aiken compiler.
Please report this error at https://github.com/aiken-lang/aiken/issues/new. In your bug report please provide the information below and if possible the code that produced it.
Operating System: linux Architecture: x86_64 Version: v1.1.7+e2fb28b
crates/aiken-lang/src/gen_uplc/decision_tree.rs:659:9
IMPORTS
use aiken/collection/list use cardano/transaction.{OutputReference, Transaction, NoDatum, Input, InlineDatum, Output} use cardano/assets.{PolicyId} use cardano/assets use aiken/collection/dict use aiken/crypto.{VerificationKeyHash} use cardano/address.{Address, Script} use aiken/interval
CODE
TEST:
What should be the expected behavior?
Some kind of error is not displayed. The error is not coming from the validator, since without the cancel() test it works. The cancel() test has worked before when plutus was V2. But this time it throws an unknown error or bug.