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

**WIP** [PH] Develop test trx generator #82

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
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
8 changes: 4 additions & 4 deletions .cicd/defaults.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"leap-dev":{
"target":"4",
"prerelease":false
"target":"5",
"prerelease":true
},
"leap":{
"target":"4",
"prerelease":false
"target":"5",
"prerelease":true
},
"cdt":{
"target":"3.1.0",
Expand Down
132 changes: 91 additions & 41 deletions .github/workflows/node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,45 +110,6 @@ jobs:
push: true
tags: ${{fromJSON(needs.d.outputs.p)[matrix.platform].image}}
file: ${{fromJSON(needs.d.outputs.p)[matrix.platform].dockerfile}}

build:
name: EOS EVM Node Build
needs: [d, build-platforms]
if: always() && needs.d.result == 'success' && (needs.build-platforms.result == 'success' || needs.build-platforms.result == 'skipped')
strategy:
fail-fast: false
matrix:
platform: [ ubuntu22 ]
runs-on: ubuntu-latest
container: ${{fromJSON(needs.d.outputs.p)[matrix.platform].image}}

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-11
CXX: g++-11

- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: build.tar.gz
path: build.tar.gz

versions:
name: Determine Versions
runs-on: ubuntu-latest
Expand Down Expand Up @@ -206,6 +167,85 @@ jobs:
if [[ "${{inputs.override-eos-evm-miner}}" != "" ]]; then
echo eos-evm-miner-target=${{inputs.override-eos-evm-miner}} >> $GITHUB_OUTPUT
fi

build:
name: EOS EVM Node Build
needs: [d, build-platforms, versions]
if: always() && needs.d.result == 'success' && (needs.build-platforms.result == 'success' || needs.build-platforms.result == 'skipped')
strategy:
fail-fast: false
matrix:
platform: [ ubuntu22 ]
runs-on: ubuntu-latest
container: ${{fromJSON(needs.d.outputs.p)[matrix.platform].image}}

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

- 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.*${{matrix.platform}}.*(x86_64|amd64).deb'
container-package: experimental-binaries
token: ${{ secrets.GITHUB_TOKEN }}

- if: needs.versions.outputs.leap-target != 'DEFAULT' && (startsWith(needs.versions.outputs.leap-target, 3) || startsWith(needs.versions.outputs.leap-target, 4))
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 }}
- if: needs.versions.outputs.leap-target == 'DEFAULT' || !(startsWith(needs.versions.outputs.leap-target, 3) && startsWith(needs.versions.outputs.leap-target, 4))
name: Download Prev Leap Version
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.*amd64.deb'

- name: Install Leap
run: |
apt-get install -y ./leap*.deb
- 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-11
CXX: g++-11

- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: build.tar.gz
path: build.tar.gz

integration-test:
name: EOS EVM Integration Tests
Expand Down Expand Up @@ -250,11 +290,12 @@ jobs:
repo: leap
target: '${{needs.versions.outputs.leap-dev-target}}'
prereleases: ${{fromJSON(needs.versions.outputs.leap-dev-prerelease)}}
file: 'leap-dev.*(x86_64|amd64).deb'
file: 'leap-dev.*${{matrix.platform}}.*(x86_64|amd64).deb'
container-package: experimental-binaries
token: ${{ secrets.GITHUB_TOKEN }}

- name: Download leap binary
- if: needs.versions.outputs.leap-target != 'DEFAULT' && (startsWith(needs.versions.outputs.leap-target, 3) || startsWith(needs.versions.outputs.leap-target, 4))
name: Download leap binary
uses: AntelopeIO/asset-artifact-download-action@v3
with:
owner: AntelopeIO
Expand All @@ -263,6 +304,15 @@ jobs:
prereleases: ${{fromJSON(needs.versions.outputs.leap-prerelease)}}
file: 'leap.*${{matrix.platform}}.*(x86_64|amd64).deb'
token: ${{ secrets.GITHUB_TOKEN }}
- if: needs.versions.outputs.leap-target == 'DEFAULT' || !(startsWith(needs.versions.outputs.leap-target, 3) && startsWith(needs.versions.outputs.leap-target, 4))
name: Download Prev Leap Version
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.*amd64.deb'

- name: Install Leap
run: |
Expand Down
1 change: 1 addition & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
add_subdirectory( nodeos_eos_evm_server )
add_subdirectory( trx_generator )

configure_file(antelope_name.py . COPYONLY)
configure_file(nodeos_eos_evm_server.py . COPYONLY)
Expand Down
9 changes: 9 additions & 0 deletions tests/trx_generator/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
find_package(eosio)

set(SILKWORM_LIBRARIES silkworm_core )

add_executable(trx_generator main.cpp trx_generator.cpp trx_provider.cpp)

target_include_directories(trx_generator PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})

target_link_libraries(trx_generator PRIVATE EosioChain Boost::program_options Boost::beast ${SILKWORM_LIBRARIES} ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS})
65 changes: 65 additions & 0 deletions tests/trx_generator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Transaction Generator

The Transaction Generator is a program built to create and send transactions at a specified rate in order to generate load on a blockchain. It is comprised of 3 main components: Transaction Generator, Transaction Provider, and Performance Monitor.

The `trx_generator.[hpp, cpp]` is currently specialized to be a `transfer_trx_generator` primarily focused on generating token transfer transactions. The transactions are then provided to the network by the `trx_provider.[hpp, cpp]` which is currently aimed at the P2P network protocol in the `p2p_trx_provider`. The third component, the `tps_performance_monitor`, allows the Transaction Generator to monitor its own performance and take action to notify and exit if it is unable to keep up with the requested transaction generation rate.

The Transaction Generator logs each transaction's id and sent timestamp at the moment the Transaction Provider sends the transaction. Logs are written to the configured log directory and will follow the naming convention `trx_data_output_10744.txt` where `10744` is the transaction generator instance's process ID.

## Configuration Options
`./build/tests/trx_generator/trx_generator` can be configured using the following command line arguments:

<details open>
<summary>Expand Argument List</summary>

* `--generator-id arg` (=0) Id for the transaction generator.
Allowed range (0-960). Defaults to 0.
* `--chain-id arg` set the chain id
* `--contract-owner-account arg` Account name of the contract account
for the transaction actions
* `--accounts arg` comma-separated list of accounts that
will be used for transfers. Minimum
required accounts: 2.
* `--priv-keys arg` comma-separated list of private keys in
same order of accounts list that will
be used to sign transactions. Minimum
required: 2.
* `--trx-expiration arg` (=3600) transaction expiration time in seconds.
Defaults to 3,600. Maximum allowed:
3,600
* `--trx-gen-duration arg` (=60) Transaction generation duration
(seconds). Defaults to 60 seconds.
* `--target-tps arg` (=1) Target transactions per second to
generate/send. Defaults to 1
transaction per second.
* `--last-irreversible-block-id arg` Current last-irreversible-block-id (LIB
ID) to use for transactions.
* `--monitor-spinup-time-us arg` (=1000000)
Number of microseconds to wait before
monitoring TPS. Defaults to 1000000
(1s).
* `--monitor-max-lag-percent arg` (=5) Max percentage off from expected
transactions sent before being in
violation. Defaults to 5.
* `--monitor-max-lag-duration-us arg` (=1000000)
Max microseconds that transaction
generation can be in violation before
quitting. Defaults to 1000000 (1s).
* `--log-dir arg` set the logs directory
* `--stop-on-trx-failed arg` (=1) stop transaction generation if sending
fails.
* `--abi-file arg` The path to the contract abi file to
use for the supplied transaction action
data
* `--actions-data arg` The json actions data file or json
actions data description string to use
* `--actions-auths arg` The json actions auth file or json
actions auths description string to
use, containting authAcctName to
activePrivateKey pairs.
* `--peer-endpoint arg` (=127.0.0.1) set the peer endpoint to send
transactions to
* `--port arg` (=9876) set the peer endpoint port to send
transactions to
* `-h [ --help ]` print this list
</details>
Loading
Loading