-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement basic L1 support and
anvil_zks_commitBatch
(#575)
* add l1 setup guide with pre-generated artifacts * use contracts with disabled commit verification * implement l1 support through foundry anvil * use copied version of IExecutor.sol * make L1 anvil optional * redirect L1 stdout to a file * add some sanity check tests * vastly simplify l1-setup process * proper CLI option for L1 support + printing L1 config for user * adapt e2e tests to new cli options * migrate to anvil dependency * revert alloy-zksync bump * rename anvil ext namespace to `anvil_zks` * update Cargo.lock
- Loading branch information
Showing
42 changed files
with
6,068 additions
and
257 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule contracts
updated
1 files
+46 −22 | l1-contracts/contracts/state-transition/chain-deps/facets/Executor.sol |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
use jsonrpsee::core::RpcResult; | ||
use jsonrpsee::proc_macros::rpc; | ||
use zksync_types::{L1BatchNumber, H256}; | ||
|
||
/// Custom namespace that contains anvil-zksync specific methods. | ||
#[rpc(server, namespace = "anvil_zks")] | ||
pub trait AnvilZksNamespace { | ||
#[method(name = "commitBatch")] | ||
async fn commit_batch(&self, batch_number: L1BatchNumber) -> RpcResult<H256>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
mod anvil; | ||
mod anvil_zks; | ||
mod config; | ||
mod eth_test; | ||
mod evm; | ||
|
||
pub use self::{ | ||
anvil::AnvilNamespaceServer, config::ConfigNamespaceServer, eth_test::EthTestNamespaceServer, | ||
evm::EvmNamespaceServer, | ||
anvil::AnvilNamespaceServer, anvil_zks::AnvilZksNamespaceServer, config::ConfigNamespaceServer, | ||
eth_test::EthTestNamespaceServer, evm::EvmNamespaceServer, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use crate::error::RpcError; | ||
use anvil_zksync_api_decl::AnvilZksNamespaceServer; | ||
use anvil_zksync_l1_sidecar::L1Sidecar; | ||
use jsonrpsee::core::{async_trait, RpcResult}; | ||
use zksync_types::{L1BatchNumber, H256}; | ||
|
||
pub struct AnvilZksNamespace { | ||
l1_sidecar: L1Sidecar, | ||
} | ||
|
||
impl AnvilZksNamespace { | ||
pub fn new(l1_sidecar: L1Sidecar) -> Self { | ||
Self { l1_sidecar } | ||
} | ||
} | ||
|
||
#[async_trait] | ||
impl AnvilZksNamespaceServer for AnvilZksNamespace { | ||
async fn commit_batch(&self, batch_number: L1BatchNumber) -> RpcResult<H256> { | ||
Ok(self | ||
.l1_sidecar | ||
.commit_batch(batch_number) | ||
.await | ||
.map_err(RpcError::from)?) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.