Function hdk::prelude::must_get_entry

source ·
pub fn must_get_entry(
    entry_hash: HoloHash<Entry>
) -> Result<HoloHashed<Entry>, WasmError>
Expand description

MUST get an EntryHashed at a given EntryHash.

The EntryHashed is NOT guaranteed to be associated with a valid (or even validated) Action/Record. For example, an invalid Record could be published and must_get_entry would return the EntryHashed.

This may be useful during validation callbacks where the validity and relevance of some content can be asserted by the CURRENT validation callback independent of a Record. This behaviour avoids the potential for eclipse attacks to lie about the validity of some data and cause problems for a hApp. If you NEED to know that a dependency is valid in order for the current validation logic (e.g. inductive validation of a tree) then must_get_valid_record is likely what you need.

must_get_entry is available in contexts such as validation where both determinism and network access is desirable.

An EntryHashed will NOT be returned if:

  • @TODO It is PURGED (community redacted entry)
  • @TODO ALL actions pointing to it are WITHDRAWN by the authors
  • ALL actions pointing to it are ABANDONED by ALL authorities due to validation failure
  • Nobody knows about it on the currently visible network

If an EntryHashed fails to be returned:

  • Callbacks will return early with UnresolvedDependencies
  • Zome calls will receive a WasmError from the host