Skip to content

Commit

Permalink
Merge branch 'develop' into feat/aleksuss/attach_fak
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksuss authored Oct 12, 2023
2 parents 227efc1 + 389d36e commit a13a418
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 113 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/scheduled_lints.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,16 @@ jobs:
run: |
git checkout -f $(git -c user.name=x -c user.email=x@x commit-tree $(git hash-object -t tree /dev/null) < /dev/null) || :
- name: Clone the repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Test mainnet
run: cargo make --profile mainnet test
run: cargo make --profile mainnet test-flow
- name: Test testnet
run: cargo make --profile testnet test
run: cargo make --profile testnet test-flow
- name: Test mainnet silo
run: cargo make --profile mainnet-silo test-flow
- name: Test testnet silo
run: cargo make --profile testnet-silo test-flow

checks:
name: Run checks
runs-on: [self-hosted, heavy]
Expand All @@ -25,5 +30,5 @@ jobs:
run: |
git checkout -f $(git -c user.name=x -c user.email=x@x commit-tree $(git hash-object -t tree /dev/null) < /dev/null) || :
- name: Clone the repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- run: cargo make check
115 changes: 59 additions & 56 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,76 +9,79 @@ on:
name: Tests
jobs:
test:
name: Test suite (mainnet, testnet)
runs-on: [self-hosted, heavy]
name: Test suite ${{ matrix.profile }}
runs-on: github-hosted-heavy-runner
strategy:
matrix:
profile: [ mainnet, testnet, mainnet-silo, testnet-silo ]
steps:
- name: Potential broken submodules fix
run: |
git checkout -f $(git -c user.name=x -c user.email=x@x commit-tree $(git hash-object -t tree /dev/null) < /dev/null) || :
- name: Clone the repository
uses: actions/checkout@v3
- name: Restore cache
run: cache-util restore cargo_git cargo_registry yarn_cache rocksdb:/root/rocksdb
- name: Preparing rocksdb library
run: scripts/ci/build_rocksdb.sh
- name: Test mainnet
run: cargo make --profile mainnet test-flow
- name: Test testnet
run: cargo make --profile testnet test-flow
- name: Save cache
run: cache-util save cargo_git cargo_registry yarn_cache

test_silo:
name: Test Silo suite (mainnet-silo, testnet-silo)
runs-on: [ self-hosted, heavy ]
steps:
- name: Potential broken submodules fix
uses: actions/checkout@v4
- name: Cargo Cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ matrix.profile }}-cargo-test
- name: Setup Node and cache
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'
cache-dependency-path: |
etc/eth-contracts
etc/tests/uniswap
- name: Install dependencies
run: cargo make -V || cargo install cargo-make
- name: Build main contract
run: |
git checkout -f $(git -c user.name=x -c user.email=x@x commit-tree $(git hash-object -t tree /dev/null) < /dev/null) || :
- name: Clone the repository
uses: actions/checkout@v3
- name: Restore cache
run: cache-util restore cargo_git cargo_registry yarn_cache rocksdb:/root/rocksdb
- name: Preparing rocksdb library
run: scripts/ci/build_rocksdb.sh
- name: Test mainnet
run: |
cargo make --profile mainnet build-test
cargo make --profile mainnet-silo test-flow
- name: Test testnet
run: |
cargo make --profile testnet build-test
cargo make --profile testnet-silo test-flow
- name: Save cache
run: cache-util save cargo_git cargo_registry yarn_cache
case ${{ matrix.profile }} in
mainnet-silo)
cargo make --profile mainnet build-test
;;
testnet-silo)
cargo make --profile testnet build-test
;;
*)
;;
esac
- name: Tests ${{ matrix.profile }}
run: cargo make --profile ${{ matrix.profile }} test-flow

test_modexp:
name: Test modexp suite (mainnet, testnet)
runs-on: [ self-hosted, heavy ]
name: Test modexp suite ${{ matrix.profile }}
runs-on: github-hosted-heavy-runner
strategy:
matrix:
profile: [ mainnet, testnet ]
steps:
- name: Potential broken submodules fix
run: |
git checkout -f $(git -c user.name=x -c user.email=x@x commit-tree $(git hash-object -t tree /dev/null) < /dev/null) || :
- name: Clone the repository
uses: actions/checkout@v3
- name: Restore cache
run: |
cache-util restore cargo_git cargo_registry yarn_cache rocksdb:/root/rocksdb
cache-util restore aurora-engine-target@modexp@${{ hashFiles('**/Cargo.lock') }}:target
- name: Preparing rocksdb library
run: scripts/ci/build_rocksdb.sh
- name: Test mainnet bench-modexp
run: cargo make --profile mainnet bench-modexp
- name: Test testnet bench-modexp
run: cargo make --profile testnet bench-modexp
- name: Save cache
run: |
cache-util save cargo_git cargo_registry yarn_cache
cache-util msave aurora-engine-target@modexp@${{ hashFiles('**/Cargo.lock') }}:target
uses: actions/checkout@v4
- name: Cargo Cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ matrix.profile }}-cargo-modexp-test
- name: Install dependencies
run: cargo make -V || cargo install cargo-make
- name: Test ${{ matrix.profile }} bench-modexp
run: cargo make --profile ${{ matrix.profile }} bench-modexp

env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
ROCKSDB_INCLUDE_DIR: /root/rocksdb/include
ROCKSDB_LIB_DIR: /root/rocksdb/lib
ROCKSDB_STATIC: 1
79 changes: 42 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ cargo install --force cargo-make
### Branches

- [`master`] is the current stable branch.
It must be ready, anytime, to deployed on chain at a moment's notice.
It must be ready, at all times, to be deployed on chain at a moment's notice.

- [`develop`] is our bleeding-edge development branch.
In general, kindly target all pull requests to this branch.
Expand All @@ -53,37 +53,38 @@ cargo install --force cargo-make
Every task with `cargo make` must have a `--profile` argument.

The current available `profile`s are:
- `mainnet`, suitable for mainnet.
- `mainnet-silo`, silo contract suitable for mainnet.
- `testnet`, suitable for testnet.
- `testnet-silo`, silo contract suitable for testnet.
- `local`, suitable for local development.
- `custom`, suitable for custom environments, see note below.

A custom environment may be required depending on the circumstances. This can
- `mainnet`: suitable for mainnet.
- `mainnet-silo`: silo contract suitable for mainnet.
- `testnet`: suitable for testnet.
- `testnet-silo`: silo contract suitable for testnet.
- `local`: suitable for local development.
- `custom`: suitable for custom environments, see note below.

In some circumstances, you may require a custom environment. This can
be created in the `.env` folder as `custom.env` following the structure of the
other `.env` files. See `bin/local-custom.env` for more details.

Every make must follow the following pattern, though `--profile` is not required
for all such as cleanup:
Every `make` invocation must follow the following pattern, though `--profile` is
not required in all cases (such as cleanup):

```sh
cargo make [--profile <profile>] <task>
```

#### Building the engine and contracts

To build the binaries there are a few commands to do such following the format.
There are several commands that can be used to build the binaries. The currently supported parameters
for the `task` field are listed below:

The current available build `task`s are:
- `default`, does not need to be specified, runs `build`. Requires a `--profile`
- `default`: does not need to be specified, runs `build`. Requires a `--profile`
argument.
- `build`, builds all engine smart contract and produces the
- `build`: builds all engine smart contract and produces the
`aurora-<profile>-test.wasm` in the `bin` folder. Requires `build-contracts`.
Requires a `--profile` argument.
- `build-test`, builds all the below using test features. Requires a `--profile`
- `build-test`: builds all the below using test features. Requires a `--profile`
argument.
- `build-contracts`, builds all the ETH contracts.
- `build-docker`, builds the `aurora-<profile>-test.wasm` in the `bin` folder using docker build environment. The purpose of this task is to produce reproducible binaries.
- `build-contracts`: builds all the ETH contracts.
- `build-docker`: builds the `aurora-<profile>-test.wasm` in the `bin` folder using docker build environment. The purpose of this task is to produce reproducible binaries.

For example, the following will build the mainnet debug binary:
```sh
Expand All @@ -92,7 +93,7 @@ cargo make --profile mainnet build

#### Verifying binary hash

To verify that a deployed binary matches the source code, you may want build it reproducibly and then check that their hashes match. The motivation behind that is to prevent malicious code from being deployed.
To verify that a deployed binary matches the source code, you may want build it reproducibly and then verify that the SHA256 hash matches that of the deployed binary. The motivation behind this is to prevent malicious code from being deployed.

Run these commands to produce the binary hash:
```sh
Expand All @@ -103,11 +104,12 @@ shasum -a 256 bin/aurora-<profile>.wasm
#### Running unit & integration tests

To run tests, there are a few cargo make tasks we can run:
- `test`, tests the whole cargo workspace, ETH contracts and runs modexp benchmarks. Requires a `--profile` argument.
- `test-flow`, tests the whole cargo workspace and ETH contracts. Requires a `--profile` argument.
- `bench-modexp`, runs modexp benchmarks. Requires a `--profile` argument.
- `test-workspace`, tests only the cargo workspace.
- `test-contracts`, tests only the contracts.
- `test`: tests the whole cargo workspace and ETH contracts. Requires a `--profile` argument.
- `test-workspace`: tests only the cargo workspace.
- `test-contracts`: tests only the contracts.
- `test`: tests the whole cargo workspace, ETH contracts and runs modexp benchmarks. Requires a `--profile` argument.
- `test-flow`: tests the whole cargo workspace and ETH contracts. Requires a `--profile` argument.
- `bench-modexp`: runs modexp benchmarks. Requires a `--profile` argument.

For example, the following will test the whole workspace and ETH contracts:
```sh
Expand All @@ -116,28 +118,31 @@ cargo make --profile mainnet test

#### Running checks & lints

To run lints and checks, the following tasks are available:
- `check`, checks the format, clippy and ETH contracts.
- `check-contracts`, runs yarn lints on the ETH contracts.
- `check-fmt`, checks the workspace Rust format only.
- `clippy`, checks the Rust workspace with clippy only.
The following tasks are available to run lints and checks:

- `check`: checks the format, clippy and ETH contracts.
- `check-contracts` runs yarn lints on the ETH contracts.
- `check-fmt`: checks the workspace Rust format only.
- `clippy`: checks the Rust workspace with clippy only.

For example the following command will run the checks. `profile` is not required
For example, the following command will run the checks. `profile` is not required
here:
```
cargo make check
```

#### Cleanup

To clean up the workspace, the following tasks are available:
- `clean`, cleans all built binaries and ETH contracts.
- `clean-cargo`, cleans with cargo.
- `clean-contracts`, cleans the ETH contracts.
- `clean-bin`, cleans the binaries.
The following tasks are available to clean up the workspace:

- `clean`: cleans all built binaries and ETH contracts.
- `clean-cargo`: cleans with cargo.
- `clean-contracts`: cleans the ETH contracts.
- `clean-bin`: cleans the binaries.

Additionally, there is also but not included in the `clean` task:
- `sweep`, sweeps the set amount of days in the ENV, default at 30 days.

- `sweep`: sweeps the set amount of days in the ENV, default at 30 days.

For example, the following command will clean everything. `profile` is not
required:
Expand All @@ -150,5 +155,5 @@ cargo make clean

## License
**aurora-engine** has multiple licenses:
* all crates except `engine-test` has **CCO-1.0** license
* All crates except `engine-test` has **CCO-1.0** license
* `engine-test` has **GPL-v3** license
2 changes: 1 addition & 1 deletion engine-tests/src/tests/uniswap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fn test_uniswap_input_multihop() {

let (_amount_out, _evm_gas, profile) = context.exact_input(&tokens, INPUT_AMOUNT.into());

assert_eq!(114, profile.all_gas() / 1_000_000_000_000);
assert_eq!(115, profile.all_gas() / 1_000_000_000_000);
}

#[test]
Expand Down
15 changes: 0 additions & 15 deletions scripts/ci/build_rocksdb.sh

This file was deleted.

0 comments on commit a13a418

Please sign in to comment.