-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(workspace): polish docs for
v0.1.0
(#68)
* docs(benchmarks): update the implementation of fibonacci in solidity * feat(workspace): add documentation field to all crates * docs(README): reorder the sections of README * docs(README): add warning for in development * docs(README): type for compilation
- Loading branch information
Showing
10 changed files
with
56 additions
and
46 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
# Zink | ||
|
||
> This project is still under development, plz DO NOT use it in production. | ||
> **Warning** | ||
> | ||
> This project is still under active development, plz DO NOT use it in production. | ||
[![zink][version-badge]][version-link] | ||
[![ci][ci-badge]][ci-link] | ||
|
@@ -18,18 +20,37 @@ flowchart LR | |
Z --> V[(EVM)] | ||
``` | ||
|
||
Here we highly recommand you to choose `rust` as the language of your smart contracts | ||
which will unlock all of the following features: | ||
|
||
- **Safe**: `rustc` is wathcing you! Furthermore, after compiling your rust code to WASM, | ||
`zinkc` will precompute all of the stack and memory usages in your contracts to ensure they | ||
are safe in EVM bytecode as well! | ||
|
||
- **High Performance**: The optimizations are provided by the three of `rustc`, `wasm-opt` | ||
and `zinkc`, your contracts will have the smallest size with **strong performance** in EVM | ||
bytecode at the end! | ||
|
||
- **Compatible**: All of the `no_std` libraries in rust are your libraries, futhermore, you | ||
can use your solidity contracts as part of your zink contracts and your zink contracts as | ||
part of your solidty contracts :) | ||
|
||
- **Easy Debugging**: Developing your smart contracts with only one programming language! | ||
zink will provide everything you need for developing your contracts officially based on the | ||
stable projects in rust like the `foundry` tools. | ||
|
||
Run `cargo install zinkup` to install the toolchain! | ||
|
||
## Fibonacci Example | ||
|
||
| fib(n) | Zink | [email protected] | | ||
| ------ | ---- | --------------- | | ||
| 0 | 110 | 605 | | ||
| 1 | 110 | 605 | | ||
| 2 | 262 | 3636 | | ||
| 3 | 414 | 6667 | | ||
| 4 | 718 | 12729 | | ||
| 5 | 1174 | 21822 | | ||
| 0 | 110 | 614 | | ||
| 1 | 110 | 614 | | ||
| 2 | 262 | 1322 | | ||
| 3 | 414 | 2030 | | ||
| 4 | 718 | 3446 | | ||
| 5 | 1174 | 5570 | | ||
|
||
```rust | ||
/// Calculates the nth fibonacci number using recursion. | ||
|
@@ -44,28 +65,9 @@ pub extern "C" fn recursion(n: usize) -> usize { | |
``` | ||
|
||
As an example for the benchmark, calculating fibonacci sequence with recursion, missed | ||
vyper because it doesn't support recursion... | ||
|
||
## Features | ||
|
||
Here we highly recommand you to choose `rust` as the language of your smart contracts | ||
which will unlock all of the following features: | ||
|
||
- **Safe**: `rustc` is wathcing you! Furthermore, after compiling your rust code into WASM, | ||
`zinkc` will precompute all of the stack and memory usages in your contracts to ensure they | ||
are safe in EVM bytecode as well! | ||
|
||
- **High Performance**: The optimizations are provided by the three of `rustc`, `wasm-opt` | ||
and `zinkc`, your contracts will have the smallest size with **strong performance** in EVM | ||
bytecode at the end! | ||
|
||
- **Compatible**: All of the `no_std` libraries in rust are your libraries, futhermore, you | ||
can use your solidity contracts as part of your zink contracts and your zink contracts as | ||
part of your solidty contracts :) | ||
|
||
- **Easy Debugging**: Developing your smart contracts with only one programming language! | ||
zink will provide everything you need for developing your contracts officially based on the | ||
stable projects in rust like the `foundry` tools. | ||
vyper because it doesn't support recursion...Zink is 5x fast on this, but it is mainly | ||
caused by our current implementation is not completed yet ( missing logic to adapt more | ||
situations ), let's keep tuned for `v0.3.0`. | ||
|
||
## LICENSE | ||
|
||
|
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 |
---|---|---|
|
@@ -6,12 +6,12 @@ Benchmarks for fibonacci. | |
|
||
| fib(n) | Zink | [email protected] | | ||
| ------ | ---- | --------------- | | ||
| 0 | 110 | 605 | | ||
| 1 | 110 | 605 | | ||
| 2 | 262 | 3636 | | ||
| 3 | 414 | 6667 | | ||
| 4 | 718 | 12729 | | ||
| 5 | 1174 | 21822 | | ||
| 0 | 110 | 614 | | ||
| 1 | 110 | 614 | | ||
| 2 | 262 | 1322 | | ||
| 3 | 414 | 2030 | | ||
| 4 | 718 | 3446 | | ||
| 5 | 1174 | 5570 | | ||
|
||
`zink` implementation in rust: | ||
|
||
|
@@ -36,10 +36,10 @@ pub extern "C" fn fib(n: usize) -> usize { | |
**/ | ||
function fib(uint n) public view returns (uint) { | ||
if (n <= 1) { | ||
if (n < 2) { | ||
return n; | ||
} else { | ||
return this.fib(n - 1) + this.fib(n - 2); | ||
return fib(n - 1) + fib(n - 2); | ||
} | ||
} | ||
``` | ||
|
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