Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add E2E test suite [WIP] #49

Merged
merged 21 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions e2e/.czrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"path": "cz-conventional-changelog"
}
16 changes: 16 additions & 0 deletions e2e/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# EditorConfig http://EditorConfig.org

# top-most EditorConfig file
root = true

# All files
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.sol]
indent_size = 4
9 changes: 9 additions & 0 deletions e2e/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export MNEMONIC="adapt mosquito move limb mobile illegal tree voyage juice mosquito burger raise father hope layer"

export TFHE_EXECUTOR_CONTRACT_ADDRESS=0x687408aB54661ba0b4aeF3a44156c616c6955E07
export ACL_CONTRACT_ADDRESS=0xFee8407e2f5e3Ee68ad77cAE98c434e637f516e5
export PAYMENT_CONTRACT_ADDRESS=0xFb03BE574d14C256D56F09a198B586bdfc0A9de2
export KMS_VERIFIER_CONTRACT_ADDRESS=0x9D6891A6240D6130c54ae243d8005063D05fE14b
export GATEWAY_CONTRACT_ADDRESS=0x33347831500F1e73f0ccCBb95c9f86B94d7b1123

export GATEWAY_URL="https://gateway-sepolia.kms-dev-v1.bc.zama.team/"
26 changes: 26 additions & 0 deletions e2e/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# directories
.coverage_artifacts
.coverage_cache
.coverage_contracts
artifacts
build
cache
coverage
dist
node_modules
/types
deployments
kms-fhe-keys/
network-fhe-keys/
fhevmTemp/
abi/

# files
*.env
*.log
.env.docker
.DS_Store
.pnp.*
coverage.json
pnpm-lock.yaml
yarn.lock
10 changes: 10 additions & 0 deletions e2e/.gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
image: "gitpod/workspace-node:latest"

tasks:
- init: "pnpm install"

vscode:
extensions:
- "esbenp.prettier-vscode"
- "NomicFoundation.hardhat-solidity"
- "ritwickdey.LiveServer"
22 changes: 22 additions & 0 deletions e2e/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# directories
.coverage_artifacts
.coverage_cache
.coverage_contracts
artifacts
build
cache
coverage
dist
node_modules
types

# files
*.env
*.log
.DS_Store
.pnp.*
coverage.json
package-lock.json
pnpm-lock.yaml
yarn.lock
README.md
23 changes: 23 additions & 0 deletions e2e/.prettierrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
bracketSpacing: true
plugins:
- "@trivago/prettier-plugin-sort-imports"
- "prettier-plugin-solidity"
printWidth: 120
proseWrap: "always"
singleQuote: false
tabWidth: 2
trailingComma: "all"

overrides:
- files: "*.sol"
options:
compiler: "0.8.24"
parser: "solidity-parse"
tabWidth: 4
- files: "*.ts"
options:
importOrder: ["<THIRD_PARTY_MODULES>", "^[./]"]
importOrderParserPlugins: ["typescript"]
importOrderSeparation: true
importOrderSortSpecifiers: true
parser: "typescript"
11 changes: 11 additions & 0 deletions e2e/.solcover.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
istanbulReporter: ["html", "lcov"],
providerOptions: {
mnemonic: process.env.MNEMONIC,
},
skipFiles: ["test", "fhevmTemp"],
mocha: {
fgrep: "[skip-on-coverage]",
invert: true,
},
};
24 changes: 24 additions & 0 deletions e2e/.solhint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"extends": "solhint:recommended",
"plugins": ["prettier"],
"rules": {
"const-name-snakecase": "off",
"no-global-import": "off",
"reason-string": "off",
"state-visibility": "off",
"custom-errors": "off",
"code-complexity": ["error", 8],
"compiler-version": ["error", ">=0.8.4"],
"func-visibility": ["error", { "ignoreConstructors": true }],
"max-line-length": ["error", 120],
"named-parameters-mapping": "off",
"no-console": "off",
"not-rely-on-time": "off",
"prettier/prettier": [
"error",
{
"endOfLine": "auto"
}
]
}
}
3 changes: 3 additions & 0 deletions e2e/.solhintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# directories
**/artifacts
**/node_modules
24 changes: 24 additions & 0 deletions e2e/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
BSD 3-Clause Clear License

Copyright © 2024 ZAMA. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of ZAMA nor the names of its contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY
THE ZAMA AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ZAMA OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
29 changes: 29 additions & 0 deletions e2e/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# e2e tests

## Install

```bash
npm install
```

## Configuration

1. Copy `.env.example` to `.env` and edit addresses with the correct one.
2. Edit your `.env` file with correct values.
3. Edit `contracts/E2EFHEVMConfig.sol` and set correct addresses of your fhEVM.
4. Edit `hardhat.config.ts` to set the `defaultNetwork`. By default, it is set to Sepolia, but you can a different one
or add your own L1 address. 4. Fund your wallet
5. Fund the primary wallet derived from your mnemomic. If you don't know what is the public address, run
`npm run task:accounts`

## Run

```bash
npm run test
```

or if you want to run only one test

```bash
npm run test test/encryptedERC20/EncryptedERC20.ts
```
Loading