diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index e34693b99155c..ddf12570bc015 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -22,14 +22,13 @@ jobs: toolchain: - stable #- beta - - nightly-2020-10-04 + - nightly runs-on: self-hosted container: image: paritytech/ci-linux:production volumes: - /cache:/cache env: - WASM_BUILD_TOOLCHAIN: nightly-2020-10-04 RUST_BACKTRACE: full SCCACHE_REDIS: redis://172.17.0.1/0 SCCACHE_IDLE_TIMEOUT: 0 @@ -46,10 +45,6 @@ jobs: with: fetch-depth: 5 submodules: recursive - - name: Install Toolchain - run: rustup toolchain add nightly-2020-10-04 - - name: Add WASM Utilities - run: rustup target add wasm32-unknown-unknown --toolchain nightly-2020-10-04 - name: Configure CARGO_TARGET_DIR shell: bash run: ./scripts/ci-cache.sh @@ -82,11 +77,11 @@ jobs: ## Linting Stage - name: Add clippy - if: matrix.toolchain == 'nightly-2020-10-04' + if: matrix.toolchain == 'nightly' run: rustup component add clippy --toolchain ${{ matrix.toolchain }} - name: Clippy uses: actions-rs/cargo@master - if: matrix.toolchain == 'nightly-2020-10-04' + if: matrix.toolchain == 'nightly' with: command: clippy toolchain: ${{ matrix.toolchain }} diff --git a/Dockerfile b/Dockerfile index ccf7e95a8c57b..ea90e514122b4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,11 +19,11 @@ RUN update-ca-certificates && \ curl https://sh.rustup.rs -sSf | sh -s -- -y ENV PATH="/root/.cargo/bin:${PATH}" -ENV LAST_RUST_UPDATE 2020-10-15 +ENV LAST_RUST_UPDATE 2020-11-30 RUN rustup update stable && \ - rustup install nightly-2020-10-04 && \ - rustup target add wasm32-unknown-unknown --toolchain nightly-2020-10-04 + rustup install nightly && \ + rustup target add wasm32-unknown-unknown --toolchain nightly RUN rustc -vV && \ cargo -V && \ diff --git a/bin/millau/node/src/chain_spec.rs b/bin/millau/node/src/chain_spec.rs index f1b6323763c4f..8c7c40472751b 100644 --- a/bin/millau/node/src/chain_spec.rs +++ b/bin/millau/node/src/chain_spec.rs @@ -65,8 +65,8 @@ pub fn get_authority_keys_from_seed(s: &str) -> (AccountId, AuraId, GrandpaId) { impl Alternative { /// Get an actual chain config from one of the alternatives. - pub(crate) fn load(self) -> Result { - Ok(match self { + pub(crate) fn load(self) -> ChainSpec { + match self { Alternative::Development => ChainSpec::from_genesis( "Development", "dev", @@ -131,7 +131,7 @@ impl Alternative { None, None, ), - }) + } } } diff --git a/bin/millau/node/src/command.rs b/bin/millau/node/src/command.rs index 651080bbf200e..c007d5d848532 100644 --- a/bin/millau/node/src/command.rs +++ b/bin/millau/node/src/command.rs @@ -61,7 +61,7 @@ impl SubstrateCli for Cli { "local" => crate::chain_spec::Alternative::LocalTestnet, _ => return Err(format!("Unsupported chain specification: {}", id)), } - .load()?, + .load(), )) } } diff --git a/bin/rialto/node/src/chain_spec.rs b/bin/rialto/node/src/chain_spec.rs index ed226334e5302..939dcc5e3fe6b 100644 --- a/bin/rialto/node/src/chain_spec.rs +++ b/bin/rialto/node/src/chain_spec.rs @@ -65,8 +65,8 @@ pub fn get_authority_keys_from_seed(s: &str) -> (AccountId, AuraId, GrandpaId) { impl Alternative { /// Get an actual chain config from one of the alternatives. - pub(crate) fn load(self) -> Result { - Ok(match self { + pub(crate) fn load(self) -> ChainSpec { + match self { Alternative::Development => ChainSpec::from_genesis( "Development", "dev", @@ -131,7 +131,7 @@ impl Alternative { None, None, ), - }) + } } } @@ -156,8 +156,8 @@ fn testnet_genesis( pallet_aura: Some(AuraConfig { authorities: Vec::new(), }), - pallet_bridge_eth_poa_Instance1: load_rialto_poa_bridge_config(), - pallet_bridge_eth_poa_Instance2: load_kovan_bridge_config(), + pallet_bridge_eth_poa_Instance1: Some(load_rialto_poa_bridge_config()), + pallet_bridge_eth_poa_Instance2: Some(load_kovan_bridge_config()), pallet_grandpa: Some(GrandpaConfig { authorities: Vec::new(), }), @@ -176,18 +176,18 @@ fn testnet_genesis( } } -fn load_rialto_poa_bridge_config() -> Option { - Some(BridgeRialtoPoAConfig { +fn load_rialto_poa_bridge_config() -> BridgeRialtoPoAConfig { + BridgeRialtoPoAConfig { initial_header: rialto_runtime::rialto_poa::genesis_header(), initial_difficulty: 0.into(), initial_validators: rialto_runtime::rialto_poa::genesis_validators(), - }) + } } -fn load_kovan_bridge_config() -> Option { - Some(BridgeKovanConfig { +fn load_kovan_bridge_config() -> BridgeKovanConfig { + BridgeKovanConfig { initial_header: rialto_runtime::kovan::genesis_header(), initial_difficulty: 0.into(), initial_validators: rialto_runtime::kovan::genesis_validators(), - }) + } } diff --git a/bin/rialto/node/src/command.rs b/bin/rialto/node/src/command.rs index fe423f8803d97..52ff1d5a254d3 100644 --- a/bin/rialto/node/src/command.rs +++ b/bin/rialto/node/src/command.rs @@ -61,7 +61,7 @@ impl SubstrateCli for Cli { "local" => crate::chain_spec::Alternative::LocalTestnet, _ => return Err(format!("Unsupported chain specification: {}", id)), } - .load()?, + .load(), )) } } diff --git a/deployments/Bridge.Dockerfile b/deployments/Bridge.Dockerfile index eab7d4fc9cf48..47e5bd8aa1e1c 100644 --- a/deployments/Bridge.Dockerfile +++ b/deployments/Bridge.Dockerfile @@ -19,11 +19,11 @@ RUN update-ca-certificates && \ curl https://sh.rustup.rs -sSf | sh -s -- -y ENV PATH="/root/.cargo/bin:${PATH}" -ENV LAST_RUST_UPDATE 2020-10-15 +ENV LAST_RUST_UPDATE 2020-11-30 RUN rustup update stable && \ - rustup install nightly-2020-10-04 && \ - rustup target add wasm32-unknown-unknown --toolchain nightly-2020-10-04 + rustup install nightly && \ + rustup target add wasm32-unknown-unknown --toolchain nightly RUN rustc -vV && \ cargo -V && \ diff --git a/modules/ethereum/src/lib.rs b/modules/ethereum/src/lib.rs index ace34f38edb81..75062f763952a 100644 --- a/modules/ethereum/src/lib.rs +++ b/modules/ethereum/src/lib.rs @@ -1028,7 +1028,7 @@ fn pool_configuration() -> PoolConfiguration { } /// Return iterator of given header ancestors. -fn ancestry<'a, S: Storage>(storage: &'a S, mut parent_hash: H256) -> impl Iterator + 'a { +fn ancestry(storage: &'_ S, mut parent_hash: H256) -> impl Iterator + '_ { sp_std::iter::from_fn(move || { let (header, _) = storage.header(&parent_hash)?; if header.number == 0 { @@ -1069,30 +1069,33 @@ pub(crate) mod tests { } fn example_header_with_failed_receipt() -> AuraHeader { - let mut header = AuraHeader::default(); - header.number = 3; - header.transactions_root = compute_merkle_root(vec![example_tx()].into_iter()); - header.receipts_root = compute_merkle_root(vec![example_tx_receipt(false)].into_iter()); - header.parent_hash = example_header().compute_hash(); - header + AuraHeader { + number: 3, + transactions_root: compute_merkle_root(vec![example_tx()].into_iter()), + receipts_root: compute_merkle_root(vec![example_tx_receipt(false)].into_iter()), + parent_hash: example_header().compute_hash(), + ..Default::default() + } } fn example_header() -> AuraHeader { - let mut header = AuraHeader::default(); - header.number = 2; - header.transactions_root = compute_merkle_root(vec![example_tx()].into_iter()); - header.receipts_root = compute_merkle_root(vec![example_tx_receipt(true)].into_iter()); - header.parent_hash = example_header_parent().compute_hash(); - header + AuraHeader { + number: 2, + transactions_root: compute_merkle_root(vec![example_tx()].into_iter()), + receipts_root: compute_merkle_root(vec![example_tx_receipt(true)].into_iter()), + parent_hash: example_header_parent().compute_hash(), + ..Default::default() + } } fn example_header_parent() -> AuraHeader { - let mut header = AuraHeader::default(); - header.number = 1; - header.transactions_root = compute_merkle_root(vec![example_tx()].into_iter()); - header.receipts_root = compute_merkle_root(vec![example_tx_receipt(true)].into_iter()); - header.parent_hash = genesis().compute_hash(); - header + AuraHeader { + number: 1, + transactions_root: compute_merkle_root(vec![example_tx()].into_iter()), + receipts_root: compute_merkle_root(vec![example_tx_receipt(true)].into_iter()), + parent_hash: genesis().compute_hash(), + ..Default::default() + } } fn with_headers_to_prune(f: impl Fn(BridgeStorage) -> T) -> T { diff --git a/modules/ethereum/src/validators.rs b/modules/ethereum/src/validators.rs index dc09b48d55062..d4ddac66b7df0 100644 --- a/modules/ethereum/src/validators.rs +++ b/modules/ethereum/src/validators.rs @@ -325,8 +325,10 @@ pub(crate) mod tests { // when contract is active, but bloom has no required bits set let config = ValidatorsConfiguration::Single(ValidatorsSource::Contract(Default::default(), Vec::new())); let validators = Validators::new(&config); - let mut header = AuraHeader::default(); - header.number = u64::max_value(); + let mut header = AuraHeader { + number: u64::max_value(), + ..Default::default() + }; assert!(!validators.maybe_signals_validators_change(&header)); // when contract is active and bloom has required bits set @@ -347,10 +349,12 @@ pub(crate) mod tests { (200, ValidatorsSource::Contract([3; 20].into(), vec![[3; 20].into()])), ]); let validators = Validators::new(&config); - let mut header = AuraHeader::default(); + let mut header = AuraHeader { + number: 100, + ..Default::default() + }; // when we're at the block that switches to list source - header.number = 100; assert_eq!( validators.extract_validators_change(&header, None), Ok((None, Some(vec![[2; 20].into()]))), diff --git a/modules/substrate/src/lib.rs b/modules/substrate/src/lib.rs index 4e62841af7b56..eb77b5af750fb 100644 --- a/modules/substrate/src/lib.rs +++ b/modules/substrate/src/lib.rs @@ -459,6 +459,7 @@ pub trait BridgeStorage { /// Replace the current authority set with the next scheduled set. /// /// Returns an error if there is no scheduled authority set to enact. + #[allow(clippy::result_unit_err)] fn enact_authority_set(&mut self, signal_hash: ::Hash) -> Result<(), ()>; /// Get the next scheduled Grandpa authority set change. diff --git a/relays/headers-relay/src/sync_loop_tests.rs b/relays/headers-relay/src/sync_loop_tests.rs index f41d9708cd61c..27e5daa7da4f4 100644 --- a/relays/headers-relay/src/sync_loop_tests.rs +++ b/relays/headers-relay/src/sync_loop_tests.rs @@ -357,9 +357,10 @@ fn target_accept_all_headers(method: &TargetMethod, data: &mut TargetData, requi if let TargetMethod::SubmitHeaders(ref submitted) = method { assert_eq!(submitted.iter().all(|header| header.extra().is_some()), requires_extra,); - let mut submitted_headers = SubmittedHeaders::default(); - submitted_headers.submitted = submitted.iter().map(|header| header.id()).collect(); - data.submit_headers_result = Some(submitted_headers); + data.submit_headers_result = Some(SubmittedHeaders { + submitted: submitted.iter().map(|header| header.id()).collect(), + ..Default::default() + }); } } diff --git a/relays/utils/src/lib.rs b/relays/utils/src/lib.rs index e81660299becb..2968320ff5c87 100644 --- a/relays/utils/src/lib.rs +++ b/relays/utils/src/lib.rs @@ -147,11 +147,12 @@ impl ToString for StringifiedMaybeConnectionError { /// Exponential backoff for connection-unrelated errors retries. pub fn retry_backoff() -> ExponentialBackoff { - let mut backoff = ExponentialBackoff::default(); - // we do not want relayer to stop - backoff.max_elapsed_time = None; - backoff.max_interval = MAX_BACKOFF_INTERVAL; - backoff + ExponentialBackoff { + // we do not want relayer to stop + max_elapsed_time: None, + max_interval: MAX_BACKOFF_INTERVAL, + ..Default::default() + } } /// Compact format of IDs vector.