add back commitment to the proof to pass tests
This commit is contained in:
parent
f6fff116ac
commit
0ed2cd8aae
|
@ -174,6 +174,8 @@ class Coin:
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class LeaderProof:
|
class LeaderProof:
|
||||||
|
# TODO: remove the useless commitment field
|
||||||
|
commitment: Id
|
||||||
nullifier: Id
|
nullifier: Id
|
||||||
evolved_commitment: Id
|
evolved_commitment: Id
|
||||||
slot: Slot
|
slot: Slot
|
||||||
|
@ -204,6 +206,7 @@ class LeaderProof:
|
||||||
evolved_coin = coin.evolve()
|
evolved_coin = coin.evolve()
|
||||||
|
|
||||||
return LeaderProof( # TODO: generate the proof with risc0
|
return LeaderProof( # TODO: generate the proof with risc0
|
||||||
|
commitment=coin.commitment(),
|
||||||
nullifier=coin_nullifier,
|
nullifier=coin_nullifier,
|
||||||
evolved_commitment=evolved_coin.commitment(),
|
evolved_commitment=evolved_coin.commitment(),
|
||||||
slot=slot,
|
slot=slot,
|
||||||
|
@ -247,6 +250,8 @@ class BlockHeader:
|
||||||
h.update(self.parent)
|
h.update(self.parent)
|
||||||
|
|
||||||
# leader proof
|
# leader proof
|
||||||
|
assert len(self.leader_proof.commitment) == 32
|
||||||
|
h.update(self.leader_proof.commitment)
|
||||||
assert len(self.leader_proof.nullifier) == 32
|
assert len(self.leader_proof.nullifier) == 32
|
||||||
h.update(self.leader_proof.nullifier)
|
h.update(self.leader_proof.nullifier)
|
||||||
assert len(self.leader_proof.evolved_commitment) == 32
|
assert len(self.leader_proof.evolved_commitment) == 32
|
||||||
|
@ -473,11 +478,11 @@ class Follower:
|
||||||
threshold_0, threshold_1 = lottery_threshold(self.config.active_slot_coeff, epoch_state.total_active_stake())
|
threshold_0, threshold_1 = lottery_threshold(self.config.active_slot_coeff, epoch_state.total_active_stake())
|
||||||
return (
|
return (
|
||||||
proof.verify(slot, current_state.nonce, threshold_0, threshold_1, current_state.commitments_lead, parent) # verify slot leader proof
|
proof.verify(slot, current_state.nonce, threshold_0, threshold_1, current_state.commitments_lead, parent) # verify slot leader proof
|
||||||
# Membership verification is included in the proof verification along with the PoS lottery:
|
# TODO: remove it because membership verification is included in the proof verification along with the PoS lottery:
|
||||||
#and (
|
and (
|
||||||
# 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)
|
and current_state.verify_unspent(proof.nullifier)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue