address CR

This commit is contained in:
David Rusu 2024-02-01 20:25:49 +04:00
parent 45bddc0e21
commit 62ea40ba5e
2 changed files with 9 additions and 5 deletions

View File

@ -82,7 +82,10 @@ class MockLeaderProof:
# TODO: verification not implemented
return True
def _id_update(self, hasher):
def _block_id_update(self, hasher):
# TODO: this is used to contribute to the block id, to ensure the id is dependent
# on the leader proof, but the details here are not specified yet, we're waiting on
# CL specification before we nail this down
hasher.update(self.commitment)
hasher.update(self.nullifier)
@ -118,7 +121,7 @@ class BlockHeader:
h.update(self.parent)
# TODO: Leader proof component of block id is mocked here until CL is understood
self.leader_proof._id_update(h)
self.leader_proof._block_id_update(h)
return h.digest()
@ -176,7 +179,7 @@ class Follower:
stake_distribution_snapshot=genesis_state,
nonce_snapshot=genesis_state,
)
self.ledger_state_snapshot = genesis_state
self.genesis_state = genesis_state
self.ledger_state = genesis_state
def validate_header(self, block: BlockHeader) -> bool:
@ -241,7 +244,7 @@ class Follower:
else:
# we have re-org'd, therefore we must roll back out ledger state and
# re-apply blocks from the new chain
ledger_state = self.ledger_state_snapshot.copy()
ledger_state = self.genesis_state.copy()
for block in new_chain.blocks:
ledger_state.apply(block)

View File

@ -3,13 +3,14 @@
BLOCK = HEADER CONTENT
; ------------ HEADER ---------------------
VERSION = %x01
HEADER = VERSION HEADER-UNSIGNED
HEADER = VERSION HEADER-UNSIGNED LEADER-PROOF
HEADER-UNSIGNED = %x00 HEADER-COMMON
HEADER-COMMON = CONTENT-SIZE CONTENT-ID BLOCK-DATE PARENT-ID
CONTENT-SIZE = U32
BLOCK-DATE = BLOCK-SLOT
BLOCK-SLOT = U64
PARENT-ID = HEADER-ID
LEADER-PROOF = <NOT SPECIFIED YET>
; ------------ CONTENT --------------------
CONTENT = *OCTET