Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Persistent Errors Encountered in Vesting Tutorial Using Aiken and Lucid #46

Open
santiagoziel opened this issue May 16, 2023 · 3 comments

Comments

@santiagoziel
Copy link

santiagoziel commented May 16, 2023

System Specifications

  • Os version Windows 10 Home 22H2
  • Deno version 1.33.2
  • TypeScript version 5.0.3
  • V8 version 11.4.183.1
  • Aiken verison 1.0.4-alpha

Problem Description

I'm a beginner in Cardano development, testing out Aiken and Lucid, and I'm currently facing issues with the tutorial located here: https://aiken-lang.org/example--vesting.

While the "Hello World" example worked fine, the 'Vesting' tutorial has been problematic, particularly when unlocking the funds. I've encountered numerous errors, primarily around the following line of code:

const tx = await lucid
    .newTx()
    .collectFrom(utxos, redeemer)
    .addSigner(await lucid.wallet.address()) // this should be beneficiary address
    .validFrom(currentTime)
    .validTo(laterTime)
    .attachSpendingValidator(from)
    .complete();

Expected Behavior

The tutorial's example code should execute without errors, specifically the transaction should be successfully created and the funds should be unlocked as per the steps outlined in the tutorial.

Current Behavior

Initially, The code on the examaple would not compile, i added types and fixed a variable name.
Then I received a transaction submission error:

"transaction submit error ShelleyTxValidationError ShelleyBasedEraBabbage (ApplyTxError [UtxowFailure (UtxoFailure (FromAlonzoUtxoFail (OutsideValidityIntervalUTxO (ValidityInterval {invalidBefore = SJust (SlotNo 28573407), invalidHereafter = SJust (SlotNo 28580607)}) (SlotNo 28573348))))])"
if (result?.status_code === 400) throw new Error(result.message);

After addressing this by removing the .validFrom and .validTo lines to match the previous example, I started receiving another error:

error: Uncaught (in promise) "Redeemer (Spend, 0): The provided Plutus code called 'error'.\n\nExBudget {\n    mem: 13835841,\n    cpu: 9936288424,\n}\n\n"

Steps to Reproduce & Attempted Solutions

Im running the tutorial code on the Preprod network. I've tried the following steps to resolve this:

  1. Looked up the error message, but no clear explanations or solutions were found.
  2. Adjusted the Smart Contract to take in a redeemer, as some people encountered a similar error when sending the wrong redeemer to a Smart Contract.
  3. Stripped most of the logic from the Smart Contract, considering the error message seemed to hint at exceeding the node's budget. This didn't resolve the issue.
  4. Made both the "owner" and the "beneficiary" work with the same key pair. ( This worked once but failed on the next attempt)
  5. Checked the UTXOs, waited for a certain number of confirmations, tried passing only one UTXO, and made several other minor adjustments.

Despite these attempts, the issue persists. The few times it did work, it failed again on the next try, leading me to believe that the successful attempts might have been due to luck rather than a concrete solution.

@VledicFranco
Copy link

Also to add, trying the same tutorial, the code as it is in the tutorial doesn't even compile. and the namings between the functions are a bit confusing.

@rvcas
Copy link
Member

rvcas commented May 25, 2023

@VledicFranco @santiagoziel I didn't build that one but those tutorials are in the https://github.com/aiken-lang/site repo. Not in this one. We'll review the tutorial and see what went wrong.

@rvcas rvcas transferred this issue from aiken-lang/aiken May 25, 2023
@avi69night
Copy link

tey this

const beneficiaryAddress = 'addr1...'; // Replace with the actual beneficiary address

const tx = await lucid
.newTx()
.collectFrom(utxos, redeemer)
.addSigner(beneficiaryAddress) // Use the beneficiary address
.validFrom(currentTime)
.validTo(laterTime)
.attachSpendingValidator(from)
.complete();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🪣 Backlog
Development

No branches or pull requests

4 participants