Skip to content

Commit

Permalink
delegator_vote: use balance commitment to the staked note
Browse files Browse the repository at this point in the history
Co-authored-by: finch <finch@plaidfinch.net>
  • Loading branch information
erwanor and plaidfinch committed Sep 6, 2023
1 parent 6a5e30b commit b4cb9aa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
13 changes: 6 additions & 7 deletions crates/core/app/src/action_handler/actions/delegator_vote.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
use std::sync::Arc;

use anyhow::{Context, Result};
use ark_ff::Zero;
use async_trait::async_trait;
use decaf377::Fr;
use penumbra_chain::TransactionContext;
use penumbra_proof_params::DELEGATOR_VOTE_PROOF_VERIFICATION_KEY;
use penumbra_storage::{StateRead, StateWrite};
use penumbra_transaction::{
action::{DelegatorVote, DelegatorVoteBody},
IsAction,
};
use penumbra_transaction::action::{DelegatorVote, DelegatorVoteBody};

use crate::{
governance::{StateReadExt as _, StateWriteExt as _},
Expand All @@ -28,9 +27,9 @@ impl ActionHandler for DelegatorVote {
start_position,
nullifier,
rk,
unbonded_amount: _, // Used to compute the balance commitment.
value,
// Unused in stateless checks:
value: _,
unbonded_amount: _,
vote: _, // Only used when executing the vote
proposal: _, // Checked against the current open proposals statefully
},
Expand All @@ -45,7 +44,7 @@ impl ActionHandler for DelegatorVote {
.verify(
&DELEGATOR_VOTE_PROOF_VERIFICATION_KEY,
context.anchor,
self.balance_commitment(),
value.commit(Fr::zero()),
*nullifier,
*rk,
*start_position,
Expand Down
3 changes: 2 additions & 1 deletion crates/core/transaction/src/plan/action/delegator_vote.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use ark_ff::UniformRand;
use ark_ff::Zero;
use decaf377::{FieldExt, Fq, Fr};
use decaf377_rdsa::{Signature, SpendAuth};
use penumbra_asset::{Balance, Value};
Expand Down Expand Up @@ -111,7 +112,7 @@ impl DelegatorVotePlan {
*fvk.spend_verification_key(),
*fvk.nullifier_key(),
state_commitment_proof.root(),
self.balance().commit(Fr::from(0u64)),
self.staked_note.value().commit(Fr::zero()),
self.nullifier(fvk),
self.rk(fvk),
self.start_position,
Expand Down

0 comments on commit b4cb9aa

Please sign in to comment.