Skip to content

Commit

Permalink
Commit-encode for bulletproofs
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Jan 19, 2021
1 parent 98e4b55 commit 4717dc1
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 25 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
matrix:
feature:
- elgamal
- bulletproofs
- serde
steps:
- uses: actions/checkout@v2
Expand Down
27 changes: 14 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lnpbp"
version = "0.3.0-beta.1+1"
version = "0.3.0-beta.1+5"
license = "MIT"
authors = ["Dr. Maxim Orlovsky <[email protected]>"]
description = "LNP/BP Core Library implementing LNPBP specifications & standards"
Expand Down Expand Up @@ -64,11 +64,12 @@ lazy_static = "~1.4.0"
# ========
[features]
default = []
all = ["serde", "elgamal"]
all = ["serde", "elgamal", "bulletproofs"]
serde = ["serde_crate", "serde_with", "serde_with_macros", "amplify/serde",
"bitcoin/use-serde", "bitcoin_hashes/serde", "miniscript/serde",
"descriptor-wallet/serde"]
elgamal = [] # Provides ElGamal encryption module from this library
bulletproofs = ["client_side_validation/bulletproofs"]

[workspace]
members = [".", "strict_encoding", "strict_encoding/derive", "client_side_validation"]
Expand Down
6 changes: 5 additions & 1 deletion client_side_validation/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "client_side_validation"
version = "1.0.0-rc.2"
version = "1.0.0-rc.2+1"
license = "Apache-2.0"
authors = ["Dr. Maxim Orlovsky <[email protected]>"]
description = "Client-side validation library"
Expand All @@ -22,5 +22,9 @@ amplify = "3"
amplify_derive = "2.4.3"
strict_encoding = { version = "1.0.0-rc.3", features = [] }
bitcoin_hashes = "0.9"
grin_secp256k1zkp = { version = "0.7", optional = true }

[features]
default = []
all = ["bulletproofs"]
bulletproofs = ["grin_secp256k1zkp"]
2 changes: 1 addition & 1 deletion contrib/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ AS_DEPENDENCY=true
DO_LINT=true

# Library components
FEATURES="serde elgamal"
FEATURES="serde elgamal bulletproofs"


# Use toolchain if explicitly specified
Expand Down
2 changes: 1 addition & 1 deletion strict_encoding/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "strict_encoding"
version = "1.0.0-rc.6"
version = "1.0.0-rc.6+2"
license = "Apache-2.0"
authors = ["Dr. Maxim Orlovsky <[email protected]>"]
description = "Strict encoding: deterministic binary serialization for networking & client-side validation"
Expand Down
2 changes: 1 addition & 1 deletion strict_encoding/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ macro_rules! impl_enum_strict_encoding {
}
}

impl $crate::strict_encoding::StrictDecode for $type {
impl ::strict_encoding::StrictDecode for $type {
#[inline]
fn strict_decode<D: ::std::io::Read>(
d: D,
Expand Down
12 changes: 6 additions & 6 deletions strict_encoding/src/test_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ macro_rules! test_enum_u8_exhaustive {
for x in 0..=core::u8::MAX {
if !set.contains(&x) {
assert_eq!($enum::from_u8(x), None);
let decoded: Result<$enum, _> = $crate::strict_encoding::strict_deserialize(&[x]);
assert_eq!(decoded.unwrap_err(), $crate::strict_encoding::Error::EnumValueNotKnown(stringify!($enum).to_string(), x));
let decoded: Result<$enum, _> = ::strict_encoding::strict_deserialize(&[x]);
assert_eq!(decoded.unwrap_err(), ::strict_encoding::Error::EnumValueNotKnown(stringify!($enum).to_string(), x));
}
}
let mut all = ::std::collections::BTreeSet::new();
Expand All @@ -43,8 +43,8 @@ macro_rules! test_enum_u8_exhaustive {
assert!(a < b);
}
}
$( assert_eq!($crate::strict_encoding::strict_serialize(&$item).unwrap(), &[$val]); )+
$( assert_eq!($item, $crate::strict_encoding::strict_deserialize(&[$val]).unwrap()); )+
$( assert_eq!(::strict_encoding::strict_serialize(&$item).unwrap(), &[$val]); )+
$( assert_eq!($item, ::strict_encoding::strict_deserialize(&[$val]).unwrap()); )+
} };
}

Expand All @@ -55,7 +55,7 @@ macro_rules! test_encode {
{
$(
let object = <$ty>::strict_decode(&$x[..]).unwrap();
test_suite(&object, &$x[..], $x.to_vec().len());
::strict_encoding::test_helpers::test_suite(&object, &$x[..], $x.to_vec().len());
)*
}
);
Expand All @@ -72,7 +72,7 @@ macro_rules! test_garbage_exhaustive {
cp[0] = byte as u8;
assert_eq!(
<$ty>::strict_decode(&cp[..]).unwrap_err(),
internet2::strict_encoding::Error::EnumValueNotKnown($err.to_string(), byte)
::strict_encoding::Error::EnumValueNotKnown($err.to_string(), byte)
);
}
)+}
Expand Down

0 comments on commit 4717dc1

Please sign in to comment.