fix: replace datetime.UTC with timezone.utc for Python 3.12+ compatibility
Some checks failed
API Endpoint Tests / test-api-endpoints (push) Successful in 22s
Blockchain Synchronization Verification / sync-verification (push) Successful in 3s
CLI Tests / test-cli (push) Failing after 13s
Cross-Chain Functionality Tests / test-cross-chain-sync (push) Failing after 3s
Cross-Chain Functionality Tests / test-cross-chain-transactions (push) Successful in 3s
Cross-Chain Functionality Tests / test-cross-chain-bridge (push) Has been skipped
Cross-Chain Functionality Tests / test-multi-chain-consensus (push) Failing after 3s
Cross-Chain Functionality Tests / aggregate-results (push) Has been skipped
Cross-Node Transaction Testing / transaction-test (push) Successful in 2s
Deploy to Testnet / deploy-testnet (push) Successful in 1m34s
Documentation Validation / validate-docs (push) Failing after 10s
Documentation Validation / validate-policies-strict (push) Successful in 3s
Multi-Node Stress Testing / stress-test (push) Has been cancelled
Node Failover Simulation / failover-test (push) Has been cancelled
Python Tests / test-python (push) Has been cancelled
Integration Tests / test-service-integration (push) Successful in 2m42s
Multi-Chain Island Architecture Tests / test-multi-chain-island (push) Successful in 3s
Multi-Node Blockchain Health Monitoring / health-check (push) Successful in 5s
P2P Network Verification / p2p-verification (push) Successful in 3s
Package Tests / Python package - aitbc-agent-sdk (push) Failing after 33s
Package Tests / Python package - aitbc-core (push) Successful in 17s
Package Tests / Python package - aitbc-crypto (push) Successful in 11s
Security Scanning / security-scan (push) Has been cancelled
Package Tests / Python package - aitbc-sdk (push) Successful in 13s
Package Tests / JavaScript package - aitbc-sdk-js (push) Successful in 9s
Package Tests / JavaScript package - aitbc-token (push) Successful in 17s
Staking Tests / test-staking-service (push) Failing after 6s
Staking Tests / test-staking-integration (push) Has been skipped
Staking Tests / test-staking-contract (push) Has been skipped
Staking Tests / run-staking-test-runner (push) Has been skipped

This commit is contained in:
aitbc
2026-05-09 12:03:26 +02:00
parent 14449b0758
commit d26e6d3772
152 changed files with 848 additions and 848 deletions

View File

@@ -8,7 +8,7 @@ sys.path.insert(0, 'src')
from aitbc_chain.database import session_scope, init_db
from aitbc_chain.models import Block
from datetime import datetime, UTC
from datetime import datetime, timezone
import hashlib
def compute_block_hash(height: int, parent_hash: str, timestamp: datetime) -> str:
@@ -31,7 +31,7 @@ def create_genesis():
return
# Create genesis block
timestamp = datetime.now(datetime.UTC)
timestamp = datetime.now(timezone.utc)
genesis_hash = compute_block_hash(0, "0x00", timestamp)
genesis = Block(
height=0,

View File

@@ -1,11 +1,11 @@
from aitbc_chain.database import session_scope, init_db
from aitbc_chain.models import Account
from datetime import datetime, UTC
from datetime import datetime, timezone
def fix():
init_db()
with session_scope() as session:
acc = Account(chain_id="ait-mainnet", address="aitbc1genesis", balance=10000000, nonce=0, updated_at=datetime.now(datetime.UTC), account_type="regular", metadata="{}")
acc = Account(chain_id="ait-mainnet", address="aitbc1genesis", balance=10000000, nonce=0, updated_at=datetime.now(timezone.utc), account_type="regular", metadata="{}")
session.merge(acc)
session.commit()
print("Added aitbc1genesis to mainnet")

View File

@@ -18,7 +18,7 @@ import base64
import os
import sys
from pathlib import Path
from datetime import datetime, UTC
from datetime import datetime, timezone
from typing import Dict, List, Any, Optional
from cryptography.hazmat.primitives.asymmetric import ed25519
@@ -233,7 +233,7 @@ def initialize_genesis_database(genesis_block: Dict, allocations: List[Dict], db
alloc["address"],
alloc["balance"],
alloc["nonce"],
datetime.now(datetime.UTC).isoformat()
datetime.now(timezone.utc).isoformat()
)
)

View File

@@ -8,7 +8,7 @@ of agent compromise.
from typing import Dict, List, Optional, Tuple
from dataclasses import dataclass
from datetime import datetime, UTC, timedelta
from datetime import datetime, timezone, timedelta
import json
from eth_account import Account
from eth_utils import to_checksum_address
@@ -37,7 +37,7 @@ class AgentSecurityProfile:
def __post_init__(self):
if self.created_at is None:
self.created_at = datetime.now(datetime.UTC)
self.created_at = datetime.now(timezone.utc)
class AgentWalletSecurity:
@@ -423,7 +423,7 @@ class AgentWalletSecurity:
def _log_security_event(self, **kwargs):
"""Log a security event"""
event = {
"timestamp": datetime.now(datetime.UTC).isoformat(),
"timestamp": datetime.now(timezone.utc).isoformat(),
**kwargs
}
self.security_events.append(event)
@@ -469,7 +469,7 @@ class AgentWalletSecurity:
return {
"status": "disabled",
"agent_address": agent_address,
"disabled_at": datetime.now(datetime.UTC).isoformat(),
"disabled_at": datetime.now(timezone.utc).isoformat(),
"guardian": guardian_address
}
@@ -527,7 +527,7 @@ def generate_security_report() -> Dict:
recent_events = agent_wallet_security.get_security_events(limit=20)
return {
"generated_at": datetime.now(datetime.UTC).isoformat(),
"generated_at": datetime.now(timezone.utc).isoformat(),
"summary": {
"total_protected_agents": total_agents,
"active_agents": active_agents,
@@ -580,5 +580,5 @@ def detect_suspicious_activity(agent_address: str, hours: int = 24) -> Dict:
"suspicious_activity": len(suspicious_patterns) > 0,
"suspicious_patterns": suspicious_patterns,
"analysis_period_hours": hours,
"analyzed_at": datetime.now(datetime.UTC).isoformat()
"analyzed_at": datetime.now(timezone.utc).isoformat()
}

View File

@@ -12,7 +12,7 @@ wallets from unlimited spending in case of compromise. It provides:
from typing import Dict, List, Optional, Tuple
from dataclasses import dataclass
from datetime import datetime, UTC, timedelta
from datetime import datetime, timezone, timedelta
import json
import os
import sqlite3
@@ -248,7 +248,7 @@ class GuardianContract:
def _get_spent_in_period(self, period: str, timestamp: datetime = None) -> int:
"""Calculate total spent in given period"""
if timestamp is None:
timestamp = datetime.now(datetime.UTC)
timestamp = datetime.now(timezone.utc)
period_key = self._get_period_key(timestamp, period)
@@ -265,7 +265,7 @@ class GuardianContract:
def _check_spending_limits(self, amount: int, timestamp: datetime = None) -> Tuple[bool, str]:
"""Check if amount exceeds spending limits"""
if timestamp is None:
timestamp = datetime.now(datetime.UTC)
timestamp = datetime.now(timezone.utc)
# Check per-transaction limit
if amount > self.config.limits.per_transaction:
@@ -350,7 +350,7 @@ class GuardianContract:
"to": to_address,
"amount": amount,
"data": data,
"timestamp": datetime.now(datetime.UTC).isoformat(),
"timestamp": datetime.now(timezone.utc).isoformat(),
"nonce": self.nonce,
"status": "pending"
}
@@ -360,7 +360,7 @@ class GuardianContract:
# Check if time lock is required
if self._requires_time_lock(amount):
unlock_time = datetime.now(datetime.UTC) + timedelta(hours=self.config.time_lock.delay_hours)
unlock_time = datetime.now(timezone.utc) + timedelta(hours=self.config.time_lock.delay_hours)
operation["unlock_time"] = unlock_time.isoformat()
operation["status"] = "time_locked"
@@ -406,7 +406,7 @@ class GuardianContract:
# Check if operation is time locked
if operation["status"] == "time_locked":
unlock_time = datetime.fromisoformat(operation["unlock_time"])
if datetime.now(datetime.UTC) < unlock_time:
if datetime.now(timezone.utc) < unlock_time:
return {
"status": "error",
"reason": f"Operation locked until {unlock_time.isoformat()}"
@@ -432,7 +432,7 @@ class GuardianContract:
"amount": operation["amount"],
"data": operation.get("data", ""),
"timestamp": operation["timestamp"],
"executed_at": datetime.now(datetime.UTC).isoformat(),
"executed_at": datetime.now(timezone.utc).isoformat(),
"status": "completed",
"nonce": operation["nonce"]
}
@@ -479,7 +479,7 @@ class GuardianContract:
return {
"status": "paused",
"paused_at": datetime.now(datetime.UTC).isoformat(),
"paused_at": datetime.now(timezone.utc).isoformat(),
"guardian": guardian_address,
"message": "Emergency pause activated - all operations halted"
}
@@ -513,7 +513,7 @@ class GuardianContract:
return {
"status": "unpaused",
"unpaused_at": datetime.now(datetime.UTC).isoformat(),
"unpaused_at": datetime.now(timezone.utc).isoformat(),
"message": "Emergency pause lifted - operations resumed"
}
@@ -541,13 +541,13 @@ class GuardianContract:
"status": "updated",
"old_limits": old_limits,
"new_limits": new_limits,
"updated_at": datetime.now(datetime.UTC).isoformat(),
"updated_at": datetime.now(timezone.utc).isoformat(),
"guardian": guardian_address
}
def get_spending_status(self) -> Dict:
"""Get current spending status and limits"""
now = datetime.now(datetime.UTC)
now = datetime.now(timezone.utc)
return {
"agent_address": self.agent_address,

View File

@@ -5,7 +5,7 @@ Fixes the critical vulnerability where spending limits were lost on restart
from typing import Dict, List, Optional, Tuple
from dataclasses import dataclass
from datetime import datetime, UTC, timedelta
from datetime import datetime, timezone, timedelta
from sqlalchemy import create_engine, Column, String, Integer, Float, DateTime, Index
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, Session
@@ -25,7 +25,7 @@ class SpendingRecord(Base):
period_key = Column(String, index=True)
amount = Column(Float)
transaction_hash = Column(String)
timestamp = Column(DateTime, default=datetime.now(datetime.UTC))
timestamp = Column(DateTime, default=datetime.now(timezone.utc))
# Composite indexes for performance
__table_args__ = (
@@ -45,7 +45,7 @@ class SpendingLimit(Base):
per_week = Column(Float)
time_lock_threshold = Column(Float)
time_lock_delay_hours = Column(Integer)
updated_at = Column(DateTime, default=datetime.now(datetime.UTC))
updated_at = Column(DateTime, default=datetime.now(timezone.utc))
updated_by = Column(String) # Guardian who updated
@@ -57,7 +57,7 @@ class GuardianAuthorization(Base):
agent_address = Column(String, index=True)
guardian_address = Column(String, index=True)
is_active = Column(Boolean, default=True)
added_at = Column(DateTime, default=datetime.now(datetime.UTC))
added_at = Column(DateTime, default=datetime.now(timezone.utc))
added_by = Column(String)
@@ -112,7 +112,7 @@ class PersistentSpendingTracker:
Total amount spent in period
"""
if timestamp is None:
timestamp = datetime.now(datetime.UTC)
timestamp = datetime.now(timezone.utc)
period_key = self._get_period_key(timestamp, period)
agent_address = to_checksum_address(agent_address)
@@ -140,7 +140,7 @@ class PersistentSpendingTracker:
True if recorded successfully
"""
if timestamp is None:
timestamp = datetime.now(datetime.UTC)
timestamp = datetime.now(timezone.utc)
agent_address = to_checksum_address(agent_address)
@@ -184,7 +184,7 @@ class PersistentSpendingTracker:
Spending check result
"""
if timestamp is None:
timestamp = datetime.now(datetime.UTC)
timestamp = datetime.now(timezone.utc)
agent_address = to_checksum_address(agent_address)
@@ -312,7 +312,7 @@ class PersistentSpendingTracker:
limits.per_week = new_limits.get("per_week", limits.per_week)
limits.time_lock_threshold = new_limits.get("time_lock_threshold", limits.time_lock_threshold)
limits.time_lock_delay_hours = new_limits.get("time_lock_delay_hours", limits.time_lock_delay_hours)
limits.updated_at = datetime.now(datetime.UTC)
limits.updated_at = datetime.now(timezone.utc)
limits.updated_by = guardian_address
else:
limits = SpendingLimit(
@@ -323,7 +323,7 @@ class PersistentSpendingTracker:
per_week=new_limits.get("per_week", 100000.0),
time_lock_threshold=new_limits.get("time_lock_threshold", 5000.0),
time_lock_delay_hours=new_limits.get("time_lock_delay_hours", 24),
updated_at=datetime.now(datetime.UTC),
updated_at=datetime.now(timezone.utc),
updated_by=guardian_address
)
session.add(limits)
@@ -361,7 +361,7 @@ class PersistentSpendingTracker:
if existing:
existing.is_active = True
existing.added_at = datetime.now(datetime.UTC)
existing.added_at = datetime.now(timezone.utc)
existing.added_by = added_by
else:
auth = GuardianAuthorization(
@@ -369,7 +369,7 @@ class PersistentSpendingTracker:
agent_address=agent_address,
guardian_address=guardian_address,
is_active=True,
added_at=datetime.now(datetime.UTC),
added_at=datetime.now(timezone.utc),
added_by=added_by
)
session.add(auth)
@@ -415,7 +415,7 @@ class PersistentSpendingTracker:
Spending summary
"""
agent_address = to_checksum_address(agent_address)
now = datetime.now(datetime.UTC)
now = datetime.now(timezone.utc)
# Get current spending
current_spent = {

View File

@@ -1,7 +1,7 @@
"""Cross-chain synchronization for testing multi-chain scenarios."""
import asyncio
from datetime import datetime, UTC
from datetime import datetime, timezone
from typing import Any, Dict, List

View File

@@ -4,7 +4,7 @@ import asyncio
import json
import time
from typing import Any, Dict, Optional, List
from datetime import datetime, UTC, timedelta
from datetime import datetime, timezone, timedelta
from fastapi import APIRouter, HTTPException, status
from pydantic import BaseModel, Field, model_validator
@@ -478,12 +478,12 @@ async def submit_marketplace_transaction(tx_data: Dict[str, Any]) -> Dict[str, A
sender=sender_addr,
recipient=recipient_addr,
payload=tx_data.get("payload", {}),
created_at=datetime.now(datetime.UTC),
created_at=datetime.now(timezone.utc),
nonce=tx_nonce,
value=amount,
fee=fee,
status="pending",
timestamp=datetime.now(datetime.UTC).isoformat()
timestamp=datetime.now(timezone.utc).isoformat()
)
session.add(transaction)
@@ -798,9 +798,9 @@ async def import_block(block_data: dict) -> Dict[str, Any]:
try:
timestamp = datetime.fromisoformat(timestamp.replace('Z', '+00:00'))
except ValueError:
timestamp = datetime.now(datetime.UTC)
timestamp = datetime.now(timezone.utc)
elif timestamp is None:
timestamp = datetime.now(datetime.UTC)
timestamp = datetime.now(timezone.utc)
with session_scope(chain_id) as session:
# Check for hash conflicts across chains
@@ -1046,7 +1046,7 @@ async def import_chain(import_data: dict) -> Dict[str, Any]:
_logger.info(f"Importing {len(unique_blocks)} unique blocks (filtered from {len(blocks)} total)")
for block_data in unique_blocks:
block_timestamp = _parse_datetime_value(block_data.get("timestamp"), "block timestamp") or datetime.now(datetime.UTC)
block_timestamp = _parse_datetime_value(block_data.get("timestamp"), "block timestamp") or datetime.now(timezone.utc)
block = Block(
chain_id=chain_id,
height=block_data["height"],

View File

@@ -11,7 +11,7 @@ from typing import Dict, List, Optional, Tuple
from sqlmodel import Session, select
from sqlalchemy import select, text
from datetime import datetime, UTC
from datetime import datetime, timezone
from ..models import Account, Transaction, Receipt
from ..logger import get_logger
@@ -242,7 +242,7 @@ class StateTransition:
# Update receipt status
receipt.status = "claimed"
receipt.claimed_at = datetime.now(datetime.UTC)
receipt.claimed_at = datetime.now(timezone.utc)
receipt.claimed_by = sender_addr
logger.info(

View File

@@ -8,7 +8,7 @@ import hmac
import json
import time
from dataclasses import dataclass
from datetime import datetime, UTC
from datetime import datetime, timezone
from typing import Any, Dict, List, Optional, Tuple
import httpx
@@ -508,9 +508,9 @@ class ChainSync:
block_hash = block_data["hash"]
timestamp_str = block_data.get("timestamp", "")
try:
timestamp = datetime.fromisoformat(timestamp_str) if timestamp_str else datetime.now(datetime.UTC)
timestamp = datetime.fromisoformat(timestamp_str) if timestamp_str else datetime.now(timezone.utc)
except (ValueError, TypeError):
timestamp = datetime.now(datetime.UTC)
timestamp = datetime.now(timezone.utc)
tx_count = block_data.get("tx_count", 0)
if transactions:

View File

@@ -5,7 +5,7 @@ from __future__ import annotations
import sys
import asyncio
import pytest
from datetime import datetime, UTC, timedelta
from datetime import datetime, timezone, timedelta
from unittest.mock import AsyncMock, Mock, patch
from typing import Generator
@@ -192,7 +192,7 @@ class TestPoAProposer:
hash="0xparent",
parent_hash="0x00",
proposer="previous-proposer",
timestamp=datetime.now(datetime.UTC),
timestamp=datetime.now(timezone.utc),
tx_count=0,
)
test_db.add(parent)
@@ -231,16 +231,16 @@ class TestPoAProposer:
hash="0xhead",
parent_hash="0x00",
proposer="test-proposer",
timestamp=datetime.now(datetime.UTC),
timestamp=datetime.now(timezone.utc),
tx_count=0,
)
test_db.add(head)
test_db.commit()
# Should wait for the configured interval
start_time = datetime.now(datetime.UTC)
start_time = datetime.now(timezone.utc)
await proposer._wait_until_next_slot()
elapsed = (datetime.now(datetime.UTC) - start_time).total_seconds()
elapsed = (datetime.now(timezone.utc) - start_time).total_seconds()
# Should wait at least some time (but less than full interval since block is recent)
assert elapsed >= 0.1
@@ -255,7 +255,7 @@ class TestPoAProposer:
hash="0xhead",
parent_hash="0x00",
proposer="test-proposer",
timestamp=datetime.now(datetime.UTC) - timedelta(seconds=10),
timestamp=datetime.now(timezone.utc) - timedelta(seconds=10),
tx_count=0,
)
test_db.add(head)
@@ -263,9 +263,9 @@ class TestPoAProposer:
# Set stop event and wait
proposer._stop_event.set()
start_time = datetime.now(datetime.UTC)
start_time = datetime.now(timezone.utc)
await proposer._wait_until_next_slot()
elapsed = (datetime.now(datetime.UTC) - start_time).total_seconds()
elapsed = (datetime.now(timezone.utc) - start_time).total_seconds()
# Should return immediately due to stop event
assert elapsed < 0.1
@@ -290,7 +290,7 @@ class TestPoAProposer:
"""Test block hash computation."""
height = 1
parent_hash = "0xparent"
timestamp = datetime.now(datetime.UTC)
timestamp = datetime.now(timezone.utc)
processed_txs = []
block_hash = proposer._compute_block_hash(height, parent_hash, timestamp, processed_txs)
@@ -303,7 +303,7 @@ class TestPoAProposer:
"""Test block hash computation with transactions."""
height = 1
parent_hash = "0xparent"
timestamp = datetime.now(datetime.UTC)
timestamp = datetime.now(timezone.utc)
mock_tx = Mock()
mock_tx.tx_hash = "0xtx"
@@ -324,7 +324,7 @@ class TestPoAProposer:
hash="0xexisting",
parent_hash="0x00",
proposer="test-proposer",
timestamp=datetime.now(datetime.UTC),
timestamp=datetime.now(timezone.utc),
tx_count=0,
)
test_db.add(block)

View File

@@ -6,7 +6,7 @@ import sys
import pytest
import tempfile
import shutil
from datetime import datetime, UTC, timedelta
from datetime import datetime, timezone, timedelta
from pathlib import Path
from unittest.mock import patch, Mock
from typing import Generator
@@ -113,7 +113,7 @@ class TestGuardianContract:
def test_spending_limit_check_hourly(self, guardian_contract: GuardianContract) -> None:
"""Test hourly spending limit."""
# Add some spending history
base_time = datetime.now(datetime.UTC)
base_time = datetime.now(timezone.utc)
guardian_contract.spending_history = [
{
"operation_id": "op1",
@@ -139,7 +139,7 @@ class TestGuardianContract:
def test_spending_limit_check_daily(self, guardian_contract: GuardianContract) -> None:
"""Test daily spending limit."""
# Add spending history across the day
base_time = datetime.now(datetime.UTC)
base_time = datetime.now(timezone.utc)
guardian_contract.spending_history = [
{
"operation_id": "op1",
@@ -165,7 +165,7 @@ class TestGuardianContract:
def test_spending_limit_check_weekly(self, guardian_contract: GuardianContract) -> None:
"""Test weekly spending limit."""
# Add spending history across the week
base_time = datetime.now(datetime.UTC)
base_time = datetime.now(timezone.utc)
guardian_contract.spending_history = [
{
"operation_id": "op1",

View File

@@ -4,7 +4,7 @@ import hashlib
import time
import sys
import pytest
from datetime import datetime, UTC
from datetime import datetime, timezone
from contextlib import contextmanager
from unittest.mock import AsyncMock, Mock
@@ -70,7 +70,7 @@ class TestProposerSignatureValidator:
def test_valid_block(self):
v = ProposerSignatureValidator()
ts = datetime.now(datetime.UTC)
ts = datetime.now(timezone.utc)
bh = _make_block_hash("test", 1, "0x00", ts)
ok, reason = v.validate_block_signature({
"height": 1, "hash": bh, "parent_hash": "0x00",
@@ -83,7 +83,7 @@ class TestProposerSignatureValidator:
v = ProposerSignatureValidator()
ok, reason = v.validate_block_signature({
"height": 1, "hash": "0x" + "a" * 64, "parent_hash": "0x00",
"timestamp": datetime.now(datetime.UTC).isoformat(),
"timestamp": datetime.now(timezone.utc).isoformat(),
})
assert ok is False
assert "Missing proposer" in reason
@@ -92,7 +92,7 @@ class TestProposerSignatureValidator:
v = ProposerSignatureValidator()
ok, reason = v.validate_block_signature({
"height": 1, "hash": "badhash", "parent_hash": "0x00",
"proposer": "node-a", "timestamp": datetime.now(datetime.UTC).isoformat(),
"proposer": "node-a", "timestamp": datetime.now(timezone.utc).isoformat(),
})
assert ok is False
assert "Invalid block hash" in reason
@@ -101,14 +101,14 @@ class TestProposerSignatureValidator:
v = ProposerSignatureValidator()
ok, reason = v.validate_block_signature({
"height": 1, "hash": "0xabc", "parent_hash": "0x00",
"proposer": "node-a", "timestamp": datetime.now(datetime.UTC).isoformat(),
"proposer": "node-a", "timestamp": datetime.now(timezone.utc).isoformat(),
})
assert ok is False
assert "Invalid hash length" in reason
def test_untrusted_proposer_rejected(self):
v = ProposerSignatureValidator(trusted_proposers=["node-a", "node-b"])
ts = datetime.now(datetime.UTC)
ts = datetime.now(timezone.utc)
bh = _make_block_hash("test", 1, "0x00", ts)
ok, reason = v.validate_block_signature({
"height": 1, "hash": bh, "parent_hash": "0x00",
@@ -119,7 +119,7 @@ class TestProposerSignatureValidator:
def test_trusted_proposer_accepted(self):
v = ProposerSignatureValidator(trusted_proposers=["node-a"])
ts = datetime.now(datetime.UTC)
ts = datetime.now(timezone.utc)
bh = _make_block_hash("test", 1, "0x00", ts)
ok, reason = v.validate_block_signature({
"height": 1, "hash": bh, "parent_hash": "0x00",
@@ -149,7 +149,7 @@ class TestChainSyncAppend:
def test_append_to_empty_chain(self, session_factory):
sync = ChainSync(session_factory, chain_id="test", validate_signatures=False)
ts = datetime.now(datetime.UTC)
ts = datetime.now(timezone.utc)
bh = _make_block_hash("test", 0, "0x00", ts)
result = sync.import_block({
"height": 0, "hash": bh, "parent_hash": "0x00",
@@ -316,7 +316,7 @@ class TestChainSyncSignatureValidation:
def test_untrusted_proposer_rejected_on_import(self, session_factory):
validator = ProposerSignatureValidator(trusted_proposers=["node-a"])
sync = ChainSync(session_factory, chain_id="test", validator=validator, validate_signatures=True)
ts = datetime.now(datetime.UTC)
ts = datetime.now(timezone.utc)
bh = _make_block_hash("test", 0, "0x00", ts)
result = sync.import_block({
"height": 0, "hash": bh, "parent_hash": "0x00",
@@ -328,7 +328,7 @@ class TestChainSyncSignatureValidation:
def test_trusted_proposer_accepted_on_import(self, session_factory):
validator = ProposerSignatureValidator(trusted_proposers=["node-a"])
sync = ChainSync(session_factory, chain_id="test", validator=validator, validate_signatures=True)
ts = datetime.now(datetime.UTC)
ts = datetime.now(timezone.utc)
bh = _make_block_hash("test", 0, "0x00", ts)
result = sync.import_block({
"height": 0, "hash": bh, "parent_hash": "0x00",
@@ -339,7 +339,7 @@ class TestChainSyncSignatureValidation:
def test_validation_disabled(self, session_factory):
validator = ProposerSignatureValidator(trusted_proposers=["node-a"])
sync = ChainSync(session_factory, chain_id="test", validator=validator, validate_signatures=False)
ts = datetime.now(datetime.UTC)
ts = datetime.now(timezone.utc)
bh = _make_block_hash("test", 0, "0x00", ts)
result = sync.import_block({
"height": 0, "hash": bh, "parent_hash": "0x00",
@@ -379,7 +379,7 @@ class TestSyncMetrics:
def test_accepted_block_increments_metrics(self, session_factory):
sync = ChainSync(session_factory, chain_id="test", validate_signatures=False)
ts = datetime.now(datetime.UTC)
ts = datetime.now(timezone.utc)
bh = _make_block_hash("test", 0, "0x00", ts)
sync.import_block({
"height": 0, "hash": bh, "parent_hash": "0x00",
@@ -392,7 +392,7 @@ class TestSyncMetrics:
def test_rejected_block_increments_metrics(self, session_factory):
validator = ProposerSignatureValidator(trusted_proposers=["node-a"])
sync = ChainSync(session_factory, chain_id="test", validator=validator, validate_signatures=True)
ts = datetime.now(datetime.UTC)
ts = datetime.now(timezone.utc)
bh = _make_block_hash("test", 0, "0x00", ts)
sync.import_block({
"height": 0, "hash": bh, "parent_hash": "0x00",