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
4 changes: 4 additions & 0 deletions .envrc.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
use flake
export VIRTUAL_ENV="tests/integration_tests/.venv"
layout python
TMPDIR=/tmp
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
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,9 @@ build/
tests/systemtests/binaries
tests/systemtests/testnet
.testnets

# Environments
*.env
/.envrc
.venv
/.direnv
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
43 changes: 43 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
lib,
stdenv,
buildGo125Module,
rev ? "dirty",
}:
buildGo125Module rec {
version = "v0.5.0";
pname = "evmd";
tags = [
"ledger"
"ledger_zemu"
"netgo" # pure go dns resolver
"osusergo" # pure go user/group lookup
"pebbledb"
];
ldflags = [
"-X github.com/cosmos/cosmos-sdk/version.Name=evmd"
"-X github.com/cosmos/cosmos-sdk/version.AppName=${pname}"
"-X github.com/cosmos/cosmos-sdk/version.Version=${version}"
"-X github.com/cosmos/cosmos-sdk/version.BuildTags=${lib.concatStringsSep "," tags}"
"-X github.com/cosmos/cosmos-sdk/version.Commit=${rev}"
];

src = lib.cleanSource ./.;
vendorHash = "sha256-+L4nKIKHV1bos9Trr50/kG69hR8iNL6MXLi9mun5iXQ=";
proxyVendor = true;
env = {
CGO_ENABLED = "1";
};

sourceRoot = "source/evmd";
subPackages = [ "cmd/evmd" ];

doCheck = false;
meta = with lib; {
description = "An EVM compatible framework for blockchain development with the Cosmos SDK";
homepage = "https://github.com/cosmos/evm";
license = licenses.asl20;
mainProgram = "evmd" + stdenv.hostPlatform.extensions.executable;
platforms = platforms.all;
};
}
145 changes: 145 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

55 changes: 55 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/release-25.05";
flake-utils.url = "github:numtide/flake-utils";
poetry2nix = {
url = "github:nix-community/poetry2nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
};

outputs =
{
self,
nixpkgs,
flake-utils,
poetry2nix,
}:
let
rev = self.shortRev or "dirty";
in
(flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs {
inherit system;
overlays = self.overlays.default;
config = { };
};
in
{
legacyPackages = pkgs;
packages.default = pkgs.evmd;
devShells = {
default = pkgs.mkShell {
buildInputs = [
pkgs.evmd.go
pkgs.nixfmt-rfc-style
pkgs.solc
pkgs.python312
pkgs.uv
];
};
};
}
))
// {
overlays.default = [
poetry2nix.overlays.default
(final: super: {
evmd = final.callPackage ./. { inherit rev; };
})
];
};
}
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)
],
},
}
Loading
Loading