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

feat: disable verifiers #1090

Merged
merged 70 commits into from
Oct 18, 2024

Conversation

MarcosNicolau
Copy link
Collaborator

@MarcosNicolau MarcosNicolau commented Sep 25, 2024

Changes
This pr introduces proving systems or verifiers blacklisting through a new bitmap field in the ServiceManager contract. The batcher and operator, before doing a verification, they make sure that the proving system is indeed whitelisted by calling isVerifierValid function in the ServiceManager contract.

It also includes the verification for disabled verifiers in the operators and the batcher logic. For the batcher it will now check for every new block if the disabled verifiers have changed, in the afirmative case it checks all the proofs inside the batcher queue and remove all of them indistinctly if it was a proof using the disabled verifier or not.

Test
You can test this following these steps:

  • Set up and run all the different components (anvil, aggregator, operator and batcher)
  • In another terminal run make batcher_send_burst_groth16 just to keep generating new proofs and avoid problems trying to submit repeated batches.
  • To update the blacklisted verifiers bitmap you can use the following makefile target that sends a transaction to the service manager with the function signature disableVerifier(uint8). The VERIFIER_ID=3 variable will disable the SP1 verifier:
make verifier_disable_devnet VERIFIER_ID=3
  • Try to send a sp1 proof that it should be rejected by the batcher: make batcher_send_sp1_task.
  • Whitelist the verifier doing:
make verifier_enable_devnet VERIFIER_ID=3
  • Try to send a sp1 proof and it should be working again: make batcher_send_sp1_task.

If you want to try and disable all the other verifiers run the same command mentioned above changing the VERIFIER_ID
that is the ID corresponding to the ProvingSystemId enum in the proving_systems.go file, being GnarkPlonkBls12_381 the id 0.

Disabled verifiers in the batch queue testing

  1. Start the Aligned components (anvil, aggregator, and operator).

  2. Open the batcher's configuration file at config-files/config-batcher.yaml and adjust the following parameters:

    block_interval: 100000
    batch_size_interval: 4
    

    This ensures the batch won't be submitted while sending valid proofs, but the batch remains open, allowing you to disable the verifier later.

  3. Run the batcher:
    make batcher_start_local

  4. Send 3 proofs using any of the verifiers:

    • make batcher_send_sp1_task
    • make batcher_send_risc0_task
    • make batcher_send_groth16_bn254_task
  5. Disable the SP1 verifier:
    make verifier_disable_devnet VERIFIER_ID=3

  6. Verify that all the clients stop and encounter an BatchReset error. The batcher's queue should now be empty.


This closes #1082

Copy link

github-actions bot commented Sep 25, 2024

Changes to gas cost

Generated at commit: 7a20d9cc4b4d2c38adc7e0240d419a62ccf45ba1, compared to commit: 07f682c7f5bab0ef2711f7373ba865d4ef9d5258

🧾 Summary (10% most significant diffs)

Contract Method Avg (+/-) %
AlignedLayerServiceManager batchesState -22 ✅ -3.13%

Full diff report 👇
Contract Deployment Cost (+/-) Method Min (+/-) % Avg (+/-) % Median (+/-) % Max (+/-) % # Calls (+/-)
AlignedLayerServiceManager 4,771,213 (+89,416) batchesState
createNewTask
receive
681 (-22)
53,923 (+88)
21,169 (0)
-3.13%
+0.16%
0.00%
681 (-22)
73,673 (-169)
44,503 (-280)
-3.13%
-0.23%
-0.63%
681 (-22)
74,081 (+100)
45,064 (0)
-3.13%
+0.14%
0.00%
681 (-22)
74,822 (+37)
45,064 (0)
-3.13%
+0.05%
0.00%
256 (0)
256 (0)
256 (0)

@IAvecilla IAvecilla marked this pull request as ready for review September 27, 2024 17:07
contracts/src/core/AlignedLayerServiceManagerStorage.sol Outdated Show resolved Hide resolved
contracts/src/core/AlignedLayerServiceManager.sol Outdated Show resolved Hide resolved
contracts/src/core/IAlignedLayerServiceManager.sol Outdated Show resolved Hide resolved
contracts/src/core/AlignedLayerServiceManager.sol Outdated Show resolved Hide resolved
contracts/src/core/AlignedLayerServiceManager.sol Outdated Show resolved Hide resolved
contracts/src/core/AlignedLayerServiceManager.sol Outdated Show resolved Hide resolved
contracts/src/core/AlignedLayerServiceManager.sol Outdated Show resolved Hide resolved
contracts/src/core/IAlignedLayerServiceManager.sol Outdated Show resolved Hide resolved
contracts/src/core/IAlignedLayerServiceManager.sol Outdated Show resolved Hide resolved
contracts/src/core/IAlignedLayerServiceManager.sol Outdated Show resolved Hide resolved
operator/pkg/operator.go Outdated Show resolved Hide resolved
operator/pkg/operator.go Outdated Show resolved Hide resolved
@IAvecilla IAvecilla requested a review from uri-99 October 2, 2024 13:15
Copy link
Contributor

@uri-99 uri-99 left a comment

Choose a reason for hiding this comment

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

still missing to review a couple of files

batcher/aligned-batcher/src/lib.rs Outdated Show resolved Hide resolved
batcher/aligned-batcher/src/lib.rs Outdated Show resolved Hide resolved
batcher/aligned-batcher/src/lib.rs Outdated Show resolved Hide resolved
batcher/aligned-batcher/src/lib.rs Outdated Show resolved Hide resolved
operator/pkg/operator.go Outdated Show resolved Hide resolved
operator/pkg/utils.go Show resolved Hide resolved
operator/pkg/utils_test.go Outdated Show resolved Hide resolved
operator/pkg/utils_test.go Outdated Show resolved Hide resolved
operator/pkg/utils_test.go Outdated Show resolved Hide resolved
@JuArce JuArce merged commit 5ac308d into staging Oct 18, 2024
7 checks passed
@JuArce JuArce deleted the 1082-add-a-bitmap-in-ethereum-to-disable-verifiers branch October 18, 2024 20:06
PatStiles pushed a commit that referenced this pull request Nov 6, 2024
Co-authored-by: IAvecilla <[email protected]>
Co-authored-by: Mariano Nicolini <[email protected]>
Co-authored-by: Uriel Mihura <[email protected]>
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 a Bitmap in Ethereum to disable verifiers
6 participants