Update Rust toolchain to get cargo fmt back

This commit is contained in:
Thomas Eizinger 2021-05-19 13:54:55 +10:00
parent 07dd12abf6
commit 642f1d8318
No known key found for this signature in database
GPG Key ID: 651AC83A6C6C8B96
6 changed files with 63 additions and 61 deletions

View File

@ -71,10 +71,9 @@ impl Client {
} }
pub async fn get_o_indexes(&self, txid: Hash) -> Result<GetOIndexesResponse> { pub async fn get_o_indexes(&self, txid: Hash) -> Result<GetOIndexesResponse> {
self.binary_request( self.binary_request(self.get_o_indexes_bin_url.clone(), GetOIndexesPayload {
self.get_o_indexes_bin_url.clone(), txid,
GetOIndexesPayload { txid }, })
)
.await .await
} }

View File

@ -63,7 +63,8 @@ impl ConfidentialTransactionBuilder {
input_commitment: input_to_spend.commitment().unwrap(), // TODO: Error handling input_commitment: input_to_spend.commitment().unwrap(), // TODO: Error handling
spend_amount: input_to_spend.amount().unwrap(), // TODO: Error handling, spend_amount: input_to_spend.amount().unwrap(), // TODO: Error handling,
global_output_index, global_output_index,
real_commitment_blinder: input_to_spend.blinding_factor().unwrap(), // TODO: Error handling real_commitment_blinder: input_to_spend.blinding_factor().unwrap(), /* TODO: Error
* handling */
} }
} }
@ -312,7 +313,8 @@ impl CalculateKeyOffsetBoundaries for monerod::Client {
.into_iter() .into_iter()
.max() .max()
.context("Expected at least one output index")?; .context("Expected at least one output index")?;
// let oldest_index = last_index - (last_index / 100) * 40; // oldest index must be within last 40% TODO: CONFIRM THIS // let oldest_index = last_index - (last_index / 100) * 40; // oldest index must
// be within last 40% TODO: CONFIRM THIS
Ok((VarInt(0), VarInt(last_index))) Ok((VarInt(0), VarInt(last_index)))
} }
@ -340,7 +342,8 @@ impl FetchDecoyInputs for monerod::Client {
.map(|(out_key, index)| { .map(|(out_key, index)| {
DecoyInput { DecoyInput {
global_output_index: *index, global_output_index: *index,
key: out_key.key.point.decompress().unwrap(), // TODO: should decompress on deserialization key: out_key.key.point.decompress().unwrap(), /* TODO: should decompress on
* deserialization */
commitment: CompressedEdwardsY(out_key.mask.key).decompress().unwrap(), commitment: CompressedEdwardsY(out_key.mask.key).decompress().unwrap(),
} }
}) })
@ -378,9 +381,7 @@ mod tests {
let relative_offsets = to_relative_offsets(&key_offsets); let relative_offsets = to_relative_offsets(&key_offsets);
assert_eq!( assert_eq!(&relative_offsets, &[
&relative_offsets,
&[
VarInt(78), VarInt(78),
VarInt(3), VarInt(3),
VarInt(10), VarInt(10),
@ -392,8 +393,7 @@ mod tests {
VarInt(1), VarInt(1),
VarInt(1), VarInt(1),
VarInt(3), VarInt(3),
] ])
)
} }
#[tokio::test] #[tokio::test]

View File

@ -9,7 +9,10 @@ pub struct EmptyTransaction {}
impl EmptyTransaction { impl EmptyTransaction {
// TODO: Need to validate that given index matches with tx pubkey and commitment // TODO: Need to validate that given index matches with tx pubkey and commitment
pub fn spend_from(input: OwnedTxOut<'_>, global_output_index: u64) -> Result<InputAdded, MissingOpening> { pub fn spend_from(
input: OwnedTxOut<'_>,
global_output_index: u64,
) -> Result<InputAdded, MissingOpening> {
todo!() todo!()
} }
} }
@ -19,7 +22,10 @@ pub struct MissingOpening; // The opening was missing from the TX
pub struct InputAdded {} pub struct InputAdded {}
impl InputAdded { impl InputAdded {
pub fn with_decoys(self, decoys: [DecoyInput; 10]) -> Result<DecoyOffsetsAdded, DuplicateIndex> { pub fn with_decoys(
self,
decoys: [DecoyInput; 10],
) -> Result<DecoyOffsetsAdded, DuplicateIndex> {
todo!() todo!()
} }
@ -83,7 +89,9 @@ impl OutputsBlinded {
/// Signs the transaction. /// Signs the transaction.
/// ///
/// This function calls the CLSAG sign algorithm with a set of parameters that will work. This however, assumes the caller does not want to have control over these parameters. /// This function calls the CLSAG sign algorithm with a set of parameters
/// that will work. This however, assumes the caller does not want to have
/// control over these parameters.
pub fn sign(self, keys: KeyPair, rng: &mut (impl RngCore + CryptoRng)) -> Transaction { pub fn sign(self, keys: KeyPair, rng: &mut (impl RngCore + CryptoRng)) -> Transaction {
// TODO: Do we want a sign_recommended API in monero::clsag? // TODO: Do we want a sign_recommended API in monero::clsag?
@ -92,8 +100,9 @@ impl OutputsBlinded {
/// Use the given signature for the internal transaction. /// Use the given signature for the internal transaction.
/// ///
/// This function is useful if the caller wants to have full control over certain parameters such as responses, L, R or I. /// This function is useful if the caller wants to have full control over
/// The provided signature will be validated to make sure it is correct. /// certain parameters such as responses, L, R or I. The provided
/// signature will be validated to make sure it is correct.
pub fn with_signature(self, sig: Clsag) -> Result<Transaction, InvalidSignature> { pub fn with_signature(self, sig: Clsag) -> Result<Transaction, InvalidSignature> {
todo!() todo!()
} }

View File

@ -1,4 +1,4 @@
[toolchain] [toolchain]
channel = "nightly-2021-05-04" channel = "nightly-2021-05-18"
components = ["clippy"] components = ["clippy"]
targets = ["armv7-unknown-linux-gnueabihf"] targets = ["armv7-unknown-linux-gnueabihf"]

View File

@ -165,9 +165,7 @@ impl State0 {
let v = self.v_a + msg.v_b; let v = self.v_a + msg.v_b;
Ok(( Ok((msg.swap_id, State1 {
msg.swap_id,
State1 {
a: self.a, a: self.a,
B: msg.B, B: msg.B,
s_a: self.s_a, s_a: self.s_a,
@ -185,8 +183,7 @@ impl State0 {
refund_address: msg.refund_address, refund_address: msg.refund_address,
redeem_address: self.redeem_address, redeem_address: self.redeem_address,
punish_address: self.punish_address, punish_address: self.punish_address,
}, }))
))
} }
} }

View File

@ -155,16 +155,13 @@ async fn init_containers(cli: &Cli) -> (Monero, Containers<'_>) {
.await .await
.unwrap(); .unwrap();
( (monero, Containers {
monero,
Containers {
bitcoind_url, bitcoind_url,
bitcoind, bitcoind,
monerod_container, monerod_container,
monero_wallet_rpc_containers, monero_wallet_rpc_containers,
electrs, electrs,
}, })
)
} }
async fn init_bitcoind_container( async fn init_bitcoind_container(