Skip to content

Commit

Permalink
Merge pull request #303 from HathorNetwork/dev
Browse files Browse the repository at this point in the history
release: v0.12.0
  • Loading branch information
alexruzenhack authored Jan 17, 2024
2 parents f56997c + b8905f8 commit 364aea3
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ jobs:
REDIS_PORT: 6379
REDIS_DB: 0
METADATA_BUCKET: hathor-explorer-metadata-testnet
CORS_ALLOWED_REGEX: https?:\/\/([a-z0-9]*\.){0,5}hathor\.network|https?:\/\/([a-z0-9\-]*\.?){0,5}hathor56\.wpcomstaging\.com
CORS_ALLOWED_REGEX: https?:\/\/([a-z0-9]*\.){0,5}hathor\.network
NODE_CACHE_TTL: 30
ELASTIC_INDEX: testnet-token
ELASTIC_TX_INDEX: testnet-tx
Expand All @@ -141,7 +141,7 @@ jobs:
REDIS_PORT: 6379
REDIS_DB: 0
METADATA_BUCKET: hathor-explorer-metadata-mainnet
CORS_ALLOWED_REGEX: https?:\/\/([a-z0-9]*\.){0,5}hathor\.network|https?:\/\/([a-z0-9\-]*\.?){0,5}hathor56\.wpcomstaging\.com
CORS_ALLOWED_REGEX: https?:\/\/([a-z0-9]*\.){0,5}hathor\.network
NODE_CACHE_TTL: 30
ELASTIC_INDEX: mainnet-token
ELASTIC_TX_INDEX: mainnet-tx
Expand Down
5 changes: 5 additions & 0 deletions domain/network/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ class AggregatedNode:
:param latest_timestamp: latest timestamp
:type latest_timestamp: int
:param best_block: best block on that peer's chain
:type best_block: BlockInfo
:param entrypoints: list of entrypoints if any
:type entrypoints: List[str]
Expand All @@ -147,6 +150,7 @@ class AggregatedNode:
uptime: float
state: NodeState
latest_timestamp: int
best_block: BlockInfo
entrypoints: List[str]
connected_peers: List[str]

Expand All @@ -166,6 +170,7 @@ def from_node(cls, node: Node) -> "AggregatedNode":
uptime=node.uptime,
state=node.state,
latest_timestamp=node.latest_timestamp,
best_block=node.best_block,
entrypoints=node.entrypoints,
connected_peers=[peer.id for peer in node.connected_peers],
)
Expand Down
8 changes: 8 additions & 0 deletions domain/network/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ class Node:
:param latest_timestamp: Timestamp of the latest block of the node
:type latest_timestamp: int
:param best_block: best block on that peer's chain
:type best_block: BlockInfo
:param entrypoints: List of node entrypoints
:type entrypoints: List[str]
Expand All @@ -138,6 +141,7 @@ class Node:
uptime: float
first_timestamp: int
latest_timestamp: int
best_block: BlockInfo
entrypoints: List[str]
known_peers: List[str]
connected_peers: List[Peer]
Expand Down Expand Up @@ -245,6 +249,10 @@ def from_status_dict(cls, status: dict) -> "Node":
first_timestamp=status["dag"]["first_timestamp"],
latest_timestamp=status["dag"]["latest_timestamp"],
entrypoints=status["server"]["entrypoints"],
best_block=BlockInfo(
height=status["dag"]["best_block"]["height"],
id=status["dag"]["best_block"]["hash"],
),
known_peers=[id for id in peer_entrypoints.keys()],
connected_peers=connected_peers,
)
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hathor-explorer-service",
"version": "0.11.1",
"version": "0.12.0",
"description": "Hathor Explorer Service Serverless deps",
"dependencies": {
"@apidevtools/swagger-cli": "^4.0.4",
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "hathor-explorer-service"
version = "0.11.1"
version = "0.12.0"
description = ""
authors = ["Hathor Labs <[email protected]>"]
license = "MIT"
Expand Down
6 changes: 6 additions & 0 deletions tests/fixtures/network_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ class Meta:
latest_timestamp = lazy_attribute(
lambda o: fake.pyint(min_value=10_000, max_value=100_000)
)
best_block = lazy_attribute(
lambda o: {
"height": fake.pyint(1_000_000, 5_000_000),
"id": fake.sha256(),
}
)
entrypoints = lazy_attribute(
lambda o: [
f"tcp://{entrypoint()}" for i in range(fake.random_int(min=1, max=1))
Expand Down
6 changes: 6 additions & 0 deletions tests/fixtures/node_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ class Meta:
latest_timestamp = lazy_attribute(
lambda o: fake.pyint(min_value=10_000, max_value=100_000)
)
best_block = lazy_attribute(
lambda o: {
"height": fake.pyint(1_000_000, 5_000_000),
"id": fake.sha256(),
}
)
entrypoints = lazy_attribute(
lambda o: [
f"tcp://{entrypoint()}" for i in range(fake.random_int(min=1, max=5))
Expand Down

0 comments on commit 364aea3

Please sign in to comment.