Skip to content

Commit

Permalink
Merge pull request #179 from tellor-io/undo-revert
Browse files Browse the repository at this point in the history
Undo revert
  • Loading branch information
0xSpuddy authored Oct 1, 2024
2 parents 94f589b + e197277 commit 9bf9031
Show file tree
Hide file tree
Showing 21 changed files with 109 additions and 95 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/py39.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
strategy:
matrix:
python-version: ["3.9"]
poetry-version: ["1.3.1"]
poetry-version: ["1.8.3"]

steps:
- uses: "actions/checkout@v2"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

jobs:
build:
runs-on: ubuntu-latest
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v2
- name: Build and publish to pypi
Expand All @@ -20,10 +20,10 @@ jobs:
repository_name: "testpypi"
repository_url: "https://test.pypi.org/legacy/"
python_version: "3.9.5"
pypi_token: ${{ secrets.TELLOR_DISPUTABES_TEST_PYPI_API_TOKEN }}
pypi_token: ${{ secrets.DISPUTABLE_VALUES_MONITOR_TEST_PYPI_API_TOKEN }}
- name: Build and publish to pypi
if: "!github.event.release.prerelease"
uses: JRubics/[email protected]
with:
python_version: "3.9.5"
pypi_token: ${{ secrets.TELLOR_DISPUTABES_PYPI_API_TOKEN }}
pypi_token: ${{ secrets.DISPUTABLE_VALUES_MONITOR_PYPI_API_TOKEN }}
6 changes: 3 additions & 3 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ name: style

on:
push:
branches: ["dvm-main", "auto-disputer-main", "main"]
branches: ["main"]
pull_request:
branches: ["dvm-main", "auto-disputer-main", "main"]
branches: ["main"]
workflow_dispatch:

jobs:
Expand All @@ -16,7 +16,7 @@ jobs:
strategy:
matrix:
python-version: ["3.9"]
poetry-version: ["1.3.1"]
poetry-version: ["1.8.3"]

steps:
- uses: "actions/checkout@v2"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/typing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
matrix:
python-version: ["3.9"]
poetry-version: ["1.3.1"]
poetry-version: ["1.8.3"]

steps:
- uses: "actions/checkout@v2"
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Auto-disputer
A CLI dashboard & text alerts app for disputing bad values reported to Tellor oracles.
A CLI dashboard & alerts app for monitoring and disputing bad values reported to Tellor oracles.

![](demo.gif)

Expand Down Expand Up @@ -44,6 +44,7 @@ pip install poetry && poetry install
mv venv/lib/python3.9/site-packages/vars.example.sh vars.sh
```
- Edit `vars.sh` with your favorite text editor replacing the dummy url with the url for your Discord bot's webhook.
- Set `MONITOR_NAME` with a memorable name for your DVM process.
- Export environment variables:
```bash
source vars.sh
Expand Down Expand Up @@ -203,11 +204,11 @@ poetry export -f requirements.txt --output requirements.txt --without-hashes
7. Check the box for This is a pre-release.
8. Click Publish release.
9. Navigate to the Actions tab from the main page of the package on github and make sure the release workflow completes successfully.
10. Check to make sure the new version was released to test PyPI [here](https://test.pypi.org/project/tellor-disputables/).
10. Check to make sure the new version was released to test PyPI [here](https://test.pypi.org/project/disputable-values-monitor/).
11. Test downloading and using the new version of the package from test PyPI ([example](https://stackoverflow.com/questions/34514703/pip-install-from-pypi-works-but-from-testpypi-fails-cannot-find-requirements)).
12. Navigate back to the pre-release you just made and click edit (the pencil icon).
13. Uncheck the This is a pre-release box.
14. Publish the release.
15. Make sure the release github action goes through.
16. Download and test the new release on PyPI official [here](https://pypi.org/project/tellor-disputables/).
16. Download and test the new release on PyPI official [here](https://pypi.org/project/disputable-values-monitor/).
17. Change the package version in **pyproject.toml** to be the next development version. For example, if you just released version 0.0.5, change **version** to be "0.0.6dev0".
12 changes: 6 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[tool.poetry]
name = "tellor-disputables"
name = "Disputable Values Monitor"
version = "2.0.1"
description = "dashboard & text alerts for disputable values reported to Tellor oracles"
authors = ["tallywiesenberg <[email protected]>"]
description = "dashboard & alerts for disputable values reported to Tellor oracles"
authors = ["Tellor Development Community"]
license = "MIT"
packages = [{ include = "tellor_disputables", from = "src" }]
packages = [{ include = "disputable_values_monitor", from = "src" }]
include = ["vars.example.sh", "README.md", "disputer-config.yaml"]

[tool.poetry.dependencies]
Expand Down Expand Up @@ -36,8 +36,8 @@ requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.scripts]
cli = "tellor_disputables.cli:main"
data = "tellor_disputables.data:main"
cli = "disputable_values_monitor.cli:main"
data = "disputable_values_monitor.data:main"

[tool.pytest.ini_options]
pythonpath = ["src"]
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Tellor Disputables - CLI dashboard & alerts for potential
"""Disputable Values Monitor - CLI dashboard & alerts for potential
bad values reported to Tellor oracles."""
from hexbytes import HexBytes
from web3.datastructures import AttributeDict
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@
from telliot_core.apps.telliot_config import TelliotConfig
from telliot_core.cli.utils import async_run

from tellor_disputables import WAIT_PERIOD
from tellor_disputables.config import AutoDisputerConfig
from tellor_disputables.data import chain_events
from tellor_disputables.data import get_events
from tellor_disputables.data import parse_new_report_event
from tellor_disputables.discord import alert
from tellor_disputables.discord import dispute_alert
from tellor_disputables.discord import generic_alert
from tellor_disputables.discord import get_alert_bot_1
from tellor_disputables.disputer import dispute
from tellor_disputables.utils import clear_console
from tellor_disputables.utils import format_values
from tellor_disputables.utils import get_logger
from tellor_disputables.utils import get_tx_explorer_url
from tellor_disputables.utils import select_account
from tellor_disputables.utils import Topics
from disputable_values_monitor import WAIT_PERIOD
from disputable_values_monitor.config import AutoDisputerConfig
from disputable_values_monitor.data import chain_events
from disputable_values_monitor.data import get_events
from disputable_values_monitor.data import parse_new_report_event
from disputable_values_monitor.discord import alert
from disputable_values_monitor.discord import dispute_alert
from disputable_values_monitor.discord import generic_alert
from disputable_values_monitor.discord import get_alert_bot_1
from disputable_values_monitor.disputer import dispute
from disputable_values_monitor.utils import clear_console
from disputable_values_monitor.utils import format_values
from disputable_values_monitor.utils import get_logger
from disputable_values_monitor.utils import get_tx_explorer_url
from disputable_values_monitor.utils import select_account
from disputable_values_monitor.utils import Topics

warnings.simplefilter("ignore", UserWarning)
price_aggregator_logger = logging.getLogger("telliot_feeds.sources.price_aggregator")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
from telliot_feeds.feeds import DATAFEED_BUILDER_MAPPING
from telliot_feeds.queries.query_catalog import query_catalog

from tellor_disputables.data import Metrics
from tellor_disputables.data import MonitoredFeed
from tellor_disputables.data import Threshold
from tellor_disputables.utils import get_logger
from disputable_values_monitor.data import Metrics
from disputable_values_monitor.data import MonitoredFeed
from disputable_values_monitor.data import Threshold
from disputable_values_monitor.utils import get_logger

logger = get_logger(__name__)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@
from web3.middleware import geth_poa_middleware
from web3.types import LogReceipt

from tellor_disputables import ALWAYS_ALERT_QUERY_TYPES
from tellor_disputables import NEW_REPORT_ABI
from tellor_disputables.discord import send_discord_msg
from tellor_disputables.utils import are_all_attributes_none
from tellor_disputables.utils import disputable_str
from tellor_disputables.utils import get_logger
from tellor_disputables.utils import get_tx_explorer_url
from tellor_disputables.utils import NewReport
from disputable_values_monitor import ALWAYS_ALERT_QUERY_TYPES
from disputable_values_monitor import NEW_REPORT_ABI
from disputable_values_monitor.discord import send_discord_msg
from disputable_values_monitor.utils import are_all_attributes_none
from disputable_values_monitor.utils import disputable_str
from disputable_values_monitor.utils import get_logger
from disputable_values_monitor.utils import get_tx_explorer_url
from disputable_values_monitor.utils import NewReport

logger = get_logger(__name__)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import click
from discordwebhook import Discord

from tellor_disputables import ALWAYS_ALERT_QUERY_TYPES
from disputable_values_monitor import ALWAYS_ALERT_QUERY_TYPES


def generic_alert(msg: str) -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
from web3 import Web3
from web3.exceptions import ContractLogicError

from tellor_disputables.config import AutoDisputerConfig
from tellor_disputables.data import get_contract
from tellor_disputables.utils import get_logger
from tellor_disputables.utils import NewReport
from disputable_values_monitor.config import AutoDisputerConfig
from disputable_values_monitor.data import get_contract
from disputable_values_monitor.utils import get_logger
from disputable_values_monitor.utils import NewReport

logger = get_logger(__name__)

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"""Unit tests for Tellor Disputables package."""
"""Unit tests for the Disputable Values Monitor package."""
21 changes: 12 additions & 9 deletions tests/test_auto_dispute_multiple_ids.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
from telliot_feeds.queries.price.spot_price import SpotPrice
from web3 import Web3

from tellor_disputables import data
from tellor_disputables.cli import start
from disputable_values_monitor import data
from disputable_values_monitor.cli import start

# during testing there aren't that many blocks so setting offset to 0
data.inital_block_offset = 0
Expand Down Expand Up @@ -58,6 +58,7 @@ def custom_open_side_effect(*args, **kwargs):


def increase_time_and_mine_blocks(w3: Web3, seconds: int, num_blocks: Optional[int] = None):
"""advances time as needed for tests"""
# Increase time
w3.provider.make_request("evm_increaseTime", [seconds])

Expand Down Expand Up @@ -94,6 +95,7 @@ async def environment_setup(setup: TelliotConfig, disputer_account: ChainedAccou

@pytest.fixture(scope="function")
async def stake_deposited(environment_setup: TelliotCore):
"""tests depositing stakes for reporting"""
core = await environment_setup
contracts = core.get_tellor360_contracts()
w3 = core.endpoint._web3
Expand All @@ -116,6 +118,7 @@ async def stake_deposited(environment_setup: TelliotCore):

@pytest.fixture(scope="function")
async def submit_multiple_bad_values(stake_deposited: Awaitable[TelliotCore]):
"""tests submission of multiple bad values by same reporter"""
core = await stake_deposited
contracts = core.get_tellor360_contracts()
w3 = core.endpoint._web3
Expand Down Expand Up @@ -167,9 +170,9 @@ async def setup_and_start(is_disputing, config, config_patches=None):
with ExitStack() as stack:
stack.enter_context(patch("getpass.getpass", return_value=""))
stack.enter_context(
patch("tellor_disputables.discord.send_discord_msg", side_effect=lambda _: print("alert sent"))
patch("disputable_values_monitor.discord.send_discord_msg", side_effect=lambda _: print("alert sent"))
)
stack.enter_context(patch("tellor_disputables.cli.TelliotConfig", new=lambda: config))
stack.enter_context(patch("disputable_values_monitor.cli.TelliotConfig", new=lambda: config))
stack.enter_context(patch("telliot_feeds.feeds.evm_call_feed.source.cfg", config))
stack.enter_context(
patch(
Expand Down Expand Up @@ -274,7 +277,7 @@ async def test_get_source_from_data(submit_multiple_bad_values: Awaitable[Tellio
config = core.config

config_patches = [
patch("tellor_disputables.data.get_source_from_data", side_effect=lambda _: None),
patch("disputable_values_monitor.data.get_source_from_data", side_effect=lambda _: None),
]
await setup_and_start(True, config, config_patches)
assert "Unable to form source from queryData of query type EVMCall" in caplog.text
Expand Down Expand Up @@ -426,9 +429,9 @@ async def test_spot_short_value(stake_deposited: Awaitable[TelliotCore], capsys)
config_patches = [
patch("builtins.open", side_effect=custom_open_side_effect),
patch("yaml.safe_load", return_value=eth_config),
patch("tellor_disputables.data.get_feed_from_catalog", return_value=eth_usd_median_feed),
patch("disputable_values_monitor.data.get_feed_from_catalog", return_value=eth_usd_median_feed),
patch(
"tellor_disputables.data.send_discord_msg",
"disputable_values_monitor.data.send_discord_msg",
side_effect=lambda _: print("Spot price value length is not 32 bytes"),
),
]
Expand Down Expand Up @@ -462,9 +465,9 @@ async def test_spot_long_value(stake_deposited: Awaitable[TelliotCore], capsys):
config_patches = [
patch("builtins.open", side_effect=custom_open_side_effect),
patch("yaml.safe_load", return_value=eth_config),
patch("tellor_disputables.data.get_feed_from_catalog", return_value=eth_usd_median_feed),
patch("disputable_values_monitor.data.get_feed_from_catalog", return_value=eth_usd_median_feed),
patch(
"tellor_disputables.data.send_discord_msg",
"disputable_values_monitor.data.send_discord_msg",
side_effect=lambda _: print("Spot price value length is not 32 bytes"),
),
]
Expand Down
8 changes: 4 additions & 4 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

from telliot_feeds.feeds import evm_call_feed

from tellor_disputables.config import AutoDisputerConfig
from tellor_disputables.data import Metrics
from tellor_disputables.data import MonitoredFeed
from tellor_disputables.data import Threshold
from disputable_values_monitor.config import AutoDisputerConfig
from disputable_values_monitor.data import Metrics
from disputable_values_monitor.data import MonitoredFeed
from disputable_values_monitor.data import Threshold


def test_build_single_feed_from_yaml():
Expand Down
4 changes: 2 additions & 2 deletions tests/test_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from telliot_core.gas.legacy_gas import fetch_gas_price
from web3 import Web3

from tellor_disputables.data import get_contract
from disputable_values_monitor.data import get_contract


@pytest.mark.skip("for demo only")
Expand Down Expand Up @@ -62,7 +62,7 @@ async def test_demo(setup: TelliotConfig):
@pytest.mark.skip("for demo only")
@pytest.mark.asyncio
async def test_evm_call_demo(setup: TelliotConfig):

"""for testing evm call checks"""
account_name = "disputer-test-acct"

if not find_accounts(account_name, 1337):
Expand Down
Loading

0 comments on commit 9bf9031

Please sign in to comment.