-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
API: argument order of functions (breaking external Nim/C/Go/Rust API…
… of Ethereum KZG EIP-4844)
- Loading branch information
Showing
21 changed files
with
323 additions
and
227 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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Architecture | ||
|
||
## APIs | ||
|
||
### Argument orders | ||
|
||
Function calls have arguments ordered the following way: | ||
|
||
1. Context arguments | ||
2. Threadpool context | ||
3. OUT arguments (only written to) | ||
4. INOUT arguments | ||
5. IN arguments | ||
|
||
The first context argument should allow method call syntax | ||
|
||
In C, length of arrays immediately follow the array, unless there are multiple array arguments with same length. | ||
If an argument is associated with a label, for domain separation for example, | ||
that label precedes the argument. | ||
|
||
### Return values | ||
|
||
Constantine avoids returning values bigger than the word size | ||
and prefer mutable out parameters. | ||
|
||
1. In some cases they introduce extra copies. | ||
2. There is less guarantees over stack space usage. | ||
3. Nim will zero the values without {.noInit.} | ||
and that zeroing might not be optimized away by the compiler | ||
on large inputs like `Fp12[BLS12_381]` 48\*12 bytes = 576 bytes. | ||
4. As we sometimes return SecretBool or status code, this keeps the API consistent. | ||
|
||
## Code organization | ||
|
||
TBD |
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.