Skip to content

Commit

Permalink
feat: cleanup kakarot ssj to match latest version of cairo
Browse files Browse the repository at this point in the history
  • Loading branch information
Eikix committed Jul 27, 2023
1 parent 4d75def commit c57d42e
Show file tree
Hide file tree
Showing 15 changed files with 16 additions and 127 deletions.
62 changes: 0 additions & 62 deletions Makefile

This file was deleted.

31 changes: 10 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,7 @@

## About

**Kakarot** is an Ethereum Virtual Machine written in Cairo. It means it can be
deployed on StarkNet, a layer 2 scaling solution for Ethereum, and run any EVM
bytecode program. Hence, Kakarot can be used to run Ethereum smart contracts on
StarkNet. Kakarot is the super sayajin zkEVM! Why? Because:
`It's over 9000!!!!!`.
Kakarot is an (zk)-Ethereum Virtual Machine implementation written in Cairo. Kakarot is Ethereum compatible, i.e. all existing smart contracts, developer tools and wallets work out-of-the-box on Kakarot. It's been open source from day one. Soon available on Starknet L2 and L3.

It is a work in progress, and it is not ready for production.

Expand All @@ -64,37 +60,30 @@ It is a work in progress, and it is not ready for production.

### Installation

> **[TODO]**
- Install Rust:
- `curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh`
- Install Scarb:
- `curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | sh`
- [Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) the repository and clone your fork (`git clone https://github.com/<YOUR_USERNAME>/kakarot-ssj`)

## Usage

### Build

```bash
make build
```

### Run

```bash
make run
scarb build
```

### Test

We use the `cairo-test` runner to run the unit tests on Kakarot.
However, it is not directly compatible with Scarb. Hence, we use a script
to generate the `cairo_project.toml` file from Scarb's metadata.
Running this script requires `jq` to be installed.

```bash
make test
scarb test
```

### Format

```bash
make format
scarb fmt
```

## Roadmap
Expand All @@ -117,7 +106,7 @@ Reach out to the maintainer at one of the following places:
If you want to say **thank you** or/and support active development of Kakarot:

- Add a [GitHub Star](https://github.com/sayajin-labs/kakarot-ssj) to the project.
- Tweet about the Kakarot.
- Tweet about [Kakarot](https://twitter.com/KakarotZkEvm).
- Write interesting articles about the project on [Dev.to](https://dev.to/), [Medium](https://medium.com/) or your personal blog.

Together, we can make Kakarot **better**!
Expand Down
1 change: 1 addition & 0 deletions Scarb.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[package]
cairo-version = "2.0.2"
name = "kakarot"
version = "0.1.0"
Empty file removed examples/bugs/.gitkeep
Empty file.
25 changes: 0 additions & 25 deletions scripts/generate_cairo_project.sh

This file was deleted.

3 changes: 3 additions & 0 deletions src/lib.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ mod context;

// Utils module
mod utils;

// tests
mod tests;
2 changes: 1 addition & 1 deletion src/memory.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ impl MemoryImpl of MemoryTrait {
///
/// * A new `Memory` instance.
fn new() -> Memory {
Memory { items: Felt252DictTrait::new(), bytes_len: 0, }
Memory { items: Default::default(), bytes_len: 0, }
}

/// Stores a 32-bytes element into the memory.
Expand Down
2 changes: 1 addition & 1 deletion src/stack.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl StackImpl of StackTrait {
/// Returns
/// * Stack The new stack instance.
fn new() -> Stack {
let items = Felt252DictTrait::<u128>::new();
let items: Felt252Dict<u128> = Default::default();
Stack { items, len: 0 }
}

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
17 changes: 0 additions & 17 deletions src/utils/helpers.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -200,23 +200,6 @@ fn reverse_array<T, impl TCopy: Copy<T>, impl TDrop: Drop<T>>(src: Span<T>) -> A
dst
}

/// Tries to convert a u256 into a u8.
impl U256TryIntoU8 of TryInto<u256, u8> {
fn try_into(self: u256) -> Option<u8> {
if self.high != 0 {
return Option::None(());
}
self.low.try_into()
}
}

/// Converts a u8 into a u256.
impl U8IntoU256 of Into<u8, u256> {
fn into(self: u8) -> u256 {
u256 { low: self.into(), high: 0 }
}
}


//TODO(eni) make PR and add this in corelib

Expand Down

0 comments on commit c57d42e

Please sign in to comment.