Skip to content

Conversation

@ginnun
Copy link
Collaborator

@ginnun ginnun commented Sep 12, 2025

Implements #306

The goal of this PR is to implement tx evaluation APIs while trying to stay compatible to the Blockfrost.io version, which are:

  • /utils/txs/evaluate
  • /utils/txs/evaluate/utxos

What is added

  • Two new endpoints and tests under a new compile configuration: evaluate
  • New cardano node client functions related to ledger: protocol_params and genesis_config
  • pallas_validate handling
  • Native tx evaluation in Rust using pallas (incomplete)
  • External tx evaluation in Haskell using ledger via a compiled binary

What is changed

  • Test folder layout. Now we can have separate files for each endpoint tests. This makes sense since we are going to have lots of them.
  • Underlying commit of the pallas tag. I ended up fixing a non-working part in pallas. So changed the hash of the tag. (I want to use tagging better in the future)
  • cargo.lock file content

Considerations

  • I am getting the protocol params and genesis from the Cardano node every time. This can be changed to use the new static implementation (or cached)
  • The build configuration evaluate will be built by default except windows and linux-aarch64 platforms (handled in build.rs).
  • The build configuration evaluate enables tx evaluation endpoints. It exists since pallat-validate crate isn't building for windows-all and linux-aarch64 at the moment.

Please run cargo clean to make sure everything is in a fresh state before compiling.

Haskell part: input-output-hk/testgen-hs#3

@ginnun ginnun marked this pull request as draft September 12, 2025 10:03
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Sep 12, 2025

Deploying blockfrost-platform with  Cloudflare Pages  Cloudflare Pages

Latest commit: 102ee66
Status: ✅  Deploy successful!
Preview URL: https://d8fc9874.blockfrost-platform.pages.dev
Branch Preview URL: https://feat-tx-evaluation-rebased.blockfrost-platform.pages.dev

View logs

Copy link
Member

@michalrus michalrus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, I started reviewing, but then noticed that it's a draft! Left a few comments either way :)

in
(import inputs.flake-compat {
src =
if targetSystem != "aarch64-darwin" && targetSystem != "aarch64-linux"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a merge/rebase artifact – wrong conflict resolution? The line is repeated.

Copy link
Collaborator Author

@ginnun ginnun Sep 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 418afac

cp -r ${unpatched} $out
chmod -R +w $out
cd $out
patch -p1 -i ${./testgen-hs--enable-aarch64-linux.diff}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, but we already have aarch64-linux on main. Something is off here, another conflict?

Copy link
Collaborator Author

@ginnun ginnun Sep 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 418afac

sender: mpsc::Sender<FDRequest>,
current_child_pid: Arc<AtomicU32>,
pub struct Testgen {
pub sender: mpsc::Sender<TestgenRequest>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do these internal fields need to be public for everyone?

Copy link
Collaborator Author

@ginnun ginnun Sep 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved in a53a53c

}

/// This function is called at startup, so that we make sure that the worker is reasonable.
pub async fn startup_sanity_test(&self) -> Result<(), String> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But isn’t this useful? Just in case that someone plugs another binary into the libexec directory.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This uses error serialization/deserialization. I can expect every binary integration to have a startup_sanity_test implementation of their own.
For evaluation, it's already handled via the init functionilty.

@ginnun ginnun force-pushed the feat/tx-evaluation-rebased branch 3 times, most recently from c702f03 to a53a53c Compare September 22, 2025 12:06
@ginnun ginnun changed the title Feat/tx evaluation rebased Tx evaluation Sep 23, 2025
@ginnun ginnun force-pushed the feat/tx-evaluation-rebased branch from 7fb0adf to 52f662b Compare October 7, 2025 11:04
@ginnun ginnun force-pushed the feat/tx-evaluation-rebased branch from 3bcc5c5 to e67b1a9 Compare October 10, 2025 11:35
@ginnun ginnun marked this pull request as ready for review December 15, 2025 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add POST /utils/txs/evaluate – how many execution units for a transaction

3 participants