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: implement anvil_zks_{prove,execute}Batch #586

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

itegulov
Copy link
Contributor

What 💻

Next part of #536

Introduces support for proving and executing on L1. Adds persistent batches to Blockchain as we must submit batches with consistent root hash. So now L1 sidecar loads batch headers from core which is more realistic to what would usually happen and bring us one step closer to having proper system logs (we need to make InMemoryNode persist them in the resulting batch).

Why ✋

L1-L2 communication

@itegulov itegulov requested a review from a team as a code owner February 12, 2025 11:43
Comment on lines +10 to +15

#[method(name = "proveBatch")]
async fn prove_batch(&self, batch_number: L1BatchNumber) -> RpcResult<H256>;

#[method(name = "executeBatch")]
async fn execute_batch(&self, batch_number: L1BatchNumber) -> RpcResult<H256>;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we be documenting these API endpoints in https://github.com/matter-labs/anvil-zksync/blob/main/SUPPORTED_APIS.md?

Comment on lines +499 to +500
// Batches are not being used when running in forking mode
batches: HashMap::from_iter([]),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why would batches not be used during forking?

Comment on lines +640 to +646
// Our version of contracts has system log and data availability verification disabled.
// Hence, we are free to create a zeroed out dummy header without any logs whatsoever.
let header = L1BatchHeader::new(
self.current_batch,
0,
// We could use contract hashes that were actually used, but they might differ from what
// L1 expects due to impersonation
Copy link
Collaborator

Choose a reason for hiding this comment

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

If a user checkouts different system contracts that has system log and data availability verification enabled will that be a problem? Just thinking about our own protocol devs usage.

@dutterbutter dutterbutter added the needs review 👓 PR requires a review label Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs review 👓 PR requires a review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants