Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ members = [
"group",
"pairing",
"zcash_client_backend",
"zcash_extensions_api",
"zcash_extensions",
"zcash_history",
"zcash_primitives",
"zcash_proofs",
Expand Down
19 changes: 19 additions & 0 deletions zcash_extensions/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[package]
name = "zcash_extensions"
description = "TBD"
version = "0.0.0"
authors = ["Jack Grigg <jack@z.cash>", "Kris Nuttycombe <kris@z.cash>"]
homepage = "https://github.com/zcash/librustzcash"
repository = "https://github.com/zcash/librustzcash"
license = "MIT OR Apache-2.0"
edition = "2018"

[dependencies]
blake2b_simd = "0.5"
zcash_primitives = { version = "0.2", path = "../zcash_primitives" }

[dev-dependencies]
ff = { version = "0.6", path = "../ff" }
pairing = { version = "0.16", path = "../pairing" }
zcash_proofs = { path = "../zcash_proofs" }
rand_core = "0.5.1"
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
//! Consensus logic for Transparent Zcash Extensions.

use std::convert::TryFrom;
use zcash_extensions_api::transparent::{Error, Extension, Precondition, Witness};
use zcash_primitives::extensions::transparent::{Error, Extension, Precondition, Witness};
use zcash_primitives::transaction::components::TzeOut;
use zcash_primitives::transaction::Transaction;

use crate::extensions::transparent::demo;
use crate::transaction::components::TzeOut;
use crate::transaction::Transaction;
use crate::transparent::demo;

/// The set of programs that have assigned type IDs within the Zcash consensus rules.
#[derive(Debug, Clone, Copy)]
pub enum ExtensionId {
Demo,
}

pub struct InvalidExtId(usize);
pub struct InvalidExtId(u32);

impl TryFrom<usize> for ExtensionId {
impl TryFrom<u32> for ExtensionId {
type Error = InvalidExtId;

fn try_from(t: usize) -> Result<Self, Self::Error> {
fn try_from(t: u32) -> Result<Self, Self::Error> {
match t {
0 => Ok(ExtensionId::Demo),
n => Err(InvalidExtId(n)),
}
}
}

impl From<ExtensionId> for usize {
fn from(type_id: ExtensionId) -> usize {
impl From<ExtensionId> for u32 {
fn from(type_id: ExtensionId) -> u32 {
match type_id {
ExtensionId::Demo => 0,
}
Expand Down
2 changes: 2 additions & 0 deletions zcash_extensions/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pub mod consensus;
pub mod transparent;
3 changes: 3 additions & 0 deletions zcash_extensions/src/transparent.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
//! Zcash transparent extensions.

pub mod demo;
Loading