-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
11 changed files
with
224 additions
and
74 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
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
prometheus: 127.0.0.1:8876 | ||
rpc: http://127.0.0.1:8899 | ||
postgres: | ||
url: postgres://solana:solana@localhost/solana | ||
min_connections: 10 | ||
max_connections: 50 | ||
bubblegum: | ||
only_trees: null |
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,5 +1,47 @@ | ||
use crate::config::ConfigMonitor; | ||
use crate::postgres::create_pool; | ||
use crate::util::create_shutdown; | ||
use crate::{config::ConfigMonitor, prom::update_tree_proof_report}; | ||
use das_bubblegum::{verify_bubblegum, BubblegumContext, VerifyArgs}; | ||
use das_core::{Rpc, SolanaRpcArgs}; | ||
use futures::stream::StreamExt; | ||
use tracing::error; | ||
|
||
pub async fn run(config: ConfigMonitor) -> anyhow::Result<()> { | ||
let mut shutdown = create_shutdown()?; | ||
let database_pool = create_pool(config.postgres).await?; | ||
let rpc = Rpc::from_config(&SolanaRpcArgs { | ||
solana_rpc_url: config.rpc, | ||
}); | ||
|
||
let bubblegum_verify = tokio::spawn(async move { | ||
loop { | ||
let bubblegum_context = BubblegumContext::new(database_pool.clone(), rpc.clone()); | ||
let verify_args = VerifyArgs { | ||
only_trees: config.bubblegum.only_trees.clone(), | ||
max_concurrency: config.bubblegum.max_concurrency, | ||
}; | ||
|
||
match verify_bubblegum(bubblegum_context, verify_args).await { | ||
Ok(reports) => { | ||
for report in reports { | ||
update_tree_proof_report(&report); | ||
} | ||
} | ||
Err(e) => { | ||
error!( | ||
message = "Error verifying bubblegum", | ||
error = ?e | ||
); | ||
} | ||
} | ||
|
||
tokio::time::sleep(tokio::time::Duration::from_millis(150)).await; | ||
} | ||
}); | ||
|
||
if let Some(_signal) = shutdown.next().await {} | ||
|
||
bubblegum_verify.abort(); | ||
|
||
Ok(()) | ||
} |
Oops, something went wrong.