Class

scorex.crypto.authds.avltree.batch

BatchAVLProver

Related Doc: package batch

Permalink

class BatchAVLProver[D <: Digest, HF <: CryptographicHash[D]] extends AuthenticatedTreeOps[D] with ToStringHelper with ScorexLogging

Implements the batch AVL prover from https://eprint.iacr.org/2016/994 Not thread safe if you use with ThreadUnsafeHash

Linear Supertypes
ScorexLogging, StrictLogging, AuthenticatedTreeOps[D], ToStringHelper, ScorexEncoding, BatchProofConstants, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. BatchAVLProver
  2. ScorexLogging
  3. StrictLogging
  4. AuthenticatedTreeOps
  5. ToStringHelper
  6. ScorexEncoding
  7. BatchProofConstants
  8. AnyRef
  9. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new BatchAVLProver(keyLength: Int, valueLengthOpt: Option[Int], oldRootAndHeight: Option[(ProverNodes[D], Int)] = None, collectChangedNodes: Boolean = true)(implicit hf: HF = Blake2b256)

    Permalink

    keyLength

    - length of keys in tree

    valueLengthOpt

    - length of values in tree. None if it is not fixed

    oldRootAndHeight

    - option root node and height of old tree. Tree should contain new nodes only WARNING if you pass it, all isNew and visited flags should be set correctly and height should be correct

    collectChangedNodes

    - changed nodes will be collected to a separate buffer during tree modifications if true

    hf

    - hash function

Type Members

  1. type ChangeHappened = Boolean

    Permalink
    Definition Classes
    AuthenticatedTreeOps
  2. type HeightIncreased = Boolean

    Permalink
    Definition Classes
    AuthenticatedTreeOps
  3. type ToDelete = Boolean

    Permalink
    Definition Classes
    AuthenticatedTreeOps

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. val EndOfTreeInPackagedProof: Byte

    Permalink
    Definition Classes
    BatchProofConstants
  5. val LabelInPackagedProof: Byte

    Permalink
    Definition Classes
    BatchProofConstants
  6. val LeafInPackagedProof: Byte

    Permalink
    Definition Classes
    BatchProofConstants
  7. val NegativeInfinityKey: ADKey

    Permalink
    Attributes
    protected
    Definition Classes
    AuthenticatedTreeOps
  8. val PositiveInfinityKey: ADKey

    Permalink
    Attributes
    protected
    Definition Classes
    AuthenticatedTreeOps
  9. def addNode(r: Leaf[D], key: ADKey, v: ADValue): InternalProverNode[D]

    Permalink

    returns

    - A new prover node with two leaves: r on the left and a new leaf containing key and value on the right

    Attributes
    protected
    Definition Classes
    BatchAVLProverAuthenticatedTreeOps
  10. def arrayToString(a: Array[Byte]): String

    Permalink
    Attributes
    protected
    Definition Classes
    ToStringHelper
  11. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  12. val changedNodesBuffer: ArrayBuffer[ProverNodes[D]]

    Permalink

    Sequence of leafs and internal nodes that where likely by modified after last proof generation

    Sequence of leafs and internal nodes that where likely by modified after last proof generation

    Attributes
    protected
    Definition Classes
    AuthenticatedTreeOps
  13. val changedNodesBufferToCheck: ArrayBuffer[ProverNodes[D]]

    Permalink

    Nodes that may, or may not be mofidied after last proof generation

    Nodes that may, or may not be mofidied after last proof generation

    Attributes
    protected
    Definition Classes
    AuthenticatedTreeOps
  14. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  15. val collectChangedNodes: Boolean

    Permalink

    - changed nodes will be collected to a separate buffer during tree modifications if true

    - changed nodes will be collected to a separate buffer during tree modifications if true

    Definition Classes
    BatchAVLProverAuthenticatedTreeOps
  16. def contains(key: ADKey, label: D): Boolean

    Permalink

    returns

    true if this tree has an element that has the same label, as node.label, false otherwise.

  17. def contains(node: ProverNodes[D]): Boolean

    Permalink

    returns

    true if this tree has an element that has the same label, as node.label, false otherwise.

  18. def digest: ADDigest

    Permalink

    Returns the current digest of the authenticated data structure, which contains the root hash and the root height

    Returns the current digest of the authenticated data structure, which contains the root hash and the root height

    returns

    - the digest

  19. def digest(rootNode: Node[D]): ADDigest

    Permalink

    The digest consists of the label of the root node followed by its height, expressed as a single (unsigned) byte

    The digest consists of the label of the root node followed by its height, expressed as a single (unsigned) byte

    Attributes
    protected
    Definition Classes
    AuthenticatedTreeOps
  20. implicit val encoder: BytesEncoder

    Permalink
    Definition Classes
    ScorexEncoding
  21. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  22. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  23. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  24. def generateProof(): SerializedAdProof

    Permalink

    Generates the proof for all the operations performed (except the ones that failed) since the last generateProof call

    Generates the proof for all the operations performed (except the ones that failed) since the last generateProof call

    returns

    - the proof

  25. def generateProofForOperations(operations: Seq[Operation]): Try[(SerializedAdProof, ADDigest)]

    Permalink

    Generates the proof for all the operations in the list.

    Generates the proof for all the operations in the list. Does NOT modify the tree

  26. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  27. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  28. implicit val hf: HF

    Permalink

    - hash function

  29. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  30. val keyLength: Int

    Permalink

    - length of keys in tree

    - length of keys in tree

    Definition Classes
    BatchAVLProverAuthenticatedTreeOps
  31. def keyMatchesLeaf(key: ADKey, r: Leaf[D]): Boolean

    Permalink

    Determines if the leaf r contains the key

    Determines if the leaf r contains the key

    Attributes
    protected
    Definition Classes
    BatchAVLProverAuthenticatedTreeOps
  32. val labelLength: Int

    Permalink
    Attributes
    protected
  33. def log: Logger

    Permalink
    Attributes
    protected
    Definition Classes
    ScorexLogging
    Annotations
    @inline()
  34. val logger: Logger

    Permalink
    Attributes
    protected
    Definition Classes
    StrictLogging
  35. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  36. def nextDirectionIsLeft(key: ADKey, r: InternalNode[D]): Boolean

    Permalink

    Figures out whether to go left or right when from node r when searching for the key; records the appropriate bit in the directions bit string to be used in the proof

    Figures out whether to go left or right when from node r when searching for the key; records the appropriate bit in the directions bit string to be used in the proof

    returns

    - true if to go left, false if to go right in the search

    Attributes
    protected
    Definition Classes
    BatchAVLProverAuthenticatedTreeOps
  37. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  38. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  39. def onNodeVisit(n: Node[D], operation: Operation, isRotate: Boolean = false): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    AuthenticatedTreeOps
  40. def performOneOperation(operation: Operation): Try[Option[ADValue]]

    Permalink

    If operation.key exists in the tree and the operation succeeds, returns Success(Some(v)), where v is the value associated with operation.key before the operation.

    If operation.key exists in the tree and the operation succeeds, returns Success(Some(v)), where v is the value associated with operation.key before the operation. If operation.key does not exists in the tree and the operation succeeds, returns Success(None). Returns Failure if the operation fails. Does not modify the tree or the proof in case return is Failure.

    returns

    - Success(Some(old value)), Success(None), or Failure

  41. def randomWalk(rand: Random = new Random): Option[(ADKey, ADValue)]

    Permalink

    rand

    - source of randomness

    returns

    Random leaf from the tree that is not positive or negative infinity

  42. def removedNodes(): List[ProverNodes[D]]

    Permalink

    returns

    nodes, that where presented in old tree (starting form oldTopNode, but are not presented in new tree

  43. def replayComparison: Int

    Permalink

    Deletions go down the tree twice -- once to find the leaf and realize that it needs to be deleted, and the second time to actually perform the deletion.

    Deletions go down the tree twice -- once to find the leaf and realize that it needs to be deleted, and the second time to actually perform the deletion. This method will re-create comparison results using directions array and lastRightStep variable. Each time it's called, it will give the next comparison result of key and node.key, where node starts at the root and progresses down the tree according to the comparison results.

    returns

    - result of previous comparison of key and relevant node's key

    Attributes
    protected
    Definition Classes
    BatchAVLProverAuthenticatedTreeOps
  44. def returnResultOfOneOperation(operation: Operation, rootNode: Node[D]): Try[(Node[D], Option[ADValue])]

    Permalink
    Attributes
    protected
    Definition Classes
    AuthenticatedTreeOps
  45. var rootNodeHeight: Int

    Permalink

    Longest path length in a tree

    Longest path length in a tree

    Definition Classes
    BatchAVLProverAuthenticatedTreeOps
  46. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  47. def toString(): String

    Permalink
    Definition Classes
    BatchAVLProver → AnyRef → Any
  48. def treeWalk[IR, LR](internalNodeFn: (InternalProverNode[D], IR) ⇒ (ProverNodes[D], IR), leafFn: (ProverLeaf[D], IR) ⇒ LR, initial: IR): LR

    Permalink

    Walk from tree to a leaf.

    Walk from tree to a leaf.

    IR

    - result of applying internalNodeFn to internal node. E.g. some accumutalor of previous results

    LR

    - result of applying leafFn to a leaf. Result of all walk application

    internalNodeFn

    - function applied to internal nodes. Takes current internal node and current IR, returns new internal nod and new IR

    leafFn

    - function applied to leafss. Takes current leaf and current IR, returns result of walk LR

    initial

    - initial value of IR

  49. def unauthenticatedLookup(key: ADKey): Option[ADValue]

    Permalink

    A simple non-modifying non-proof-generating lookup.

    A simple non-modifying non-proof-generating lookup. Does not mutate the data structure

    returns

    Some(value) for value associated with the given key if key is in the tree, and None otherwise

  50. val valueLengthOpt: Option[Int]

    Permalink

    - length of values in tree.

    - length of values in tree. None if it is not fixed

    Definition Classes
    BatchAVLProverAuthenticatedTreeOps
  51. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  52. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  53. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from ScorexLogging

Inherited from StrictLogging

Inherited from AuthenticatedTreeOps[D]

Inherited from ToStringHelper

Inherited from ScorexEncoding

Inherited from BatchProofConstants

Inherited from AnyRef

Inherited from Any

Ungrouped