-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
98 changed files
with
3,078 additions
and
868 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,6 @@ prometheus-client | |
pytest | ||
pytest-asyncio | ||
PyYAML | ||
typeguard | ||
typeguard<3.0.0 | ||
sympy | ||
Web3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Maximum length of an edge. | ||
const MAX_LENGTH = 251; | ||
|
||
// A struct of globals that are passed throughout the algorithm. | ||
struct ParticiaGlobals { | ||
// An array of size MAX_LENGTH, where pow2[i] = 2**i. | ||
pow2: felt*, | ||
// Offset of the relevant value field in DictAccess. | ||
// 1 if the previous tree is traversed and 2 if the new tree is traversed. | ||
access_offset: felt, | ||
} | ||
|
||
// Represents an edge node: a subtree with a path, s.t. all leaves not under that path are 0. | ||
struct NodeEdge { | ||
length: felt, | ||
path: felt, | ||
bottom: felt, | ||
} | ||
|
||
// Holds the constants needed for Patricia updates. | ||
struct PatriciaUpdateConstants { | ||
globals_pow2: felt*, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from starkware.cairo.common.cairo_builtins import PoseidonBuiltin | ||
from starkware.cairo.common.dict import DictAccess | ||
from starkware.cairo.common.patricia_utils import PatriciaUpdateConstants | ||
from starkware.cairo.common.patricia_with_sponge import ( | ||
patricia_update_using_update_constants as patricia_update_using_update_constants_with_sponge, | ||
) | ||
from starkware.cairo.common.sponge_as_hash import SpongeHashBuiltin | ||
|
||
func patricia_update_using_update_constants{poseidon_ptr: PoseidonBuiltin*, range_check_ptr}( | ||
patricia_update_constants: PatriciaUpdateConstants*, | ||
update_ptr: DictAccess*, | ||
n_updates: felt, | ||
height: felt, | ||
prev_root: felt, | ||
new_root: felt, | ||
) { | ||
let hash_ptr = cast(poseidon_ptr, SpongeHashBuiltin*); | ||
|
||
with hash_ptr { | ||
patricia_update_using_update_constants_with_sponge( | ||
patricia_update_constants=patricia_update_constants, | ||
update_ptr=update_ptr, | ||
n_updates=n_updates, | ||
height=height, | ||
prev_root=prev_root, | ||
new_root=new_root, | ||
); | ||
} | ||
|
||
// Update poseidon_ptr. | ||
let poseidon_ptr = cast(hash_ptr, PoseidonBuiltin*); | ||
|
||
return (); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.11.0a0 | ||
0.11.0a1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.