From 6bae92943935a679ea577df7a42e6041bb342a76 Mon Sep 17 00:00:00 2001 From: Jordan Hrycaj Date: Tue, 6 Aug 2024 12:43:39 +0000 Subject: [PATCH] Added comments (#2546) --- nimbus/db/aristo/aristo_part.nim | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/nimbus/db/aristo/aristo_part.nim b/nimbus/db/aristo/aristo_part.nim index 3ed13083a..f2cd637fe 100644 --- a/nimbus/db/aristo/aristo_part.nim +++ b/nimbus/db/aristo/aristo_part.nim @@ -113,6 +113,7 @@ proc partUntwig*( root: Hash256; path: openArray[byte]; ): Result[Blob,AristoError] = + ## Verify the chain of rlp-encoded nodes and return the payload. try: let nibbles = NibblesBuf.fromBytes path return chain.trackRlpNodes(root.to(HashKey), nibbles, start=true) @@ -124,6 +125,7 @@ proc partUntwig*( root: Hash256; path: Hash256; ): Result[Blob,AristoError] = + ## Veriant of `partUntwig()`. chain.partUntwig(root, path.data) @@ -133,6 +135,11 @@ proc partUntwigOk*( path: openArray[byte]; payload: openArray[byte]; ): Result[void,AristoError] = + ## Verify the chain of rlp-encoded nodes and return the payload. + ## + ## Note: This function provides a functionality comparable to the + ## `isValidBranch()` function from `hexary.nim` + ## if payload == ? chain.partUntwig(root, path): ok() else: @@ -144,6 +151,7 @@ proc partUntwigOk*( path: Hash256; payload: openArray[byte]; ): Result[void,AristoError] = + ## Veriant of `partUntwigOk()`. chain.partUntwigOk(root, path.data, payload) # ----------------