mirror of
https://github.com/logos-co/nomos-specs.git
synced 2025-02-02 18:44:11 +00:00
address CR
This commit is contained in:
parent
45bddc0e21
commit
62ea40ba5e
@ -82,7 +82,10 @@ class MockLeaderProof:
|
|||||||
# TODO: verification not implemented
|
# TODO: verification not implemented
|
||||||
return True
|
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.commitment)
|
||||||
hasher.update(self.nullifier)
|
hasher.update(self.nullifier)
|
||||||
|
|
||||||
@ -118,7 +121,7 @@ class BlockHeader:
|
|||||||
h.update(self.parent)
|
h.update(self.parent)
|
||||||
|
|
||||||
# TODO: Leader proof component of block id is mocked here until CL is understood
|
# 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()
|
return h.digest()
|
||||||
|
|
||||||
@ -176,7 +179,7 @@ class Follower:
|
|||||||
stake_distribution_snapshot=genesis_state,
|
stake_distribution_snapshot=genesis_state,
|
||||||
nonce_snapshot=genesis_state,
|
nonce_snapshot=genesis_state,
|
||||||
)
|
)
|
||||||
self.ledger_state_snapshot = genesis_state
|
self.genesis_state = genesis_state
|
||||||
self.ledger_state = genesis_state
|
self.ledger_state = genesis_state
|
||||||
|
|
||||||
def validate_header(self, block: BlockHeader) -> bool:
|
def validate_header(self, block: BlockHeader) -> bool:
|
||||||
@ -241,7 +244,7 @@ class Follower:
|
|||||||
else:
|
else:
|
||||||
# we have re-org'd, therefore we must roll back out ledger state and
|
# we have re-org'd, therefore we must roll back out ledger state and
|
||||||
# re-apply blocks from the new chain
|
# 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:
|
for block in new_chain.blocks:
|
||||||
ledger_state.apply(block)
|
ledger_state.apply(block)
|
||||||
|
|
||||||
|
@ -3,13 +3,14 @@
|
|||||||
BLOCK = HEADER CONTENT
|
BLOCK = HEADER CONTENT
|
||||||
; ------------ HEADER ---------------------
|
; ------------ HEADER ---------------------
|
||||||
VERSION = %x01
|
VERSION = %x01
|
||||||
HEADER = VERSION HEADER-UNSIGNED
|
HEADER = VERSION HEADER-UNSIGNED LEADER-PROOF
|
||||||
HEADER-UNSIGNED = %x00 HEADER-COMMON
|
HEADER-UNSIGNED = %x00 HEADER-COMMON
|
||||||
HEADER-COMMON = CONTENT-SIZE CONTENT-ID BLOCK-DATE PARENT-ID
|
HEADER-COMMON = CONTENT-SIZE CONTENT-ID BLOCK-DATE PARENT-ID
|
||||||
CONTENT-SIZE = U32
|
CONTENT-SIZE = U32
|
||||||
BLOCK-DATE = BLOCK-SLOT
|
BLOCK-DATE = BLOCK-SLOT
|
||||||
BLOCK-SLOT = U64
|
BLOCK-SLOT = U64
|
||||||
PARENT-ID = HEADER-ID
|
PARENT-ID = HEADER-ID
|
||||||
|
LEADER-PROOF = <NOT SPECIFIED YET>
|
||||||
|
|
||||||
; ------------ CONTENT --------------------
|
; ------------ CONTENT --------------------
|
||||||
CONTENT = *OCTET
|
CONTENT = *OCTET
|
||||||
|
Loading…
x
Reference in New Issue
Block a user