Struct pallet_merkle::pallet::Pallet [−][src]
Implementations
impl<T: Config> Pallet<T>
[src]
pub fn create_group(
origin: OriginFor<T>,
r_is_mgr: bool,
_depth: Option<u8>
) -> DispatchResultWithPostInfo
[src]
origin: OriginFor<T>,
r_is_mgr: bool,
_depth: Option<u8>
) -> DispatchResultWithPostInfo
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]
origin: OriginFor<T>,
group_id: T::GroupId,
manager_required: bool
) -> DispatchResultWithPostInfo
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]
origin: OriginFor<T>,
group_id: T::GroupId,
new_manager: T::AccountId
) -> DispatchResultWithPostInfo
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]
origin: OriginFor<T>,
group_id: T::GroupId,
stopped: bool
) -> DispatchResultWithPostInfo
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]
origin: OriginFor<T>,
group_id: T::GroupId,
members: Vec<ScalarData>
) -> DispatchResultWithPostInfo
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]
origin: OriginFor<T>,
group_id: T::GroupId,
leaf: ScalarData,
path: Vec<(bool, ScalarData)>
) -> DispatchResultWithPostInfo
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]
KArg: EncodeLike<T::GroupId>,
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>ⓘ where
KArg1: EncodeLike<T::BlockNumber>,
KArg2: EncodeLike<T::GroupId>,
[src]
KArg1: EncodeLike<T::BlockNumber>,
KArg2: EncodeLike<T::GroupId>,
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]
KArg: EncodeLike<T::GroupId>,
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]
KArg: EncodeLike<(T::GroupId, ScalarData)>,
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]
KArg: EncodeLike<T::GroupId>,
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>ⓘ
[src]
group_id: T::GroupId,
block_number: T::BlockNumber
) -> Vec<ScalarData>ⓘ
pub fn get_merkle_root(
group_id: T::GroupId
) -> Result<ScalarData, DispatchError>
[src]
group_id: T::GroupId
) -> Result<ScalarData, DispatchError>
pub fn add_root_to_cache(
group_id: T::GroupId,
block_number: T::BlockNumber
) -> Result<(), DispatchError>
[src]
group_id: T::GroupId,
block_number: T::BlockNumber
) -> Result<(), DispatchError>
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]
tree: &mut GroupTree,
data: ScalarData,
zero_tree: &Vec<[u8; 32]>,
h: &Poseidon
)
Trait Implementations
impl<T: Config> Callable<T> for Pallet<T>
[src]
impl<T> Clone for Pallet<T>
[src]
fn clone(&self) -> Self
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T> Debug for Pallet<T>
[src]
impl<T> Eq for Pallet<T>
[src]
impl<T: Config> GetPalletVersion for Pallet<T>
[src]
fn current_version() -> PalletVersion
[src]
fn storage_version() -> Option<PalletVersion>
[src]
impl<T: Config> Group<<T as Config>::AccountId, <T as Config>::BlockNumber, <T as Config>::GroupId> for Pallet<T>
[src]
fn create_group(
sender: T::AccountId,
is_manager_required: bool,
depth: u8
) -> Result<T::GroupId, DispatchError>
[src]
sender: T::AccountId,
is_manager_required: bool,
depth: u8
) -> Result<T::GroupId, DispatchError>
fn set_stopped(
sender: T::AccountId,
id: T::GroupId,
stopped: bool
) -> Result<(), DispatchError>
[src]
sender: T::AccountId,
id: T::GroupId,
stopped: bool
) -> Result<(), DispatchError>
fn set_manager_required(
sender: T::AccountId,
id: T::GroupId,
manager_required: bool
) -> Result<(), DispatchError>
[src]
sender: T::AccountId,
id: T::GroupId,
manager_required: bool
) -> Result<(), DispatchError>
fn set_manager(
sender: T::AccountId,
id: T::GroupId,
new_manager: T::AccountId
) -> Result<(), DispatchError>
[src]
sender: T::AccountId,
id: T::GroupId,
new_manager: T::AccountId
) -> Result<(), DispatchError>
fn add_members(
sender: T::AccountId,
id: T::GroupId,
members: Vec<ScalarData>
) -> Result<(), DispatchError>
[src]
sender: T::AccountId,
id: T::GroupId,
members: Vec<ScalarData>
) -> Result<(), DispatchError>
fn add_nullifier(
sender: T::AccountId,
id: T::GroupId,
nullifier_hash: ScalarData
) -> Result<(), DispatchError>
[src]
sender: T::AccountId,
id: T::GroupId,
nullifier_hash: ScalarData
) -> Result<(), DispatchError>
fn has_used_nullifier(
id: T::GroupId,
nullifier: ScalarData
) -> Result<(), DispatchError>
[src]
id: T::GroupId,
nullifier: ScalarData
) -> Result<(), DispatchError>
fn verify(
id: T::GroupId,
leaf: ScalarData,
path: Vec<(bool, ScalarData)>
) -> Result<(), DispatchError>
[src]
id: T::GroupId,
leaf: ScalarData,
path: Vec<(bool, ScalarData)>
) -> Result<(), DispatchError>
fn verify_zk_membership_proof(
group_id: T::GroupId,
cached_block: T::BlockNumber,
cached_root: ScalarData,
comms: Vec<Commitment>,
nullifier_hash: ScalarData,
proof_bytes: Vec<u8>,
leaf_index_commitments: Vec<Commitment>,
proof_commitments: Vec<Commitment>,
recipient: ScalarData,
relayer: ScalarData
) -> Result<(), DispatchError>
[src]
group_id: T::GroupId,
cached_block: T::BlockNumber,
cached_root: ScalarData,
comms: Vec<Commitment>,
nullifier_hash: ScalarData,
proof_bytes: Vec<u8>,
leaf_index_commitments: Vec<Commitment>,
proof_commitments: Vec<Commitment>,
recipient: ScalarData,
relayer: ScalarData
) -> Result<(), DispatchError>
fn verify_zk(
pc_gens: PedersenGens,
m_root: ScalarData,
depth: u8,
comms: Vec<Commitment>,
nullifier_hash: ScalarData,
proof_bytes: Vec<u8>,
leaf_index_commitments: Vec<Commitment>,
proof_commitments: Vec<Commitment>,
recipient: ScalarData,
relayer: ScalarData
) -> Result<(), DispatchError>
[src]
pc_gens: PedersenGens,
m_root: ScalarData,
depth: u8,
comms: Vec<Commitment>,
nullifier_hash: ScalarData,
proof_bytes: Vec<u8>,
leaf_index_commitments: Vec<Commitment>,
proof_commitments: Vec<Commitment>,
recipient: ScalarData,
relayer: ScalarData
) -> Result<(), DispatchError>
impl<T: Config> Hooks<<T as Config>::BlockNumber> for Pallet<T>
[src]
fn on_initialize(_n: T::BlockNumber) -> Weight
[src]
fn on_finalize(n: T::BlockNumber)
[src]
pub fn on_runtime_upgrade() -> u64
[src]
pub fn offchain_worker(_n: BlockNumber)
[src]
pub fn integrity_test()
[src]
impl<T: Config> IntegrityTest for Pallet<T>
[src]
fn integrity_test()
[src]
impl<T: Config> ModuleErrorMetadata for Pallet<T>
[src]
fn metadata() -> &'static [ErrorMetadata]ⓘ
[src]
impl<T: Config> OffchainWorker<<T as Config>::BlockNumber> for Pallet<T>
[src]
fn offchain_worker(n: <T as Config>::BlockNumber)
[src]
impl<T: Config> OnFinalize<<T as Config>::BlockNumber> for Pallet<T>
[src]
fn on_finalize(n: <T as Config>::BlockNumber)
[src]
impl<T: Config> OnGenesis for Pallet<T>
[src]
fn on_genesis()
[src]
impl<T: Config> OnInitialize<<T as Config>::BlockNumber> for Pallet<T>
[src]
fn on_initialize(n: <T as Config>::BlockNumber) -> Weight
[src]
impl<T: Config> OnRuntimeUpgrade for Pallet<T>
[src]
fn on_runtime_upgrade() -> Weight
[src]
impl<T> PartialEq<Pallet<T>> for Pallet<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for Pallet<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Pallet<T> where
T: Send,
T: Send,
impl<T> Sync for Pallet<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Pallet<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Pallet<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CheckedConversion for T
[src]
pub fn checked_from<T>(t: T) -> Option<Self> where
Self: TryFrom<T>,
[src]
Self: TryFrom<T>,
pub fn checked_into<T>(self) -> Option<T> where
Self: TryInto<T>,
[src]
Self: TryInto<T>,
impl<T> DynClone for T where
T: Clone,
[src]
T: Clone,
pub fn __clone_box(&self, Private) -> *mut ()
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> IsType<T> for T
[src]
pub fn from_ref(t: &T) -> &T
[src]
pub fn into_ref(&self) -> &T
[src]
pub fn from_mut(t: &mut T) -> &mut T
[src]
pub fn into_mut(&mut self) -> &mut T
[src]
impl<T, Outer> IsWrappedBy<Outer> for T where
T: From<Outer>,
Outer: AsRef<T> + AsMut<T> + From<T>,
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,
T: Debug,
impl<T> MaybeDebug for T where
T: Debug,
T: Debug,
impl<T> MaybeRefUnwindSafe for T where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Member for T where
T: 'static + Clone + PartialEq<T> + Eq + Send + Sync + Debug,
[src]
T: 'static + Clone + PartialEq<T> + Eq + Send + Sync + Debug,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> SaturatedConversion for T
pub fn saturated_from<T>(t: T) -> Self where
Self: UniqueSaturatedFrom<T>,
Self: UniqueSaturatedFrom<T>,
pub fn saturated_into<T>(self) -> T where
Self: UniqueSaturatedInto<T>,
Self: UniqueSaturatedInto<T>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
SS: SubsetOf<SP>,
pub fn to_subset(&self) -> Option<SS>
pub fn is_in_subset(&self) -> bool
pub fn to_subset_unchecked(&self) -> SS
pub fn from_subset(element: &SS) -> SP
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<S, T> UncheckedInto<T> for S where
T: UncheckedFrom<S>,
T: UncheckedFrom<S>,
pub fn unchecked_into(self) -> T
impl<T, S> UniqueSaturatedInto<T> for S where
T: Bounded,
S: TryInto<T>,
T: Bounded,
S: TryInto<T>,
pub fn unique_saturated_into(self) -> T
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,