-
Notifications
You must be signed in to change notification settings - Fork 82
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 basic L1 support with commitment #575
base: main
Are you sure you want to change the base?
Conversation
2bea19e
to
dec25a4
Compare
crates/cli/src/main.rs
Outdated
let mut node_service_tasks: Vec<Pin<Box<dyn Future<Output = anyhow::Result<()>>>>> = Vec::new(); | ||
let l1_sidecar = match config.l1_anvil_port { | ||
Some(l1_anvil_port) => { | ||
let (l1_sidecar, l1_sidecar_runner) = L1Sidecar::builtin(l1_anvil_port).await?; | ||
node_service_tasks.push(Box::pin(l1_sidecar_runner.run())); | ||
l1_sidecar | ||
} | ||
None => L1Sidecar::none(), | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want L1-L2 support enabled by default rather then be toggled via l1-port option? Perhaps this is intentional right now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about something --with-l1
(that will be false
by default until the feature is polished), and then --l1-port
etc to affect how anvil
is launched.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed that it should be disabled by default. Went with options as per @popzxc's suggestion for now. Also I put them under "UNSTABLE - L1" header so hopefully it's clear enough that those are subject to change.
@itegulov awesome work good sir 💪 ! Understandably this will happen iteratively but devs wont be required to manually send a |
crates/cli/src/main.rs
Outdated
let mut node_service_tasks: Vec<Pin<Box<dyn Future<Output = anyhow::Result<()>>>>> = Vec::new(); | ||
let l1_sidecar = match config.l1_anvil_port { | ||
Some(l1_anvil_port) => { | ||
let (l1_sidecar, l1_sidecar_runner) = L1Sidecar::builtin(l1_anvil_port).await?; | ||
node_service_tasks.push(Box::pin(l1_sidecar_runner.run())); | ||
l1_sidecar | ||
} | ||
None => L1Sidecar::none(), | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about something --with-l1
(that will be false
by default until the feature is polished), and then --l1-port
etc to affect how anvil
is launched.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Storing 80mb in the repository seems like a bad idea :(
I dunno, the longer I think about it, the more I'm leaning towards just biting the bullet and adding anvil
as a dependency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. +4k lines in Cargo.lock is not ideal but this approach does simplify a couple of things :)
@@ -0,0 +1,388 @@ | |||
postgres: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should find a way to not include the configs into the repository.
Instead, we probably can use zkstack dev config-writer
to apply overrides only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have revamped l1-setup script to create an ecosystem from scratch and then patch it via yq
(as we discussed in DMs). Feels a lot cleaner, PTAL
@dutterbutter this should also address your comments above so I resolved them, PTAL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now configs certainly look much better!
use jsonrpsee::proc_macros::rpc; | ||
use zksync_types::{L1BatchNumber, H256}; | ||
|
||
#[rpc(server, namespace = "anvil")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussion point: what is appropriate namespace?
anvil
-- pro is that it's a "natural" scope, con is that it's an extension that will not be covered inanvil
docs.anvil_zksync
-- pro is that it's super explicit, con is that we start having too many namespaceszks
-- pro is that it's zksync-native namespace, con is that it's not available on the main node.
Subjectively I'm leaning towards zks
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One counter-argument of extending zks
: presumably we won't stop at commit
/prove
/execute
(which are all clearly testing-related) so we might create false expectations of some of the future methods being available on ENs.
Either of the first two options seem fine to me. Slightly leaning toward a new namespace as I hated what early ETH tooling has done to the evm
namespace lol. We could shorten anvil_zksync
to anvil_zks
for brevity if that helps
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
anvil_zks
ftw
You don't need to send commit batch request to start using L1/L2 support in a sense that this is not a one time thing. You have to do it for every batch you want to eventually execute/finalize. |
What 💻
First part of #536
This PR implement L1 sidecar: an independent service that can initialize, run and query an L1 network. I tried to design it with some extendibility in mind but for now it can only spawn a built-in anvil with precomputed state.
L1 sidecar can:
To try this out run
cargo run --release -- --l1-anvil-port 8012
and then commit batch like this:Additionally I updated our branch of era-contracts: disabled system log validation and DA input validation (only for commitment, will extend it further as need be).
Needs popzxc/alloy-zksync#47 for testing. Tests are pretty bare bones for now but I am hoping to do more on that front further down the line.
Why ✋
First step towards having L1-L2 communication