(&mut self)
| 44 | |
| 45 | impl 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, |
no test coverage detected