chore: fix dprint config and run fmt

This commit is contained in:
Byron Hambly 2023-03-15 14:12:28 +02:00
parent 31914bc1ed
commit 00cfce57c7
No known key found for this signature in database
GPG Key ID: DE8F6EA20A661697
11 changed files with 136 additions and 100 deletions

View File

@ -15,6 +15,11 @@ jobs:
- name: Checkout sources - name: Checkout sources
uses: actions/checkout@v3.3.0 uses: actions/checkout@v3.3.0
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.63
components: clippy,rustfmt
- uses: Swatinem/rust-cache@v2.2.1 - uses: Swatinem/rust-cache@v2.2.1
- name: Check formatting - name: Check formatting

View File

@ -3,22 +3,16 @@
"projectType": "openSource", "projectType": "openSource",
"incremental": true, "incremental": true,
"markdown": {}, "markdown": {},
"rustfmt": { "exec": {
"edition": 2021, "associations": "**/*.{rs}",
"condense_wildcard_suffixes": true, "rustfmt": "rustfmt --edition 2021",
"format_macro_matchers": true, "rustfmt.associations": "**/*.rs"
"imports_granularity": "Module",
"use_field_init_shorthand": true,
"format_code_in_doc_comments": true,
"normalize_comments": true,
"wrap_comments": true,
"overflow_delimited_expr": true
}, },
"includes": ["**/*.{md}", "**/*.{toml}", "**/*.{rs}"], "includes": ["**/*.{md}", "**/*.{toml}", "**/*.{rs}"],
"excludes": ["target/"], "excludes": ["target/"],
"plugins": [ "plugins": [
"https://plugins.dprint.dev/markdown-0.13.1.wasm", "https://plugins.dprint.dev/markdown-0.13.1.wasm",
"https://github.com/thomaseizinger/dprint-plugin-cargo-toml/releases/download/0.1.0/cargo-toml-0.1.0.wasm", "https://github.com/thomaseizinger/dprint-plugin-cargo-toml/releases/download/0.1.0/cargo-toml-0.1.0.wasm",
"https://plugins.dprint.dev/rustfmt-0.6.1.exe-plugin@99b89a0599fd3a63e597e03436862157901f3facae2f0c2fbd0b9f656cdbc2a5" "https://plugins.dprint.dev/exec-0.3.5.json@d687dda57be0fe9a0088ccdaefa5147649ff24127d8b3ea227536c68ee7abeab"
] ]
} }

View File

@ -47,9 +47,10 @@ 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.get_o_indexes_bin_url.clone(), GetOIndexesPayload { self.binary_request(
txid, self.get_o_indexes_bin_url.clone(),
}) GetOIndexesPayload { txid },
)
.await .await
} }

View File

@ -210,14 +210,20 @@ impl TxCancel {
}; };
// The order in which these are inserted doesn't matter // The order in which these are inserted doesn't matter
satisfier.insert(A, ::bitcoin::EcdsaSig { satisfier.insert(
sig: sig_a.into(), A,
hash_ty: EcdsaSighashType::All, ::bitcoin::EcdsaSig {
}); sig: sig_a.into(),
satisfier.insert(B, ::bitcoin::EcdsaSig { hash_ty: EcdsaSighashType::All,
sig: sig_b.into(), },
hash_ty: EcdsaSighashType::All, );
}); satisfier.insert(
B,
::bitcoin::EcdsaSig {
sig: sig_b.into(),
hash_ty: EcdsaSighashType::All,
},
);
satisfier satisfier
}; };

View File

@ -65,14 +65,20 @@ impl TxPunish {
let B = B.try_into()?; let B = B.try_into()?;
// The order in which these are inserted doesn't matter // The order in which these are inserted doesn't matter
satisfier.insert(A, ::bitcoin::EcdsaSig { satisfier.insert(
sig: sig_a.into(), A,
hash_ty: EcdsaSighashType::All, ::bitcoin::EcdsaSig {
}); sig: sig_a.into(),
satisfier.insert(B, ::bitcoin::EcdsaSig { hash_ty: EcdsaSighashType::All,
sig: sig_b.into(), },
hash_ty: EcdsaSighashType::All, );
}); satisfier.insert(
B,
::bitcoin::EcdsaSig {
sig: sig_b.into(),
hash_ty: EcdsaSighashType::All,
},
);
satisfier satisfier
}; };

View File

@ -87,14 +87,20 @@ impl TxRedeem {
}; };
// The order in which these are inserted doesn't matter // The order in which these are inserted doesn't matter
satisfier.insert(A, ::bitcoin::EcdsaSig { satisfier.insert(
sig: sig_a.into(), A,
hash_ty: EcdsaSighashType::All, ::bitcoin::EcdsaSig {
}); sig: sig_a.into(),
satisfier.insert(B, ::bitcoin::EcdsaSig { hash_ty: EcdsaSighashType::All,
sig: sig_b.into(), },
hash_ty: EcdsaSighashType::All, );
}); satisfier.insert(
B,
::bitcoin::EcdsaSig {
sig: sig_b.into(),
hash_ty: EcdsaSighashType::All,
},
);
satisfier satisfier
}; };

View File

@ -70,14 +70,20 @@ impl TxRefund {
}; };
// The order in which these are inserted doesn't matter // The order in which these are inserted doesn't matter
satisfier.insert(A, ::bitcoin::EcdsaSig { satisfier.insert(
sig: sig_a.into(), A,
hash_ty: EcdsaSighashType::All, ::bitcoin::EcdsaSig {
}); sig: sig_a.into(),
satisfier.insert(B, ::bitcoin::EcdsaSig { hash_ty: EcdsaSighashType::All,
sig: sig_b.into(), },
hash_ty: EcdsaSighashType::All, );
}); satisfier.insert(
B,
::bitcoin::EcdsaSig {
sig: sig_b.into(),
hash_ty: EcdsaSighashType::All,
},
);
satisfier satisfier
}; };

View File

@ -350,23 +350,26 @@ mod tests {
list.sort(); list.sort();
assert_eq!(list, vec![ assert_eq!(
Seller { list,
multiaddr: "/ip4/127.0.0.1/tcp/5678".parse().unwrap(), vec![
status: Status::Online(BidQuote { Seller {
price: Default::default(), multiaddr: "/ip4/127.0.0.1/tcp/5678".parse().unwrap(),
min_quantity: Default::default(), status: Status::Online(BidQuote {
max_quantity: Default::default(), price: Default::default(),
}) min_quantity: Default::default(),
}, max_quantity: Default::default(),
Seller { })
multiaddr: Multiaddr::empty(), },
status: Status::Unreachable Seller {
}, multiaddr: Multiaddr::empty(),
Seller { status: Status::Unreachable
multiaddr: "/ip4/127.0.0.1/tcp/1234".parse().unwrap(), },
status: Status::Unreachable Seller {
}, multiaddr: "/ip4/127.0.0.1/tcp/1234".parse().unwrap(),
]) status: Status::Unreachable
},
]
)
} }
} }

View File

@ -155,13 +155,16 @@ impl ProtocolsHandler for Handler {
let env_config = self.env_config; let env_config = self.env_config;
let protocol = tokio::time::timeout(self.timeout, async move { let protocol = tokio::time::timeout(self.timeout, async move {
write_cbor_message(&mut substream, SpotPriceRequest { write_cbor_message(
btc: info.btc, &mut substream,
blockchain_network: BlockchainNetwork { SpotPriceRequest {
bitcoin: env_config.bitcoin_network, btc: info.btc,
monero: env_config.monero_network, blockchain_network: BlockchainNetwork {
bitcoin: env_config.bitcoin_network,
monero: env_config.monero_network,
},
}, },
}) )
.await?; .await?;
let xmr = Result::from(read_cbor_message::<SpotPriceResponse>(&mut substream).await?)?; let xmr = Result::from(read_cbor_message::<SpotPriceResponse>(&mut substream).await?)?;

View File

@ -184,29 +184,32 @@ impl State0 {
let v = self.v_a + msg.v_b; let v = self.v_a + msg.v_b;
Ok((msg.swap_id, State1 { Ok((
a: self.a, msg.swap_id,
B: msg.B, State1 {
s_a: self.s_a, a: self.a,
S_a_monero: self.S_a_monero, B: msg.B,
S_a_bitcoin: self.S_a_bitcoin, s_a: self.s_a,
S_b_monero: msg.S_b_monero, S_a_monero: self.S_a_monero,
S_b_bitcoin: msg.S_b_bitcoin, S_a_bitcoin: self.S_a_bitcoin,
v, S_b_monero: msg.S_b_monero,
v_a: self.v_a, S_b_bitcoin: msg.S_b_bitcoin,
dleq_proof_s_a: self.dleq_proof_s_a, v,
btc: self.btc, v_a: self.v_a,
xmr: self.xmr, dleq_proof_s_a: self.dleq_proof_s_a,
cancel_timelock: self.cancel_timelock, btc: self.btc,
punish_timelock: self.punish_timelock, xmr: self.xmr,
refund_address: msg.refund_address, cancel_timelock: self.cancel_timelock,
redeem_address: self.redeem_address, punish_timelock: self.punish_timelock,
punish_address: self.punish_address, refund_address: msg.refund_address,
tx_redeem_fee: self.tx_redeem_fee, redeem_address: self.redeem_address,
tx_punish_fee: self.tx_punish_fee, punish_address: self.punish_address,
tx_refund_fee: msg.tx_refund_fee, tx_redeem_fee: self.tx_redeem_fee,
tx_cancel_fee: msg.tx_cancel_fee, tx_punish_fee: self.tx_punish_fee,
})) tx_refund_fee: msg.tx_refund_fee,
tx_cancel_fee: msg.tx_cancel_fee,
},
))
} }
} }

View File

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