-
Notifications
You must be signed in to change notification settings - Fork 187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[website/docs]: add page on EVM precompiles #944
Conversation
docs/src/spec/precompiles.md
Outdated
|
||
### Parameters | ||
|
||
- `input_buf`: a sequence of bytes to hash, `MemoryBuffer` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The input argument at the callsite is buf
; input_buf
is the name of the value used internally in the function (argument labelling scheme was borrowed from swift, btw). The signature should probably be written sha2_256(buf: MemoryBuffer) -> u256
.
(I'd argue that these single-argument functions should be defined as e.g. sha2_256(_ input_buf: MemoryBuffer) -> u256
, so they can be called without a label on the arg.)
docs/src/spec/precompiles.md
Outdated
### Function signature | ||
|
||
```fe,ignore,ignore | ||
pub fn sha2_256(buf input_buf: MemoryBuffer) -> u256 {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since I'm nitpicking, the {}
should be left off of the signature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
like this?:
pub fn sha2_256(buf input_buf: MemoryBuffer) -> u256 {} | |
pub fn {} sha2_256(buf input_buf: MemoryBuffer) -> u256 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean "left off of" as in "not included". So, like this:
pub fn sha2_256(buf input_buf: MemoryBuffer) -> u256
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks for adding this.
We could borrow the descriptions of the functions and parameters from evm.codes (MIT licensed, should be fair game, right?) for a bit more detail, but I'd be happy to see this merged any time as it's obviously much better than what we have now.
docs/src/SUMMARY.md
Outdated
@@ -81,6 +81,7 @@ | |||
* [Memory](spec/data_layout/memory/index.md) | |||
* [Sequence types in memory](spec/data_layout/memory/sequence_types_in_memory.md) | |||
* [Function calls](spec/function_calls.md) | |||
* [Precompiles](spec/precompiles.md) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since precompiles are part of the std library, I believe this should sit outside of spec
as spec is supposed to as close as possible a language specification (inspired by https://doc.rust-lang.org/stable/reference/introduction.html) and hence not cover std library stuff. I think that this should either become a sub of "Using Fe" or become a sub of a completely new item but I'm not sure what that would be (maybe "Standard Library"). The more I think about it, I think I like the idea of organizing this under a "Standard Library" section.
This PR adds a new page documenting the EVM precompiles included in Fe