Skip to content

Commit

Permalink
docs(workspace): polish docs for v0.1.0 (#68)
Browse files Browse the repository at this point in the history
* 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
clearloop authored Aug 5, 2023
1 parent ee0f744 commit b93a7f1
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 46 deletions.
14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[workspace.package]
version = "0.0.3"
version = "0.1.0"
authors = ["clearloop"]
edition = "2021"
license = "GPL-3.0-only"
Expand Down Expand Up @@ -43,12 +43,12 @@ wasmparser = "0.107.0"
wat = "1.0.66"

# Local Dependencies.
zinkup = { path = "cli", version = "=0.0.3" }
opcodes = { package = "evm-opcodes", path = "codegen/opcodes", version = "=0.0.1" }
zingen = { path = "codegen", version = "=0.0.3" }
zinkc = { path = "compiler", version = "=0.0.3" }
zink = { path = "zink", version = "=0.0.3" }
zint = { path = "zint", version = "=0.0.3" }
zinkup = { path = "cli", version = "=0.1.0" }
opcodes = { package = "evm-opcodes", path = "codegen/opcodes", version = "=0.0.2" }
zingen = { path = "codegen", version = "=0.1.0" }
zinkc = { path = "compiler", version = "=0.1.0" }
zink = { path = "zink", version = "=0.1.0" }
zint = { path = "zint", version = "=0.1.0" }

[profile]
dev = { panic = "abort"}
Expand Down
60 changes: 31 additions & 29 deletions README.md
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]
Expand All @@ -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.
Expand All @@ -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

Expand Down
1 change: 1 addition & 0 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[package]
name = "zinkup"
description = "Zink toolchain"
documentation = "https://docs.rs/zinkup"
version.workspace = true
authors.workspace = true
edition.workspace = true
Expand Down
1 change: 1 addition & 0 deletions codegen/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[package]
name = "zingen"
description = "Code generation library for zink."
documentation = "https://docs.rs/zingen"
version.workspace = true
authors.workspace = true
edition.workspace = true
Expand Down
3 changes: 2 additions & 1 deletion codegen/opcodes/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[package]
name = "evm-opcodes"
description = "Rust implementation of EVM opcode"
version = "0.0.1"
documentation = "https://docs.rs/evm-opcodes"
version = "0.0.2"
authors.workspace = true
edition.workspace = true
homepage.workspace = true
Expand Down
1 change: 1 addition & 0 deletions compiler/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[package]
name = "zinkc"
description = "The Zink Compiler"
documentation = "https://docs.rs/zinkc"
version.workspace = true
authors.workspace = true
edition.workspace = true
Expand Down
16 changes: 8 additions & 8 deletions docs/benchmarks/fibonacci.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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);
}
}
```
Expand Down
4 changes: 3 additions & 1 deletion utils/conta/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[package]
name = "conta"
version.workspace = true
description = "Tool for bumping and publishing crates."
documentation = "https://docs.rs/conta"
version = "0.0.0"
authors.workspace = true
edition.workspace = true
license.workspace = true
Expand Down
1 change: 1 addition & 0 deletions zink/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[package]
name = "zink"
description = "Standard library for zink projects."
documentation = "https://docs.rs/zink"
version.workspace = true
authors.workspace = true
edition.workspace = true
Expand Down
1 change: 1 addition & 0 deletions zint/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[package]
name = "zint"
description = "Zink testing utils"
documentation = "https://docs.rs/zint"
version.workspace = true
authors.workspace = true
edition.workspace = true
Expand Down

0 comments on commit b93a7f1

Please sign in to comment.