Skip to content

Commit

Permalink
format: Fix cargo fmt issues
Browse files Browse the repository at this point in the history
  • Loading branch information
aidan46 committed Jun 19, 2024
1 parent 731a9b8 commit 86c0565
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 20 deletions.
10 changes: 5 additions & 5 deletions pallets/storage-provider/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand All @@ -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<T> =
Expand Down
8 changes: 4 additions & 4 deletions pallets/storage-provider/src/types.rs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions pallets/storage-provider/src/types/proofs.rs
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions pallets/storage-provider/src/types/sector.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
10 changes: 5 additions & 5 deletions pallets/storage-provider/src/types/storage_provider.rs
Original file line number Diff line number Diff line change
@@ -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<PeerId, Balance> {
Expand Down
4 changes: 2 additions & 2 deletions pallets/storage-provider/src/utils.rs
Original file line number Diff line number Diff line change
@@ -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.
///
Expand Down

0 comments on commit 86c0565

Please sign in to comment.