diff --git a/Cargo.lock b/Cargo.lock index 9d85d5b5..6475d9a3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -11,9 +11,9 @@ dependencies = [ [[package]] name = "amplify" -version = "2.4.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90a05a371d467d56ccd699e6f5d412a3e82b09e2a1856fc64124e7a51813ca2b" +checksum = "58a0bd5c3d6605f6f0cbf90d7af2cdd37215b1db193282753fd6bd1dce4b75b3" dependencies = [ "amplify_derive", "serde", @@ -21,16 +21,6 @@ dependencies = [ "serde_yaml", "stringly_conversions", "toml", - "torut", -] - -[[package]] -name = "amplify" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58a0bd5c3d6605f6f0cbf90d7af2cdd37215b1db193282753fd6bd1dce4b75b3" -dependencies = [ - "amplify_derive", ] [[package]] @@ -66,21 +56,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" -[[package]] -name = "base32" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23ce669cd6c8588f79e15cf450314f9638f967fc5770ff1c7c1deb0925ea7cfa" - -[[package]] -name = "base64" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" -dependencies = [ - "byteorder", -] - [[package]] name = "bech32" version = "0.7.2" @@ -114,54 +89,21 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" -[[package]] -name = "block-buffer" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" -dependencies = [ - "block-padding", - "byte-tools", - "byteorder", - "generic-array 0.12.3", -] - [[package]] name = "block-buffer" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ - "generic-array 0.14.4", + "generic-array", ] -[[package]] -name = "block-padding" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" -dependencies = [ - "byte-tools", -] - -[[package]] -name = "byte-tools" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" - [[package]] name = "byteorder" version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae44d1a3d5a19df61dd0c8beb138458ac2a53a7ac09eba97d55592540004306b" -[[package]] -name = "bytes" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0dcbc35f504eb6fc275a6d20e4ebcda18cf50d40ba6fabff8c711fa16cb3b16" - [[package]] name = "cc" version = "1.0.41" @@ -187,11 +129,23 @@ dependencies = [ "winapi", ] +[[package]] +name = "client_side_validation" +version = "1.0.0-rc.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc54cd31c720c00385a36ee2fe817fede66958e349f582e3354980503d75248a" +dependencies = [ + "amplify", + "amplify_derive", + "bitcoin_hashes", + "strict_encoding 1.0.0-rc.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "client_side_validation" version = "1.0.0-rc.2" dependencies = [ - "amplify 3.0.0", + "amplify", "amplify_derive", "bitcoin_hashes", "strict_encoding 1.0.0-rc.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -212,16 +166,6 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634" -[[package]] -name = "crypto-mac" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5" -dependencies = [ - "generic-array 0.12.3", - "subtle 1.0.0", -] - [[package]] name = "curve25519-dalek" version = "3.0.2" @@ -229,9 +173,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f627126b946c25a4638eec0ea634fc52506dea98db118aae985118ce7c3d723f" dependencies = [ "byteorder", - "digest 0.9.0", + "digest", "rand_core 0.5.1", - "subtle 2.4.0", + "subtle", "zeroize 1.2.0", ] @@ -271,26 +215,20 @@ dependencies = [ ] [[package]] -name = "derive_more" -version = "0.15.0" +name = "descriptor-wallet" +version = "0.3.0-rc.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a141330240c921ec6d074a3e188a7c7ef95668bb95e7d44fa0e5778ec2a7afe" +checksum = "272eebed36ec77b9cc4c378ec6688d111b9cdfc46c06a1c5f6125ffabdc35f6f" dependencies = [ + "amplify", + "amplify_derive", + "bitcoin", "lazy_static", - "proc-macro2 0.4.30", - "quote 0.6.13", + "miniscript", "regex", - "rustc_version", - "syn 0.15.44", -] - -[[package]] -name = "digest" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" -dependencies = [ - "generic-array 0.12.3", + "serde", + "serde_with", + "strict_encoding 1.0.0-rc.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -299,7 +237,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" dependencies = [ - "generic-array 0.14.4", + "generic-array", ] [[package]] @@ -327,52 +265,22 @@ dependencies = [ "ed25519", "rand 0.7.3", "serde", - "sha2 0.9.2", + "sha2", "zeroize 1.2.0", ] -[[package]] -name = "fake-simd" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" - [[package]] name = "fnv" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - [[package]] name = "fuchsia-cprng" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" -[[package]] -name = "generic-array" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec" -dependencies = [ - "typenum", -] - [[package]] name = "generic-array" version = "0.14.4" @@ -416,16 +324,6 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "644f9158b2f133fd50f5fb3242878846d9eb792e445c893805ff0e3824006e35" -[[package]] -name = "hmac" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dcb5e64cda4c23119ab41ba960d1e170a774c8e4b9d9e6a9bc18aabf5e59695" -dependencies = [ - "crypto-mac", - "digest 0.8.1", -] - [[package]] name = "ident_case" version = "1.0.1" @@ -438,12 +336,6 @@ version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" -[[package]] -name = "keccak" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7" - [[package]] name = "lazy_static" version = "1.4.0" @@ -466,22 +358,18 @@ checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" name = "lnpbp" version = "0.3.0-alpha.3" dependencies = [ - "amplify 2.4.0", + "amplify", "amplify_derive", - "bech32", "bitcoin", "bitcoin_hashes", - "client_side_validation", + "client_side_validation 1.0.0-rc.1", + "descriptor-wallet", "lazy_static", "miniscript", - "num-derive", - "num-traits", - "regex", "serde", - "serde_json", "serde_with", "serde_with_macros", - "strict_encoding 1.0.0-rc.3", + "strict_encoding 1.0.0-rc.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -506,17 +394,6 @@ version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" -[[package]] -name = "num-derive" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" -dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.8", - "syn 1.0.58", -] - [[package]] name = "num-integer" version = "0.1.44" @@ -542,63 +419,18 @@ version = "0.2.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4eae0151b9dacf24fcc170d9995e511669a082856a91f958a2fe380bfab3fb22" -[[package]] -name = "opaque-debug" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" - [[package]] name = "opaque-debug" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" -[[package]] -name = "openssl" -version = "0.10.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "038d43985d1ddca7a9900630d8cd031b56e4794eecc2e9ea39dd17aa04399a70" -dependencies = [ - "bitflags", - "cfg-if", - "foreign-types", - "lazy_static", - "libc", - "openssl-sys", -] - -[[package]] -name = "openssl-sys" -version = "0.9.60" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "921fc71883267538946025deffb622905ecad223c28efbfdef9bb59a0175f3e6" -dependencies = [ - "autocfg 1.0.1", - "cc", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "paste" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c5d65c4d95931acda4498f675e332fcbdc9a06705cd07086c510e9b6009cd1c1" -[[package]] -name = "pin-project-lite" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439697af366c49a6d0a010c56a0d97685bc140ce0d377b13a2ea2aa42d64a827" - -[[package]] -name = "pkg-config" -version = "0.3.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" - [[package]] name = "ppv-lite86" version = "0.2.10" @@ -834,15 +666,6 @@ version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" -[[package]] -name = "rustc_version" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -dependencies = [ - "semver", -] - [[package]] name = "ryu" version = "1.0.5" @@ -869,21 +692,6 @@ dependencies = [ "cc", ] -[[package]] -name = "semver" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -dependencies = [ - "semver-parser", -] - -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" - [[package]] name = "serde" version = "1.0.119" @@ -960,48 +768,17 @@ dependencies = [ "yaml-rust", ] -[[package]] -name = "sha1" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" - -[[package]] -name = "sha2" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69" -dependencies = [ - "block-buffer 0.7.3", - "digest 0.8.1", - "fake-simd", - "opaque-debug 0.2.3", -] - [[package]] name = "sha2" version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e7aab86fe2149bad8c507606bdb3f4ef5e7b2380eb92350f56122cca72a42a8" dependencies = [ - "block-buffer 0.9.0", + "block-buffer", "cfg-if", "cpuid-bool", - "digest 0.9.0", - "opaque-debug 0.3.0", -] - -[[package]] -name = "sha3" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd26bc0e7a2e3a7c959bc494caf58b72ee0c71d67704e9520f736ca7e4853ecf" -dependencies = [ - "block-buffer 0.7.3", - "byte-tools", - "digest 0.8.1", - "keccak", - "opaque-debug 0.2.3", + "digest", + "opaque-debug", ] [[package]] @@ -1014,7 +791,7 @@ checksum = "0f0242b8e50dd9accdd56170e94ca1ebd223b098eb9c83539a6e367d0f36ae68" name = "strict_encoding" version = "1.0.0-rc.3" dependencies = [ - "amplify 3.0.0", + "amplify", "amplify_derive", "bitcoin", "chrono", @@ -1030,10 +807,11 @@ version = "1.0.0-rc.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6bd1bd070762bba6f022eefdeb4a6498db16b5906150dfcbbdfdf8b7f7a839f" dependencies = [ - "amplify 3.0.0", + "amplify", "amplify_derive", "bitcoin", "chrono", + "miniscript", "strict_encoding_derive 1.0.0-rc.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1041,7 +819,7 @@ dependencies = [ name = "strict_encoding_derive" version = "1.0.0-rc.1" dependencies = [ - "amplify 3.0.0", + "amplify", "proc-macro2 1.0.24", "quote 1.0.8", "strict_encoding 1.0.0-rc.3", @@ -1054,7 +832,7 @@ version = "1.0.0-rc.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f879c81dfff3bf07ad02d0c829598aacabc5692446eff4a5c771eb4ae59d235c" dependencies = [ - "amplify 3.0.0", + "amplify", "proc-macro2 1.0.24", "quote 1.0.8", "syn 1.0.58", @@ -1076,12 +854,6 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c" -[[package]] -name = "subtle" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" - [[package]] name = "subtle" version = "2.4.0" @@ -1154,18 +926,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "tokio" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "720ba21c25078711bf456d607987d95bce90f7c3bea5abe1db587862e7a1e87c" -dependencies = [ - "autocfg 1.0.1", - "bytes", - "memchr", - "pin-project-lite", -] - [[package]] name = "toml" version = "0.5.8" @@ -1175,28 +935,6 @@ dependencies = [ "serde", ] -[[package]] -name = "torut" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0f9ee72e91955797223909df23bab7c857abf33806fd6b2cc66726b9b16bdb6" -dependencies = [ - "base32", - "base64", - "derive_more", - "ed25519-dalek", - "hex", - "hmac", - "openssl", - "rand 0.7.3", - "serde", - "serde_derive", - "sha1", - "sha2 0.8.2", - "sha3", - "tokio", -] - [[package]] name = "typenum" version = "1.12.0" @@ -1215,12 +953,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" -[[package]] -name = "vcpkg" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b00bca6106a5e23f3eee943593759b7fcddb00554332e856d990c893966879fb" - [[package]] name = "version_check" version = "0.9.2" diff --git a/Cargo.toml b/Cargo.toml index b965d7fd..8be22f9a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ exclude = [".github", "contrib", "client_side_validation", "strict_encoding"] [lib] name = "lnpbp" path = "src/lib.rs" -crate-type = ["dylib", "rlib", "staticlib"] +crate-type = ["rlib", "staticlib"] # Dependencies # ============ @@ -34,56 +34,39 @@ crate-type = ["dylib", "rlib", "staticlib"] [dependencies] # Dependencies on other LNP/BP repositories # ----------------------------------------- -amplify = { version = "2.4", features = ["stringly_conversions"] } +amplify = { version = "3", features = ["stringly_conversions"] } amplify_derive = "2.4.3" -strict_encoding = { version = "1.0.0-rc.3", path = "./strict_encoding", features = ["miniscript", "derive"] } -client_side_validation = { version = "1.0.0-rc.2", path = "./client_side_validation" } +strict_encoding = { version = "1.0.0-rc.3", features = ["miniscript", "derive"] } +client_side_validation = { version = "1.0.0-rc.1" } # Dependencies on core rust-bitcoin ecosystem projects # ---------------------------------------------------- bitcoin = { version = "~0.26.0", features = ["rand"] } bitcoin_hashes = "~0.9.4" # we need macro from here # # We have to fix version of miniscript as required by LNPBP-2 specification -miniscript = { version = "~5.0.0", features = ["compiler"] } -bech32 = "~0.7.2" -# Core rust projects -# ------------------ -# This strange naming is a workaround for cargo inability to define required -# features for a dependency. See -# for the explanation -# and references. +miniscript = { version = "=5.0.0", features = ["compiler"] } +descriptor-wallet = "~0.3.0-rc.1" +# Serialization +# ------------- +# This strange naming is a workaround for cargo inability to define required +# features for a dependency. See +# for the explanation +# and references. serde_crate = { package = "serde", version = "~1.0.106", features = ["derive"], optional = true } serde_with = { version = "~1.5.1", features = ["hex"], optional = true } serde_with_macros = { version = "~1.2.0", optional = true } # Fix for the problem in 1.3.0 +# Core rust projects +# ------------------ lazy_static = "~1.4.0" -# Serializtion -# ------------ -# Used in RGB data Bech32 encodings -regex = "1" -# Temporary-needed dependencies: -# ------------------------------ -# 2. We use these to simplify enum strict encoding, but once the required -# functionality will become part of either amplify_derive or lnpbp_derive -# crates they should be removed -num-traits = "~0.2.11" -num-derive = "~0.3.0" - -[dev-dependencies] -serde_json = "~1.0.60" # Features # ======== [features] -# Listings -# -------- -# By default we use LNP with Tor support and URL support default = [] all = ["serde", "elgamal"] serde = ["serde_crate", "serde_with", "serde_with_macros", "amplify/serde", - "bitcoin/use-serde", "bitcoin_hashes/serde", "miniscript/serde"] -# Optional cryptographic functionality -# ------------------------------------ -keygen = ["bitcoin/rand"] + "bitcoin/use-serde", "bitcoin_hashes/serde", "miniscript/serde", + "descriptor-wallet/serde"] elgamal = [] # Provides ElGamal encryption module from this library [workspace] diff --git a/src/bp/mod.rs b/src/bp/mod.rs deleted file mode 100644 index b691920f..00000000 --- a/src/bp/mod.rs +++ /dev/null @@ -1,82 +0,0 @@ -// LNP/BP Core Library implementing LNPBP specifications & standards -// Written in 2019 by -// Dr. Maxim Orlovsky -// -// To the extent possible under law, the author(s) have dedicated all -// copyright and related and neighboring rights to this software to -// the public domain worldwide. This software is distributed without -// any warranty. -// -// You should have received a copy of the MIT License -// along with this software. -// If not, see . - -#[allow(unused_variables)] -pub mod blind; -pub mod chain; -pub mod dbc; -pub mod seals; -pub mod short_id; -mod strict_encoding; -pub mod tagged_hash; - -pub use chain::{Chain, P2pNetworkId}; -pub use seals::TxoutSeal; -pub use short_id::ShortId; -pub use tagged_hash::TaggedHash; - -use bitcoin::secp256k1; - -pub trait IntoPk { - fn into_pk(self) -> bitcoin::PublicKey; - fn into_legacy_pk(self) -> bitcoin::PublicKey; -} - -impl IntoPk for secp256k1::PublicKey { - fn into_pk(self) -> bitcoin::PublicKey { - ::bitcoin::PublicKey { - compressed: true, - key: self, - } - } - - fn into_legacy_pk(self) -> bitcoin::PublicKey { - ::bitcoin::PublicKey { - compressed: true, - key: self, - } - } -} - -#[cfg(test)] -pub mod test { - use crate::SECP256K1; - use bitcoin::secp256k1; - - pub fn gen_secp_pubkeys(n: usize) -> Vec { - let mut ret = Vec::with_capacity(n); - let mut sk = [0; 32]; - - for i in 1..n + 1 { - sk[0] = i as u8; - sk[1] = (i >> 8) as u8; - sk[2] = (i >> 16) as u8; - - ret.push(secp256k1::PublicKey::from_secret_key( - &SECP256K1, - &secp256k1::SecretKey::from_slice(&sk[..]).unwrap(), - )); - } - ret - } - - pub fn gen_bitcoin_pubkeys( - n: usize, - compressed: bool, - ) -> Vec { - gen_secp_pubkeys(n) - .into_iter() - .map(|key| bitcoin::PublicKey { key, compressed }) - .collect() - } -} diff --git a/src/bp/chain.rs b/src/chain.rs similarity index 99% rename from src/bp/chain.rs rename to src/chain.rs index 481c98a9..19fe2c85 100644 --- a/src/bp/chain.rs +++ b/src/chain.rs @@ -19,7 +19,6 @@ use bitcoin::hashes::hex::{self, FromHex, ToHex}; use bitcoin::hashes::{sha256d, Hash}; use bitcoin::BlockHash; -use crate::lightning_encoding; use crate::strict_encoding::{ self, strict_deserialize, strict_serialize, StrictDecode, StrictEncode, }; @@ -191,9 +190,6 @@ hash_newtype!( impl strict_encoding::Strategy for AssetId { type Strategy = strict_encoding::strategies::HashFixedBytes; } -impl lightning_encoding::Strategy for AssetId { - type Strategy = lightning_encoding::strategies::AsBitcoinHash; -} impl From for AssetId { fn from(block_hash: BlockHash) -> Self { @@ -389,8 +385,8 @@ lazy_static! { Debug, Display, Hash, - FromPrimitive, - ToPrimitive, + StrictEncode, + StrictDecode, )] #[display(Debug)] #[cfg_attr( @@ -406,7 +402,6 @@ pub enum ChainFormat { /// Confidential transactions format Elements = 1, } -impl_enum_strict_encoding!(ChainFormat); /// Layers on which a given asset can operate #[derive( @@ -419,8 +414,8 @@ impl_enum_strict_encoding!(ChainFormat); Debug, Display, Hash, - FromPrimitive, - ToPrimitive, + StrictEncode, + StrictDecode, )] #[display(Debug)] #[cfg_attr( @@ -439,7 +434,6 @@ pub enum AssetLayer { /// RGB), but also can be used on top of payment/state channels Layer2and3 = 2, } -impl_enum_strict_encoding!(AssetLayer); #[derive( Clone, @@ -451,8 +445,8 @@ impl_enum_strict_encoding!(AssetLayer); Debug, Display, Hash, - FromPrimitive, - ToPrimitive, + StrictEncode, + StrictDecode, )] #[cfg_attr( feature = "serde", @@ -472,7 +466,6 @@ pub enum AssetSystem { /// RGB confidential assets RgbContract = 2, } -impl_enum_strict_encoding!(AssetSystem); /// Parameters for a given asset, which are shared between different types of /// Layer 1, 2 and 3 assets. @@ -565,7 +558,6 @@ impl StrictDecode for AssetParams { serde(crate = "serde_crate") )] #[display(Debug)] -#[lnpbp_crate(crate)] pub struct ChainParams { /// Hash of the genesis block, uniquely defining chain pub genesis_hash: BlockHash, diff --git a/src/bp/dbc/error.rs b/src/dbc/error.rs similarity index 85% rename from src/bp/dbc/error.rs rename to src/dbc/error.rs index 83f6b46d..3727d77c 100644 --- a/src/bp/dbc/error.rs +++ b/src/dbc/error.rs @@ -11,7 +11,8 @@ // along with this software. // If not, see . -use crate::bp; +use wallet::descriptor; + use crate::lnpbp1; /// Different error types which may happen during deterministic bitcoin @@ -40,7 +41,7 @@ pub enum Error { /// Miniscript was unable to parse provided script data; they are either /// invalid or miniscript library contains a bug - #[from(crate::bp::scripts::PubkeyParseError)] + #[from(wallet::PubkeyParseError)] LockscriptParseError, /// Provided script contains no keys, so commitment or its verification is @@ -66,17 +67,17 @@ pub enum Error { UncompressedKey, } -impl From for Error { - fn from(err: bp::descriptor::Error) -> Self { +impl From for Error { + fn from(err: descriptor::Error) -> Self { match err { - bp::descriptor::Error::InvalidKeyData => Error::InvalidKeyData, - bp::descriptor::Error::UnsupportedWitnessVersion => { + descriptor::Error::InvalidKeyData => Error::InvalidKeyData, + descriptor::Error::UnsupportedWitnessVersion => { Error::UnsupportedWitnessVersion } - bp::descriptor::Error::PolicyCompilation(err) => { + descriptor::Error::PolicyCompilation(err) => { Error::PolicyCompilation(err) } - bp::descriptor::Error::UncompressedKeyInSegWitContext => { + descriptor::Error::UncompressedKeyInSegWitContext => { Error::UncompressedKey } } diff --git a/src/bp/dbc/keyset.rs b/src/dbc/keyset.rs similarity index 99% rename from src/bp/dbc/keyset.rs rename to src/dbc/keyset.rs index fbb6daf5..b3a13940 100644 --- a/src/bp/dbc/keyset.rs +++ b/src/dbc/keyset.rs @@ -17,10 +17,10 @@ use std::collections::BTreeSet; use bitcoin::hashes::{sha256, Hmac}; use bitcoin::secp256k1; +use client_side_validation::commit_verify::EmbedCommitVerify; use miniscript::Segwitv0; use super::{Container, Error, Proof, ScriptEncodeData}; -use crate::commit_verify::EmbedCommitVerify; use crate::lnpbp1; /// Container for LNPBP-1 commitments. In order to be constructed, commitment diff --git a/src/bp/dbc/lockscript.rs b/src/dbc/lockscript.rs similarity index 98% rename from src/bp/dbc/lockscript.rs rename to src/dbc/lockscript.rs index cdc44262..26e07a66 100644 --- a/src/bp/dbc/lockscript.rs +++ b/src/dbc/lockscript.rs @@ -29,12 +29,12 @@ use std::collections::{BTreeSet, HashSet}; use bitcoin::hashes::{hash160, sha256, Hmac}; use bitcoin::secp256k1; use bitcoin::PubkeyHash; +use client_side_validation::commit_verify::EmbedCommitVerify; use miniscript::Segwitv0; +use wallet::LockScript; use super::{Container, Error, KeysetCommitment, Proof, ScriptEncodeData}; -use crate::bp::dbc::KeysetContainer; -use crate::bp::scripts::*; -use crate::commit_verify::EmbedCommitVerify; +use crate::dbc::KeysetContainer; #[derive(Clone, PartialEq, Eq, Hash, Debug, Display)] #[display(Debug)] @@ -242,14 +242,15 @@ where #[cfg(test)] mod test { + use std::str::FromStr; + use bitcoin::hashes::{hash160, sha256, Hash}; use bitcoin::secp256k1; use miniscript::{Miniscript, Segwitv0}; - use std::str::FromStr; + use wallet::SECP256K1; - use super::super::Error; use super::*; - use crate::SECP256K1; + use crate::dbc::Error; macro_rules! ms_str { ($($arg:tt)*) => (Miniscript::::from_str_insane(&format!($($arg)*)).unwrap()) diff --git a/src/bp/dbc/mod.rs b/src/dbc/mod.rs similarity index 98% rename from src/bp/dbc/mod.rs rename to src/dbc/mod.rs index 3f352d39..670e8465 100644 --- a/src/bp/dbc/mod.rs +++ b/src/dbc/mod.rs @@ -11,7 +11,6 @@ // along with this software. // If not, see . -pub mod digests; mod error; pub mod keyset; pub mod lockscript; diff --git a/src/bp/dbc/pubkey.rs b/src/dbc/pubkey.rs similarity index 98% rename from src/bp/dbc/pubkey.rs rename to src/dbc/pubkey.rs index 26bf8d47..abd78279 100644 --- a/src/bp/dbc/pubkey.rs +++ b/src/dbc/pubkey.rs @@ -28,9 +28,9 @@ use bitcoin::hashes::{sha256, Hmac}; use bitcoin::secp256k1; +use client_side_validation::commit_verify::EmbedCommitVerify; use super::{Container, Error, Proof}; -use crate::commit_verify::EmbedCommitVerify; use crate::lnpbp1; /// Container for LNPBP-1 commitments. In order to be constructed, commitment diff --git a/src/bp/dbc/spk.rs b/src/dbc/spk.rs similarity index 84% rename from src/bp/dbc/spk.rs rename to src/dbc/spk.rs index b9da4119..35d80b92 100644 --- a/src/bp/dbc/spk.rs +++ b/src/dbc/spk.rs @@ -15,14 +15,14 @@ use amplify::Wrapper; use bitcoin::blockdata::script::Script; use bitcoin::hashes::{sha256, Hmac}; use bitcoin::secp256k1; +use client_side_validation::commit_verify::EmbedCommitVerify; use core::convert::TryFrom; +use wallet::{descriptor, LockScript, PubkeyScript, ToPubkeyScript}; use super::{ Container, Error, LockscriptCommitment, LockscriptContainer, Proof, PubkeyCommitment, PubkeyContainer, TaprootCommitment, TaprootContainer, }; -use crate::bp::{descriptor, LockScript, PubkeyScript, ToPubkeyScript}; -use crate::commit_verify::EmbedCommitVerify; /// Enum defining how given `scriptPubkey` is constructed from the script data /// or a public key. It is similar to Bitcoin Core descriptors, however it does @@ -53,7 +53,9 @@ pub enum ScriptEncodeMethod { /// Structure keeping the minimum of information (bytewise) required to verify /// deterministic bitcoin commitment given only the transaction source, its /// fee and protocol-specific constants. It is a part of the [`Proof`] data. -#[derive(Clone, PartialEq, Eq, Hash, Debug, Display)] +#[derive( + Clone, PartialEq, Eq, Hash, Debug, Display, StrictEncode, StrictDecode, +)] #[display(doc_comments)] #[non_exhaustive] pub enum ScriptEncodeData { @@ -95,81 +97,6 @@ pub struct SpkContainer { pub tweaking_factor: Option>, } -pub(super) mod strict_encoding { - use super::*; - use crate::strict_encoding::{Error, StrictDecode, StrictEncode}; - use std::io; - - #[derive( - Copy, - Clone, - PartialEq, - Eq, - PartialOrd, - Ord, - FromPrimitive, - ToPrimitive, - Debug, - )] - #[repr(u8)] - pub(in super::super) enum EncodingTag { - None = 0, - LockScript = 1, - Taproot = 2, - } - impl_enum_strict_encoding!(EncodingTag); - - impl StrictEncode for ScriptEncodeData { - fn strict_encode( - &self, - mut e: E, - ) -> Result { - Ok(match self { - ScriptEncodeData::SinglePubkey => { - EncodingTag::None.strict_encode(&mut e)? - } - ScriptEncodeData::LockScript(val) => { - strict_encode_list!(e; EncodingTag::LockScript, val) - } - ScriptEncodeData::Taproot(val) => { - strict_encode_list!(e; EncodingTag::Taproot, val) - } - }) - } - } - - impl StrictDecode for ScriptEncodeData { - fn strict_decode( - mut d: D, - ) -> Result { - let format = EncodingTag::strict_decode(&mut d)?; - Ok(match format { - EncodingTag::None => ScriptEncodeData::SinglePubkey, - EncodingTag::LockScript => ScriptEncodeData::LockScript( - LockScript::strict_decode(&mut d)?, - ), - EncodingTag::Taproot => ScriptEncodeData::Taproot( - sha256::Hash::strict_decode(&mut d)?, - ), - }) - } - } - - #[cfg(test)] - mod test { - use super::*; - - #[test] - fn test_encoding_tag_exhaustive() { - test_enum_u8_exhaustive!(EncodingTag; - EncodingTag::None => 0, - EncodingTag::LockScript => 1, - EncodingTag::Taproot => 2 - ); - } - } -} - impl SpkContainer { pub fn construct( protocol_tag: &sha256::Hash, @@ -249,6 +176,7 @@ impl Container for SpkContainer { descriptor::Compact::Wpkh(_) => ScriptEncodeMethod::WPubkeyHash, descriptor::Compact::Wsh(_) => ScriptEncodeMethod::WScriptHash, descriptor::Compact::Taproot(_) => ScriptEncodeMethod::Taproot, + _ => unimplemented!(), }; let proof = proof; diff --git a/src/bp/dbc/taproot.rs b/src/dbc/taproot.rs similarity index 95% rename from src/bp/dbc/taproot.rs rename to src/dbc/taproot.rs index 8e39c7aa..3ce6d26a 100644 --- a/src/bp/dbc/taproot.rs +++ b/src/dbc/taproot.rs @@ -13,10 +13,12 @@ use bitcoin::hashes::{sha256, Hmac}; use bitcoin::secp256k1; +use client_side_validation::commit_verify::EmbedCommitVerify; -use super::{Container, Error, Proof, PubkeyCommitment, ScriptEncodeData}; -use crate::bp::dbc::PubkeyContainer; -use crate::commit_verify::EmbedCommitVerify; +use super::{ + Container, Error, Proof, PubkeyCommitment, PubkeyContainer, + ScriptEncodeData, +}; #[derive(Clone, PartialEq, Eq, Hash, Debug, Display)] #[display(Debug)] diff --git a/src/bp/dbc/tx.rs b/src/dbc/tx.rs similarity index 99% rename from src/bp/dbc/tx.rs rename to src/dbc/tx.rs index 7e4f962a..95d58432 100644 --- a/src/bp/dbc/tx.rs +++ b/src/dbc/tx.rs @@ -14,12 +14,12 @@ use amplify::Wrapper; use bitcoin::hashes::{sha256, Hmac}; use bitcoin::{secp256k1, Transaction, TxOut}; +use client_side_validation::commit_verify::EmbedCommitVerify; use super::{ Container, Error, Proof, ScriptEncodeData, ScriptEncodeMethod, TxoutCommitment, TxoutContainer, }; -use crate::commit_verify::EmbedCommitVerify; #[derive(Clone, PartialEq, Eq, Debug, Display)] #[display(Debug)] diff --git a/src/bp/dbc/txout.rs b/src/dbc/txout.rs similarity index 97% rename from src/bp/dbc/txout.rs rename to src/dbc/txout.rs index 6579e80a..c677dae9 100644 --- a/src/bp/dbc/txout.rs +++ b/src/dbc/txout.rs @@ -14,13 +14,13 @@ use amplify::Wrapper; use bitcoin::hashes::{sha256, Hmac}; use bitcoin::{secp256k1, TxOut}; +use client_side_validation::commit_verify::EmbedCommitVerify; +use wallet::PubkeyScript; use super::{ Container, Error, Proof, ScriptEncodeData, ScriptEncodeMethod, SpkCommitment, SpkContainer, }; -use crate::bp::PubkeyScript; -use crate::commit_verify::EmbedCommitVerify; #[derive(Clone, PartialEq, Eq, Debug, Display)] #[display(Debug)] diff --git a/src/bp/dbc/types.rs b/src/dbc/types.rs similarity index 96% rename from src/bp/dbc/types.rs rename to src/dbc/types.rs index e5efd3df..b55fbd29 100644 --- a/src/bp/dbc/types.rs +++ b/src/dbc/types.rs @@ -35,7 +35,6 @@ pub trait Container: Sized { #[derive( Clone, PartialEq, Eq, Hash, Debug, Display, StrictEncode, StrictDecode, )] -#[lnpbp_crate(crate)] #[display("proof({pubkey}, {source}")] pub struct Proof { pub pubkey: secp256k1::PublicKey, @@ -44,7 +43,7 @@ pub struct Proof { impl DumbDefault for Proof { fn dumb_default() -> Self { - use crate::SECP256K1; + use wallet::SECP256K1; Proof { pubkey: secp256k1::PublicKey::from_secret_key( &SECP256K1, diff --git a/src/standards/elgamal.rs b/src/elgamal.rs similarity index 99% rename from src/standards/elgamal.rs rename to src/elgamal.rs index 533f6e0d..bdc99f96 100644 --- a/src/standards/elgamal.rs +++ b/src/elgamal.rs @@ -16,8 +16,7 @@ use bitcoin::hashes::{sha256, Hash, HashEngine}; use bitcoin::secp256k1; - -use crate::SECP256K1; +use wallet::SECP256K1; #[derive(Clone, Copy, PartialEq, Eq, Debug, Display, Error, From)] #[display(Debug)] diff --git a/src/lib.rs b/src/lib.rs index 2547a54f..2ff6ed83 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -29,9 +29,9 @@ extern crate amplify; #[macro_use] extern crate amplify_derive; #[macro_use] -extern crate lazy_static; +extern crate strict_encoding; #[macro_use] -extern crate num_derive; +extern crate lazy_static; #[cfg(feature = "serde")] #[macro_use] @@ -39,34 +39,52 @@ extern crate serde_with; #[cfg(feature = "serde")] extern crate serde_crate as serde; -// Bitcoin-specific imports. We make them public while we use custom versions -// of the libs so downstream dependencies can use them directly from this lib -// TODO: Refactor re-exported bitcoin and hashes functionality -pub extern crate bitcoin; -pub use bitcoin::secp256k1; #[macro_use] -pub extern crate bitcoin_hashes as hashes; -pub use hashes::hex; -pub extern crate miniscript; -#[cfg(feature = "bulletproofs")] -pub extern crate secp256k1zkp; +extern crate bitcoin_hashes; -#[macro_use] -extern crate lnpbp_derive; +pub mod chain; +pub mod dbc; +#[cfg(feature = "elgamal")] +pub mod elgamal; +pub mod seals; +pub mod short_id; +pub mod tagged_hash; -mod standards; -#[macro_use] -pub mod bp; +pub use chain::{Chain, P2pNetworkId}; +pub use seals::TxoutSeal; +pub use seals::{lnpbp1, lnpbp2, lnpbp3, lnpbp4}; +pub use short_id::ShortId; +pub use tagged_hash::TaggedHash; -#[cfg(feature = "elgamal")] -pub use standards::elgamal; -pub use standards::{features, lnpbp1, lnpbp2, lnpbp3, lnpbp4}; +#[cfg(test)] +pub mod test { + use crate::SECP256K1; + use bitcoin::secp256k1; + + pub fn gen_secp_pubkeys(n: usize) -> Vec { + let mut ret = Vec::with_capacity(n); + let mut sk = [0; 32]; + + for i in 1..n + 1 { + sk[0] = i as u8; + sk[1] = (i >> 8) as u8; + sk[2] = (i >> 16) as u8; -lazy_static! { - /// Global Secp256k1 context object - pub static ref SECP256K1: bitcoin::secp256k1::Secp256k1 = - bitcoin::secp256k1::Secp256k1::new(); + ret.push(secp256k1::PublicKey::from_secret_key( + &SECP256K1, + &secp256k1::SecretKey::from_slice(&sk[..]).unwrap(), + )); + } + ret + } - pub static ref SECP256K1_PUBKEY_DUMB: bitcoin::secp256k1::PublicKey = - bitcoin::secp256k1::PublicKey::from_secret_key(&SECP256K1, &bitcoin::secp256k1::key::ONE_KEY); + pub fn gen_bitcoin_pubkeys( + n: usize, + compressed: bool, + ) -> Vec { + gen_secp_pubkeys(n) + .into_iter() + .map(|key| bitcoin::PublicKey { key, compressed }) + .collect() + } } diff --git a/src/bp/blind.rs b/src/seals/blind.rs similarity index 99% rename from src/bp/blind.rs rename to src/seals/blind.rs index c9152bf9..ebd66d33 100644 --- a/src/bp/blind.rs +++ b/src/seals/blind.rs @@ -36,7 +36,6 @@ use crate::commit_verify::CommitVerify; StrictEncode, StrictDecode, )] -#[lnpbp_crate(crate)] #[cfg_attr( feature = "serde", derive(Serialize, Deserialize), diff --git a/src/bp/seals/error.rs b/src/seals/error.rs similarity index 98% rename from src/bp/seals/error.rs rename to src/seals/error.rs index 4f7c80c6..053ad732 100644 --- a/src/bp/seals/error.rs +++ b/src/seals/error.rs @@ -11,7 +11,7 @@ // along with this software. // If not, see . -use crate::bp::dbc; +use crate::dbc; #[derive(Clone, PartialEq, Debug, Display, From, Error)] #[display(doc_comments)] diff --git a/src/standards/lnpbp1.rs b/src/seals/lnpbp1.rs similarity index 99% rename from src/standards/lnpbp1.rs rename to src/seals/lnpbp1.rs index a7d4231d..5e89ec2e 100644 --- a/src/standards/lnpbp1.rs +++ b/src/seals/lnpbp1.rs @@ -15,8 +15,7 @@ use std::collections::BTreeSet; use bitcoin::hashes::{sha256, Hash, HashEngine, Hmac, HmacEngine}; use bitcoin::secp256k1; - -use crate::SECP256K1; +use wallet::SECP256K1; lazy_static! { /// Single SHA256 hash of "LNPBP1" string according to LNPBP-1 acting as a diff --git a/src/standards/lnpbp2.rs b/src/seals/lnpbp2.rs similarity index 100% rename from src/standards/lnpbp2.rs rename to src/seals/lnpbp2.rs diff --git a/src/standards/lnpbp3.rs b/src/seals/lnpbp3.rs similarity index 100% rename from src/standards/lnpbp3.rs rename to src/seals/lnpbp3.rs diff --git a/src/standards/lnpbp4.rs b/src/seals/lnpbp4.rs similarity index 97% rename from src/standards/lnpbp4.rs rename to src/seals/lnpbp4.rs index fac012eb..6d744838 100644 --- a/src/standards/lnpbp4.rs +++ b/src/seals/lnpbp4.rs @@ -16,8 +16,7 @@ use std::collections::BTreeMap; use bitcoin::hashes::{sha256d, Hash, HashEngine}; use bitcoin::secp256k1::rand::{thread_rng, Rng}; use bitcoin::util::uint::Uint256; - -use crate::commit_verify::TryCommitVerify; +use client_side_validation::commit_verify::TryCommitVerify; /// Source data for creation of multi-message commitments according to LNPBP-4 /// procedure @@ -40,7 +39,6 @@ pub struct TooManyMessagesError; StrictEncode, StrictDecode, )] -#[lnpbp_crate(crate)] #[display(Debug)] pub struct MultimsgCommitmentItem { pub protocol: Option, @@ -69,7 +67,6 @@ impl MultimsgCommitmentItem { StrictEncode, StrictDecode, )] -#[lnpbp_crate(crate)] #[display(Debug)] pub struct MultimsgCommitment { pub commitments: Vec, diff --git a/src/bp/seals/mod.rs b/src/seals/mod.rs similarity index 92% rename from src/bp/seals/mod.rs rename to src/seals/mod.rs index 2298f8c9..95591697 100644 --- a/src/bp/seals/mod.rs +++ b/src/seals/mod.rs @@ -12,6 +12,10 @@ // If not, see . mod error; +pub mod lnpbp1; +pub mod lnpbp2; +pub mod lnpbp3; +pub mod lnpbp4; mod tx_graph; mod txout_seal; mod txout_witness; diff --git a/src/bp/seals/tx_graph.rs b/src/seals/tx_graph.rs similarity index 100% rename from src/bp/seals/tx_graph.rs rename to src/seals/tx_graph.rs diff --git a/src/bp/seals/txout_seal.rs b/src/seals/txout_seal.rs similarity index 91% rename from src/bp/seals/txout_seal.rs rename to src/seals/txout_seal.rs index a2095d12..a6ff4775 100644 --- a/src/bp/seals/txout_seal.rs +++ b/src/seals/txout_seal.rs @@ -13,12 +13,11 @@ use amplify::Wrapper; use bitcoin::{OutPoint, Transaction}; +use client_side_validation::commit_verify::EmbedCommitVerify; +use client_side_validation::single_use_seals::{Message, SingleUseSeal}; -use super::{Error, SpendingStatus, TxGraph, Witness}; -use crate::bp::dbc::{Container, TxCommitment, TxContainer, TxSupplement}; -use crate::bp::ShortId; -use crate::commit_verify::EmbedCommitVerify; -use crate::single_use_seals::{Message, SealMedium, SealStatus, SingleUseSeal}; +use super::{Error, Witness}; +use crate::dbc::{Container, TxCommitment, TxContainer, TxSupplement}; pub struct TxoutSeal<'a, RESOLVER> where @@ -32,7 +31,7 @@ impl<'a, RESOLVER> TxoutSeal<'a, RESOLVER> where RESOLVER: TxResolve, { - fn new(seal_definition: OutPoint, resolver: &'a RESOLVER) -> Self { + pub fn new(seal_definition: OutPoint, resolver: &'a RESOLVER) -> Self { Self { seal_definition, resolver, @@ -80,6 +79,7 @@ where } } +/* impl<'a, TXGRAPH> SealMedium<'a, TxoutSeal<'a, TXGRAPH>> for TXGRAPH where TXGRAPH: TxGraph + TxResolve, @@ -122,6 +122,7 @@ where // TODO: Implement publication-related methods } + */ pub trait TxResolve { type Error: std::error::Error; diff --git a/src/bp/seals/txout_witness.rs b/src/seals/txout_witness.rs similarity index 93% rename from src/bp/seals/txout_witness.rs rename to src/seals/txout_witness.rs index ae4a3a1c..d72f9ade 100644 --- a/src/bp/seals/txout_witness.rs +++ b/src/seals/txout_witness.rs @@ -11,7 +11,7 @@ // along with this software. // If not, see . -use crate::bp::dbc::{Proof, TxCommitment}; +use crate::dbc::{Proof, TxCommitment}; pub struct Witness(pub InnerWitness, pub OuterWitness); diff --git a/src/bp/short_id.rs b/src/short_id.rs similarity index 99% rename from src/bp/short_id.rs rename to src/short_id.rs index 3d29454d..45e6fe23 100644 --- a/src/bp/short_id.rs +++ b/src/short_id.rs @@ -382,7 +382,6 @@ impl Descriptor { StrictEncode, StrictDecode, )] -#[lnpbp_crate(crate)] #[display(Debug)] pub struct ShortId(u64); diff --git a/src/standards/mod.rs b/src/standards/mod.rs deleted file mode 100644 index dda6c275..00000000 --- a/src/standards/mod.rs +++ /dev/null @@ -1,27 +0,0 @@ -// LNP/BP Core Library implementing LNPBP specifications & standards -// Written in 2020 by -// Dr. Maxim Orlovsky -// -// To the extent possible under law, the author(s) have dedicated all -// copyright and related and neighboring rights to this software to -// the public domain worldwide. This software is distributed without -// any warranty. -// -// You should have received a copy of the MIT License -// along with this software. -// If not, see . - -//! Modules implementing specific LNPBP standards. Check -//! [LNP/BP Standards page](https://github.com/LNP-BP/LNPBPs) for details. -//! -//! Here reside low-level standards implementations, used by a higher-level -//! convenience wrappers (like `bp::dbc`) or not fitting into the scope of any -//! other part of the library (like Elgamal encryption). - -#[cfg(feature = "elgamal")] -pub mod elgamal; -pub mod features; -pub mod lnpbp1; -pub mod lnpbp2; -pub mod lnpbp3; -pub mod lnpbp4; diff --git a/src/bp/tagged_hash.rs b/src/tagged_hash.rs similarity index 100% rename from src/bp/tagged_hash.rs rename to src/tagged_hash.rs diff --git a/src/bp/tweak.rs b/src/tweak.rs similarity index 100% rename from src/bp/tweak.rs rename to src/tweak.rs