Skip to content

Commit

Permalink
Model {Value,Asset,Nonce}::Confidential using secp256k1-zkp types
Browse files Browse the repository at this point in the history
This patch introduces a _breaking_ change in the (de)serialisation of
confidential assets, confidential values and confidential nonces. In
particular, we now support both readable and compact serialization,
and they both include a serialization prefix `2` as opposed to the old
prefix which is now part of the inner condifential value, since that
is controlled by secp256k1-zkp. We choose the number `2` since we were
already using `0` for null values and `1` for explicit values.

We also had to modify some of the test data now that `secp256k1-zkp` is
validating for us that the confidential assets are actually valid
generators.
  • Loading branch information
luckysori committed Apr 9, 2021
1 parent f8fa967 commit 285f565
Show file tree
Hide file tree
Showing 6 changed files with 697 additions and 269 deletions.
6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ default = [ "json-contract" ]
json-contract = [ "serde_json" ]
"serde-feature" = [
"bitcoin/use-serde",
"secp256k1-zkp/use-serde",
"serde"
]
"fuzztarget" = []

[dependencies]
bitcoin = "0.26"
secp256k1-zkp = { version = "0.2", features = [ "global-context", "hashes" ] }
slip21 = "0.2.0"

# While this dependency is included in bitcoin, we need this to use the macros.
Expand All @@ -37,3 +39,7 @@ rand = "0.6.5"
serde_test = "1.0"
serde_json = "<=1.0.44"
ryu = "<1.0.5"

[patch.crates-io]
# Until https://github.com/ElementsProject/rust-elements/pull/70/ is merged
secp256k1-zkp = { git = "https://github.com/luckysori/rust-secp256k1-zkp", branch = "fix-pedersen-deser" }
Loading

0 comments on commit 285f565

Please sign in to comment.