diff --git a/cryptarchia/cryptarchia.py b/cryptarchia/cryptarchia.py index 47ec032..736af21 100644 --- a/cryptarchia/cryptarchia.py +++ b/cryptarchia/cryptarchia.py @@ -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) diff --git a/cryptarchia/messages.abnf b/cryptarchia/messages.abnf index 1f828fe..ef3e7c5 100644 --- a/cryptarchia/messages.abnf +++ b/cryptarchia/messages.abnf @@ -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 = ; ------------ CONTENT -------------------- CONTENT = *OCTET