Skip to content

Commit 9186c83

Browse files
committed
fix(controlplane,actions): fix aleo adding new standard out to execute API
1 parent 88073d5 commit 9186c83

File tree

3 files changed

+29
-6
lines changed

3 files changed

+29
-6
lines changed

crates/cli/src/commands/env/action/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,7 @@ pub async fn post_and_wait_tx(url: &str, req: RequestBuilder) -> Result<()> {
383383
use snops_common::events::EventFilter::*;
384384

385385
let tx_id: String = req.send().await?.json().await?;
386+
eprintln!("transaction id: {tx_id}");
386387

387388
let mut events = EventsClient::open_with_filter(url, TransactionIs(Arc::new(tx_id))).await?;
388389

crates/controlplane/src/server/actions/deploy.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ pub async fn deploy_inner(
9191
let compute_bin = env.storage.resolve_compute_binary(state).await?;
9292
// authorize the transaction
9393
let aot = AotCmd::new(compute_bin, env.network);
94-
let auth_str = aot
94+
let mut auth_str = aot
9595
.authorize_deploy(
9696
&resolved_pk,
9797
resolved_fee_pk.as_ref(),
@@ -104,9 +104,20 @@ pub async fn deploy_inner(
104104
)
105105
.await?;
106106

107+
// Truncate the output to the first {
108+
// because Aleo decided to print execute
109+
// status to stdout...
110+
if let Some(index) = auth_str.find("{") {
111+
auth_str = auth_str.split_off(index);
112+
}
113+
107114
// parse the json and bundle it up
108-
let authorization: Authorization =
109-
serde_json::from_str(&auth_str).map_err(AuthorizeError::Json)?;
115+
let authorization: Authorization = serde_json::from_str(&auth_str)
116+
.inspect_err(|e| {
117+
tracing::error!("failed to parse authorization json: {e}");
118+
tracing::error!("authorization json: {auth_str}");
119+
})
120+
.map_err(AuthorizeError::Json)?;
110121

111122
// proxy it to a listen cannon
112123
let tx_id = cannon.proxy_auth(authorization).await?;

crates/controlplane/src/server/actions/execute.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ pub async fn execute_inner(
166166
// authorize the transaction
167167
let compute_bin = env.storage.resolve_compute_binary(state).await?;
168168
let aot = AotCmd::new(compute_bin, env.network);
169-
let auth_str = aot
169+
let mut auth_str = aot
170170
.authorize_program(
171171
&resolved_pk,
172172
resolved_fee_pk.as_ref(),
@@ -181,9 +181,20 @@ pub async fn execute_inner(
181181
)
182182
.await?;
183183

184+
// Truncate the output to the first {
185+
// because Aleo decided to print execute
186+
// status to stdout...
187+
if let Some(index) = auth_str.find("{") {
188+
auth_str = auth_str.split_off(index);
189+
}
190+
184191
// parse the json and bundle it up
185-
let authorization: Authorization =
186-
serde_json::from_str(&auth_str).map_err(AuthorizeError::Json)?;
192+
let authorization: Authorization = serde_json::from_str(&auth_str)
193+
.inspect_err(|e| {
194+
tracing::error!("failed to parse authorization json: {e}");
195+
tracing::error!("authorization json: {auth_str}");
196+
})
197+
.map_err(AuthorizeError::Json)?;
187198

188199
// proxy it to a listen cannon
189200
let tx_id = cannon.proxy_auth(authorization).await?;

0 commit comments

Comments
 (0)