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

chore: add testing configuration #250

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
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
8 changes: 5 additions & 3 deletions .github/workflows/zksync-integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ on:
push:
branches:
- main
- develop
pull_request:
types: [opened, synchronize, reopened]
# - develop
# pull_request:
# types: [opened, synchronize, reopened]
workflow_dispatch:

defaults:
Expand Down Expand Up @@ -87,6 +87,8 @@ jobs:
echo sleeping 250 to wait for ./start to setup
sleep 250

cat docker_output.log

export ZKSYNC_DIAMOND_PROXY_ADDRESS=$(cat docker_output.log | sed -n 's/.*CONTRACTS_DIAMOND_PROXY_ADDR=\(0x[a-fA-F0-9]*\).*/\1/p')
echo stored ZKSYNC_DIAMOND_PROXY_ADDRESS variable:
echo $ZKSYNC_DIAMOND_PROXY_ADDRESS
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/zksync-scripts/claim_payment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ echo "Withdrawing $BRIDGE_AMOUNT_ETH ETH" # == $BRIDGE_AMOUNT_WEI WEI"
cast send --rpc-url $ETHEREUM_RPC --private-key $ETHEREUM_PRIVATE_KEY --gas-price 2000000000 \
$PAYMENT_REGISTRY_PROXY_ADDRESS "claimPaymentZKSync(uint256, address, uint256, uint256, uint256)" \
"0" $USER_ETHEREUM_PUBLIC_ADDRESS $BRIDGE_AMOUNT_WEI 2000000 800 \
--value 5000000000000000000 > /dev/null
--value 5000000000000000000

BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT_WEI=$(cast balance --rpc-url http://localhost:3050 $ZKSYNC_ESCROW_CONTRACT_ADDRESS) #for assert.sh
BALANCE_ESCROW_L2_AFTER_CLAIMPAYMENT=$(cast balance --rpc-url http://localhost:3050 --ether $ZKSYNC_ESCROW_CONTRACT_ADDRESS) #for logging
Expand Down
2 changes: 1 addition & 1 deletion contracts/zksync/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const config: HardhatUserConfig = {
},
},
zksolc: {
version: "latest",
version: "1.4.0",
settings: {
// find all available options in the official documentation
// https://era.zksync.io/docs/tools/hardhat/hardhat-zksync-solc.html#configuration
Expand Down
4 changes: 4 additions & 0 deletions mm-bot/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,7 @@ create_db:
docker run --name $(container) -e POSTGRES_PASSWORD=$(password) -e POSTGRES_USER=$(user) -p 5432:5432 -d postgres
sleep 5 # Wait for the PostgreSQL container to start (you can adjust this as needed)
docker exec -it $(container) psql -U $(user) -c 'CREATE DATABASE "$(database)" WITH ENCODING "UTF-8";'

tests:
@echo "Running tests..."
pytest ./tests/*_test.py
4 changes: 2 additions & 2 deletions mm-bot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ To start the Bot, you can use the following command:
make run
```

## Test [TODO]
## Test
To run the tests, you can use the following command:

```bash

make tests
```
2 changes: 2 additions & 0 deletions mm-bot/src/config/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@
LOGGING_DIRECTORY = os.getenv('LOGGING_DIRECTORY')

PAYMENT_CLAIMER = os.getenv('PAYMENT_CLAIMER')

SQL_LITE_DATABASE_URL = "sqlite:///:memory:"
11 changes: 11 additions & 0 deletions mm-bot/src/config/testing_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker, declarative_base
from config import constants

Engine = create_engine(
constants.SQL_LITE_DATABASE_URL, connect_args={"check_same_thread": False}
)

SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=Engine)

Base = declarative_base()
Loading