mirror of
https://github.com/logos-blockchain/logos-blockchain-pocs.git
synced 2026-01-17 04:23:10 +00:00
Add zone funds spending logic
First iteration of the death constraint for spending zone funds
This commit is contained in:
parent
e517ca9f00
commit
201c3810d3
@ -51,6 +51,10 @@ impl NullifierSecret {
|
||||
let commit_bytes: [u8; 32] = hasher.finalize().into();
|
||||
NullifierCommitment(commit_bytes)
|
||||
}
|
||||
|
||||
pub fn from_bytes(bytes: [u8; 16]) -> Self {
|
||||
Self(bytes)
|
||||
}
|
||||
}
|
||||
|
||||
impl NullifierCommitment {
|
||||
@ -73,6 +77,10 @@ impl NullifierNonce {
|
||||
pub fn as_bytes(&self) -> &[u8; 16] {
|
||||
&self.0
|
||||
}
|
||||
|
||||
pub fn from_bytes(bytes: [u8; 16]) -> Self {
|
||||
Self(bytes)
|
||||
}
|
||||
}
|
||||
|
||||
impl Nullifier {
|
||||
@ -86,7 +94,7 @@ impl Nullifier {
|
||||
Self(nf_bytes)
|
||||
}
|
||||
|
||||
pub(crate) fn as_bytes(&self) -> &[u8; 32] {
|
||||
pub fn as_bytes(&self) -> &[u8; 32] {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,9 +12,15 @@ const MAX_OUTPUTS: usize = 8;
|
||||
|
||||
/// The partial transaction commitment couples an input to a partial transaction.
|
||||
/// Prevents partial tx unbundling.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize)]
|
||||
pub struct PtxRoot(pub [u8; 32]);
|
||||
|
||||
impl From<[u8; 32]> for PtxRoot {
|
||||
fn from(bytes: [u8; 32]) -> Self {
|
||||
Self(bytes)
|
||||
}
|
||||
}
|
||||
|
||||
impl PtxRoot {
|
||||
pub fn random(mut rng: impl RngCore) -> Self {
|
||||
let mut sk = [0u8; 32];
|
||||
|
||||
@ -1 +1,2 @@
|
||||
pub mod input;
|
||||
pub mod zone_funds;
|
||||
|
||||
@ -7,5 +7,5 @@ edition = "2021"
|
||||
risc0-build = { version = "1.0" }
|
||||
|
||||
[package.metadata.risc0]
|
||||
methods = ["input"]
|
||||
methods = ["input", "withdraw"]
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user