Skip to content

Commit

Permalink
fix: failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
palozano committed Oct 31, 2024
1 parent 3466ddf commit 9ee91b3
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions offchain/src/chain/connections.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use alloy::{
pubsub::{PubSubFrontend, SubscriptionStream},
rpc::types::{Filter, Log},
};
use eyre::{OptionExt, Result};
use eyre::{eyre, OptionExt, Result};

/// Create the subscriptions for the DVN workflow.
pub async fn build_dvn_subscriptions(
Expand Down Expand Up @@ -86,7 +86,7 @@ pub async fn build_executor_subscriptions(
/// Load the MessageLib ABI.
pub fn get_abi_from_path(path: &str) -> Result<JsonAbi> {
// Get the SendLib ABI
let artifact = std::fs::read(path)?;
let artifact = std::fs::read(path).map_err(|e| eyre!("Cannot load config for offchain worker. Error: {:?}", e))?;
let json: serde_json::Value = serde_json::from_slice(&artifact)?;
// SAFETY: Assume `unwrap` is safe since the key has been harcoded
let abi_value = json.get("abi").ok_or_eyre("ABI not found in artifact")?;
Expand All @@ -108,9 +108,9 @@ mod tests {

#[test]
fn test_expect_to_find_all_abis() {
get_abi_from_path("abi/ReceiveLibUln302.json").unwrap();
get_abi_from_path("abi/SendLibUln302.json").unwrap();
get_abi_from_path("abi/L0V2Endpoint.json").unwrap();
get_abi_from_path("./offchain/abi/ReceiveLibUln302.json").unwrap();
get_abi_from_path("./offchain/abi/SendLibUln302.json").unwrap();
get_abi_from_path("./offchain/abi/L0V2Endpoint.json").unwrap();
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion offchain/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use config::Config;
use eyre::Result;
use serde::Deserialize;

const CONFIG_PATH: &str = "./workers_config";
const CONFIG_PATH: &str = "./offchain/workers_config.toml";

#[derive(Debug, Deserialize)]
pub struct WorkerConfig {
Expand Down
2 changes: 1 addition & 1 deletion offchain/src/workers/dvn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ impl Dvn {
let http_provider = get_http_provider(&self.config)?;

// Get the relevant contract ABI, and create contract.
let abi = get_abi_from_path("./abi/ReceiveLibUln302.json")?;
let abi = get_abi_from_path("./offchain/abi/ReceiveLibUln302.json")?;
self.receive_lib = Some(create_contract_instance(
self.config.receivelib_uln302_addr,
http_provider,
Expand Down
2 changes: 1 addition & 1 deletion offchain/src/workers/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl NFFLExecutor {
build_executor_subscriptions(&self.config).await?;

let http_provider = get_http_provider(&self.config)?;
let l0_abi = get_abi_from_path("./abi/L0V2Endpoint.json")?;
let l0_abi = get_abi_from_path("./offchain/abi/L0V2Endpoint.json")?;
// Create a contract instance.
let contract = create_contract_instance(self.config.l0_endpoint_addr, http_provider, l0_abi)?;

Expand Down

0 comments on commit 9ee91b3

Please sign in to comment.