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

fix: rewards-related flicker #337

Closed
wants to merge 70 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
8967e9b
initial win support
solarw Aug 5, 2024
da1579a
Merge branch 'main' of github.com:valory-xyz/olas-operate-app into fe…
solarw Aug 8, 2024
18c234b
Merge branch 'staging' of github.com:valory-xyz/olas-operate-app into…
solarw Aug 8, 2024
d1015e7
win: process kill fixes
solarw Aug 13, 2024
0e5dfbf
Merge branch 'staging' of github.com:valory-xyz/olas-operate-app into…
solarw Aug 13, 2024
0930ac2
win: tendermint installation automated
solarw Aug 13, 2024
e42ba6e
helthchecker env vars to switch it off. small refactoring
solarw Aug 19, 2024
f793a03
Merge branch 'feat/contract-migration-ui' of github.com:valory-xyz/ol…
solarw Aug 20, 2024
bccc559
service hash id updated
solarw Aug 23, 2024
8f6cea6
use bundled in tendermint.exe, not download it
solarw Aug 29, 2024
d06eb95
Merge branch 'staging' of github.com:valory-xyz/olas-operate-app into…
solarw Aug 29, 2024
bc234f8
Merge branch 'staging' of github.com:valory-xyz/olas-operate-app into…
solarw Aug 29, 2024
5d6b007
Merge branch 'staging' of github.com:valory-xyz/olas-operate-app into…
solarw Aug 30, 2024
b398318
Merge branch 'main' of github.com:valory-xyz/olas-operate-app into fe…
solarw Aug 30, 2024
d80ef14
lint fixes
solarw Aug 30, 2024
0adeefa
feat: add staking deployment vars
jmoreira-valory Sep 2, 2024
ef1bbe0
feat: added pearl beta 2 address & section
truemiller Sep 3, 2024
32872ad
chore: add pearl beta 2 address
jmoreira-valory Sep 3, 2024
4f90bd5
Merge remote-tracking branch 'origin/feat/update_staking' into feat/u…
jmoreira-valory Sep 3, 2024
e5e107c
chore: init
mohandast52 Sep 3, 2024
0ae8d9f
chore: comment env example
truemiller Sep 3, 2024
b86056a
fix: isNil check for low balance
truemiller Sep 3, 2024
440f5e5
fix: serviceFundRequirements coalesce
truemiller Sep 3, 2024
b1da55f
refactor: order and map staking contracts
truemiller Sep 3, 2024
e9a53bb
fix: required olas when both staked and not staked
truemiller Sep 3, 2024
5d2d0fd
feat: update StakingContractSection to support multi-contract
truemiller Sep 3, 2024
9f7e41b
feat: updated STAKING_PROGRAM_META with deprecated and supported migr…
truemiller Sep 3, 2024
66eac9c
fix: isAddress checks to protect against 0xm
truemiller Sep 3, 2024
3291615
feat: added pearl_beta_2 to StakingContractInfo record
truemiller Sep 3, 2024
93a96cb
feat: add pearl_beta_2 Beta2 enum
truemiller Sep 3, 2024
47b353a
chore: comment availableRewards until it's used
truemiller Sep 3, 2024
664b3cb
feat: extend serviceStakingMechUsageContracts with pearl_beta_2, prot…
truemiller Sep 3, 2024
9d22c47
fix: protect against -1 serviceId related errors
truemiller Sep 3, 2024
901d19b
feat: add pearl_beta_2 requirement
truemiller Sep 3, 2024
3293996
bump: rc124 for test release
truemiller Sep 3, 2024
bbb74f0
add staking contract update button in homepage
mohandast52 Sep 3, 2024
78db173
Merge pull request #313 from valory-xyz/feat/update_staking
mohandast52 Sep 3, 2024
8124fd8
Merge branch 'staging' of github.com-personal:valory-xyz/olas-operate…
mohandast52 Sep 4, 2024
a98590f
update contract UI
mohandast52 Sep 4, 2024
11cb12a
update
mohandast52 Sep 4, 2024
9209c3f
win release updates
solarw Aug 30, 2024
88c39ab
Merge branch 'staging' of github.com:valory-xyz/olas-operate-app into…
solarw Sep 4, 2024
ad8a653
add loading state
mohandast52 Sep 4, 2024
19c375d
workflow cleanup
solarw Sep 4, 2024
b78b8ca
Merge pull request #260 from valory-xyz/feat/win-support
truemiller Sep 4, 2024
94df634
Merge pull request #315 from valory-xyz/mohan/staking-contract-ui
mohandast52 Sep 4, 2024
4de52d2
fix: default contract fallback, instead of "not staked"
truemiller Sep 4, 2024
d4578c6
fix: broken import (kebabCase import)
truemiller Sep 4, 2024
a192da8
Merge pull request #316 from valory-xyz/fix/selected-fallback
truemiller Sep 4, 2024
de4b0d9
bump: rc125
truemiller Sep 4, 2024
d83f04c
win build poetry version bump
solarw Sep 4, 2024
29d9edf
fix: added minimum staking duration to migration condition
truemiller Sep 4, 2024
4a0d4d7
fix for windows tendermint bundle in
solarw Sep 4, 2024
5745a56
Merge pull request #320 from valory-xyz/poetry-win-test
truemiller Sep 4, 2024
0bb1fc9
Merge pull request #319 from valory-xyz/fix/hide-funding-until-comple…
truemiller Sep 4, 2024
e04d470
fix: typo
truemiller Sep 4, 2024
fd212a7
fix for tendermint PATH env vars
solarw Sep 5, 2024
a707ddb
feat: Disable the staking contract button if the balance is low. (#317)
mohandast52 Sep 5, 2024
49ad26a
refactor: remove OLAS requirement from notification
truemiller Sep 5, 2024
9ffafde
fix: commented link to broken site
truemiller Sep 5, 2024
a4ae3ad
Merge pull request #326 from valory-xyz/poetry-win-test
truemiller Sep 5, 2024
1b235d1
feat: Staking info per contract (#325)
mohandast52 Sep 6, 2024
59bca90
feat: Add balance polling pause functionality to StakingContractSecti…
mohandast52 Sep 6, 2024
eed4cae
Merge pull request #328 from valory-xyz/fix/remove-pandora-link
truemiller Sep 6, 2024
4336aad
Merge pull request #327 from valory-xyz/fix/hardcoded-olas-running-no…
truemiller Sep 6, 2024
fd18e36
bump: rc126
truemiller Sep 9, 2024
c8bd590
hotfix: undefined fixes in useStakingContractInfo hook for build 126
truemiller Sep 9, 2024
8684332
fix: ensure rewards are loaded
truemiller Sep 9, 2024
14f86a9
chore: TODO comments to address (DX related)
truemiller Sep 9, 2024
a25e05e
feat: added balance skeleton class (stops resizing when skeleton is h…
truemiller Sep 9, 2024
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
4 changes: 3 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
FORK_URL=
NODE_ENV=
FORK_URL=
DEV_RPC=

# TODO: determine if these are needed
STAKING_TEST_KEYS_PATH=
IS_STAGING=
55 changes: 55 additions & 0 deletions .github/workflows/release_win.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Release for Windows

on:
push:
tags:
- 'v*.*.*'

jobs:
build-windows:
runs-on: windows-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4
with:
python-version: '3.10'

- uses: actions/setup-node@v4
with:
node-version: lts/*

- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
version: '1.8.3'
virtualenvs-create: true
virtualenvs-in-project: false
virtualenvs-path: ~/my-custom-path
installer-parallel: true
- name: Install dependencies
run: poetry install

- name: install node deps
run: yarn install-deps

- name: set env vars to prod.env
env:
NODE_ENV: production
DEV_RPC: https://rpc-gate.autonolas.tech/gnosis-rpc/
IS_STAGING: ${{ github.ref != 'refs/heads/main' && 'true' || 'false' }}
FORK_URL: https://rpc-gate.autonolas.tech/gnosis-rpc/
GH_TOKEN: ${{ secrets.github_token}}
run: |
echo NODE_ENV=$NODE_ENV >> prod.env
echo DEV_RPC=$DEV_RPC >> prod.env
echo IS_STAGING=$IS_STAGING >> prod.env
echo FORK_URL=$FORK_URL >> prod.env
cat prod.env
echo GH_TOKEN=$GH_TOKEN >> prod.env
- run: rm -rf /dist
- name: "Build, notarize, publish"
run: make build
58 changes: 58 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@

define setup_env
$(eval ENV_FILE := $(1).env)
@echo " - setup env $(ENV_FILE)"
$(eval include $(1).env)
$(eval export)
endef


./trader/:
pwd
git clone https://github.com/valory-xyz/trader.git

./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
cp -f trader/dist/trader_win.exe ./dist/aea_win.exe
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


./electron/bins/:
mkdir -p ./electron/bins/

./electron/bins/tendermint.exe: ./electron/bins/
curl -L https://github.com/tendermint/tendermint/releases/download/v0.34.19/tendermint_0.34.19_windows_amd64.tar.gz -o tendermint.tar.gz
tar -xvf tendermint.tar.gz tendermint.exe
cp ./tendermint.exe ./electron/bins/tendermint.exe

.PHONY: build
build: ./dist/pearl_win.exe ./electron/bins/tendermint.exe
$(call setup_env, prod)
echo ${DEV_RPC}
cp -f dist/pearl_win.exe ./electron/bins/pearl_win.exe
echo ${NODE_ENV}
NODE_ENV=${NODE_ENV} DEV_RPC=${DEV_RPC} FORK_URL=${FORK_URL} yarn build:frontend
NODE_ENV=${NODE_ENV} DEV_RPC=${DEV_RPC} FORK_URL=${FORK_URL} GH_TOKEN=${GH_TOKEN} node build-win.js




.PHONY: build-tenderly
build-tenderly: ./dist/pearl_win.exe
$(call setup_env, dev-tenderly)
echo ${DEV_RPC}
cp -f dist/pearl_win.exe ./electron/bins/pearl_win.exe
echo ${NODE_ENV}
NODE_ENV=${NODE_ENV} DEV_RPC=${DEV_RPC} FORK_URL=${FORK_URL} yarn build:frontend
GH_TOKEN=${GH_TOKEN} node build-win-tenderly.js
38 changes: 38 additions & 0 deletions build-win-tenderly.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/**
* This script is used to build the electron app **with notarization**. It is used for the final build and release process.
*/
require('dotenv').config();
const build = require('electron-builder').build;

const { publishOptions } = require('./electron/constants');

const main = async () => {
console.log('Building...');

/** @type import {CliOptions} from "electron-builder" */
await build({
publish: 'onTag',
config: {
appId: 'xyz.valory.olas-operate-app',
artifactName: '${productName}-${version}-${platform}-${arch}-tenderly.${ext}',
productName: 'Pearl',
files: ['electron/**/*', 'package.json'],
directories: {
output: 'dist',
},
nsis: {
oneClick: false,
},
extraResources: [
{
from: 'electron/bins',
to: 'bins',
filter: ['**/*'],
},
],

},
});
};

main().then((response) => { console.log('Build & Notarize complete'); }).catch((e) => console.error(e));
49 changes: 49 additions & 0 deletions build-win.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/**
* This script is used to build the electron app **with notarization**. It is used for the final build and release process.
*/
require('dotenv').config();
const build = require('electron-builder').build;

const { publishOptions } = require('./electron/constants');


function artifactName() {
const env = process.env.NODE_ENV;
const prefix = env === 'production' ? '' : 'dev-';
return prefix + '${productName}-${version}-${platform}-${arch}.${ext}';
}

const main = async () => {
console.log('Building...');

/** @type import {CliOptions} from "electron-builder" */
await build({
publish: 'onTag',
config: {
appId: 'xyz.valory.olas-operate-app',
artifactName: artifactName(),
productName: 'Pearl',
files: ['electron/**/*', 'package.json'],
directories: {
output: 'dist',
},
nsis: {
oneClick: false,
},
win: {
publish: publishOptions,
icon: 'electron/assets/icons/splash-robot-head-dock.png',
},
extraResources: [
{
from: 'electron/bins',
to: 'bins',
filter: ['**/*'],
},
],

},
});
};

main().then((response) => { console.log('Build & Notarize complete'); }).catch((e) => console.error(e));
79 changes: 76 additions & 3 deletions electron/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ const process = require('process');
const axios = require('axios');
const { spawnSync } = require('child_process');
const { logger } = require('./logger');

const { execSync} = require('child_process');
const { paths } = require('./constants');

const homedir = os.homedir();
/**
* current version of the pearl release
* - use "" (nothing as a suffix) for latest release candidate, for example "0.1.0rc26"
* - use "alpha" for alpha release, for example "0.1.0rc26-alpha"
*/
const OlasMiddlewareVersion = '0.1.0rc120';
const OlasMiddlewareVersion = '0.1.0rc126';

const path = require('path');
const { app } = require('electron');
Expand Down Expand Up @@ -55,6 +55,21 @@ const TendermintUrls = {
},
};


function execSyncExitCode(cmd) {
try {
execSync(cmd);
return 0;
}
catch (error) {
logger.electron(error.status); // Might be 127 in your example.
logger.electron(error.message); // Holds the message you typically want.
logger.electron(error.stderr.toString()); // Holds the stderr output. Use `.toString()`.
logger.electron(error.stdout.toString()); // Holds the stdout output. Use `.toString()`.
return error.status;
}
}

function getBinPath(command) {
return spawnSync('/usr/bin/which', [command], { env: Env })
.stdout?.toString()
Expand All @@ -79,6 +94,7 @@ function runCmdUnix(command, options) {
logger.electron(`===== stderr ===== \n${output.stderr}`);
}


function runSudoUnix(command, options) {
let bin = getBinPath(command);
if (!bin) {
Expand Down Expand Up @@ -113,6 +129,12 @@ function isTendermintInstalledUnix() {
return Boolean(getBinPath('tendermint'));
}

function isTendermintInstalledWindows() {
return true;
//always installed cause bundled in
return execSyncExitCode('tendermint --help') === 0;
}

async function downloadFile(url, dest) {
const writer = fs.createWriteStream(dest);
try {
Expand All @@ -132,6 +154,41 @@ async function downloadFile(url, dest) {
}
}

async function installTendermintWindows() {
return;
// bundled in
logger.electron(`Installing tendermint for ${os.platform()}-${process.arch}`);
const cwd = process.cwd();
process.chdir(paths.tempDir);

const url = TendermintUrls[os.platform()][process.arch];

logger.electron(
`Downloading ${url} to ${paths.tempDir}. This might take a while...`,
);
await downloadFile(url, `${paths.tempDir}/tendermint.tar.gz`);

logger.electron(`Installing tendermint binary`);
try {
execSync('tar -xvf tendermint.tar.gz');
} catch (error){
logger.electron(error.status); // Might be 127 in your example.
logger.electron(error.message); // Holds the message you typically want.
logger.electron(error.stderr.toString()); // Holds the stderr output. Use `.toString()`.
logger.electron(error.stdout.toString()); // Holds the stdout output. Use `.toString()`.
}

const bin_dir = homedir + "//AppData//Local//Microsoft//WindowsApps//"
if (!Env.CI) {
if (!fs.existsSync(bin_dir)) {
fs.mkdirSync(bin_dir, {recursive: true});
}
fs.copyFileSync("tendermint.exe", bin_dir + "tendermint.exe");
}
process.chdir(cwd);
}


async function installTendermintUnix() {
logger.electron(`Installing tendermint for ${os.platform()}-${process.arch}`);
const cwd = process.cwd();
Expand Down Expand Up @@ -202,8 +259,24 @@ async function setupUbuntu(ipcChannel) {
}
}



async function setupWindows(ipcChannel) {
logger.electron('Creating required directories');
await createDirectory(`${paths.dotOperateDirectory}`);
await createDirectory(`${paths.tempDir}`);

logger.electron('Checking tendermint installation: ' + isTendermintInstalledWindows());
if (!isTendermintInstalledWindows()) {
ipcChannel.send('response', 'Installing tendermint');
logger.electron('Installing tendermint');
await installTendermintWindows();
}
}

module.exports = {
setupDarwin,
setupUbuntu,
setupWindows,
Env,
};
9 changes: 7 additions & 2 deletions electron/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const http = require('http');
const AdmZip = require('adm-zip');
const { TRAY_ICONS, TRAY_ICONS_PATHS } = require('./icons');

const { setupDarwin, setupUbuntu, Env } = require('./install');
const { setupDarwin, setupUbuntu, setupWindows, Env } = require('./install');

const { paths } = require('./constants');
const { killProcesses } = require('./processes');
Expand All @@ -39,6 +39,9 @@ const binaryPaths = {
arm64: 'bins/pearl_arm64',
x64: 'bins/pearl_x64',
},
win32: {
x64: 'bins/pearl_win.exe',
},
};

let appConfig = {
Expand Down Expand Up @@ -334,6 +337,7 @@ async function launchDaemon() {
}

async function launchDaemonDev() {

const check = new Promise(function (resolve, _reject) {
operateDaemon = spawn('poetry', [
'run',
Expand Down Expand Up @@ -398,6 +402,7 @@ async function launchNextAppDev() {
'yarn',
['dev:frontend', '--port', appConfig.ports.dev.next],
{
shell: true,
env: {
...process.env,
NEXT_PUBLIC_BACKEND_PORT: appConfig.ports.dev.operate,
Expand Down Expand Up @@ -441,7 +446,7 @@ ipcMain.on('check', async function (event, _argument) {
if (platform === 'darwin') {
await setupDarwin(event.sender);
} else if (platform === 'win32') {
// TODO
await setupWindows(event.sender);
} else {
await setupUbuntu(event.sender);
}
Expand Down
Loading
Loading