cryptarchia: remove debug log
This commit is contained in:
parent
155ac242c3
commit
ee2c36bc29
|
@ -195,13 +195,7 @@ class MockLeaderProof:
|
||||||
|
|
||||||
def verify(self, slot: Slot, parent: Id):
|
def verify(self, slot: Slot, parent: Id):
|
||||||
# TODO: verification not implemented
|
# TODO: verification not implemented
|
||||||
if slot != self.slot:
|
return slot == self.slot and parent == self.parent
|
||||||
logger.warning("PoL: wrong slot")
|
|
||||||
return False
|
|
||||||
if parent != self.parent:
|
|
||||||
logger.warning("PoL: wrong parent")
|
|
||||||
return False
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
@ -213,12 +207,6 @@ class BlockHeader:
|
||||||
leader_proof: MockLeaderProof
|
leader_proof: MockLeaderProof
|
||||||
orphaned_proofs: List["BlockHeader"] = field(default_factory=list)
|
orphaned_proofs: List["BlockHeader"] = field(default_factory=list)
|
||||||
|
|
||||||
def __post_init__(self):
|
|
||||||
assert type(self.slot) == Slot
|
|
||||||
assert type(self.parent) == Id
|
|
||||||
assert self.slot == self.leader_proof.slot
|
|
||||||
assert self.parent == self.leader_proof.parent
|
|
||||||
|
|
||||||
def update_header_hash(self, h):
|
def update_header_hash(self, h):
|
||||||
# version byte
|
# version byte
|
||||||
h.update(b"\x01")
|
h.update(b"\x01")
|
||||||
|
@ -388,7 +376,8 @@ class Follower:
|
||||||
|
|
||||||
current_state = self.ledger_state[block.parent].copy()
|
current_state = self.ledger_state[block.parent].copy()
|
||||||
|
|
||||||
# we use the proposed block epoch state to validate orphans as well
|
# We use the proposed block epoch state to validate orphans as well.
|
||||||
|
# For very old orphans, these states may be different.
|
||||||
epoch_state = self.compute_epoch_state(
|
epoch_state = self.compute_epoch_state(
|
||||||
block.slot.epoch(self.config), block.parent
|
block.slot.epoch(self.config), block.parent
|
||||||
)
|
)
|
||||||
|
@ -443,21 +432,14 @@ class Follower:
|
||||||
# This will change once we start putting merkle roots in headers
|
# This will change once we start putting merkle roots in headers
|
||||||
current_state: LedgerState,
|
current_state: LedgerState,
|
||||||
) -> bool:
|
) -> bool:
|
||||||
if not proof.verify(slot, parent):
|
return (
|
||||||
logger.warning("invalid PoL")
|
proof.verify(slot, parent) # verify slot leader proof
|
||||||
return False
|
and (
|
||||||
if not (
|
current_state.verify_eligible_to_lead(proof.commitment)
|
||||||
current_state.verify_eligible_to_lead(proof.commitment)
|
or epoch_state.verify_eligible_to_lead_due_to_age(proof.commitment)
|
||||||
or epoch_state.verify_eligible_to_lead_due_to_age(proof.commitment)
|
)
|
||||||
):
|
and current_state.verify_unspent(proof.nullifier)
|
||||||
logger.warning("invalid commitment")
|
)
|
||||||
return False
|
|
||||||
|
|
||||||
if not current_state.verify_unspent(proof.nullifier):
|
|
||||||
logger.warning("PoL coin already spent")
|
|
||||||
return False
|
|
||||||
|
|
||||||
return True
|
|
||||||
|
|
||||||
def on_block(self, block: BlockHeader):
|
def on_block(self, block: BlockHeader):
|
||||||
if block.id() in self.ledger_state:
|
if block.id() in self.ledger_state:
|
||||||
|
|
Loading…
Reference in New Issue