Skip to content

Commit

Permalink
Add call to verify
Browse files Browse the repository at this point in the history
  • Loading branch information
gianbelinche committed Sep 30, 2024
1 parent ebee098 commit 4dc9e16
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 9 deletions.
2 changes: 1 addition & 1 deletion contracts
2 changes: 1 addition & 1 deletion core/bin/zksync_server/src/node_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ impl MainNodeBuilder {
.add_layer(ObjectStorageClientWiringLayer::new(config));
}
DAClient::EigenDA(config) => {
self.node.add_layer(EigenDAWiringLayer::new(config, self.contracts_config.eigenda_verifier_addr));
self.node.add_layer(EigenDAWiringLayer::new(config, self.contracts_config.eigenda_verifier_addr.unwrap()));
}
}

Expand Down
9 changes: 8 additions & 1 deletion core/lib/contracts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ const LOADNEXT_CONTRACT_FILE: &str =
"etc/contracts-test-data/artifacts-zk/contracts/loadnext/loadnext_contract.sol/LoadnextContract.json";
const LOADNEXT_SIMPLE_CONTRACT_FILE: &str =
"etc/contracts-test-data/artifacts-zk/contracts/loadnext/loadnext_contract.sol/Foo.json";

const EIGENDA_VERIFIER_CONTRACT_FILE: (&str, &str) = (
"eigenda",
"EigendaVerifier.sol/EigendaVerifier.json",
);
fn home_path() -> PathBuf {
Workspace::locate().core()
}
Expand Down Expand Up @@ -162,6 +165,10 @@ pub fn verifier_contract() -> Contract {
load_contract_for_both_compilers(VERIFIER_CONTRACT_FILE)
}

pub fn eigenda_verifier_contract() -> Contract {
load_contract_for_both_compilers(EIGENDA_VERIFIER_CONTRACT_FILE)
}

#[derive(Debug, Clone)]
pub struct TestContract {
/// Contract bytecode to be used for sending deploy transaction.
Expand Down
12 changes: 8 additions & 4 deletions core/node/da_clients/src/eigen_da.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl EigenDAClient {
pub async fn verify_blob(
&self,
commitment: String,
) -> Result<U256, ContractCallError> {
) -> Result<U256, types::DAError> {
let data = &hex::decode(commitment).unwrap()[3..];

let blob_info: BlobInfo = match decode(&data) {
Expand All @@ -48,11 +48,14 @@ impl EigenDAClient {

CallFunctionArgs::new("verifyBlob", blob_info)
.for_contract(
self.verifier_address, //todo
&zksync_contracts::hyperchain_contract(), // todo
self.verifier_address,
&zksync_contracts::eigenda_verifier_contract(),
)
.call(&self.eth_client)
.await
.await.map_err(|e| DAError {
error: e.into(),
is_retriable: true,
})
}
}

Expand Down Expand Up @@ -81,6 +84,7 @@ impl DataAvailabilityClient for EigenDAClient {
self.verify_blob(
hex::encode(request_id.clone()),
).await?;

Ok(types::DispatchResponse {
blob_id: hex::encode(request_id),
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use zksync_config::configs::da_client::eigen_da::EigenDAConfig;
use zksync_da_client::DataAvailabilityClient;
use zksync_da_clients::eigen_da::EigenDAClient;
use zksync_node_framework_derive::FromContext;
use zksync_types::Address;

use crate::{
implementations::resources::da_client::DAClientResource,
implementations::resources::{da_client::DAClientResource, eth_interface::EthInterfaceResource},
wiring_layer::{WiringError, WiringLayer},
IntoContext,
};
Expand All @@ -27,9 +28,15 @@ pub struct Output {
pub client: DAClientResource,
}

#[derive(Debug, FromContext)]
#[context(crate = crate)]
pub struct Input {
pub eth_client: EthInterfaceResource,
}

#[async_trait::async_trait]
impl WiringLayer for EigenDAWiringLayer {
type Input = ();
type Input = Input;
type Output = Output;

fn layer_name(&self) -> &'static str {
Expand Down
2 changes: 2 additions & 0 deletions zk_toolbox/crates/config/src/contracts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ impl ContractsConfig {
.diamond_cut_data
.clone_from(&deploy_l1_output.contracts_config.diamond_cut_data);
self.l1.chain_admin_addr = deploy_l1_output.deployed_addresses.chain_admin;
self.l1.eigenda_verifier_addr = deploy_l1_output.deployed_addresses.eigenda_verifier_addr;
}

pub fn set_chain_contracts(&mut self, register_chain_output: &RegisterChainOutput) {
Expand Down Expand Up @@ -151,6 +152,7 @@ pub struct L1Contracts {
pub verifier_addr: Address,
pub validator_timelock_addr: Address,
pub base_token_addr: Address,
pub eigenda_verifier_addr: Address,
}

#[derive(Debug, Serialize, Deserialize, Clone, Default)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ pub struct DeployL1DeployedAddressesOutput {
pub bridgehub: L1BridgehubOutput,
pub bridges: L1BridgesOutput,
pub state_transition: L1StateTransitionOutput,
pub eigenda_verifier_addr: Address,
}

#[derive(Debug, Deserialize, Serialize, Clone)]
Expand Down

0 comments on commit 4dc9e16

Please sign in to comment.