diff --git a/.github/workflows/nym-wallet-publish-windows10.yml b/.github/workflows/nym-wallet-publish-windows10.yml index 6f22820943..5eab299f9d 100644 --- a/.github/workflows/nym-wallet-publish-windows10.yml +++ b/.github/workflows/nym-wallet-publish-windows10.yml @@ -1,5 +1,6 @@ name: Publish Nym Wallet (Windows 10) on: + workflow_dispatch: release: types: [created] diff --git a/.github/workflows/run-api-tests.yml b/.github/workflows/run-api-tests.yml index 02621beffe..1d2afec2bd 100644 --- a/.github/workflows/run-api-tests.yml +++ b/.github/workflows/run-api-tests.yml @@ -1,23 +1,36 @@ name: CI for Nym API Tests -'on': + +on: + workflow_dispatch: push: paths: - - nym-api/** + - "nym-api/**" + defaults: run: working-directory: nym-api/tests + jobs: test: name: nym-api tests runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Use correct nvm version - run: nvm use v18.1.0 + + - name: Install npm + run: npm install + + - name: Node v18 + uses: actions/setup-node@v3 + with: + node-version: 18.1.0 + - name: Install yarn run: yarn install + - name: Run yarn run: yarn + - name: Run tests - run: 'yarn test:qa' + run: yarn test:qa working-directory: nym-api/tests diff --git a/Cargo.lock b/Cargo.lock index 7235f28297..a5ae3d2f08 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1601,6 +1601,7 @@ dependencies = [ "ff 0.11.1", "group 0.11.0", "lazy_static", + "nym-contracts-common", "nym-pemstore", "rand 0.8.5", "rand_chacha 0.3.1", @@ -3519,7 +3520,6 @@ version = "0.1.0" dependencies = [ "bs58", "cosmwasm-std", - "dkg", "schemars", "serde", "serde_json", diff --git a/common/cosmwasm-smart-contracts/contracts-common/Cargo.toml b/common/cosmwasm-smart-contracts/contracts-common/Cargo.toml index 946f0cce90..59042f9a48 100644 --- a/common/cosmwasm-smart-contracts/contracts-common/Cargo.toml +++ b/common/cosmwasm-smart-contracts/contracts-common/Cargo.toml @@ -9,7 +9,6 @@ edition = "2021" [dependencies] bs58 = "0.4.0" cosmwasm-std = "1.0.0" -dkg = { path = "../../../common/dkg", optional = true } schemars = "0.8" serde = { version = "1.0", features = ["derive"] } thiserror = "1" diff --git a/common/cosmwasm-smart-contracts/contracts-common/src/dealings.rs b/common/cosmwasm-smart-contracts/contracts-common/src/dealings.rs index f28ca85ba2..cfc22e8727 100644 --- a/common/cosmwasm-smart-contracts/contracts-common/src/dealings.rs +++ b/common/cosmwasm-smart-contracts/contracts-common/src/dealings.rs @@ -69,19 +69,3 @@ impl<'de> Deserialize<'de> for ContractSafeBytes { Ok(ContractSafeBytes(bytes)) } } - -#[cfg(feature = "dkg")] -impl<'a> From<&'a Dealing> for ContractSafeBytes { - fn from(dealing: &'a Dealing) -> Self { - ContractSafeBytes(dealing.to_bytes()) - } -} - -#[cfg(feature = "dkg")] -impl<'a> TryFrom<&'a ContractSafeBytes> for Dealing { - type Error = DkgError; - - fn try_from(value: &'a ContractSafeBytes) -> Result { - Dealing::try_from_bytes(&value.0) - } -} diff --git a/common/crypto/Cargo.toml b/common/crypto/Cargo.toml index b962a26f29..0600adf87d 100644 --- a/common/crypto/Cargo.toml +++ b/common/crypto/Cargo.toml @@ -1,15 +1,11 @@ [package] name = "nym-crypto" version = "0.1.0" +description = "Crypto library for the nym mixnet" edition = { workspace = true } authors = { workspace = true } license = { workspace = true } repository = { workspace = true } -readme = { workspace = true } -homepage = { workspace = true } -documentation = { workspace = true } - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] aes = { version = "0.8.1", optional = true } @@ -30,7 +26,7 @@ subtle-encoding = { version = "0.5", features = ["bech32-preview"]} thiserror = "1.0.37" # internal -nym-sphinx-types = { path = "../nymsphinx/types" } +nym-sphinx-types = { path = "../nymsphinx/types", version = "0.1.0" } nym-pemstore = { path = "../../common/pemstore", version = "0.1.0" } [dev-dependencies] diff --git a/common/dkg/Cargo.toml b/common/dkg/Cargo.toml index 33ec03447a..525001f42e 100644 --- a/common/dkg/Cargo.toml +++ b/common/dkg/Cargo.toml @@ -12,9 +12,10 @@ bitvec = "1.0.0" # unfortunately until https://github.com/zkcrypto/bls12_381/issues/10 is resolved, we have to rely on the fork # as we need to be able to serialize Gt so that we could create the lookup table for baby-step-giant-step algorithm bls12_381 = { git = "https://github.com/jstuczyn/bls12_381", branch ="gt-serialisation", default-features = false, features = ["alloc", "pairings", "experimental", "zeroize"] } - +nym-contracts-common = { path = "../cosmwasm-smart-contracts/contracts-common", optional = true } bs58 = "0.4" + lazy_static = "1.4.0" rand = { version = "0.8.5", default-features = false} rand_chacha = "0.3" @@ -41,3 +42,7 @@ criterion = "0.3" [[bench]] name = "benchmarks" harness = false + +[features] +default = [] +cw-types = ["nym-contracts-common"] \ No newline at end of file diff --git a/common/dkg/src/dealing.rs b/common/dkg/src/dealing.rs index d92a9ba6b4..ff31c5736e 100644 --- a/common/dkg/src/dealing.rs +++ b/common/dkg/src/dealing.rs @@ -307,6 +307,24 @@ impl Dealing { } } +#[cfg(feature = "cw-types")] +impl<'a> From<&'a Dealing> for nym_contracts_common::dealings::ContractSafeBytes { + fn from(dealing: &'a Dealing) -> Self { + nym_contracts_common::dealings::ContractSafeBytes(dealing.to_bytes()) + } +} + +#[cfg(feature = "cw-types")] +impl<'a> TryFrom<&'a nym_contracts_common::dealings::ContractSafeBytes> for Dealing { + type Error = DkgError; + + fn try_from( + value: &'a nym_contracts_common::dealings::ContractSafeBytes, + ) -> Result { + Dealing::try_from_bytes(&value.0) + } +} + // this assumes all dealings have been verified pub fn try_recover_verification_keys( dealings: &[Dealing], diff --git a/common/nymsphinx/Cargo.toml b/common/nymsphinx/Cargo.toml index bb738f75d6..d5d10ea633 100644 --- a/common/nymsphinx/Cargo.toml +++ b/common/nymsphinx/Cargo.toml @@ -1,15 +1,11 @@ [package] name = "nym-sphinx" version = "0.1.0" +description = "Top-level crate for sphinx packets as used by the Nym mixnet" edition = { workspace = true } authors = { workspace = true } license = { workspace = true } repository = { workspace = true } -readme = { workspace = true } -homepage = { workspace = true } -documentation = { workspace = true } - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] rand = { version = "0.7.3", features = ["wasm-bindgen"] } diff --git a/common/nymsphinx/acknowledgements/Cargo.toml b/common/nymsphinx/acknowledgements/Cargo.toml index 50d41e7bd9..3db7d909db 100644 --- a/common/nymsphinx/acknowledgements/Cargo.toml +++ b/common/nymsphinx/acknowledgements/Cargo.toml @@ -1,15 +1,11 @@ [package] name = "nym-sphinx-acknowledgements" version = "0.1.0" +description = "Sphinx packet ack messages" edition = { workspace = true } authors = { workspace = true } license = { workspace = true } repository = { workspace = true } -readme = { workspace = true } -homepage = { workspace = true } -documentation = { workspace = true } - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] rand = { version = "0.7.3", features = ["wasm-bindgen"] } diff --git a/common/nymsphinx/addressing/Cargo.toml b/common/nymsphinx/addressing/Cargo.toml index 6b2aae04d4..f9c646e04b 100644 --- a/common/nymsphinx/addressing/Cargo.toml +++ b/common/nymsphinx/addressing/Cargo.toml @@ -1,15 +1,11 @@ [package] name = "nym-sphinx-addressing" version = "0.1.0" +description = "Nym mixnet addressing" edition = { workspace = true } authors = { workspace = true } license = { workspace = true } repository = { workspace = true } -readme = { workspace = true } -homepage = { workspace = true } -documentation = { workspace = true } - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] nym-crypto = { path = "../../crypto", features = ["asymmetric"] } # all addresses are expressed in terms on their crypto keys diff --git a/common/nymsphinx/anonymous-replies/Cargo.toml b/common/nymsphinx/anonymous-replies/Cargo.toml index c9068d859d..40a6d19308 100644 --- a/common/nymsphinx/anonymous-replies/Cargo.toml +++ b/common/nymsphinx/anonymous-replies/Cargo.toml @@ -1,15 +1,11 @@ [package] name = "nym-sphinx-anonymous-replies" version = "0.1.0" +description = "Anonymous sphinx packet replies using singly-use-reply-blocks (SURB)" edition = { workspace = true } authors = { workspace = true } license = { workspace = true } repository = { workspace = true } -readme = { workspace = true } -homepage = { workspace = true } -documentation = { workspace = true } - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] rand = { version = "0.7.3", features = ["wasm-bindgen"] } diff --git a/common/nymsphinx/chunking/Cargo.toml b/common/nymsphinx/chunking/Cargo.toml index 2e26f1626f..94bec5886b 100644 --- a/common/nymsphinx/chunking/Cargo.toml +++ b/common/nymsphinx/chunking/Cargo.toml @@ -1,13 +1,11 @@ [package] name = "nym-sphinx-chunking" version = "0.1.0" +description = "Sphinx packet chunking of underlying data packets" edition = { workspace = true } authors = { workspace = true } license = { workspace = true } repository = { workspace = true } -readme = { workspace = true } -homepage = { workspace = true } -documentation = { workspace = true } # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/common/nymsphinx/cover/Cargo.toml b/common/nymsphinx/cover/Cargo.toml index 1e32ff500e..f1558d3676 100644 --- a/common/nymsphinx/cover/Cargo.toml +++ b/common/nymsphinx/cover/Cargo.toml @@ -1,15 +1,11 @@ [package] name = "nym-sphinx-cover" version = "0.1.0" +description = "Sphinx packets used as cover traffic" edition = { workspace = true } authors = { workspace = true } license = { workspace = true } repository = { workspace = true } -readme = { workspace = true } -homepage = { workspace = true } -documentation = { workspace = true } - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] rand = { version = "0.7.3", features = ["wasm-bindgen"] } diff --git a/common/nymsphinx/forwarding/Cargo.toml b/common/nymsphinx/forwarding/Cargo.toml index bd1a6a830b..e4931b7d8b 100644 --- a/common/nymsphinx/forwarding/Cargo.toml +++ b/common/nymsphinx/forwarding/Cargo.toml @@ -1,15 +1,11 @@ [package] name = "nym-sphinx-forwarding" version = "0.1.0" +description = "Sphinx packet forwarding as Nym mix packets" edition = { workspace = true } authors = { workspace = true } license = { workspace = true } repository = { workspace = true } -readme = { workspace = true } -homepage = { workspace = true } -documentation = { workspace = true } - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] nym-sphinx-addressing = { path = "../addressing" } diff --git a/common/nymsphinx/framing/Cargo.toml b/common/nymsphinx/framing/Cargo.toml index 90a8e94e5a..b510926555 100644 --- a/common/nymsphinx/framing/Cargo.toml +++ b/common/nymsphinx/framing/Cargo.toml @@ -1,15 +1,11 @@ [package] name = "nym-sphinx-framing" version = "0.1.0" +description = "Sphinx packet framing for the Nym mixnet" edition = { workspace = true } authors = { workspace = true } license = { workspace = true } repository = { workspace = true } -readme = { workspace = true } -homepage = { workspace = true } -documentation = { workspace = true } - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] bytes = "1.0" diff --git a/common/nymsphinx/params/Cargo.toml b/common/nymsphinx/params/Cargo.toml index 319a55513d..6037bdb333 100644 --- a/common/nymsphinx/params/Cargo.toml +++ b/common/nymsphinx/params/Cargo.toml @@ -1,15 +1,11 @@ [package] name = "nym-sphinx-params" version = "0.1.0" +description = "Sphinx packet parameters for the Nym mixnet" edition = { workspace = true } authors = { workspace = true } license = { workspace = true } repository = { workspace = true } -readme = { workspace = true } -homepage = { workspace = true } -documentation = { workspace = true } - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] thiserror = "1.0.37" diff --git a/common/nymsphinx/types/Cargo.toml b/common/nymsphinx/types/Cargo.toml index 9eaa417b42..53e399ebcf 100644 --- a/common/nymsphinx/types/Cargo.toml +++ b/common/nymsphinx/types/Cargo.toml @@ -1,13 +1,11 @@ [package] name = "nym-sphinx-types" version = "0.1.0" +description = "Re-export sphinx packet types" edition = { workspace = true } authors = { workspace = true } license = { workspace = true } repository = { workspace = true } -readme = { workspace = true } -homepage = { workspace = true } -documentation = { workspace = true } [dependencies] sphinx-packet = { version = "0.1.0" } diff --git a/nym-api/Cargo.toml b/nym-api/Cargo.toml index a1ae9478b5..f64d624708 100644 --- a/nym-api/Cargo.toml +++ b/nym-api/Cargo.toml @@ -75,12 +75,12 @@ credentials = { path = "../common/credentials" } nym-crypto = { path = "../common/crypto" } cw3 = { version = "0.13.4" } cw4 = { version = "0.13.4" } -dkg = { path = "../common/dkg" } +dkg = { path = "../common/dkg", features = ["cw-types"] } gateway-client = { path = "../common/client-libs/gateway-client" } nym-inclusion-probability = { path = "../common/inclusion-probability" } nym-mixnet-contract-common = { path = "../common/cosmwasm-smart-contracts/mixnet-contract" } nym-vesting-contract-common = { path = "../common/cosmwasm-smart-contracts/vesting-contract" } -nym-contracts-common = { path = "../common/cosmwasm-smart-contracts/contracts-common", features = ["dkg"] } +nym-contracts-common = { path = "../common/cosmwasm-smart-contracts/contracts-common" } multisig-contract-common = { path = "../common/cosmwasm-smart-contracts/multisig-contract" } nymcoconut = { path = "../common/nymcoconut" } nym-sphinx = { path = "../common/nymsphinx" }