-
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
@@ -0,0 +1,44 @@ | |||
{ |
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 need to include portal config? I'd rather not have it included.
@@ -0,0 +1,15 @@ | |||
tokens: |
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 need to include this config? I am not opposed to have pre-deployed mock contracts available but there equivalent would need to be available on L2.
server_url: postgres://postgres:notsecurepassword@localhost:5433/zksync_local_test | ||
prover_url: postgres://postgres:notsecurepassword@localhost:5433/prover_local_test | ||
db: | ||
state_keeper_db_path: /home/itegulov/Work/matterlabs/anvil-zksync/l1-setup/./chains/anvil/db/main/state_keeper |
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.
Assuming the file paths should be changed.
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.
@itegulov awesome work good sir 💪 ! Understandably this will happen iteratively but devs wont be required to manually send a |
@@ -133,6 +133,8 @@ pub struct TestNodeConfig { | |||
pub preserve_historical_states: bool, | |||
/// State to load | |||
pub load_state: Option<PathBuf>, | |||
/// Port the spawned L1 anvil node will listen on | |||
pub l1_anvil_port: Option<u16>, |
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.
Can we add a print statement to print
that indicates what port L1 is running at.
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.
@@ -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.
Should this be in gitignore?
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