Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

Commit

Permalink
fix: fix manifest creation in benchmarks (#1133)
Browse files Browse the repository at this point in the history
Fix manifest creation in benchmarks
  • Loading branch information
deekerno authored Jul 20, 2023
1 parent 8f0af4e commit 5619dde
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 52 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
use criterion::Criterion;
use fuel_indexer_benchmarks::{create_wasm_indexer_benchmark, create_wasm_manifest};
use fuel_indexer_benchmarks::create_wasm_indexer_benchmark;
use fuel_indexer_lib::{config::IndexerConfig, manifest::Manifest};

fn setup_fuel_explorer_manifest() -> Manifest {
create_wasm_manifest(
"indexer_benchmarks",
"fuel_explorer",
"examples/fuel-explorer/fuel-explorer/schema/fuel_explorer.schema.graphql",
"target/wasm32-unknown-unknown/release/fuel_explorer.wasm",
)
let manifest_str = r#"
namespace: indexer_benchmarks
abi: ~
identifier: fuel_explorer
fuel_client: ~
graphql_schema: ../../examples/fuel-explorer/fuel-explorer/schema/fuel_explorer.schema.graphql
module:
wasm: ../../target/wasm32-unknown-unknown/release/fuel_explorer.wasm
metrics: ~
contract_id: ~
start_block: ~
end_block: ~
resumable: ~
"#;

Manifest::try_from(manifest_str).unwrap()
}

// The `criterion_group!` macro requires that target functions have a name.
Expand Down
45 changes: 0 additions & 45 deletions packages/fuel-indexer-benchmarks/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
use criterion::Criterion;
use fuel_core_client::client::FuelClient;
use fuel_indexer::Module;
use fuel_indexer::{
executor::retrieve_blocks_from_node, prelude::fuel::BlockData, Executor,
IndexerConfig, Manifest, WasmIndexExecutor,
};
use fuel_indexer_database::IndexerConnectionPool;
use fuel_indexer_lib::config::DatabaseConfig;
use fuel_indexer_lib::manifest::ContractIds;
use fuel_indexer_tests::fixtures::TestPostgresDb;
use std::path::Path;
use std::str::FromStr;

/// Location of Fuel node to be used for block retrieval.
Expand All @@ -35,48 +32,6 @@ async fn get_blocks(start_cursor: u64, num_blocks: usize) -> Result<Vec<BlockDat
Ok(blocks)
}

pub fn create_wasm_manifest(
namespace: &str,
identifier: &str,
schema_path: &str,
wasm_module_path: &str,
) -> Manifest {
let schema_path = Path::new(WORKSPACE_ROOT)
.parent()
.unwrap()
.parent()
.unwrap()
.join(schema_path)
.as_path()
.to_str()
.unwrap()
.to_string();
let module_path = Path::new(WORKSPACE_ROOT)
.parent()
.unwrap()
.parent()
.unwrap()
.join(wasm_module_path)
.as_path()
.to_str()
.unwrap()
.to_string();

Manifest {
namespace: namespace.to_string(),
identifier: identifier.to_string(),
graphql_schema: schema_path,
module: Module::Wasm(module_path),
abi: None,
fuel_client: None,
metrics: None,
contract_id: ContractIds::Single(None),
start_block: None,
end_block: None,
resumable: None,
}
}

/// Create WASM executor for use in a benchmarking function.
async fn setup_wasm_executor(
mut config: IndexerConfig,
Expand Down

0 comments on commit 5619dde

Please sign in to comment.