Skip to content

Commit

Permalink
rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Pauan committed Oct 25, 2023
1 parent 5a34b8f commit d4491d0
Show file tree
Hide file tree
Showing 7 changed files with 122 additions and 201 deletions.
27 changes: 12 additions & 15 deletions wasm/src/programs/manager/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@

use super::*;

use crate::{
log,
PrivateKey,
RecordPlaintext,
Transaction,
};
use crate::{log, PrivateKey, RecordPlaintext, Transaction};

use js_sys::Object;

Expand Down Expand Up @@ -66,15 +61,17 @@ impl ProgramManager {

deploy.check_fee(fee_microcredits)?;

let (state, fee) = state.execute_fee(
deploy.execution_id()?,
url,
private_key.clone(),
fee_microcredits,
fee_record,
fee_proving_key,
fee_verifying_key,
).await?;
let (state, fee) = state
.execute_fee(
deploy.execution_id()?,
url,
private_key.clone(),
fee_microcredits,
fee_record,
fee_proving_key,
fee_verifying_key,
)
.await?;

state.deploy_transaction(deploy, fee).await
}
Expand Down
48 changes: 17 additions & 31 deletions wasm/src/programs/manager/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,12 @@ impl ProgramManager {

let state = ProgramState::new(program, imports).await?;

let (state, execute) = state.execute_program(
function,
inputs,
private_key.clone(),
proving_key,
verifying_key,
).await?;
let (state, execute) =
state.execute_program(function, inputs, private_key.clone(), proving_key, verifying_key).await?;

if prove_execution {
let (state, execution) = state.prove_execution(execute, "https://vm.aleo.org/api".to_string()).await?;
state.prove_response(execution, cache)

} else {
state.execute_response(execute, cache)
}
Expand Down Expand Up @@ -129,25 +123,22 @@ impl ProgramManager {

let state = ProgramState::new(program, imports).await?;

let (state, execute) = state.execute_program(
function,
inputs,
private_key.clone(),
proving_key,
verifying_key,
).await?;
let (state, execute) =
state.execute_program(function, inputs, private_key.clone(), proving_key, verifying_key).await?;

let (state, execution) = state.prove_execution(execute, url.clone()).await?;

let (_state, fee) = state.execute_fee(
execution.execution_id()?,
url,
private_key.clone(),
fee_microcredits,
fee_record,
fee_proving_key,
fee_verifying_key,
).await?;
let (_state, fee) = state
.execute_fee(
execution.execution_id()?,
url,
private_key.clone(),
fee_microcredits,
fee_record,
fee_proving_key,
fee_verifying_key,
)
.await?;

execution.into_transaction(Some(fee)).await
}
Expand Down Expand Up @@ -190,13 +181,8 @@ impl ProgramManager {

let state = ProgramState::new(program, imports).await?;

let (state, execute) = state.execute_program(
function,
inputs,
private_key.clone(),
proving_key,
verifying_key,
).await?;
let (state, execute) =
state.execute_program(function, inputs, private_key.clone(), proving_key, verifying_key).await?;

let (state, execution) = state.prove_execution(execute, url).await?;

Expand Down
50 changes: 18 additions & 32 deletions wasm/src/programs/manager/join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,7 @@

use super::*;

use crate::{
log,
types::{ProgramNative},
PrivateKey,
RecordPlaintext,
Transaction,
};
use crate::{log, types::ProgramNative, PrivateKey, RecordPlaintext, Transaction};

#[wasm_bindgen]
impl ProgramManager {
Expand Down Expand Up @@ -61,38 +55,30 @@ impl ProgramManager {

let state = ProgramState::new(program, None).await?;

let (state, fee_record, join_proving_key, join_verifying_key) = state.insert_proving_keys(
fee_record,
join_proving_key,
join_verifying_key,
).await?;
let (state, fee_record, join_proving_key, join_verifying_key) =
state.insert_proving_keys(fee_record, join_proving_key, join_verifying_key).await?;

let inputs = vec![
record_1.to_string(),
record_2.to_string(),
];
let inputs = vec![record_1.to_string(), record_2.to_string()];

let (state, mut execute) = state.execute_program(
"join".to_string(),
inputs,
private_key.clone(),
join_proving_key,
join_verifying_key,
).await?;
let (state, mut execute) = state
.execute_program("join".to_string(), inputs, private_key.clone(), join_proving_key, join_verifying_key)
.await?;

execute.set_locator("credits.aleo/join".to_string());

let (state, execution) = state.prove_execution(execute, url.clone()).await?;

let (_state, fee) = state.execute_fee(
execution.execution_id()?,
url,
private_key.clone(),
fee_microcredits,
fee_record,
fee_proving_key,
fee_verifying_key,
).await?;
let (_state, fee) = state
.execute_fee(
execution.execution_id()?,
url,
private_key.clone(),
fee_microcredits,
fee_record,
fee_proving_key,
fee_verifying_key,
)
.await?;

execution.into_transaction(Some(fee)).await
}
Expand Down
Loading

0 comments on commit d4491d0

Please sign in to comment.