Skip to content

Commit

Permalink
test: fix integration test - comment test_priority.py
Browse files Browse the repository at this point in the history
  • Loading branch information
dudong2 committed Jan 2, 2024
1 parent d0facf3 commit 702808d
Showing 1 changed file with 35 additions and 34 deletions.
69 changes: 35 additions & 34 deletions tests/integration_tests/test_priority.py
Original file line number Diff line number Diff line change
@@ -1,44 +1,45 @@
import sys
# The priority mempool feature has been removed from comet bft.

Check failure on line 1 in tests/integration_tests/test_priority.py

View workflow job for this annotation

GitHub Actions / Run flake8 on python integration tests

./tests/integration_tests/test_priority.py:1:64: W291 trailing whitespace
# Tx priority features can be implemented using ABCI++'s app-side mempool.

Check failure on line 2 in tests/integration_tests/test_priority.py

View workflow job for this annotation

GitHub Actions / Run flake8 on python integration tests

./tests/integration_tests/test_priority.py:2:75: W291 trailing whitespace
# Therefore, we are removing the related tests. If tx priority features

Check failure on line 3 in tests/integration_tests/test_priority.py

View workflow job for this annotation

GitHub Actions / Run flake8 on python integration tests

./tests/integration_tests/test_priority.py:3:72: W291 trailing whitespace
# are implemented on the app-side in the future, the tests will need to be restored.

import pytest
# import sys

from .network import setup_ethermint
from .utils import ADDRS, KEYS, eth_to_bech32, sign_transaction, wait_for_new_blocks
# import pytest

PRIORITY_REDUCTION = 1000000
# from .network import setup_ethermint
# from .utils import ADDRS, KEYS, eth_to_bech32, sign_transaction, wait_for_new_blocks

# PRIORITY_REDUCTION = 1000000

@pytest.fixture(scope="module")
def custom_ethermint(tmp_path_factory):
path = tmp_path_factory.mktemp("priority")
yield from setup_ethermint(path, 26800, long_timeout_commit=True)

# @pytest.fixture(scope="module")
# def custom_ethermint(tmp_path_factory):
# path = tmp_path_factory.mktemp("priority")
# yield from setup_ethermint(path, 26800, long_timeout_commit=True)

def effective_gas_price(tx, base_fee):
if "maxFeePerGas" in tx:
# dynamic fee tx
return min(base_fee + tx["maxPriorityFeePerGas"], tx["maxFeePerGas"])
else:
# legacy tx
return tx["gasPrice"]

# def effective_gas_price(tx, base_fee):
# if "maxFeePerGas" in tx:
# # dynamic fee tx
# return min(base_fee + tx["maxPriorityFeePerGas"], tx["maxFeePerGas"])
# else:
# # legacy tx
# return tx["gasPrice"]


# def tx_priority(tx, base_fee):
# if "maxFeePerGas" in tx:
# # dynamic fee tx
# return (
# min(tx["maxPriorityFeePerGas"], tx["maxFeePerGas"] - base_fee)
# // PRIORITY_REDUCTION
# )
# else:
# # legacy tx
# return (tx["gasPrice"] - base_fee) // PRIORITY_REDUCTION

def tx_priority(tx, base_fee):
if "maxFeePerGas" in tx:
# dynamic fee tx
return (
min(tx["maxPriorityFeePerGas"], tx["maxFeePerGas"] - base_fee)
// PRIORITY_REDUCTION
)
else:
# legacy tx
return (tx["gasPrice"] - base_fee) // PRIORITY_REDUCTION

# The priority mempool feature has been removed from comet bft.
# Tx priority features can be implemented using ABCI++'s app-side mempool.
# Therefore, we are removing the related tests. If tx priority features
# are implemented on the app-side in the future, the tests will need to be restored.

# def test_priority(ethermint):
# """
# test priorities of different tx types
Expand Down Expand Up @@ -202,6 +203,6 @@ def tx_priority(tx, base_fee):
# ) for (b1, i1), (b2, i2) in zip(tx_indexes, tx_indexes[1:]))


def get_max_priority_price(max_priority_price):
"default to max int64 if None"
return max_priority_price if max_priority_price is not None else sys.maxsize
# def get_max_priority_price(max_priority_price):
# "default to max int64 if None"
# return max_priority_price if max_priority_price is not None else sys.maxsize

0 comments on commit 702808d

Please sign in to comment.