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

eos-evm-node repo integration test #17

Merged
merged 52 commits into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
5e88edd
Port PR for leap integration test updates and workflow.
oschwaldp-oci Jul 28, 2023
950a483
sudo not installed.
oschwaldp-oci Jul 28, 2023
bb3925a
Fix typo in tar extraction.
oschwaldp-oci Jul 28, 2023
f4305c3
Add Update Package Index & Upgrade Packages step to itegration-test job.
oschwaldp-oci Jul 30, 2023
638e2be
Install libssl-dev directly.
oschwaldp-oci Jul 31, 2023
b0ee240
Target Ubuntu 22.04 leap package.
oschwaldp-oci Jul 31, 2023
a72d3c4
Try using matrix platform substitution into file regex.
oschwaldp-oci Jul 31, 2023
103ee0b
Leap v4.0.4 only currently supports ubuntu20.04. Revert change.
oschwaldp-oci Jul 31, 2023
19b22ae
Add Authenticate step.
oschwaldp-oci Jul 31, 2023
538ff1f
Take care of install continue prompts with auto yes.
oschwaldp-oci Jul 31, 2023
0eff6a0
Fix directory structure, test is not longer in leap.
oschwaldp-oci Jul 31, 2023
83c2039
Give test executable permissions.
oschwaldp-oci Jul 31, 2023
42f88e3
Use absolute paths instead of relative.
oschwaldp-oci Jul 31, 2023
135c31a
Working to debug test failure in cicd.
oschwaldp-oci Jul 31, 2023
574cf3b
Try some relative paths to debug cicd.
oschwaldp-oci Jul 31, 2023
a3ee342
checkout into specific path to not overwrite other checkouts.
oschwaldp-oci Aug 1, 2023
9a40beb
Fixing path issues.
oschwaldp-oci Aug 1, 2023
b15eeaa
Fix path to test.
oschwaldp-oci Aug 1, 2023
9b4db47
Debug node root.
oschwaldp-oci Aug 1, 2023
7eb8c6d
CICD test still not found. Debugging.
oschwaldp-oci Aug 1, 2023
10e2319
Remove unnecessary object files from build dir artifact.
oschwaldp-oci Aug 1, 2023
162a96e
Move EOS EVM Contract step after cdt and leap steps.
oschwaldp-oci Aug 1, 2023
a849bba
Fix evm-contract step name.
oschwaldp-oci Aug 1, 2023
b9f60d1
Fix exclude in tar step.
oschwaldp-oci Aug 1, 2023
d2f4a57
Give test more time yet to see how long it takes, if it succeeds.
oschwaldp-oci Aug 1, 2023
224b6e5
Add tests and peripherals into the build.
oschwaldp-oci Aug 1, 2023
412eaa7
eos-evm-node executable is no longer in cmd but is still in src in th…
oschwaldp-oci Aug 1, 2023
1886713
Update eos-evm-node arguments.
oschwaldp-oci Aug 1, 2023
1923dc0
Need to update test for split of eos-evm-node and eos-evm-rpc and lau…
oschwaldp-oci Aug 2, 2023
51fbcc8
Fix genesis spelling.
oschwaldp-oci Aug 2, 2023
0c86e42
Workflow and test cleanup.
oschwaldp-oci Aug 2, 2023
8dbc112
Update notes on running test.
oschwaldp-oci Aug 2, 2023
cf5d57c
Copy eos-evm-node and eos-evm-rpc executables into the bin directory …
oschwaldp-oci Aug 2, 2023
cdbb6e6
Fix no newline at end of file.
oschwaldp-oci Aug 2, 2023
ef8d9cc
Add configurability to workflow for leap, leap-dev, cdt, and eos-evm-…
oschwaldp-oci Aug 2, 2023
12ee317
Move version discovery into own job.
oschwaldp-oci Aug 2, 2023
ae68d04
Fix quotes for jq
oschwaldp-oci Aug 2, 2023
6f37a2e
Fix no newline at end of file.
oschwaldp-oci Aug 2, 2023
51c323c
Revert change to index.js that may no longer be necessary.
oschwaldp-oci Aug 2, 2023
f7c496a
Update docs for version of web3 bumped up to >6
oschwaldp-oci Aug 2, 2023
7c92aed
Define evmRPCPOpen earlier in test.
oschwaldp-oci Aug 2, 2023
24a98d7
Revert "Revert change to index.js that may no longer be necessary."
oschwaldp-oci Aug 2, 2023
1a8317b
Address peer review comments around js and node versions.
oschwaldp-oci Aug 2, 2023
90f99b7
Fix install of nvm
oschwaldp-oci Aug 3, 2023
018e69b
Install curl.
oschwaldp-oci Aug 3, 2023
fc55ee1
Install lts node from downloaded archive.
oschwaldp-oci Aug 3, 2023
9eeded2
Fix typo.
oschwaldp-oci Aug 3, 2023
27910a4
Fix spelling.
oschwaldp-oci Aug 3, 2023
ac91998
Use the npm installed from the tarball.
oschwaldp-oci Aug 3, 2023
1af990b
Use import instead of require.
oschwaldp-oci Aug 3, 2023
793bbee
Fix up module imports and index.js
oschwaldp-oci Aug 3, 2023
41ed154
Use npm install in tx_wrapper instead of trying to install dependenci…
oschwaldp-oci Aug 3, 2023
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
18 changes: 18 additions & 0 deletions .cicd/defaults.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"leap-dev":{
"target":"4",
"prerelease":false
},
"leap":{
"target":"4",
"prerelease":false
},
"cdt":{
"target":"3.1.0",
"prerelease":false
},
"eos-evm-contract":{
"target":"main",
"prerelease":false
}
}
2 changes: 1 addition & 1 deletion .github/workflows/build-node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ ee make -j "$(nproc)"

# pack
ee popd
ee 'tar -czf build.tar.gz build/*'
ee 'tar -czf build.tar.gz --exclude="*.o" build/*'

echo "Done! - ${0##*/}"
238 changes: 233 additions & 5 deletions .github/workflows/node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,46 @@ on:
pull_request:
workflow_dispatch:
inputs:
upload-artifacts:
description: 'Upload artifacts, including the build.tar.gz, for debugging.'
type: boolean
default: false
override-leap-dev:
description: Override leap-dev target
type: string
override-leap-dev-prerelease:
type: choice
description: Override leap-dev prelease
options:
- default
- true
- false
override-leap:
description: Override leap target
type: string
override-leap-prerelease:
type: choice
description: Override leap prelease
options:
- default
- true
- false
override-cdt:
description: 'Override cdt target'
type: string
override-cdt-prerelease:
type: choice
description: Override cdt prelease
options:
- default
- true
- false
override-eos-evm-contract:
description: 'Override eos-evm-contract target'
type: string
override-eos-evm-contract-prerelease:
type: choice
description: Override eos-evm-contract prelease
options:
- default
- true
- false

defaults:
run:
Expand Down Expand Up @@ -106,7 +142,199 @@ jobs:

- name: Upload Artifacts
uses: actions/upload-artifact@v3
if: inputs.upload-artifacts || false
with:
name: build.tar.gz
path: build.tar.gz

versions:
name: Determine Versions
runs-on: ubuntu-latest
outputs:
leap-dev-target: ${{steps.versions.outputs.leap-dev-target}}
leap-dev-prerelease: ${{steps.versions.outputs.leap-dev-prerelease}}
leap-target: ${{steps.versions.outputs.leap-target}}
leap-prerelease: ${{steps.versions.outputs.leap-prerelease}}
cdt-target: ${{steps.versions.outputs.cdt-target}}
cdt-prerelease: ${{steps.versions.outputs.cdt-prerelease}}
eos-evm-contract-target: ${{steps.versions.outputs.eos-evm-contract-target}}
eos-evm-contract-prerelease: ${{steps.versions.outputs.eos-evm-contract-prerelease}}
steps:
- name: Setup versions from input or defaults
id: versions
env:
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
DEFAULTS_JSON=$(curl -sSfL $(gh api https://api.github.com/repos/${{github.repository}}/contents/.cicd/defaults.json?ref=${{github.sha}} --jq .download_url))
echo leap-dev-target=$(echo "$DEFAULTS_JSON" | jq -r '."leap-dev".target') >> $GITHUB_OUTPUT
echo leap-dev-prerelease=$(echo "$DEFAULTS_JSON" | jq -r '."leap-dev".prerelease') >> $GITHUB_OUTPUT
echo leap-target=$(echo "$DEFAULTS_JSON" | jq -r '."leap".target') >> $GITHUB_OUTPUT
echo leap-prerelease=$(echo "$DEFAULTS_JSON" | jq -r '."leap".prerelease') >> $GITHUB_OUTPUT
echo cdt-target=$(echo "$DEFAULTS_JSON" | jq -r '."cdt".target') >> $GITHUB_OUTPUT
echo cdt-prerelease=$(echo "$DEFAULTS_JSON" | jq -r '."cdt".prerelease') >> $GITHUB_OUTPUT
echo eos-evm-contract-target=$(echo "$DEFAULTS_JSON" | jq -r '."eos-evm-contract".target') >> $GITHUB_OUTPUT
echo eos-evm-contract-prerelease=$(echo "$DEFAULTS_JSON" | jq -r '."eos-evm-contract".prerelease') >> $GITHUB_OUTPUT

if [[ "${{inputs.override-leap-dev}}" != "" ]]; then
echo leap-dev-target=${{inputs.override-leap-dev}} >> $GITHUB_OUTPUT
fi
if [[ "${{inputs.override-leap-dev-prerelease}}" == +(true|false) ]]; then
echo leap-dev-prerelease=${{inputs.override-leap-dev-prerelease}} >> $GITHUB_OUTPUT
fi
if [[ "${{inputs.override-leap}}" != "" ]]; then
echo leap-target=${{inputs.override-leap}} >> $GITHUB_OUTPUT
fi
if [[ "${{inputs.override-leap-prerelease}}" == +(true|false) ]]; then
echo leap-prerelease=${{inputs.override-leap-prerelease}} >> $GITHUB_OUTPUT
fi
if [[ "${{inputs.override-cdt}}" != "" ]]; then
echo cdt-target=${{inputs.override-cdt}} >> $GITHUB_OUTPUT
fi
if [[ "${{inputs.override-cdt-prerelease}}" == +(true|false) ]]; then
echo cdt-prerelease=${{inputs.override-cdt-prerelease}} >> $GITHUB_OUTPUT
fi
if [[ "${{inputs.override-eos-evm-contract}}" != "" ]]; then
echo eos-evm-contract-target=${{inputs.override-eos-evm-contract}} >> $GITHUB_OUTPUT
fi
if [[ "${{inputs.override-eos-evm-contract-prerelease}}" == +(true|false) ]]; then
echo eos-evm-contract-prerelease=${{inputs.override-eos-evm-contract-prerelease}} >> $GITHUB_OUTPUT
fi

integration-test:
name: EOS EVM Integration Tests
needs: [d, build, versions]
if: always() && needs.d.result == 'success' && needs.build.result == 'success' && needs.versions.result == 'success'
strategy:
fail-fast: false
matrix:
platform: [ ubuntu22 ]
runs-on: ubuntu-latest
container: ${{fromJSON(needs.d.outputs.p)[matrix.platform].image}}
env:
CC: gcc-11
CXX: g++-11
DCMAKE_BUILD_TYPE: 'Release'

steps:
- name: Update Package Index & Upgrade Packages
run: |
apt-get update
apt-get upgrade -y
apt update
apt upgrade -y

- name: Download CDT
uses: AntelopeIO/asset-artifact-download-action@v3
with:
owner: AntelopeIO
repo: cdt
target: '${{needs.versions.outputs.cdt-target}}'
prereleases: ${{fromJSON(needs.versions.outputs.cdt-prerelease)}}
file: 'cdt_.*amd64.deb'
token: ${{ secrets.GITHUB_TOKEN }}

- name: Install CDT
run: apt-get install -y ./cdt*.deb

- name: Download leap-dev binary
uses: AntelopeIO/asset-artifact-download-action@v3
with:
owner: AntelopeIO
repo: leap
target: '${{needs.versions.outputs.leap-dev-target}}'
prereleases: ${{fromJSON(needs.versions.outputs.leap-dev-prerelease)}}
file: 'leap-dev.*(x86_64|amd64).deb'
container-package: experimental-binaries
token: ${{ secrets.GITHUB_TOKEN }}

- name: Download leap binary
uses: AntelopeIO/asset-artifact-download-action@v3
with:
owner: AntelopeIO
repo: leap
target: '${{needs.versions.outputs.leap-target}}'
prereleases: ${{fromJSON(needs.versions.outputs.leap-prerelease)}}
file: 'leap.*${{matrix.platform}}.*(x86_64|amd64).deb'
token: ${{ secrets.GITHUB_TOKEN }}

- name: Install Leap
run: |
apt-get install -y ./leap*.deb

- name: Link Leap TestHarness Module (fix for v4 of leap)
run: ln -s /usr/share/leap_testing/tests/TestHarness /usr/lib/python3/dist-packages/TestHarness

- name: Download EOS EVM Contract
uses: AntelopeIO/asset-artifact-download-action@v3
with:
owner: eosnetworkfoundation
repo: eos-evm
target: '${{needs.versions.outputs.eos-evm-contract-target}}'
prereleases: ${{fromJSON(needs.versions.outputs.eos-evm-contract-prerelease)}}
file: 'contract.tar.gz'
artifact-name: contract.test-actions-off.tar.gz
token: ${{ secrets.GITHUB_TOKEN }}

- name: Extract EOS EVM Contract
id: evm-contract
run: |
mkdir contract
mv contract.tar.gz contract/
cd contract
tar xvf contract.tar.gz
cd build
echo "EVM_CONTRACT=$(pwd)" >> "$GITHUB_OUTPUT"

- 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: Download EOS EVM Node builddir
uses: actions/download-artifact@v3
with:
name: build.tar.gz

- name: Extract EOS EVM Node builddir
id: evm-node-build
run: |
mkdir eos-evm-node
mv build.tar.gz eos-evm-node/
pushd eos-evm-node
tar xvf build.tar.gz
pushd build
echo "EVM_NODE_BUILD=$(pwd)" >> "$GITHUB_OUTPUT"
popd

- name: Install Test Depedencies
run: |
apt install -y nvm
nvm use lts/hydrogen
pip install --upgrade web3
apt install -y nodejs
apt install -y npm
npm install eosjs
npm install ethereumjs-util
npm install node-fetch
npm install http-jsonrpc-server
npm install dotenv
npm install is-valid-hostname

- name: Test Leap Integration
run: |
mkdir test_run_root
cd test_run_root
${{ steps.evm-node-build.outputs.EVM_NODE_BUILD }}/tests/nodeos_eos_evm_test.py -v --eos-evm-contract-root ${{ steps.evm-contract.outputs.EVM_CONTRACT }} --eos-evm-build-root ${{ steps.evm-node-build.outputs.EVM_NODE_BUILD }} --use-tx-wrapper ${{ steps.evm-node-build.outputs.EVM_NODE_BUILD }}/peripherals/tx_wrapper
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we consider setting up ctest?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what that would look like since this is an integration test that requires access to leap, leap-dev, cdt, eos-evm-contract which may not be available locally for ctest.


- name: Prepare Logs
if: failure()
run: |
tar -czf leap-int-test-logs.tar.gz test_run_root/*

- name: Upload logs from failed tests
uses: actions/upload-artifact@v3
if: failure()
with:
name: leap-int-test-logs.tar.gz
path: leap-int-test-logs.tar.gz
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
cmake_minimum_required(VERSION 3.16.2)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")

include(cmake/cable/bootstrap.cmake)
include(CableBuildType)
include(utils)
cable_set_build_type(DEFAULT Release CONFIGURATION_TYPES Release Debug)

if(NOT CMAKE_TOOLCHAIN_FILE)
Expand Down Expand Up @@ -29,3 +32,5 @@ endif()
add_subdirectory(external)
add_subdirectory(version)
add_subdirectory(src)
add_subdirectory(peripherals)
add_subdirectory(tests)
4 changes: 4 additions & 0 deletions CMakeModules/utils.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
macro( copy_bin file )
add_custom_command( TARGET ${file} POST_BUILD COMMAND mkdir -p ${CMAKE_BINARY_DIR}/bin )
add_custom_command( TARGET ${file} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/${file}${CMAKE_EXECUTABLE_SUFFIX} ${CMAKE_BINARY_DIR}/bin/ )
endmacro( copy_bin )
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ make -j8
```
You'll get the list of binaries with other tools:
```
src/eos-evm-node
src/eos-evm-rpc
bin/eos-evm-node
bin/eos-evm-rpc
```

Alternatively, to build with specific compiler:
Expand Down
1 change: 1 addition & 0 deletions peripherals/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add_subdirectory( tx_wrapper )
4 changes: 4 additions & 0 deletions peripherals/tx_wrapper/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
configure_file( index.js . COPYONLY )
configure_file( package-lock.json . COPYONLY )
configure_file( package.json . COPYONLY )
configure_file( yarn.lock . COPYONLY )
4 changes: 2 additions & 2 deletions peripherals/tx_wrapper/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { Api, JsonRpc, RpcError } = require("eosjs");
const { JsSignatureProvider } = require("eosjs/dist/eosjs-jssig"); // development only
const fetch = require("node-fetch"); // node only; not needed in browsers
//const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args));
// const fetch = require("node-fetch"); // node only; not needed in browsers
const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args));
ericpassmore marked this conversation as resolved.
Show resolved Hide resolved
const { TextEncoder, TextDecoder } = require("util"); // node only; native TextEncoder/Decoder

const RpcServer = require("http-jsonrpc-server");
Expand Down
1 change: 1 addition & 0 deletions peripherals/tx_wrapper/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "evm_poc_tx_wrapper",
"type": "module",
"version": "1.0.0",
"main": "index.js",
"repository": "https://github.com/yarkinwho/evm_poc_tx_wrapper",
Expand Down
5 changes: 4 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,7 @@ target_link_libraries(eos-evm-node PRIVATE appbase abieos sys_plugin engine_plug

add_executable(eos-evm-rpc eos-evm-rpc.cpp)
target_include_directories(eos-evm-rpc PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries(eos-evm-rpc PRIVATE appbase abieos sys_plugin rpc_plugin boost_filesystem version)
target_link_libraries(eos-evm-rpc PRIVATE appbase abieos sys_plugin rpc_plugin boost_filesystem version)

copy_bin( eos-evm-node )
copy_bin( eos-evm-rpc )
5 changes: 5 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
add_subdirectory( nodeos_eos_evm_server )

configure_file(antelope_name.py . COPYONLY)
configure_file(nodeos_eos_evm_server.py . COPYONLY)
configure_file(nodeos_eos_evm_test.py . COPYONLY)
7 changes: 7 additions & 0 deletions tests/nodeos_eos_evm_server/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
add_subdirectory( contracts )
add_subdirectory( scripts )

configure_file( extract-logtime-cmd.sh . COPYONLY )
configure_file( hardhat.config.js . COPYONLY )
configure_file( package.json . COPYONLY )
configure_file( yarn.lock . COPYONLY )
6 changes: 3 additions & 3 deletions tests/nodeos_eos_evm_server/PERFORMANCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ ln -s ~/evmperf/eos-evm/tests/leap/nodeos_eos_evm_server.py nodeos_eos_evm_serve
sed -i 's/SYS/EOS/g' core_symbol.py
python3 -m venv venv
source venv/bin/activate
pip install 'web3<6' flask flask-cors
pip install 'web3>=6' flask flask-cors
```


Expand All @@ -68,14 +68,14 @@ cd ..

### Launch eos-evm-node
```
cd ~/evmperf/eos-evm/build/cmd
cd ~/evmperf/eos-evm/build/bin
rm -rf chaindata etl-temp config-dir
./eos-evm-node --plugin=blockchain_plugin --ship-endpoint=127.0.0.1:8999 --genesis-json=$HOME/evmperf/leap/build/eos-evm-genesis.json --verbosity=4
```

### Launch eos-evm-rpc
```
cd ~/evmperf/eos-evm/build/cmd
cd ~/evmperf/eos-evm/build/bin
./eos-evm-rpc --eos-evm-node=127.0.0.1:8080 --http-port=0.0.0.0:8881 --chaindata=./ --api-spec=eth,debug,net,trace --verbosity=4
```

Expand Down
9 changes: 9 additions & 0 deletions tests/nodeos_eos_evm_server/contracts/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
configure_file( BlockNum.sol . COPYONLY )
configure_file( Blockhash.sol . COPYONLY )
configure_file( CMakeLists.txt . COPYONLY )
configure_file( Eventor.sol . COPYONLY )
configure_file( Lock.sol . COPYONLY )
configure_file( Recursive.sol . COPYONLY )
configure_file( Storage.sol . COPYONLY )
configure_file( Token.sol . COPYONLY )
configure_file( WEOS.sol . COPYONLY )
Loading
Loading