From 526dc18785dbc3257789ebfed76d1e8483687432 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillem=20C=C3=B3rdoba?= Date: Thu, 5 Oct 2023 00:07:28 +0200 Subject: [PATCH] Fixed doc comment --- EXERCISES.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/EXERCISES.md b/EXERCISES.md index fdfcb21..f50cb74 100644 --- a/EXERCISES.md +++ b/EXERCISES.md @@ -160,9 +160,10 @@ Go into `dnas/lobby/integrity_zomes/private_publication/src/properties.rs`: 3. Add a `Properties` struct, with only a `progenitor` field of type `AgentPubKeyB64`. - Annotate this struct with `#[derive(Serialize, Deserialize, Debug, SerializedBytes)]`. -- Create an extern function `progenitor` that doesn't have any input parameters and that returns the `AgentPubKey` for the progenitor of this DNA. - - Get the serialized properties with `dna_info()?.properties`. +- Create an extern function `progenitor` that doesn't have any input parameters and that returns an `ExternResult` with the `AgentPubKey` for the progenitor of this DNA. + - Get the serialized properties with `dna_info()?.modifiers.properties`. - Transform that serialized properties type into our `Properties` struct. + - You can deserialize any type that is annotated with `SerializedBytes` using `try_from`: `Properties::try_from(serialized_bytes).map_err(|err| wasm_error!(err))?` - Convert the `AgentPubKeyB64` into an `AgentPubKey` with `AgentPubKey::from()`. Now go into `dnas/private_publication/integrity_zomes/private_publication/src/validation.rs`. There you can see boilerplate that allows for the genesis self-check and for different validations for the two kinds of entries present in that DNA.