-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0a3c469
commit c362d1a
Showing
5 changed files
with
66 additions
and
47 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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,47 +1,26 @@ | ||
use anyhow::Result; | ||
use std::{fs, path::Path}; | ||
|
||
// Copyright (c) Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
use serde::Deserialize; | ||
|
||
use clap::*; | ||
use std::path::PathBuf; | ||
|
||
#[derive(Parser, Clone, Debug)] | ||
#[clap( | ||
name = "Bridge Indexer", | ||
about = "Run an indexer for the bridge.\n\ | ||
It uses the data ingestion framework to read sui transactions and listens\n\ | ||
to Ethereum events in order to generate data related to the bridge.\n\ | ||
Data is written to postgres tables and can be used for dashboards and general checks\n\ | ||
on bridge health.", | ||
rename_all = "kebab-case" | ||
)] | ||
pub struct BridgeIndexerConfig { | ||
/// URL of the sui remote store. | ||
#[clap(long, short = 'r', required = true)] | ||
pub remote_store_url: Option<String>, | ||
/// URL for Eth fullnode. | ||
#[clap(long, short = 'e', required = true)] | ||
/// config as loaded from `config.yaml`. | ||
#[derive(Debug, Deserialize)] | ||
pub struct Config { | ||
pub remote_store_url: String, | ||
pub eth_rpc_url: String, | ||
/// URL of the DB instance holding indexed bridge data. | ||
#[clap(long, short = 'd', required = true)] | ||
pub db_url: String, | ||
/// Path to the file where the progress store is stored. | ||
#[clap( | ||
long, | ||
short = 'p', | ||
default_value = "/tmp/progress_store", | ||
global = true | ||
)] | ||
pub progress_store_file: PathBuf, | ||
/// Path to the directory where the checkpoints are stored. | ||
#[clap(long, short = 'c', default_value = "/tmp", global = true)] | ||
pub checkpoints_path: PathBuf, | ||
/// Number of worker threads to use. | ||
#[clap(long, short = 't', default_value = "1", global = true)] | ||
pub concurrency: usize, | ||
/// Address of the SuiBridge contract | ||
#[clap(long, required = true, short = 'a')] | ||
pub progress_store_file: String, | ||
pub checkpoints_path: String, | ||
pub concurrency: u64, | ||
pub eth_sui_bridge_contract_address: String, | ||
/// Block to start indexing from | ||
#[clap(long, required = true, short = 's')] | ||
pub start_block: u64, | ||
} | ||
|
||
/// Load the config to run. | ||
pub fn load_config(path: &Path) -> Result<Config> { | ||
let reader = fs::File::open(path)?; | ||
let config: Config = serde_yaml::from_reader(reader)?; | ||
Ok(config) | ||
} |
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,18 @@ | ||
# config.yaml format: | ||
|
||
# URL of the remote store | ||
# remote_store_url: <url> | ||
# URL for Ethereum RPC | ||
# eth_rpc_url: <url> | ||
# Database connection URL | ||
# db_url: <url> | ||
# File to store the progress | ||
# progress_store_file: <path> | ||
# Path to the checkpoints | ||
# checkpoints_path: <path> | ||
# Number of concurrent operations | ||
# concurrency: 1 | ||
# Ethereum to Sui bridge contract address | ||
# eth_sui_bridge_contract_address: <contract_address> | ||
# Starting block number | ||
# start_block: <indexing_start_block> |
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