Merge pull request #1663 from zcash/pczt-no-std

pczt: Enable the base crate to be no-std compatible
This commit is contained in:
Jack Grigg 2024-12-17 17:23:07 +13:00 committed by GitHub
commit 8c59e25d79
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 33 additions and 12 deletions

View File

@ -21,7 +21,7 @@ rand_core = { workspace = true, optional = true }
# Encoding
postcard = { version = "1", features = ["alloc"] }
serde.workspace = true
serde_with = "3"
serde_with = { version = "3", default-features = false, features = ["alloc", "macros"] }
# Payment protocols
# - Transparent

View File

@ -1,4 +1,6 @@
use std::collections::BTreeMap;
use alloc::collections::BTreeMap;
use alloc::string::String;
use alloc::vec::Vec;
use getset::Getters;
use serde::{Deserialize, Serialize};
@ -199,7 +201,7 @@ pub(crate) struct Zip32Derivation {
#[cfg(test)]
mod tests {
use std::collections::BTreeMap;
use alloc::collections::BTreeMap;
use super::Global;

View File

@ -41,6 +41,13 @@
//! - Transaction Extractor (anyone can execute)
//! - Creates bindingSig and extracts the final transaction.
#![no_std]
#[macro_use]
extern crate alloc;
use alloc::vec::Vec;
use getset::Getters;
use serde::{Deserialize, Serialize};

View File

@ -1,4 +1,7 @@
use std::{cmp::Ordering, collections::BTreeMap};
use alloc::collections::BTreeMap;
use alloc::string::String;
use alloc::vec::Vec;
use core::cmp::Ordering;
#[cfg(feature = "orchard")]
use ff::PrimeField;

View File

@ -1,4 +1,5 @@
use std::collections::BTreeMap;
use alloc::collections::BTreeMap;
use alloc::vec::Vec;
use crate::Pczt;

View File

@ -1,4 +1,4 @@
use std::collections::BTreeMap;
use alloc::collections::BTreeMap;
use crate::{
common::{

View File

@ -278,7 +278,7 @@ impl Authorization for EffectsOnly {
type SaplingAuth = sapling::bundle::EffectsOnly;
type OrchardAuth = orchard::bundle::EffectsOnly;
#[cfg(zcash_unstable = "zfuture")]
type TzeAuth = std::convert::Infallible;
type TzeAuth = core::convert::Infallible;
}
/// Errors that can occur while creating signatures for a PCZT.

View File

@ -1,4 +1,4 @@
use std::marker::PhantomData;
use core::marker::PhantomData;
use rand_core::OsRng;
use zcash_primitives::{
@ -155,7 +155,7 @@ impl Authorization for Unbound {
type SaplingAuth = ::sapling::pczt::Unbound;
type OrchardAuth = ::orchard::pczt::Unbound;
#[cfg(zcash_unstable = "zfuture")]
type TzeAuth = std::convert::Infallible;
type TzeAuth = core::convert::Infallible;
}
/// Errors that can occur while extracting a transaction from a PCZT.

View File

@ -1,3 +1,6 @@
use alloc::string::String;
use alloc::vec::Vec;
use crate::{common::Global, Pczt};
#[cfg(feature = "orchard")]

View File

@ -1,5 +1,7 @@
use std::cmp::Ordering;
use std::collections::BTreeMap;
use alloc::collections::BTreeMap;
use alloc::string::String;
use alloc::vec::Vec;
use core::cmp::Ordering;
use getset::Getters;
use serde::{Deserialize, Serialize};

View File

@ -1,4 +1,7 @@
use std::{cmp::Ordering, collections::BTreeMap};
use alloc::collections::BTreeMap;
use alloc::string::String;
use alloc::vec::Vec;
use core::cmp::Ordering;
use crate::{
common::{Global, Zip32Derivation},