Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bridge] remove disable-eth #19923

Merged
merged 1 commit into from
Oct 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions crates/sui-bridge-indexer/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ pub struct IndexerConfig {
pub eth_sui_bridge_contract_address: String,

pub metric_port: u16,

/// A temporary flag to disable the eth indexer to test mainnet before eth contracts are deployed.
pub disable_eth: Option<bool>,
}

impl sui_config::Config for IndexerConfig {}
Expand Down
118 changes: 57 additions & 61 deletions crates/sui-bridge-indexer/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,70 +110,66 @@ async fn main() -> Result<()> {
);
let eth_bridge_proxy_address = EthAddress::from_str(&config.eth_sui_bridge_contract_address)?;
let mut tasks = vec![];
if Some(true) == config.disable_eth {
info!("Eth indexer is disabled");
} else {
// Start the eth subscription indexer
let bridge_address = EthAddress::from_str(&config.eth_sui_bridge_contract_address)?;
let provider = Arc::new(
Provider::<Http>::try_from(&config.eth_rpc_url)?
.interval(std::time::Duration::from_millis(2000)),
);
let bridge_addresses = get_eth_contract_addresses(bridge_address, &provider).await?;
let bridge_addresses: Vec<EthAddress> = vec![
bridge_address,
bridge_addresses.0,
bridge_addresses.1,
bridge_addresses.2,
bridge_addresses.3,
];
// Start the eth subscription indexer
let bridge_address = EthAddress::from_str(&config.eth_sui_bridge_contract_address)?;
let provider = Arc::new(
Provider::<Http>::try_from(&config.eth_rpc_url)?
.interval(std::time::Duration::from_millis(2000)),
);
let bridge_addresses = get_eth_contract_addresses(bridge_address, &provider).await?;
let bridge_addresses: Vec<EthAddress> = vec![
bridge_address,
bridge_addresses.0,
bridge_addresses.1,
bridge_addresses.2,
bridge_addresses.3,
];

// Start the eth subscription indexer
let eth_subscription_datasource = EthSubscriptionDatasource::new(
bridge_addresses.clone(),
eth_client.clone(),
config.eth_ws_url.clone(),
indexer_meterics.clone(),
config.eth_bridge_genesis_block,
)
.await?;
let eth_subscription_indexer = IndexerBuilder::new(
"EthBridgeSubscriptionIndexer",
eth_subscription_datasource,
EthDataMapper {
metrics: indexer_meterics.clone(),
},
datastore.clone(),
)
.with_backfill_strategy(BackfillStrategy::Disabled)
.build();
tasks.push(spawn_logged_monitored_task!(
eth_subscription_indexer.start()
));
// Start the eth subscription indexer
let eth_subscription_datasource = EthSubscriptionDatasource::new(
bridge_addresses.clone(),
eth_client.clone(),
config.eth_ws_url.clone(),
indexer_meterics.clone(),
config.eth_bridge_genesis_block,
)
.await?;
let eth_subscription_indexer = IndexerBuilder::new(
"EthBridgeSubscriptionIndexer",
eth_subscription_datasource,
EthDataMapper {
metrics: indexer_meterics.clone(),
},
datastore.clone(),
)
.with_backfill_strategy(BackfillStrategy::Disabled)
.build();
tasks.push(spawn_logged_monitored_task!(
eth_subscription_indexer.start()
));

// Start the eth sync data source
let eth_sync_datasource = EthFinalizedSyncDatasource::new(
bridge_addresses.clone(),
eth_client.clone(),
config.eth_rpc_url.clone(),
indexer_meterics.clone(),
bridge_metrics.clone(),
config.eth_bridge_genesis_block,
)
.await?;
// Start the eth sync data source
let eth_sync_datasource = EthFinalizedSyncDatasource::new(
bridge_addresses.clone(),
eth_client.clone(),
config.eth_rpc_url.clone(),
indexer_meterics.clone(),
bridge_metrics.clone(),
config.eth_bridge_genesis_block,
)
.await?;

let eth_sync_indexer = IndexerBuilder::new(
"EthBridgeFinalizedSyncIndexer",
eth_sync_datasource,
EthDataMapper {
metrics: indexer_meterics.clone(),
},
datastore,
)
.with_backfill_strategy(BackfillStrategy::Partitioned { task_size: 1000 })
.build();
tasks.push(spawn_logged_monitored_task!(eth_sync_indexer.start()));
}
let eth_sync_indexer = IndexerBuilder::new(
"EthBridgeFinalizedSyncIndexer",
eth_sync_datasource,
EthDataMapper {
metrics: indexer_meterics.clone(),
},
datastore,
)
.with_backfill_strategy(BackfillStrategy::Partitioned { task_size: 1000 })
.build();
tasks.push(spawn_logged_monitored_task!(eth_sync_indexer.start()));

let sui_client = Arc::new(
SuiClientBuilder::default()
Expand Down
Loading