Skip to content

Incorrect datum for fetchUtxos() with Koios provider #612

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

Open
1 of 4 tasks
mpizenberg opened this issue Apr 21, 2025 · 0 comments
Open
1 of 4 tasks

Incorrect datum for fetchUtxos() with Koios provider #612

mpizenberg opened this issue Apr 21, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@mpizenberg
Copy link

Summary

I was facing a missing required datum in the UPLC offline evaluator for a datum this IS present inline by value in the corresponding spent UTxO. So I’ve looked for the reason and it seems this error only happens when I use Koios as the provider for the offline evaluator:

new MeshTxBuilder({
  evaluator: new OfflineEvaluator(koios, "preview"),
  ...

If I change the provider by blockfrost inside the OfflineEvaluator constructor, then everything works.

So I’ve dig a little in the code, and it seems the faulty function is fetchUTxOs(), called inside the evaluateTx() function of offline-evaluator.ts:

...
const txHashesSet = new Set(inputsToResolve.map((input) => input.txHash));
for (const txHash of txHashesSet) {
  const utxos = await this.fetcher.fetchUTxOs(txHash);            // HERE
  for (const utxo of utxos) {
    if (utxo)
      if (
        inputsToResolve.find(
          (input) =>
            input.txHash === txHash &&
            input.outputIndex === utxo.input.outputIndex,
        )
      ) {
        additionalUtxos.push(utxo);
        foundUtxos.add(`${utxo.input.txHash}:${utxo.input.outputIndex}`);
      }
  }
}
...

Steps to reproduce the bug

Create a Tx spending a utxo with an inline datum, and use the offline evaluator, with Koios configured as a fetcher.

Actual Result

The offline uplc vm says that the inline datum does not exist.

Expected Result

The fetched and decoded utxos should contain the inline datum, so that the offline uplc vm is aware of it.

SDK version

1.9.0-beta.37 with the fix in #608

Environment type

  • Node.js
  • Browser
  • Browser Extension
  • Other

Environment details

No response

@mpizenberg mpizenberg added the bug Something isn't working label Apr 21, 2025
@mpizenberg mpizenberg changed the title Incorrect datum for getUtxos() with Koios provider Incorrect datum for fetchUtxos() with Koios provider Apr 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant