Skip to content

Commit

Permalink
Merge branch 'main' into update-tests-to-use-leap-dev-install
Browse files Browse the repository at this point in the history
  • Loading branch information
oschwaldp-oci committed Jul 19, 2023
2 parents 6076d9e + f352bbb commit 2f3cdba
Show file tree
Hide file tree
Showing 143 changed files with 4,421 additions and 6,021 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/contract.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# TrustEVM Contract CI
This GitHub Actions workflow builds the TrustEVM contract and its associated tests.
# EOS EVM Contract CI
This GitHub Actions workflow builds the EOS EVM contract and its associated tests.

### Index
1. [Triggers](#triggers)
Expand Down Expand Up @@ -30,17 +30,17 @@ This workflow performs the following steps:
1. Attach Documentation
1. Checkout the repo with no submodules.
1. Attach an annotation to the GitHub Actions build summary page containing CI documentation.
1. TrustEVM Contract Build
1. EOS EVM Contract Build
> This is a build matrix with and without tests enabled.
1. Authenticate to the `trustevm-ci-submodule-checkout` GitHub app using the [AntelopeIO/github-app-token-action](https://github.com/AntelopeIO/github-app-token-action) action to obtain an ephemeral token.
1. Checkout the repo and submodules using the ephemeral token.
1. Download the CDT binary using the [AntelopeIO/asset-artifact-download-action](https://github.com/AntelopeIO/asset-artifact-download-action) action.
1. Install the CDT binary.
1. Build the TrustEVM contract using `make` and `cmake`.
1. Build the EOS EVM contract using `make` and `cmake`.
1. Upload the contract build folder to GitHub Actions.
1. If tests are enabled, download the `leap-dev` binary using [AntelopeIO/asset-artifact-download-action](https://github.com/AntelopeIO/asset-artifact-download-action) action.
1. If tests are enabled, install the `leap-dev` binary.
1. If tests are enabled, build the TrustEVM contract tests using `make` and `cmake`.
1. If tests are enabled, build the EOS EVM contract tests using `make` and `cmake`.
1. If tests are enabled, upload the build folder for the contract test code to GitHub Actions.
1. If tests are enabled, run them and ignore the outcome.
1. If tests are enabled, attach xUnit-formatted test metrics as an artifact.
Expand All @@ -56,12 +56,12 @@ This workflow produces the following outputs:
## GitHub App Integration
This workflow uses the [AntelopeIO/github-app-token-action](https://github.com/AntelopeIO/github-app-token-action) GitHub action to assume the role of a GitHub application installed to the AntelopeIO organization to clone the private submodules. It requests a token from the GitHub app, clones everything using this token under the identity of the app, then the token expires. This is advantageous over a persistent API key from a GitHub service account because this does not consume a paid user seat, the "account" associated with the app cannot be logged into in the GitHub web UI, the app is scoped to exactly the permissions it needs to perform the clones for this repo _and nothing more_, and the API key expires very quickly so a bad actor who exfiltrates this key from the CI system should find it is not useful.

**The downside is that if TrustEVM adds additional private submodules, the GitHub app must be granted permissions to these new submodules.** The CI system will not work until this happens.
**The downside is that if EOS EVM adds additional private submodules, the GitHub app must be granted permissions to these new submodules.** The CI system will not work until this happens.

## See Also
- [asset-artifact-download-action](https://github.com/AntelopeIO/asset-artifact-download-action) GitHub Action
- [github-app-token-action](https://github.com/AntelopeIO/github-app-token-action) GitHub action
- [TrustEVM Documentation](../../README.md)
- [EOS EVM Documentation](../../README.md)

For assistance with the CI system, please open an issue in this repo or reach out in the `#help-automation` channel via IM.

Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/contract.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: TrustEVM Contract CI
name: EOS EVM Contract CI

on:
push:
Expand Down Expand Up @@ -27,7 +27,7 @@ jobs:
strategy:
matrix:
DWITH_TEST_ACTIONS: ['on', 'off']
name: TrustEVM Contract Build - Tests ${{ matrix.DWITH_TEST_ACTIONS }}
name: EOS EVM Contract Build - Tests ${{ matrix.DWITH_TEST_ACTIONS }}
env:
CC: gcc-10
CXX: g++-10
Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:
- name: Install CDT
run: sudo apt-get install -y ./cdt*.deb

- name: Build TrustEVM Contract
- name: Build EOS EVM Contract
run: .github/workflows/build-contract.sh
env:
DWITH_TEST_ACTIONS: ${{ matrix.DWITH_TEST_ACTIONS }}
Expand All @@ -87,7 +87,7 @@ jobs:
- name: Install Leap
run: sudo apt-get install -y ./leap*.deb

- name: Build TrustEVM Contract Tests
- name: Build EOS EVM Contract Tests
run: .github/workflows/build-contract-test.sh

- name: Upload Artifacts
Expand All @@ -97,7 +97,7 @@ jobs:
path: contract-test.tar.gz
if-no-files-found: error

- name: Test TrustEVM Contract
- name: Test EOS EVM Contract
run: .github/workflows/test-contract.sh
env:
DWITH_TEST_ACTIONS: ${{ matrix.DWITH_TEST_ACTIONS }}
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/node.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# TrustEVM Node CI
This GitHub Actions workflow builds the TrustEVM node.
# EOS EVM Node CI
This GitHub Actions workflow builds eos-evm-node and eos-evm-rpc.

### Index
1. [Triggers](#triggers)
Expand Down Expand Up @@ -27,21 +27,21 @@ This workflow performs the following steps:
1. Attach Documentation
1. Checkout the repo with no submodules.
1. Attach an annotation to the GitHub Actions build summary page containing CI documentation.
1. TrustEVM Node Build
1. EOS EVM Node Build
1. Authenticate to the `trustevm-ci-submodule-checkout` GitHub app using the [AntelopeIO/github-app-token-action](https://github.com/AntelopeIO/github-app-token-action) action to obtain an ephemeral token.
1. Checkout the repo and submodules using the ephemeral token.
1. Build the TrustEVM node using `cmake` and `make`.
1. Upload the node build folder to GitHub Actions if the `upload-artifacts` input is set to `true`.
1. Build eos-evm-node and eos-evm-rpc using `cmake` and `make`.
1. Upload the build folder to GitHub Actions if the `upload-artifacts` input is set to `true`.

## Outputs
This workflow produces the following outputs:
1. Build Artifacts - `build.tar.gz` containing the built artifacts of TrustEVM Node, if the `upload-artifacts` input is set to `true`.
1. Build Artifacts - `build.tar.gz` containing the built artifacts of eos-evm-node and eos-evm-rpc, if the `upload-artifacts` input is set to `true`.

> 💾️ Build artifacts are only attached on-demand for this pipeline because they are >117 MB each, but we only get 2 GB of cumulative artifact storage in GitHub Actions while TrustEVM is a private repo. Obtain artifacts by performing a manual build with `upload-artifacts` set to `true`.
> 💾️ Build artifacts are only attached on-demand for this pipeline because they are >117 MB each, but we only get 2 GB of cumulative artifact storage in GitHub Actions while eos-evm is a private repo. Obtain artifacts by performing a manual build with `upload-artifacts` set to `true`.
## See Also
- [github-app-token-action](https://github.com/AntelopeIO/github-app-token-action) GitHub action
- [TrustEVM Documentation](../../README.md)
- [EOS EVM Documentation](../../README.md)

For assistance with the CI system, please open an issue in this repo or reach out in the `#help-automation` channel via IM.

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/node.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: TrustEVM Node CI
name: EOS EVM Node CI

on:
push:
Expand Down Expand Up @@ -32,7 +32,7 @@ jobs:
run: cat .github/workflows/node.md >> $GITHUB_STEP_SUMMARY

build:
name: TrustEVM Node Build
name: EOS EVM Node Build
runs-on: ubuntu-20.04

steps:
Expand All @@ -50,7 +50,7 @@ jobs:
submodules: 'recursive'
token: ${{ steps.auth.outputs.token }}

- name: Build TrustEVM Node
- name: Build EOS EVM Node
run: .github/workflows/build-node.sh
env:
CC: gcc-10
Expand Down
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
url = https://github.com/lemire/CRoaringUnityBuild
[submodule "silkworm"]
path = silkworm
url = git@github.com:eosnetworkfoundation/silkworm
url = https://github.com/eosnetworkfoundation/silkworm
[submodule "contract/external/ethash"]
path = contract/external/ethash
url = git@github.com:eosnetworkfoundation/ethash
url = https://github.com/eosnetworkfoundation/ethash
[submodule "contract/external/intx"]
path = contract/external/intx
url = https://github.com/chfast/intx
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ HunterGate(
FILEPATH "${CMAKE_SOURCE_DIR}/cmake/Hunter/config.cmake"
)

project(trustevm_node)
set(PROJECT_VERSION 0.3.0)
project(eos_evm_node)
set(PROJECT_VERSION 0.5.1)

string(REGEX MATCH "([0-9]+)\\.([0-9]+)\\.([0-9]+)" _ ${PROJECT_VERSION})
set(PROJECT_VERSION_MAJOR ${CMAKE_MATCH_1})
Expand Down
70 changes: 44 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,43 @@
# TrustEVM
Main Repository of the Trust Ethereum Virtual Machine (TrustEVM-node, TrustEVM-RPC, EVM smart contract) on the Antelope Network.
# EOS EVM

This is the main repository of the EOS EVM project. EOS EVM is a compatibility layer deployed on top of the EOS blockchain which implements the Ethereum Virtual Machine (EVM). It enables developers to deploy and run their applications on top of the EOS blockchain infrastructure but to build, test, and debug those applications using the common languages and tools they are used to using with other EVM compatible blockchains. It also enables users of those applications to interact with the application in ways they are familiar with (e.g. using a MetaMask wallet).

The EOS EVM consists of multiple components that are tracked across different repositories.

The repositories containing code relevant to the EOS EVM project include:
1. https://github.com/eosnetworkfoundation/blockscout: A fork of the [blockscout](https://github.com/blockscout/blockscout) blockchain explorer with adaptations to make it suitable for the EOS EVM project.
2. https://github.com/eosnetworkfoundation/evm_bridge_frontend: Frontend to operate the EVM trustless bridge.
3. This repository.

This repository in particular hosts the source to build three significant components of EOS EVM:
1. EOS EVM Contract: This is the Antelope smart contract that implements the main runtime for the EVM. The source code for the smart contract can be found in the `contracts` directory. The main build artifacts are `evm_runtime.wasm` and `evm_runtime.abi`.
2. EOS EVM Node and RPC: These are programs, EOS EVM Node (`eos-evm-node` executable) and EOS EVM RPC (`eos-evm-rpc` executable), that are based on Silkworm and which together allow a node to service a subset of the RPC methods supported in the Ethereum JSON-RPC which involve reading the state of the (virtual) EVM blockchain enabled by the EOS EVM Contract. The `eos-evm-node` program relies on a SHiP connection to a [Leap](https://github.com/AntelopeIO/leap) node that is connected to the blockchain network hosting the desired EOS EVM Contract (i.e. the EOS network in the case of the EOS EVM Mainnet).
3. TX-Wrapper: This is a Node.js application which specifically services two RPC methods of the Ethereum JSON-RPC: `eth_sendRawTransaction` and `eth_gasPrice`. It relies on chain API access to a [Leap](https://github.com/AntelopeIO/leap) node connected to the blockchain network hosting the desired EOS EVM Contract. The source code for TX-Wrapper can be found in the `peripherals/tx_wrapper` directory.

Beyond code, there are additional useful resources relevant to the EOS EVM project.
1. https://github.com/eosnetworkfoundation/evm-public-docs: A repository to hold technical documentation for an audience interested in following and participating in the operations of the EOS EVM project. The genesis JSON needed to stand up a EOS EVM Node that works with the EVM on the EOS blockchain can also be found in that repository.
2. https://docs.eosnetwork.com/docs/latest/eos-evm/: Official documentation for the EOS EVM.

## Overview
The TrustEVM node consumes Antelope(EOS) blocks from Antelope node (nodeos) via state history (SHIP) endpoint, and build up the virtual Ethereum blockchain in a deterministic way.
The TrustEVM RPC will talk with the TrustEVM node, and provide read-only Ethereum compatible RPC services for clients (such as MetaMask)

Clients can also push Ethereum compatible transactions to the Antelope blockchain, via proxy and Transaction Wrapper (TX-Wrapper), which encapsulates Ethereum raw transactions into Antelope transactions. All ethereum transactions will be validated and executed by the EVM smart contracts deployed in the Antelope Blockchain network.
The EOS EVM Node consumes Antelope (EOS) blocks from a Leap node via state history (SHiP) endpoint and builds the virtual EVM blockchain in a deterministic way.
The EOS EVM RPC will talk with the EOS EVM node, and provide read-only Ethereum compatible RPC services for clients (such as MetaMask).

Clients can also push Ethereum compatible transactions (aka EVM transactions) to the EOS blockchain, via proxy and Transaction Wrapper (TX-Wrapper), which encapsulates EVM transactions into Antelope transactions. All EVM transactions will be validated and executed by the EOS EVM Contract deployed on the EOS blockchain.

```
|
| WRITE +-----------------+
| +------------------------->| TX-Wrapper |
| +------------------------->| TX-Wrapper |
| | +-------v---------+
| | | Antelope node | ---> connect to the other nodes in the Antelope blockchain network
| | | Leap node | ---> connect to the other nodes in the blockchain network
client | | +-------+---------+
request | +-----+-----+ |
---------+------>| Proxy | |
| +-----------+ v
| | +-----------------+
| READ | +--------------+ | |
| +---->| TrustEVM RPC |---->| TrustEVM Node +
| +---->| EOS EVM RPC |---->| EOS EVM Node +
| +--------------+ | |
| +-----------------+
```
Expand All @@ -28,12 +46,12 @@ Clients can also push Ethereum compatible transactions to the Antelope blockchai

### checkout the source code:
```
git clone https://github.com/eosnetworkfoundation/TrustEVM.git
cd TrustEVM
git clone https://github.com/eosnetworkfoundation/eos-evm.git
cd eos-evm
git submodule update --init --recursive
```

### compile TrustEVM-node, TrustEVM-rpc, unittests
### compile eos-evm-node, eos-evm-rpc, unittests

Prerequisites:
- Ubuntu 20 or later or other compatible Linux
Expand All @@ -48,8 +66,8 @@ make -j8
```
You'll get the list of binaries with other tools:
```
cmd/trustevm-node
cmd/trustevm-rpc
cmd/eos-evm-node
cmd/eos-evm-rpc
cmd/unit_test
cmd/silkrpc_toolbox
cmd/silkrpcdaemon
Expand Down Expand Up @@ -84,25 +102,25 @@ make -j
```
You should get the following output files:
```
TrustEVM/contract/build/evm_runtime/evm_runtime.wasm
TrustEVM/contract/build/evm_runtime/evm_runtime.abi
eos-evm/contract/build/evm_runtime/evm_runtime.wasm
eos-evm/contract/build/evm_runtime/evm_runtime.abi
```

## Unittests
## Unit tests

We need to compile the leap project in Antelope in order to compile unittests:
We need to compile the Leap project in Antelope in order to compile unit tests:
following the instruction in https://github.com/AntelopeIO/leap to compile leap

To compile unittests:
To compile unit tests:
```
cd TrustEVM/contract/tests
cd eos-evm/contract/tests
mkdir build
cd build
cmake -Deosio_DIR=/<PATH_TO_LEAP_SOURCE>/build/lib/cmake/eosio ..
make -j4 unit_test
```

to run unittest:
to run unit test:
```
cd contract/tests/build
./unit_test
Expand All @@ -111,18 +129,18 @@ cd contract/tests/build
## Deployments

For local testnet deployment and testings, please refer to
https://github.com/eosnetworkfoundation/TrustEVM/blob/main/docs/local_testnet_deployment_plan.md
https://github.com/eosnetworkfoundation/eos-evm/blob/main/docs/local_testnet_deployment_plan.md

For public testnet deployment, please refer to
https://github.com/eosnetworkfoundation/TrustEVM/blob/main/docs/public_testnet_deployment_plan.md
https://github.com/eosnetworkfoundation/eos-evm/blob/main/docs/public_testnet_deployment_plan.md

## CI
This repo contains the following GitHub Actions workflows for CI:
- TrustEVM Contract CI - build the TrustEVM contract and its associated tests
- [Pipeline](https://github.com/eosnetworkfoundation/TrustEVM/actions/workflows/contract.yml)
- EOS EVM Contract CI - build the EOS EVM Contract and its associated tests
- [Pipeline](https://github.com/eosnetworkfoundation/eos-evm/actions/workflows/contract.yml)
- [Documentation](./.github/workflows/contract.md)
- TrustEVM Node CI - build the TrustEVM node
- [Pipeline](https://github.com/eosnetworkfoundation/TrustEVM/actions/workflows/node.yml)
- EOS EVM Node CI - build the EOS EVM node
- [Pipeline](https://github.com/eosnetworkfoundation/eos-evm/actions/workflows/node.yml)
- [Documentation](./.github/workflows/node.md)

See the pipeline documentation for more information.
14 changes: 7 additions & 7 deletions cmd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ add_library(rpc_plugin rpc_plugin.cpp)
target_include_directories(rpc_plugin PUBLIC ${CMAKE_SOURCE_DIR})
target_link_libraries(rpc_plugin PUBLIC ${SILKRPC_LIBRARIES} ${SILKRPC_DAEMON_LIBRARIES} sys_plugin appbase ${Boost_PROGRAM_OPTIONS_LIBRARY})

add_executable(trustevm-node node.cpp)
target_include_directories(trustevm-node PRIVATE ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR})
target_link_libraries(trustevm-node PRIVATE engine_plugin shipreceiver_plugin sys_plugin blockchain_plugin rpc_plugin trustevm_node-buildinfo)
add_executable(eos-evm-node node.cpp)
target_include_directories(eos-evm-node PRIVATE ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR})
target_link_libraries(eos-evm-node PRIVATE engine_plugin shipreceiver_plugin sys_plugin blockchain_plugin rpc_plugin eos_evm_node-buildinfo)

add_executable(trustevm-rpc rpc.cpp)
target_include_directories(trustevm-rpc PRIVATE ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR})
target_link_libraries(trustevm-rpc PRIVATE rpc_plugin trustevm_node-buildinfo)
add_executable(eos-evm-rpc rpc.cpp)
target_include_directories(eos-evm-rpc PRIVATE ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR})
target_link_libraries(eos-evm-rpc PRIVATE rpc_plugin eos_evm_node-buildinfo)

# Unit tests
enable_testing()
Expand Down Expand Up @@ -126,4 +126,4 @@ include_directories(
)

target_compile_definitions(consensus PRIVATE SILKWORM_CONSENSUS_TEST_DIR="${CMAKE_SOURCE_DIR}/silkworm/third_party/tests")
target_link_libraries(consensus PRIVATE engine_plugin shipreceiver_plugin sys_plugin blockchain_plugin rpc_plugin trustevm_node-buildinfo evmc::loader CLI11::CLI11)
target_link_libraries(consensus PRIVATE engine_plugin shipreceiver_plugin sys_plugin blockchain_plugin rpc_plugin eos_evm_node-buildinfo evmc::loader CLI11::CLI11)
Loading

0 comments on commit 2f3cdba

Please sign in to comment.