-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated Cairo builtins, changed name of file from builtins.adoc to ca…
…iro-builtins.adoc.
- Loading branch information
Showing
3 changed files
with
27 additions
and
153 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
152 changes: 0 additions & 152 deletions
152
.../Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/builtins.adoc
This file was deleted.
Oops, something went wrong.
26 changes: 26 additions & 0 deletions
26
...net/modules/architecture_and_concepts/pages/Smart_Contracts/cairo-builtins.adoc
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,26 @@ | ||
[id="cairo-builtins"] | ||
= Cairo builtins | ||
|
||
_Builtins_ in Cairo are predefined optimized low-level execution units that the Cairo VM refers to in order to perform predefined computations that are expensive to perform in standard Cairo. Builtins enhance the functionality of the Cairo VM, enabling you to perform certain tasks, such as using the Poseidon hash, range-checks, or ECDSA signature verifications, more efficiently, using less gas. | ||
|
||
In contrast to CairoZero, where you needed to consiously write code to take advantage of builitn optimizations, in Cairo, you simply write high-level code without doing anything special, and when the Cairo VM executes the code, certain operations take advantage of builtins to optimize logic and use less gas. | ||
|
||
[#list-of-cairo-builtins] | ||
.List of Cairo builtins | ||
|
||
[cols="1,2",] | ||
|=== | ||
|Name of builtin | Description | ||
|
||
|Pedersen |Computes the Pedersen hash over two elements. For more information see xref:architecture_and_concepts:Cryptography/hash-functions.adoc[]. | ||
|Poseidon |Computes the Hades permutation on three field elements. For more info, see xref to Hash functions topic. The Cairo corelib functions use this builtin under the hood. The Cairo corelib functions are defined in link:https://github.com/starkware-libs/cairo/blob/v2.6.0/corelib/src/starknet/info.cairo[`info.cairo`] in the Cairo GitHub repository. | ||
|Range check a| | ||
Checks whether a field element is in the range [0,2^128^-1]. | ||
|
||
All arithmetic comparisons use the range check builtin. | ||
|
||
|ECDSA |Verifies the validity of an ECDSA signature over the STARK curve. | ||
|Keccak | _TBD_ | ||
|Bitwise |Computes the bitwise operations `OR`, `AND`, and `XOR` of two felts. | ||
|EC_OP |Multiplies a point on the STARK curve by a scalar. | ||
|=== |