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

Improved system tests #110

Merged
merged 19 commits into from
Nov 4, 2024
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
4 changes: 4 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ export SPONSOR_SECRET_KEY=413f42575f7f26fad3317a778771212fdb80245850981e48b58a4f

# For the Github workflows, a repository secret (private deep history instance) is being used.
export MAINNET_PROXY_URL="https://gateway.multiversx.com"

# For internal testing:
export INTERNAL_TESTNET_PROXY_URL=""
export INTERNAL_TESTNET_EXPLORER_URL=""
2 changes: 1 addition & 1 deletion .github/workflows/check_with_mesh_cli.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Check with Mesh CLI
name: Check with Mesh CLI (testnet)

on:
pull_request:
Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/check_with_mesh_cli_on_localnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Check with Mesh CLI (localnet)

on:
pull_request:
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/setup-python@v5
with:
python-version: 3.11

- uses: actions/checkout@v4

- name: Install dependencies
run: |
pipx install multiversx-sdk-cli --force
pip install -r ./requirements-dev.txt
curl -sSfL https://raw.githubusercontent.com/coinbase/mesh-cli/master/scripts/install.sh | sh -s -- -b "$HOME/.local/bin"
echo "$HOME/.local/bin" >> $GITHUB_PATH

- name: Build
run: |
cd $GITHUB_WORKSPACE/cmd/rosetta && go build .
cd $GITHUB_WORKSPACE/systemtests && go build ./proxyToObserverAdapter.go

- name: Set up MultiversX localnet
run: |
mkdir -p ~/localnet && cd ~/localnet
mxpy localnet setup --configfile=${GITHUB_WORKSPACE}/systemtests/localnet.toml

# Start the localnet and store the PID
nohup mxpy localnet start --configfile=${GITHUB_WORKSPACE}/systemtests/localnet.toml > localnet.log 2>&1 & echo $! > localnet.pid
sleep 60 # Allow time for the localnet to start

- name: Generate testdata
run: |
source .env
PYTHONPATH=. python3 ./systemtests/generate_testdata_on_network.py setup --network localnet
PYTHONPATH=. python3 ./systemtests/generate_testdata_on_network.py run --network localnet

- name: check:data
run: |
source .env
PYTHONPATH=. python3 ./systemtests/check_with_mesh_cli.py --mode=data --network=localnet

- name: Stop MultiversX localnet
if: success() || failure()
run: |
kill $(cat localnet.pid) || echo "Testnet already stopped"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ cmd/rosetta/logs/**
systemtests/logs/**
systemtests/memento/**
systemtests/**/check-data/**
systemtests/localnet/**
logs/**

**/__pycache__/**
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,9 @@ Run the checks:

```
PYTHONPATH=. python3 ./systemtests/check_with_mesh_cli.py --mode=data --network=testnet

# Or, continuously:
while PYTHONPATH=. python3 ./systemtests/check_with_mesh_cli.py --mode=data --network=testnet; do sleep 5; done
```

### Check:construction
Expand Down
41 changes: 32 additions & 9 deletions systemtests/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ class Configuration:
check_data_configuration_file: str
check_data_directory: str
check_data_num_blocks: int
explorer_url: str
view_url: str
custom_currency_issue_cost: int = 50000000000000000
memento_file: str = ""
sponsor_secret_key: bytes = bytes.fromhex(os.environ.get("SPONSOR_SECRET_KEY", ""))
users_mnemonic: str = os.environ.get("USERS_MNEMONIC", "")
num_users: int = 128


CONFIGURATIONS = {
Expand All @@ -36,14 +38,14 @@ class Configuration:
observer_url="",
proxy_url=os.environ.get("MAINNET_PROXY_URL", "https://gateway.multiversx.com"),
activation_epoch_sirius=1265,
activation_epoch_spica=4294967295,
activation_epoch_spica=1538,
check_construction_native_configuration_file="",
check_construction_custom_configuration_file="",
check_data_configuration_file="systemtests/mesh_cli_config/check-data.json",
check_data_directory="systemtests/mainnet-data",
check_data_num_blocks=4096,
memento_file="systemtests/memento/mainnet.json",
explorer_url="https://explorer.multiversx.com",
view_url="https://explorer.multiversx.com/transactions/{hash}",
),
"devnet": Configuration(
network_shard=0,
Expand All @@ -55,14 +57,14 @@ class Configuration:
observer_url="",
proxy_url="https://devnet-gateway.multiversx.com",
activation_epoch_sirius=629,
activation_epoch_spica=4294967295,
activation_epoch_spica=2327,
check_construction_native_configuration_file="systemtests/mesh_cli_config/devnet-construction-native.json",
check_construction_custom_configuration_file="systemtests/mesh_cli_config/devnet-construction-custom.json",
check_data_configuration_file="systemtests/mesh_cli_config/check-data.json",
check_data_directory="systemtests/devnet-data",
check_data_num_blocks=0,
memento_file="systemtests/memento/devnet.json",
explorer_url="https://devnet-explorer.multiversx.com",
view_url="https://devnet-explorer.multiversx.com/transactions/{hash}",
),
"testnet": Configuration(
network_shard=0,
Expand All @@ -81,25 +83,46 @@ class Configuration:
check_data_directory="systemtests/testnet-data",
check_data_num_blocks=0,
memento_file="systemtests/memento/testnet.json",
explorer_url="https://testnet-explorer.multiversx.com",
view_url="https://testnet-explorer.multiversx.com/transactions/{hash}",
),
"localnet": Configuration(
network_shard=0,
network_id="localnet",
network_name="untitled",
native_currency="EGLD",
config_file_custom_currencies="systemtests/rosetta_config/localnet-custom-currencies.json",
num_historical_epochs=2,
num_historical_epochs=3,
observer_url="",
proxy_url="http://localhost:7950",
activation_epoch_sirius=1,
activation_epoch_spica=4294967295,
activation_epoch_spica=4,
check_construction_native_configuration_file="systemtests/mesh_cli_config/localnet-construction-native.json",
check_construction_custom_configuration_file="systemtests/mesh_cli_config/localnet-construction-custom.json",
check_data_configuration_file="systemtests/mesh_cli_config/check-data.json",
check_data_directory="systemtests/localnet-data",
check_data_num_blocks=0,
memento_file="systemtests/memento/localnet.json",
explorer_url="",
view_url="http://localhost:7950/transaction/{hash}?withResults=true&withLogs=true",
custom_currency_issue_cost=5000000000000000000
),
"internal": Configuration(
network_shard=0,
network_id="1",
network_name="untitled",
native_currency="EGLD",
config_file_custom_currencies="systemtests/rosetta_config/internal-custom-currencies.json",
num_historical_epochs=1,
observer_url="",
proxy_url=os.environ.get("INTERNAL_TESTNET_PROXY_URL", ""),
activation_epoch_sirius=1,
activation_epoch_spica=4,
check_construction_native_configuration_file="systemtests/mesh_cli_config/internal-construction-native.json",
check_construction_custom_configuration_file="systemtests/mesh_cli_config/internal-construction-custom.json",
check_data_configuration_file="systemtests/mesh_cli_config/check-data.json",
check_data_directory="systemtests/internal-data",
check_data_num_blocks=0,
memento_file="systemtests/memento/internal.json",
view_url=f"{os.environ.get('INTERNAL_TESTNET_EXPLORER_URL', '')}/transactions/{{hash}}",
custom_currency_issue_cost=5000000000000000000
),
}
Binary file modified systemtests/contracts/dummy.wasm
Binary file not shown.
Binary file added systemtests/contracts/forwarder.wasm
Binary file not shown.
Loading
Loading