-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from smartcontractkit/gauntlet-start
Gauntlet starter
- Loading branch information
Showing
78 changed files
with
21,371 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: gauntlet | ||
|
||
on: | ||
push: | ||
|
||
jobs: | ||
gauntlet_build: | ||
name: Gauntlet Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@f25a3a9f25bd5f4c5d77189cab02ff357b5aedeb # v2.4.1 | ||
- uses: smartcontractkit/[email protected] | ||
id: tool-versions | ||
- name: Setup Node ${{ steps.tool-versions.outputs.nodejs_version }} | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: ${{ steps.tool-versions.outputs.nodejs_version }} | ||
- name: Install | ||
run: yarn install --frozen-lockfile | ||
- name: Build | ||
run: yarn build | ||
- name: Run Gauntlet | ||
run: yarn gauntlet | ||
|
||
gauntlet_format: | ||
name: Gauntlet Format | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@f25a3a9f25bd5f4c5d77189cab02ff357b5aedeb # v2.4.1 | ||
- uses: smartcontractkit/[email protected] | ||
id: tool-versions | ||
- name: Setup Node ${{ steps.tool-versions.outputs.nodejs_version }} | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: ${{ steps.tool-versions.outputs.nodejs_version }} | ||
- name: Install | ||
run: yarn install --frozen-lockfile | ||
- name: Lint | ||
run: yarn lint:format | ||
|
||
gauntlet_run_tests: | ||
name: Gauntlet Run Tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@f25a3a9f25bd5f4c5d77189cab02ff357b5aedeb # v2.4.1 | ||
- uses: smartcontractkit/[email protected] | ||
id: tool-versions | ||
- name: Setup Node ${{ steps.tool-versions.outputs.nodejs_version }} | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: ${{ steps.tool-versions.outputs.nodejs_version }} | ||
- name: Install | ||
run: yarn install --frozen-lockfile | ||
- name: test:ci | ||
run: yarn test:ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
migrations | ||
programs | ||
tests | ||
ops | ||
packages-rs | ||
relay | ||
target | ||
*.json | ||
dist | ||
*.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"semi": false, | ||
"singleQuote": true, | ||
"printWidth": 120, | ||
"endOfLine": "auto", | ||
"trailingComma": "all" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2022 SmartContract ChainLink, Ltd. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
## Table of Contents | ||
|
||
- Use Gauntlet | ||
- [Local Install](./getting_started.md#setup) | ||
- [Binary](./getting_started.md#binary) | ||
- [Basic Setup](./getting_started.md#basic-setup) | ||
- [CLI](../../packages-ts/gauntlet-starknet-cli/README.md) | ||
- [Example Contract](../../packages-ts/gauntlet-starknet-example/README.md) | ||
- [Account Contract](../../packages-ts/gauntlet-starknet-account/README.md) | ||
- [OCR2 Contracts](../../packages-ts/gauntlet-starknet-ocr2/README.md) | ||
- Contribute |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# Getting started | ||
|
||
## Setup | ||
|
||
Make sure you have Node and Yarn installed | ||
|
||
Node: https://nodejs.org/es/download/ | ||
|
||
Yarn: | ||
|
||
``` | ||
npm install --global yarn | ||
``` | ||
|
||
### Install | ||
|
||
``` | ||
yarn | ||
``` | ||
|
||
### Run | ||
|
||
To see the available commands, run: | ||
|
||
``` | ||
yarn gauntlet | ||
``` | ||
|
||
## Binary | ||
|
||
To easily use Gauntlet, we recommend to use the binary. To generate it, run: | ||
|
||
``` | ||
yarn bundle | ||
``` | ||
|
||
It will generate 2 binaries, for Linux and MacOS distributions. To use them, replace `yarn gauntlet` with `./bin/chainlink-starknet-<linux|macos>` | ||
|
||
```bash | ||
./bin/chainlink-starknet-macos | ||
|
||
🧤 gauntlet 0.2.0 | ||
ℹ️ Available gauntlet commands: | ||
|
||
example: | ||
example:deploy | ||
example:increase_balance | ||
example:inspect | ||
|
||
account: | ||
account:deploy | ||
|
||
|
||
ℹ️ Available global flags: | ||
|
||
--help, -h Display information about command usage | ||
--network The network to connect to | ||
``` | ||
|
||
## Basic Setup | ||
|
||
To deploy or query contracts you do not need any configuration. If you want to execute some contract method, you will need a wallet configured. The details should be added into a `.env` file in the root of the project. | ||
|
||
```bash | ||
## Public key of the account contract | ||
ACCOUNT=0x... | ||
## Private key of the wallet configured on the account contract | ||
PRIVATE_KEY=0x... | ||
``` | ||
|
||
In order to get this configuration, go to [how to setup an account](../../packages-ts/gauntlet-starknet-account/README.md#setup-an-account) | ||
|
||
If you are interacting with a local network and do not want to use any wallet, execute every command with the flag `--noWallet` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
## Integration tests | ||
See examples [here](testing.md) | ||
|
||
See examples [here](testing.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,54 @@ | ||
## Integration tests usage | ||
|
||
Setup k8s context, if you don't have k8s, spin up a local cluster using [this](../kubernetes.md) guide | ||
|
||
### Run tests using ephemeral envs | ||
|
||
``` | ||
make e2e_test | ||
``` | ||
|
||
### Run tests on a standalone local env | ||
|
||
1. Spin up an env, for example, see yaml file for more options with a stark-devnet/pathfinder real node | ||
|
||
``` | ||
envcli new -p ops/chainlink-starknet.yaml | ||
``` | ||
|
||
2. Check created file in a previous command output, example `Environment setup and written to file environmentFile=chainlink-stark-k42hp.yaml` | ||
3. Run the tests | ||
|
||
``` | ||
ENVIRONMENT_FILE="$(pwd)/chainlink-stark-k42hp.yaml" KEEP_ENVIRONMENTS="Always" make e2e_test | ||
``` | ||
|
||
4. Check the env file or connect command logs for a forwarded `local_ports` and try it in the browser | ||
5. Destroy the env | ||
|
||
``` | ||
envcli rm -e chainlink-stark-b7mt9.yaml | ||
``` | ||
|
||
### Interact with an env using other scripts | ||
|
||
1. Spin up an env, for example, see yaml file for more options with a stark-devnet/pathfinder real node | ||
|
||
``` | ||
envcli new -p ops/chainlink-starknet.yaml | ||
``` | ||
|
||
2. Check created file in a previous command output, example `Environment setup and written to file environmentFile=chainlink-stark-mx7rg.yaml` | ||
3. Connect to your env | ||
|
||
``` | ||
envcli connect -e ${your_env_file_yaml} | ||
``` | ||
|
||
4. Check the env file or connect command logs for a forwarded `local_ports` and try it in the browser | ||
5. Interact using other scripts | ||
6. Destroy the env | ||
|
||
``` | ||
envcli rm -e chainlink-stark-b7mt9.yaml | ||
``` | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,19 @@ | ||
# Kubernetes | ||
|
||
We run our software in Kubernetes. | ||
|
||
### Local k3d setup | ||
|
||
1. `make install` | ||
2. (Optional) Install `Lens` from [here](https://k8slens.dev/) or use `k9s` as a low resource consumption alternative from [here](https://k9scli.io/topics/install/) | ||
or from source [here](https://github.com/smartcontractkit/helmenv) | ||
or from source [here](https://github.com/smartcontractkit/helmenv) | ||
3. Setup your docker resources, 6vCPU/10Gb RAM are enough for most CL related tasks | ||
4. `k3d cluster create local` | ||
5. Check your contexts with `kubectl config get-contexts` | ||
6. Switch context `kubectl config use-context k3d-local` | ||
7. Run any tests, use a guide [here](integration-tests/README.md) | ||
8. Stop the cluster | ||
|
||
``` | ||
k3d cluster stop local | ||
``` | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
# Local k8s run | ||
|
||
See [there](../docs/integration-tests/README.md) | ||
|
||
# Integration Tests | ||
For more information, see the [Chainlink StarkNet Documentation | Integration Tests](../docs/integration-tests). | ||
|
||
For more information, see the [Chainlink StarkNet Documentation | Integration Tests](../docs/integration-tests). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
module.exports = { | ||
rootDir: '.', | ||
projects: [ | ||
{ | ||
displayName: 'gauntlet-starknet', | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
testMatch: ['<rootDir>/packages-ts/gauntlet-starknet/**/*.test.ts'], | ||
globals: { | ||
'ts-jest': { | ||
tsconfig: '<rootDir>/packages-ts/gauntlet-starknet/tsconfig.json', | ||
}, | ||
}, | ||
}, | ||
{ | ||
displayName: 'gauntlet-starknet-account', | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
testMatch: ['<rootDir>/packages-ts/gauntlet-starknet-account/**/*.test.ts'], | ||
globals: { | ||
'ts-jest': { | ||
tsconfig: '<rootDir>/packages-ts/gauntlet-starknet-account/tsconfig.json', | ||
}, | ||
}, | ||
}, | ||
{ | ||
displayName: 'gauntlet-starknet-ocr2', | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
testMatch: ['<rootDir>/packages-ts/gauntlet-starknet-ocr2/**/*.test.ts'], | ||
globals: { | ||
'ts-jest': { | ||
tsconfig: '<rootDir>/packages-ts/gauntlet-starknet-ocr2/tsconfig.json', | ||
}, | ||
}, | ||
}, | ||
], | ||
} |
Oops, something went wrong.