Skip to content
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
57 changes: 57 additions & 0 deletions .github/workflows/tests-e2e-nix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: E2E Nix Tests
on:
push:
branches:
- main
- release/**
pull_request:
branches:
- main
- release/**

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
integration_tests:
runs-on: ubuntu-latest
timeout-minutes: 240
strategy:
matrix:
tests: [all]
env:
TESTS_TO_RUN: ${{ matrix.tests }}
steps:
- name: Create more disk space
run: sudo rm -rf /usr/share/dotnet && sudo rm -rf /opt/ghc && sudo rm -rf "/usr/local/share/boost" && sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 1
- id: changed-files
uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c # v46.0.5
with:
files: |
docs
*.md
**/*.md
- uses: cachix/install-nix-action@ba0dd844c9180cbf77aa72a116d6fbc515d0e87b # v27
with:
nix_path: nixpkgs=channel:nixos-24.11
extra_nix_config: |
access-tokens = github.com=${{ secrets.NIX_GH_TOKEN || github.token }}
sandbox = false
if: steps.changed-files.outputs.only_changed == 'false'
- name: Run integration tests
if: steps.changed-files.outputs.only_changed == 'false'
run: make test-e2e-nix
- name: 'Tar debug files'
if: failure()
run: tar cfz debug_files.tar.gz -C "${TMPDIR-/tmp}/pytest-of-runner" .
- uses: actions/upload-artifact@v4
if: failure()
with:
name: debug-files
path: debug_files.tar.gz
if-no-files-found: ignore
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,8 @@ build/
tests/systemtests/binaries
tests/systemtests/testnet
.testnets

# Environments
*.env
.envrc
.venv
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@
[submodule "tests/evm-tools-compatibility/foundry/lib/forge-std"]
path = tests/evm-tools-compatibility/foundry/lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "tests/integration_tests/contracts/openzeppelin-contracts-upgradeable"]
path = tests/integration_tests/contracts/openzeppelin-contracts-upgradeable
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable.git
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,10 @@ test-solidity:
@echo "Beginning solidity tests..."
./scripts/run-solidity-tests.sh

test-e2e-nix:
@bash ./tests/scripts/restore_envs.sh
@nix-shell ./tests/integration_tests/shell.nix --run "CHAIN_CONFIG=$(CHAIN_CONFIG) ./tests/scripts/run-integration-tests.sh"

.PHONY: run-tests test test-all $(TEST_TARGETS)

benchmark:
Expand Down Expand Up @@ -239,6 +243,12 @@ lint-fix:
lint-fix-contracts:
solhint --fix contracts/**/*.sol

lint-py:
flake8 --show-source --count --statistics \
--format="::error file=%(path)s,line=%(row)d,col=%(col)d::%(path)s:%(row)d:%(col)d: %(code)s %(text)s" \
--exclude=tests/integration_tests/contracts \
tests/integration_tests/

.PHONY: lint lint-fix lint-contracts lint-go lint-python

format: format-go format-python format-shell
Expand Down
4 changes: 4 additions & 0 deletions tests/integration_tests/.flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[flake8]
max-line-length = 88
extend-ignore = E203
exclude = .git,__pycache__,./integration_tests/contracts
Empty file.
15 changes: 15 additions & 0 deletions tests/integration_tests/configs/accounts.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
local config = import 'default.jsonnet';
local chain = (import 'chains.jsonnet')[std.extVar('CHAIN_CONFIG')];

config {
'evm-canary-net-1'+: {
accounts: super.accounts[:std.length(super.accounts) - 1] + [
{
'coin-type': 60,
name: 'user' + i,
coins: '100000000000000000' + chain.evm_denom,
}
for i in std.range(0, 5)
],
},
}
34 changes: 34 additions & 0 deletions tests/integration_tests/configs/chains.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
evmd: {
'account-prefix': 'cosmos',
evm_denom: 'atest',
cmd: 'evmd',
evm_chain_id: 262144,
bank: {
denom_metadata: [{
description: 'Native 18-decimal denom metadata for Cosmos EVM chain',
denom_units: [
{
denom: 'atest',
exponent: 0,
},
{
denom: 'test',
exponent: 18,
},
],
base: 'atest',
display: 'test',
name: 'Cosmos EVM',
symbol: 'ATOM',
}],
},
evm: {},
feemarket: {
params: {
base_fee: '1000000000',
min_gas_price: '1000000000',
},
},
},
}
188 changes: 188 additions & 0 deletions tests/integration_tests/configs/default.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
local chain = (import 'chains.jsonnet')[std.extVar('CHAIN_CONFIG')];
local gas_price = 1000000000;

{
dotenv: '../../scripts/.env',
'evm-canary-net-1': {
cmd: chain.cmd,
'start-flags': '--trace',
config: {
mempool: {
version: 'v1',
},
},
'app-config': {
evm: {
'evm-chain-id': chain.evm_chain_id,
},
grpc: {
'skip-check-header': true,
},
'minimum-gas-prices': '0' + chain.evm_denom,
'index-events': ['ethereum_tx.ethereumTxHash'],
'iavl-lazy-loading': true,
'json-rpc': {
enable: true,
address: '127.0.0.1:{EVMRPC_PORT}',
'ws-address': '127.0.0.1:{EVMRPC_PORT_WS}',
api: 'eth,net,web3,debug,txpool',
'feehistory-cap': 100,
'block-range-cap': 10000,
'logs-cap': 10000,
'gas-cap': 30000000,
'allow-unprotected-txs': true,
},
mempool: {
'max-txs': 5000,
},
},
validators: [{
'coin-type': 60,
coins: '100000000000000000000' + chain.evm_denom,
staked: '10000000000000000000' + chain.evm_denom,
gas_prices: gas_price + chain.evm_denom,
mnemonic: '${VALIDATOR1_MNEMONIC}',
}, {
'coin-type': 60,
coins: '100000000000000000000' + chain.evm_denom,
staked: '10000000000000000000' + chain.evm_denom,
gas_prices: gas_price + chain.evm_denom,
mnemonic: '${VALIDATOR2_MNEMONIC}',
config: {
db_backend: 'pebbledb',
},
'app-config': {
'app-db-backend': 'pebbledb',
},
}, {
'coin-type': 60,
coins: '100000000000000000000' + chain.evm_denom,
staked: '10000000000000000000' + chain.evm_denom,
gas_prices: gas_price + chain.evm_denom,
mnemonic: '${VALIDATOR3_MNEMONIC}',
config: {
db_backend: 'goleveldb',
},
'app-config': {
'app-db-backend': 'goleveldb',
},
}],
accounts: [{
'coin-type': 60,
name: 'community',
coins: '100000000000000000000' + chain.evm_denom + ',1000000000000atoken',
mnemonic: '${COMMUNITY_MNEMONIC}',
}, {
'coin-type': 60,
name: 'signer1',
coins: '100000000000000000000' + chain.evm_denom,
mnemonic: '${SIGNER1_MNEMONIC}',
}, {
'coin-type': 60,
name: 'signer2',
coins: '100000000000000000000' + chain.evm_denom,
mnemonic: '${SIGNER2_MNEMONIC}',
}, {
'coin-type': 60,
name: 'reserve',
coins: '100000000000000000000' + chain.evm_denom,
mnemonic: '${RESERVE_MNEMONIC}',
vesting: '60s',
}],
genesis: {
consensus: {
params: {
block: {
max_bytes: '1048576',
max_gas: '81500000',
},
abci: {
vote_extensions_enable_height: '1',
},
},
},
app_state: {
evm: chain.evm {
params+: {
evm_denom: chain.evm_denom,
active_static_precompiles: [
'0x0000000000000000000000000000000000000800',
'0x0000000000000000000000000000000000000801',
'0x0000000000000000000000000000000000000805',
'0x0000000000000000000000000000000000000807',
],
},
},
erc20: {
native_precompiles: [
'0x4200000000000000000000000000000000000006',
],
token_pairs: [{
erc20_address: '0x4200000000000000000000000000000000000006',
denom: chain.evm_denom,
enabled: true,
contract_owner: 1,
}],
},
feemarket: chain.feemarket {
params+: {
min_gas_multiplier: '0',
},
},
gov: {
params: {
expedited_voting_period: '1s',
voting_period: '10s',
max_deposit_period: '10s',
min_deposit: [
{
denom: chain.evm_denom,
amount: '1',
},
],
expedited_min_deposit: [
{
denom: chain.evm_denom,
amount: '2',
},
],
},
},
crisis: {
constant_fee: {
denom: chain.evm_denom,
},
},
mint: {
params: {
mint_denom: chain.evm_denom,
},
},
staking: {
params: {
bond_denom: chain.evm_denom,
unbonding_time: '10s',
},
},
bank: chain.bank {
denom_metadata+: [{
denom_units+: [
{
denom: 'atoken',
exponent: 0,
},
{
denom: 'token',
exponent: 18,
},
],
base: 'atoken',
display: 'token',
name: 'Test Coin',
symbol: 'ATOKEN',
}],
},
},
},
},
}
16 changes: 16 additions & 0 deletions tests/integration_tests/configs/enable-indexer.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
local config = import 'default.jsonnet';

config {
'evm-canary-net-1'+: {
config+: {
tx_index+: {
indexer: 'null',
},
},
'app-config'+: {
'json-rpc'+: {
'enable-indexer': true,
},
},
},
}
12 changes: 12 additions & 0 deletions tests/integration_tests/configs/exploit.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
local config = import 'default.jsonnet';

config {
'evm-canary-net-1'+: {
'app-config'+: {
'json-rpc'+: {
'batch-request-limit': 2,
'batch-response-max-size': 7188483, // memory_byte_size - 1
},
},
},
}
17 changes: 17 additions & 0 deletions tests/integration_tests/configs/fee-history.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
local config = import 'default.jsonnet';

config {
'evm-canary-net-1'+: {
genesis+: {
app_state+: {
feemarket+: {
params+: {
elasticity_multiplier: 3,
base_fee_change_denominator: 100000000,
min_gas_price: '0.000000000000000000', # TODO: remove after basefee fix
},
},
},
},
},
}
Loading
Loading