From 97d75bab9a5aebab86b9bc55e4a1a25cb6735a29 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Wed, 24 Feb 2021 20:07:49 +0000 Subject: [PATCH] Enforce in type system that a Bundle contains at least one Action --- Cargo.toml | 1 + src/bundle.rs | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 22ba29ed..84c0bb48 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,6 +20,7 @@ rustdoc-args = [ "--html-in-header", "katex-header.html" ] [dependencies] halo2 = { git = "https://github.com/zcash/halo2.git", branch = "main" } +nonempty = "0.6" [dev-dependencies] criterion = "0.3" diff --git a/src/bundle.rs b/src/bundle.rs index c3e828c8..3318b550 100644 --- a/src/bundle.rs +++ b/src/bundle.rs @@ -1,5 +1,7 @@ //! Structs related to bundles of Orchard actions. +use nonempty::NonEmpty; + use crate::{ circuit::Proof, note::{EncryptedNote, NoteCommitment, Nullifier}, @@ -36,7 +38,7 @@ pub struct Action { #[derive(Debug)] pub struct Bundle { anchor: Anchor, - actions: Vec, + actions: NonEmpty, value_balance: ValueSum, }