Struct pallet_merkle::pallet::Pallet[][src]

pub struct Pallet<T>(_);

Implementations

impl<T: Config> Pallet<T>[src]

pub fn create_group(
    origin: OriginFor<T>,
    r_is_mgr: bool,
    _depth: Option<u8>
) -> DispatchResultWithPostInfo
[src]

Creates a new group and sets a new manager for that group. The initial manager is the sender. Also increments the mixer id counter in the storage. If _depth is not provided, max tree depth is assumed.

Weights:

  • Dependent on arguments: _depth

  • Base weight: 8_356_000

  • DB weights: 1 read, 3 writes

  • Additional weights: 151_000 * _depth

pub fn set_manager_required(
    origin: OriginFor<T>,
    group_id: T::GroupId,
    manager_required: bool
) -> DispatchResultWithPostInfo
[src]

Sets if a manager is required for specific actions like adding nullifiers or leaves into the tree.

Can only be called by the root or the current manager.

Weights:

  • Independend of the arguments.

  • Base weight: 7_000_000

  • DB weights: 1 read, 1 write

pub fn set_manager(
    origin: OriginFor<T>,
    group_id: T::GroupId,
    new_manager: T::AccountId
) -> DispatchResultWithPostInfo
[src]

Sets manager account id.

Can only be called by the root or the current manager.

Weights:

  • Independent of the arguments.

  • Base weight: 8_000_000

  • DB weights: 1 read, 1 write

pub fn set_stopped(
    origin: OriginFor<T>,
    group_id: T::GroupId,
    stopped: bool
) -> DispatchResultWithPostInfo
[src]

Set stopped flag inside the storage.

Can only be called by the root or the current manager.

Weights:

  • Independent of the arguments.

  • Base weight: 8_000_000

  • DB weights: 1 read, 1 write

pub fn add_members(
    origin: OriginFor<T>,
    group_id: T::GroupId,
    members: Vec<ScalarData>
) -> DispatchResultWithPostInfo
[src]

Adds an array of leaf data into the tree and adds calculated root to the cache.

Can only be called by the manager if a manager is set.

Weights:

  • Dependent on argument: members

  • Base weight: 384_629_956_000

  • DB weights: 3 reads, 2 writes

  • Additional weights: 20_135_984_000 * members.len()

pub fn verify(
    origin: OriginFor<T>,
    group_id: T::GroupId,
    leaf: ScalarData,
    path: Vec<(bool, ScalarData)>
) -> DispatchResultWithPostInfo
[src]

Verification stub for testing, these verification functions should not need to be used directly as extrinsics. Rather, higher-order modules should use the module functions to verify and execute further logic.

Verifies the membership proof.

Weights:

  • Dependent on the argument: path
  • Base weight: 383_420_867_000
  • DB weights: 1 read
  • Additional weights: 814_291_000 * path.len()

impl<T: Config> Pallet<T>[src]

pub fn next_group_id() -> T::GroupId[src]

Old name generated by decl_event. The next group identifier up for grabs

impl<T: Config> Pallet<T>[src]

pub fn groups<KArg>(k: KArg) -> Option<GroupTree> where
    KArg: EncodeLike<T::GroupId>, 
[src]

The map of groups to their metadata

impl<T: Config> Pallet<T>[src]

pub fn cached_roots<KArg1, KArg2>(k1: KArg1, k2: KArg2) -> Vec<ScalarData>

Notable traits for Vec<u8, A>

impl<A> Write for Vec<u8, A> where
    A: Allocator
where
    KArg1: EncodeLike<T::BlockNumber>,
    KArg2: EncodeLike<T::GroupId>, 
[src]

Map of cached/past Merkle roots at each block number and group. There can be more than one root update in a single block. Allows for easy pruning since we can remove all keys of the first map past a certain point.

impl<T: Config> Pallet<T>[src]

pub fn get_manager<KArg>(k: KArg) -> Option<Manager<T>> where
    KArg: EncodeLike<T::GroupId>, 
[src]

Maps tree id to the manager of the tree

impl<T: Config> Pallet<T>[src]

pub fn lowest_cached_block() -> T::BlockNumber[src]

Block number of the oldest set of roots that we are caching

impl<T: Config> Pallet<T>[src]

pub fn highest_cached_block() -> T::BlockNumber[src]

Block number of the newest set of roots that we are caching

impl<T: Config> Pallet<T>[src]

pub fn used_nullifiers<KArg>(k: KArg) -> bool where
    KArg: EncodeLike<(T::GroupId, ScalarData)>, 
[src]

Map of used nullifiers for each tree.

impl<T: Config> Pallet<T>[src]

pub fn stopped<KArg>(k: KArg) -> bool where
    KArg: EncodeLike<T::GroupId>, 
[src]

Indicates whether the group tree is stopped or not

impl<T: Config> Pallet<T>[src]

pub fn get_cache(
    group_id: T::GroupId,
    block_number: T::BlockNumber
) -> Vec<ScalarData>

Notable traits for Vec<u8, A>

impl<A> Write for Vec<u8, A> where
    A: Allocator
[src]

pub fn get_merkle_root(
    group_id: T::GroupId
) -> Result<ScalarData, DispatchError>
[src]

pub fn add_root_to_cache(
    group_id: T::GroupId,
    block_number: T::BlockNumber
) -> Result<(), DispatchError>
[src]

pub fn get_group(group_id: T::GroupId) -> Result<GroupTree, DispatchError>[src]

pub fn is_manager_required(sender: T::AccountId, manager: &Manager<T>) -> bool[src]

pub fn add_leaf(
    tree: &mut GroupTree,
    data: ScalarData,
    zero_tree: &Vec<[u8; 32]>,
    h: &Poseidon
)
[src]

Trait Implementations

impl<T: Config> Callable<T> for Pallet<T>[src]

type Call = Call<T>

impl<T> Clone for Pallet<T>[src]

impl<T> Debug for Pallet<T>[src]

impl<T> Eq for Pallet<T>[src]

impl<T: Config> GetPalletVersion for Pallet<T>[src]

impl<T: Config> Group<<T as Config>::AccountId, <T as Config>::BlockNumber, <T as Config>::GroupId> for Pallet<T>[src]

impl<T: Config> Hooks<<T as Config>::BlockNumber> for Pallet<T>[src]

impl<T: Config> IntegrityTest for Pallet<T>[src]

impl<T: Config> ModuleErrorMetadata for Pallet<T>[src]

impl<T: Config> OffchainWorker<<T as Config>::BlockNumber> for Pallet<T>[src]

impl<T: Config> OnFinalize<<T as Config>::BlockNumber> for Pallet<T>[src]

impl<T: Config> OnGenesis for Pallet<T>[src]

impl<T: Config> OnInitialize<<T as Config>::BlockNumber> for Pallet<T>[src]

impl<T: Config> OnRuntimeUpgrade for Pallet<T>[src]

impl<T> PartialEq<Pallet<T>> for Pallet<T>[src]

Auto Trait Implementations

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> CheckedConversion for T[src]

impl<T> DynClone for T where
    T: Clone
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> IsType<T> for T[src]

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

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

Get a reference to the inner from the outer.

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

Get a mutable reference to the inner from the outer.

impl<T> MaybeDebug for T where
    T: Debug

impl<T> MaybeDebug for T where
    T: Debug

impl<T> MaybeRefUnwindSafe for T where
    T: RefUnwindSafe

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

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> SaturatedConversion for T

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

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

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