private_event_sourcing_integrity

Function validate

Source
pub fn validate(op: Op) -> ExternResult<ValidateCallbackResult>
Expand description

This is the unified validation callback for all entries and link types in this integrity zome Below is a match template for all of the variants of DHT Ops and entry and link types

Holochain has already performed the following validation for you:

  • The action signature matches on the hash of its content and is signed by its author
  • The previous action exists, has a lower timestamp than the new action, and incremented sequence number
  • The previous action author is the same as the new action author
  • The timestamp of each action is after the DNA’s origin time
  • AgentActivity authorities check that the agent hasn’t forked their chain
  • The entry hash in the action matches the entry content
  • The entry type in the action matches the entry content
  • The entry size doesn’t exceed the maximum entry size (currently 4MB)
  • Private entry types are not included in the Op content, and public entry types are
  • If the Op is an update or a delete, the original action exists and is a Create or Update action
  • If the Op is an update, the original entry exists and is of the same type as the new one
  • If the Op is a delete link, the original action exists and is a CreateLink action
  • Link tags don’t exceed the maximum tag size (currently 1KB)
  • Countersigned entries include an action from each required signer

You can read more about validation here: https://docs.rs/hdi/latest/hdi/index.html#data-validation