```
chore: refactor logging module, update genesis timestamp, remove model relationships, and reorganize routers - Rename logging.py to logger.py and update import paths in poa.py and main.py - Update devnet genesis timestamp to 1766828620 - Remove SQLModel Relationship declarations from Block, Transaction, and Receipt models - Add SessionDep type alias and get_session dependency in coordinator-api deps - Reorganize coordinator-api routers: replace explorer/registry with exchange, users, marketplace
This commit is contained in:
@ -9,7 +9,7 @@ from typing import Callable, ContextManager, Optional
|
||||
|
||||
from sqlmodel import Session, select
|
||||
|
||||
from ..logging import get_logger
|
||||
from ..logger import get_logger
|
||||
from ..metrics import metrics_registry
|
||||
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@ from typing import Optional
|
||||
from .config import settings
|
||||
from .consensus import PoAProposer, ProposerConfig
|
||||
from .database import init_db, session_scope
|
||||
from .logging import get_logger
|
||||
from .logger import get_logger
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
|
||||
@ -8,6 +8,7 @@ from pydantic import field_validator
|
||||
from sqlalchemy import Column
|
||||
from sqlalchemy.types import JSON
|
||||
from sqlmodel import Field, Relationship, SQLModel
|
||||
from sqlalchemy.orm import Mapped
|
||||
|
||||
_HEX_PATTERN = re.compile(r"^(0x)?[0-9a-fA-F]+$")
|
||||
|
||||
@ -34,9 +35,6 @@ class Block(SQLModel, table=True):
|
||||
tx_count: int = 0
|
||||
state_root: Optional[str] = None
|
||||
|
||||
transactions: list["Transaction"] = Relationship(back_populates="block")
|
||||
receipts: list["Receipt"] = Relationship(back_populates="block")
|
||||
|
||||
@field_validator("hash", mode="before")
|
||||
@classmethod
|
||||
def _hash_is_hex(cls, value: str) -> str:
|
||||
@ -69,8 +67,6 @@ class Transaction(SQLModel, table=True):
|
||||
)
|
||||
created_at: datetime = Field(default_factory=datetime.utcnow, index=True)
|
||||
|
||||
block: Optional["Block"] = Relationship(back_populates="transactions")
|
||||
|
||||
@field_validator("tx_hash", mode="before")
|
||||
@classmethod
|
||||
def _tx_hash_is_hex(cls, value: str) -> str:
|
||||
@ -101,8 +97,6 @@ class Receipt(SQLModel, table=True):
|
||||
minted_amount: Optional[int] = None
|
||||
recorded_at: datetime = Field(default_factory=datetime.utcnow, index=True)
|
||||
|
||||
block: Optional["Block"] = Relationship(back_populates="receipts")
|
||||
|
||||
@field_validator("receipt_id", mode="before")
|
||||
@classmethod
|
||||
def _receipt_id_is_hex(cls, value: str) -> str:
|
||||
|
||||
Reference in New Issue
Block a user