diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000000..4b56a90efe --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,32 @@ +--- +name: Feature request +about: Suggest an enhancement to the product +title: "[Feature Request]" +labels: enhancement +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is... + +**Is your request a feature not related to an existing problem? A new feature.** +For example. +- Given I am using the nym wallet +- When I transfer nym tokens across the network +- Then I want to have an url link in the wallet which navigates outside the application to the nym-explorer + +**Where does the feature fit in the Nym real estate?** +- Application / UI + +**What is this solving?** +How will this improve the product... + +**Is this an update to packages or libraries?** +If so, please list them. If not, please ignore this section. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/report.md b/.github/ISSUE_TEMPLATE/report.md new file mode 100644 index 0000000000..3dac5eb4f5 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/report.md @@ -0,0 +1,43 @@ +--- +name: Report +about: To help identify and reproduce issues +title: "[Issue]" +labels: bug, bug-needs-triage, qa +assignees: tommyv1987 + +--- + +**Describe the issue** +A clear and concise description of what the issue is... + +**Expected behaviour** +A clear and concise description of what you expected to happen... + +**Stack Traces** +If there are stack traces or logs, please provide them here... + +**Steps to Reproduce** +Steps to reproduce the behaviour, if you're familiar with BDD syntax, please write it in this style: +- Given I was doing X +- And I installed Y +- When I actioned Y +- Then I expect Z + +*An example:* +- Given I was setting up a mix-node following the instructions in the docs +- And I successfully bonded my node via the the wallet +- When I went to start my mixnode +- Then I was presented with an error + +**Screenshots** +If applicable, add screenshots to help explain your problem... + +**Which area of Nym were you using?** + - UI: [e.g. Websites - network-explorer, nym-website] + - Application: [e.g Gateway, Client, Wallet] + - OS: [e.g. Ubuntu 20.x, MacOs Big Sur, Windows 10] + - Browser: [e.g Chrome (if applicable)] + - Version: [e.g. nym binary(0.11.0), browser(94.0)] + +**Additional context** +Please provide any other information diff --git a/.github/workflows/nym-wallet-tests.yml b/.github/workflows/nym-wallet-tests.yml deleted file mode 100644 index 8b13789179..0000000000 --- a/.github/workflows/nym-wallet-tests.yml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/.github/workflows/nym_wallet.yml b/.github/workflows/nym_wallet.yml index 144fdb7a0d..47864cd3e2 100644 --- a/.github/workflows/nym_wallet.yml +++ b/.github/workflows/nym_wallet.yml @@ -1,9 +1,9 @@ -name: webdriverio tests for nym wallet +name: Webdriverio tests for nym wallet on: push: paths: - - '/tauri-wallet/*' + - 'tauri-wallet/**' defaults: run: @@ -43,15 +43,20 @@ jobs: - name: Build application run: yarn run webpack:build & yarn run tauri:build + + - name: Check binary exists + run: | + cd target/release/ + (test -f nym-wallet && echo nym binary exists) || echo wallet does not exist - name: Install dependencies run: yarn install - working-directory: webdriver/ + working-directory: tauri-wallet/webdriver - name: Remove existing user datafile uses: JesseTG/rm@v1.0.2 with: - path: webdriver/data/user-data.json + path: tauri-wallet/webdriver/common/data/user-data.json - name: Create user data json file id: create-json @@ -59,7 +64,7 @@ jobs: with: name: "user-data.json" json: ${{ secrets.WALLET_USERDATA }} - dir: 'webdriver/data/' + dir: 'tauri-wallet/webdriver/common/data/' - name: Install tauri-driver uses: actions-rs/cargo@v1 @@ -68,5 +73,5 @@ jobs: args: tauri-driver - name: Launch tests - run: xvfb-run yarn test:login - working-directory: webdriver/ + run: xvfb-run yarn test:newuser + working-directory: tauri-wallet/webdriver diff --git a/Cargo.toml b/Cargo.toml index 0b112df4f1..02ceec5e95 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,6 +4,7 @@ [profile.release] panic = "abort" opt-level = "s" +overflow-checks = true [profile.dev] panic = "abort" diff --git a/common/client-libs/gateway-client/src/socket_state.rs b/common/client-libs/gateway-client/src/socket_state.rs index 80b8085499..b82e9907b3 100644 --- a/common/client-libs/gateway-client/src/socket_state.rs +++ b/common/client-libs/gateway-client/src/socket_state.rs @@ -173,9 +173,9 @@ impl PartiallyDelegated { // this call failing is incredibly unlikely, but not impossible. // basically the gateway connection must have failed after executing previous line but // before starting execution of this one. - if notify.send(()).is_err() { - return Err(GatewayClientError::ConnectionAbruptlyClosed); - } + notify + .send(()) + .map_err(|_| GatewayClientError::ConnectionAbruptlyClosed)?; let stream_results: Result<_, GatewayClientError> = stream_receiver .await diff --git a/common/crypto/src/hkdf.rs b/common/crypto/src/hkdf.rs index 8791ea1bbf..5300947448 100644 --- a/common/crypto/src/hkdf.rs +++ b/common/crypto/src/hkdf.rs @@ -5,18 +5,13 @@ use digest::{BlockInput, FixedOutput, Reset, Update}; use generic_array::ArrayLength; use hkdf::Hkdf; -#[derive(Debug)] -pub enum HkdfError { - InvalidOkmLength, -} - /// Perform HKDF `extract` then `expand` as a single step. pub fn extract_then_expand( salt: Option<&[u8]>, ikm: &[u8], info: Option<&[u8]>, okm_length: usize, -) -> Result, HkdfError> +) -> Result, hkdf::InvalidLength> where D: Update + BlockInput + FixedOutput + Reset + Default + Clone, D::BlockSize: ArrayLength, @@ -27,9 +22,7 @@ where let hkdf = Hkdf::::new(salt, ikm); let mut okm = vec![0u8; okm_length]; - if hkdf.expand(info.unwrap_or_else(|| &[]), &mut okm).is_err() { - return Err(HkdfError::InvalidOkmLength); - } + hkdf.expand(info.unwrap_or_else(|| &[]), &mut okm)?; Ok(okm) } diff --git a/common/nymsphinx/src/receiver.rs b/common/nymsphinx/src/receiver.rs index 01f308ac75..76c65c1f15 100644 --- a/common/nymsphinx/src/receiver.rs +++ b/common/nymsphinx/src/receiver.rs @@ -156,11 +156,9 @@ impl MessageReceiver { }; // Finally, remove the zero padding from the message - if Self::remove_padding(&mut message).is_err() { - return Err(MessageRecoveryError::MalformedReconstructedMessage( - used_sets, - )); - }; + Self::remove_padding(&mut message).map_err(|_| { + MessageRecoveryError::MalformedReconstructedMessage(used_sets.clone()) + })?; Ok(Some(( ReconstructedMessage { diff --git a/tauri-wallet/README.md b/tauri-wallet/README.md index 465cd18132..5cd0fdd60a 100644 --- a/tauri-wallet/README.md +++ b/tauri-wallet/README.md @@ -7,12 +7,19 @@ SPDX-License-Identifier: Apache-2.0 A Rust and Tauri desktop wallet implementation. -## Installation prerequisites +## Installation prerequisites Linux / Mac - `Yarn` - `NodeJS >= v16.8.0` - `Rust & cargo >= v1.51` +## Installation prerequisites Windows + +- When running on Windows you will need to install c++ build tools +- An easy guide to get rust up and running [Installation]("http://kennykerr.ca/2019/11/18/rust-getting-started/") +- When installing NodeJS please use the `current features` version +- Using a package manager like [Chocolatey]("chocolatey.org") is recommended + ## Installation Inside of the `tauri-wallet` folder, run the following commands diff --git a/tauri-wallet/src/components/Confirmation.tsx b/tauri-wallet/src/components/Confirmation.tsx index 87c570b84c..e227021d0b 100644 --- a/tauri-wallet/src/components/Confirmation.tsx +++ b/tauri-wallet/src/components/Confirmation.tsx @@ -33,7 +33,7 @@ export const Confirmation = ({ {error === null ? ( SuccessMessage ) : ( - + {error.name} {failureMessage} - {error.message} diff --git a/tauri-wallet/src/components/CopyToClipboard.tsx b/tauri-wallet/src/components/CopyToClipboard.tsx index c09edfe287..9e4cd4ae71 100644 --- a/tauri-wallet/src/components/CopyToClipboard.tsx +++ b/tauri-wallet/src/components/CopyToClipboard.tsx @@ -40,7 +40,7 @@ export const CopyToClipboard = ({ text }: { text: string }) => { size="small" variant={copied ? 'text' : 'outlined'} aria-label="save" - data-testid="copyButton" + data-testid="copy-button" onClick={() => handleCopy({ text, cb: updateCopyStatus })} endIcon={copied && } style={copied ? { background: green[500], color: 'white' } : {}} diff --git a/tauri-wallet/src/components/Error.tsx b/tauri-wallet/src/components/Error.tsx index cb211269d4..d1947bac31 100644 --- a/tauri-wallet/src/components/Error.tsx +++ b/tauri-wallet/src/components/Error.tsx @@ -6,11 +6,11 @@ import { Button } from '@material-ui/core' export const ErrorFallback = ({ error, resetErrorBoundary }: FallbackProps) => { return (
- + {error.name} {error.message} - + Stack trace {error.stack} diff --git a/tauri-wallet/src/components/Nav.tsx b/tauri-wallet/src/components/Nav.tsx index ba60e4d162..4af636f53f 100644 --- a/tauri-wallet/src/components/Nav.tsx +++ b/tauri-wallet/src/components/Nav.tsx @@ -131,7 +131,7 @@ export const Nav = () => { )} - + { noPadding Action={ - + @@ -43,7 +43,7 @@ export const BalanceCard = () => { {getBalance.error} ) : ( - + {getBalance.balance?.printable_balance} )} @@ -71,7 +71,7 @@ export const AddressCard = () => { title="Address" subheader="Wallet payments address" noPadding - data-testid="walletAddressHeader" + data-testid="wallet-address-header" Action={ @@ -107,7 +107,7 @@ export const AddressCard = () => { } > - {truncate(clientDetails?.client_address!, 35)} diff --git a/tauri-wallet/src/components/NoClientError.tsx b/tauri-wallet/src/components/NoClientError.tsx index b703832aee..cf65ae0904 100644 --- a/tauri-wallet/src/components/NoClientError.tsx +++ b/tauri-wallet/src/components/NoClientError.tsx @@ -5,7 +5,7 @@ import { Alert, AlertTitle } from '@material-ui/lab' export const NoClientError = () => { return ( - No client detected + No client detected Have you signed in? Try to go back to{' '} the main page and try again diff --git a/tauri-wallet/src/components/NodeTypeSelector.tsx b/tauri-wallet/src/components/NodeTypeSelector.tsx index 3f068680b3..e36432a637 100644 --- a/tauri-wallet/src/components/NodeTypeSelector.tsx +++ b/tauri-wallet/src/components/NodeTypeSelector.tsx @@ -34,13 +34,13 @@ export const NodeTypeSelector = ({ value={EnumNodeType.mixnode} control={} label="Mixnode" - data-testid="mixNode" + data-testid="mix-node" disabled={disabled} /> } - data-testid="gateWay" + data-testid="gate-way" label="Gateway" disabled={disabled} /> diff --git a/tauri-wallet/src/components/NymCard.tsx b/tauri-wallet/src/components/NymCard.tsx index c77fe38359..162610b15b 100644 --- a/tauri-wallet/src/components/NymCard.tsx +++ b/tauri-wallet/src/components/NymCard.tsx @@ -13,6 +13,7 @@ export const NymCard: React.FC<{ { size="small" color="primary" type="submit" + data-testid="refresh-button" onClick={fetchBalance} disabled={isLoading} disableElevation @@ -31,13 +32,13 @@ export const Balance = () => { return ( - + {error && ( } style={{ padding: theme.spacing(2) }} > @@ -47,7 +48,7 @@ export const Balance = () => { {!error && ( } > diff --git a/tauri-wallet/src/routes/bond/BondForm.tsx b/tauri-wallet/src/routes/bond/BondForm.tsx index 06936f86ee..ea689aa7db 100644 --- a/tauri-wallet/src/routes/bond/BondForm.tsx +++ b/tauri-wallet/src/routes/bond/BondForm.tsx @@ -142,7 +142,7 @@ export const BondForm = ({ {fees && ( - + {`A fee of ${ watchNodeType === EnumNodeType.mixnode ? fees.mixnode.amount @@ -369,7 +369,7 @@ export const BondForm = ({ color="primary" type="submit" size="large" - data-testid="submitButton" + data-testid="submit-button" disableElevation onClick={handleSubmit(onSubmit)} endIcon={isSubmitting && } diff --git a/tauri-wallet/src/routes/bond/index.tsx b/tauri-wallet/src/routes/bond/index.tsx index cf11a2c712..0e89ae070f 100644 --- a/tauri-wallet/src/routes/bond/index.tsx +++ b/tauri-wallet/src/routes/bond/index.tsx @@ -94,10 +94,10 @@ export const Bond = () => { Successfully bonded node + Successfully bonded node } Error={ - + An error occurred with the request: {message} } diff --git a/tauri-wallet/src/routes/delegate/DelegateForm.tsx b/tauri-wallet/src/routes/delegate/DelegateForm.tsx index 2aabc04ae7..0a32c08395 100644 --- a/tauri-wallet/src/routes/delegate/DelegateForm.tsx +++ b/tauri-wallet/src/routes/delegate/DelegateForm.tsx @@ -97,7 +97,7 @@ export const DelegateForm = ({ /> - + {`A fee of ${ watchNodeType === EnumNodeType.mixnode ? fees.mixnode.amount @@ -153,7 +153,7 @@ export const DelegateForm = ({
- {data.to_address} + {data.to_address}
@@ -70,7 +70,7 @@ export const SendConfirmation = ({
- {data.amount.amount + ' punks'} + {data.amount.amount + ' punks'}
diff --git a/tauri-wallet/src/routes/send/SendError.tsx b/tauri-wallet/src/routes/send/SendError.tsx index 644067e432..f90c9b9df5 100644 --- a/tauri-wallet/src/routes/send/SendError.tsx +++ b/tauri-wallet/src/routes/send/SendError.tsx @@ -37,7 +37,7 @@ export const SendError = ({ message }: { message?: string }) => { variant="outlined" style={{ width: '100%', padding: theme.spacing(2) }} > - + An error occured during the request {message} diff --git a/tauri-wallet/src/routes/send/SendReview.tsx b/tauri-wallet/src/routes/send/SendReview.tsx index 0b31454d3d..b51edc1626 100644 --- a/tauri-wallet/src/routes/send/SendReview.tsx +++ b/tauri-wallet/src/routes/send/SendReview.tsx @@ -44,19 +44,19 @@ export const SendReview = () => { ) : ( - + - + - + @@ -65,7 +65,6 @@ export const SendReview = () => { @@ -87,7 +86,7 @@ export const SendReviewField = ({ {title} - {subtitle} + {subtitle} ) } diff --git a/tauri-wallet/src/routes/send/SendWizard.tsx b/tauri-wallet/src/routes/send/SendWizard.tsx index 65ed2f9c97..2f41946157 100644 --- a/tauri-wallet/src/routes/send/SendWizard.tsx +++ b/tauri-wallet/src/routes/send/SendWizard.tsx @@ -148,7 +148,7 @@ export const SendWizard = () => { disableElevation style={{ marginRight: theme.spacing(1) }} onClick={handlePreviousStep} - data-testid="backButton" + data-testid="back-button" > Back diff --git a/tauri-wallet/src/routes/sign-in.tsx b/tauri-wallet/src/routes/sign-in.tsx index 14670f9b63..0cbac9f2ac 100644 --- a/tauri-wallet/src/routes/sign-in.tsx +++ b/tauri-wallet/src/routes/sign-in.tsx @@ -100,7 +100,7 @@ const SignInContent = ({ return ( <> - Sign in + Sign in
@@ -239,7 +239,7 @@ const CreateAccountContent = ({ showSignIn }: { showSignIn: () => void }) => { /> Wallet setup complete - + Please store your mnemonic in a safe place. You'll need it to access your wallet @@ -257,7 +257,7 @@ const CreateAccountContent = ({ showSignIn }: { showSignIn: () => void }) => { - {accountDetails.mnemonic} + {accountDetails.mnemonic}
@@ -273,7 +273,7 @@ const CreateAccountContent = ({ showSignIn }: { showSignIn: () => void }) => { - {accountDetails.client_address} + {accountDetails.client_address} @@ -293,7 +293,7 @@ const CreateAccountContent = ({ showSignIn }: { showSignIn: () => void }) => { variant="contained" color="primary" type="submit" - data-testid="createButton" + data-testid="create-button" disableElevation style={{ marginBottom: theme.spacing(1) }} disabled={isLoading} @@ -305,7 +305,7 @@ const CreateAccountContent = ({ showSignIn }: { showSignIn: () => void }) => { fullWidth variant="text" onClick={showSignIn} - data-testid="signInButton" + data-testid="sign-in-button" startIcon={} > Sign in diff --git a/tauri-wallet/src/routes/unbond/index.tsx b/tauri-wallet/src/routes/unbond/index.tsx index 36b7756603..2edca71138 100644 --- a/tauri-wallet/src/routes/unbond/index.tsx +++ b/tauri-wallet/src/routes/unbond/index.tsx @@ -29,10 +29,10 @@ export const Unbond = () => { {ownership?.hasOwnership && ( { setIsLoading(true) @@ -50,7 +50,7 @@ export const Unbond = () => { )} {!ownership.hasOwnership && ( - + You don't currently have a bonded node )} diff --git a/tauri-wallet/src/routes/undelegate/UndelegateForm.tsx b/tauri-wallet/src/routes/undelegate/UndelegateForm.tsx index f897851da0..4be7bacf45 100644 --- a/tauri-wallet/src/routes/undelegate/UndelegateForm.tsx +++ b/tauri-wallet/src/routes/undelegate/UndelegateForm.tsx @@ -84,7 +84,7 @@ export const UndelegateForm = ({ /> - + {`A fee of ${ watchNodeType === EnumNodeType.mixnode ? fees.mixnode.amount @@ -140,7 +140,7 @@ export const UndelegateForm = ({ variant="contained" color="primary" type="submit" - data-testid="submitButton" + data-testid="submit-button" disableElevation disabled={isSubmitting} endIcon={isSubmitting && } diff --git a/tauri-wallet/src/routes/undelegate/index.tsx b/tauri-wallet/src/routes/undelegate/index.tsx index bd9208f1ba..98b6319b08 100644 --- a/tauri-wallet/src/routes/undelegate/index.tsx +++ b/tauri-wallet/src/routes/undelegate/index.tsx @@ -102,14 +102,14 @@ export const Undelegate = () => { + An error occurred with the request: {message} } Success={ {' '} - Undelegation complete + Undelegation complete {message} } @@ -125,7 +125,7 @@ export const Undelegate = () => { }} >