From 7602d910d41595b37a99a50632bfd421a43cd252 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Sun, 28 Feb 2021 07:22:58 +0100 Subject: [PATCH] Disable cache in CI builds. (#772) * Disable cache. * Fix tests. * Fix clippy? * cargo fmt --all --- bridges/modules/finality-verifier/src/lib.rs | 6 +- bridges/relays/ethereum/src/main.rs | 70 ++++++++++---------- 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/bridges/modules/finality-verifier/src/lib.rs b/bridges/modules/finality-verifier/src/lib.rs index 8f3505252e..3db6cb7bf7 100644 --- a/bridges/modules/finality-verifier/src/lib.rs +++ b/bridges/modules/finality-verifier/src/lib.rs @@ -369,9 +369,9 @@ mod tests { } // Can still submit `MaxRequests` requests afterwards - assert_ok!(submit_finality_proof()); - assert_ok!(submit_finality_proof()); - assert_err!(submit_finality_proof(), >::TooManyRequests); + assert_ok!(submit_finality_proof(1, 2)); + assert_ok!(submit_finality_proof(3, 4)); + assert_err!(submit_finality_proof(5, 6), >::TooManyRequests); }) } diff --git a/bridges/relays/ethereum/src/main.rs b/bridges/relays/ethereum/src/main.rs index 3ff6d5499a..c0c36cc130 100644 --- a/bridges/relays/ethereum/src/main.rs +++ b/bridges/relays/ethereum/src/main.rs @@ -243,16 +243,13 @@ fn ethereum_deploy_contract_params(matches: &clap::ArgMatches) -> Result Some( - sub_initial_authorities_set_id - .parse() - .map_err(|e| format!("Failed to parse sub-authorities-set-id: {}", e))?, - ), - None => None, - }; + let sub_initial_authorities_set_id = matches + .value_of("sub-authorities-set-id") + .map(|set| { + set.parse() + .map_err(|e| format!("Failed to parse sub-authorities-set-id: {}", e)) + }) + .transpose()?; let sub_initial_authorities_set = parse_hex_argument(matches, "sub-authorities-set")?; let sub_initial_header = parse_hex_argument(matches, "sub-initial-header")?; @@ -272,24 +269,26 @@ fn ethereum_deploy_contract_params(matches: &clap::ArgMatches) -> Result Result { - #[allow(clippy::manual_map)] - let eth_nonce = if let Some(eth_nonce) = matches.value_of("eth-nonce") { - Some( + let eth_nonce = matches + .value_of("eth-nonce") + .map(|eth_nonce| { relay_ethereum_client::types::U256::from_dec_str(ð_nonce) - .map_err(|e| format!("Failed to parse eth-nonce: {}", e))?, - ) - } else { - None - }; + .map_err(|e| format!("Failed to parse eth-nonce: {}", e)) + }) + .transpose()?; - let eth_amount = if let Some(eth_amount) = matches.value_of("eth-amount") { - eth_amount - .parse() - .map_err(|e| format!("Failed to parse eth-amount: {}", e))? - } else { - // This is in Wei, represents 1 ETH - 1_000_000_000_000_000_000_u64.into() - }; + let eth_amount = matches + .value_of("eth-amount") + .map(|eth_amount| { + eth_amount + .parse() + .map_err(|e| format!("Failed to parse eth-amount: {}", e)) + }) + .transpose()? + .unwrap_or_else(|| { + // This is in Wei, represents 1 ETH + 1_000_000_000_000_000_000_u64.into() + }); // This is the well-known Substrate account of Ferdie let default_recepient = hex!("1cbd2d43530a44705ad088af313e18f80b53ef16b36177cd4b77b846f2a5f07c"); @@ -332,15 +331,16 @@ fn ethereum_exchange_params(matches: &clap::ArgMatches) -> Result ethereum_exchange::ExchangeRelayMode::Auto(match matches.value_of("eth-start-with-block") { - Some(eth_start_with_block) => Some( - eth_start_with_block - .parse() - .map_err(|e| format!("Failed to parse eth-start-with-block: {}", e))?, - ), - None => None, - }), + None => ethereum_exchange::ExchangeRelayMode::Auto( + matches + .value_of("eth-start-with-block") + .map(|eth_start_with_block| { + eth_start_with_block + .parse() + .map_err(|e| format!("Failed to parse eth-start-with-block: {}", e)) + }) + .transpose()?, + ), }; let params = EthereumExchangeParams {