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

Set ZK constants in compile time #1613

Merged
merged 105 commits into from
Dec 21, 2024

Conversation

yaziciahmet
Copy link
Contributor

@yaziciahmet yaziciahmet commented Dec 16, 2024

Description

Made certain variables constant in zk. Only environment variable needed is CITREA_NETWORK, and all the constant values are decided based on the network env value. Valid CITREA_NETWORK values are:

  • mainnet
  • testnet
  • devnet
  • nightly

If no CITREA_NETWORK env variable is found, it defaults to nightly. And to make things more testable, if the network is nightly, the exact values for each constant value can be provided through env variable.

Batch Proof:

  • FORKS
  • SEQUENCER_PUBLIC_KEY
  • SEQUENCER_DA_PUBLIC_KEY

Light Client Proof:

  • L2_GENESIS_ROOT
  • BATCH_PROOF_METHOD_ID
  • BATCH_PROVER_DA_PUBLIC_KEY

TODO:

  • Make needed variables constant in guest
  • Update circuit methods to take constants as arguments
  • Separate network fork lists and use one of them based on the provided network (through CLI in native, and through env in guest)
  • Update guest Dockerfile & Makefile
  • Update release CI files

Linked Issues

Testing

Describe how these changes were tested. If you've added new features, have you added unit tests?

Docs

Describe where this code is documented. If it changes a documented interface, have the docs been updated?

@eyusufatik
Copy link
Member

If using VSCode, set the following key-value into your settings.json:

you can put a setting.json under .vscode under this pr I think.

Also create a test_builds.env file unders guests/ so that people can see the env vars in the repo

kpp
kpp previously requested changes Dec 16, 2024
Copy link
Contributor

@kpp kpp left a comment

Choose a reason for hiding this comment

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

option_env!, please.

Copy link

codecov bot commented Dec 20, 2024

Codecov Report

Attention: Patch coverage is 63.68715% with 65 lines in your changes missing coverage. Please review.

Project coverage is 78.2%. Comparing base (04dff78) to head (443b7ed).
Report is 1 commits behind head on nightly.

Files with missing lines Patch % Lines
crates/citrea-stf/src/verifier.rs 0.0% 13 Missing ⚠️
...tes/sovereign-sdk/rollup-interface/src/fork/mod.rs 64.5% 11 Missing ⚠️
...ates/sovereign-sdk/rollup-interface/src/network.rs 0.0% 11 Missing ⚠️
crates/sovereign-sdk/rollup-interface/src/spec.rs 0.0% 10 Missing ⚠️
...overeign-sdk/adapters/mock-da/src/types/address.rs 86.4% 5 Missing ⚠️
bin/citrea/src/rollup/bitcoin.rs 0.0% 3 Missing ⚠️
crates/primitives/src/forks.rs 84.2% 3 Missing ⚠️
crates/light-client-prover/src/da_block_handler.rs 0.0% 2 Missing ⚠️
crates/prover-services/src/parallel/mod.rs 75.0% 2 Missing ⚠️
...module-system/sov-modules-stf-blueprint/src/lib.rs 0.0% 2 Missing ⚠️
... and 3 more
Additional details and impacted files
Files with missing lines Coverage Δ
bin/citrea/src/lib.rs 0.0% <ø> (ø)
bin/citrea/src/main.rs 0.0% <ø> (ø)
bin/citrea/src/rollup/mock.rs 77.0% <100.0%> (-2.2%) ⬇️
crates/batch-prover/src/da_block_handler.rs 78.0% <100.0%> (ø)
crates/batch-prover/src/proving.rs 88.9% <100.0%> (-0.1%) ⬇️
crates/batch-prover/src/runner.rs 85.9% <100.0%> (ø)
crates/evm/src/evm/conversions.rs 98.0% <100.0%> (ø)
crates/evm/src/query.rs 89.6% <100.0%> (-0.1%) ⬇️
crates/fullnode/src/da_block_handler.rs 77.1% <100.0%> (-0.1%) ⬇️
crates/fullnode/src/runner.rs 82.3% <100.0%> (ø)
... and 25 more

... and 8 files with indirect coverage changes

Copy link
Member

@eyusufatik eyusufatik left a comment

Choose a reason for hiding this comment

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

update all evm tests to use fork1 spec unless we test for specific behaviour going from genesis to fork1

.github/workflows/release.yml Outdated Show resolved Hide resolved
@eyusufatik eyusufatik dismissed kpp’s stale review December 21, 2024 19:03

option_env implemented

@eyusufatik eyusufatik merged commit 8feb715 into nightly Dec 21, 2024
14 of 15 checks passed
@eyusufatik eyusufatik deleted the yaziciahmet/set-zk-constants-from-env branch December 21, 2024 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants