Skip to content

Commit

Permalink
refactor: rename OMO to flexEmu (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
templexxx authored Aug 20, 2023
1 parent a251a63 commit 661b046
Show file tree
Hide file tree
Showing 56 changed files with 180 additions and 180 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release-packaging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
release:
name: Release Packaging
env:
PROJECT_NAME_UNDERSCORE: omo
PROJECT_NAME_UNDERSCORE: flexemu
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
test:
name: Test
env:
PROJECT_NAME_UNDERSCORE: omo
PROJECT_NAME_UNDERSCORE: flexemu
CARGO_INCREMENTAL: 0
RUSTFLAGS: -Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort
RUSTDOCFLAGS: -Cpanic=abort
Expand Down
110 changes: 55 additions & 55 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[workspace]
resolver = "2"
members = [
"omo",
"omo-workflow",
"flexemu",
"flexemu-workflow",
"rust-mips-example",
"crates/ethtrie-codec"
]
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# OMO
# flexEmu

General purpose bytecode emulator with per-step proof.
It can be used to generate challenge proof of optimistic rollup,
Expand All @@ -8,7 +8,7 @@ See more introductions here: [en](docs/overview.md) / [zh](docs/ch/overview.md).

## Platforms

OMO could emulate program built with:
flexEmu could emulate program built with:

- **Arch**: MIPS32
- **OS**: Linux
Expand All @@ -32,10 +32,10 @@ Not fully supported yet, only for developing.

The project contains three major Rust crates:

- [`./omo` ](omo): main entrypoint of the OMO emulator.
- [`./flexemu` ](flexemu): main entrypoint of the flexEmu emulator.
- [`./rust-mips-example`](rust-mips-example): examples crate. It is configured to build into a linux mips binary, which
can be run by `OMO`.
- [`./omo-workflow`](omo-workflow): Rust binary to demonstrate how OMO work with onchain contracts to provide
can be run by `flexEmu`.
- [`./flexemu-workflow`](flexemu-workflow): Rust binary to demonstrate how flexEmu work with onchain contracts to provide
interacting fraud proof.

### Prerequisites
Expand Down Expand Up @@ -68,7 +68,7 @@ brew install richard-vd/musl-cross/musl-cross --without-x86_64 --with-mips
cargo build --target mips-unknown-linux-musl --release
```

**Compile `OMO`:**
**Compile `flexEmu`:**

```shell
cargo build --release
Expand All @@ -77,7 +77,7 @@ cargo build --release
**Run Example1:**

```shell
RUST_LOG=error ./omo --config config.toml.example run --env E1=a --env E2=b ../target/mips-unknown-linux-musl/release/rust-mips-example E1 E2
RUST_LOG=error ./flexemu --config config.toml.example run --env E1=a --env E2=b ../target/mips-unknown-linux-musl/release/rust-mips-example E1 E2
```

**Output:**
Expand All @@ -91,7 +91,7 @@ E2=b
**Run Example2:**

```shell
RUST_LOG=error ./omo --config config.toml.example run ../rooch/omo/target/mips-unknown-linux-musl/release/arith-example 1 11
RUST_LOG=error ./flexemu --config config.toml.example run ../rooch/flexemu/target/mips-unknown-linux-musl/release/arith-example 1 11
```

**Output:**
Expand Down
4 changes: 2 additions & 2 deletions contracts/Move.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ trie = {local = "./deps/trie"}
#starcoin-framework-commons = {git = "https://github.com/starcoinorg/starcoin-framework-commons.git", rev = "e7f538175a5f50a97207692569b6631a87ee08cc"}

[dev-addresses]
omo = "0x48"
flexemu = "0x48"
signed_integer="0x49"
trie="0x50"

[addresses]
omo="0xfc2cd714a9d954dcec4ca5366d2461c4"
flexemu="0xfc2cd714a9d954dcec4ca5366d2461c4"
signed_integer="0xfc2cd714a9d954dcec4ca5366d2461c4"
trie="0xfc2cd714a9d954dcec4ca5366d2461c4"
4 changes: 2 additions & 2 deletions contracts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The folder contains Move modules used in layer2 to verify layer2 instructions.
Download move-cli from [movelang](https://github.com/move-language/move)

```
$ move build --docs -d
$ move build --doc -d
```

### Module docs
Expand All @@ -16,7 +16,7 @@ see `./build/docs`.

### Dev keys

`./dev.key` is the private key corresponding to the dev-address of omo.
`./dev.key` is the private key corresponding to the dev-address of flexemu.

You can use the key to deploy contracts if you don't want to change the dev-address in Move.toml.
And dont use it in production!
2 changes: 1 addition & 1 deletion contracts/bins/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Gen test data with testbin

```shell
../target/release/omo --config ../omo/config.toml.example gen-state -s 59 ./bins/arith-example 1 10
../target/release/flexemu --config ../flexemu/config.toml.example gen-state -s 59 ./bins/arith-example 1 10
```

this will generate a dir `step-59` with state and proof at step 59 when running the `arith-example`.
Expand Down
2 changes: 1 addition & 1 deletion contracts/integration-tests/step_59_test.move
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

//# run --signers alice --args x"{{$.read-json[-1].access_nodes}}" --args x"{{$.read-json[-1].root_before}}" --args x"{{$.read-json[-1].root_after}}"
script {
use omo::mips_emulator;
use flexemu::mips_emulator;
use StarcoinFramework::Signer;
use trie::rlp;

Expand Down
6 changes: 3 additions & 3 deletions contracts/sources/challenge_script.move
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/// Public entrpoints functions for onchain challenges.
module omo::challenge_script {
use omo::SimpleChallenge;
module flexemu::challenge_script {
use flexemu::SimpleChallenge;
use trie::hash_value;
use trie::rlp;
use omo::mips_emulator;
use flexemu::mips_emulator;
use StarcoinFramework::Signer;

public(script) fun declare_state(signer: signer, final_state: vector<u8>) {
Expand Down
2 changes: 1 addition & 1 deletion contracts/sources/memory.move
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// `memory` module implements the read/write operations to underlying memory slots stored in eth-trie.
/// Besides, the module also includes rw operations to registers.
module omo::memory {
module flexemu::memory {
use trie::hash_value::{HashValue};
use signed_integer::bits::Bits;
use StarcoinFramework::Vector::{length};
Expand Down
6 changes: 3 additions & 3 deletions contracts/sources/mips.move
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/// Mips Reference impl. https://inst.eecs.berkeley.edu/~cs61c/resources/MIPS_help.html
module omo::mips {
module flexemu::mips {
use signed_integer::bits;
use signed_integer::bits::{Bits, se, left_shift};
use signed_integer::i64;
use trie::hash_value::HashValue;
use trie::hash_value;
use omo::memory::{Memory, read_reg, write_reg, read_reg_bits, write_reg_bits, read_memory, write_memory};
use flexemu::memory::{Memory, read_reg, write_reg, read_reg_bits, write_reg_bits, read_memory, write_memory};


const REG_ZERO: u64 = 2;
Expand Down Expand Up @@ -532,7 +532,7 @@ module omo::mips {

}

//module omo::utils {
//module flexemu::utils {
// /// SignExt_idx(dat)
// public fun se(dat: u64, idx: u64): u64 {
// 0
Expand Down
6 changes: 3 additions & 3 deletions contracts/sources/mips_emulator.move
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/// A mips emulator which can run a single mips instruction based on pre-added state.
module omo::mips_emulator {
use omo::memory;
use omo::mips;
module flexemu::mips_emulator {
use flexemu::memory;
use flexemu::mips;
use trie::hash_value;

public fun create(signer: &signer) {
Expand Down
6 changes: 3 additions & 3 deletions contracts/sources/simple_challenge.move
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/// Challenge contracts used by layer2 roles like defender/challenger.
module omo::SimpleChallenge {
module flexemu::SimpleChallenge {
use StarcoinFramework::Table;
use StarcoinFramework::Vector;
use StarcoinFramework::Signer;
use omo::mips_emulator;
use flexemu::mips_emulator;
use trie::hash_value::HashValue;
use trie::hash_value;

Expand Down Expand Up @@ -80,7 +80,7 @@ module omo::SimpleChallenge {
move_to(signer, challenges);
}

/// only used in omo demo
/// only used in flexemu demo
public fun clean_state(signer: &signer) acquires Global, Challenges {
if (exists<Global>(Signer::address_of(signer))) {
let Challenges {value} = move_from<Challenges>(Signer::address_of(signer));
Expand Down
6 changes: 3 additions & 3 deletions docs/ch/components.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Components
===

OMO 主要有以下四个关键组件:
flexEmu 主要有以下四个关键组件:

* Loader: 加载可执行文件。
* CPU Emulator: 在宿主机上模拟执行指令。
Expand All @@ -28,8 +28,8 @@ OMO 主要有以下四个关键组件:

## Registers and Stack

在 CPU Emulator 之上, OMO 提供了关于栈的抽象,以及更高级的寄存器和内存操作。这样我们可以很方便的对运行状态进行快照。
在 CPU Emulator 之上, flexEmu 提供了关于栈的抽象,以及更高级的寄存器和内存操作。这样我们可以很方便的对运行状态进行快照。

## OS Interface

OMO 模拟了大量系统调用,并保证调用是幂等的。
flexEmu 模拟了大量系统调用,并保证调用是幂等的。
4 changes: 2 additions & 2 deletions docs/ch/overview.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
概览
===

## 关于 OMO
## 关于 flexEmu

随着链上交易量增多,Layer2 成为解决扩容问题的一个重要研究领域,其中 optimistic rollup 这一方向已经有了落地的解决方案,比如 Arbitrum (后称 arb), Optimism Cannon (后称 op)。

Expand All @@ -13,7 +13,7 @@ arb 和 op 都采用了交互式的链上仲裁技术。交互式的意思是,

和 Qiling 不同的是,区块链中的合约执行环境相对简单,没复杂 I/O 的外部交互,也无需考虑系统隔离性。另外,qiling 缺少中间状态生成以及状态证明,这是做交互式仲裁所必须的功能之一。

我们把这个合约执行环境称作 OMO
我们把这个合约执行环境称作 flexEmu

## 更多资料

Expand Down
Loading

0 comments on commit 661b046

Please sign in to comment.