Skip to content

Commit 871f1e6

Browse files
ci: setup test and sast pipelines (#6)
* ci: introduce sast * ci: introduce unit tests * chore: format retryable_eth_module.py * chore: use make commands * chore: test * chore: remove versions from setup.cfg
1 parent 216cd1a commit 871f1e6

File tree

9 files changed

+138
-22
lines changed

9 files changed

+138
-22
lines changed

Diff for: .gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.sol linguist-language=Solidity
2+
*.vy linguist-language=Python

Diff for: .github/workflows/sast.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: SAST
2+
on:
3+
pull_request:
4+
types: [opened, synchronize]
5+
jobs:
6+
run-sast:
7+
runs-on: ubuntu-latest
8+
timeout-minutes: 10
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v3
12+
- name: Set up Python
13+
uses: actions/setup-python@v4
14+
with:
15+
python-version-file: .python-version
16+
- run: |
17+
make install
18+
- uses: AppThreat/sast-scan-action@master
19+
with:
20+
output: reports
21+
type: python, depscan
22+
- uses: actions/upload-artifact@v3
23+
with:
24+
name: reports
25+
path: reports
26+
retention-days: 5

Diff for: .github/workflows/tests.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Run tests
2+
on:
3+
pull_request:
4+
types: [opened, synchronize]
5+
jobs:
6+
run-tests:
7+
runs-on: ubuntu-latest
8+
timeout-minutes: 10
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v3
12+
- name: Set up Python
13+
uses: actions/setup-python@v4
14+
with:
15+
python-version-file: .python-version
16+
- run: |
17+
make install
18+
- name: Check style format
19+
run: make lint
20+
- name: Use Node.js
21+
uses: actions/setup-node@v3
22+
with:
23+
node-version: '16.14.2'
24+
cache: 'npm'
25+
- name: Install Node.js dependencies
26+
run: |
27+
npm ci
28+
- name: Run tests
29+
run: make test

Diff for: .gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ develop-eggs
3232
lib
3333
lib64
3434
venv*
35-
.python-version
3635

3736
# Installer logs
3837
pip-log.txt

Diff for: .python-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.10.5

Diff for: Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ clean-pyc:
1919
find . -name '*.pyo' -exec rm -f {} +
2020
find . -name '*~' -exec rm -f {} +
2121

22+
lint:
23+
black --check .
24+
2225
format:
2326
black .
2427

Diff for: brownie-config.yaml

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
project_structure:
2+
build: build
3+
contracts: contracts
4+
interfaces: interfaces
5+
reports: reports
6+
scripts: scripts
7+
tests: tests
8+
9+
networks:
10+
default: ${DEFAULT_NETWORK:-hardhat}
11+
development:
12+
gas_limit: max
13+
gas_buffer: 1
14+
gas_price: 0
15+
max_fee: null
16+
priority_fee: null
17+
reverting_tx_gas_limit: max
18+
default_contract_owner: true
19+
cmd_settings: null
20+
live:
21+
gas_limit: auto
22+
gas_buffer: 1.1
23+
gas_price: auto
24+
max_fee: null
25+
priority_fee: null
26+
reverting_tx_gas_limit: false
27+
default_contract_owner: false
28+
29+
compiler:
30+
evm_version: null
31+
solc:
32+
version: "0.8.7"
33+
optimizer:
34+
enabled: true
35+
runs: 200
36+
vyper:
37+
version: null
38+
39+
console:
40+
show_colors: true
41+
color_style: monokai
42+
auto_suggest: true
43+
completions: true
44+
editing_mode: emacs
45+
46+
reports:
47+
exclude_paths: null
48+
exclude_contracts: null
49+
only_include_project: true
50+
51+
hypothesis:
52+
deadline: null
53+
max_examples: 50
54+
report_multiple_bugs: False
55+
stateful_step_count: 10
56+
phases:
57+
explicit: true
58+
reuse: true
59+
generate: true
60+
target: true
61+
shrink: true
62+
63+
autofetch_sources: false
64+
dev_deployment_artifacts: false

Diff for: hardhat.config.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
21
// autogenerated by brownie
32
// do not modify the existing settings
43
module.exports = {
5-
networks: {
6-
hardhat: {
7-
hardfork: "london",
8-
// base fee of 0 allows use of 0 gas price when testing
9-
initialBaseFeePerGas: 0,
10-
// brownie expects calls and transactions to throw on revert
11-
throwOnTransactionFailures: true,
12-
throwOnCallFailures: true
13-
}
14-
}
15-
}
4+
networks: {
5+
hardhat: {
6+
hardfork: "merge",
7+
// base fee of 0 allows use of 0 gas price when testing
8+
initialBaseFeePerGas: 0,
9+
// brownie expects calls and transactions to throw on revert
10+
throwOnTransactionFailures: true,
11+
throwOnCallFailures: true,
12+
loggingEnabled: true
13+
}
14+
}
15+
}

Diff for: web3_utils/retryable_eth_module.py

+1-9
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,7 @@
66
import typing
77
from aiohttp import ClientConnectorError
88
from requests import HTTPError, ConnectionError
9-
from tenacity import (
10-
retry,
11-
retry_if_exception_type,
12-
wait_fixed,
13-
RetryCallState,
14-
retry_any,
15-
retry_if_exception,
16-
stop_never
17-
)
9+
from tenacity import retry, retry_if_exception_type, wait_fixed, RetryCallState, retry_any, retry_if_exception, stop_never
1810
from tenacity._utils import get_callback_name
1911
from web3.eth import Eth, AsyncEth
2012
from web3.exceptions import TransactionNotFound, BlockNotFound

0 commit comments

Comments
 (0)