Skip to content

Commit

Permalink
better/more log message for starknet AccountError
Browse files Browse the repository at this point in the history
  • Loading branch information
paulbalaji committed Jan 6, 2025
1 parent 55488d9 commit 1db10a5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
7 changes: 5 additions & 2 deletions rust/main/chains/hyperlane-starknet/src/mailbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,10 @@ impl StarknetMailbox {
None => {
tx.estimate_fee()
.await
.map_err(|e| HyperlaneStarknetError::AccountError(e.to_string()))?
.map_err(|e| {
tracing::error!("Failed to estimate fee in process_contract_call: {:?}", e);
HyperlaneStarknetError::AccountError(e.to_string())
})?
.overall_fee
}
};
Expand Down Expand Up @@ -221,7 +224,7 @@ impl Mailbox for StarknetMailbox {
.estimate_fee()
.await
.map_err(|e| {
tracing::error!("Failed to estimate fee: {:?}", e);
tracing::error!("Failed to estimate fee in process_estimate_costs: {:?}", e);
HyperlaneStarknetError::AccountError(e.to_string())
})?;

Expand Down
5 changes: 4 additions & 1 deletion rust/main/chains/hyperlane-starknet/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,10 @@ pub async fn send_and_confirm(
let tx = contract_call
.send()
.await
.map_err(|e| HyperlaneStarknetError::AccountError(e.to_string()))?;
.map_err(|e| {
tracing::error!("Failed to send transaction in send_and_confirm: {:?}", e);
HyperlaneStarknetError::AccountError(e.to_string())
})?;

let receipt = get_transaction_receipt(rpc_client, tx.transaction_hash).await?;

Expand Down
6 changes: 4 additions & 2 deletions rust/main/chains/hyperlane-starknet/src/validator_announce.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,13 @@ impl StarknetValidatorAnnounce {
let tx = self
.contract
.announce(&EthAddress(validator), &storage_location, signature);

let gas_estimate = tx
.estimate_fee()
.await
.map_err(|e| HyperlaneStarknetError::AccountError(e.to_string()))?
.map_err(|e| {
tracing::error!("Failed to estimate gas in announce_contract_call: {:?}", e);
HyperlaneStarknetError::AccountError(e.to_string())
})?
.overall_fee;

let max_cost = gas_estimate * FieldElement::TWO;
Expand Down

0 comments on commit 1db10a5

Please sign in to comment.