-
Notifications
You must be signed in to change notification settings - Fork 262
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
126 changed files
with
10,580 additions
and
5,562 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
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,16 @@ | ||
from enum import Enum | ||
|
||
|
||
class HttpStatusCode(Enum): | ||
""" | ||
See HTTP status codes in Wikipedia: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes. | ||
""" | ||
|
||
# Success. | ||
OK = 200 | ||
|
||
# Client Errors. | ||
BAD_REQUEST = 400 | ||
|
||
# Server Errors. | ||
INTERNAL_SERVER_ERROR = 500 |
2 changes: 1 addition & 1 deletion
2
src/starkware/cairo/cairo_verifier/layouts/all_cairo/program_hash.json
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,3 +1,3 @@ | ||
{ | ||
"program_hash": "0x4be98ab4e3f3d142b0323d537a98b1f3c9886e142c83d9c2125a718cbac41d4" | ||
"program_hash": "0x271bc26265915a6fb21e99388451ef7491c5ec3229546381a7e2b581ecb699a" | ||
} |
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 |
---|---|---|
@@ -1 +1 @@ | ||
0.11.2 | ||
0.12.0a0 |
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 |
---|---|---|
@@ -1,25 +1,45 @@ | ||
import dataclasses | ||
from typing import Optional | ||
|
||
from starkware.cairo.lang.builtins.instance_def import BuiltinInstanceDef | ||
|
||
# Each bitwise operation consists of 5 cells (two inputs and three outputs - and, or, xor). | ||
CELLS_PER_BITWISE = 5 | ||
HEIGHT = 64 | ||
INPUT_CELLS_PER_BITWISE = 2 | ||
|
||
|
||
@dataclasses.dataclass | ||
class BitwiseInstanceDef: | ||
# Defines the ratio between the number of steps to the number of bitwise instances. | ||
# For every ratio steps, we have one instance. | ||
# None means dynamic ratio. | ||
ratio: Optional[int] | ||
|
||
class BitwiseInstanceDef(BuiltinInstanceDef): | ||
# The number of bits in a single field element that are supported by the bitwise builtin. | ||
total_n_bits: int | ||
|
||
@property | ||
def cells_per_builtin(self): | ||
def cells_per_builtin(self) -> int: | ||
return CELLS_PER_BITWISE | ||
|
||
@property | ||
def range_check_units_per_builtin(self): | ||
def range_check_units_per_builtin(self) -> int: | ||
return 0 | ||
|
||
@property | ||
def invocation_height(self) -> int: | ||
return HEIGHT | ||
|
||
def get_diluted_units_per_builtin(self, diluted_spacing: int, diluted_n_bits: int) -> int: | ||
""" | ||
Calculates the number of diluted check units used by one bitwise builtin. | ||
""" | ||
partition = [ | ||
i + j | ||
for i in range(0, self.total_n_bits, diluted_spacing * diluted_n_bits) | ||
for j in range(diluted_spacing) | ||
if i + j < self.total_n_bits | ||
] | ||
num_trimmed = len( | ||
[ | ||
1 | ||
for shift in partition | ||
if shift + diluted_spacing * (diluted_n_bits - 1) + 1 > self.total_n_bits | ||
] | ||
) | ||
return 4 * len(partition) + num_trimmed |
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,28 +1,32 @@ | ||
import dataclasses | ||
from typing import Optional | ||
|
||
from starkware.cairo.lang.builtins.instance_def import BuiltinInstanceDef | ||
|
||
# Each EC operation P + m * Q = R contains 7 cells: P_x, P_y, Q_x, Q_y, m, R_x, R_y. | ||
CELLS_PER_EC_OP = 7 | ||
INPUT_CELLS_PER_EC_OP = 5 | ||
|
||
|
||
@dataclasses.dataclass | ||
class EcOpInstanceDef: | ||
# Defines the ratio between the number of steps to the number of EC op instances. | ||
# For every ratio steps, we have one instance. | ||
# None means dynamic ratio. | ||
ratio: Optional[int] | ||
|
||
class EcOpInstanceDef(BuiltinInstanceDef): | ||
# Size of coefficient. | ||
scalar_height: int | ||
scalar_bits: int | ||
# The upper bound on the multiplication scalar, m. If None, the upper bound is 2^scalar_bits. | ||
scalar_limit: Optional[int] = None | ||
|
||
@property | ||
def cells_per_builtin(self): | ||
def cells_per_builtin(self) -> int: | ||
return CELLS_PER_EC_OP | ||
|
||
@property | ||
def range_check_units_per_builtin(self): | ||
def range_check_units_per_builtin(self) -> int: | ||
return 0 | ||
|
||
@property | ||
def invocation_height(self) -> int: | ||
return self.scalar_height | ||
|
||
def get_diluted_units_per_builtin(self, diluted_spacing: int, diluted_n_bits: int) -> int: | ||
return 0 |
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.