diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 5c2c36e929b..a7f513f42b8 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -7,12 +7,12 @@ /crates/sc-proof-of-time @nazar-pc /crates/sp-* @NingLin-P @vedhavyas /crates/sp-consensus-subspace @NingLin-P @vedhavyas @nazar-pc -/crates/subspace-archiving @nazar-pc @shamil-gadelshin @teor2345 +/crates/subspace-archiving @nazar-pc @teor2345 /crates/subspace-core-primitives @nazar-pc /crates/subspace-erasure-coding @nazar-pc -/crates/subspace-farmer* @nazar-pc @shamil-gadelshin -/crates/subspace-gateway-* @shamil-gadelshin @teor2345 -/crates/subspace-networking @nazar-pc @shamil-gadelshin @teor2345 +/crates/subspace-farmer* @nazar-pc +/crates/subspace-gateway-* @teor2345 +/crates/subspace-networking @nazar-pc @teor2345 /crates/subspace-proof-* @nazar-pc /crates/subspace-rpc-primitives @nazar-pc @teor2345 /crates/subspace-runtime* @vedhavyas @nazar-pc diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 536680d5fdf..4cf42ec81fa 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -34,7 +34,7 @@ jobs: repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Configure cache - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 + uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 with: path: | ~/.cargo/registry @@ -86,7 +86,7 @@ jobs: if: runner.os == 'macOS' - name: CUDA toolchain - uses: Jimver/cuda-toolkit@9b295696791d75d658d8de64c4a85097ad8abeaf # v0.2.16 + uses: Jimver/cuda-toolkit@4bd727d5619dc6fa323b1e76c3aa5dca94f5ec6d # v0.2.19 with: cuda: '12.4.1' method: network @@ -94,7 +94,7 @@ jobs: if: runner.os == 'Linux' || runner.os == 'Windows' - name: Configure ROCm cache (Windows) - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 + uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 id: rocm-cache with: path: C:\Program Files\AMD\ROCm @@ -123,7 +123,7 @@ jobs: if: runner.os == 'Windows' && steps.rocm-cache.outputs.cache-hit != 'true' - name: Configure cache - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 + uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 with: path: | ~/.cargo/registry @@ -155,32 +155,6 @@ jobs: cargo -Zgitoxide -Zgit clippy --locked --all-targets --features rocm -- -D warnings if: runner.os == 'Windows' - cargo-docs: - runs-on: ${{ fromJson(github.repository_owner == 'autonomys' && '["self-hosted", "ubuntu-22.04-x86-64"]' || '"ubuntu-22.04"') }} - steps: - - name: Checkout - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - - name: Install Protoc - uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3.0.0 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - - - name: Configure cache - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }} - restore-keys: | - ${{ runner.os }}-cargo- - - - name: Check Documentation - run: cargo -Zgitoxide -Zgit doc --locked --all --no-deps --lib - env: - RUSTDOCFLAGS: "-D rustdoc::broken-intra-doc-links -D rustdoc::private_intra_doc_links" - cargo-test: strategy: matrix: @@ -223,7 +197,7 @@ jobs: if: runner.os == 'macOS' - name: Configure cache - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 + uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 with: path: | ~/.cargo/registry diff --git a/.github/workflows/rustdoc.yml b/.github/workflows/rustdoc.yml index ef24ad6e08d..25e6956e420 100644 --- a/.github/workflows/rustdoc.yml +++ b/.github/workflows/rustdoc.yml @@ -4,6 +4,9 @@ on: push: branches: - main + pull_request: + workflow_dispatch: + merge_group: concurrency: group: rustdoc-${{ github.workflow }}-${{ github.ref }} @@ -30,7 +33,7 @@ jobs: repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Configure cache - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 + uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 with: path: | ~/.cargo/registry @@ -40,7 +43,7 @@ jobs: ${{ runner.os }}-cargo- - name: CUDA toolchain - uses: Jimver/cuda-toolkit@9b295696791d75d658d8de64c4a85097ad8abeaf # v0.2.16 + uses: Jimver/cuda-toolkit@4bd727d5619dc6fa323b1e76c3aa5dca94f5ec6d # v0.2.19 with: cuda: '12.4.1' method: network @@ -48,9 +51,9 @@ jobs: # Build the rust crate docs - name: Build Documentation - run: cargo -Zgitoxide -Zgit doc --all --no-deps --lib --features cuda + run: cargo -Zgitoxide -Zgit doc --locked --all --no-deps --lib --features cuda env: - RUSTDOCFLAGS: "-Z unstable-options --enable-index-page" + RUSTDOCFLAGS: "-D rustdoc::broken-intra-doc-links -D rustdoc::private_intra_doc_links -Z unstable-options --enable-index-page" - name: Deploy Docs uses: JamesIves/github-pages-deploy-action@881db5376404c5c8d621010bcbec0310b58d5e29 # v4.6.8 @@ -58,3 +61,4 @@ jobs: branch: gh-pages single-commit: true folder: target/doc + if: ${{ github.event_name == 'push' }} diff --git a/.github/workflows/snapshot-build.yml b/.github/workflows/snapshot-build.yml index dba04fe5b8f..22c6de5a75a 100644 --- a/.github/workflows/snapshot-build.yml +++ b/.github/workflows/snapshot-build.yml @@ -191,7 +191,7 @@ jobs: if: runner.os == 'macOS' - name: CUDA toolchain - uses: Jimver/cuda-toolkit@9b295696791d75d658d8de64c4a85097ad8abeaf # v0.2.16 + uses: Jimver/cuda-toolkit@4bd727d5619dc6fa323b1e76c3aa5dca94f5ec6d # v0.2.19 with: cuda: '12.4.1' method: network @@ -199,7 +199,7 @@ jobs: if: runner.os == 'Windows' - name: Configure ROCm cache (Windows) - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 + uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 id: rocm-cache with: path: C:\Program Files\AMD\ROCm @@ -215,7 +215,7 @@ jobs: if: runner.os == 'Windows' && steps.rocm-cache.outputs.cache-hit != 'true' - name: Configure cache - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 + uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 with: path: | ~/.cargo/registry diff --git a/crates/pallet-domains/Cargo.toml b/crates/pallet-domains/Cargo.toml index 7313be70ae0..ff9a2292b5f 100644 --- a/crates/pallet-domains/Cargo.toml +++ b/crates/pallet-domains/Cargo.toml @@ -3,7 +3,7 @@ name = "pallet-domains" version = "0.1.0" authors = ["Subspace Labs "] edition = "2021" -license = "Apache-2.0" +license = "0BSD" homepage = "https://subspace.network" repository = "https://github.com/autonomys/subspace" description = "Subspace domains pallet" diff --git a/crates/pallet-domains/src/lib.rs b/crates/pallet-domains/src/lib.rs index dc1c5565cef..e6815241d7d 100644 --- a/crates/pallet-domains/src/lib.rs +++ b/crates/pallet-domains/src/lib.rs @@ -1,18 +1,3 @@ -// Copyright (C) 2021 Subspace Labs, Inc. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - //! Pallet Domains #![cfg_attr(not(feature = "std"), no_std)] @@ -53,7 +38,7 @@ use frame_support::ensure; use frame_support::pallet_prelude::StorageVersion; use frame_support::traits::fungible::{Inspect, InspectHold}; use frame_support::traits::tokens::{Fortitude, Preservation}; -use frame_support::traits::{Get, Randomness as RandomnessT}; +use frame_support::traits::{Get, Randomness as RandomnessT, Time}; use frame_support::weights::Weight; use frame_system::offchain::SubmitTransaction; use frame_system::pallet_prelude::*; @@ -86,6 +71,7 @@ use sp_subspace_mmr::{ConsensusChainMmrLeafProof, MmrProofVerifier}; pub use staking::OperatorConfig; use subspace_core_primitives::pot::PotOutput; use subspace_core_primitives::{BlockHash, SlotNumber, U256}; +use subspace_runtime_primitives::{Balance, Moment, StorageFee}; /// Maximum number of nominators to slash within a give operator at a time. pub const MAX_NOMINATORS_TO_SLASH: u32 = 10; @@ -201,7 +187,7 @@ mod pallet { #[cfg(not(feature = "runtime-benchmarks"))] use crate::staking_epoch::do_slash_operator; use crate::staking_epoch::{do_finalize_domain_current_epoch, Error as StakingEpochError}; - use crate::storage_proof::InvalidInherentExtrinsicData; + use crate::storage_proof::InherentExtrinsicData; use crate::weights::WeightInfo; #[cfg(not(feature = "runtime-benchmarks"))] use crate::DomainHashingFor; @@ -248,10 +234,10 @@ mod pallet { use sp_std::fmt::Debug; use sp_subspace_mmr::MmrProofVerifier; use subspace_core_primitives::{Randomness, U256}; - use subspace_runtime_primitives::{Balance, StorageFee}; + use subspace_runtime_primitives::StorageFee; #[pallet::config] - pub trait Config: frame_system::Config> { + pub trait Config: frame_system::Config + From> { type RuntimeEvent: From> + IsType<::RuntimeEvent>; // TODO: `DomainHash` can be derived from `DomainHeader`, it is still needed just for @@ -1856,7 +1842,7 @@ mod pallet { /// Combined fraud proof data for the InvalidInherentExtrinsic fraud proof #[pallet::storage] - pub type BlockInvalidInherentExtrinsicData = StorageValue<_, InvalidInherentExtrinsicData>; + pub type BlockInherentExtrinsicData = StorageValue<_, InherentExtrinsicData>; #[pallet::hooks] // TODO: proper benchmark @@ -1907,7 +1893,7 @@ mod pallet { } } - BlockInvalidInherentExtrinsicData::::kill(); + BlockInherentExtrinsicData::::kill(); Weight::zero() } @@ -1919,31 +1905,23 @@ mod pallet { || !DomainRuntimeUpgrades::::get().is_empty() { let extrinsics_shuffling_seed = Randomness::from( - Into::::into(Self::extrinsics_shuffling_seed()).to_fixed_bytes(), + Into::::into(Self::extrinsics_shuffling_seed_value()).to_fixed_bytes(), ); // There are no actual conversions here, but the trait bounds required to prove that // (and debug-print the error in expect()) are very verbose. - let timestamp = T::BlockTimestamp::now() - .try_into() - .map_err(|_| ()) - .expect("Moment is the same type in both pallets; qed"); - let transaction_byte_fee: Balance = T::StorageFee::transaction_byte_fee() - .try_into() - .map_err(|_| ()) - .expect("Balance is the same type in both pallets; qed"); + let timestamp = Self::timestamp_value(); // The value returned by the consensus_chain_byte_fee() runtime API - let consensus_transaction_byte_fee = - sp_domains::DOMAIN_STORAGE_FEE_MULTIPLIER * transaction_byte_fee; + let consensus_transaction_byte_fee = Self::consensus_transaction_byte_fee_value(); - let invalid_inherent_extrinsic_data = InvalidInherentExtrinsicData { + let inherent_extrinsic_data = InherentExtrinsicData { extrinsics_shuffling_seed, timestamp, consensus_transaction_byte_fee, }; - BlockInvalidInherentExtrinsicData::::set(Some(invalid_inherent_extrinsic_data)); + BlockInherentExtrinsicData::::set(Some(inherent_extrinsic_data)); } let _ = LastEpochStakingDistribution::::clear(u32::MAX, None); @@ -2770,12 +2748,66 @@ impl Pallet { false } + /// The external function used to access the extrinsics shuffling seed stored in + /// `BlockInherentExtrinsicData`. pub fn extrinsics_shuffling_seed() -> T::Hash { + // Fall back to recalculating if it hasn't been stored yet. + BlockInherentExtrinsicData::::get() + .map(|data| H256::from(*data.extrinsics_shuffling_seed).into()) + .unwrap_or_else(|| Self::extrinsics_shuffling_seed_value()) + } + + /// The internal function used to calculate the extrinsics shuffling seed for storage into + /// `BlockInherentExtrinsicData`. + fn extrinsics_shuffling_seed_value() -> T::Hash { let subject = DOMAIN_EXTRINSICS_SHUFFLING_SEED_SUBJECT; let (randomness, _) = T::Randomness::random(subject); randomness } + /// The external function used to access the timestamp stored in + /// `BlockInherentExtrinsicData`. + pub fn timestamp() -> Moment { + // Fall back to recalculating if it hasn't been stored yet. + BlockInherentExtrinsicData::::get() + .map(|data| data.timestamp) + .unwrap_or_else(|| Self::timestamp_value()) + } + + /// The internal function used to access the timestamp for storage into + /// `BlockInherentExtrinsicData`. + fn timestamp_value() -> Moment { + // There are no actual conversions here, but the trait bounds required to prove that + // (and debug-print the error in expect()) are very verbose. + T::BlockTimestamp::now() + .try_into() + .map_err(|_| ()) + .expect("Moment is the same type in both pallets; qed") + } + + /// The external function used to access the consensus transaction byte fee stored in + /// `BlockInherentExtrinsicData`. + /// This value is returned by the consensus_chain_byte_fee() runtime API + pub fn consensus_transaction_byte_fee() -> Balance { + // Fall back to recalculating if it hasn't been stored yet. + BlockInherentExtrinsicData::::get() + .map(|data| data.consensus_transaction_byte_fee) + .unwrap_or_else(|| Self::consensus_transaction_byte_fee_value()) + } + + /// The internal function used to calculate the consensus transaction byte fee for storage into + /// `BlockInherentExtrinsicData`. + fn consensus_transaction_byte_fee_value() -> Balance { + // There are no actual conversions here, but the trait bounds required to prove that + // (and debug-print the error in expect()) are very verbose. + let transaction_byte_fee: Balance = T::StorageFee::transaction_byte_fee() + .try_into() + .map_err(|_| ()) + .expect("Balance is the same type in both pallets; qed"); + + sp_domains::DOMAIN_STORAGE_FEE_MULTIPLIER * transaction_byte_fee + } + pub fn execution_receipt(receipt_hash: ReceiptHashFor) -> Option> { BlockTreeNodes::::get(receipt_hash).map(|db| db.execution_receipt) } diff --git a/crates/pallet-rewards/Cargo.toml b/crates/pallet-rewards/Cargo.toml index 30043ad86c2..3ff1963934e 100644 --- a/crates/pallet-rewards/Cargo.toml +++ b/crates/pallet-rewards/Cargo.toml @@ -3,7 +3,7 @@ name = "pallet-rewards" version = "0.1.0" authors = ["Nazar Mokrynskyi "] edition = "2021" -license = "Apache-2.0" +license = "0BSD" homepage = "https://subspace.network" repository = "https://github.com/autonomys/subspace" description = "Pallet for issuing rewards to block producers" diff --git a/crates/pallet-rewards/src/lib.rs b/crates/pallet-rewards/src/lib.rs index 4b7de6e9356..64b0ee087b3 100644 --- a/crates/pallet-rewards/src/lib.rs +++ b/crates/pallet-rewards/src/lib.rs @@ -1,18 +1,3 @@ -// Copyright (C) 2021 Subspace Labs, Inc. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - //! Pallet for issuing rewards to block producers. #![cfg_attr(not(feature = "std"), no_std)] diff --git a/crates/pallet-runtime-configs/Cargo.toml b/crates/pallet-runtime-configs/Cargo.toml index 971f2f39672..57facf9b212 100644 --- a/crates/pallet-runtime-configs/Cargo.toml +++ b/crates/pallet-runtime-configs/Cargo.toml @@ -3,7 +3,7 @@ name = "pallet-runtime-configs" version = "0.1.0" authors = ["Liu-Cheng Xu "] edition = "2021" -license = "GPL-3.0-or-later WITH Classpath-exception-2.0" +license = "0BSD" homepage = "https://subspace.network" repository = "https://github.com/autonomys/subspace" description = "Pallet for tweaking the runtime configs for multiple network" diff --git a/crates/pallet-runtime-configs/src/lib.rs b/crates/pallet-runtime-configs/src/lib.rs index 175f396597a..71a66ebffd9 100644 --- a/crates/pallet-runtime-configs/src/lib.rs +++ b/crates/pallet-runtime-configs/src/lib.rs @@ -1,18 +1,3 @@ -// Copyright (C) 2022 Subspace Labs, Inc. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - //! Pallet for tweaking the runtime configs for multiple network. #![cfg_attr(not(feature = "std"), no_std)] diff --git a/crates/pallet-subspace-mmr/Cargo.toml b/crates/pallet-subspace-mmr/Cargo.toml index 001b3f8556f..a9d4a1eff89 100644 --- a/crates/pallet-subspace-mmr/Cargo.toml +++ b/crates/pallet-subspace-mmr/Cargo.toml @@ -3,7 +3,7 @@ name = "pallet-subspace-mmr" homepage = "https://subspace.network" repository = "https://github.com/autonomys/subspace" description = "Primitives for Subspace MMR" -license = "GPL-3.0-or-later WITH Classpath-exception-2.0" +license = "0BSD" version = "0.1.0" authors = ["Subspace Labs "] edition = "2021" diff --git a/crates/pallet-subspace-mmr/src/lib.rs b/crates/pallet-subspace-mmr/src/lib.rs index 581d5d10a40..e6ccbc2d90f 100644 --- a/crates/pallet-subspace-mmr/src/lib.rs +++ b/crates/pallet-subspace-mmr/src/lib.rs @@ -1,18 +1,3 @@ -// Copyright (C) 2022 Subspace Labs, Inc. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - //! Pallet that provides necessary Leaf data for MMR. #![cfg_attr(not(feature = "std"), no_std)] diff --git a/crates/pallet-subspace/Cargo.toml b/crates/pallet-subspace/Cargo.toml index be8d3b0f271..b8fe2f81632 100644 --- a/crates/pallet-subspace/Cargo.toml +++ b/crates/pallet-subspace/Cargo.toml @@ -3,7 +3,7 @@ name = "pallet-subspace" version = "0.1.0" authors = ["Parity Technologies ", "Subspace Labs "] edition = "2021" -license = "Apache-2.0" +license = "0BSD" homepage = "https://subspace.network" repository = "https://github.com/autonomys/subspace" description = "Subspace consensus pallet" diff --git a/crates/pallet-subspace/README.md b/crates/pallet-subspace/README.md index b0868dbfda1..e22bc82b797 100644 --- a/crates/pallet-subspace/README.md +++ b/crates/pallet-subspace/README.md @@ -14,5 +14,3 @@ Pallet maintains crucial state required for Subspace Proof-of-Archival-Storage c validity of piece from solution can be checked later Pallet also provides handy API for finding block author, block reward address, randomness and some others. - -License: Apache-2.0 diff --git a/crates/pallet-subspace/src/lib.rs b/crates/pallet-subspace/src/lib.rs index e193be29e38..8ba37dd90ca 100644 --- a/crates/pallet-subspace/src/lib.rs +++ b/crates/pallet-subspace/src/lib.rs @@ -1,18 +1,3 @@ -// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd. -// Copyright (C) 2021 Subspace Labs, Inc. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. #![doc = include_str!("../README.md")] #![cfg_attr(not(feature = "std"), no_std)] #![feature(array_chunks, assert_matches, let_chains, portable_simd)] diff --git a/crates/pallet-subspace/src/mock.rs b/crates/pallet-subspace/src/mock.rs index ca14de2c384..c854817313d 100644 --- a/crates/pallet-subspace/src/mock.rs +++ b/crates/pallet-subspace/src/mock.rs @@ -1,19 +1,3 @@ -// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd. -// Copyright (C) 2021 Subspace Labs, Inc. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - //! Test utilities use crate::{self as pallet_subspace, AllowAuthoringBy, Config, EnableRewardsAt, NormalEraChange}; diff --git a/crates/pallet-subspace/src/tests.rs b/crates/pallet-subspace/src/tests.rs index 66f576514bc..af6b54bd6d1 100644 --- a/crates/pallet-subspace/src/tests.rs +++ b/crates/pallet-subspace/src/tests.rs @@ -1,19 +1,3 @@ -// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd. -// Copyright (C) 2021 Subspace Labs, Inc. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - //! Consensus extension module tests for Subspace consensus. use crate::mock::{ diff --git a/crates/pallet-transaction-fees/Cargo.toml b/crates/pallet-transaction-fees/Cargo.toml index 7c03012e606..40019077679 100644 --- a/crates/pallet-transaction-fees/Cargo.toml +++ b/crates/pallet-transaction-fees/Cargo.toml @@ -3,7 +3,7 @@ name = "pallet-transaction-fees" version = "0.1.0" authors = ["Nazar Mokrynskyi "] edition = "2021" -license = "Apache-2.0" +license = "0BSD" homepage = "https://subspace.network" repository = "https://github.com/autonomys/subspace" description = "Pallet for charging and re-distributing transaction fees" diff --git a/crates/pallet-transaction-fees/README.md b/crates/pallet-transaction-fees/README.md index cca2c2b954c..46e56374885 100644 --- a/crates/pallet-transaction-fees/README.md +++ b/crates/pallet-transaction-fees/README.md @@ -1,5 +1,3 @@ # Pallet Transaction Fees Pallet for charging and re-distributing transaction fees. - -License: Apache-2.0 diff --git a/crates/pallet-transaction-fees/src/lib.rs b/crates/pallet-transaction-fees/src/lib.rs index 1ec8b9fac4e..cf66d92df99 100644 --- a/crates/pallet-transaction-fees/src/lib.rs +++ b/crates/pallet-transaction-fees/src/lib.rs @@ -1,18 +1,3 @@ -// Copyright (C) 2021 Subspace Labs, Inc. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - //! Pallet for charging and re-distributing transaction fees. #![cfg_attr(not(feature = "std"), no_std)] diff --git a/crates/pallet-transaction-fees/src/weights.rs b/crates/pallet-transaction-fees/src/weights.rs index 7897c2f28ec..e0fa3337c7e 100644 --- a/crates/pallet-transaction-fees/src/weights.rs +++ b/crates/pallet-transaction-fees/src/weights.rs @@ -1,18 +1,3 @@ -// Copyright (C) 2021 Subspace Labs, Inc. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - //! Default weights for the Rewards Pallet //! This file was not auto-generated. diff --git a/crates/sc-consensus-subspace-rpc/Cargo.toml b/crates/sc-consensus-subspace-rpc/Cargo.toml index 5753a6b877d..198ae5a6350 100644 --- a/crates/sc-consensus-subspace-rpc/Cargo.toml +++ b/crates/sc-consensus-subspace-rpc/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["Parity Technologies ", "Subspace Labs "] description = "RPC extensions for the Subspace consensus algorithm" edition = "2021" -license = "GPL-3.0-or-later WITH Classpath-exception-2.0" +license = "0BSD" homepage = "https://subspace.network" repository = "https://github.com/autonomys/subspace" readme = "README.md" diff --git a/crates/sc-consensus-subspace-rpc/README.md b/crates/sc-consensus-subspace-rpc/README.md index 591a505e335..b68db93add6 100644 --- a/crates/sc-consensus-subspace-rpc/README.md +++ b/crates/sc-consensus-subspace-rpc/README.md @@ -1,3 +1 @@ RPC api for Subspace Consensus. - -License: GPL-3.0-or-later WITH Classpath-exception-2.0 diff --git a/crates/sc-consensus-subspace-rpc/src/lib.rs b/crates/sc-consensus-subspace-rpc/src/lib.rs index 0dff89e28ee..c8c5acda1e9 100644 --- a/crates/sc-consensus-subspace-rpc/src/lib.rs +++ b/crates/sc-consensus-subspace-rpc/src/lib.rs @@ -1,20 +1,3 @@ -// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd. -// Copyright (C) 2021 Subspace Labs, Inc. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - //! RPC api for Subspace. #![feature(try_blocks)] diff --git a/crates/sc-consensus-subspace/Cargo.toml b/crates/sc-consensus-subspace/Cargo.toml index 1a1a8ba4f79..9122fa9af64 100644 --- a/crates/sc-consensus-subspace/Cargo.toml +++ b/crates/sc-consensus-subspace/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["Parity Technologies ", "Subspace Labs "] description = "Subspace consensus algorithm for substrate" edition = "2021" -license = "GPL-3.0-or-later WITH Classpath-exception-2.0" +license = "0BSD" homepage = "https://subspace.network" repository = "https://github.com/autonomys/subspace" documentation = "https://docs.rs/sc-consensus-subspace" diff --git a/crates/sc-consensus-subspace/src/archiver.rs b/crates/sc-consensus-subspace/src/archiver.rs index 9344f633bef..c4ed38d2f26 100644 --- a/crates/sc-consensus-subspace/src/archiver.rs +++ b/crates/sc-consensus-subspace/src/archiver.rs @@ -1,19 +1,3 @@ -// Copyright (C) 2021 Subspace Labs, Inc. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - //! Consensus archiver responsible for archival of blockchain history, it is driven by block import //! pipeline. //! @@ -58,7 +42,9 @@ use rand::prelude::*; use rand_chacha::ChaCha8Rng; use rayon::prelude::*; use rayon::ThreadPoolBuilder; -use sc_client_api::{AuxStore, Backend as BackendT, BlockBackend, Finalizer, LockImportRun}; +use sc_client_api::{ + AuxStore, Backend as BackendT, BlockBackend, BlockchainEvents, Finalizer, LockImportRun, +}; use sc_telemetry::{telemetry, TelemetryHandle, CONSENSUS_INFO}; use sc_utils::mpsc::{tracing_unbounded, TracingUnboundedSender}; use sp_api::ProvideRuntimeApi; @@ -830,7 +816,7 @@ where fn finalize_block( client: &Client, - telemetry: Option, + telemetry: Option<&TelemetryHandle>, hash: Block::Hash, number: NumberFor, ) where @@ -916,6 +902,7 @@ where + HeaderBackend + LockImportRun + Finalizer + + BlockchainEvents + AuxStore + Send + Sync @@ -1055,12 +1042,12 @@ where } } + let max_segment_index_before = segment_headers_store.max_segment_index(); (best_archived_block_hash, best_archived_block_number) = archive_block( &mut archiver, segment_headers_store.clone(), &*client, &sync_oracle, - telemetry.clone(), subspace_link.object_mapping_notification_sender.clone(), subspace_link.archived_segment_notification_sender.clone(), best_archived_block_hash, @@ -1068,6 +1055,54 @@ where create_object_mappings, ) .await?; + + let max_segment_index = segment_headers_store.max_segment_index(); + if max_segment_index_before != max_segment_index { + let maybe_block_number_to_finalize = max_segment_index + // Skip last `FINALIZATION_DEPTH_IN_SEGMENTS` archived segments + .and_then(|max_segment_index| { + max_segment_index.checked_sub(FINALIZATION_DEPTH_IN_SEGMENTS) + }) + .and_then(|segment_index| { + segment_headers_store.get_segment_header(segment_index) + }) + .map(|segment_header| segment_header.last_archived_block().number) + // Make sure not to finalize block number that does not yet exist (segment + // headers store may contain future blocks during initial sync) + .map(|block_number| block_number_to_archive.min(block_number.into())) + // Do not finalize blocks twice + .filter(|block_number| *block_number > client.info().finalized_number); + + if let Some(block_number_to_finalize) = maybe_block_number_to_finalize { + { + let mut import_notification = client.every_import_notification_stream(); + + // Drop notification to drop acknowledgement and allow block import to + // proceed + drop(block_importing_notification); + + while let Some(notification) = import_notification.next().await { + // Wait for importing block to finish importing + if notification.header.number() == &importing_block_number { + break; + } + } + } + + // Block is not guaranteed to be present this deep if we have only synced recent + // blocks + if let Some(block_hash_to_finalize) = + client.block_hash(block_number_to_finalize)? + { + finalize_block( + &*client, + telemetry.as_ref(), + block_hash_to_finalize, + block_number_to_finalize, + ); + } + } + } } Ok(()) @@ -1081,7 +1116,6 @@ async fn archive_block( segment_headers_store: SegmentHeadersStore, client: &Client, sync_oracle: &SubspaceSyncOracle, - telemetry: Option, object_mapping_notification_sender: SubspaceNotificationSender, archived_segment_notification_sender: SubspaceNotificationSender, best_archived_block_hash: Block::Hash, @@ -1157,7 +1191,6 @@ where encoded_block.len() as f32 / 1024.0 ); - let mut new_segment_headers = Vec::new(); let block_outcome = archiver.add_block( encoded_block, block_object_mappings, @@ -1175,36 +1208,6 @@ where send_archived_segment_notification(&archived_segment_notification_sender, archived_segment) .await; - - new_segment_headers.push(segment_header); - } - - if !new_segment_headers.is_empty() { - let maybe_block_number_to_finalize = segment_headers_store - .max_segment_index() - // Skip last `FINALIZATION_DEPTH_IN_SEGMENTS` archived segments - .and_then(|max_segment_index| { - max_segment_index.checked_sub(FINALIZATION_DEPTH_IN_SEGMENTS) - }) - .and_then(|segment_index| segment_headers_store.get_segment_header(segment_index)) - .map(|segment_header| segment_header.last_archived_block().number) - // Make sure not to finalize block number that does not yet exist (segment - // headers store may contain future blocks during initial sync) - .map(|block_number| block_number_to_archive.min(block_number.into())) - // Do not finalize blocks twice - .filter(|block_number| *block_number > client.info().finalized_number); - - if let Some(block_number_to_finalize) = maybe_block_number_to_finalize { - // Block is not guaranteed to be present this deep if we have only synced recent blocks - if let Some(block_hash_to_finalize) = client.block_hash(block_number_to_finalize)? { - finalize_block( - client, - telemetry.clone(), - block_hash_to_finalize, - block_number_to_finalize, - ); - } - } } Ok((block_hash_to_archive, block_number_to_archive)) diff --git a/crates/sc-consensus-subspace/src/aux_schema.rs b/crates/sc-consensus-subspace/src/aux_schema.rs index 7f99fda6f11..137d3fb8812 100644 --- a/crates/sc-consensus-subspace/src/aux_schema.rs +++ b/crates/sc-consensus-subspace/src/aux_schema.rs @@ -1,20 +1,3 @@ -// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd. -// Copyright (C) 2021 Subspace Labs, Inc. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - //! Schema for Subspace block weight in the aux-db. use codec::{Decode, Encode}; diff --git a/crates/sc-consensus-subspace/src/block_import.rs b/crates/sc-consensus-subspace/src/block_import.rs index 3e2ebb916f6..820162384da 100644 --- a/crates/sc-consensus-subspace/src/block_import.rs +++ b/crates/sc-consensus-subspace/src/block_import.rs @@ -1,19 +1,3 @@ -// Copyright (C) 2021 Subspace Labs, Inc. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - //! Block import for Subspace, which includes stateful verification and corresponding notifications. //! //! In most cases block import happens after stateless block verification using [`verifier`](crate::verifier), diff --git a/crates/sc-consensus-subspace/src/lib.rs b/crates/sc-consensus-subspace/src/lib.rs index 57211c5c9a1..079534f5dee 100644 --- a/crates/sc-consensus-subspace/src/lib.rs +++ b/crates/sc-consensus-subspace/src/lib.rs @@ -1,19 +1,3 @@ -// Copyright (C) 2021 Subspace Labs, Inc. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - //! `sc-consensus-subspace` is the core of Subspace consensus implementation. //! //! You should familiarize yourself with [Subnomicon](https://subnomicon.subspace.network/) and, ideally, protocol diff --git a/crates/sc-consensus-subspace/src/notification.rs b/crates/sc-consensus-subspace/src/notification.rs index 22992e60e78..023debdb8e2 100644 --- a/crates/sc-consensus-subspace/src/notification.rs +++ b/crates/sc-consensus-subspace/src/notification.rs @@ -1,18 +1,3 @@ -// Copyright (C) 2021 Subspace Labs, Inc. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . //! Utility module for handling Subspace client notifications. use parking_lot::Mutex; diff --git a/crates/sc-consensus-subspace/src/slot_worker.rs b/crates/sc-consensus-subspace/src/slot_worker.rs index 98c06a26a51..1c8bc8e7c74 100644 --- a/crates/sc-consensus-subspace/src/slot_worker.rs +++ b/crates/sc-consensus-subspace/src/slot_worker.rs @@ -1,19 +1,3 @@ -// Copyright (C) 2021 Subspace Labs, Inc. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - //! Slot worker drives block and vote production based on slots produced in [`sc_proof_of_time`]. //! //! While slot worker uses [`sc_consensus_slots`], it is not driven by time, but instead by Proof of diff --git a/crates/sc-consensus-subspace/src/tests.rs b/crates/sc-consensus-subspace/src/tests.rs index 6fc89b98235..30ae1db0378 100644 --- a/crates/sc-consensus-subspace/src/tests.rs +++ b/crates/sc-consensus-subspace/src/tests.rs @@ -1,20 +1,3 @@ -// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd. -// Copyright (C) 2021 Subspace Labs, Inc. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - //! PoC testsuite // TODO: Restore in the future, currently tests are mostly broken and useless diff --git a/crates/sc-domains/Cargo.toml b/crates/sc-domains/Cargo.toml index 47fbf8e7890..f7733810343 100644 --- a/crates/sc-domains/Cargo.toml +++ b/crates/sc-domains/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["Subspace Labs "] description = "Subspace service." edition = "2021" -license = "GPL-3.0-or-later" +license = "0BSD" homepage = "https://subspace.network" repository = "https://github.com/autonomys/subspace" include = [ diff --git a/crates/sc-domains/src/lib.rs b/crates/sc-domains/src/lib.rs index 5413a50f22b..0e96cebe2b6 100644 --- a/crates/sc-domains/src/lib.rs +++ b/crates/sc-domains/src/lib.rs @@ -1,19 +1,3 @@ -// Copyright (C) 2021 Subspace Labs, Inc. -// SPDX-License-Identifier: GPL-3.0-or-later - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - //! Domain specific Host functions and Extension factory use sc_client_api::execution_extensions::ExtensionsFactory as ExtensionsFactoryT; diff --git a/crates/sc-proof-of-time/Cargo.toml b/crates/sc-proof-of-time/Cargo.toml index 1e3394c2f96..e2cfb62a4cf 100644 --- a/crates/sc-proof-of-time/Cargo.toml +++ b/crates/sc-proof-of-time/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "sc-proof-of-time" description = "Subspace proof of time implementation" -license = "MIT OR Apache-2.0" +license = "0BSD" version = "0.1.0" authors = ["Rahul Subramaniyam "] edition = "2021" diff --git a/crates/sc-subspace-block-relay/Cargo.toml b/crates/sc-subspace-block-relay/Cargo.toml index 4bc2671c650..2b373e24305 100644 --- a/crates/sc-subspace-block-relay/Cargo.toml +++ b/crates/sc-subspace-block-relay/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "sc-subspace-block-relay" description = "Block relay implementation" -license = "MIT OR Apache-2.0" +license = "0BSD" version = "0.1.0" authors = ["Rahul Subramaniyam "] edition = "2021" diff --git a/crates/sc-subspace-chain-specs/Cargo.toml b/crates/sc-subspace-chain-specs/Cargo.toml index fb238e47700..d7cffbb13a1 100644 --- a/crates/sc-subspace-chain-specs/Cargo.toml +++ b/crates/sc-subspace-chain-specs/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "sc-subspace-chain-specs" description = "Chain specification data structures tailored for Subspace" -license = "GPL-3.0-or-later WITH Classpath-exception-2.0" +license = "0BSD" version = "0.1.0" authors = ["Nazar Mokrynskyi "] edition = "2021" diff --git a/crates/sc-subspace-chain-specs/src/lib.rs b/crates/sc-subspace-chain-specs/src/lib.rs index 88ec5992f8b..9e797c908b1 100644 --- a/crates/sc-subspace-chain-specs/src/lib.rs +++ b/crates/sc-subspace-chain-specs/src/lib.rs @@ -1,19 +1,3 @@ -// Copyright (C) 2021 Subspace Labs, Inc. -// SPDX-License-Identifier: GPL-3.0-or-later - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - //! Consensus chain specifications for Subspace. /// Devnet chain spec diff --git a/crates/sp-consensus-subspace/Cargo.toml b/crates/sp-consensus-subspace/Cargo.toml index b4b750fc4da..6499304628f 100644 --- a/crates/sp-consensus-subspace/Cargo.toml +++ b/crates/sp-consensus-subspace/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["Parity Technologies ", "Subspace Labs "] description = "Primitives for Subspace consensus" edition = "2021" -license = "Apache-2.0" +license = "0BSD" homepage = "https://subspace.network" repository = "https://github.com/autonomys/subspace" readme = "README.md" diff --git a/crates/sp-consensus-subspace/README.md b/crates/sp-consensus-subspace/README.md index 68159f74824..e7c7a99407d 100644 --- a/crates/sp-consensus-subspace/README.md +++ b/crates/sp-consensus-subspace/README.md @@ -1,3 +1 @@ -Primitives for Subspace Consensus. Based on a fork of `sp_consensus_babe` - -License: Apache-2.0 +Primitives for Subspace Consensus. diff --git a/crates/sp-consensus-subspace/src/digests.rs b/crates/sp-consensus-subspace/src/digests.rs index 1169a45c871..72cbae5a2d6 100644 --- a/crates/sp-consensus-subspace/src/digests.rs +++ b/crates/sp-consensus-subspace/src/digests.rs @@ -1,19 +1,3 @@ -// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd. -// Copyright (C) 2021 Subspace Labs, Inc. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - //! Private implementation details of Subspace consensus digests. use crate::{ConsensusLog, PotParametersChange, SUBSPACE_ENGINE_ID}; diff --git a/crates/sp-consensus-subspace/src/inherents.rs b/crates/sp-consensus-subspace/src/inherents.rs index 402f3b45507..1a8825e24bb 100644 --- a/crates/sp-consensus-subspace/src/inherents.rs +++ b/crates/sp-consensus-subspace/src/inherents.rs @@ -1,19 +1,3 @@ -// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd. -// Copyright (C) 2021 Subspace Labs, Inc. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - //! Inherents for Subspace consensus #[cfg(not(feature = "std"))] diff --git a/crates/sp-consensus-subspace/src/lib.rs b/crates/sp-consensus-subspace/src/lib.rs index d3271eb9072..6d4c6e5c71c 100644 --- a/crates/sp-consensus-subspace/src/lib.rs +++ b/crates/sp-consensus-subspace/src/lib.rs @@ -1,19 +1,3 @@ -// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd. -// Copyright (C) 2021 Subspace Labs, Inc. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - //! Primitives for Subspace consensus. #![forbid(unsafe_code, missing_docs)] diff --git a/crates/sp-domains-fraud-proof/Cargo.toml b/crates/sp-domains-fraud-proof/Cargo.toml index 08a8d1c584f..9474e28deab 100644 --- a/crates/sp-domains-fraud-proof/Cargo.toml +++ b/crates/sp-domains-fraud-proof/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "sp-domains-fraud-proof" description = "Domains fraud proof primitves for Consensus chain" -license = "GPL-3.0-or-later WITH Classpath-exception-2.0" +license = "0BSD" version = "0.1.0" authors = ["Subspace Labs "] edition = "2021" diff --git a/crates/sp-domains-fraud-proof/src/lib.rs b/crates/sp-domains-fraud-proof/src/lib.rs index e62b88e2201..69d4a0debaf 100644 --- a/crates/sp-domains-fraud-proof/src/lib.rs +++ b/crates/sp-domains-fraud-proof/src/lib.rs @@ -1,19 +1,3 @@ -// Copyright (C) 2022 Subspace Labs, Inc. -// SPDX-License-Identifier: GPL-3.0-or-later - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - //! Subspace fraud proof primitives for consensus chain. #![cfg_attr(not(feature = "std"), no_std)] // `generic_const_exprs` is an incomplete feature diff --git a/crates/sp-domains-fraud-proof/src/storage_proof.rs b/crates/sp-domains-fraud-proof/src/storage_proof.rs index d1fb32d88d7..d30864ca65e 100644 --- a/crates/sp-domains-fraud-proof/src/storage_proof.rs +++ b/crates/sp-domains-fraud-proof/src/storage_proof.rs @@ -369,7 +369,7 @@ impl MaybeDomainRuntimeUpgradedProof { } #[derive(Clone, Debug, Decode, Encode, Eq, PartialEq, TypeInfo)] -pub struct InvalidInherentExtrinsicData { +pub struct InherentExtrinsicData { /// Extrinsics shuffling seed, derived from block randomness pub extrinsics_shuffling_seed: Randomness, @@ -380,7 +380,7 @@ pub struct InvalidInherentExtrinsicData { pub consensus_transaction_byte_fee: Balance, } -impl PassBy for InvalidInherentExtrinsicData { +impl PassBy for InherentExtrinsicData { type PassBy = pass_by::Codec; } @@ -389,7 +389,7 @@ pub struct InvalidInherentExtrinsicDataProof(StorageProof); impl_storage_proof!(InvalidInherentExtrinsicDataProof); impl BasicStorageProof for InvalidInherentExtrinsicDataProof { - type StorageValue = InvalidInherentExtrinsicData; + type StorageValue = InherentExtrinsicData; fn storage_key_request(_key: Self::Key) -> FraudProofStorageKeyRequest> { FraudProofStorageKeyRequest::InvalidInherentExtrinsicData } diff --git a/crates/sp-domains/Cargo.toml b/crates/sp-domains/Cargo.toml index 2b485d98cdc..96d9a4351bb 100644 --- a/crates/sp-domains/Cargo.toml +++ b/crates/sp-domains/Cargo.toml @@ -3,7 +3,7 @@ name = "sp-domains" version = "0.1.0" authors = ["Subspace Labs "] edition = "2021" -license = "Apache-2.0" +license = "0BSD" homepage = "https://subspace.network" repository = "https://github.com/autonomys/subspace" description = "Primitives of domains pallet" diff --git a/crates/sp-domains/src/extrinsics.rs b/crates/sp-domains/src/extrinsics.rs index 896a0d231a6..8d84bc561c2 100644 --- a/crates/sp-domains/src/extrinsics.rs +++ b/crates/sp-domains/src/extrinsics.rs @@ -1,11 +1,9 @@ #[cfg(not(feature = "std"))] extern crate alloc; -use crate::DOMAIN_EXTRINSICS_SHUFFLING_SEED_SUBJECT; #[cfg(not(feature = "std"))] use alloc::vec::Vec; use domain_runtime_primitives::opaque::AccountId; -use hash_db::Hasher; use rand::seq::SliceRandom; use rand::SeedableRng; use rand_chacha::ChaCha8Rng; @@ -15,15 +13,6 @@ use sp_std::collections::vec_deque::VecDeque; use sp_std::fmt::Debug; use subspace_core_primitives::Randomness; -pub fn extrinsics_shuffling_seed(block_randomness: Randomness) -> Hashing::Out -where - Hashing: Hasher, -{ - let mut subject = DOMAIN_EXTRINSICS_SHUFFLING_SEED_SUBJECT.to_vec(); - subject.extend_from_slice(block_randomness.as_ref()); - Hashing::hash(&subject) -} - pub fn deduplicate_and_shuffle_extrinsics( mut extrinsics: Vec<(Option, Extrinsic)>, shuffling_seed: Randomness, diff --git a/crates/sp-domains/src/lib.rs b/crates/sp-domains/src/lib.rs index 3645ace4ee7..483d9e2dba3 100644 --- a/crates/sp-domains/src/lib.rs +++ b/crates/sp-domains/src/lib.rs @@ -1,18 +1,3 @@ -// Copyright (C) 2021 Subspace Labs, Inc. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - //! Primitives for domains pallet. #![cfg_attr(not(feature = "std"), no_std)] @@ -1470,8 +1455,9 @@ pub enum OperatorRewardSource { sp_api::decl_runtime_apis! { /// APIs used to access the domains pallet. // When updating this version, document new APIs with "Only present in API versions" comments. - // TODO: when removing this version, also remove "Only present in API versions" comments. - #[api_version(2)] + // TODO: when removing this version, also remove "Only present in API versions" comments and + // deprecated attributes. + #[api_version(3)] pub trait DomainsApi { /// Submits the transaction bundle via an unsigned extrinsic. fn submit_bundle_unsigned(opaque_bundle: OpaqueBundle, Block::Hash, DomainHeader, Balance>); @@ -1502,8 +1488,23 @@ sp_api::decl_runtime_apis! { fn domain_instance_data(domain_id: DomainId) -> Option<(DomainInstanceData, NumberFor)>; /// Returns the current timestamp at the current height. + fn domain_timestamp() -> Moment; + + /// Returns the current timestamp at the current height. + #[allow(clippy::deprecated_semver)] + #[deprecated(since = "3", note = "Use `domain_timestamp()` instead")] fn timestamp() -> Moment; + /// Returns the consensus transaction byte fee that will used to charge the domain + /// transaction for consensus chain storage fees. + fn consensus_transaction_byte_fee() -> Balance; + + /// Returns the consensus chain byte fee that will used to charge the domain transaction + /// for consensus chain storage fees. + #[allow(clippy::deprecated_semver)] + #[deprecated(since = "3", note = "Use `consensus_transaction_byte_fee()` instead")] + fn consensus_chain_byte_fee() -> Balance; + /// Returns the current Tx range for the given domain Id. fn domain_tx_range(domain_id: DomainId) -> U256; @@ -1534,10 +1535,6 @@ sp_api::decl_runtime_apis! { /// Returns the execution receipt hash of the given domain and domain block number. fn receipt_hash(domain_id: DomainId, domain_number: HeaderNumberFor) -> Option>; - /// Returns the consensus chain byte fee that will used to charge the domain transaction for consensus - /// chain storage fees. - fn consensus_chain_byte_fee() -> Balance; - /// Returns the latest confirmed domain block number and hash. fn latest_confirmed_domain_block(domain_id: DomainId) -> Option<(HeaderNumberFor, HeaderHashFor)>; diff --git a/crates/sp-objects/Cargo.toml b/crates/sp-objects/Cargo.toml index aa6fb0322b7..e159212a873 100644 --- a/crates/sp-objects/Cargo.toml +++ b/crates/sp-objects/Cargo.toml @@ -3,7 +3,7 @@ name = "sp-objects" version = "0.1.0" authors = ["Vedhavyas Singareddi "] edition = "2021" -license = "Apache-2.0" +license = "0BSD" homepage = "https://subspace.network" repository = "https://github.com/autonomys/subspace" description = "Primitives for Objects" diff --git a/crates/sp-objects/src/lib.rs b/crates/sp-objects/src/lib.rs index e36dec23a91..26ab47a04fc 100644 --- a/crates/sp-objects/src/lib.rs +++ b/crates/sp-objects/src/lib.rs @@ -1,18 +1,3 @@ -// Copyright (C) 2021 Subspace Labs, Inc. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - //! Primitives for Objects. #![cfg_attr(not(feature = "std"), no_std)] diff --git a/crates/sp-subspace-mmr/Cargo.toml b/crates/sp-subspace-mmr/Cargo.toml index 7e49038985c..e7ab6ae8a5b 100644 --- a/crates/sp-subspace-mmr/Cargo.toml +++ b/crates/sp-subspace-mmr/Cargo.toml @@ -3,7 +3,7 @@ name = "sp-subspace-mmr" homepage = "https://subspace.network" repository = "https://github.com/autonomys/subspace" description = "Primitives for Subspace MMR" -license = "GPL-3.0-or-later WITH Classpath-exception-2.0" +license = "0BSD" version = "0.1.0" authors = ["Subspace Labs "] edition = "2021" diff --git a/crates/sp-subspace-mmr/src/lib.rs b/crates/sp-subspace-mmr/src/lib.rs index 7b11c65c2d7..53b67ca6448 100644 --- a/crates/sp-subspace-mmr/src/lib.rs +++ b/crates/sp-subspace-mmr/src/lib.rs @@ -1,18 +1,3 @@ -// Copyright (C) 2021 Subspace Labs, Inc. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - //! Primitives for Subspace MMR. #![cfg_attr(not(feature = "std"), no_std)] diff --git a/crates/subspace-archiving/Cargo.toml b/crates/subspace-archiving/Cargo.toml index 41bc6dcfc89..f58091c70cc 100644 --- a/crates/subspace-archiving/Cargo.toml +++ b/crates/subspace-archiving/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "subspace-archiving" description = "Collection of modules used for dealing with archived state of Subspace Network" -license = "Apache-2.0" +license = "0BSD" version = "0.1.0" authors = ["Nazar Mokrynskyi "] edition = "2021" diff --git a/crates/subspace-archiving/src/archiver.rs b/crates/subspace-archiving/src/archiver.rs index 923ea8cf0bc..f45e7890dcf 100644 --- a/crates/subspace-archiving/src/archiver.rs +++ b/crates/subspace-archiving/src/archiver.rs @@ -1,18 +1,3 @@ -// Copyright (C) 2021 Subspace Labs, Inc. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - mod incremental_record_commitments; extern crate alloc; diff --git a/crates/subspace-archiving/src/lib.rs b/crates/subspace-archiving/src/lib.rs index eb19b2b6228..a1405e03a52 100644 --- a/crates/subspace-archiving/src/lib.rs +++ b/crates/subspace-archiving/src/lib.rs @@ -1,18 +1,3 @@ -// Copyright (C) 2021 Subspace Labs, Inc. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - //! Collection of modules used for dealing with archived state of Subspace Network. #![cfg_attr(not(feature = "std"), no_std)] #![feature(array_chunks, extract_if, iter_collect_into)] diff --git a/crates/subspace-core-primitives/Cargo.toml b/crates/subspace-core-primitives/Cargo.toml index 80f3efb0381..006b03dcb9d 100644 --- a/crates/subspace-core-primitives/Cargo.toml +++ b/crates/subspace-core-primitives/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "subspace-core-primitives" description = "Core primitives for Subspace Network" -license = "Apache-2.0" +license = "0BSD" version = "0.1.0" authors = ["Nazar Mokrynskyi "] edition = "2021" diff --git a/crates/subspace-core-primitives/src/hashes.rs b/crates/subspace-core-primitives/src/hashes.rs index 80b3c328519..919c9672e8a 100644 --- a/crates/subspace-core-primitives/src/hashes.rs +++ b/crates/subspace-core-primitives/src/hashes.rs @@ -1,18 +1,3 @@ -// Copyright (C) 2021 Subspace Labs, Inc. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - //! Hashes-related data structures and functions. use crate::ScalarBytes; diff --git a/crates/subspace-core-primitives/src/lib.rs b/crates/subspace-core-primitives/src/lib.rs index 0b9d0eb7ea3..bc2603bd15b 100644 --- a/crates/subspace-core-primitives/src/lib.rs +++ b/crates/subspace-core-primitives/src/lib.rs @@ -1,18 +1,3 @@ -// Copyright (C) 2021 Subspace Labs, Inc. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - //! Core primitives for Subspace Network. #![cfg_attr(not(feature = "std"), no_std)] diff --git a/crates/subspace-core-primitives/src/objects.rs b/crates/subspace-core-primitives/src/objects.rs index 467e5a7f805..2814e9afede 100644 --- a/crates/subspace-core-primitives/src/objects.rs +++ b/crates/subspace-core-primitives/src/objects.rs @@ -1,18 +1,3 @@ -// Copyright (C) 2021 Subspace Labs, Inc. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - //! Data structures related to objects (useful data) stored on Subspace Network. //! //! There are two kinds of mappings: diff --git a/crates/subspace-erasure-coding/Cargo.toml b/crates/subspace-erasure-coding/Cargo.toml index 39416f1c341..34ae39dd2c4 100644 --- a/crates/subspace-erasure-coding/Cargo.toml +++ b/crates/subspace-erasure-coding/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "subspace-erasure-coding" description = "Polynomial erasure coding implementation used in Subspace Network" -license = "Apache-2.0" +license = "0BSD" version = "0.1.0" authors = ["Nazar Mokrynskyi "] edition = "2021" diff --git a/crates/subspace-fake-runtime-api/Cargo.toml b/crates/subspace-fake-runtime-api/Cargo.toml index 2853b930cbf..0fc94e328a0 100644 --- a/crates/subspace-fake-runtime-api/Cargo.toml +++ b/crates/subspace-fake-runtime-api/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["Subspace Labs "] description = "Fake subspace runtime API." edition = "2021" -license = "GPL-3.0-or-later" +license = "0BSD" homepage = "https://subspace.network" repository = "https://github.com/autonomys/subspace" include = ["/src", "/Cargo.toml"] diff --git a/crates/subspace-fake-runtime-api/src/lib.rs b/crates/subspace-fake-runtime-api/src/lib.rs index 5c3f63b8b50..6ddfe888683 100644 --- a/crates/subspace-fake-runtime-api/src/lib.rs +++ b/crates/subspace-fake-runtime-api/src/lib.rs @@ -1,19 +1,3 @@ -// Copyright (C) 2021 Subspace Labs, Inc. -// SPDX-License-Identifier: GPL-3.0-or-later - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - //! Provides "fake" runtime API implementation as a workaround for compile-time checks. use domain_runtime_primitives::opaque::Header as DomainHeader; @@ -218,7 +202,19 @@ sp_api::impl_runtime_apis! { unreachable!() } - fn timestamp() -> Moment{ + fn domain_timestamp() -> Moment { + unreachable!() + } + + fn timestamp() -> Moment { + unreachable!() + } + + fn consensus_transaction_byte_fee() -> Balance { + unreachable!() + } + + fn consensus_chain_byte_fee() -> Balance { unreachable!() } @@ -262,10 +258,6 @@ sp_api::impl_runtime_apis! { unreachable!() } - fn consensus_chain_byte_fee() -> Balance { - unreachable!() - } - fn latest_confirmed_domain_block(_domain_id: DomainId) -> Option<(DomainNumber, DomainHash)>{ unreachable!() } diff --git a/crates/subspace-farmer-components/Cargo.toml b/crates/subspace-farmer-components/Cargo.toml index 6e6e64de7b0..296a2c2497f 100644 --- a/crates/subspace-farmer-components/Cargo.toml +++ b/crates/subspace-farmer-components/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "subspace-farmer-components" description = "Farmer for the Subspace Network Blockchain" -license = "MIT OR Apache-2.0" +license = "0BSD" version = "0.1.0" authors = ["Nazar Mokrynskyi "] edition = "2021" diff --git a/crates/subspace-farmer/Cargo.toml b/crates/subspace-farmer/Cargo.toml index bff753a07f3..4fbc6f2762b 100644 --- a/crates/subspace-farmer/Cargo.toml +++ b/crates/subspace-farmer/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "subspace-farmer" description = "Farmer for the Subspace Network Blockchain" -license = "MIT OR Apache-2.0" +license = "0BSD" version = "0.1.0" authors = ["Nazar Mokrynskyi "] edition = "2021" diff --git a/crates/subspace-farmer/src/bin/subspace-farmer/commands/cluster/controller.rs b/crates/subspace-farmer/src/bin/subspace-farmer/commands/cluster/controller.rs index 8757b14f788..3ab81d3c178 100644 --- a/crates/subspace-farmer/src/bin/subspace-farmer/commands/cluster/controller.rs +++ b/crates/subspace-farmer/src/bin/subspace-farmer/commands/cluster/controller.rs @@ -205,7 +205,7 @@ pub(super) async fn controller( ); let fut = farmer_cache_worker - .run(piece_getter.downgrade()) + .run(piece_getter) .instrument(info_span!("", %cache_group)); async move { 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 cb7b4189293..14acaa5f1e6 100644 --- a/crates/subspace-farmer/src/bin/subspace-farmer/commands/farm.rs +++ b/crates/subspace-farmer/src/bin/subspace-farmer/commands/farm.rs @@ -487,6 +487,9 @@ where let farmer_cache_worker_fut = run_future_in_dedicated_thread( { + // Piece cache worker uses piece getter, while piece getter uses piece cache, which + // piece cache worker depends on. Use weak reference to break the cycle and allow worker + // to exit when last piece cache instance is dropped. let future = farmer_cache_worker.run(piece_getter.downgrade()); move || future diff --git a/crates/subspace-farmer/src/utils/ss58.rs b/crates/subspace-farmer/src/utils/ss58.rs index 6d532ad9881..52c66ded7c9 100644 --- a/crates/subspace-farmer/src/utils/ss58.rs +++ b/crates/subspace-farmer/src/utils/ss58.rs @@ -1,19 +1,3 @@ -// Copyright (C) 2017-2022 Parity Technologies (UK) Ltd. -// Copyright (C) 2022 Subspace Labs, Inc. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - //! Modified version of SS58 parser extracted from Substrate in order to not pull the whole //! `sp-core` into farmer application diff --git a/crates/subspace-gateway-rpc/Cargo.toml b/crates/subspace-gateway-rpc/Cargo.toml index b8ed9081f3e..145df1fcf52 100644 --- a/crates/subspace-gateway-rpc/Cargo.toml +++ b/crates/subspace-gateway-rpc/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["Teor "] description = "A Subspace Network data gateway." edition = "2021" -license = "MIT OR Apache-2.0" +license = "0BSD" homepage = "https://subspace.network" repository = "https://github.com/autonomys/subspace" diff --git a/crates/subspace-gateway/Cargo.toml b/crates/subspace-gateway/Cargo.toml index 3127b26d067..024a6d4caf5 100644 --- a/crates/subspace-gateway/Cargo.toml +++ b/crates/subspace-gateway/Cargo.toml @@ -7,7 +7,7 @@ authors = [ ] description = "A Subspace Network data gateway." edition = "2021" -license = "MIT OR Apache-2.0" +license = "0BSD" homepage = "https://subspace.network" repository = "https://github.com/autonomys/subspace" include = [ diff --git a/crates/subspace-malicious-operator/Cargo.toml b/crates/subspace-malicious-operator/Cargo.toml index 420eaaa3854..6628698867b 100644 --- a/crates/subspace-malicious-operator/Cargo.toml +++ b/crates/subspace-malicious-operator/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["Subspace Labs "] description = "A Subspace Network Blockchain node." edition = "2021" -license = "GPL-3.0-or-later" +license = "0BSD" build = "build.rs" homepage = "https://subspace.network" repository = "https://github.com/autonomys/subspace" diff --git a/crates/subspace-malicious-operator/build.rs b/crates/subspace-malicious-operator/build.rs index e69d6d8b7a5..f9d839f9be3 100644 --- a/crates/subspace-malicious-operator/build.rs +++ b/crates/subspace-malicious-operator/build.rs @@ -1,19 +1,3 @@ -// Copyright (C) 2023 Subspace Labs, Inc. -// SPDX-License-Identifier: GPL-3.0-or-later - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - use substrate_build_script_utils::{generate_cargo_keys, rerun_if_git_head_changed}; fn main() { diff --git a/crates/subspace-malicious-operator/src/bin/subspace-malicious-operator.rs b/crates/subspace-malicious-operator/src/bin/subspace-malicious-operator.rs index 7727865a2a2..5ca70c6ef06 100644 --- a/crates/subspace-malicious-operator/src/bin/subspace-malicious-operator.rs +++ b/crates/subspace-malicious-operator/src/bin/subspace-malicious-operator.rs @@ -1,19 +1,3 @@ -// Copyright (C) 2023 Subspace Labs, Inc. -// SPDX-License-Identifier: GPL-3.0-or-later - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - //! Subspace malicious operator node. #![feature(trait_upcasting)] diff --git a/crates/subspace-malicious-operator/src/lib.rs b/crates/subspace-malicious-operator/src/lib.rs index bd860bd3f42..8f2c26521fe 100644 --- a/crates/subspace-malicious-operator/src/lib.rs +++ b/crates/subspace-malicious-operator/src/lib.rs @@ -1,19 +1,3 @@ -// Copyright (C) 2023 Subspace Labs, Inc. -// SPDX-License-Identifier: GPL-3.0-or-later - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - //! Subspace malicious operator library. mod chain_spec; diff --git a/crates/subspace-networking/Cargo.toml b/crates/subspace-networking/Cargo.toml index 1f6184dbb88..6fde5204bb1 100644 --- a/crates/subspace-networking/Cargo.toml +++ b/crates/subspace-networking/Cargo.toml @@ -7,7 +7,7 @@ authors = [ ] description = "Networking functionality of Subspace Network, primarily used for DSN (Distributed Storage Network)" edition = "2021" -license = "Apache-2.0" +license = "0BSD" homepage = "https://subspace.network" repository = "https://github.com/autonomys/subspace" include = [ diff --git a/crates/subspace-networking/src/lib.rs b/crates/subspace-networking/src/lib.rs index b13554da37b..bc0bdc59a47 100644 --- a/crates/subspace-networking/src/lib.rs +++ b/crates/subspace-networking/src/lib.rs @@ -1,18 +1,3 @@ -// Copyright (C) 2021 Subspace Labs, Inc. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - //! Networking functionality of Subspace Network, primarily used for DSN (Distributed Storage //! Network). diff --git a/crates/subspace-networking/src/protocols/request_response/handlers/generic_request_handler.rs b/crates/subspace-networking/src/protocols/request_response/handlers/generic_request_handler.rs index a61c1c66618..3c298418ebe 100644 --- a/crates/subspace-networking/src/protocols/request_response/handlers/generic_request_handler.rs +++ b/crates/subspace-networking/src/protocols/request_response/handlers/generic_request_handler.rs @@ -1,19 +1,3 @@ -// Copyright (C) 2020-2022 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - //! Generic request-response handler, typically is used with a type implementing [`GenericRequest`] //! to significantly reduce boilerplate when implementing [`RequestHandler`]. diff --git a/crates/subspace-node/Cargo.toml b/crates/subspace-node/Cargo.toml index 0d0ad438feb..0acd2a2b503 100644 --- a/crates/subspace-node/Cargo.toml +++ b/crates/subspace-node/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["Subspace Labs "] description = "A Subspace Network Blockchain node." edition = "2021" -license = "GPL-3.0-or-later" +license = "0BSD" build = "build.rs" homepage = "https://subspace.network" repository = "https://github.com/autonomys/subspace" diff --git a/crates/subspace-node/build.rs b/crates/subspace-node/build.rs index 3adcb976907..f9d839f9be3 100644 --- a/crates/subspace-node/build.rs +++ b/crates/subspace-node/build.rs @@ -1,19 +1,3 @@ -// Copyright (C) 2021 Subspace Labs, Inc. -// SPDX-License-Identifier: GPL-3.0-or-later - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - use substrate_build_script_utils::{generate_cargo_keys, rerun_if_git_head_changed}; fn main() { diff --git a/crates/subspace-node/src/chain_spec.rs b/crates/subspace-node/src/chain_spec.rs index 8cf80065b84..066eda37e21 100644 --- a/crates/subspace-node/src/chain_spec.rs +++ b/crates/subspace-node/src/chain_spec.rs @@ -1,19 +1,3 @@ -// Copyright (C) 2021 Subspace Labs, Inc. -// SPDX-License-Identifier: GPL-3.0-or-later - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - //! Subspace chain configurations. use crate::chain_spec_utils::{chain_spec_properties, get_account_id_from_seed}; diff --git a/crates/subspace-node/src/cli.rs b/crates/subspace-node/src/cli.rs index a17768c9991..131ef2c3088 100644 --- a/crates/subspace-node/src/cli.rs +++ b/crates/subspace-node/src/cli.rs @@ -1,19 +1,3 @@ -// Copyright (C) 2021 Subspace Labs, Inc. -// SPDX-License-Identifier: GPL-3.0-or-later - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - use crate::chain_spec; use crate::commands::{RunOptions, WipeOptions}; use clap::Parser; diff --git a/crates/subspace-node/src/domain.rs b/crates/subspace-node/src/domain.rs index 3b08441c67c..fc4c850d842 100644 --- a/crates/subspace-node/src/domain.rs +++ b/crates/subspace-node/src/domain.rs @@ -1,19 +1,3 @@ -// Copyright (C) 2023 Subspace Labs, Inc. -// SPDX-License-Identifier: GPL-3.0-or-later - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - pub mod auto_id_chain_spec; pub(crate) mod cli; pub mod evm_chain_spec; diff --git a/crates/subspace-node/src/domain/auto_id_chain_spec.rs b/crates/subspace-node/src/domain/auto_id_chain_spec.rs index 38c64422fe5..c1be4e9c543 100644 --- a/crates/subspace-node/src/domain/auto_id_chain_spec.rs +++ b/crates/subspace-node/src/domain/auto_id_chain_spec.rs @@ -1,19 +1,3 @@ -// Copyright (C) 2023 Subspace Labs, Inc. -// SPDX-License-Identifier: GPL-3.0-or-later - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - //! AutoId domain configurations. use crate::chain_spec_utils::{ diff --git a/crates/subspace-node/src/domain/cli.rs b/crates/subspace-node/src/domain/cli.rs index e057764d9bb..fd1bace1a6b 100644 --- a/crates/subspace-node/src/domain/cli.rs +++ b/crates/subspace-node/src/domain/cli.rs @@ -1,19 +1,3 @@ -// Copyright (C) 2021 Subspace Labs, Inc. -// SPDX-License-Identifier: GPL-3.0-or-later - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - use crate::commands::{CreateDomainKeyOptions, InsertDomainKeyOptions}; use crate::domain::{auto_id_chain_spec, evm_chain_spec}; use clap::{Parser, ValueEnum}; diff --git a/crates/subspace-node/src/domain/evm_chain_spec.rs b/crates/subspace-node/src/domain/evm_chain_spec.rs index 7759be43705..9132f531fb2 100644 --- a/crates/subspace-node/src/domain/evm_chain_spec.rs +++ b/crates/subspace-node/src/domain/evm_chain_spec.rs @@ -1,19 +1,3 @@ -// Copyright (C) 2023 Subspace Labs, Inc. -// SPDX-License-Identifier: GPL-3.0-or-later - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - //! EVM domain configurations. use crate::chain_spec_utils::{chain_spec_properties, get_public_key_from_seed}; diff --git a/crates/subspace-node/src/main.rs b/crates/subspace-node/src/main.rs index c0bb9c7260e..d7e1d4ae2ab 100644 --- a/crates/subspace-node/src/main.rs +++ b/crates/subspace-node/src/main.rs @@ -1,19 +1,3 @@ -// Copyright (C) 2021 Subspace Labs, Inc. -// SPDX-License-Identifier: GPL-3.0-or-later - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - //! Subspace node implementation. #![feature(trait_upcasting)] diff --git a/crates/subspace-proof-of-space/Cargo.toml b/crates/subspace-proof-of-space/Cargo.toml index fad67cf1238..20140410932 100644 --- a/crates/subspace-proof-of-space/Cargo.toml +++ b/crates/subspace-proof-of-space/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "subspace-proof-of-space" description = "Subspace proof of space implementation based on Chia" -license = "Apache-2.0" +license = "0BSD" version = "0.1.0" authors = ["Nazar Mokrynskyi "] edition = "2021" diff --git a/crates/subspace-proof-of-time/Cargo.toml b/crates/subspace-proof-of-time/Cargo.toml index 1ad6bcfea0a..f418dad0d7e 100644 --- a/crates/subspace-proof-of-time/Cargo.toml +++ b/crates/subspace-proof-of-time/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "subspace-proof-of-time" description = "Subspace proof of time implementation" -license = "Apache-2.0" +license = "0BSD" version = "0.1.0" authors = ["Rahul Subramaniyam "] edition = "2021" diff --git a/crates/subspace-rpc-primitives/Cargo.toml b/crates/subspace-rpc-primitives/Cargo.toml index 0647b0d4ca5..c5575066223 100644 --- a/crates/subspace-rpc-primitives/Cargo.toml +++ b/crates/subspace-rpc-primitives/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["Subspace Labs "] description = "RPC primitives for Subspace Network" edition = "2021" -license = "Apache-2.0" +license = "0BSD" homepage = "https://subspace.network" repository = "https://github.com/autonomys/subspace" include = [ diff --git a/crates/subspace-rpc-primitives/src/lib.rs b/crates/subspace-rpc-primitives/src/lib.rs index 319e37e12dd..d7c31646b1c 100644 --- a/crates/subspace-rpc-primitives/src/lib.rs +++ b/crates/subspace-rpc-primitives/src/lib.rs @@ -1,18 +1,3 @@ -// Copyright (C) 2021 Subspace Labs, Inc. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - //! Primitives for Subspace RPC. use parity_scale_codec::{Decode, Encode, EncodeLike, Input, Output}; diff --git a/crates/subspace-runtime-primitives/Cargo.toml b/crates/subspace-runtime-primitives/Cargo.toml index 29d4eaadaee..8bccfae0a01 100644 --- a/crates/subspace-runtime-primitives/Cargo.toml +++ b/crates/subspace-runtime-primitives/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "subspace-runtime-primitives" description = "Runtime primitives for Subspace Network" -license = "GPL-3.0-or-later" +license = "0BSD" version = "0.1.0" authors = ["Subspace Labs "] edition = "2021" diff --git a/crates/subspace-runtime-primitives/src/lib.rs b/crates/subspace-runtime-primitives/src/lib.rs index f29e9e28e69..1a89c1ca1da 100644 --- a/crates/subspace-runtime-primitives/src/lib.rs +++ b/crates/subspace-runtime-primitives/src/lib.rs @@ -1,19 +1,3 @@ -// Copyright (C) 2021 Subspace Labs, Inc. -// SPDX-License-Identifier: GPL-3.0-or-later - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - //! Runtime primitives for Subspace Network. #![cfg_attr(not(feature = "std"), no_std)] diff --git a/crates/subspace-runtime/Cargo.toml b/crates/subspace-runtime/Cargo.toml index 2a1a40bf7cb..7a91479f0ae 100644 --- a/crates/subspace-runtime/Cargo.toml +++ b/crates/subspace-runtime/Cargo.toml @@ -3,7 +3,7 @@ name = "subspace-runtime" version = "0.1.0" authors = ["Subspace Labs "] edition = "2021" -license = "GPL-3.0-or-later" +license = "0BSD" homepage = "https://subspace.network" repository = "https://github.com/autonomys/subspace" include = [ diff --git a/crates/subspace-runtime/build.rs b/crates/subspace-runtime/build.rs index e2217a8dda5..8f021e8381d 100644 --- a/crates/subspace-runtime/build.rs +++ b/crates/subspace-runtime/build.rs @@ -1,19 +1,3 @@ -// Copyright (C) 2021 Subspace Labs, Inc. -// SPDX-License-Identifier: GPL-3.0-or-later - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - fn main() { #[cfg(feature = "std")] { diff --git a/crates/subspace-runtime/src/lib.rs b/crates/subspace-runtime/src/lib.rs index 4a1789167a5..f0ac27b2584 100644 --- a/crates/subspace-runtime/src/lib.rs +++ b/crates/subspace-runtime/src/lib.rs @@ -1,19 +1,3 @@ -// Copyright (C) 2021 Subspace Labs, Inc. -// SPDX-License-Identifier: GPL-3.0-or-later - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - #![cfg_attr(not(feature = "std"), no_std)] #![feature(const_trait_impl, variant_count)] // `generic_const_exprs` is an incomplete feature @@ -1038,7 +1022,7 @@ impl FraudProofStorageKeyProvider> for StorageKeyProvider { fn storage_key(req: FraudProofStorageKeyRequest>) -> Vec { match req { FraudProofStorageKeyRequest::InvalidInherentExtrinsicData => { - pallet_domains::BlockInvalidInherentExtrinsicData::::hashed_key().to_vec() + pallet_domains::BlockInherentExtrinsicData::::hashed_key().to_vec() } FraudProofStorageKeyRequest::SuccessfulBundles(domain_id) => { pallet_domains::SuccessfulBundles::::hashed_key_for(domain_id) @@ -1278,10 +1262,22 @@ impl_runtime_apis! { Domains::domain_instance_data(domain_id) } - fn timestamp() -> Moment{ + fn domain_timestamp() -> Moment { + Domains::timestamp() + } + + fn timestamp() -> Moment { Timestamp::now() } + fn consensus_transaction_byte_fee() -> Balance { + Domains::consensus_transaction_byte_fee() + } + + fn consensus_chain_byte_fee() -> Balance { + DOMAIN_STORAGE_FEE_MULTIPLIER * TransactionFees::transaction_byte_fee() + } + fn domain_tx_range(domain_id: DomainId) -> U256 { Domains::domain_tx_range(domain_id) } @@ -1325,10 +1321,6 @@ impl_runtime_apis! { Domains::receipt_hash(domain_id, domain_number) } - fn consensus_chain_byte_fee() -> Balance { - DOMAIN_STORAGE_FEE_MULTIPLIER * TransactionFees::transaction_byte_fee() - } - fn latest_confirmed_domain_block(domain_id: DomainId) -> Option<(DomainNumber, DomainHash)>{ Domains::latest_confirmed_domain_block(domain_id) } diff --git a/crates/subspace-service/Cargo.toml b/crates/subspace-service/Cargo.toml index b3397a7f721..28c5e1562e6 100644 --- a/crates/subspace-service/Cargo.toml +++ b/crates/subspace-service/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["Subspace Labs "] description = "Subspace service." edition = "2021" -license = "GPL-3.0-or-later" +license = "0BSD" homepage = "https://subspace.network" repository = "https://github.com/autonomys/subspace" include = [ diff --git a/crates/subspace-service/src/lib.rs b/crates/subspace-service/src/lib.rs index e94734a8526..59156d21b33 100644 --- a/crates/subspace-service/src/lib.rs +++ b/crates/subspace-service/src/lib.rs @@ -1,19 +1,3 @@ -// Copyright (C) 2021 Subspace Labs, Inc. -// SPDX-License-Identifier: GPL-3.0-or-later - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - //! Service and ServiceFactory implementation. Specialized wrapper over substrate service. #![feature( duration_constructors, diff --git a/crates/subspace-service/src/rpc.rs b/crates/subspace-service/src/rpc.rs index 9b10d806491..01037529554 100644 --- a/crates/subspace-service/src/rpc.rs +++ b/crates/subspace-service/src/rpc.rs @@ -1,19 +1,3 @@ -// Copyright (C) 2021 Subspace Labs, Inc. -// SPDX-License-Identifier: GPL-3.0-or-later - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - //! A collection of node-specific RPC methods. //! //! Substrate provides the `sc-rpc` crate, which defines the core RPC layer diff --git a/crates/subspace-service/src/sync_from_dsn/import_blocks.rs b/crates/subspace-service/src/sync_from_dsn/import_blocks.rs index d6b648561de..c13d2317272 100644 --- a/crates/subspace-service/src/sync_from_dsn/import_blocks.rs +++ b/crates/subspace-service/src/sync_from_dsn/import_blocks.rs @@ -1,19 +1,3 @@ -// Copyright (C) 2023 Subspace Labs, Inc. -// SPDX-License-Identifier: GPL-3.0-or-later - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - use crate::sync_from_dsn::segment_header_downloader::SegmentHeaderDownloader; use crate::sync_from_dsn::PieceGetter; use sc_client_api::{AuxStore, BlockBackend, HeaderBackend}; diff --git a/crates/subspace-verification/Cargo.toml b/crates/subspace-verification/Cargo.toml index 093129e074d..3ff1b96e1b7 100644 --- a/crates/subspace-verification/Cargo.toml +++ b/crates/subspace-verification/Cargo.toml @@ -3,7 +3,7 @@ name = "subspace-verification" version = "0.1.0" authors = ["Vedhavyas Singareddi "] edition = "2021" -license = "Apache-2.0" +license = "0BSD" homepage = "https://subspace.network" repository = "https://github.com/autonomys/subspace" description = "Verification primitives for Subspace" diff --git a/crates/subspace-verification/src/lib.rs b/crates/subspace-verification/src/lib.rs index e762747804b..3d752ea4dae 100644 --- a/crates/subspace-verification/src/lib.rs +++ b/crates/subspace-verification/src/lib.rs @@ -1,19 +1,3 @@ -// Copyright (C) 2021 Subspace Labs, Inc. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - //! Verification primitives for Subspace. #![forbid(unsafe_code)] #![warn(rust_2018_idioms, missing_debug_implementations, missing_docs)] diff --git a/domains/client/block-preprocessor/src/inherents.rs b/domains/client/block-preprocessor/src/inherents.rs index 28b8c7bce9f..73653b72937 100644 --- a/domains/client/block-preprocessor/src/inherents.rs +++ b/domains/client/block-preprocessor/src/inherents.rs @@ -195,8 +195,22 @@ where let consensus_block_hash = self .maybe_consensus_block_hash .unwrap_or(self.consensus_client.info().best_hash); + let runtime_api = self.consensus_client.runtime_api(); - let timestamp = runtime_api.timestamp(consensus_block_hash)?; + // Some APIs are only present in API versions 3 and later. On earlier versions, we need to + // call legacy code. + // TODO: remove version check before next network + let domains_api_version = runtime_api + .api_version::>(consensus_block_hash)? + // It is safe to return a default version of 1, since there will always be version 1. + .unwrap_or(1); + + let timestamp = if domains_api_version >= 3 { + runtime_api.domain_timestamp(consensus_block_hash)? + } else { + #[allow(deprecated)] + runtime_api.timestamp(consensus_block_hash)? + }; let timestamp_provider = sp_timestamp::InherentDataProvider::new(InherentType::new(timestamp)); @@ -208,8 +222,12 @@ where let runtime_upgrade_provider = sp_executive::InherentDataProvider::new(maybe_runtime_upgrade_code); - let consensus_chain_byte_fee = - runtime_api.consensus_chain_byte_fee(consensus_block_hash)?; + let consensus_chain_byte_fee = if domains_api_version >= 3 { + runtime_api.consensus_transaction_byte_fee(consensus_block_hash)? + } else { + #[allow(deprecated)] + runtime_api.consensus_chain_byte_fee(consensus_block_hash)? + }; let storage_price_provider = sp_block_fees::InherentDataProvider::new(consensus_chain_byte_fee); diff --git a/domains/client/block-preprocessor/src/lib.rs b/domains/client/block-preprocessor/src/lib.rs index de37e7fec50..bc7e98f38d0 100644 --- a/domains/client/block-preprocessor/src/lib.rs +++ b/domains/client/block-preprocessor/src/lib.rs @@ -18,7 +18,7 @@ use crate::inherents::is_runtime_upgraded; use codec::Encode; use domain_runtime_primitives::opaque::AccountId; use sc_client_api::BlockBackend; -use sp_api::{ApiError, Core, ProvideRuntimeApi}; +use sp_api::{ApiError, ProvideRuntimeApi}; use sp_blockchain::HeaderBackend; use sp_core::H256; use sp_domains::core_api::DomainCoreApi; @@ -29,8 +29,7 @@ use sp_domains::{ }; use sp_messenger::MessengerApi; use sp_mmr_primitives::MmrApi; -use sp_runtime::traits::{Block as BlockT, Hash as HashT, Header, NumberFor}; -use sp_runtime::DigestItem; +use sp_runtime::traits::{Block as BlockT, Hash as HashT, NumberFor}; use sp_state_machine::LayoutV1; use sp_subspace_mmr::ConsensusChainMmrLeafProof; use sp_weights::Weight; @@ -208,13 +207,6 @@ where Vec>, Vec<(Option, Block::Extrinsic)>, )> { - let consensus_spec_version = self - .consensus_client - .runtime_api() - .version(at_consensus_hash) - .map_err(sp_blockchain::Error::RuntimeApiError)? - .spec_version; - let mut inboxed_bundles = Vec::with_capacity(bundles.len()); let mut valid_extrinsics = Vec::new(); @@ -230,42 +222,16 @@ where // NOTE: The receipt's `domain_block_number` is verified by the consensus runtime while // the `domain_block_hash` is not (which is take care of by the fraud proof) so we can't // check the parent domain block hash here. - // TODO: remove consensus runtime version check before next network - if consensus_spec_version >= 6 - && bundle.receipt().domain_block_number != parent_domain_number - { - // If there consensus runtime just upgraded to spec version 6, which bring the receipt - // gap check, the bundle that included in the same block is doesn't perform the check - // because the new runtime take effect in the next block so skip the check here too. - let is_consensus_runtime_upgraded_to_6 = { - let consensus_header = self - .consensus_client - .header(at_consensus_hash)? - .ok_or_else(|| { - sp_blockchain::Error::Backend(format!( - "Consensus block header of {at_consensus_hash:?} unavailable" - )) - })?; - - let runtime_upgraded = consensus_header - .digest() - .logs() - .iter() - .any(|di| di == &DigestItem::RuntimeEnvironmentUpdated); - - runtime_upgraded && consensus_spec_version == 6 - }; - if !is_consensus_runtime_upgraded_to_6 { - return Err(sp_blockchain::Error::RuntimeApiError( - ApiError::Application( - format!( - "Unexpected bundle in consensus block: {:?}, something must be wrong", - at_consensus_hash - ) - .into(), - ), - )); - } + if bundle.receipt().domain_block_number != parent_domain_number { + return Err(sp_blockchain::Error::RuntimeApiError( + ApiError::Application( + format!( + "Unexpected bundle in consensus block: {:?}, something must be wrong", + at_consensus_hash + ) + .into(), + ), + )); } let extrinsic_root = bundle.extrinsics_root(); diff --git a/domains/client/domain-operator/src/domain_bundle_proposer.rs b/domains/client/domain-operator/src/domain_bundle_proposer.rs index 28964f2dd01..fe4afdf5a53 100644 --- a/domains/client/domain-operator/src/domain_bundle_proposer.rs +++ b/domains/client/domain-operator/src/domain_bundle_proposer.rs @@ -154,6 +154,13 @@ where let (domain_bundle_limit, storage_fund_balance, transaction_byte_fee) = { let consensus_runtime_api = self.consensus_client.runtime_api(); + // Some APIs are only present in API versions 3 and later. On earlier versions, we need to + // call legacy code. + // TODO: remove version check before next network + let domains_api_version = consensus_runtime_api + .api_version::>(consensus_best_hash)? + // It is safe to return a default version of 1, since there will always be version 1. + .unwrap_or(1); let domain_bundle_limit = consensus_runtime_api .domain_bundle_limit(consensus_best_hash, self.domain_id)? @@ -166,8 +173,12 @@ where let storage_fund_balance = consensus_runtime_api .storage_fund_account_balance(consensus_best_hash, operator_id)?; - let transaction_byte_fee = - consensus_runtime_api.consensus_chain_byte_fee(consensus_best_hash)?; + let transaction_byte_fee = if domains_api_version >= 3 { + consensus_runtime_api.consensus_transaction_byte_fee(consensus_best_hash)? + } else { + #[allow(deprecated)] + consensus_runtime_api.consensus_chain_byte_fee(consensus_best_hash)? + }; ( domain_bundle_limit, diff --git a/domains/client/domain-operator/src/tests.rs b/domains/client/domain-operator/src/tests.rs index 4e1473aca4d..5e8601aa9af 100644 --- a/domains/client/domain-operator/src/tests.rs +++ b/domains/client/domain-operator/src/tests.rs @@ -796,13 +796,13 @@ async fn test_executor_inherent_timestamp_is_set() { let consensus_timestamp = ferdie .client .runtime_api() - .timestamp(ferdie.client.info().best_hash) + .domain_timestamp(ferdie.client.info().best_hash) .unwrap(); let domain_timestamp = bob .client .runtime_api() - .timestamp(bob.client.info().best_hash) + .domain_timestamp(bob.client.info().best_hash) .unwrap(); assert_eq!( @@ -4969,12 +4969,12 @@ async fn test_domain_chain_storage_price_should_be_aligned_with_the_consensus_ch let consensus_chain_byte_fee = ferdie .client .runtime_api() - .consensus_chain_byte_fee(ferdie.client.info().best_hash) + .consensus_transaction_byte_fee(ferdie.client.info().best_hash) .unwrap(); let operator_consensus_chain_byte_fee = alice .client .runtime_api() - .consensus_chain_byte_fee(alice.client.info().best_hash) + .consensus_transaction_byte_fee(alice.client.info().best_hash) .unwrap(); assert!(operator_consensus_chain_byte_fee.is_zero()); assert!(!consensus_chain_byte_fee.is_zero()); @@ -4986,12 +4986,12 @@ async fn test_domain_chain_storage_price_should_be_aligned_with_the_consensus_ch let consensus_chain_byte_fee = ferdie .client .runtime_api() - .consensus_chain_byte_fee(ferdie.client.info().best_hash) + .consensus_transaction_byte_fee(ferdie.client.info().best_hash) .unwrap(); let operator_consensus_chain_byte_fee = alice .client .runtime_api() - .consensus_chain_byte_fee(alice.client.info().best_hash) + .consensus_transaction_byte_fee(alice.client.info().best_hash) .unwrap(); assert_eq!(consensus_chain_byte_fee, operator_consensus_chain_byte_fee); } diff --git a/domains/test/primitives/src/lib.rs b/domains/test/primitives/src/lib.rs index 763eb5b3dca..d8b806aa432 100644 --- a/domains/test/primitives/src/lib.rs +++ b/domains/test/primitives/src/lib.rs @@ -9,7 +9,7 @@ sp_api::decl_runtime_apis! { /// Api that returns the timestamp pub trait TimestampApi { /// Api to construct inherent timestamp extrinsic from given time - fn timestamp() -> Moment; + fn domain_timestamp() -> Moment; } } @@ -27,7 +27,7 @@ sp_api::decl_runtime_apis! { fn get_open_channel_for_chain(dst_chain_id: ChainId) -> Option; /// Api to get the current domain transaction byte fee - fn consensus_chain_byte_fee() -> Balance; + fn consensus_transaction_byte_fee() -> Balance; /// Get the storage root fn storage_root() -> [u8; 32]; diff --git a/domains/test/runtime/auto-id/src/lib.rs b/domains/test/runtime/auto-id/src/lib.rs index e90b68463f8..7d547a1a54c 100644 --- a/domains/test/runtime/auto-id/src/lib.rs +++ b/domains/test/runtime/auto-id/src/lib.rs @@ -983,7 +983,7 @@ impl_runtime_apis! { Messenger::get_open_channel_for_chain(dst_chain_id).map(|(c, _)| c) } - fn consensus_chain_byte_fee() -> Balance { + fn consensus_transaction_byte_fee() -> Balance { BlockFees::consensus_chain_byte_fee() } diff --git a/domains/test/runtime/evm/src/lib.rs b/domains/test/runtime/evm/src/lib.rs index 27e898ae59f..2d11e661fb4 100644 --- a/domains/test/runtime/evm/src/lib.rs +++ b/domains/test/runtime/evm/src/lib.rs @@ -1507,7 +1507,7 @@ impl_runtime_apis! { } impl domain_test_primitives::TimestampApi for Runtime { - fn timestamp() -> Moment { + fn domain_timestamp() -> Moment { Timestamp::now() } } @@ -1521,7 +1521,7 @@ impl_runtime_apis! { Messenger::get_open_channel_for_chain(dst_chain_id).map(|(c, _)| c) } - fn consensus_chain_byte_fee() -> Balance { + fn consensus_transaction_byte_fee() -> Balance { BlockFees::consensus_chain_byte_fee() } diff --git a/shared/sc-subspace-sync-common/Cargo.toml b/shared/sc-subspace-sync-common/Cargo.toml index fbf6d60ea24..943eefdcc8c 100644 --- a/shared/sc-subspace-sync-common/Cargo.toml +++ b/shared/sc-subspace-sync-common/Cargo.toml @@ -6,7 +6,7 @@ authors = [ "Shamil Gadelshin " ] description = "Synchronization algorithms for Autonomys Network" -license = "Apache-2.0" +license = "0BSD" repository = "https://github.com/autonomys/subspace" include = [ "/src", diff --git a/shared/sc-subspace-sync-common/src/snap_sync_engine.rs b/shared/sc-subspace-sync-common/src/snap_sync_engine.rs index f15c1abda6b..9759c4bdd46 100644 --- a/shared/sc-subspace-sync-common/src/snap_sync_engine.rs +++ b/shared/sc-subspace-sync-common/src/snap_sync_engine.rs @@ -1,21 +1,3 @@ -// This file is part of Substrate. - -// Copyright (C) Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - //! `SyncingEngine` is the actor responsible for syncing Substrate chain //! to tip and keep the blockchain up to date with network updates. diff --git a/shared/subspace-data-retrieval/Cargo.toml b/shared/subspace-data-retrieval/Cargo.toml index 1843628c257..e91c58e5a76 100644 --- a/shared/subspace-data-retrieval/Cargo.toml +++ b/shared/subspace-data-retrieval/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "subspace-data-retrieval" description = "Fetching data from the archived history of the Subspace Distributed Storage Network." -license = "Apache-2.0" +license = "0BSD" version = "0.1.0" authors = ["Teor "] edition = "2021" diff --git a/shared/subspace-data-retrieval/src/lib.rs b/shared/subspace-data-retrieval/src/lib.rs index a14159b2cb0..eab9a733560 100644 --- a/shared/subspace-data-retrieval/src/lib.rs +++ b/shared/subspace-data-retrieval/src/lib.rs @@ -1,18 +1,3 @@ -// Copyright (C) 2024 Subspace Labs, Inc. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - //! Fetching data from the archived history of the Subspace Distributed Storage Network. #![feature(exact_size_is_empty)] diff --git a/shared/subspace-data-retrieval/src/object_fetcher.rs b/shared/subspace-data-retrieval/src/object_fetcher.rs index 85800987efe..4394f35bf61 100644 --- a/shared/subspace-data-retrieval/src/object_fetcher.rs +++ b/shared/subspace-data-retrieval/src/object_fetcher.rs @@ -1,18 +1,3 @@ -// Copyright (C) 2024 Subspace Labs, Inc. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - //! Fetching objects stored in the archived history of Subspace Network. use crate::piece_fetcher::download_pieces; diff --git a/shared/subspace-data-retrieval/src/piece_fetcher.rs b/shared/subspace-data-retrieval/src/piece_fetcher.rs index ea702a16066..9db8f64e1fc 100644 --- a/shared/subspace-data-retrieval/src/piece_fetcher.rs +++ b/shared/subspace-data-retrieval/src/piece_fetcher.rs @@ -1,18 +1,3 @@ -// Copyright (C) 2024 Subspace Labs, Inc. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - //! Fetching pieces of the archived history of Subspace Network. use crate::object_fetcher::Error; diff --git a/shared/subspace-data-retrieval/src/piece_getter.rs b/shared/subspace-data-retrieval/src/piece_getter.rs index e23fee44ec0..f323e5309b7 100644 --- a/shared/subspace-data-retrieval/src/piece_getter.rs +++ b/shared/subspace-data-retrieval/src/piece_getter.rs @@ -1,18 +1,3 @@ -// Copyright (C) 2024 Subspace Labs, Inc. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - //! Getting object pieces from the Subspace Distributed Storage Network, or various caches. use async_trait::async_trait; diff --git a/shared/subspace-data-retrieval/src/segment_downloading.rs b/shared/subspace-data-retrieval/src/segment_downloading.rs index f84fe86ec42..689804ed8ca 100644 --- a/shared/subspace-data-retrieval/src/segment_downloading.rs +++ b/shared/subspace-data-retrieval/src/segment_downloading.rs @@ -1,18 +1,3 @@ -// Copyright (C) 2024 Subspace Labs, Inc. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - //! Fetching segments of the archived history of Subspace Network. use crate::piece_getter::PieceGetter; diff --git a/shared/subspace-kzg/Cargo.toml b/shared/subspace-kzg/Cargo.toml index 35f4d3e88fb..62f46f40cff 100644 --- a/shared/subspace-kzg/Cargo.toml +++ b/shared/subspace-kzg/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "subspace-kzg" description = "KZG primitives for Subspace Network" -license = "Apache-2.0" +license = "0BSD" version = "0.1.0" authors = ["Nazar Mokrynskyi "] edition = "2021" diff --git a/shared/subspace-logging/Cargo.toml b/shared/subspace-logging/Cargo.toml index 9345b5fc445..345dbd63da8 100644 --- a/shared/subspace-logging/Cargo.toml +++ b/shared/subspace-logging/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "subspace-logging" description = "Ensure all logging uilities are centralized for the whole project" -license = "Apache-2.0" +license = "0BSD" version = "0.0.1" authors = ["Nazar Mokrynskyi "] edition = "2021" diff --git a/shared/subspace-metrics/Cargo.toml b/shared/subspace-metrics/Cargo.toml index a53310ba399..81c89d2d184 100644 --- a/shared/subspace-metrics/Cargo.toml +++ b/shared/subspace-metrics/Cargo.toml @@ -6,7 +6,7 @@ authors = [ "Shamil Gadelshin " ] description = "Metrics for Subspace Network" -license = "Apache-2.0" +license = "0BSD" homepage = "https://subspace.network" repository = "https://github.com/autonomys/subspace" include = [ diff --git a/shared/subspace-proof-of-space-gpu/Cargo.toml b/shared/subspace-proof-of-space-gpu/Cargo.toml index 3ab7730e15f..8e2223176fc 100644 --- a/shared/subspace-proof-of-space-gpu/Cargo.toml +++ b/shared/subspace-proof-of-space-gpu/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "subspace-proof-of-space-gpu" description = "Subspace proof of space implementation for GPU (low-level proving utilities)" -license = "Apache-2.0" +license = "0BSD" version = "0.1.0" authors = ["Supranational LLC"] edition = "2021" diff --git a/shared/subspace-proof-of-space-gpu/build.rs b/shared/subspace-proof-of-space-gpu/build.rs index 935605ee4a6..95962f0efdb 100644 --- a/shared/subspace-proof-of-space-gpu/build.rs +++ b/shared/subspace-proof-of-space-gpu/build.rs @@ -1,6 +1,4 @@ -// Copyright Supranational LLC -// Licensed under the Apache License, Version 2.0, see LICENSE for details. -// SPDX-License-Identifier: Apache-2.0 +// Originally written by Supranational LLC use std::env; use std::thread::available_parallelism; diff --git a/shared/subspace-proof-of-space-gpu/src/blake3.cuh b/shared/subspace-proof-of-space-gpu/src/blake3.cuh index dfb1f52b6ff..64529629d6b 100644 --- a/shared/subspace-proof-of-space-gpu/src/blake3.cuh +++ b/shared/subspace-proof-of-space-gpu/src/blake3.cuh @@ -1,6 +1,4 @@ -// Copyright Supranational LLC -// Licensed under the Apache License, Version 2.0, see LICENSE for details. -// SPDX-License-Identifier: Apache-2.0 +// Originally written by Supranational LLC #include #include diff --git a/shared/subspace-proof-of-space-gpu/src/chacha.cuh b/shared/subspace-proof-of-space-gpu/src/chacha.cuh index 10bed1ce68e..faddef44b2a 100644 --- a/shared/subspace-proof-of-space-gpu/src/chacha.cuh +++ b/shared/subspace-proof-of-space-gpu/src/chacha.cuh @@ -1,6 +1,4 @@ -// Copyright Supranational LLC -// Licensed under the Apache License, Version 2.0, see LICENSE for details. -// SPDX-License-Identifier: Apache-2.0 +// Originally written by Supranational LLC #include #include diff --git a/shared/subspace-proof-of-space-gpu/src/common_operations.cuh b/shared/subspace-proof-of-space-gpu/src/common_operations.cuh index 6b125726c99..5341fa95788 100644 --- a/shared/subspace-proof-of-space-gpu/src/common_operations.cuh +++ b/shared/subspace-proof-of-space-gpu/src/common_operations.cuh @@ -1,6 +1,4 @@ -// Copyright Supranational LLC -// Licensed under the Apache License, Version 2.0, see LICENSE for details. -// SPDX-License-Identifier: Apache-2.0 +// Originally written by Supranational LLC __device__ __forceinline__ uint32_t byte_swap(uint32_t in) diff --git a/shared/subspace-proof-of-space-gpu/src/create_tables.cuh b/shared/subspace-proof-of-space-gpu/src/create_tables.cuh index 6843123d4ae..303bde43ae7 100644 --- a/shared/subspace-proof-of-space-gpu/src/create_tables.cuh +++ b/shared/subspace-proof-of-space-gpu/src/create_tables.cuh @@ -1,6 +1,4 @@ -// Copyright Supranational LLC -// Licensed under the Apache License, Version 2.0, see LICENSE for details. -// SPDX-License-Identifier: Apache-2.0 +// Originally written by Supranational LLC template __global__ __launch_bounds__(1024) diff --git a/shared/subspace-proof-of-space-gpu/src/cuda.rs b/shared/subspace-proof-of-space-gpu/src/cuda.rs index 6cff6ad6257..e8a53d03899 100644 --- a/shared/subspace-proof-of-space-gpu/src/cuda.rs +++ b/shared/subspace-proof-of-space-gpu/src/cuda.rs @@ -1,6 +1,4 @@ -// Copyright Supranational LLC -// Licensed under the Apache License, Version 2.0, see LICENSE for details. -// SPDX-License-Identifier: Apache-2.0 +// Originally written by Supranational LLC #[cfg(test)] mod tests; diff --git a/shared/subspace-proof-of-space-gpu/src/data_structures.cuh b/shared/subspace-proof-of-space-gpu/src/data_structures.cuh index eec265967f2..58d5ead9c5e 100644 --- a/shared/subspace-proof-of-space-gpu/src/data_structures.cuh +++ b/shared/subspace-proof-of-space-gpu/src/data_structures.cuh @@ -1,6 +1,4 @@ -// Copyright Supranational LLC -// Licensed under the Apache License, Version 2.0, see LICENSE for details. -// SPDX-License-Identifier: Apache-2.0 +// Originally written by Supranational LLC #include #include diff --git a/shared/subspace-proof-of-space-gpu/src/find_matches.cuh b/shared/subspace-proof-of-space-gpu/src/find_matches.cuh index af79b36e67a..ae78c9de82f 100644 --- a/shared/subspace-proof-of-space-gpu/src/find_matches.cuh +++ b/shared/subspace-proof-of-space-gpu/src/find_matches.cuh @@ -1,6 +1,4 @@ -// Copyright Supranational LLC -// Licensed under the Apache License, Version 2.0, see LICENSE for details. -// SPDX-License-Identifier: Apache-2.0 +// Originally written by Supranational LLC __device__ __forceinline__ uint32_t calculate_destination(uint32_t parity, uint32_t r, uint32_t m) diff --git a/shared/subspace-proof-of-space-gpu/src/find_proof.cuh b/shared/subspace-proof-of-space-gpu/src/find_proof.cuh index 9a46eb97380..fc5ff476c87 100644 --- a/shared/subspace-proof-of-space-gpu/src/find_proof.cuh +++ b/shared/subspace-proof-of-space-gpu/src/find_proof.cuh @@ -1,6 +1,4 @@ -// Copyright Supranational LLC -// Licensed under the Apache License, Version 2.0, see LICENSE for details. -// SPDX-License-Identifier: Apache-2.0 +// Originally written by Supranational LLC __device__ __forceinline__ uint32_t search_min_left_pos(table_data_ptr table, uint32_t dest, diff --git a/shared/subspace-proof-of-space-gpu/src/rocm.rs b/shared/subspace-proof-of-space-gpu/src/rocm.rs index 507517eb163..fe9298d4b79 100644 --- a/shared/subspace-proof-of-space-gpu/src/rocm.rs +++ b/shared/subspace-proof-of-space-gpu/src/rocm.rs @@ -1,6 +1,4 @@ -// Copyright Supranational LLC -// Licensed under the Apache License, Version 2.0, see LICENSE for details. -// SPDX-License-Identifier: Apache-2.0 +// Originally written by Supranational LLC #[cfg(test)] mod tests; diff --git a/shared/subspace-proof-of-space-gpu/src/sort15113.cuh b/shared/subspace-proof-of-space-gpu/src/sort15113.cuh index 5ffd5abeae5..d14cfbb4373 100644 --- a/shared/subspace-proof-of-space-gpu/src/sort15113.cuh +++ b/shared/subspace-proof-of-space-gpu/src/sort15113.cuh @@ -1,6 +1,4 @@ -// Copyright Supranational LLC -// Licensed under the Apache License, Version 2.0, see LICENSE for details. -// SPDX-License-Identifier: Apache-2.0 +// Originally written by Supranational LLC #ifndef __SUBSPACE_SORT_CUH__ #define __SUBSPACE_SORT_CUH__ diff --git a/shared/subspace-proof-of-space-gpu/src/subspace_api.cu b/shared/subspace-proof-of-space-gpu/src/subspace_api.cu index 67a185abf6b..d454f12dddc 100644 --- a/shared/subspace-proof-of-space-gpu/src/subspace_api.cu +++ b/shared/subspace-proof-of-space-gpu/src/subspace_api.cu @@ -1,6 +1,4 @@ -// Copyright Supranational LLC -// Licensed under the Apache License, Version 2.0, see LICENSE for details. -// SPDX-License-Identifier: Apache-2.0 +// Originally written by Supranational LLC #include #include @@ -187,7 +185,7 @@ RustError::by_value generate_and_encode_pospace(const uint8_t* key, kern_endianness_swap<<>>(&d_record[record_size], &d_record[record_size], record_size); - + CUDA_OK(cudaGetLastError()); // Converts and duplicates data on the GPU. @@ -208,12 +206,12 @@ RustError::by_value generate_and_encode_pospace(const uint8_t* key, NTT::Base_dev_ptr(gpu, d_record, lg_record_size + 1, NTT::InputOutputOrder::RN, NTT::Direction::forward, NTT::Type::standard); - + // Convert the inputs (and outputs) back to big-endian kern_endianness_swap<<>>(&d_record[0], &d_record[0], 2 * record_size); - + CUDA_OK(cudaGetLastError()); // Record a list of pending operations submitted to the stream diff --git a/test/subspace-test-runtime/src/lib.rs b/test/subspace-test-runtime/src/lib.rs index b3f7333727b..db145489170 100644 --- a/test/subspace-test-runtime/src/lib.rs +++ b/test/subspace-test-runtime/src/lib.rs @@ -1109,7 +1109,7 @@ impl FraudProofStorageKeyProvider> for StorageKeyProvider { fn storage_key(req: FraudProofStorageKeyRequest>) -> Vec { match req { FraudProofStorageKeyRequest::InvalidInherentExtrinsicData => { - pallet_domains::BlockInvalidInherentExtrinsicData::::hashed_key().to_vec() + pallet_domains::BlockInherentExtrinsicData::::hashed_key().to_vec() } FraudProofStorageKeyRequest::SuccessfulBundles(domain_id) => { pallet_domains::SuccessfulBundles::::hashed_key_for(domain_id) @@ -1326,10 +1326,22 @@ impl_runtime_apis! { Domains::domain_instance_data(domain_id) } - fn timestamp() -> Moment{ + fn domain_timestamp() -> Moment { + Domains::timestamp() + } + + fn timestamp() -> Moment { Timestamp::now() } + fn consensus_transaction_byte_fee() -> Balance { + Domains::consensus_transaction_byte_fee() + } + + fn consensus_chain_byte_fee() -> Balance { + DOMAIN_STORAGE_FEE_MULTIPLIER * TransactionFees::transaction_byte_fee() + } + fn domain_tx_range(_: DomainId) -> U256 { U256::MAX } @@ -1373,10 +1385,6 @@ impl_runtime_apis! { Domains::receipt_hash(domain_id, domain_number) } - fn consensus_chain_byte_fee() -> Balance { - DOMAIN_STORAGE_FEE_MULTIPLIER * TransactionFees::transaction_byte_fee() - } - fn latest_confirmed_domain_block(domain_id: DomainId) -> Option<(DomainNumber, DomainHash)>{ Domains::latest_confirmed_domain_block(domain_id) }