AccountUpdateForest
Class which represents a forest (list of trees) of account updates, in a compressed way which allows iterating and selectively witnessing the account updates.
The (recursive) type signature is:
type AccountUpdateForest = MerkleList<AccountUpdateTree>;
type AccountUpdateTree = {
accountUpdate: Hashed<AccountUpdate>;
children: AccountUpdateForest;
};
Extends
MerkleList
<{"accountUpdate"
:HashedAccountUpdate
;"children"
:MerkleListBase
<AccountUpdateTreeBase
>;"id"
:RandomId
; },this
>
Constructors
new AccountUpdateForest()
new AccountUpdateForest(__namedParameters: MerkleListBase<{
"accountUpdate": HashedAccountUpdate;
"children": MerkleListBase<AccountUpdateTreeBase>;
"id": RandomId;
}>): AccountUpdateForest
Parameters
• __namedParameters: MerkleListBase
<{
"accountUpdate"
: HashedAccountUpdate
;
"children"
: MerkleListBase
<AccountUpdateTreeBase
>;
"id"
: RandomId
;
}>
Returns
Inherited from
Source
lib/provable/merkle-list.ts:84
Properties
data
data: Unconstrained<WithHash<{
"accountUpdate": HashedAccountUpdate;
"children": MerkleListBase<AccountUpdateTreeBase>;
"id": RandomId;
}>[]>;
Inherited from
Source
lib/provable/merkle-list.ts:82
hash
hash: Field;
Inherited from
Source
lib/provable/merkle-list.ts:81
_emptyHash
static _emptyHash: undefined | Field;
Inherited from
Source
lib/provable/merkle-list.ts:350
_innerProvable
static _innerProvable: undefined | ProvableHashable<any>;
Inherited from
Source
lib/provable/merkle-list.ts:353
_nextHash
static _nextHash: undefined | (hash: Field, t: any) => Field;
Inherited from
Source
lib/provable/merkle-list.ts:349
_provable
static _provable: undefined | ProvableHashable<MerkleList<any>>;
Inherited from
Source
lib/provable/merkle-list.ts:352
provable
static provable: {
"check": void;
"empty": AccountUpdateForest;
"fromFields": AccountUpdateForest;
"fromValue": AccountUpdateForest;
"sizeInFields": number;
"toAuxiliary": any[];
"toFields": Field[];
"toInput": HashInput;
"toValue": any;
};
check()
Parameters
• value: AccountUpdateForest
| MerkleList
<{
"accountUpdate"
: HashedAccountUpdate
;
"children"
: MerkleListBase
<AccountUpdateTreeBase
>;
"id"
: RandomId
;
}>
Returns
void
empty()
Returns
fromFields()
Parameters
• fields: Field
[]
• aux: any
[]
Returns
fromValue()
Parameters
• value: any
Returns
sizeInFields()
Returns
number
toAuxiliary()
Parameters
• value?: AccountUpdateForest
| MerkleList
<{
"accountUpdate"
: HashedAccountUpdate
;
"children"
: MerkleListBase
<AccountUpdateTreeBase
>;
"id"
: RandomId
;
}>
Returns
any
[]
toFields()
Parameters
• value: AccountUpdateForest
| MerkleList
<{
"accountUpdate"
: HashedAccountUpdate
;
"children"
: MerkleListBase
<AccountUpdateTreeBase
>;
"id"
: RandomId
;
}>
Returns
Field
[]
toInput()
Parameters
• value: AccountUpdateForest
| MerkleList
<{
"accountUpdate"
: HashedAccountUpdate
;
"children"
: MerkleListBase
<AccountUpdateTreeBase
>;
"id"
: RandomId
;
}>
Returns
HashInput
toValue()
Parameters
• value: AccountUpdateForest
| MerkleList
<{
"accountUpdate"
: HashedAccountUpdate
;
"children"
: MerkleListBase
<AccountUpdateTreeBase
>;
"id"
: RandomId
;
}>
Returns
any
Overrides
MerkleList.create( AccountUpdateTreeBase, merkleListHash ).provable
Source
lib/mina/account-update.ts:1379
Accessors
Constructor
get Constructor(): typeof MerkleList
Returns
typeof MerkleList
Source
lib/provable/merkle-list.ts:355
innerProvable
get innerProvable(): ProvableHashable<T>
Returns
Source
lib/provable/merkle-list.ts:372
emptyHash
get static emptyHash(): Field
Returns
Source
lib/provable/merkle-list.ts:367
Methods
clone()
clone(): MerkleList<{
"accountUpdate": HashedAccountUpdate;
"children": MerkleListBase<AccountUpdateTreeBase>;
"id": RandomId;
}>
Returns
MerkleList
<{
"accountUpdate"
: HashedAccountUpdate
;
"children"
: MerkleListBase
<AccountUpdateTreeBase
>;
"id"
: RandomId
;
}>
accountUpdate
accountUpdate: Hashed<AccountUpdate> = HashedAccountUpdate;
children
children: MerkleListBase<AccountUpdateTreeBase>;
id
id: number = RandomId;
Inherited from
Source
lib/provable/merkle-list.ts:223
forEach()
forEach(length: number, callback: (element: {
"accountUpdate": HashedAccountUpdate;
"children": MerkleListBase<AccountUpdateTreeBase>;
"id": RandomId;
}, isDummy: Bool, i: number) => void): void
Iterate through the list in a fixed number of steps any apply a given callback on each element.
Proves that the iteration traverses the entire list. Once past the last element, dummy elements will be passed to the callback.
Note: There are no guarantees about the contents of dummy elements, so the callback is expected
to handle the isDummy
flag separately.
Parameters
• length: number
• callback
Returns
void
Inherited from
Source
lib/provable/merkle-list.ts:237
isEmpty()
isEmpty(): Bool
Returns
Inherited from
Source
lib/provable/merkle-list.ts:89
lengthUnconstrained()
lengthUnconstrained(): Unconstrained<number>
Returns
Unconstrained
<number
>
Inherited from
MerkleList
.lengthUnconstrained
Source
lib/provable/merkle-list.ts:267
nextHash()
nextHash(hash: Field, value: {
"accountUpdate": HashedAccountUpdate;
"children": MerkleListBase<AccountUpdateTreeBase>;
"id": RandomId;
}): Field
Parameters
• hash: Field
• value
• value.accountUpdate: Hashed
<AccountUpdate
>= HashedAccountUpdate
• value.children: MerkleListBase
<AccountUpdateTreeBase
>= undefined
• value.id: number
= RandomId
Returns
Inherited from
Source
lib/provable/merkle-list.ts:359
pop()
pop(): {
"accountUpdate": HashedAccountUpdate;
"children": MerkleListBase<AccountUpdateTreeBase>;
"id": RandomId;
}
Remove the last element from the list and return it.
If the list is empty, returns a dummy element.
Returns
{
"accountUpdate": HashedAccountUpdate;
"children": MerkleListBase<AccountUpdateTreeBase>;
"id": RandomId;
}
accountUpdate
accountUpdate: Hashed<AccountUpdate> = HashedAccountUpdate;
children
children: MerkleListBase<AccountUpdateTreeBase>;
id
id: number = RandomId;
Inherited from
Source
lib/provable/merkle-list.ts:155
popExn()
popExn(): {
"accountUpdate": HashedAccountUpdate;
"children": MerkleListBase<AccountUpdateTreeBase>;
"id": RandomId;
}
Remove the last element from the list and return it.
This proves that the list is non-empty, and fails otherwise.
Returns
{
"accountUpdate": HashedAccountUpdate;
"children": MerkleListBase<AccountUpdateTreeBase>;
"id": RandomId;
}
accountUpdate
accountUpdate: Hashed<AccountUpdate> = HashedAccountUpdate;
children
children: MerkleListBase<AccountUpdateTreeBase>;
id
id: number = RandomId;
Inherited from
Source
lib/provable/merkle-list.ts:140
popIf()
popIf(condition: Bool): {
"accountUpdate": HashedAccountUpdate;
"children": MerkleListBase<AccountUpdateTreeBase>;
"id": RandomId;
}
Return the last element, but only remove it if condition
is true.
If the list is empty, returns a dummy element.
Parameters
• condition: Bool
Returns
{
"accountUpdate": HashedAccountUpdate;
"children": MerkleListBase<AccountUpdateTreeBase>;
"id": RandomId;
}
accountUpdate
accountUpdate: Hashed<AccountUpdate> = HashedAccountUpdate;
children
children: MerkleListBase<AccountUpdateTreeBase>;
id
id: number = RandomId;
Inherited from
Source
lib/provable/merkle-list.ts:174
popIfUnsafe()
popIfUnsafe(shouldPop: Bool): {
"accountUpdate": HashedAccountUpdate;
"children": MerkleListBase<AccountUpdateTreeBase>;
"id": RandomId;
}
Low-level, minimal version of pop()
which lets the caller decide whether there is an element to pop.
I.e. this proves:
- If the input condition is true, this returns the last element and removes it from the list.
- If the input condition is false, the list is unchanged and the return value is garbage.
Note that if the caller passes true
but the list is empty, this will fail.
If the caller passes false
but the list is non-empty, this succeeds and just doesn't pop off an element.