Skip to content

Commit

Permalink
Merge pull request #447 from valory-xyz/chore/merge-latest-middleware…
Browse files Browse the repository at this point in the history
…-branch

Merge latest into frontend refactor branch
  • Loading branch information
truemiller authored Nov 13, 2024
2 parents bb4c251 + 37f6f75 commit e917cb1
Show file tree
Hide file tree
Showing 76 changed files with 4,594 additions and 2,534 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ jobs:
with:
node-version: "20.x"

# Configure Yarn network settings for timeout, retries, and reduced concurrency
- name: Configure Yarn network settings
run: |
yarn config set network-timeout 60000 # Set network timeout to 1 minute
yarn config set network-retries 10 # Retry up to 10 times
yarn config set network-concurrency 2 # Reduce concurrency to 2 connections
# Python
- uses: actions/setup-python@v4
with:
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ jobs:
with:
node-version: "20.x"

# Configure Yarn network settings for timeout, retries, and reduced concurrency
- name: Configure Yarn network settings
run: |
yarn config set network-timeout 60000 # Set network timeout to 1 minute
yarn config set network-retries 10 # Retry up to 10 times
yarn config set network-concurrency 2 # Reduce concurrency to 2 connections
# Install dependencies
- name: Install dependencies
run: yarn install:frontend
Expand Down
57 changes: 39 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-14, macos-14-large]
os: [macos-14]
arch: [arm64, x64]

steps:
- uses: actions/checkout@v3

# Setup Python
- uses: actions/setup-python@v4
# Set up Python with setup-python action and add it to PATH
- uses: actions/setup-python@v5
id: setup-python
with:
python-version: "3.10"

Expand All @@ -32,10 +34,10 @@ jobs:
virtualenvs-path: ~/my-custom-path
installer-parallel: true

# Set architecture for macos-latest-large as x64 and arm64 for other versions
# Set OS_ARCH env
- name: Set architecture environment variable
run: |
if [ "${{ matrix.os }}" == "macos-14-large" ]; then echo "OS_ARCH=x64" >> $GITHUB_ENV; else echo "OS_ARCH=arm64" >> $GITHUB_ENV; fi
run:
echo "OS_ARCH=${{ matrix.arch }}" >> $GITHUB_ENV;

# Cache Poetry dependencies with unique key for each environment and architecture
- name: Cache Poetry dependencies
Expand All @@ -45,34 +47,45 @@ jobs:
~/.cache/pypoetry
~/.cache/pip
~/.venv
key: poetry-${{ env.OS_ARCH }}-${{ hashFiles('**/poetry.lock') }}
key: poetry-${{ matrix.arch }}-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
poetry-${{ env.OS_ARCH }}-
poetry-${{ matrix.arch }}-
- name: Install dependencies
run: poetry install

# Download and build with PyInstaller
- name: Get trader bin
run: |
optimus_version=$(poetry run python -c "import yaml; config = yaml.safe_load(open('templates/optimus.yaml')); print(config['service_version'])")
echo $optimus_version
mkdir dist && curl -L -o dist/aea_bin "https://github.com/valory-xyz/optimus/releases/download/${$optimus_version}/optimus_bin_${{ env.OS_ARCH }}"
trader_version=$(poetry run python -c "import yaml; config = yaml.safe_load(open('templates/trader.yaml')); print(config['service_version'])")
echo $trader_version
make ./dist/aea_bin
#instead of this one mwe use make; mkdir dist && curl -L -o dist/aea_bin "https://github.com/valory-xyz/trader/releases/download/${trader_version}/trader_bin_${{ env.OS_ARCH }}"

# -- old optimus getter
# optimus_version=$(poetry run python -c "import yaml; config = yaml.safe_load(open('templates/optimus.yaml')); print(config['service_version'])")
# echo $optimus_version
# mkdir dist && curl -L -o dist/aea_bin "https://github.com/valory-xyz/optimus/releases/download/${$optimus_version}/optimus_bin_${{ env.OS_ARCH }}"
- name: Build with PyInstaller
run: |
poetry run pyinstaller operate/services/utils/tendermint.py --onefile
# patch open aea in place
rm -fr ./open-aea
git clone https://github.com/valory-xyz/open-aea.git -b fix/1.5.2_encoding
poetry run pip install ./open-aea/
poetry run pyinstaller --collect-data eth_account --collect-all aea --collect-all autonomy --collect-all operate --collect-all aea_ledger_ethereum --collect-all aea_ledger_cosmos --collect-all aea_ledger_ethereum_flashbots --hidden-import aea_ledger_ethereum --hidden-import aea_ledger_cosmos --hidden-import aea_ledger_ethereum_flashbots operate/pearl.py --add-binary dist/aea_bin:. --add-binary dist/tendermint:. --onefile --name pearl_${{ env.OS_ARCH }}
- name: Upload Release Assets
uses: actions/upload-artifact@v4
with:
name: pearl_${{ env.OS_ARCH }}
path: dist/pearl_${{ env.OS_ARCH }}
name: pearl_${{ matrix.arch }}
path: dist/pearl_${{ matrix.arch }}

# Jobs for production and development, running separately for x64 and arm64
build-release:
runs-on: macos-latest
runs-on: macos-14
strategy:
matrix:
env: [production, development]
Expand All @@ -86,7 +99,15 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org"
registry-url: "https://registry.npmjs.org"

# Configure Yarn network settings for timeout, retries, and reduced concurrency
- name: Configure Yarn network settings
run: |
yarn config set network-timeout 60000 # Set network timeout to 1 minute
yarn config set network-retries 10 # Retry up to 10 times
yarn config set network-concurrency 2 # Reduce concurrency to 2 connections

# Download the appropriate architecture artifact
- name: Download Pearl (Optimus) binary for architecture
Expand Down Expand Up @@ -151,7 +172,7 @@ jobs:
env:
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLEIDPASS }}
APPLE_ID: ${{ secrets.APPLEID }}
APPLETEAMID: ${{ secrets.APPLETEAMID }}
APPLE_TEAM_ID: ${{ secrets.APPLETEAMID }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
CSC_LINK: ${{ secrets.CSC_LINK }}
GH_TOKEN: ${{ secrets.github_token }}
Expand All @@ -167,7 +188,7 @@ jobs:
env:
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLEIDPASS }}
APPLE_ID: ${{ secrets.APPLEID }}
APPLETEAMID: ${{ secrets.APPLETEAMID }}
APPLE_TEAM_ID: ${{ secrets.APPLETEAMID }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
CSC_LINK: ${{ secrets.CSC_LINK }}
GH_TOKEN: ${{ secrets.github_token }}
Expand Down
16 changes: 14 additions & 2 deletions .github/workflows/release_win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,27 @@ jobs:
steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4
# Set up Python with setup-python action and add it to PATH
- uses: actions/setup-python@v5
id: setup-python
with:
python-version: "3.10"

- name: Add Python to PATH
run: |
echo "${{ steps.setup-python.outputs.python-path }}" >> $GITHUB_PATH
- uses: actions/setup-node@v4
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org"
registry-url: "https://registry.npmjs.org"

# Configure Yarn network settings for timeout, retries, and reduced concurrency
- name: Configure Yarn network settings
run: |
yarn config set network-timeout 60000 # Set network timeout to 1 minute
yarn config set network-retries 10 # Retry up to 10 times
yarn config set network-concurrency 2 # Reduce concurrency to 2 connections
- name: Install and configure Poetry
uses: snok/install-poetry@v1
Expand Down
8 changes: 4 additions & 4 deletions .gitleaksignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ ada5590acaa13a35afb62c368b13c3601e658c0c:operate/services/manage.py:generic-api-
ada5590acaa13a35afb62c368b13c3601e658c0c:operate/services/manage.py:generic-api-key:449
ef9ec7a111816282b6185e8268a460d02329fbe4:api.md:generic-api-key:13
ef9ec7a111816282b6185e8268a460d02329fbe4:api.md:generic-api-key:37
44388a82d29ce4d96e554c828c3c2c12d6ee3b8a:operate/data/contracts/service_staking_token/contract.yaml:generic-api-key:10
43bb67ace89a4a6e0eee84d3ee6495088288c528:backend/operate/data/contracts/service_staking_token/contract.yaml:generic-api-key:10
19ecb1e59813c632971658183a9f2d9d88e0614b:backend/operate/data/contracts/service_staking_token/contract.yaml:generic-api-key:10
44388a82d29ce4d96e554c828c3c2c12d6ee3b8a:operate/data/contracts/staking_token/contract.yaml:generic-api-key:10
43bb67ace89a4a6e0eee84d3ee6495088288c528:backend/operate/data/contracts/staking_token/contract.yaml:generic-api-key:10
19ecb1e59813c632971658183a9f2d9d88e0614b:backend/operate/data/contracts/staking_token/contract.yaml:generic-api-key:10
37847b0c322a0dbc8987df526a49df70301e44d4:backend/operate/ledger/profiles.py:generic-api-key:29
6834023917760bf7875cc7c107e0c59ad7925ef4:backend/operate/ledger/profiles.py:generic-api-key:32
4e8c1c21dffd9283195052117ad4c371f770e0b2:backend/operate/ledger/profiles.py:generic-api-key:28
Expand All @@ -17,7 +17,7 @@ daf41a143aa8c483db584ba1e7222e8eafec1d3b:backend/controller.py:generic-api-key:2
af77e930289cbc87987567bff0efc25936484df2:backend/controller.py:generic-api-key:354b04972639d66053109596d3b73a1d91688964ebb:electron/constants/publishOptions.js:github-fine-grained-pat:3
b04972639d66053109596d3b73a1d91688964ebb:electron/constants/publishOptions.js:github-fine-grained-pat:3
af77e930289cbc87987567bff0efc25936484df2:backend/controller.py:generic-api-key:354
e7de9ce0b902ed6d68f8c5b033d044f39b08f5a1:operate/data/contracts/service_staking_token/contract.yaml:generic-api-key:10
e7de9ce0b902ed6d68f8c5b033d044f39b08f5a1:operate/data/contracts/staking_token/contract.yaml:generic-api-key:10
d8149e9b5b7bd6a7ed7bc1039900702f1d4f287b:operate/services/manage.py:generic-api-key:405
d8149e9b5b7bd6a7ed7bc1039900702f1d4f287b:operate/services/manage.py:generic-api-key:406
d8149e9b5b7bd6a7ed7bc1039900702f1d4f287b:operate/services/manage.py:generic-api-key:454
Expand Down
11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,26 @@ endef

./dist/aea_win.exe: ./trader/
mkdir -p dist
cd trader && poetry install && poetry run pyinstaller --collect-data eth_account --collect-all aea --collect-all autonomy --collect-all operate --collect-all aea_ledger_ethereum --collect-all aea_ledger_cosmos --collect-all aea_ledger_ethereum_flashbots --hidden-import aea_ledger_ethereum --hidden-import aea_ledger_cosmos --hidden-import aea_ledger_ethereum_flashbots --hidden-import grpc --hidden-import openapi_core --collect-all google.protobuf --collect-all openapi_core --collect-all openapi_spec_validator --collect-all asn1crypto --hidden-import py_ecc --hidden-import pytz --onefile pyinstaller/trader_bin.py --name trader_win
cd trader && poetry install && rm -fr ./open-aea && git clone https://github.com/valory-xyz/open-aea.git -b fix/1.5.2_encoding && poetry run pip install ./open-aea/ && poetry run pyinstaller --collect-data eth_account --collect-all aea --collect-all autonomy --collect-all operate --collect-all aea_ledger_ethereum --collect-all aea_ledger_cosmos --collect-all aea_ledger_ethereum_flashbots --hidden-import aea_ledger_ethereum --hidden-import aea_ledger_cosmos --hidden-import aea_ledger_ethereum_flashbots --hidden-import grpc --hidden-import openapi_core --collect-all google.protobuf --collect-all openapi_core --collect-all openapi_spec_validator --collect-all asn1crypto --hidden-import py_ecc --hidden-import pytz --onefile pyinstaller/trader_bin.py --name trader_win
cp -f trader/dist/trader_win.exe ./dist/aea_win.exe
pwd


./dist/aea_bin: ./trader/
mkdir -p dist
cd trader && poetry install && rm -fr ./open-aea && git clone https://github.com/valory-xyz/open-aea.git -b fix/1.5.2_encoding && poetry run pip install ./open-aea/ && poetry run pyinstaller --collect-data eth_account --collect-all aea --collect-all autonomy --collect-all operate --collect-all aea_ledger_ethereum --collect-all aea_ledger_cosmos --collect-all aea_ledger_ethereum_flashbots --hidden-import aea_ledger_ethereum --hidden-import aea_ledger_cosmos --hidden-import aea_ledger_ethereum_flashbots --hidden-import grpc --hidden-import openapi_core --collect-all google.protobuf --collect-all openapi_core --collect-all openapi_spec_validator --collect-all asn1crypto --hidden-import py_ecc --hidden-import pytz --onefile pyinstaller/trader_bin.py --name trader_bin
cp -f trader/dist/trader_bin ./dist/aea_bin
pwd


./dist/tendermint_win.exe: ./operate/
pwd
poetry install && poetry run pyinstaller operate/services/utils/tendermint.py --onefile --name tendermint_win


./dist/pearl_win.exe: ./operate/ ./dist/aea_win.exe ./dist/tendermint_win.exe
pwd
poetry install && poetry run pyinstaller --collect-data eth_account --collect-all aea --collect-all coincurve --collect-all autonomy --collect-all operate --collect-all aea_ledger_ethereum --collect-all aea_ledger_cosmos --collect-all aea_ledger_ethereum_flashbots --hidden-import aea_ledger_ethereum --hidden-import aea_ledger_cosmos --hidden-import aea_ledger_ethereum_flashbots operate/pearl.py --add-binary dist/aea_win.exe:. --add-binary dist/tendermint_win.exe:. --onefile --name pearl_win
poetry install && rm -fr ./open-aea && git clone https://github.com/valory-xyz/open-aea.git -b fix/1.5.2_encoding && poetry run pip install ./open-aea/ && poetry run pyinstaller --collect-data eth_account --collect-all aea --collect-all coincurve --collect-all autonomy --collect-all operate --collect-all aea_ledger_ethereum --collect-all aea_ledger_cosmos --collect-all aea_ledger_ethereum_flashbots --hidden-import aea_ledger_ethereum --hidden-import aea_ledger_cosmos --hidden-import aea_ledger_ethereum_flashbots operate/pearl.py --add-binary dist/aea_win.exe:. --add-binary dist/tendermint_win.exe:. --onefile --name pearl_win


./electron/bins/:
Expand Down
8 changes: 5 additions & 3 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ Creates a master key for given chain type.
"address": "0xAafd5cb31a611C5e5aa65ea8c6226EB4328175E1",
"safe_chains": [],
"ledger_type": 0,
"safe": null,
"safes": {},
"safe_nonce": null
},
"mnemonic": [...]
Expand All @@ -205,7 +205,7 @@ Creates a master key for given chain type.
</details>

---
#### `PUT /api/wallet`
#### `POST /api/wallet/safe`

Creates a gnosis safe for given chain type.

Expand All @@ -230,7 +230,9 @@ Creates a gnosis safe for given chain type.
2
],
"ledger_type": 0,
"safe": "0xe56fb574ce2C66008d5c4C09980c4f36Ab81ff22",
"safes": {
"2": "0xe56fb574ce2C66008d5c4C09980c4f36Ab81ff22"
},
"safe_nonce": 110558881674480320952254000342160989674913430251157716140571305138121962898821
}
```
Expand Down
6 changes: 5 additions & 1 deletion build-win-tenderly.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,8 @@ const main = async () => {
});
};

main().then((response) => { console.log('Build & Notarize complete'); }).catch((e) => console.error(e));
main().then(() => {
console.log('Build & Notarize complete');
}).catch(() => {
throw new Error('Failed to build and notarize.');
});
6 changes: 5 additions & 1 deletion build-win.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,8 @@ const main = async () => {
});
};

main().then((response) => { console.log('Build & Notarize complete'); }).catch((e) => console.error(e));
main().then(() => {
console.log('Build & Notarize complete');
}).catch(() => {
throw new Error('Failed to build and notarize.');
});
9 changes: 5 additions & 4 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,13 @@ const main = async () => {
gatekeeperAssess: false,
entitlements: 'electron/entitlements.mac.plist',
entitlementsInherit: 'electron/entitlements.mac.plist',
notarize: {
teamId: process.env.APPLETEAMID,
},
},
},
});
};

main().then((response) => { console.log('Build & Notarize complete'); }).catch((e) => console.error(e));
main().then(() => {
console.log('Build & Notarize complete');
}).catch(() => {
throw new Error('Failed to build and notarize.');
});
6 changes: 5 additions & 1 deletion build.tester.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,8 @@ const main = async () => {
});
};

main().then((response) => { console.log('Build & Notarize complete'); }).catch((e) => console.error(e));
main().then(() => {
console.log('Build & Notarize complete');
}).catch(() => {
throw new Error('Failed to build and notarize.');
});
2 changes: 1 addition & 1 deletion electron/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const Env = {
PATH: `${process.env.PATH}:/opt/homebrew/bin:/usr/local/bin`,
HOMEBREW_NO_AUTO_UPDATE: '1',
PYTHONUTF8: '1',
PYTHONIOENCODING: 'utf8'
PYTHONIOENCODING: 'utf-8'
};

const SudoOptions = {
Expand Down
Loading

0 comments on commit e917cb1

Please sign in to comment.