Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
47831ae
chore: clean up feature activation logs (#1035)
glevco May 28, 2024
fbbcc64
fix(log): correctly handle errors when logging events (#1040)
glevco May 28, 2024
b06dd2d
Merge pull request #1045 from HathorNetwork/release-candidate
jansegre May 29, 2024
2f78353
Merge branch 'release' into master
jansegre May 29, 2024
8e9bfbc
feat(api): Add include_transactions parameter to the BlockAtHeightRes…
msbrogli Jun 3, 2024
43c579e
chore: bump version to v0.61.0
jansegre Jun 3, 2024
c346ef2
Merge pull request #1047 from HathorNetwork/chore/v0.61.0
jansegre Jun 3, 2024
40a25dc
fix: add peers api
glevco Jun 4, 2024
8aafd01
refactor(p2p): split hathor.p2p.peer_discovery into separate modules
jansegre Jun 6, 2024
b20be70
Merge pull request #1055 from HathorNetwork/refactor/p2p-discovery-mo…
jansegre Jun 6, 2024
83c9190
feat(side-dag): implement side_dag CLI command (#1039)
glevco Jun 10, 2024
1d0b439
feat(side-dag): implement gen_keys CLI command (#1041)
glevco Jun 10, 2024
71b079a
fix: improve stratum logs (#1049)
glevco Jun 10, 2024
62ba5a1
chore(docker): drop support for PyPy
jansegre Jun 11, 2024
948f357
Merge pull request #1062 from HathorNetwork/chore/drop-pypy-support
jansegre Jun 11, 2024
4a46f3a
docs(security): update link to bug bounty program (#1065)
BrunoCampana Jun 13, 2024
bc01626
fix(cli): regression of --help after side-dag cli
jansegre Jun 21, 2024
14289d5
Merge pull request #1073 from HathorNetwork/fix/run-node-help-regression
jansegre Jun 21, 2024
255fd58
fix: profiler reactor initialization (#1058)
glevco Jul 5, 2024
c075d5e
fix(side-dag): remove init timeout (#1070)
glevco Jul 5, 2024
f95d189
feat(side-dag): implement Proof-of-Authority (#1060)
glevco Jul 8, 2024
845e9c9
refactor(storage): change storages to use injected settings
glevco Jul 8, 2024
7c7c261
Merge pull request #1081 from HathorNetwork/refactor/storage-injected…
jansegre Jul 9, 2024
5a788d0
feat(side-dag): implement PoaBlockProducer (#1061)
glevco Jul 15, 2024
aaf959c
refactor(settings): more settings injection refactors (#1085)
glevco Jul 16, 2024
06a93b8
refactor: miscellaneous small improvements (#1069)
glevco Jul 17, 2024
b3f3d3e
tests(side-dag): implement missing side-dag related tests (#1064)
glevco Jul 18, 2024
66eec5a
feat(side-dag): update APIs (#1071)
glevco Jul 18, 2024
2cf1908
refactor(p2p): use Entrypoint type instead of str
jansegre Jul 4, 2024
a77deb3
Merge pull request #1086 from HathorNetwork/refactor/entrypoint-type
jansegre Jul 18, 2024
eb74c11
fix(logging): make different version logging less obtrusive
jansegre Jun 21, 2024
1aeb710
Merge pull request #1087 from HathorNetwork/fix/version-logging
jansegre Jul 18, 2024
d30a59c
feat(side-dag): implement signer round-robin (#1074)
glevco Jul 22, 2024
0ded56d
feat(side-dag): add ability to update signers list (#1075)
glevco Jul 22, 2024
0a76090
fix(p2p): regression after entrypoint refactor
jansegre Jul 18, 2024
b98b938
Merge pull request #1088 from HathorNetwork/fix/entrypoint-regression
jansegre Jul 22, 2024
53fa539
feat(side-dag): add signers validation on peer hello (#1078)
glevco Jul 22, 2024
928bc95
refactor(side-dag): refactor node processes management (#1079)
glevco Jul 23, 2024
631f2ca
feat(wallet): Add a vertex history streamer to the wallet websocket API
msbrogli Jul 11, 2024
e6c68da
refactor(api): prevent duplicate tx earlier
jansegre Apr 16, 2024
d2dde8f
Merge pull request #1006 from HathorNetwork/fix/duplicate-push-tx
jansegre Jul 24, 2024
995c208
tests(event-queue): add test for invalid tx in mempool (#1091)
glevco Jul 25, 2024
2a15861
fix(p2p): status regression after entrypoint refactor
jansegre Jul 23, 2024
3ffc83d
Merge pull request #1089 from HathorNetwork/fix/p2p-status-regression
jansegre Jul 25, 2024
bd8c2aa
fix(indexes): efficient rocksdb mempool-tips initialization
jansegre Mar 20, 2024
e61463e
Merge pull request #938 from HathorNetwork/fix/rocksdb-mempool-tips-i…
jansegre Jul 26, 2024
eb0ad92
fix(reward-lock): save removed txs in the consensus context (#1092)
glevco Jul 26, 2024
a02ae1a
feat(event-queue): add new VERTEX_REMOVED event
glevco Jul 24, 2024
e7d1bc4
Merge pull request #1093 from HathorNetwork/feat/event-queue/add-tx-r…
jansegre Jul 26, 2024
b98f659
chore: bump version to v0.62.0
jansegre Jul 25, 2024
29ff505
Merge pull request #1095 from HathorNetwork/chore/v0.62.0
jansegre Jul 26, 2024
5e9c6d4
chore(cli): mark sync-v1 and bridge as unsafe
jansegre Jul 24, 2024
7829afb
Merge pull request #1090 from HathorNetwork/chore/cli-mark-sync-v1-un…
jansegre Jul 26, 2024
c605607
refactor(side-dag): general improvements
glevco Jul 23, 2024
716a012
Merge pull request #1080 from HathorNetwork/refactor/side-dag/improve…
jansegre Jul 26, 2024
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: 0 additions & 4 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ jobs:
- '3.10'
- '3.11'
- '3.12'
include:
- python-impl: pypy
python-version: '3.10'
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -96,7 +93,6 @@ jobs:
run: docker run --rm ${{ env.TEST_TAG }} quick_test --data / --testnet
- name: Build and push
uses: docker/build-push-action@v3
continue-on-error: ${{ matrix.python-impl == 'pypy' }} # PyPy is not first-class and has been causing some build failures
if: ${{ !env.ACT }} # Skip this step when testing locally with https://github.com/nektos/act
with:
context: .
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ jobs:
'python': ['3.10', '3.11', '3.12'],
# available OS's: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idruns-on
'os': ['ubuntu-22.04', 'macos-12', 'windows-2022'],
'include': [
# XXX: tests fail on these, not sure why, when running them individually each on passes, but not on `make tests`
# {'os': 'ubuntu-22.04', 'python': 'pypy-3.10'},
],
}
# this is the fastest one:
reduced_matrix = {
Expand Down
36 changes: 0 additions & 36 deletions Dockerfile.pypy

This file was deleted.

16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
py_sources = hathor/ tests/
py_sources = hathor/ tests/ extras/custom_tests/

.PHONY: all
all: check tests
Expand Down Expand Up @@ -49,8 +49,12 @@ tests-genesis:
tests-ci:
pytest $(tests_ci)

.PHONY: tests-custom
tests-custom:
bash ./extras/custom_tests.sh

.PHONY: tests
tests: tests-cli tests-lib tests-genesis tests-ci
tests: tests-cli tests-lib tests-genesis tests-custom tests-ci

.PHONY: tests-full
tests-full:
Expand All @@ -60,11 +64,11 @@ tests-full:

.PHONY: mypy
mypy:
mypy -p hathor -p tests
mypy -p hathor -p tests -p extras.custom_tests

.PHONY: dmypy
dmypy:
dmypy run --timeout 86400 -- -p hathor -p tests
dmypy run --timeout 86400 -- -p hathor -p tests -p extras.custom_tests

.PHONY: flake8
flake8:
Expand Down Expand Up @@ -134,10 +138,6 @@ endif
docker: $(docker_dir)/Dockerfile
docker build$(docker_build_flags) -t $(docker_tag) $(docker_dir)

.PHONY: docker-pypy
docker-pypy: $(docker_dir)/Dockerfile.pypy
docker build$(docker_build_flags) -f Dockerfile.pypy -t $(docker_tag) $(docker_dir)

.PHONY: docker-push
docker-push: docker
docker tag $(docker_tag) hathornetwork/hathor-core:$(docker_subtag)
Expand Down
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Security

Hathor Labs has a bounty program to encourage white hat hackers to collaborate in identifying security breaches and vulnerabilities in Hathor core. To know more about this, see [Bug bounty program at Hathor docs](https://docs.hathor.network/references/besides-documentation#security).
Hathor Labs has a bounty program to encourage white hat hackers to collaborate in identifying security breaches and vulnerabilities in Hathor core. To know more about this, see [Bug bounty program at Hathor Network](https://hathor.network/bug-bounty/).
40 changes: 40 additions & 0 deletions extras/custom_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash

# Define colors
RED='\033[0;31m'
GREEN='\033[0;32m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color

TESTS_DIR="extras/custom_tests"

# List of test scripts to be executed
tests=(
/side_dag/test_one_fails.py
/side_dag/test_both_fail.py
)

# Initialize a variable to track if any test fails
any_test_failed=0

# Loop over all tests
for test in "${tests[@]}"; do
echo -e "${BLUE}Testing $test${NC}"
PYTHONPATH=$TESTS_DIR python $TESTS_DIR/$test
result=$?
if [ $result -ne 0 ]; then
echo -e "${RED}Test $test FAILED${NC}"
any_test_failed=1
else
echo -e "${GREEN}Test $test PASSED${NC}"
fi
done

# Exit with code 0 if no test failed, otherwise exit with code 1
if [ $any_test_failed -eq 0 ]; then
echo -e "${GREEN}All tests PASSED${NC}"
exit 0
else
echo -e "${RED}Some tests FAILED${NC}"
exit 1
fi
Empty file.
Empty file.
98 changes: 98 additions & 0 deletions extras/custom_tests/side_dag/test_both_fail.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Copyright 2024 Hathor Labs
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import os
import shlex
import signal
import subprocess
import sys

from utils import ( # type: ignore[import-not-found]
COMMAND,
HATHOR_PROCESS_NAME,
KILL_WAIT_DELAY,
MONITOR_PROCESS_NAME,
SIDE_DAG_PROCESS_NAME,
get_pid_by_name,
is_alive,
popen_is_alive,
wait_seconds,
)

if sys.platform == 'win32':
print("test skipped on windows")
sys.exit(0)


def test_both_fail() -> None:
# Assert that there are no existing processes
assert get_pid_by_name(MONITOR_PROCESS_NAME) is None
assert get_pid_by_name(HATHOR_PROCESS_NAME) is None
assert get_pid_by_name(SIDE_DAG_PROCESS_NAME) is None

# Run the python command
args = shlex.split(COMMAND)
monitor_process = subprocess.Popen(args)
print(f'running "run_node_with_side_dag" in the background with pid: {monitor_process.pid}')
print('awaiting subprocesses initialization...')
wait_seconds(5)

monitor_process_pid = get_pid_by_name(MONITOR_PROCESS_NAME)
hathor_process_pid = get_pid_by_name(HATHOR_PROCESS_NAME)
side_dag_process_pid = get_pid_by_name(SIDE_DAG_PROCESS_NAME)

# Assert that the processes exist and are alive
assert monitor_process_pid == monitor_process.pid
assert monitor_process_pid is not None
assert hathor_process_pid is not None
assert side_dag_process_pid is not None

assert is_alive(monitor_process_pid)
assert is_alive(hathor_process_pid)
assert is_alive(side_dag_process_pid)

print('processes are running:')
print(f' "{MONITOR_PROCESS_NAME}" pid: {monitor_process_pid}')
print(f' "{HATHOR_PROCESS_NAME}" pid: {hathor_process_pid}')
print(f' "{SIDE_DAG_PROCESS_NAME}" pid: {side_dag_process_pid}')
print('letting processes run for a while...')
wait_seconds(10)

# Terminate both subprocess
print('terminating subprocesses...')
os.kill(hathor_process_pid, signal.SIGTERM)
os.kill(side_dag_process_pid, signal.SIGTERM)
print('awaiting processes termination...')
wait_seconds(KILL_WAIT_DELAY, break_function=lambda: not popen_is_alive(monitor_process))

# Assert that all process are terminated
assert not popen_is_alive(monitor_process)
assert not is_alive(monitor_process_pid)
assert not is_alive(hathor_process_pid)
assert not is_alive(side_dag_process_pid)

print('all processes are dead. test succeeded!')


try:
test_both_fail()
except Exception:
if monitor_process_pid := get_pid_by_name(MONITOR_PROCESS_NAME):
os.kill(monitor_process_pid, signal.SIGKILL)
if hathor_process_pid := get_pid_by_name(HATHOR_PROCESS_NAME):
os.kill(hathor_process_pid, signal.SIGKILL)
if side_dag_process_pid := get_pid_by_name(SIDE_DAG_PROCESS_NAME):
os.kill(side_dag_process_pid, signal.SIGKILL)

raise
97 changes: 97 additions & 0 deletions extras/custom_tests/side_dag/test_one_fails.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Copyright 2024 Hathor Labs
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import os
import shlex
import signal
import subprocess
import sys

from utils import ( # type: ignore[import-not-found]
COMMAND,
HATHOR_PROCESS_NAME,
KILL_WAIT_DELAY,
MONITOR_PROCESS_NAME,
SIDE_DAG_PROCESS_NAME,
get_pid_by_name,
is_alive,
popen_is_alive,
wait_seconds,
)

if sys.platform == 'win32':
print("test skipped on windows")
sys.exit(0)


def test_one_fails() -> None:
# Assert that there are no existing processes
assert get_pid_by_name(MONITOR_PROCESS_NAME) is None
assert get_pid_by_name(HATHOR_PROCESS_NAME) is None
assert get_pid_by_name(SIDE_DAG_PROCESS_NAME) is None

# Run the python command
args = shlex.split(COMMAND)
monitor_process = subprocess.Popen(args)
print(f'running "run_node_with_side_dag" in the background with pid: {monitor_process.pid}')
print('awaiting subprocesses initialization...')
wait_seconds(5)

monitor_process_pid = get_pid_by_name(MONITOR_PROCESS_NAME)
hathor_process_pid = get_pid_by_name(HATHOR_PROCESS_NAME)
side_dag_process_pid = get_pid_by_name(SIDE_DAG_PROCESS_NAME)

# Assert that the processes exist and are alive
assert monitor_process_pid == monitor_process.pid
assert monitor_process_pid is not None
assert hathor_process_pid is not None
assert side_dag_process_pid is not None

assert is_alive(monitor_process_pid)
assert is_alive(hathor_process_pid)
assert is_alive(side_dag_process_pid)

print('processes are running:')
print(f' "{MONITOR_PROCESS_NAME}" pid: {monitor_process_pid}')
print(f' "{HATHOR_PROCESS_NAME}" pid: {hathor_process_pid}')
print(f' "{SIDE_DAG_PROCESS_NAME}" pid: {side_dag_process_pid}')
print('letting processes run for a while...')
wait_seconds(10)

# Terminate one subprocess
print('terminating side-dag process...')
os.kill(side_dag_process_pid, signal.SIGTERM)
print('awaiting process termination...')
wait_seconds(KILL_WAIT_DELAY, break_function=lambda: not popen_is_alive(monitor_process))

# Assert that all process are terminated
assert not popen_is_alive(monitor_process)
assert not is_alive(monitor_process_pid)
assert not is_alive(hathor_process_pid)
assert not is_alive(side_dag_process_pid)

print('all processes are dead. test succeeded!')


try:
test_one_fails()
except Exception:
if monitor_process_pid := get_pid_by_name(MONITOR_PROCESS_NAME):
os.kill(monitor_process_pid, signal.SIGKILL)
if hathor_process_pid := get_pid_by_name(HATHOR_PROCESS_NAME):
os.kill(hathor_process_pid, signal.SIGKILL)
if side_dag_process_pid := get_pid_by_name(SIDE_DAG_PROCESS_NAME):
os.kill(side_dag_process_pid, signal.SIGKILL)

raise
Loading