aiken-lang / aiken

A modern smart contract platform for Cardano
https://aiken-lang.org
Apache License 2.0
470 stars 91 forks source link

aiken::fatal::error in test #924

Closed oskin1 closed 4 months ago

oskin1 commented 5 months ago

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: macos Architecture: aarch64 Version: v1.0.26-alpha+075668b

crates/aiken-project/src/test_framework.rs:1148:39

   called `Result::unwrap()` on an `Err` value: ()
test test_proposal_vote_double_satisfaction() {
  let deadline = test_time_point + 24_000_000
  let proposal_address = from_script("proposal")
  let state_0_0 =
    ProposalState {
      distribution: [opt("a", 1_000_000), opt("b", 4_000_000)],
      deadline,
      governance_power_policy: test_g_power_policy,
    }
  let state_0_1 =
    ProposalState {
      distribution: [opt("a", 1_500_000), opt("b", 5_000_000)],
      deadline,
      governance_power_policy: test_g_power_policy,
    }
  let state_1 =
    ProposalState {
      distribution: [opt("a", 2_000_000), opt("b", 4_000_000)],
      deadline,
      governance_power_policy: test_g_power_policy,
    }
  let index_tn = index.index_tn(deadline)
  let value_0_0 =
    add(
      add(from_lovelace(1000), test_proposal_script, index_tn, 1),
      test_g_power_policy,
      index_tn,
      5_000_000,
    )
  let value_0_1 =
    add(
      add(from_lovelace(1000), test_proposal_script, index_tn, 1),
      test_g_power_policy,
      index_tn,
      6_500_000,
    )
  let value_1 =
    add(
      add(from_lovelace(1000), test_proposal_script, index_tn, 1),
      test_g_power_policy,
      index_tn,
      6_000_000,
    )
  let input_output_0 =
    Output {
      address: proposal_address,
      value: value_0_0,
      datum: InlineDatum(state_0_0),
      reference_script: None,
    }
  let input_ref_0 =
    OutputReference {
      transaction_id: TransactionId(test_tx_id),
      output_index: 0,
    }
  let input_0 = Input { output_reference: input_ref_0, output: input_output_0 }
  let input_output_1 =
    Output {
      address: proposal_address,
      value: value_0_1,
      datum: InlineDatum(state_0_1),
      reference_script: None,
    }
  let input_ref_1 =
    OutputReference {
      transaction_id: TransactionId(test_tx_id),
      output_index: 1,
    }
  let input_1 = Input { output_reference: input_ref_1, output: input_output_1 }
  let proposal_output =
    Output {
      address: proposal_address,
      value: value_1,
      datum: InlineDatum(state_1),
      reference_script: None,
    }
  let adversary_output =
    Output {
      address: from_script("adv"),
      value: from_lovelace(1_000)
        |> add(test_g_power_policy, index_tn, 5_500_000),
      datum: InlineDatum(state_1),
      reference_script: None,
    }
  let ctx_0 =
    ScriptContext {
      purpose: Spend(input_ref_0),
      transaction: transaction.placeholder()
        |> fn(transaction) {
            Transaction {
              ..transaction,
              inputs: [input_0, input_1],
              outputs: [proposal_output, adversary_output],
              mint: value.to_minted_value(
                value.from_asset(test_g_power_policy, index_tn, 1_000_000),
              ),
            }
          },
    }
  let ctx_1 =
    ScriptContext {
      purpose: Spend(input_ref_0),
      transaction: transaction.placeholder()
        |> fn(transaction) {
            Transaction {
              ..transaction,
              inputs: [input_0, input_1],
              outputs: [proposal_output, adversary_output],
              mint: value.to_minted_value(
                value.from_asset(test_g_power_policy, index_tn, 1_000_000),
              ),
            }
          },
    }
  !proposal(state_0_0, Vote, ctx_0) && !proposal(state_0_1, Vote, ctx_1)
}
MicroProofs commented 5 months ago

Might be a duplicate of #909

KtorZ commented 5 months ago

@oskin1 We are not able to reproduce with the example you shared unfortunately. We assume that this is now fixed, so we'll keep that ticket open until the next release and close it soon after unless we hear back from you.

oskin1 commented 5 months ago

@oskin1 We are not able to reproduce with the example you shared unfortunately. We assume that this is now fixed, so we'll keep that ticket open until the next release and close it soon after unless we hear back from you.

Idk, it fails consistently on my side

   Operating System: macos
   Architecture:     aarch64
   Version:          v1.0.26-alpha+075668b

   crates/aiken-project/src/test_framework.rs:1148:39

       called `Result::unwrap()` on an `Err` value: ()
oskin1 commented 5 months ago

Should I update something?

KtorZ commented 5 months ago

Yes, you need to update the compiler. We are about to release a new version so likely better wait for the new version. You can always try main, but expect some breaking changes with the stdlib which we haven't fully documented yet (hence why we're holding off the release).