cargo fmt

This commit is contained in:
lunar-mining
2022-11-05 12:51:16 +01:00
parent 623bf9a295
commit bdd0dd3362
9 changed files with 17 additions and 30 deletions

View File

@@ -16,7 +16,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use std::{any::{Any, TypeId}, time::Instant};
use std::{
any::{Any, TypeId},
time::Instant,
};
use incrementalmerkletree::Tree;
use log::debug;
@@ -1113,7 +1116,7 @@ async fn main() -> Result<()> {
dao_serial,
*dao::exec::FUNC_ID,
dao_bulla.0,
dao_coin_blind
dao_coin_blind,
]));
debug!("coin_1: {:?}", coin_1);
@@ -1130,13 +1133,9 @@ async fn main() -> Result<()> {
debug!("money::transfer() coin 1 = {:?}", money_transfer_coin_1);
let dao_exec_call_data = tx.func_calls[1].call_data.as_any();
let dao_exec_call_data =
dao_exec_call_data.downcast_ref::<dao::exec::validate::CallData>();
let dao_exec_call_data = dao_exec_call_data.downcast_ref::<dao::exec::validate::CallData>();
let dao_exec_call_data = dao_exec_call_data.unwrap();
assert_eq!(
dao_exec_call_data.type_id(),
TypeId::of::<dao::exec::validate::CallData>()
);
assert_eq!(dao_exec_call_data.type_id(), TypeId::of::<dao::exec::validate::CallData>());
let dao_exec_coin_1 = &dao_exec_call_data.coin_1;
debug!("dao::exec() coin 1 = {:?}", dao_exec_coin_1);

View File

@@ -96,7 +96,7 @@ impl Clock {
async fn ticking(&self) -> bool {
let (abs, rel, _) = self.tick_time().await;
debug!("abs time to genesis ticks: {}, rel ticks: {}", abs, rel);
rel < (self.tick_len)*2 / 3
rel < (self.tick_len) * 2 / 3
}
pub async fn sync(&mut self) -> Result<()> {

View File

@@ -283,7 +283,6 @@ fn create_leadcoin(
};
*/
let coin_nonce2_msg = [c_seed, c_root_sk.inner(), one.clone(), one.clone()];
let c_seed2: pallas::Base =
poseidon::Hash::<_, poseidon::P128Pow5T3, poseidon::ConstantLength<4>, 3, 2>::init()
@@ -333,11 +332,13 @@ fn create_coins_election_seeds(
// mu_rho
let nonce_mu_msg = [election_seed_nonce, eta, slot];
let nonce_mu: pallas::Base =
poseidon::Hash::<_, poseidon::P128Pow5T3, poseidon::ConstantLength<3>, 3, 2>::init().hash(nonce_mu_msg);
poseidon::Hash::<_, poseidon::P128Pow5T3, poseidon::ConstantLength<3>, 3, 2>::init()
.hash(nonce_mu_msg);
// mu_y
let lead_mu_msg = [election_seed_lead, eta, slot];
let lead_mu: pallas::Base =
poseidon::Hash::<_, poseidon::P128Pow5T3, poseidon::ConstantLength<3>, 3, 2>::init().hash(lead_mu_msg);
poseidon::Hash::<_, poseidon::P128Pow5T3, poseidon::ConstantLength<3>, 3, 2>::init()
.hash(lead_mu_msg);
(lead_mu, nonce_mu)
}

View File

@@ -73,14 +73,10 @@ impl LeadCoin {
let po_y_y = *po_y_pt.to_affine().coordinates().unwrap().y();
let y_coord_arr = [po_y_x, po_y_y];
let po_y: pallas::Base =
poseidon::Hash::<_, poseidon::P128Pow5T3, poseidon::ConstantLength<2>, 3, 2>::init().hash(y_coord_arr);
poseidon::Hash::<_, poseidon::P128Pow5T3, poseidon::ConstantLength<2>, 3, 2>::init()
.hash(y_coord_arr);
let public_inputs: [pallas::Base; LEAD_PUBLIC_INPUT_LEN] =
[
po_nonce,
*po_pk.x(),
*po_pk.y(),
po_y
];
[po_nonce, *po_pk.x(), *po_pk.y(), po_y];
public_inputs
}

View File

@@ -63,4 +63,3 @@ pub(crate) fn set_return_data(ctx: FunctionEnvMut<Env>, ptr: WasmPtr<u8>, len: u
_ => -1,
}
}

View File

@@ -39,4 +39,3 @@ pub mod tx;
/// Utilities
pub mod util;

View File

@@ -10,4 +10,3 @@ pub struct FuncCall {
pub func_id: FuncId,
pub call_data: Vec<u8>,
}

View File

@@ -19,4 +19,3 @@ pub fn set_return_data(data: &[u8]) -> Result<(), ContractError> {
extern "C" {
fn set_return_data_(ptr: *const u8, len: u32) -> i32;
}

View File

@@ -685,19 +685,14 @@ impl Circuit<pallas::Base> for LeadContract {
layouter.assign_region(
|| "coin1_cm_root equality",
|mut region| {
region.constrain_equal(coin1_cm_root.cell(), coin1_commit_root.cell())
},
|mut region| region.constrain_equal(coin1_cm_root.cell(), coin1_commit_root.cell()),
)?;
layouter.assign_region(
|| "sn_commit equality",
|mut region| {
region.constrain_equal(sn_commit.cell(), coin1_serial.cell())
},
|mut region| region.constrain_equal(sn_commit.cell(), coin1_serial.cell()),
)?;
// Constrain equality between witnessed and derived commitment
coin2_commitment
.constrain_equal(layouter.namespace(|| "coin2_commit equality"), &coin2_commit)?;