MCPcopy Index your code
hub / github.com/Commit-Boost/commit-boost-client / run

Method run

examples/da_commit/src/main.rs:46–76  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

44
45impl DaCommitService {
46 pub async fn run(&mut self) -> Result<()> {
47 // the config has the signer_client already setup, we can use it to interact
48 // with the Signer API
49 let pubkeys = self.config.signer_client.get_pubkeys().await?.keys;
50 info!(pubkeys = %serde_json::to_string_pretty(&pubkeys).unwrap(), "Received pubkeys");
51
52 let pubkey = pubkeys.first().ok_or_eyre("no key available")?.consensus.clone();
53 info!("Registered validator {pubkey}");
54
55 let proxy_delegation_bls =
56 self.config.signer_client.generate_proxy_key_bls(pubkey.clone()).await?;
57 info!("Obtained a BLS proxy delegation:\n{proxy_delegation_bls}");
58 let proxy_bls = proxy_delegation_bls.message.proxy;
59
60 let proxy_ecdsa = if self.config.extra.use_ecdsa_keys {
61 let proxy_delegation_ecdsa =
62 self.config.signer_client.generate_proxy_key_ecdsa(pubkey.clone()).await?;
63 info!("Obtained an ECDSA proxy delegation:\n{proxy_delegation_ecdsa}");
64 Some(proxy_delegation_ecdsa.message.proxy)
65 } else {
66 None
67 };
68
69 let mut data = 0;
70
71 loop {
72 self.send_request(data, pubkey.clone(), proxy_bls.clone(), proxy_ecdsa).await?;
73 sleep(Duration::from_secs(self.config.extra.sleep_secs)).await;
74 data += 1;
75 }
76 }
77
78 pub async fn send_request(
79 &mut self,

Callers 1

mainFunction · 0.45

Calls 4

get_pubkeysMethod · 0.80
send_requestMethod · 0.80

Tested by

no test coverage detected