Struct pallet_subspace::pallet::Pallet

source ·
pub struct Pallet<T>(/* private fields */);
Expand description

The Subspace Pallet

Implementations§

source§

impl<T: Config> Pallet<T>

Methods for the ValidateUnsigned implementation: It restricts calls to report_equivocation to local calls (i.e. extrinsics generated on this node) or that already in a block. This guarantees that only block authors can include equivocation reports.

source

pub fn validate_equivocation_report( source: TransactionSource, equivocation_proof: &EquivocationProof<HeaderFor<T>>, ) -> TransactionValidity

source

pub fn pre_dispatch_equivocation_report( equivocation_proof: &EquivocationProof<HeaderFor<T>>, ) -> Result<(), TransactionValidityError>

source§

impl<T: Config> Pallet<T>

source

pub fn report_equivocation( origin: OriginFor<T>, equivocation_proof: Box<EquivocationProof<HeaderFor<T>>>, ) -> DispatchResultWithPostInfo

Report farmer equivocation/misbehavior. This method will verify the equivocation proof. If valid, the offence will be reported.

This extrinsic must be called unsigned and it is expected that only block authors will call it (validated in ValidateUnsigned), as such if the block author is defined it will be defined as the equivocation reporter.

source

pub fn store_segment_headers( origin: OriginFor<T>, segment_headers: Vec<SegmentHeader>, ) -> DispatchResult

Submit new segment header to the blockchain. This is an inherent extrinsic and part of the Subspace consensus logic.

source

pub fn enable_solution_range_adjustment( origin: OriginFor<T>, solution_range_override: Option<u64>, voting_solution_range_override: Option<u64>, ) -> DispatchResult

Enable solution range adjustment after every era. Note: No effect on the solution range for the current era

source

pub fn vote( origin: OriginFor<T>, signed_vote: Box<SignedVote<BlockNumberFor<T>, T::Hash, T::AccountId>>, ) -> DispatchResult

Farmer vote, currently only used for extra rewards to farmers.

source

pub fn enable_rewards_at( origin: OriginFor<T>, enable_rewards_at: EnableRewardsAt<BlockNumberFor<T>>, ) -> DispatchResult

Enable rewards for blocks and votes at specified block height.

source

pub fn enable_authoring_by_anyone(origin: OriginFor<T>) -> DispatchResult

Enable storage access for all users.

source

pub fn set_pot_slot_iterations( origin: OriginFor<T>, slot_iterations: NonZeroU32, ) -> DispatchResult

Update proof of time slot iterations

source§

impl<T: Config> Pallet<T>

source

pub fn genesis_slot() -> Slot

An auto-generated getter for GenesisSlot.

source§

impl<T: Config> Pallet<T>

source

pub fn current_slot() -> Slot

An auto-generated getter for CurrentSlot.

source§

impl<T: Config> Pallet<T>

source

pub fn block_slots() -> BoundedBTreeMap<BlockNumberFor<T>, Slot, T::BlockSlotCount>

An auto-generated getter for BlockSlots.

source§

impl<T: Config> Pallet<T>

source

pub fn solution_ranges() -> SolutionRanges

An auto-generated getter for SolutionRanges.

source§

impl<T: Config> Pallet<T>

source

pub fn should_adjust_solution_range() -> bool

An auto-generated getter for ShouldAdjustSolutionRange.

source§

impl<T: Config> Pallet<T>

source

pub fn segment_commitment<KArg>(k: KArg) -> Option<SegmentCommitment>
where KArg: EncodeLike<SegmentIndex>,

An auto-generated getter for SegmentCommitment.

source§

impl<T: Config> Pallet<T>

source

pub fn root_plot_public_key() -> Option<FarmerPublicKey>

An auto-generated getter for RootPlotPublicKey.

source§

impl<T: Config> Pallet<T>

source

pub fn history_size() -> HistorySize

Total number of pieces in the blockchain

source

pub fn submit_equivocation_report( equivocation_proof: EquivocationProof<HeaderFor<T>>, ) -> Option<()>

Submits an extrinsic to report an equivocation. This method will create an unsigned extrinsic with a call to report_equivocation and will push the transaction to the pool. Only useful in an offchain context.

source

pub fn submit_test_equivocation_report( equivocation_proof: EquivocationProof<HeaderFor<T>>, ) -> Option<()>

Just stores offender from equivocation report in block list, only used for tests.

source

pub fn pot_parameters() -> PotParameters

Proof of time parameters

source

pub fn is_in_block_list(farmer_public_key: &FarmerPublicKey) -> bool

Check if farmer_public_key is in block list (due to equivocation)

source

pub fn archived_history_size() -> u64

Size of the archived history of the blockchain in bytes

source§

impl<T> Pallet<T>
where T: Config + SendTransactionTypes<Call<T>>,

source

pub fn submit_vote( signed_vote: SignedVote<BlockNumberFor<T>, T::Hash, T::AccountId>, )

Submit farmer vote vote that is essentially a header with bigger solution range than acceptable for block authoring.

Trait Implementations§

source§

impl<T: Config> BeforeAllRuntimeMigrations for Pallet<T>

source§

fn before_all_runtime_migrations() -> Weight

Something that should happen before runtime migrations are executed.
source§

impl<T: Config> Callable<T> for Pallet<T>

source§

impl<T> Clone for Pallet<T>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T> Debug for Pallet<T>

source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T: Config> FindBlockRewardAddress<<T as Config>::AccountId> for Pallet<T>

source§

fn find_block_reward_address() -> Option<T::AccountId>

Find the address for a block rewards based on the pre-runtime digests.
source§

impl<T: Config> FindVotingRewardAddresses<<T as Config>::AccountId> for Pallet<T>

source§

fn find_voting_reward_addresses() -> Vec<T::AccountId>

Find the addresses for voting rewards based on transactions found in the block.
source§

impl<T: Config> GetStorageVersion for Pallet<T>

§

type InCodeStorageVersion = NoStorageVersionSet

This type is generated by the pallet macro. Read more
source§

fn in_code_storage_version() -> Self::InCodeStorageVersion

Returns the in-code storage version as specified in the storage_version attribute, or [NoStorageVersionSet] if the attribute is missing.
source§

fn on_chain_storage_version() -> StorageVersion

Returns the storage version of the pallet as last set in the actual on-chain storage.
§

fn current_storage_version() -> Self::InCodeStorageVersion

👎Deprecated: This method has been renamed to in_code_storage_version and will be removed after March 2024.
DEPRECATED: Use [Self::current_storage_version] instead. Read more
source§

impl<T: Config> Hooks<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>

source§

fn on_initialize(block_number: BlockNumberFor<T>) -> Weight

Block initialization hook. This is called at the very beginning of block execution. Read more
source§

fn on_finalize(block_number: BlockNumberFor<T>)

Block finalization hook. This is called at the very end of block execution. Read more
§

fn on_idle(_n: BlockNumber, _remaining_weight: Weight) -> Weight

Hook to consume a block’s idle time. This will run when the block is being finalized (before [Hooks::on_finalize]). Read more
§

fn on_poll(_n: BlockNumber, _weight: &mut WeightMeter)

A hook to run logic after inherent application. Read more
§

fn on_runtime_upgrade() -> Weight

Hook executed when a code change (aka. a “runtime upgrade”) is detected by the FRAME Executive pallet. Read more
§

fn offchain_worker(_n: BlockNumber)

Implementing this function on a pallet allows you to perform long-running tasks that are dispatched as separate threads, and entirely independent of the main blockchain execution. Read more
§

fn integrity_test()

Check the integrity of this pallet’s configuration. Read more
source§

impl<T: Config> IntegrityTest for Pallet<T>

source§

fn integrity_test()

See [Hooks::integrity_test].
source§

impl<T: Config> OffchainWorker<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>

source§

fn offchain_worker(n: BlockNumberFor<T>)

This function is being called after every block import (when fully synced). Read more
source§

impl<T: Config> OnFinalize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>

source§

fn on_finalize(n: BlockNumberFor<T>)

See [Hooks::on_finalize].
source§

impl<T: Config> OnGenesis for Pallet<T>

source§

fn on_genesis()

Something that should happen at genesis.
source§

impl<T: Config> OnIdle<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>

source§

fn on_idle(n: BlockNumberFor<T>, remaining_weight: Weight) -> Weight

See [Hooks::on_idle].
source§

impl<T: Config> OnInitialize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>

source§

fn on_initialize(n: BlockNumberFor<T>) -> Weight

See [Hooks::on_initialize].
source§

impl<T: Config> OnOffenceHandler<Public> for Pallet<T>

source§

fn on_offence(offenders: &[OffenceDetails<FarmerPublicKey>])

A handler for an offence of a particular kind. Read more
source§

impl<T: Config> OnPoll<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>

source§

fn on_poll(n: BlockNumberFor<T>, weight: &mut WeightMeter)

Code to execute every now and then at the beginning of the block after inherent application. Read more
source§

impl<T: Config> OnRuntimeUpgrade for Pallet<T>

source§

fn on_runtime_upgrade() -> Weight

See [Hooks::on_runtime_upgrade].
source§

impl<T: Config> PalletInfoAccess for Pallet<T>

source§

fn index() -> usize

Index of the pallet as configured in the runtime.
source§

fn name() -> &'static str

Name of the pallet as configured in the runtime.
source§

fn name_hash() -> [u8; 16]

Two128 hash of name.
source§

fn module_name() -> &'static str

Name of the Rust module containing the pallet.
source§

fn crate_version() -> CrateVersion

Version of the crate containing the pallet.
source§

impl<T: Config> PalletsInfoAccess for Pallet<T>

source§

fn count() -> usize

The number of pallets’ information that this type represents. Read more
source§

fn infos() -> Vec<PalletInfoData>

All of the pallets’ information that this type represents.
source§

impl<T> PartialEq for Pallet<T>

source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T: Config> ProvideInherent for Pallet<T>

§

type Call = Call<T>

The call type of the pallet.
§

type Error = InherentError

The error returned by check_inherent.
source§

const INHERENT_IDENTIFIER: InherentIdentifier = INHERENT_IDENTIFIER

The inherent identifier used by this inherent.
source§

fn create_inherent(data: &InherentData) -> Option<Self::Call>

Create an inherent out of the given InherentData. Read more
source§

fn is_inherent_required( data: &InherentData, ) -> Result<Option<Self::Error>, Self::Error>

Determines whether this inherent is required in this block. Read more
source§

fn check_inherent( call: &Self::Call, data: &InherentData, ) -> Result<(), Self::Error>

Check whether the given inherent is valid. Checking the inherent is optional and can be omitted by using the default implementation. Read more
source§

fn is_inherent(call: &Self::Call) -> bool

Return whether the call is an inherent call. Read more
source§

impl<T: Config> Randomness<<T as Config>::Hash, <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>

source§

fn random(subject: &[u8]) -> (T::Hash, BlockNumberFor<T>)

Get the most recently determined random seed, along with the time in the past since when it was determinable by chain observers. Read more
source§

fn random_seed() -> (T::Hash, BlockNumberFor<T>)

Get the basic random seed. Read more
source§

impl<T: Config> RewardsEnabled for Pallet<T>

source§

fn rewards_enabled() -> bool

Determine whether rewards are enabled or not
source§

impl<T: Config> StorageInfoTrait for Pallet<T>

source§

fn storage_info() -> Vec<StorageInfo>

source§

impl<T: Config> ValidateUnsigned for Pallet<T>

§

type Call = Call<T>

The call to validate
source§

fn validate_unsigned( source: TransactionSource, call: &Self::Call, ) -> TransactionValidity

Return the validity of the call Read more
source§

fn pre_dispatch(call: &Self::Call) -> Result<(), TransactionValidityError>

Validate the call right before dispatch. Read more
source§

impl<T: Config> WhitelistedStorageKeys for Pallet<T>

source§

fn whitelisted_storage_keys() -> Vec<TrackedStorageKey>

Returns a Vec<TrackedStorageKey> indicating the storage keys that should be whitelisted during benchmarking. This means that those keys will be excluded from the benchmarking performance calculation.
source§

impl<T> Eq for Pallet<T>

Auto Trait Implementations§

§

impl<T> Freeze for Pallet<T>

§

impl<T> RefUnwindSafe for Pallet<T>
where T: RefUnwindSafe,

§

impl<T> Send for Pallet<T>
where T: Send,

§

impl<T> Sync for Pallet<T>
where T: Sync,

§

impl<T> Unpin for Pallet<T>
where T: Unpin,

§

impl<T> UnwindSafe for Pallet<T>
where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CheckedConversion for T

§

fn checked_from<T>(t: T) -> Option<Self>
where Self: TryFrom<T>,

Convert from a value of T into an equivalent instance of Option<Self>. Read more
§

fn checked_into<T>(self) -> Option<T>
where Self: TryInto<T>,

Consume self to return Some equivalent value of Option<T>. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T, U> IntoKey<U> for T
where U: FromKey<T>,

§

fn into_key(self) -> U

§

impl<T> IsType<T> for T

§

fn from_ref(t: &T) -> &T

Cast reference.
§

fn into_ref(&self) -> &T

Cast reference.
§

fn from_mut(t: &mut T) -> &mut T

Cast mutable reference.
§

fn into_mut(&mut self) -> &mut T

Cast mutable reference.
§

impl<T, Outer> IsWrappedBy<Outer> for T
where Outer: AsRef<T> + AsMut<T> + From<T>, T: From<Outer>,

§

fn from_ref(outer: &Outer) -> &T

Get a reference to the inner from the outer.

§

fn from_mut(outer: &mut Outer) -> &mut T

Get a mutable reference to the inner from the outer.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
§

impl<T> SaturatedConversion for T

§

fn saturated_from<T>(t: T) -> Self
where Self: UniqueSaturatedFrom<T>,

Convert from a value of T into an equivalent instance of Self. Read more
§

fn saturated_into<T>(self) -> T
where Self: UniqueSaturatedInto<T>,

Consume self to return an equivalent value of T. Read more
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T, U> TryIntoKey<U> for T
where U: TryFromKey<T>,

§

type Error = <U as TryFromKey<T>>::Error

§

fn try_into_key(self) -> Result<U, <U as TryFromKey<T>>::Error>

§

impl<S, T> UncheckedInto<T> for S
where T: UncheckedFrom<S>,

§

fn unchecked_into(self) -> T

The counterpart to unchecked_from.
§

impl<T, S> UniqueSaturatedInto<T> for S
where T: Bounded, S: TryInto<T>,

§

fn unique_saturated_into(self) -> T

Consume self to return an equivalent value of T.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> JsonSchemaMaybe for T

§

impl<T> MaybeDebug for T
where T: Debug,

§

impl<T> MaybeRefUnwindSafe for T
where T: RefUnwindSafe,

§

impl<T> Member for T
where T: Send + Sync + Debug + Eq + PartialEq + Clone + 'static,