Skip to content

chore(aggregation-mode): prevent rebuilding programs if not changed #1959

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

Closed
wants to merge 6 commits into from

Conversation

MarcosNicolau
Copy link
Member

@MarcosNicolau MarcosNicolau commented May 30, 2025

Description

Since we introduced deterministic buildings with docker for the zkvm programs the proof aggregator started to take too much time to compile. This got even worse after the multilayer feature. This pr, recompiles the programs only if they have changed. For that, we've been orthodox and simply solved it by hashing the files + features.

This means that now the programs have to be compiled only once for each feature (prove, gpu)

To test it I suggest removing the use_docker options for faster builds in build.rs

Type of change

  • Optimization

Checklist

  • “Hotfix” to testnet, everything else to staging
  • Linked to Github Issue
  • This change depends on code or research by an external entity
    • Acknowledgements were updated to give credit
  • Unit tests added
  • This change requires new documentation.
    • Documentation has been added/updated.
  • This change is an Optimization
    • Benchmarks added/run
  • Has a known issue
  • If your PR changes the Operator compatibility (Ex: Upgrade prover versions)
    • This PR adds compatibility for operator for both versions and do not change batcher/docs/examples
    • This PR updates batcher and docs/examples to the newer version. This requires the operator are already updated to be compatible

@MarcosNicolau MarcosNicolau self-assigned this May 30, 2025
];

for file in &programs {
println!("cargo:rerun-if-changed={}", file);
Copy link
Collaborator

Choose a reason for hiding this comment

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

These prints are not displayed

Copy link
Member Author

@MarcosNicolau MarcosNicolau Jun 2, 2025

Choose a reason for hiding this comment

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

Build scripts communicate with Cargo by printing to stdout. Cargo will interpret each line that starts with cargo:: as an instruction that will influence compilation of the package. All other lines are ignored.

These flags indicate that the build.rs should run if the file outputted has been modified. They weren't really working for me that is why the hash solution was applied. Right now, they are there just in case. You can read more in the source.

Source: https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script

@MauroToscano
Copy link
Contributor

This should be done with a makefile, I'm making another pr to solve this issue:

#1962

@MarcosNicolau MarcosNicolau deleted the chore/separate-build-from-run-agg-mode branch June 3, 2025 18:26
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.

3 participants