diff --git a/Cargo.lock b/Cargo.lock
index 7d1eee8..3b8bf4e 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1896,7 +1896,7 @@ dependencies = [
[[package]]
name = "intmax"
-version = "2.2.0-alpha"
+version = "2.2.1-alpha"
dependencies = [
"anyhow",
"ctrlc",
diff --git a/Cargo.toml b/Cargo.toml
index b6e4359..73b3720 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "intmax"
-version = "2.2.0-alpha"
+version = "2.2.1-alpha"
edition = "2021"
[dependencies]
diff --git a/README.md b/README.md
index 48906e3..b892fe7 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
-
+
![74763454](https://github.com/pucedoteth/intmax-rollup-cli/assets/119044801/2140fab8-a17b-4ae1-a95a-e8b464209e86)
intmax
The first stateless zkRollup
@@ -40,7 +40,7 @@ cargo run --release --bin intmax config aggregator-url https://alpha.testnet.int
```sh
alias intmax="$(pwd)/target/release/intmax"
-intmax -V # intmax 2.2.0-alpha
+intmax -V # intmax 2.2.1-alpha
```
## Update
diff --git a/src/controller/mod.rs b/src/controller/mod.rs
index e322b19..15cdba4 100644
--- a/src/controller/mod.rs
+++ b/src/controller/mod.rs
@@ -635,6 +635,7 @@ pub async fn invoke_command(command: Command) -> anyhow::Result<()> {
println!("the above account appears replaced by {nickname}");
}
+ service.resolve_server_health_issue().await.unwrap();
service.trigger_propose_block().await.unwrap();
service.trigger_approve_block().await.unwrap();
}
@@ -918,6 +919,7 @@ pub async fn invoke_command(command: Command) -> anyhow::Result<()> {
.deposit_assets(user_address, vec![deposit_info])
.await?;
+ service.resolve_server_health_issue().await.unwrap();
service.trigger_propose_block().await.unwrap();
service.trigger_approve_block().await.unwrap();
}
@@ -1093,7 +1095,16 @@ pub async fn invoke_command(command: Command) -> anyhow::Result<()> {
}
#[cfg(feature = "advanced")]
BlockCommand::Approve {} => {
- service.trigger_approve_block().await?;
+ match service.trigger_approve_block().await {
+ Ok(_) => {}
+ Err(error) => {
+ if error.to_string().contains("unexpected response from /block/approve: Validation error: proposal blocks were not found") {
+ println!("No proposal blocks were found");
+ } else {
+ anyhow::bail!(error);
+ }
+ }
+ };
}
#[cfg(feature = "advanced")]
BlockCommand::Verify { block_number } => {
@@ -1346,6 +1357,7 @@ pub async fn invoke_command(command: Command) -> anyhow::Result<()> {
}
// reflect to deposit tree
+ service.resolve_server_health_issue().await.unwrap();
service.trigger_propose_block().await.unwrap();
service.trigger_approve_block().await.unwrap();
}
diff --git a/src/service/builder.rs b/src/service/builder.rs
index 3e8ce6d..ffa157f 100644
--- a/src/service/builder.rs
+++ b/src/service/builder.rs
@@ -401,6 +401,26 @@ impl ServiceBuilder {
Ok(resp)
}
+ pub async fn resolve_server_health_issue(&self) -> anyhow::Result<()> {
+ // If an error occurs in this section, there is a high likelihood that the server is down.
+ self.check_health().await?;
+
+ match self.trigger_approve_block().await {
+ Ok(_) => {}
+ Err(error) => {
+ // Approve proposal blocks when they are stuck in an unapproved state.
+ if !error
+ .to_string()
+ .contains("Validation error: proposal blocks were not found")
+ {
+ anyhow::bail!(error);
+ }
+ }
+ };
+
+ Ok(())
+ }
+
pub async fn sync_sent_transaction<
D: NodeData, WrappedHashOut, WrappedHashOut> + Clone,
R: RootData> + Clone,
diff --git a/src/service/functions.rs b/src/service/functions.rs
index 858cd4a..3ac7416 100644
--- a/src/service/functions.rs
+++ b/src/service/functions.rs
@@ -89,6 +89,7 @@ pub async fn merge(
wallet.backup()?;
+ service.resolve_server_health_issue().await.unwrap();
service.trigger_propose_block().await.unwrap();
service.trigger_approve_block().await.unwrap();
}
@@ -147,6 +148,7 @@ pub async fn transfer(
tx_hash
};
+ service.resolve_server_health_issue().await.unwrap();
service.trigger_propose_block().await.unwrap();
{
@@ -225,6 +227,7 @@ pub async fn bulk_mint(
service.deposit_assets(user_address, deposit_list).await?;
+ service.resolve_server_health_issue().await.unwrap();
service.trigger_propose_block().await.unwrap();
service.trigger_approve_block().await.unwrap();
}