-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check if relayer funds are enough to process submitted transaction (estimates). #53
Conversation
67e35d5
to
2588866
Compare
.await?; | ||
|
||
let block_fees = app.db.get_latest_block_fees_by_chain_id(relayer.chain_id).await?; | ||
if let Some(block_fees) = block_fees { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I decided to check funds only if estimates are available. Other option is to return error here if we think it is crucial for us.
2588866
to
6879b43
Compare
6879b43
to
575d7cb
Compare
src/service.rs
Outdated
@@ -82,6 +82,18 @@ impl Service { | |||
|
|||
Ok(()) | |||
} | |||
|
|||
pub async fn is_estimates_ready_for_chain(&self, chain_id: u64) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pub async fn is_estimates_ready_for_chain(&self, chain_id: u64) -> bool { | |
pub async fn are_estimates_ready_for_chain(&self, chain_id: u64) -> bool { |
?
tests/common/service_builder.rs
Outdated
@@ -94,6 +94,22 @@ impl ServiceBuilder { | |||
let client = | |||
TxSitterClient::new(format!("http://{}", service.local_addr())); | |||
|
|||
// Awaits for estimates to be ready | |||
let mut is_estimates_ready = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let mut is_estimates_ready = false; | |
let mut are_estimates_ready = false; |
src/service.rs
Outdated
|
||
pub async fn is_estimates_ready_for_chain(&self, chain_id: u64) -> bool { | ||
let res = self | ||
._app |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change struct field to app
Transaction cost is estimated based on gas limit and current gas cost estimates based on chain.