-
Notifications
You must be signed in to change notification settings - Fork 313
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement check and execute for LQT votes (#5033)
Closes #5032. The check and execute logic for the action handler is still missing the nullifier check, but there's an obvious insertion point for adding that logic. Testing deferred.
- Loading branch information
1 parent
3eb2418
commit 2ee34d6
Showing
7 changed files
with
175 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
crates/core/component/funding/src/component/liquidity_tournament/mod.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
pub mod nullifier; | ||
pub mod votes; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
crates/core/component/funding/src/component/liquidity_tournament/votes/mod.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use async_trait::async_trait; | ||
use cnidarium::StateWrite; | ||
use penumbra_sdk_asset::asset; | ||
use penumbra_sdk_keys::Address; | ||
|
||
use crate::component::state_key; | ||
|
||
#[async_trait] | ||
pub trait StateWriteExt: StateWrite { | ||
// Keeping this as returning a result to not have to touch other code if it changes to return an error. | ||
async fn tally( | ||
&mut self, | ||
epoch: u64, | ||
asset: asset::Id, | ||
power: u64, | ||
voter: &Address, | ||
) -> anyhow::Result<()> { | ||
self.nonverifiable_put_raw( | ||
state_key::lqt::v1::votes::receipt(epoch, asset, power, voter).to_vec(), | ||
Vec::default(), | ||
); | ||
Ok(()) | ||
} | ||
} | ||
|
||
impl<T: StateWrite + ?Sized> StateWriteExt for T {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters