Skip to content

fix(aggregation_mode): hardcode image_id and vk_hash from solidity contract #1910

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

Merged
merged 14 commits into from
May 8, 2025

Conversation

MarcosNicolau
Copy link
Member

@MarcosNicolau MarcosNicolau commented Apr 30, 2025

Description

  1. The verifySp1 and verifyRisc0 functions no longer require image_id and vk_hash as input parameters. Instead, these values are now stored in the contract’s storage and can only be modified by the contract owner.
  2. This change ensures that only trusted and verified programs can be used for verification.

Also, a new CLI binary was added to export the image_id and vk_hash to a JSON file to simplify the process of managing and registering valid programs.

How to test

Run the proof aggregator with proving and verify that it works:

  1. make start_proof_aggregator AGGREGATOR=sp1
  2. make start_proof_aggregator AGGREGATOR=risc0

Type of change

  • Bug fix

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

Copy link

github-actions bot commented Apr 30, 2025

Changes to gas cost

Generated at commit: a06d4e2a6611d91ab17cb248e114455041114aef, compared to commit: 837b4fbe4715d1b848b001bf77ce517608ae7d02

🧾 Summary (10% most significant diffs)

Contract Method Avg (+/-) %
AlignedLayerServiceManager createNewTask +127 ❌ +0.16%

Full diff report 👇
Contract Deployment Cost (+/-) Method Min (+/-) % Avg (+/-) % Median (+/-) % Max (+/-) % # Calls (+/-)
AlignedLayerServiceManager 8,469,871 (+150,663) createNewTask
receive
57,806 (-36)
23,496 (0)
-0.06%
0.00%
77,924 (+127)
47,378 (+187)
+0.16%
+0.40%
77,916 (-6)
47,472 (0)
-0.01%
0.00%
78,681 (-111)
47,472 (0)
-0.14%
0.00%
256 (0)
256 (0)

Comment on lines 34 to 39
// Write to the file
fs::write(
&dest_path,
serde_json::to_string_pretty(&json_data).unwrap(),
)
.unwrap();
Copy link
Member Author

@MarcosNicolau MarcosNicolau Apr 30, 2025

Choose a reason for hiding this comment

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

I also considered printing it to the console instead of writing it to a file, as this is only available in the contracts deployment configs.

@MarcosNicolau MarcosNicolau self-assigned this May 5, 2025
Co-authored-by: Julian Arce <[email protected]>
Copy link
Collaborator

@JuArce JuArce left a comment

Choose a reason for hiding this comment

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

Lgtm
I tested it changing the expected ELF and it works as expected rejecting the proof

If we merge first #1916 and #1918, we should regenerate program_ids.json to use the deterministic ones

Copy link
Contributor

@MauroToscano MauroToscano left a comment

Choose a reason for hiding this comment

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

We should re review the hashes after deterministic compiling gets added on this PR for Risc0 (SP1 is already merged)

#1918

@MarcosNicolau MarcosNicolau requested a review from MauroToscano May 7, 2025 13:57
@MarcosNicolau
Copy link
Member Author

We should re review the hashes after deterministic compiling gets added on this PR for Risc0 (SP1 is already merged)

The program ids with the new builds have been updated: cdf6342.

@MarcosNicolau MarcosNicolau requested a review from JuArce May 7, 2025 14:02
Copy link
Collaborator

@JuArce JuArce left a comment

Choose a reason for hiding this comment

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

Lgtm
I added to the anvil_deploy_aligned_contracts the step to update the program_ids and fixed the install_aggregation_mode target

@MauroToscano MauroToscano added this pull request to the merge queue May 8, 2025
@JuArce JuArce changed the title fix(aggregation-mode): hardcode image_id and vk_hash from solidity contract fix(aggregation_mode): hardcode image_id and vk_hash from solidity contract May 8, 2025
Merged via the queue into staging with commit 0a6419f May 8, 2025
6 checks passed
@MauroToscano MauroToscano deleted the fix/aggregation-contract-verify-elfs branch May 8, 2025 18:12
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