diff --git a/integration_tests/conftest.py b/integration_tests/conftest.py index 5014d0ae20..6a0b68caf7 100644 --- a/integration_tests/conftest.py +++ b/integration_tests/conftest.py @@ -3,7 +3,6 @@ from pathlib import Path import pytest -from pytest_lazyfixture import lazy_fixture from .network import setup_cronos, setup_custom_cronos, setup_geth @@ -76,23 +75,19 @@ def geth(tmp_path_factory): yield from setup_geth(path, 8545) -@pytest.fixture(scope="session") -def cronos_ws(cronos): - cronos_ws = cronos.copy() - cronos_ws.use_websocket() - yield cronos_ws - - -@pytest.fixture( - scope="session", - params=[ - lazy_fixture("cronos"), - lazy_fixture("geth"), - lazy_fixture("cronos_ws"), - ], -) -def cluster(request): +@pytest.fixture(scope="session", params=["cronos", "geth", "cronos-ws"]) +def cluster(request, cronos, geth): """ run on both cronos and geth """ - yield request.param + provider = request.param + if provider == "cronos": + yield cronos + elif provider == "geth": + yield geth + elif provider == "cronos-ws": + cronos_ws = cronos.copy() + cronos_ws.use_websocket() + yield cronos_ws + else: + raise NotImplementedError diff --git a/integration_tests/poetry.lock b/integration_tests/poetry.lock index 4bff17b4a6..a6c1aee848 100644 --- a/integration_tests/poetry.lock +++ b/integration_tests/poetry.lock @@ -1,10 +1,9 @@ -# This file is automatically @generated by Poetry and should not be changed by hand. +# This file is automatically @generated by Poetry 1.6.1 and should not be changed by hand. [[package]] name = "aiohttp" version = "3.9.0" description = "Async http client/server framework (asyncio)" -category = "main" optional = false python-versions = ">=3.8" files = [ @@ -101,7 +100,6 @@ speedups = ["Brotli", "aiodns", "brotlicffi"] name = "aiosignal" version = "1.2.0" description = "aiosignal: a list of registered asynchronous callbacks" -category = "main" optional = false python-versions = ">=3.6" files = [ @@ -116,7 +114,6 @@ frozenlist = ">=1.1.0" name = "async-timeout" version = "4.0.2" description = "Timeout context manager for asyncio programs" -category = "main" optional = false python-versions = ">=3.6" files = [ @@ -128,7 +125,6 @@ files = [ name = "atomicwrites" version = "1.4.0" description = "Atomic file writes." -category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" files = [ @@ -140,7 +136,6 @@ files = [ name = "attrs" version = "21.4.0" description = "Classes Without Boilerplate" -category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" files = [ @@ -158,7 +153,6 @@ tests-no-zope = ["cloudpickle", "coverage[toml] (>=5.0.2)", "hypothesis", "mypy" name = "base58" version = "2.1.1" description = "Base58 and Base58Check implementation." -category = "main" optional = false python-versions = ">=3.5" files = [ @@ -173,7 +167,6 @@ tests = ["PyHamcrest (>=2.0.2)", "mypy", "pytest (>=4.6)", "pytest-benchmark", " name = "bech32" version = "1.2.0" description = "Reference implementation for Bech32 and segwit addresses." -category = "main" optional = false python-versions = ">=3.5" files = [ @@ -185,7 +178,6 @@ files = [ name = "bitarray" version = "2.6.0" description = "efficient arrays of booleans -- C extension" -category = "main" optional = false python-versions = "*" files = [ @@ -267,7 +259,6 @@ files = [ name = "black" version = "22.6.0" description = "The uncompromising code formatter." -category = "main" optional = false python-versions = ">=3.6.2" files = [ @@ -314,7 +305,6 @@ uvloop = ["uvloop (>=0.15.2)"] name = "certifi" version = "2023.7.22" description = "Python package for providing Mozilla's CA Bundle." -category = "main" optional = false python-versions = ">=3.6" files = [ @@ -326,7 +316,6 @@ files = [ name = "charset-normalizer" version = "2.0.12" description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet." -category = "main" optional = false python-versions = ">=3.5.0" files = [ @@ -341,7 +330,6 @@ unicode-backport = ["unicodedata2"] name = "click" version = "8.1.2" description = "Composable command line interface toolkit" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -356,7 +344,6 @@ colorama = {version = "*", markers = "platform_system == \"Windows\""} name = "colorama" version = "0.4.4" description = "Cross-platform colored terminal text." -category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" files = [ @@ -368,7 +355,6 @@ files = [ name = "cprotobuf" version = "0.1.11" description = "pythonic and high performance protocol buffer implementation." -category = "main" optional = false python-versions = "*" files = [ @@ -379,7 +365,6 @@ files = [ name = "cytoolz" version = "0.11.2" description = "Cython implementation of Toolz: High performance functional utilities" -category = "main" optional = false python-versions = ">=3.5" files = [ @@ -396,7 +381,6 @@ cython = ["cython"] name = "docker" version = "5.0.3" description = "A Python library for the Docker Engine API." -category = "main" optional = false python-versions = ">=3.6" files = [ @@ -417,7 +401,6 @@ tls = ["cryptography (>=3.4.7)", "idna (>=2.0.0)", "pyOpenSSL (>=17.5.0)"] name = "durations" version = "0.3.3" description = "UNKNOWN" -category = "main" optional = false python-versions = "*" files = [ @@ -428,7 +411,6 @@ files = [ name = "eth-abi" version = "3.0.1" description = "eth_abi: Python utilities for working with Ethereum ABI definitions, especially encoding and decoding" -category = "main" optional = false python-versions = ">=3.7, <4" files = [ @@ -452,7 +434,6 @@ tools = ["hypothesis (>=4.18.2,<5.0.0)"] name = "eth-account" version = "0.7.0" description = "eth-account: Sign Ethereum transactions and messages with local private keys" -category = "main" optional = false python-versions = ">=3.6, <4" files = [ @@ -480,7 +461,6 @@ test = ["hypothesis (>=4.18.0,<5)", "pytest (>=6.2.5,<7)", "pytest-xdist", "tox name = "eth-bloom" version = "1.0.4" description = "Python implementation of the Ethereum Trie structure" -category = "main" optional = false python-versions = ">=3.6, <4" files = [ @@ -501,7 +481,6 @@ test = ["hypothesis (==3.7.0)", "pytest (==3.0.7)", "tox (==2.6.0)"] name = "eth-hash" version = "0.3.2" description = "eth-hash: The Ethereum hashing function, keccak256, sometimes (erroneously) called sha3" -category = "main" optional = false python-versions = ">=3.5, <4" files = [ @@ -524,7 +503,6 @@ test = ["pytest (==5.4.1)", "pytest-xdist", "tox (==3.14.6)"] name = "eth-keyfile" version = "0.6.0" description = "A library for handling the encrypted keyfiles used to store ethereum private keys." -category = "main" optional = false python-versions = "*" files = [ @@ -547,7 +525,6 @@ test = ["pytest (>=6.2.5,<7)"] name = "eth-keys" version = "0.4.0" description = "Common API for Ethereum key operations." -category = "main" optional = false python-versions = "*" files = [ @@ -570,7 +547,6 @@ test = ["asn1tools (>=0.146.2,<0.147)", "eth-hash[pycryptodome]", "eth-hash[pysh name = "eth-rlp" version = "0.3.0" description = "eth-rlp: RLP definitions for common Ethereum objects in Python" -category = "main" optional = false python-versions = ">=3.7, <4" files = [ @@ -593,7 +569,6 @@ test = ["eth-hash[pycryptodome]", "pytest (>=6.2.5,<7)", "pytest-xdist", "tox (= name = "eth-typing" version = "3.2.0" description = "eth-typing: Common type annotations for ethereum python packages" -category = "main" optional = false python-versions = ">=3.6, <4" files = [ @@ -611,7 +586,6 @@ test = ["pytest (>=6.2.5,<7)", "pytest-xdist", "tox (>=2.9.1,<3)"] name = "eth-utils" version = "2.0.0" description = "eth-utils: Common utility functions for python code that interacts with Ethereum" -category = "main" optional = false python-versions = ">=3.6,<4" files = [ @@ -635,7 +609,6 @@ test = ["hypothesis (>=4.43.0,<5.0.0)", "pytest (>=6.2.5,<7)", "pytest-xdist", " name = "fire" version = "0.4.0" description = "A library for automatically generating command line interfaces." -category = "main" optional = false python-versions = "*" files = [ @@ -650,7 +623,6 @@ termcolor = "*" name = "flake8" version = "4.0.1" description = "the modular source code checker: pep8 pyflakes and co" -category = "main" optional = false python-versions = ">=3.6" files = [ @@ -667,7 +639,6 @@ pyflakes = ">=2.4.0,<2.5.0" name = "flake8-black" version = "0.3.2" description = "flake8 plugin to call black as a code style validator" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -684,7 +655,6 @@ tomli = "*" name = "flake8-isort" version = "4.1.1" description = "flake8 plugin that integrates isort ." -category = "main" optional = false python-versions = "*" files = [ @@ -704,7 +674,6 @@ test = ["pytest-cov"] name = "flake8-polyfill" version = "1.0.2" description = "Polyfill package for Flake8 plugins" -category = "main" optional = false python-versions = "*" files = [ @@ -719,7 +688,6 @@ flake8 = "*" name = "flaky" version = "3.7.0" description = "Plugin for nose or pytest that automatically reruns flaky tests." -category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" files = [ @@ -731,7 +699,6 @@ files = [ name = "frozenlist" version = "1.3.0" description = "A list-like structure which implements collections.abc.MutableSequence" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -800,7 +767,6 @@ files = [ name = "grpcio" version = "1.53.0" description = "HTTP/2-based RPC framework" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -858,7 +824,6 @@ protobuf = ["grpcio-tools (>=1.53.0)"] name = "hexbytes" version = "0.2.2" description = "hexbytes: Python `bytes` subclass that decodes hex, with a readable console output" -category = "main" optional = false python-versions = ">=3.6, <4" files = [ @@ -876,7 +841,6 @@ test = ["eth-utils (>=1.0.1,<2)", "hypothesis (>=3.44.24,<4)", "pytest (==5.4.1) name = "idna" version = "3.3" description = "Internationalized Domain Names in Applications (IDNA)" -category = "main" optional = false python-versions = ">=3.5" files = [ @@ -888,7 +852,6 @@ files = [ name = "importlib-resources" version = "5.7.1" description = "Read resources from Python packages" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -907,7 +870,6 @@ testing = ["pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", name = "iniconfig" version = "1.1.1" description = "iniconfig: brain-dead simple config-ini parsing" -category = "main" optional = false python-versions = "*" files = [ @@ -919,7 +881,6 @@ files = [ name = "ipfshttpclient" version = "0.8.0a2" description = "Python IPFS HTTP CLIENT library" -category = "main" optional = false python-versions = ">=3.6.2,!=3.7.0,!=3.7.1" files = [ @@ -935,7 +896,6 @@ requests = ">=2.11" name = "isort" version = "5.10.1" description = "A Python utility / library to sort Python imports." -category = "main" optional = false python-versions = ">=3.6.1,<4.0" files = [ @@ -953,7 +913,6 @@ requirements-deprecated-finder = ["pip-api", "pipreqs"] name = "jsonmerge" version = "1.8.0" description = "Merge a series of JSON documents." -category = "main" optional = false python-versions = "*" files = [ @@ -967,7 +926,6 @@ jsonschema = "*" name = "jsonnet" version = "0.18.0" description = "Python bindings for Jsonnet - The data templating language" -category = "main" optional = false python-versions = "*" files = [ @@ -978,7 +936,6 @@ files = [ name = "jsonschema" version = "4.4.0" description = "An implementation of JSON Schema validation for Python" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -999,7 +956,6 @@ format-nongpl = ["fqdn", "idna", "isoduration", "jsonpointer (>1.13)", "rfc3339- name = "lru-dict" version = "1.1.7" description = "An Dict like LRU container." -category = "main" optional = false python-versions = "*" files = [ @@ -1010,7 +966,6 @@ files = [ name = "mccabe" version = "0.6.1" description = "McCabe checker, plugin for flake8" -category = "main" optional = false python-versions = "*" files = [ @@ -1022,7 +977,6 @@ files = [ name = "multiaddr" version = "0.0.9" description = "Python implementation of jbenet's multiaddr" -category = "main" optional = false python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*" files = [ @@ -1040,7 +994,6 @@ varint = "*" name = "multidict" version = "6.0.2" description = "multidict implementation" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -1109,7 +1062,6 @@ files = [ name = "multitail2" version = "1.5.2" description = "Enables following multiple files for new lines at once, automatically handling file creation/deletion/rotation" -category = "main" optional = false python-versions = "*" files = [ @@ -1123,7 +1075,6 @@ six = "*" name = "mypy-extensions" version = "0.4.3" description = "Experimental type system extensions for programs checked with the mypy typechecker." -category = "main" optional = false python-versions = "*" files = [ @@ -1135,7 +1086,6 @@ files = [ name = "netaddr" version = "0.8.0" description = "A network address manipulation library for Python" -category = "main" optional = false python-versions = "*" files = [ @@ -1147,7 +1097,6 @@ files = [ name = "packaging" version = "21.3" description = "Core utilities for Python packages" -category = "main" optional = false python-versions = ">=3.6" files = [ @@ -1162,7 +1111,6 @@ pyparsing = ">=2.0.2,<3.0.5 || >3.0.5" name = "parsimonious" version = "0.8.1" description = "(Soon to be) the fastest pure-Python PEG parser I could muster" -category = "main" optional = false python-versions = "*" files = [ @@ -1176,7 +1124,6 @@ six = ">=1.9.0" name = "pathspec" version = "0.10.1" description = "Utility library for gitignore style pattern matching of file paths." -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -1188,7 +1135,6 @@ files = [ name = "pep8-naming" version = "0.11.1" description = "Check PEP-8 naming conventions, plugin for flake8" -category = "main" optional = false python-versions = "*" files = [ @@ -1203,7 +1149,6 @@ flake8-polyfill = ">=1.0.2,<2" name = "platformdirs" version = "2.5.2" description = "A small Python module for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -1219,7 +1164,6 @@ test = ["appdirs (==1.4.4)", "pytest (>=6)", "pytest-cov (>=2.7)", "pytest-mock name = "pluggy" version = "1.0.0" description = "plugin and hook calling mechanisms for python" -category = "main" optional = false python-versions = ">=3.6" files = [ @@ -1235,7 +1179,6 @@ testing = ["pytest", "pytest-benchmark"] name = "protobuf" version = "3.20.1" description = "Protocol Buffers" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -1269,7 +1212,6 @@ files = [ name = "py" version = "1.11.0" description = "library with cross-python path, ini-parsing, io, code, log facilities" -category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" files = [ @@ -1281,7 +1223,6 @@ files = [ name = "pycodestyle" version = "2.8.0" description = "Python style guide checker" -category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" files = [ @@ -1293,7 +1234,6 @@ files = [ name = "pycryptodome" version = "3.14.1" description = "Cryptographic library for Python" -category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" files = [ @@ -1333,7 +1273,6 @@ files = [ name = "pyflakes" version = "2.4.0" description = "passive checker of Python programs" -category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" files = [ @@ -1345,7 +1284,6 @@ files = [ name = "pyparsing" version = "3.0.8" description = "pyparsing module - Classes and methods to define and execute parsing grammars" -category = "main" optional = false python-versions = ">=3.6.8" files = [ @@ -1360,7 +1298,6 @@ diagrams = ["jinja2", "railroad-diagrams"] name = "pyrsistent" version = "0.18.1" description = "Persistent/Functional/Immutable data structures" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -1391,7 +1328,6 @@ files = [ name = "pysha3" version = "1.0.2" description = "SHA-3 (Keccak) for Python 2.7 - 3.5" -category = "main" optional = false python-versions = "*" files = [ @@ -1422,7 +1358,6 @@ files = [ name = "pystarport" version = "0.2.5" description = "Spawn local devnets for cosmos-sdk chains" -category = "main" optional = false python-versions = "^3.8" files = [] @@ -1453,7 +1388,6 @@ resolved_reference = "39ecbd29fcdd50cb3015524c13755fda05bdf23d" name = "pytest" version = "7.1.1" description = "pytest: simple powerful testing with Python" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -1478,7 +1412,6 @@ testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2. name = "pytest-github-actions-annotate-failures" version = "0.1.6" description = "pytest plugin to annotate failed tests with a workflow command for GitHub Actions" -category = "main" optional = false python-versions = "*" files = [ @@ -1489,26 +1422,10 @@ files = [ [package.dependencies] pytest = ">=4.0.0" -[[package]] -name = "pytest-lazy-fixture" -version = "0.6.3" -description = "It helps to use fixtures in pytest.mark.parametrize" -category = "main" -optional = false -python-versions = "*" -files = [ - {file = "pytest-lazy-fixture-0.6.3.tar.gz", hash = "sha256:0e7d0c7f74ba33e6e80905e9bfd81f9d15ef9a790de97993e34213deb5ad10ac"}, - {file = "pytest_lazy_fixture-0.6.3-py3-none-any.whl", hash = "sha256:e0b379f38299ff27a653f03eaa69b08a6fd4484e46fd1c9907d984b9f9daeda6"}, -] - -[package.dependencies] -pytest = ">=3.2.5" - [[package]] name = "python-dateutil" version = "2.8.2" description = "Extensions to the standard Python datetime module" -category = "main" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7" files = [ @@ -1523,7 +1440,6 @@ six = ">=1.5" name = "python-dotenv" version = "0.19.2" description = "Read key-value pairs from a .env file and set them as environment variables" -category = "main" optional = false python-versions = ">=3.5" files = [ @@ -1538,7 +1454,6 @@ cli = ["click (>=5.0)"] name = "pywin32" version = "227" description = "Python for Window Extensions" -category = "main" optional = false python-versions = "*" files = [ @@ -1560,7 +1475,6 @@ files = [ name = "pyyaml" version = "6.0.1" description = "YAML parser and emitter for Python" -category = "main" optional = false python-versions = ">=3.6" files = [ @@ -1620,7 +1534,6 @@ files = [ name = "pyyaml-include" version = "1.3" description = "Extending PyYAML with a custom constructor for including YAML files within YAML files" -category = "main" optional = false python-versions = ">=3.5" files = [ @@ -1639,7 +1552,6 @@ toml = ["toml"] name = "requests" version = "2.31.0" description = "Python HTTP for Humans." -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -1661,7 +1573,6 @@ use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"] name = "rlp" version = "3.0.0" description = "A package for Recursive Length Prefix encoding and decoding" -category = "main" optional = false python-versions = "*" files = [ @@ -1683,7 +1594,6 @@ test = ["hypothesis (==5.19.0)", "pytest (>=6.2.5,<7)", "tox (>=2.9.1,<3)"] name = "setuptools" version = "65.5.1" description = "Easily download, build, install, upgrade, and uninstall Python packages" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -1700,7 +1610,6 @@ testing-integration = ["build[virtualenv]", "filelock (>=3.4.0)", "jaraco.envs ( name = "six" version = "1.16.0" description = "Python 2 and 3 compatibility utilities" -category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" files = [ @@ -1712,7 +1621,6 @@ files = [ name = "supervisor" version = "4.2.4" description = "A system for controlling process state under UNIX" -category = "main" optional = false python-versions = "*" files = [ @@ -1730,7 +1638,6 @@ testing = ["pytest", "pytest-cov"] name = "termcolor" version = "1.1.0" description = "ANSII Color formatting for output in terminal." -category = "main" optional = false python-versions = "*" files = [ @@ -1741,7 +1648,6 @@ files = [ name = "testfixtures" version = "6.18.5" description = "A collection of helpers and mock objects for unit tests and doc tests." -category = "main" optional = false python-versions = "*" files = [ @@ -1758,7 +1664,6 @@ test = ["django", "django (<2)", "mock", "pytest (>=3.6)", "pytest-cov", "pytest name = "toml" version = "0.10.2" description = "Python Library for Tom's Obvious, Minimal Language" -category = "main" optional = false python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" files = [ @@ -1770,7 +1675,6 @@ files = [ name = "tomli" version = "2.0.1" description = "A lil' TOML parser" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -1782,7 +1686,6 @@ files = [ name = "tomlkit" version = "0.7.2" description = "Style preserving TOML library" -category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" files = [ @@ -1794,7 +1697,6 @@ files = [ name = "toolz" version = "0.11.2" description = "List processing tools and functional utilities" -category = "main" optional = false python-versions = ">=3.5" files = [ @@ -1806,7 +1708,6 @@ files = [ name = "typing-extensions" version = "4.2.0" description = "Backported and Experimental Type Hints for Python 3.7+" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -1818,7 +1719,6 @@ files = [ name = "urllib3" version = "1.26.18" description = "HTTP library with thread-safe connection pooling, file post, and more." -category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*" files = [ @@ -1835,7 +1735,6 @@ socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"] name = "varint" version = "1.0.2" description = "Simple python varint implementation" -category = "main" optional = false python-versions = "*" files = [ @@ -1846,7 +1745,6 @@ files = [ name = "web3" version = "6.0.0b6" description = "Web3.py" -category = "main" optional = false python-versions = ">=3.7.2" files = [ @@ -1880,7 +1778,6 @@ tester = ["eth-tester[py-evm] (==v0.7.0-beta.1)", "py-geth (>=3.9.1,<4)"] name = "websocket-client" version = "1.3.2" description = "WebSocket client for Python with low level API options" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -1897,7 +1794,6 @@ test = ["websockets"] name = "websockets" version = "10.3" description = "An implementation of the WebSocket Protocol (RFC 6455 & 7692)" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -1955,7 +1851,6 @@ files = [ name = "yarl" version = "1.7.2" description = "Yet another URL library" -category = "main" optional = false python-versions = ">=3.6" files = [ @@ -2041,7 +1936,6 @@ multidict = ">=4.0" name = "zipp" version = "3.8.0" description = "Backport of pathlib-compatible object wrapper for zip files" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -2056,4 +1950,4 @@ testing = ["func-timeout", "jaraco.itertools", "pytest (>=6)", "pytest-black (>= [metadata] lock-version = "2.0" python-versions = "^3.8" -content-hash = "9f0a6db31616e9bad08d09e2a63270140e551165d8e9c186fb073712b8082a7d" +content-hash = "18d622c6ef865cb4666dda7f262d9ff4a23fbcbf2d4d50eac76660f3b5a3c179" diff --git a/integration_tests/pyproject.toml b/integration_tests/pyproject.toml index 241ff0ef5d..eaa361bcd9 100644 --- a/integration_tests/pyproject.toml +++ b/integration_tests/pyproject.toml @@ -29,7 +29,6 @@ eth-account = "^0.7.0" cprotobuf = "^0.1.11" pathspec = "^0.10.1" flaky = "^3.7.0" -pytest-lazy-fixture = "^0.6.3" [tool.poetry.dev-dependencies] diff --git a/integration_tests/test_eip1559.py b/integration_tests/test_eip1559.py index df8077c7a9..93ecf0e10c 100644 --- a/integration_tests/test_eip1559.py +++ b/integration_tests/test_eip1559.py @@ -1,70 +1,27 @@ -from pathlib import Path - -import pytest -from pytest_lazyfixture import lazy_fixture - -from .network import setup_custom_cronos from .utils import ADDRS, KEYS, send_transaction, w3_wait_for_block -pytestmark = pytest.mark.slow - - -@pytest.fixture(scope="module") -def custom_cronos(tmp_path_factory): - path = tmp_path_factory.mktemp("min-gas-price") - yield from setup_custom_cronos( - path, 26500, Path(__file__).parent / "configs/min_gas_price.jsonnet" - ) - -@pytest.fixture( - scope="module", - params=[ - lazy_fixture("cronos"), - lazy_fixture("geth"), - lazy_fixture("cronos_ws"), - lazy_fixture("custom_cronos"), - ], -) -def custom_cluster(request): - yield request.param - - -def adjust_base_fee(parent_fee, gas_limit, gas_used, params): +def adjust_base_fee(parent_fee, gas_limit, gas_used): "spec: https://eips.ethereum.org/EIPS/eip-1559#specification" - change_denominator = params["base_fee_change_denominator"] - elasticity_multiplier = params["elasticity_multiplier"] + change_denominator = 8 + elasticity_multiplier = 2 gas_target = gas_limit // elasticity_multiplier delta = parent_fee * (gas_target - gas_used) // gas_target // change_denominator - # https://github.com/crypto-org-chain/ethermint/blob/develop/x/feemarket/keeper/eip1559.go#L104 - return max(parent_fee - delta, params["min_gas_price"]) - + return parent_fee - delta -def get_params(cli): - if cli is None: - return { - "base_fee_change_denominator": 8, - "elasticity_multiplier": 2, - "min_gas_price": 0, - } - params = cli.query_params("feemarket")["params"] - return {k: int(float(v)) for k, v in params.items()} - -def test_dynamic_fee_tx(custom_cluster, custom_cronos, geth): +def test_dynamic_fee_tx(cluster): """ test basic eip-1559 tx works: - tx fee calculation is compliant to go-ethereum - base fee adjustment is compliant to go-ethereum """ - w3 = custom_cluster.w3 + w3 = cluster.w3 amount = 10000 before = w3.eth.get_balance(ADDRS["community"]) tip_price = 1 max_price = 1000000000000 + tip_price - if custom_cluster == custom_cronos: - max_price = 10000000000000 + tip_price tx = { "to": "0x0000000000000000000000000000000000000000", "value": amount, @@ -86,39 +43,36 @@ def test_dynamic_fee_tx(custom_cluster, custom_cronos, geth): # check the next block's base fee is adjusted accordingly w3_wait_for_block(w3, txreceipt.blockNumber + 1) - fee = w3.eth.get_block(txreceipt.blockNumber + 1).baseFeePerGas - cli = None if custom_cluster == geth else custom_cluster.cosmos_cli() - params = get_params(cli) - assert fee == adjust_base_fee( - blk.baseFeePerGas, blk.gasLimit, blk.gasUsed, params - ), fee + next_base_price = w3.eth.get_block(txreceipt.blockNumber + 1).baseFeePerGas + + assert next_base_price == adjust_base_fee( + blk.baseFeePerGas, blk.gasLimit, blk.gasUsed + ) -def test_base_fee_adjustment(custom_cluster, geth): +def test_base_fee_adjustment(cluster): """ verify base fee adjustment of three continuous empty blocks """ - w3 = custom_cluster.w3 + w3 = cluster.w3 begin = w3.eth.block_number w3_wait_for_block(w3, begin + 3) blk = w3.eth.get_block(begin) parent_fee = blk.baseFeePerGas - cli = None if custom_cluster == geth else custom_cluster.cosmos_cli() - params = get_params(cli) for i in range(3): fee = w3.eth.get_block(begin + 1 + i).baseFeePerGas - assert fee == adjust_base_fee(parent_fee, blk.gasLimit, 0, params) + assert fee == adjust_base_fee(parent_fee, blk.gasLimit, 0) parent_fee = fee -def test_recommended_fee_per_gas(custom_cluster): +def test_recommended_fee_per_gas(cluster): """The recommended base fee per gas returned by eth_gasPrice is base fee of the block just produced + eth_maxPriorityFeePerGas (the buffer).\n Verify the calculation of recommended base fee per gas (eth_gasPrice) """ - w3 = custom_cluster.w3 + w3 = cluster.w3 recommended_base_fee_per_gas = w3.eth.gas_price latest_block = w3.eth.get_block("latest") @@ -131,14 +85,12 @@ def test_recommended_fee_per_gas(custom_cluster): ) -def test_current_fee_per_gas_should_not_be_smaller_than_next_block_base_fee( - custom_cluster, -): +def test_current_fee_per_gas_should_not_be_smaller_than_next_block_base_fee(cluster): """The recommended base fee per gas returned by eth_gasPrice should be bigger than or equal to the base fee per gas of the next block, \n otherwise the tx does not meet the requirement to be included in the next block.\n """ - w3 = custom_cluster.w3 + w3 = cluster.w3 base_block = w3.eth.block_number recommended_base_fee = w3.eth.gas_price diff --git a/integration_tests/test_min_gas_price.py b/integration_tests/test_min_gas_price.py new file mode 100644 index 0000000000..10d4dea604 --- /dev/null +++ b/integration_tests/test_min_gas_price.py @@ -0,0 +1,82 @@ +from pathlib import Path + +import pytest + +from .network import setup_custom_cronos +from .utils import ADDRS, KEYS, send_transaction, w3_wait_for_block + + +@pytest.fixture(scope="module") +def custom_cronos(tmp_path_factory): + path = tmp_path_factory.mktemp("min-gas-price") + yield from setup_custom_cronos( + path, 26500, Path(__file__).parent / "configs/min_gas_price.jsonnet" + ) + + +def adjust_base_fee(parent_fee, gas_limit, gas_used, params): + "spec: https://eips.ethereum.org/EIPS/eip-1559#specification" + change_denominator = params["base_fee_change_denominator"] + elasticity_multiplier = params["elasticity_multiplier"] + gas_target = gas_limit // elasticity_multiplier + + delta = parent_fee * (gas_target - gas_used) // gas_target // change_denominator + # https://github.com/crypto-org-chain/ethermint/blob/develop/x/feemarket/keeper/eip1559.go#L104 + return max(parent_fee - delta, params["min_gas_price"]) + + +def get_params(cli): + params = cli.query_params("feemarket")["params"] + return {k: int(float(v)) for k, v in params.items()} + + +def test_dynamic_fee_tx(custom_cronos): + w3 = custom_cronos.w3 + amount = 10000 + before = w3.eth.get_balance(ADDRS["community"]) + tip_price = 1 + max_price = 10000000000000 + tip_price + tx = { + "to": "0x0000000000000000000000000000000000000000", + "value": amount, + "gas": 21000, + "maxFeePerGas": max_price, + "maxPriorityFeePerGas": tip_price, + } + txreceipt = send_transaction(w3, tx, KEYS["community"]) + assert txreceipt.status == 1 + blk = w3.eth.get_block(txreceipt.blockNumber) + assert txreceipt.effectiveGasPrice == blk.baseFeePerGas + tip_price + + fee_expected = txreceipt.gasUsed * txreceipt.effectiveGasPrice + after = w3.eth.get_balance(ADDRS["community"]) + fee_deducted = before - after - amount + assert fee_deducted == fee_expected + + assert blk.gasUsed == txreceipt.gasUsed # we are the only tx in the block + + # check the next block's base fee is adjusted accordingly + w3_wait_for_block(w3, txreceipt.blockNumber + 1) + fee = w3.eth.get_block(txreceipt.blockNumber + 1).baseFeePerGas + params = get_params(custom_cronos.cosmos_cli()) + assert fee == adjust_base_fee( + blk.baseFeePerGas, blk.gasLimit, blk.gasUsed, params + ), fee + + +def test_base_fee_adjustment(custom_cronos): + """ + verify base fee adjustment of three continuous empty blocks + """ + w3 = custom_cronos.w3 + begin = w3.eth.block_number + w3_wait_for_block(w3, begin + 3) + + blk = w3.eth.get_block(begin) + parent_fee = blk.baseFeePerGas + params = get_params(custom_cronos.cosmos_cli()) + + for i in range(3): + fee = w3.eth.get_block(begin + 1 + i).baseFeePerGas + assert fee == adjust_base_fee(parent_fee, blk.gasLimit, 0, params) + parent_fee = fee