Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge elmato/dev #4

Merged
merged 3 commits into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/build-node.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
set -eo pipefail

# print and run a command
function ee()
{
echo "$ $*"
eval "$@"
}

# install dependencies for self-hosted runners
ee export DEBIAN_FRONTEND='noninteractive'
ee sudo apt-get update -q
ee sudo apt-get install -yqq cmake gcc-10 g++-10

# debug code
echo "CC='${CC}'"
echo "CXX='${CXX}'"
ee cmake --version

# build
ee mkdir build
ee pushd build
ee cmake ..
ee make -j "$(nproc)"

# pack
ee popd
ee 'tar -czf build.tar.gz build/*'

echo "Done! - ${0##*/}"
53 changes: 53 additions & 0 deletions .github/workflows/node.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# EOS EVM Node CI
This GitHub Actions workflow builds eos-evm-node and eos-evm-rpc.

### Index
1. [Triggers](#triggers)
1. [Inputs](#inputs)
1. [Steps](#steps)
1. [Outputs](#outputs)
1. [See Also](#see-also)

## Triggers
This GitHub action will run under the following circumstances:
1. When code is pushed.
1. Workflow dispatch event, a manual CI run, which can be triggered by the "Workflow Dispatch" button in the Actions tab of the GitHub repository, among other means.

## Inputs
The inputs for this GitHub action are:
1. `GITHUB_TOKEN` - a GitHub Actions intrinsic used to access the repository and other public resources.
1. `TRUSTEVM_CI_APP_ID` - the app ID of the `trustevm-ci-submodule-checkout` GitHub App.
1. `TRUSTEVM_CI_APP_KEY` - the private key to the `trustevm-ci-submodule-checkout` GitHub App.
1. `upload-artifacts` - a boolean input that specifies whether or not to upload the artifacts of the build. The default value is `false`. This can be overridden in manual CI runs.

These inputs are used in various steps of the workflow to perform actions such as authentication, downloading artifacts, configuring the build, and uploading artifacts.

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

***
**_Legal notice_**
This document was generated in collaboration with ChatGPT from OpenAI, a machine learning algorithm or weak artificial intelligence (AI). At the time of this writing, the [OpenAI terms of service agreement](https://openai.com/terms) §3.a states:
> Your Content. You may provide input to the Services (“Input”), and receive output generated and returned by the Services based on the Input (“Output”). Input and Output are collectively “Content.” As between the parties and to the extent permitted by applicable law, you own all Input, and subject to your compliance with these Terms, OpenAI hereby assigns to you all its right, title and interest in and to Output.

This notice is required in some countries.
64 changes: 64 additions & 0 deletions .github/workflows/node.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: EOS EVM Node CI

on:
push:
branches:
- main
- release/*
pull_request:
workflow_dispatch:
inputs:
upload-artifacts:
description: 'Upload artifacts, including the build.tar.gz, for debugging.'
type: boolean
default: false

defaults:
run:
shell: bash

jobs:
documentation:
name: Attach Documentation
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
fetch-depth: 1
submodules: 'false'

- name: Attach Documentation
run: cat .github/workflows/node.md >> $GITHUB_STEP_SUMMARY

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

steps:
- name: Authenticate
id: auth
uses: AntelopeIO/github-app-token-action@v1
with:
app_id: ${{ secrets.TRUSTEVM_CI_APP_ID }}
private_key: ${{ secrets.TRUSTEVM_CI_APP_KEY }}

- name: Checkout Repo
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: 'recursive'
token: ${{ steps.auth.outputs.token }}

- name: Build EOS EVM Node
run: .github/workflows/build-node.sh
env:
CC: gcc-10
CXX: g++-10

- name: Upload Artifacts
uses: actions/upload-artifact@v3
if: inputs.upload-artifacts || false
with:
name: build.tar.gz
path: build.tar.gz
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
build
.vscode
tests/nodeos_eos_evm_server/artifacts
tests/nodeos_eos_evm_server/cache
tests/nodeos_eos_evm_server/node_modules
77 changes: 77 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# EOS EVM NODE

## Overview

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 |
| | +-------v---------+
| | | Leap node | ---> connect to the other nodes in the blockchain network
client | | +-------+---------+
request | +-----+-----+ |
---------+------>| Proxy | |
| +-----------+ v
| | +-----------------+
| READ | +--------------+ | |
| +---->| EOS EVM RPC |---->| EOS EVM Node +
| +--------------+ | |
| +-----------------+
```

## Compilation

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

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

Prerequisites:
- Ubuntu 20 or later or other compatible Linux
- gcc 10 or later

Easy Steps:
```
mkdir build
cd build
cmake ..
make -j8
```
You'll get the list of binaries with other tools:
```
src/eos-evm-node
src/eos-evm-rpc
```

Alternatively, to build with specific compiler:
```
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ ..
make -j8
```

## Deployments

For local testnet deployment and testings, please refer to
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/eos-evm/blob/main/docs/public_testnet_deployment_plan.md

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

See the pipeline documentation for more information.
2 changes: 1 addition & 1 deletion external/silkworm
Submodule silkworm updated 1 files
+1 −1 third_party/evmone
3 changes: 2 additions & 1 deletion tests/nodeos_eos_evm_server.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
appArgs.add(flag="--eos-evm-contract-root", type=str, help="EOS EVM Contract build dir", default=None)
appArgs.add(flag="--genesis-json", type=str, help="File to save generated genesis json", default="eos-evm-genesis.json")
appArgs.add(flag="--read-endpoint", type=str, help="EVM read endpoint (eos-evm-rpc)", default="http://localhost:8881")
appArgs.add(flag="--use-eos-vm-oc", type=bool, help="EOS EVM Contract build dir", default=False)

args=TestHelper.parse_args({"--keep-logs","--dump-error-details","-v","--leave-running","--clean-run" }, applicationSpecificArgs=appArgs)
debug=args.v
Expand All @@ -76,7 +77,7 @@
eosEvmContractRoot=args.eos_evm_contract_root
gensisJson=args.genesis_json
readEndpoint=args.read_endpoint

useEosVmOC=args.use_eos_vm_oc
assert eosEvmContractRoot is not None, "--eos-evm-contract-root is required"

totalProducerNodes=2
Expand Down
Loading