Skip to content

Commit

Permalink
feat: cleanup kakarot ssj to match latest version of cairo (#38)
Browse files Browse the repository at this point in the history
* feat: cleanup kakarot ssj to match latest version of cairo

* fix: fix CI

* fix: fix readme
  • Loading branch information
Eikix committed Jul 27, 2023
1 parent 4d75def commit 2ac9e10
Show file tree
Hide file tree
Showing 18 changed files with 27 additions and 220 deletions.
18 changes: 3 additions & 15 deletions .github/ISSUE_TEMPLATE/02_FEATURE_REQUEST.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,21 @@
---
name: Feature Request
about: Suggest an idea for this project
title: "feat: "
labels: "enhancement"
assignees: ""
title: 'feat: '
labels: 'enhancement'
assignees: ''
---

# Feature Request

**Describe the Feature Request**

<!-- A clear and concise description of what the feature request is. Please include if your feature request is related to a problem. -->

**Describe Preferred Solution**

<!-- A clear and concise description of what you want to happen. -->

**Describe Alternatives**

<!-- A clear and concise description of any alternative solutions or features you've considered. -->

**Related Code**

<!-- If you are able to illustrate the bug or feature request with an example, please provide it here. -->

**Additional Context**

<!-- List any other information that is relevant to your issue. Stack traces, related issues, suggestions on how to add, use case, Stack Overflow links, forum links, screenshots, OS if applicable, etc. -->

**If the feature request is approved, would you be willing to submit a PR?**
_(Help can be provided if you need assistance submitting a PR)_

Expand Down
32 changes: 0 additions & 32 deletions .github/workflows/lock.yml

This file was deleted.

50 changes: 8 additions & 42 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,48 +1,14 @@
name: test
name: CI

on: [push, pull_request]

env:
CAIRO_COMPILER_VERSION: 1.0.0-rc0
# Temporary use artifacts from custom CI build
ARTIFACT_RELEASE_ARCHIVE_LINK: https://api.github.com/repos/starkware-libs/cairo/actions/artifacts/689746858/zip
ARTIFACT_RELEASE_ARCHIVE_NAME: cairo.zip
RELEASE_ARCHIVE_NAME: x86_64-unknown-linux-musl.tar.gz

jobs:
build:
name: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
curl -H "Accept: application/vnd.github+json" -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -L -o $ARTIFACT_RELEASE_ARCHIVE_NAME $ARTIFACT_RELEASE_ARCHIVE_LINK
unzip $ARTIFACT_RELEASE_ARCHIVE_NAME
tar -xvf $RELEASE_ARCHIVE_NAME
export PATH=$PATH:$(pwd)/cairo/bin
make build
run:
name: run
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
curl -H "Accept: application/vnd.github+json" -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -L -o $ARTIFACT_RELEASE_ARCHIVE_NAME $ARTIFACT_RELEASE_ARCHIVE_LINK
unzip $ARTIFACT_RELEASE_ARCHIVE_NAME
tar -xvf $RELEASE_ARCHIVE_NAME
export PATH=$PATH:$(pwd)/cairo/bin
# TODO: uncomment when demo is ready
#make run
test:
name: test
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
curl -H "Accept: application/vnd.github+json" -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -L -o $ARTIFACT_RELEASE_ARCHIVE_NAME $ARTIFACT_RELEASE_ARCHIVE_LINK
unzip $ARTIFACT_RELEASE_ARCHIVE_NAME
tar -xvf $RELEASE_ARCHIVE_NAME
export PATH=$PATH:$(pwd)/cairo/bin
make test
- uses: actions/checkout@v3
- uses: software-mansion/setup-scarb@v1
with:
scarb-version: '0.5.2'
- run: scarb fmt --check
- run: scarb test
62 changes: 0 additions & 62 deletions Makefile

This file was deleted.

35 changes: 10 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,56 +45,41 @@

## 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.

## Getting Started

This repository is a rewrite of [the first version of Kakarot zkEVM](https://github.com/kkrt-labs/kakarot).

### Prerequisites

- [Cairo](https://github.com/starkware-libs/cairo)
- [Rust](https://www.rust-lang.org/tools/install)
- [Scarb](https://docs.swmansion.com/scarb/download)
- [jq](https://stedolan.github.io/jq/download/)

### Installation

> **[TODO]**
## Usage
- 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`)

### 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 +102,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 2ac9e10

Please sign in to comment.