diff --git a/pallets/storage-provider/src/lib.rs b/pallets/storage-provider/src/lib.rs index 052b664c2..faa785876 100644 --- a/pallets/storage-provider/src/lib.rs +++ b/pallets/storage-provider/src/lib.rs @@ -27,11 +27,6 @@ mod utils; #[frame_support::pallet(dev_mode)] pub mod pallet { - use crate::types::{RegisteredPoStProof, StorageProviderInfo, StorageProviderState}; - use crate::utils::{ - assign_proving_period_offset, current_deadline_index, current_proving_period_start, - }; - use codec::{Decode, Encode}; use core::fmt::Debug; use frame_support::{ @@ -44,6 +39,11 @@ pub mod pallet { use frame_system::{ensure_signed, pallet_prelude::OriginFor, Config as SystemConfig}; use scale_info::TypeInfo; + use crate::types::{RegisteredPoStProof, StorageProviderInfo, StorageProviderState}; + use crate::utils::{ + assign_proving_period_offset, current_deadline_index, current_proving_period_start, + }; + // Allows to extract Balance of an account via the Config::Currency associated type. // BalanceOf is a sophisticated way of getting an u128. type BalanceOf = diff --git a/pallets/storage-provider/src/types.rs b/pallets/storage-provider/src/types.rs index 51f4ca8db..a61a9ae1e 100644 --- a/pallets/storage-provider/src/types.rs +++ b/pallets/storage-provider/src/types.rs @@ -1,14 +1,14 @@ use primitives::{BlockNumber, DAYS, SLOT_DURATION}; use scale_info::prelude::string::String; -pub use proofs::{RegisteredPoStProof, RegisteredSealProof}; -pub use sector::{SectorOnChainInfo, SectorPreCommitOnChainInfo, SectorSize}; -pub use storage_provider::{StorageProviderInfo, StorageProviderState}; - mod proofs; mod sector; mod storage_provider; +pub use proofs::{RegisteredPoStProof, RegisteredSealProof}; +pub use sector::{SectorOnChainInfo, SectorPreCommitOnChainInfo, SectorSize}; +pub use storage_provider::{StorageProviderInfo, StorageProviderState}; + type Cid = String; // Challenge window of 24 hours diff --git a/pallets/storage-provider/src/types/proofs.rs b/pallets/storage-provider/src/types/proofs.rs index 5c340562d..bfb435595 100644 --- a/pallets/storage-provider/src/types/proofs.rs +++ b/pallets/storage-provider/src/types/proofs.rs @@ -1,10 +1,10 @@ -use crate::types::SectorSize; - use codec::{Decode, Encode}; use frame_support::pallet_prelude::ConstU32; use frame_support::sp_runtime::BoundedVec; use scale_info::TypeInfo; +use crate::types::SectorSize; + /// Proof of Spacetime type, indicating version and sector size of the proof. #[derive(Debug, Decode, Encode, TypeInfo, PartialEq, Eq, Clone, Copy)] pub enum RegisteredPoStProof { diff --git a/pallets/storage-provider/src/types/sector.rs b/pallets/storage-provider/src/types/sector.rs index 6a4dd4d27..4950c074c 100644 --- a/pallets/storage-provider/src/types/sector.rs +++ b/pallets/storage-provider/src/types/sector.rs @@ -1,9 +1,9 @@ -use crate::types::{Cid, RegisteredSealProof}; - use codec::{Decode, Encode}; use primitives::BlockNumber; use scale_info::TypeInfo; +use crate::types::{Cid, RegisteredSealProof}; + // https://github.com/filecoin-project/builtin-actors/blob/17ede2b256bc819dc309edf38e031e246a516486/runtime/src/runtime/policy.rs#L262 pub const SECTORS_MAX: u32 = 32 << 20; diff --git a/pallets/storage-provider/src/types/storage_provider.rs b/pallets/storage-provider/src/types/storage_provider.rs index f01430169..a812d0e01 100644 --- a/pallets/storage-provider/src/types/storage_provider.rs +++ b/pallets/storage-provider/src/types/storage_provider.rs @@ -1,14 +1,14 @@ -use crate::types::{ - sector::SECTORS_MAX, RegisteredPoStProof, SectorOnChainInfo, SectorPreCommitOnChainInfo, - SectorSize, -}; - use codec::{Decode, Encode}; use frame_support::pallet_prelude::ConstU32; use frame_support::sp_runtime::BoundedVec; use primitives::BlockNumber; use scale_info::TypeInfo; +use crate::types::{ + sector::SECTORS_MAX, RegisteredPoStProof, SectorOnChainInfo, SectorPreCommitOnChainInfo, + SectorSize, +}; + /// This struct holds the state of a single storage provider. #[derive(Debug, Decode, Encode, TypeInfo)] pub struct StorageProviderState { diff --git a/pallets/storage-provider/src/utils.rs b/pallets/storage-provider/src/utils.rs index d6f41560c..68c452061 100644 --- a/pallets/storage-provider/src/utils.rs +++ b/pallets/storage-provider/src/utils.rs @@ -1,9 +1,9 @@ -use crate::types::{WPOST_CHALLENGE_WINDOW, WPOST_PROVING_PERIOD}; - use codec::Encode; use primitives::BlockNumber; use sp_core::blake2_64; +use crate::types::{WPOST_CHALLENGE_WINDOW, WPOST_PROVING_PERIOD}; + /// Assigns proving period offset randomly in the range [0, WPOST_PROVING_PERIOD) /// by hashing the address and current block number. ///