Skip to content

Commit

Permalink
Merge pull request #16 from hyperlane-xyz/trevor/fix-announcement-iss…
Browse files Browse the repository at this point in the history
…ues-1

Fix build, oops
  • Loading branch information
daniel-savu authored Oct 28, 2023
2 parents 47d2054 + 966aa49 commit e0323c8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 8 additions & 3 deletions rust/agents/validator/src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,26 +202,29 @@ impl Validator {
tasks
}

fn log_on_announce_failure(result: ChainResult<TxOutcome>) {
fn log_on_announce_failure(result: ChainResult<TxOutcome>, chain_signer: &String) {
match result {
Ok(outcome) => {
if outcome.executed {
info!(
tx_outcome=?outcome,
?chain_signer,
"Successfully announced validator",
);
} else {
error!(
txid=?outcome.transaction_id,
gas_used=?outcome.gas_used,
gas_price=?outcome.gas_price,
?chain_signer,
"Transaction attempting to announce validator reverted. Make sure you have enough funds in your account to pay for transaction fees."
);
}
}
Err(err) => {
error!(
?err,
?chain_signer,
"Failed to announce validator. Make sure you have enough funds in your account to pay for gas."
);
}
Expand Down Expand Up @@ -274,6 +277,8 @@ impl Validator {
.chain_signer()
.await?
{
let chain_signer = chain_signer.address_string();
info!(eth_validator_address=?announcement.validator, ?chain_signer, "Attempting self announce");
let balance_delta = self
.validator_announce
.announce_tokens_needed(signed_announcement.clone())
Expand All @@ -283,15 +288,15 @@ impl Validator {
warn!(
tokens_needed=%balance_delta,
eth_validator_address=?announcement.validator,
chain_signer=?chain_signer.address_string(),
?chain_signer,
"Please send tokens to your chain signer address to announce",
);
} else {
let result = self
.validator_announce
.announce(signed_announcement.clone(), None)
.await;
Self::log_on_announce_failure(result);
Self::log_on_announce_failure(result, &chain_signer);
}
} else {
warn!(origin_chain=%self.origin_chain, "Cannot announce validator without a signer; make sure a signer is set for the origin chain");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ pub struct GetAnnounceStorageLocationsRequestInner {
pub validators: Vec<String>,
}

#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct AnnouncementRequest {
pub announce: AnnouncementRequestInner,
}

#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct AnnouncementRequestInner {
pub validator: String,
pub storage_location: String,
Expand Down

0 comments on commit e0323c8

Please sign in to comment.