Module pallet_anchors::pallet::dispatchables
source · Expand description
Functions§
- Commits a
document_root
of a merklized off chain document in Centrifuge p2p network as the latest version id(anchor_id
) obtained by hashinganchor_id_preimage
. If a pre-commit exists for the obtainedanchor_id
, hash of pre-committedsigning_root + proof
must match the givendoc_root
. Any pre-committed data is automatically removed on a succesful commit and the reserved funds fromPallet::pre_commit()
are returned to the same account. To avoid state bloat on chain, the committed anchor would be evicted after the givenstored_until_date
. The calling account would be charged accordingly for the storage period. For a more detailed explanation refer section 3.4 of Centrifuge Protocol Paper - Initiates eviction of expired anchors. Since anchors are stored on a child trie indexed by their eviction date, what this function does is to remove those child tries which has date_represented_by_root < current_date. Additionally it needs to take care of indexes created for accessing anchors, eg: to find an anchor given an id.
- Initiates eviction of pre-commits that has expired given a list on anchor ids. For each evicted pre-commits, the deposit holded by
Pallet::pre_commit()
call will be returned to the same account that made it originally. - Obtains an exclusive lock to make the next update to a certain document version identified by
anchor_id
on Centrifuge p2p network for a number of blocks given byPRE_COMMIT_EXPIRATION_DURATION_BLOCKS
value.signing_root
is a child node of the off-chain merkle tree of that document. In Centrifuge protocol, a document is committed only after reaching consensus with the other collaborators on the document. Consensus is reached by getting a cryptographic signature from other parties by sending them thesigning_root
. To deny the counter-party the free option of publishing its own state commitment upon receiving a request for signature, the node can first publish a pre-commit. Only the pre-committer account in the Centrifuge chain is allowed tocommit
a corresponding anchor before the pre-commit has expired. Some funds are reserved on a succesful pre-commit call. These funds are returned to the same account after a succesfulPallet::commit()
call or explicitely if evicting the pre-commits by callingPallet::evict_pre_commits()
. For a more detailed explanation refer section 3.4 of Centrifuge Protocol Paper