Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
b01ab74
refactor: move ValidationState to its own file (#635)
glevco May 29, 2023
e80309e
feat(feature-activation): implement signal_bits field in txs (#623)
glevco May 31, 2023
93129a9
feat(events): add event simulator scenarios and tests (#609)
glevco May 31, 2023
cf1a728
feat(feature-activation): implement feature service
glevco May 31, 2023
c68cc37
Merge pull request #639 from HathorNetwork/feat/feature-activation/fe…
jansegre May 31, 2023
1569b4a
chore: remove --x-fast-init-beta CLI option (#643)
glevco Jun 1, 2023
9cd9e2b
refactor: Add common Hathor types
msbrogli Jun 1, 2023
84a7516
tests: Skip flaky event tests
msbrogli Jun 1, 2023
0cf0e1d
fix(simulator): Patch BaseTransaction.resolve() to prevent updating t…
msbrogli Jun 1, 2023
12ec328
refactor: improve manager building on simulator (#653)
glevco Jun 7, 2023
3ced4db
chore: improve progress function (#651)
glevco Jun 9, 2023
dd56e0a
refactor: migrate all type annotations to PEP 585
jansegre Jun 7, 2023
74a5ac6
Merge pull request #654 from HathorNetwork/refactor/pep-585
jansegre Jun 9, 2023
57489f9
chore(events): move event queue option to unsafe args (#656)
glevco Jun 12, 2023
de5267b
Merge branch 'release' into master without code changes
jansegre Jun 12, 2023
fb2b1b2
fix(p2p): Fix node sync not cancelling delayed calls when stopped
msbrogli Jun 2, 2023
0dcf3b5
Merge pull request #650 from HathorNetwork/fix/p2p-rate-limit-call-later
alexruzenhack Jun 13, 2023
512ac62
refactor(builder): Build IndexesManager on builders
msbrogli May 30, 2023
ebbe237
chore: bump version to v0.55.0
jansegre Jun 9, 2023
f8796eb
Merge pull request #661 from HathorNetwork/chore/v0.55.0
jansegre Jun 13, 2023
33daa68
feat(feature-activation): bit count optimization (#633)
glevco Jun 14, 2023
f772aac
refactor(init): Remove duplicate code and simplify full verification …
msbrogli Jun 14, 2023
58799dd
fix(storage): incorrect validation store when using cache storage
jansegre Jun 14, 2023
4b87046
Merge pull request #663 from HathorNetwork/fix/cache-allow-scope
jansegre Jun 14, 2023
d6aafe5
feat(feature-activation): implement get endpoint (#634)
glevco Jun 14, 2023
ff09836
refactor: use None by default for height metadata
jansegre Jun 14, 2023
fbc4f0a
Merge pull request #665 from HathorNetwork/refactor/use-none-height-m…
jansegre Jun 14, 2023
89a001c
fix: settings initialization
glevco Jun 14, 2023
b889539
docs: add event queue docs
glevco Jun 9, 2023
5502d83
refactor: implement typed RunNodeArgs
glevco Jun 14, 2023
b0e3509
Merge branch 'docs/reliable-integration'
msbrogli Jun 14, 2023
ae81b27
refactor: Change HathorManager.on_new_tx() to accept only fully valid…
msbrogli Jun 14, 2023
e4dc9bd
refactor(sync): move sync-v1 files to a separate module
jansegre Jun 14, 2023
99a76a8
Merge pull request #667 from HathorNetwork/refactor/sync-v1-module
jansegre Jun 14, 2023
7ac143f
fix(tests): remove undeeded broken tests
jansegre Jun 14, 2023
7d1f4cd
tests: Do not update time by default on BaseTransaction.resolve()
msbrogli Jun 15, 2023
768e9d2
fix(events): fix bugs in the event stream and improve tests
glevco Jun 7, 2023
441c255
tests(events): migrate flaky event simulation tests to new format
glevco Jun 15, 2023
827f003
feat(feature-activation): implement block ancestor optimization
glevco Jun 14, 2023
292550f
chore(p2p): Add stop to delayed calls
alexruzenhack Jun 7, 2023
a651eb1
fix(metadata): actually use None for unset height
jansegre Jun 15, 2023
28e2598
feat(traversal): add BFS order traversal
jansegre Jun 16, 2023
6eaedc5
Merge pull request #672 from HathorNetwork/feat/traversal-bfs-order
jansegre Jun 16, 2023
2aead42
feat(feature-activation): implement caching mechanism (#645)
glevco Jun 16, 2023
1d5227c
tests(feature-activation): implement reorg test (#660)
glevco Jun 20, 2023
21443ac
refactor(events): improve events during the load phase (#652)
glevco Jun 26, 2023
56d9fb2
docs: add PR templates for the new release process (#674)
luislhl Jul 3, 2023
a0fd874
chore: update checkpoints
jansegre Jun 30, 2023
87f8a21
Merge pull request #687 from HathorNetwork/chore/update-checkpoints
jansegre Jul 3, 2023
e486924
chore: deprecate set output (#689)
r4mmer Jul 4, 2023
18c6853
feat(feature-activation): new MUST_SIGNAL and LOCKED_IN states
glevco Jun 27, 2023
a91c88c
feat(feature-activation): improve docstring and add comment
glevco Jul 7, 2023
c84ca8b
Merge pull request #675 from HathorNetwork/feat/feature-activation/ne…
jansegre Jul 10, 2023
0dd129d
chore: update mypy, mypy-zope, and pydantic (#691)
glevco Jul 11, 2023
45cbdf8
tests: implement new PubSub tests
glevco Jul 11, 2023
d9e15be
fix: consensus-fail-id marker should not be treated as a tx-id
jansegre Jul 11, 2023
ef2720a
Merge pull request #695 from HathorNetwork/fix/consensus-fail-id-marker
jansegre Jul 11, 2023
67e0848
chore: add peer connecting event
glevco Jul 11, 2023
a7aed1e
Merge pull request #700 from HathorNetwork/master
jansegre Jul 12, 2023
78123f0
refactor: Prepare for sync-v2
msbrogli Jul 12, 2023
ba13778
refactor: do not use built-in random and add proper linter check
jansegre Jul 12, 2023
6a2891f
Merge pull request #698 from HathorNetwork/refactor/no-builtin-random
jansegre Jul 12, 2023
b0672bc
refactor: remove deprecated typing uses and add custom linter script
jansegre Jul 12, 2023
ab215c4
Merge pull request #699 from HathorNetwork/refactor/no-deprecated-typing
jansegre Jul 12, 2023
32ae482
chore(extras): script to generate list of PRs that master is ahead of rc
jansegre Jul 12, 2023
d920df5
Merge pull request #701 from HathorNetwork/chore/gen-rc-prs-script
jansegre Jul 12, 2023
779494c
fix(event-queue): fix event simulator scenario parsing (#706)
glevco Jul 18, 2023
7bee591
feat(feature-activation): fix criteria validation (#708)
glevco Jul 19, 2023
c770612
feat(feature-activation): implement bit signaling service (#702)
glevco Jul 19, 2023
b826588
feat(feature-activation): block features endpoint (#690)
glevco Jul 20, 2023
5c04547
chore: update default Python version to 3.10
jansegre Jul 21, 2023
02d3bf7
Merge pull request #712 from HathorNetwork/chore/update-default-python
jansegre Jul 24, 2023
73a8a68
chore: update autobahn package
jansegre Jul 21, 2023
175f40a
Merge pull request #713 from HathorNetwork/chore/update-autobahn
jansegre Jul 25, 2023
f63f3b8
feat(sync-v2): sync-v2 implemented, sync-v1 still default
jansegre Sep 10, 2021
bdfc5fc
Merge pull request #275 from HathorNetwork/feat/sync-v2-mvp2
jansegre Jul 25, 2023
ad194da
fix(test): regression after sync-v2 command was removed
jansegre Jul 26, 2023
e9235e6
Merge pull request #730 from HathorNetwork/fix/sync-v2-regression
jansegre Jul 26, 2023
1d48776
refactor(p2p): rename sync *manager* to sync *agent*
jansegre Jul 26, 2023
405ab6a
Merge pull request #729 from HathorNetwork/refactor/sync-agent
jansegre Jul 26, 2023
b602039
refactor(sync-v2): improve deferreds handling
glevco Jul 26, 2023
7aaf57c
feat(indexes): add get_n_height_tips method to height index
jansegre Jul 27, 2023
91590c7
Merge pull request #734 from HathorNetwork/feat/new-height-index-method
jansegre Jul 27, 2023
e710e6d
feat(p2p): add setting to enable/disable peer whitelist for sync-v2
jansegre Jul 27, 2023
338b3ef
Merge pull request #735 from HathorNetwork/feat/whitelist-for-sync-v2
jansegre Jul 27, 2023
126017d
feat: add get-best-blockchain capability (#686)
alexruzenhack Jul 28, 2023
f5248a4
Merge pull request #723 from HathorNetwork/master
jansegre Jul 28, 2023
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
11 changes: 11 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/feature_branch_pr_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
### Motivation

What was the motivation for the changes in this PR?

### Acceptance Criteria

- Include here all things that this PR should solve

### Checklist

- [ ] If you are requesting a merge into `master`, confirm this code is production-ready and can be included in future releases as soon as it gets merged
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changes

Link here all the PRs that are included in this release candidate

# Checklist

- [ ] I've read and followed the release candidate process described in https://github.com/HathorNetwork/ops-tools/blob/master/docs/release-guides/hathor-core.md#release-candidate
- [ ] I confirm this release candidate only includes production-ready changes
12 changes: 12 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/release_pr_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Changes

Link here all the PRs that are included in this release

# Release-candidates

Link here the release-candidates that were deployed as part of this release

# Checklist

- [ ] I've read and followed the release process described in https://github.com/HathorNetwork/ops-tools/blob/master/docs/release-guides/hathor-core.md#stable-release
- [ ] The QA process was run successfully during the tests of the corresponding release-candidate(s)
5 changes: 5 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Please go to the `Preview` tab and select the appropriate Pull Request template:

* [Feature Branch](?expand=1&template=feature_branch_pr_template.md) - Use this PR template when you are merging a feature branch into `master`
* [Release Candidate](?expand=1&template=release_candidate_pr_template.md) - Use this PR template when you are merging `master` into `release-candidate`
* [Release](?expand=1&template=release_pr_template.md) - Use this PR template when you are merging `release-candidate` into `release`
9 changes: 4 additions & 5 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ jobs:
- '3.10'
- '3.11'
exclude:
# XXX: neither pypy-3.10 nor pypy-3.11 exist yet, maybe pypy-3.10 will be out on PyPy v7.3.10
- python-impl: pypy
python-version: '3.10'
# XXX: pypy-3.11 does exist yet
- python-impl: pypy
python-version: '3.11'
steps:
Expand All @@ -52,8 +50,9 @@ jobs:
python extras/github/docker.py
- name: Check version
if: steps.prep.outputs.check-version
run: |
make check-version VERSION='${{ steps.prep.outputs.check-version }}'
env:
VERSION: ${{ steps.prep.outputs.check-version }}
run: make check-custom
- name: Set up QEMU # arm64 is not available natively
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ jobs:
matrix = full_matrix
else:
matrix = reduced_matrix
print('::set-output name=matrix::' + json.dumps(matrix))
with open(os.environ['GITHUB_OUTPUT'], 'a') as f:
f.write('matrix={}\n'.format(json.dumps(matrix)))
check-matrix:
runs-on: ubuntu-latest
needs: matrix
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# before changing these variables, make sure the tag $PYTHON-alpine$ALPINE exists first
# list of valid tags hese: https://hub.docker.com/_/python
ARG PYTHON=3.9
ARG PYTHON=3.10
ARG DEBIAN=bullseye

# stage-0: copy pyproject.toml/poetry.lock and install the production set of dependencies
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.pypy
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# before changing these variables, make sure the tag $PYTHON-alpine$ALPINE exists first
# list of valid tags hese: https://hub.docker.com/_/pypy
ARG PYTHON=3.9
ARG PYTHON=3.10
ARG DEBIAN=bullseye

# stage-0: copy pyproject.toml/poetry.lock and install the production set of dependencies
Expand Down
341 changes: 341 additions & 0 deletions EVENT_QUEUE.md

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,15 @@ isort-check:
yamllint:
yamllint .

.PHONY: check-version
check-version:
bash ./extras/check_version.sh $(VERSION)
.PHONY: check-custom
check-custom:
bash ./extras/custom_checks.sh

.PHONY: check
check: check-version yamllint flake8 isort-check mypy
check: check-custom yamllint flake8 isort-check mypy

.PHONY: dcheck
dcheck: check-version yamllint flake8 isort-check dmypy
dcheck: check-custom yamllint flake8 isort-check dmypy

# formatting:

Expand Down
47 changes: 0 additions & 47 deletions extras/check_version.sh

This file was deleted.

112 changes: 112 additions & 0 deletions extras/custom_checks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
#!/bin/bash

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

# Source dirs
SOURCE_DIRS=(hathor tests)

# Define your custom linter check functions here
# Each function should return 0 if everything is OK, and 1 if something is wrong.

function check_version_match() {
# This function will check all source files containing the project version and return 1 in case
# they don't match. When a version is provided as an environment variable, it is checked against the package version.

OPENAPI_FILE="hathor/cli/openapi_files/openapi_base.json"
SRC_FILE="hathor/version.py"
PACKAGE_FILE="pyproject.toml"

OPENAPI_VERSION=`grep "version\":" ${OPENAPI_FILE} | cut -d'"' -f4`
SRC_VERSION=`grep "BASE_VERSION =" ${SRC_FILE} | cut -d "'" -f2`
PACKAGE_VERSION=`grep '^version' ${PACKAGE_FILE} | cut -d '"' -f2`

# For debugging:
# echo x${SRC_VERSION}x
# echo x${OPENAPI_VERSION}x
# echo x${PACKAGE_VERSION}x

EXITCODE=0

if [[ x${PACKAGE_VERSION}x != x${SRC_VERSION}x ]]; then
echo "Version different in ${PACKAGE_FILE} and ${SRC_FILE}"
EXITCODE=1
fi

if [[ x${PACKAGE_VERSION}x != x${OPENAPI_VERSION}x ]]; then
echo "Version different in ${PACKAGE_FILE} and ${OPENAPI_FILE}"
EXITCODE=1
fi

# We expect an optional environment variable containing a version string to be checked against the others
if [[ -n ${VERSION} ]]; then
if [[ x${PACKAGE_VERSION}x != x${VERSION}x ]]; then
echo "Version different in ${PACKAGE_FILE} and VERSION environment variable"
EXITCODE=1
fi
fi

return $EXITCODE
}

function check_do_not_use_builtin_random_in_tests() {
# If the check fails, return 1
# If the check passes, return 0
exclude=(
hathor/merged_mining/debug_api.py
hathor/client.py
hathor/cli/tx_generator.py
)
exclude_params=()
for item in "${exclude[@]}"; do
exclude_params+=(-not -path "*$item*")
done
if find "${SOURCE_DIRS[@]}" "${exclude_params[@]}" -type f -print0 | xargs -0 grep -l '\<import .*\<random\>'; then
echo '"import random" found in the files above'
echo 'use `self.rng` or `hathor.util.Random` instead of `random`'
return 1
fi
return 0
}

function check_deprecated_typing() {
if grep -R '\<typing .*\<import .*\<\(Tuple\|List\|Dict\|Set\|FrozenSet\|AbstractSet\|DefaultDict\|OrderedDict\)\>' "${SOURCE_DIRS[@]}"; then
echo 'do not use typing.List/Tuple/Dict/... for type annotations use builtin list/tuple/dict/... instead'
echo 'for more info check the PEP 585 doc: https://peps.python.org/pep-0585/'
return 1
fi
return 0
}

# List of functions to be executed
checks=(
check_version_match
check_do_not_use_builtin_random_in_tests
check_deprecated_typing
)

# Initialize a variable to track if any check fails
any_check_failed=0

# Loop over all checks
for check in "${checks[@]}"; do
$check
result=$?
if [ $result -ne 0 ]; then
echo -e "${RED}Check $check FAILED${NC}"
any_check_failed=1
else
echo -e "${GREEN}Check $check PASSED${NC}"
fi
done

# Exit with code 0 if no check failed, otherwise exit with code 1
if [ $any_check_failed -eq 0 ]; then
echo -e "${GREEN}All checks PASSED${NC}"
exit 0
else
echo -e "${RED}Some checks FAILED${NC}"
exit 1
fi
79 changes: 79 additions & 0 deletions extras/gen_release_candidate_changes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/usr/bin/env python
"""
This script finds all PRs that have been merged into the `master` branch but not into the `release-candidate` branch in a given GitHub repository.

Usage:

./extras/gen_release_candidate_changes.py

Example output:

```
- #701
- #697
- #686
```
"""

import yaml
import os
import requests

BASE_API_URL = 'https://api.github.com'
REPO = 'HathorNetwork/hathor-core'


def get_gh_token():
config_path = os.path.expanduser('~/.config/gh/hosts.yml')

if not os.path.exists(config_path):
print("GitHub CLI configuration not found. Please authenticate with 'gh auth login'.")
exit(1)

with open(config_path, 'r') as file:
config = yaml.safe_load(file)

token = config['github.com']['oauth_token']
return token


def get_headers(token):
return {'Authorization': f'token {token}'}


def get_commits_ahead(base, compare, token):
response = requests.get(
f'{BASE_API_URL}/repos/{REPO}/compare/{base}...{compare}',
headers=get_headers(token)
)
data = response.json()
return [commit['sha'] for commit in data['commits']]


def get_pr_for_commit(commit, token):
response = requests.get(
f'{BASE_API_URL}/repos/{REPO}/commits/{commit}/pulls',
headers=get_headers(token),
params={'state': 'all'}
)
data = response.json()
if data:
return data[0]['number']
return None


def get_new_prs_in_master(token):
commits = get_commits_ahead('release-candidate', 'master', token)
prs = []
for commit in commits:
pr = get_pr_for_commit(commit, token)
if pr and pr not in prs:
prs.append(pr)
return prs


if __name__ == '__main__':
token = get_gh_token()
prs = get_new_prs_in_master(token)
for pr in prs:
print(f'- #{pr}')
6 changes: 3 additions & 3 deletions extras/github/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
from typing import Dict

def print_output(output: Dict):
for k, v in output.items():
print(f'::set-output name={k}::{v}')

outputs = ['{}={}\n'.format(k, v) for k, v in output.items()]
with open(os.environ['GITHUB_OUTPUT'], 'a') as f:
f.writelines(outputs)

def prep_base_version(environ: Dict):
GITHUB_REF = environ.get('GITHUB_REF')
Expand Down
Loading