From adbf8fc62155dc3ff1de728fac2ba45bc2b65552 Mon Sep 17 00:00:00 2001 From: Nazar Mokrynskyi Date: Fri, 19 Jan 2024 16:12:21 +0200 Subject: [PATCH 1/3] Upgrade Rust to latest nightly --- Dockerfile-bootstrap-node | 2 +- Dockerfile-bootstrap-node.aarch64 | 2 +- Dockerfile-farmer | 2 +- Dockerfile-farmer.aarch64 | 2 +- Dockerfile-node | 2 +- Dockerfile-node.aarch64 | 2 +- Dockerfile-runtime | 2 +- crates/pallet-domains/src/staking.rs | 46 +++++++++++-------- crates/pallet-domains/src/tests.rs | 2 +- crates/pallet-rewards/src/lib.rs | 4 +- crates/pallet-transaction-fees/src/lib.rs | 7 +-- crates/sp-domains/src/merkle_tree.rs | 5 +- .../tests/integration/archiver.rs | 4 +- .../src/bin/subspace-farmer/commands/farm.rs | 6 +-- .../src/utils/unique_record_binary_heap.rs | 2 + .../src/chiapos/table.rs | 3 +- domains/client/eth-service/src/rpc.rs | 3 +- domains/client/eth-service/src/service.rs | 2 - domains/pallets/transporter/src/lib.rs | 6 +-- domains/service/src/lib.rs | 6 +++ orml/vesting/src/tests.rs | 6 +-- rust-toolchain.toml | 2 +- 22 files changed, 64 insertions(+), 54 deletions(-) diff --git a/Dockerfile-bootstrap-node b/Dockerfile-bootstrap-node index 85e5109e7f..b4b4460711 100644 --- a/Dockerfile-bootstrap-node +++ b/Dockerfile-bootstrap-node @@ -1,6 +1,6 @@ FROM ubuntu:20.04 -ARG RUSTC_VERSION=nightly-2023-10-16 +ARG RUSTC_VERSION=nightly-2024-01-19 ARG PROFILE=production ARG RUSTFLAGS # Workaround for https://github.com/rust-lang/cargo/issues/10583 diff --git a/Dockerfile-bootstrap-node.aarch64 b/Dockerfile-bootstrap-node.aarch64 index 6b0902da88..09a40ca763 100644 --- a/Dockerfile-bootstrap-node.aarch64 +++ b/Dockerfile-bootstrap-node.aarch64 @@ -1,6 +1,6 @@ FROM ubuntu:20.04 -ARG RUSTC_VERSION=nightly-2023-10-16 +ARG RUSTC_VERSION=nightly-2024-01-19 ARG PROFILE=production ARG RUSTFLAGS # Workaround for https://github.com/rust-lang/cargo/issues/10583 diff --git a/Dockerfile-farmer b/Dockerfile-farmer index dd32f45ab0..00f036f8b3 100644 --- a/Dockerfile-farmer +++ b/Dockerfile-farmer @@ -1,6 +1,6 @@ FROM ubuntu:20.04 -ARG RUSTC_VERSION=nightly-2023-10-16 +ARG RUSTC_VERSION=nightly-2024-01-19 ARG PROFILE=production ARG RUSTFLAGS # Workaround for https://github.com/rust-lang/cargo/issues/10583 diff --git a/Dockerfile-farmer.aarch64 b/Dockerfile-farmer.aarch64 index 11046baa2c..7c232001ba 100644 --- a/Dockerfile-farmer.aarch64 +++ b/Dockerfile-farmer.aarch64 @@ -1,6 +1,6 @@ FROM ubuntu:20.04 -ARG RUSTC_VERSION=nightly-2023-10-16 +ARG RUSTC_VERSION=nightly-2024-01-19 ARG PROFILE=production ARG RUSTFLAGS # Workaround for https://github.com/rust-lang/cargo/issues/10583 diff --git a/Dockerfile-node b/Dockerfile-node index a3775ac1fa..4d35b532cd 100644 --- a/Dockerfile-node +++ b/Dockerfile-node @@ -1,6 +1,6 @@ FROM ubuntu:20.04 -ARG RUSTC_VERSION=nightly-2023-10-16 +ARG RUSTC_VERSION=nightly-2024-01-19 ARG PROFILE=production ARG RUSTFLAGS # Workaround for https://github.com/rust-lang/cargo/issues/10583 diff --git a/Dockerfile-node.aarch64 b/Dockerfile-node.aarch64 index 0dd70f8822..f9bdb7ebdc 100644 --- a/Dockerfile-node.aarch64 +++ b/Dockerfile-node.aarch64 @@ -1,6 +1,6 @@ FROM ubuntu:20.04 -ARG RUSTC_VERSION=nightly-2023-10-16 +ARG RUSTC_VERSION=nightly-2024-01-19 ARG PROFILE=production ARG RUSTFLAGS # Workaround for https://github.com/rust-lang/cargo/issues/10583 diff --git a/Dockerfile-runtime b/Dockerfile-runtime index 3bd02e65fa..80b4d38006 100644 --- a/Dockerfile-runtime +++ b/Dockerfile-runtime @@ -1,6 +1,6 @@ FROM ubuntu:20.04 -ARG RUSTC_VERSION=nightly-2023-10-16 +ARG RUSTC_VERSION=nightly-2024-01-19 ARG PROFILE=production ARG RUSTFLAGS # Workaround for https://github.com/rust-lang/cargo/issues/10583 diff --git a/crates/pallet-domains/src/staking.rs b/crates/pallet-domains/src/staking.rs index d2b229a4eb..dc3fbbf54b 100644 --- a/crates/pallet-domains/src/staking.rs +++ b/crates/pallet-domains/src/staking.rs @@ -386,9 +386,11 @@ pub(crate) fn do_convert_previous_epoch_deposits( let maybe_pending_deposit = deposit.pending.take(); // if it is one of the previous domain epoch, then calculate shares for the epoch and update known deposit deposit.pending = if let Some(PendingDeposit { - effective_domain_epoch, - amount, - }) = maybe_pending_deposit && let Some(epoch_share_price) = OperatorEpochSharePrice::::get(operator_id, effective_domain_epoch) + effective_domain_epoch, + amount, + }) = maybe_pending_deposit + && let Some(epoch_share_price) = + OperatorEpochSharePrice::::get(operator_id, effective_domain_epoch) { let new_shares = epoch_share_price.stake_to_shares::(amount); deposit.known.shares = deposit @@ -411,21 +413,24 @@ pub(crate) fn do_convert_previous_epoch_withdrawal( withdrawal: &mut Withdrawal, T::Share, DomainBlockNumberFor>, ) -> Result<(), Error> { let withdrawal_in_shares = withdrawal.withdrawal_in_shares.take(); - withdrawal.withdrawal_in_shares = - if let Some((domain_epoch, domain_block_number, shares)) = withdrawal_in_shares && let Some(epoch_share_price) = OperatorEpochSharePrice::::get(operator_id, domain_epoch){ - let withdrawal_amount = epoch_share_price.shares_to_stake::(shares); - withdrawal.total_withdrawal_amount = withdrawal - .total_withdrawal_amount - .checked_add(&withdrawal_amount) - .ok_or(Error::BalanceOverflow)?; - let (domain_id, _) = domain_epoch.deconstruct(); - withdrawal - .withdrawals - .push_back((domain_id, domain_block_number, withdrawal_amount)); - None - } else { - withdrawal_in_shares - }; + withdrawal.withdrawal_in_shares = if let Some((domain_epoch, domain_block_number, shares)) = + withdrawal_in_shares + && let Some(epoch_share_price) = + OperatorEpochSharePrice::::get(operator_id, domain_epoch) + { + let withdrawal_amount = epoch_share_price.shares_to_stake::(shares); + withdrawal.total_withdrawal_amount = withdrawal + .total_withdrawal_amount + .checked_add(&withdrawal_amount) + .ok_or(Error::BalanceOverflow)?; + let (domain_id, _) = domain_epoch.deconstruct(); + withdrawal + .withdrawals + .push_back((domain_id, domain_block_number, withdrawal_amount)); + None + } else { + withdrawal_in_shares + }; Ok(()) } @@ -836,7 +841,10 @@ pub(crate) fn do_unlock_funds( *maybe_withdrawal = None; // if there is no deposit or pending deposits, then clean up the deposit state as well Deposits::::mutate_exists(operator_id, nominator_id, |maybe_deposit| { - if let Some(deposit) = maybe_deposit && deposit.known.shares.is_zero() && deposit.pending.is_none() { + if let Some(deposit) = maybe_deposit + && deposit.known.shares.is_zero() + && deposit.pending.is_none() + { *maybe_deposit = None } }); diff --git a/crates/pallet-domains/src/tests.rs b/crates/pallet-domains/src/tests.rs index 02b0016256..835b25e3c8 100644 --- a/crates/pallet-domains/src/tests.rs +++ b/crates/pallet-domains/src/tests.rs @@ -1023,7 +1023,7 @@ fn test_invalid_domain_extrinsic_root_proof() { ); let bad_receipt_at = 8; - let valid_bundle_digests = vec![ValidBundleDigest { + let valid_bundle_digests = [ValidBundleDigest { bundle_index: 0, bundle_digest: vec![(Some(vec![1, 2, 3]), ExtrinsicDigest::Data(vec![4, 5, 6]))], }]; diff --git a/crates/pallet-rewards/src/lib.rs b/crates/pallet-rewards/src/lib.rs index d8c4d9dc8f..03c8533706 100644 --- a/crates/pallet-rewards/src/lib.rs +++ b/crates/pallet-rewards/src/lib.rs @@ -113,7 +113,7 @@ impl Pallet { // Block author may equivocate, in which case they'll not be present here if let Some(block_author) = T::FindBlockRewardAddress::find_block_reward_address() { let reward = T::BlockReward::get(); - T::Currency::deposit_creating(&block_author, reward); + let _imbalance = T::Currency::deposit_creating(&block_author, reward); T::OnReward::on_reward(block_author.clone(), reward); Self::deposit_event(Event::BlockReward { @@ -127,7 +127,7 @@ impl Pallet { let reward = T::VoteReward::get(); for voter in T::FindVotingRewardAddresses::find_voting_reward_addresses() { - T::Currency::deposit_creating(&voter, reward); + let _imbalance = T::Currency::deposit_creating(&voter, reward); T::OnReward::on_reward(voter.clone(), reward); Self::deposit_event(Event::VoteReward { voter, reward }); diff --git a/crates/pallet-transaction-fees/src/lib.rs b/crates/pallet-transaction-fees/src/lib.rs index 6558a651b8..c543575331 100644 --- a/crates/pallet-transaction-fees/src/lib.rs +++ b/crates/pallet-transaction-fees/src/lib.rs @@ -264,7 +264,7 @@ where // Issue storage fees reward. let storage_fees_reward = storage_fees_escrow_reward + collected_storage_fees_reward; if !storage_fees_reward.is_zero() { - T::Currency::deposit_creating(&block_author, storage_fees_reward); + let _imbalance = T::Currency::deposit_creating(&block_author, storage_fees_reward); Self::deposit_event(Event::::StorageFeesReward { who: block_author.clone(), amount: storage_fees_reward, @@ -273,7 +273,8 @@ where // Issue compute fees reward. if !collected_fees.compute.is_zero() { - T::Currency::deposit_creating(&block_author, collected_fees.compute); + let _imbalance = + T::Currency::deposit_creating(&block_author, collected_fees.compute); Self::deposit_event(Event::::ComputeFeesReward { who: block_author.clone(), amount: collected_fees.compute, @@ -282,7 +283,7 @@ where // Issue tips reward. if !collected_fees.tips.is_zero() { - T::Currency::deposit_creating(&block_author, collected_fees.tips); + let _imbalance = T::Currency::deposit_creating(&block_author, collected_fees.tips); Self::deposit_event(Event::::TipsReward { who: block_author, amount: collected_fees.tips, diff --git a/crates/sp-domains/src/merkle_tree.rs b/crates/sp-domains/src/merkle_tree.rs index 50ddd126ee..edf2a6cdef 100644 --- a/crates/sp-domains/src/merkle_tree.rs +++ b/crates/sp-domains/src/merkle_tree.rs @@ -1,5 +1,4 @@ use crate::OperatorPublicKey; -use blake2::digest::typenum::U32; use blake2::digest::FixedOutput; use blake2::{Blake2b, Digest}; use parity_scale_codec::{Decode, Encode}; @@ -27,12 +26,12 @@ pub struct Witness { } #[derive(Clone)] -pub struct Blake2b256Algorithm(Blake2b); +pub struct Blake2b256Algorithm; impl Default for Blake2b256Algorithm { #[inline] fn default() -> Self { - Self(Blake2b::new()) + Self } } diff --git a/crates/subspace-archiving/tests/integration/archiver.rs b/crates/subspace-archiving/tests/integration/archiver.rs index 46c1fd5a32..8c46e6e07f 100644 --- a/crates/subspace-archiving/tests/integration/archiver.rs +++ b/crates/subspace-archiving/tests/integration/archiver.rs @@ -276,7 +276,7 @@ fn archiver() { // Check archived bytes for block with index `2` in each archived segment { - let archived_segment = archived_segments.get(0).unwrap(); + let archived_segment = archived_segments.first().unwrap(); let last_archived_block = archived_segment.segment_header.last_archived_block(); assert_eq!(last_archived_block.number, 2); assert_eq!(last_archived_block.partial_archived(), Some(108352733)); @@ -360,7 +360,7 @@ fn archiver() { // Archived segment should fit exactly into the last archived segment (rare case) { - let archived_segment = archived_segments.get(0).unwrap(); + let archived_segment = archived_segments.first().unwrap(); let last_archived_block = archived_segment.segment_header.last_archived_block(); assert_eq!(last_archived_block.number, 3); assert_eq!(last_archived_block.partial_archived(), None); diff --git a/crates/subspace-farmer/src/bin/subspace-farmer/commands/farm.rs b/crates/subspace-farmer/src/bin/subspace-farmer/commands/farm.rs index b1bcb5b49d..80ccd827c4 100644 --- a/crates/subspace-farmer/src/bin/subspace-farmer/commands/farm.rs +++ b/crates/subspace-farmer/src/bin/subspace-farmer/commands/farm.rs @@ -231,11 +231,7 @@ impl FromStr for DiskFarm { match key { "path" => { - plot_directory.replace( - PathBuf::try_from(value).map_err(|error| { - format!("Failed to parse `path` \"{value}\": {error}") - })?, - ); + plot_directory.replace(PathBuf::from(value)); } "size" => { allocated_plotting_space.replace( diff --git a/crates/subspace-networking/src/utils/unique_record_binary_heap.rs b/crates/subspace-networking/src/utils/unique_record_binary_heap.rs index f66163d29f..9edee5a9ba 100644 --- a/crates/subspace-networking/src/utils/unique_record_binary_heap.rs +++ b/crates/subspace-networking/src/utils/unique_record_binary_heap.rs @@ -45,6 +45,8 @@ where RecordKey: From, K: Clone, { + // TODO: False-positive in clippy: https://github.com/rust-lang/rust-clippy/issues/12154 + #[allow(clippy::unconditional_recursion)] fn eq(&self, other: &Self) -> bool { self.peer_distance().eq(&other.peer_distance()) } diff --git a/crates/subspace-proof-of-space/src/chiapos/table.rs b/crates/subspace-proof-of-space/src/chiapos/table.rs index cad041d6ec..479dae2713 100644 --- a/crates/subspace-proof-of-space/src/chiapos/table.rs +++ b/crates/subspace-proof-of-space/src/chiapos/table.rs @@ -13,7 +13,8 @@ use alloc::vec::Vec; use chacha20::cipher::{KeyIvInit, StreamCipher, StreamCipherSeek}; use chacha20::{ChaCha8, Key, Nonce}; use core::mem; -use core::simd::{Simd, SimdUint}; +use core::simd::num::SimdUint; +use core::simd::Simd; #[cfg(any(feature = "parallel", test))] use rayon::prelude::*; use seq_macro::seq; diff --git a/domains/client/eth-service/src/rpc.rs b/domains/client/eth-service/src/rpc.rs index 70a81570b6..49b210b7a6 100644 --- a/domains/client/eth-service/src/rpc.rs +++ b/domains/client/eth-service/src/rpc.rs @@ -4,9 +4,8 @@ use fc_rpc::{ Eth, EthApiServer, EthDevSigner, EthFilter, EthFilterApiServer, EthPubSub, EthPubSubApiServer, EthSigner, Net, NetApiServer, Web3, Web3ApiServer, }; -pub use fc_rpc::{EthBlockDataCacheTask, EthConfig, StorageOverride}; +pub use fc_rpc::{EthBlockDataCacheTask, EthConfig}; pub use fc_rpc_core::types::{FeeHistoryCache, FeeHistoryCacheLimit, FilterPool}; -pub use fc_storage::overrides_handle; use fc_storage::OverrideHandle; use fp_rpc::{ConvertTransaction, ConvertTransactionRuntimeApi, EthereumRuntimeRPCApi}; use jsonrpsee::RpcModule; diff --git a/domains/client/eth-service/src/service.rs b/domains/client/eth-service/src/service.rs index 2d6f422d78..ab205cc281 100644 --- a/domains/client/eth-service/src/service.rs +++ b/domains/client/eth-service/src/service.rs @@ -1,5 +1,3 @@ -pub use fc_consensus::FrontierBlockImport; -pub use fc_db::kv::frontier_database_dir; use fc_mapping_sync::kv::MappingSyncWorker; use fc_mapping_sync::SyncStrategy; use fc_rpc::{EthTask, OverrideHandle}; diff --git a/domains/pallets/transporter/src/lib.rs b/domains/pallets/transporter/src/lib.rs index 45d117cffb..da4b2836e6 100644 --- a/domains/pallets/transporter/src/lib.rs +++ b/domains/pallets/transporter/src/lib.rs @@ -193,7 +193,7 @@ mod pallet { let sender = ensure_signed(origin)?; // burn transfer amount - T::Currency::withdraw( + let _imbalance = T::Currency::withdraw( &sender, amount, WithdrawReasons::TRANSFER, @@ -266,7 +266,7 @@ mod pallet { let account_id = T::AccountIdConverter::try_convert_back(req.receiver.account_id) .ok_or(Error::::InvalidAccountId)?; - T::Currency::deposit_creating(&account_id, req.amount); + let _imbalance = T::Currency::deposit_creating(&account_id, req.amount); frame_system::Pallet::::deposit_event(Into::<::RuntimeEvent>::into( Event::::IncomingTransferSuccessful { chain_id: src_chain_id, @@ -314,7 +314,7 @@ mod pallet { let account_id = T::AccountIdConverter::try_convert_back(transfer.sender.account_id) .ok_or(Error::::InvalidAccountId)?; - T::Currency::deposit_creating(&account_id, transfer.amount); + let _imbalance = T::Currency::deposit_creating(&account_id, transfer.amount); frame_system::Pallet::::deposit_event( Into::<::RuntimeEvent>::into( Event::::OutgoingTransferFailed { diff --git a/domains/service/src/lib.rs b/domains/service/src/lib.rs index 06e6b245e4..fe4332f865 100644 --- a/domains/service/src/lib.rs +++ b/domains/service/src/lib.rs @@ -153,6 +153,8 @@ where let (engine, sync_service, block_announce_config) = SyncingEngine::new( Roles::from(&config.role), client.clone(), + // TODO: False-positive in clippy: https://github.com/rust-lang/rust-clippy/issues/12148 + #[allow(clippy::useless_asref)] config .prometheus_config .as_ref() @@ -212,6 +214,8 @@ where genesis_hash, protocol_id, fork_id: config.chain_spec.fork_id().map(ToOwned::to_owned), + // TODO: False-positive in clippy: https://github.com/rust-lang/rust-clippy/issues/12148 + #[allow(clippy::useless_asref)] metrics_registry: config .prometheus_config .as_ref() @@ -234,6 +238,8 @@ where transaction_pool, client.clone(), )), + // TODO: False-positive in clippy: https://github.com/rust-lang/rust-clippy/issues/12148 + #[allow(clippy::useless_asref)] config .prometheus_config .as_ref() diff --git a/orml/vesting/src/tests.rs b/orml/vesting/src/tests.rs index a98978eceb..7b5f52dcbb 100644 --- a/orml/vesting/src/tests.rs +++ b/orml/vesting/src/tests.rs @@ -164,7 +164,7 @@ fn add_new_vesting_schedule_merges_with_current_locked_balance_and_until() { )); assert_eq!( - PalletBalances::locks(BOB).get(0), + PalletBalances::locks(BOB).first(), Some(&BalanceLock { id: VESTING_LOCK_ID, amount: 17u64, @@ -348,7 +348,7 @@ fn claim_for_works() { assert_ok!(Vesting::claim_for(RuntimeOrigin::signed(ALICE), BOB)); assert_eq!( - PalletBalances::locks(BOB).get(0), + PalletBalances::locks(BOB).first(), Some(&BalanceLock { id: VESTING_LOCK_ID, amount: 20u64, @@ -411,7 +411,7 @@ fn update_vesting_schedules_works() { // empty vesting schedules cleanup the storage and unlock the fund assert!(VestingSchedules::::contains_key(BOB)); assert_eq!( - PalletBalances::locks(BOB).get(0), + PalletBalances::locks(BOB).first(), Some(&BalanceLock { id: VESTING_LOCK_ID, amount: 10u64, diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 6ce5e5e18e..dfb6c7bb43 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "nightly-2023-10-16" +channel = "nightly-2024-01-19" components = ["rust-src"] targets = ["wasm32-unknown-unknown"] profile = "default" From d783d7f0aad8760f032e9ce0a96b98462f2a0a70 Mon Sep 17 00:00:00 2001 From: Nazar Mokrynskyi Date: Fri, 19 Jan 2024 16:17:16 +0200 Subject: [PATCH 2/3] Take advantage of Rust reimplementation of Git in Cargo (gitoxide) and shallow clones --- .github/workflows/rust.yml | 19 ++++++------------- .github/workflows/rustdoc.yml | 2 +- .github/workflows/snapshot-build.yml | 18 ++++++------------ 3 files changed, 13 insertions(+), 26 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 12a78598c8..5e6df9a40c 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -52,10 +52,7 @@ jobs: ${{ runner.os }}-cargo- - name: cargo fmt - uses: actions-rs/cargo@ae10961054e4aa8b4aa7dffede299aaf087aa33b # @v1.0.1 - with: - command: fmt - args: --all -- --check + run: cargo fmt --all -- --check cargo-clippy: strategy: @@ -114,10 +111,8 @@ jobs: ${{ runner.os }}-cargo- - name: cargo clippy - uses: actions-rs/clippy-check@b5b5f21f4797c02da247df37026fcd0a5024aa4d # @v1.0.7 - with: - token: ${{ secrets.GITHUB_TOKEN }} - args: --locked --all-targets --features "runtime-benchmarks" -- -D warnings + run: | + cargo -Zgitoxide -Zgit clippy --locked --all-targets --features "runtime-benchmarks" -- -D warnings cargo-docs: runs-on: ${{ fromJson(github.repository_owner == 'subspace' && '["self-hosted", "ubuntu-20.04-x86-64"]' || '"ubuntu-22.04"') }} @@ -141,7 +136,7 @@ jobs: ${{ runner.os }}-cargo- - name: Check Documentation - run: cargo doc --locked --all --no-deps --lib + run: cargo -Zgitoxide -Zgit doc --locked --all --no-deps --lib env: RUSTDOCFLAGS: "-D rustdoc::broken-intra-doc-links -D rustdoc::private_intra_doc_links" @@ -207,7 +202,5 @@ jobs: tool: cargo-nextest - name: cargo nextest run --locked - uses: actions-rs/cargo@ae10961054e4aa8b4aa7dffede299aaf087aa33b # @v1.0.1 - with: - command: nextest - args: run --locked + run: | + cargo -Zgitoxide -Zgit nextest run --locked diff --git a/.github/workflows/rustdoc.yml b/.github/workflows/rustdoc.yml index 48d7a8cfcb..0454ea09b7 100644 --- a/.github/workflows/rustdoc.yml +++ b/.github/workflows/rustdoc.yml @@ -46,7 +46,7 @@ jobs: # Build the rust crate docs - name: Build Documentation - run: cargo doc --all --no-deps --lib + run: cargo -Zgitoxide -Zgit doc --all --no-deps --lib env: RUSTDOCFLAGS: "-Z unstable-options --enable-index-page" diff --git a/.github/workflows/snapshot-build.yml b/.github/workflows/snapshot-build.yml index 6922881ab6..0a9203dcc5 100644 --- a/.github/workflows/snapshot-build.yml +++ b/.github/workflows/snapshot-build.yml @@ -201,25 +201,19 @@ jobs: ${{ runner.os }}-cargo- - name: Build farmer (Linux and Windows) - uses: actions-rs/cargo@ae10961054e4aa8b4aa7dffede299aaf087aa33b # @v1.0.1 - with: - command: build - args: --locked -Z build-std --target ${{ matrix.build.target }} --profile production --bin subspace-farmer + run: | + cargo -Zgitoxide -Zgit build --locked -Z build-std --target ${{ matrix.build.target }} --profile production --bin subspace-farmer if: runner.os != 'macOS' # We build macOS without `numa` feature, primarily because of https://github.com/HadrienG2/hwlocality/issues/31 - name: Build farmer (macOS) - uses: actions-rs/cargo@ae10961054e4aa8b4aa7dffede299aaf087aa33b # @v1.0.1 - with: - command: build - args: --locked -Z build-std --target ${{ matrix.build.target }} --profile production --bin subspace-farmer --no-default-features + run: | + cargo -Zgitoxide -Zgit build --locked -Z build-std --target ${{ matrix.build.target }} --profile production --bin subspace-farmer --no-default-features if: runner.os == 'macOS' - name: Build node - uses: actions-rs/cargo@ae10961054e4aa8b4aa7dffede299aaf087aa33b # @v1.0.1 - with: - command: build - args: --locked -Z build-std --target ${{ matrix.build.target }} --profile production --bin subspace-node + run: | + cargo -Zgitoxide -Zgit build --locked -Z build-std --target ${{ matrix.build.target }} --profile production --bin subspace-node - name: Sign Application (macOS) run: | From 32dcf61006fc6bcc1ed02bd962e65ab857591599 Mon Sep 17 00:00:00 2001 From: Nazar Mokrynskyi Date: Fri, 19 Jan 2024 22:04:55 +0200 Subject: [PATCH 3/3] Use shallow clone for container builds as well --- Dockerfile-bootstrap-node | 2 +- Dockerfile-bootstrap-node.aarch64 | 2 +- Dockerfile-farmer | 2 +- Dockerfile-farmer.aarch64 | 2 +- Dockerfile-node | 2 +- Dockerfile-node.aarch64 | 2 +- Dockerfile-runtime | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Dockerfile-bootstrap-node b/Dockerfile-bootstrap-node index b4b4460711..3ba63b4150 100644 --- a/Dockerfile-bootstrap-node +++ b/Dockerfile-bootstrap-node @@ -41,7 +41,7 @@ COPY test /code/test # Up until this line all Rust images in this repo should be the same to share the same layers RUN \ - /root/.cargo/bin/cargo build \ + /root/.cargo/bin/cargo -Zgitoxide -Zgit build \ --locked \ -Z build-std \ --profile $PROFILE \ diff --git a/Dockerfile-bootstrap-node.aarch64 b/Dockerfile-bootstrap-node.aarch64 index 09a40ca763..6c4a49a3cb 100644 --- a/Dockerfile-bootstrap-node.aarch64 +++ b/Dockerfile-bootstrap-node.aarch64 @@ -54,7 +54,7 @@ RUN \ RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends g++-9-multilib RUN \ - /root/.cargo/bin/cargo build \ + /root/.cargo/bin/cargo -Zgitoxide -Zgit build \ --locked \ -Z build-std \ --profile $PROFILE \ diff --git a/Dockerfile-farmer b/Dockerfile-farmer index 00f036f8b3..1c1b7cf901 100644 --- a/Dockerfile-farmer +++ b/Dockerfile-farmer @@ -41,7 +41,7 @@ COPY test /code/test # Up until this line all Rust images in this repo should be the same to share the same layers RUN \ - /root/.cargo/bin/cargo build \ + /root/.cargo/bin/cargo -Zgitoxide -Zgit build \ --locked \ -Z build-std \ --profile $PROFILE \ diff --git a/Dockerfile-farmer.aarch64 b/Dockerfile-farmer.aarch64 index 7c232001ba..dca67be413 100644 --- a/Dockerfile-farmer.aarch64 +++ b/Dockerfile-farmer.aarch64 @@ -54,7 +54,7 @@ RUN \ RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends g++-9-multilib RUN \ - /root/.cargo/bin/cargo build \ + /root/.cargo/bin/cargo -Zgitoxide -Zgit build \ --locked \ -Z build-std \ --profile $PROFILE \ diff --git a/Dockerfile-node b/Dockerfile-node index 4d35b532cd..d660bdcef4 100644 --- a/Dockerfile-node +++ b/Dockerfile-node @@ -43,7 +43,7 @@ COPY test /code/test ARG SUBSTRATE_CLI_GIT_COMMIT_HASH RUN \ - /root/.cargo/bin/cargo build \ + /root/.cargo/bin/cargo -Zgitoxide -Zgit build \ --locked \ -Z build-std \ --profile $PROFILE \ diff --git a/Dockerfile-node.aarch64 b/Dockerfile-node.aarch64 index f9bdb7ebdc..f11629423d 100644 --- a/Dockerfile-node.aarch64 +++ b/Dockerfile-node.aarch64 @@ -51,7 +51,7 @@ RUN \ libc6-dev-arm64-cross RUN \ - /root/.cargo/bin/cargo build \ + /root/.cargo/bin/cargo -Zgitoxide -Zgit build \ --locked \ -Z build-std \ --profile $PROFILE \ diff --git a/Dockerfile-runtime b/Dockerfile-runtime index 80b4d38006..59a6ea65bd 100644 --- a/Dockerfile-runtime +++ b/Dockerfile-runtime @@ -41,7 +41,7 @@ COPY test /code/test # Up until this line all Rust images in this repo should be the same to share the same layers RUN \ - /root/.cargo/bin/cargo build \ + /root/.cargo/bin/cargo -Zgitoxide -Zgit build \ --locked \ -Z build-std \ --profile $PROFILE \