From f50838e9ce48027dce5b32354b36381ffb88717e Mon Sep 17 00:00:00 2001 From: David Rusu Date: Fri, 21 Mar 2025 15:26:27 +0400 Subject: [PATCH] cryptarchia fix nonce contribution derivation --- cryptarchia/cryptarchia.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/cryptarchia/cryptarchia.py b/cryptarchia/cryptarchia.py index fe51801..8bfcebd 100644 --- a/cryptarchia/cryptarchia.py +++ b/cryptarchia/cryptarchia.py @@ -184,7 +184,12 @@ class MockLeaderProof: parent: Hash def epoch_nonce_contribution(self) -> Hash: - return Hash(b"NOMOS_NONCE_CONTRIB", self.slot.encode(), self.note.nullifier()) + return Hash( + b"NOMOS_NONCE_CONTRIB", + self.slot.encode(), + self.note.commitment(), + self.encode_sk(), + ) def verify( self, slot: Slot, parent: Hash, commitments: set[Hash], nullifiers: set[Hash] @@ -238,10 +243,7 @@ class LedgerState: # This nonce is used to derive the seed for the slot leader lottery. # It's updated at every block by hashing the previous nonce with the - # leader proof's nullifier. - # - # NOTE that this does not prevent nonce grinding at the last slot - # when the nonce snapshot is taken + # leader proof's nonce contribution nonce: Hash = None # set of note commitments