Skip to content

Commit

Permalink
Merge pull request #155 from Cerebellum-Network/release/0.32.0
Browse files Browse the repository at this point in the history
Release 0.32.0
  • Loading branch information
shamilkhan authored Aug 11, 2023
2 parents 08fe813 + 1a6f244 commit 21198af
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 61 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,17 @@ permissions:

jobs:
build_and_deploy_backend_cerestats_api:
uses: Cerebellum-Network/reusable-workflows/.github/workflows/deploy-to-ecr.yaml@1.3.0
uses: Cerebellum-Network/reusable-workflows/.github/workflows/deploy-to-ecr.yaml@master
with:
runs-on: '["self-hosted", "cere-network-large-workers"]'
environment: dev
aws_account_id: ${{ vars.DEV_NETWORK_AWS_ACCOUNT_ID }}
repository: stats-api
file: ./api/Dockerfile
secrets: inherit

build_and_deploy_backend_cerestats_crawler:
uses: Cerebellum-Network/reusable-workflows/.github/workflows/deploy-to-ecr.yaml@1.3.0
uses: Cerebellum-Network/reusable-workflows/.github/workflows/deploy-to-ecr.yaml@master
with:
runs-on: '["self-hosted", "cere-network-large-workers"]'
environment: dev
aws_account_id: ${{ vars.DEV_NETWORK_AWS_ACCOUNT_ID }}
repository: stats-crawler
Expand Down
57 changes: 18 additions & 39 deletions .github/workflows/stage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,61 +4,40 @@ on:
branches:
- 'release/**'
- 'hotfix/**'
workflow_dispatch:

permissions:
id-token: write
contents: read

jobs:
build_backend_cerestats_api:
uses: Cerebellum-Network/reusable-workflows/.github/workflows/build-and-push-docker.yaml@1.0.0
build_and_deploy_backend_cerestats_api:
uses: Cerebellum-Network/reusable-workflows/.github/workflows/deploy-to-ecr.yaml@master
with:
runs-on: '["self-hosted", "cere-network-large-workers"]'
org: cerebellumnetwork
environment: stage
image: crb-cerestats-api
repository: crb-cerestats-api
environment: stg
aws_account_id: ${{ vars.DEV_NETWORK_AWS_ACCOUNT_ID }}
repository: stats-api
file: ./api/Dockerfile
secrets: inherit

build_backend_cerestats_crawler:
uses: Cerebellum-Network/reusable-workflows/.github/workflows/build-and-push-docker.yaml@1.0.0
build_and_deploy_backend_cerestats_crawler:
uses: Cerebellum-Network/reusable-workflows/.github/workflows/deploy-to-ecr.yaml@master
with:
runs-on: '["self-hosted", "cere-network-large-workers"]'
org: cerebellumnetwork
environment: stage
image: crb-cerestats-crawler
repository: crb-cerestats-crawler
environment: stg
aws_account_id: ${{ vars.DEV_NETWORK_AWS_ACCOUNT_ID }}
repository: stats-crawler
file: ./backend/docker/crawler/Dockerfile
secrets: inherit

deploy_backend_cerestats_api:
uses: Cerebellum-Network/reusable-workflows/.github/workflows/[email protected]
needs: build_backend_cerestats_api
with:
runs-on: '["self-hosted", "cere-network-stg-deployer"]'
helm-repo-path: cerestats/cerestats-api
helm-release: cerestats-api
namespace: cerestats
tag: ${{ needs.build_backend_cerestats_api.outputs.version }}
environment: stage
secrets: inherit

deploy_backend_cerestats_crawler:
uses: Cerebellum-Network/reusable-workflows/.github/workflows/[email protected]
needs: build_backend_cerestats_crawler
with:
runs-on: '["self-hosted", "cere-network-stg-deployer"]'
helm-repo-path: cerestats/cerestats-crawler
helm-release: cerestats-crawler
namespace: cerestats
tag: ${{ needs.build_backend_cerestats_crawler.outputs.version }}
environment: stage
secrets: inherit

build_and_deploy_frontend:
uses: Cerebellum-Network/reusable-workflows/.github/workflows/build-and-upload-static.yaml@1.0.0
uses: Cerebellum-Network/reusable-workflows/.github/workflows/build-and-upload-static.yaml@master
with:
runs-on: '["self-hosted", "cere-network-large-workers"]'
build_container: 'node:14-buster-slim'
deploy_container: 'ubuntu:20.04'
install_packages_command: 'cp -rf frontend/frontend.config-cere-stg.js frontend/frontend.config.js; yarn install'
install_packages_command: 'cp -rf frontend/frontend.config-cere-dev.js frontend/frontend.config.js; yarn install'
build_command: 'yarn workspace frontend generate'
path_to_static_files_to_upload: 'frontend/dist'
secrets:
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
## vNext
...

## v0.32.0
- [BE] Add Resilient Network Initialization to Cere Stats API for Robust Handling of Network Failures

## v0.31.0
- [FE] Replace `extrinsic` with `event` as a data source on the `SentTransfers` page

Expand Down
3 changes: 2 additions & 1 deletion api/.env.default
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ POSTGRES_PORT=5432
BLOCKCHAINS=[{"name":"CERE","nativeTokenSymbol":"CERE","bestBlockNumberDiff":10,"blockTimeDiffMs":15000,"networks":[{"name":"DEVNET","rpcUrl":"wss://rpc.devnet.cere.network/ws"},{"name":"QANET","rpcUrl":"wss://rpc.qanet.cere.network/ws"},{"name":"TESTNET","rpcUrl":"wss://rpc.testnet.cere.network/ws","accounts":[{"address":"5GjivYu4Sb9qNLWp6GYqm5VgPqbYCA2JsePBENAZTdsgqGmn","name":"relayer-0","minBalance":5,"group":"BRIDGE_RELAYERS"},{"address":"5FRkUfyFFnmMGMyahCVPph11tLJhSsTgzk3dJz9PHQayjJnV","name":"relayer-1","minBalance":5,"group":"BRIDGE_RELAYERS"},{"address":"5DcK9wGDQfdjH75Wu9KWbax25sKp9gAHHABFMaTxzYUMbUax","name":"relayer-2","minBalance":5,"group":"BRIDGE_RELAYERS"},{"address":"5EYCAe5g7bGpFHagwe26HiRHdHdE3hobrwV6hq1UD2BPAiZb","name":"bridge","minBalance":5,"group":"BRIDGE"},{"address":"5HgyguXZNFra3BKQ3yBVHMReuSaK7ZPDKiftq9rgV43vuG9U","name":"faucet","minBalance":1000,"group":"STATS"}]},{"name":"MAINNET","rpcUrl":"wss://rpc.mainnet.cere.network/ws","accounts":[{"address":"5DDArkL7BzgQqRSKF4jeaDUi9ezr9UbYYjX6G3dyDM2eA3bi","name":"relayer-0","minBalance":10,"group":"BRIDGE_RELAYERS"},{"address":"5DMDToa27GZhHBCS6vr7evgnyz1XJdfb3CZejSPQuTEH1fMZ","name":"relayer-1","minBalance":10,"group":"BRIDGE_RELAYERS"},{"address":"5FPAKxVmwCj4DMnHJmnnWffztwUyvVucbgaGDUaSjcFqKuHe","name":"relayer-2","minBalance":10,"group":"BRIDGE_RELAYERS"},{"address":"5DRzvs36qMwHdHxw1iE4hJMbsrbfqz9DpDNd52wqyBQcRgwh","name":"relayer-3","minBalance":10,"group":"BRIDGE_RELAYERS"},{"address":"5EYCAe5g7bGpFHagwe26HiRHdHdE3hobrwV6hq1UD2BPAiZb","name":"bridge","minBalance":10000000,"group":"BRIDGE"},{"address":"5FEwg9i9TZMEQRCW8pEe9UYreSn1RJBuXqJZXsozv12LCjyE","name":"ocw-node-2","minBalance":1000,"group":"DDC"},{"address":"5GRK2Nq72ob6L31MeJ4YGDFbEbjD16YamKFby543g76ZHwLt","name":"ocw-node-4","minBalance":1000,"group":"DDC"},{"address":"5HZBfpk4XfLsBuLjb83Ly146FFrDBvzqLqSgwGEE9SWNz8Gf","name":"ocw-node-8","minBalance":1000,"group":"DDC"},{"address":"5G47ZMPqJYhGCqjeqNGZn6PRKctvQJFusazGyWN6GT3Ljssr","name":"davinci-ddc-wallet","minBalance":1000,"group":"DAVINCI"},{"address":"5CrTTUY62vpywpTfyXupzJve2imVEqLry8Gn461muwCGHm74","name":"liveone-ddc-wallet","minBalance":100,"group":"LIVEONE"}]}]},{"name":"POLYGON","nativeTokenSymbol":"MATIC","networks":[{"name":"TESTNET","cereTokenContractAddress":"0xd111d479e23A8342A81ad595Ea1CAF229B3528c3","rpcUrl":"https://rpc-mumbai.matic.today","accounts":[{"address":"0x78408C4240dC5Cf55202113572aba37150DFF89A","name":"polygon-relayer-0","minBalance":1,"group":"BRIDGE_RELAYERS"},{"address":"0x5F569F9183BD44D2e46B872270Af9E620ED83d0D","name":"polygon-relayer-1","minBalance":1,"group":"BRIDGE_RELAYERS"},{"address":"0x5311d410571961A9cc3F97eD98A4088AB96E4Dd1","name":"polygon-relayer-2","minBalance":1,"group":"BRIDGE_RELAYERS"},{"address":"0x8Ee8876d13e79b846fb6c3e5Ffe226a2e111387a","name":"polygon-erc20-handler","minBalance":100,"type":"ERC20","tokenSymbol":"CERE","erc20TokenAddress":"0xd111d479e23A8342A81ad595Ea1CAF229B3528c3","group":"BRIDGE"}]},{"name":"MAINNET","cereTokenContractAddress":"0x2da719db753dfa10a62e140f436e1d67f2ddb0d6","rpcUrl":"https://matic-mainnet.chainstacklabs.com","accounts":[{"address":"0x4478e3B0B71531DAc9d0ECe9357eBB0043669804","name":"fiat-gateway-contract","minBalance":10000,"type":"ERC20","erc20TokenAddress":"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174","tokenSymbol":"USDC","group":"DAVINCI"},{"address":"0x2352f1167F1c1c5273bB64a1FEEAf9dF49702A19","name":"fiat-gateway-service-gas","minBalance":20,"group":"DAVINCI"},{"address":"0xD5E601af441E75E2c90dE56b884f93Cab991018C","name":"polygon-relayer-0","minBalance":5,"group":"BRIDGE_RELAYERS"},{"address":"0x1FD36AfaAD703922b896DeBC64aC3A5c866d5e6F","name":"polygon-relayer-1","minBalance":5,"group":"BRIDGE_RELAYERS"},{"address":"0xd1Dd4F25136BaF6C180616196bd994DA5E7102e8","name":"polygon-relayer-2","minBalance":5,"group":"BRIDGE_RELAYERS"},{"address":"0xa4dD2305220351B999aeE038E615972708719306","name":"polygon-relayer-3","minBalance":5,"group":"BRIDGE_RELAYERS"},{"address":"0x8fe028Eb002bbc3ec45c5dF8acfFf67eC95B6f88","name":"polygon-erc20-handler","minBalance":10000000,"type":"ERC20","erc20TokenAddress":"0x2da719db753dfa10a62e140f436e1d67f2ddb0d6","tokenSymbol":"CERE","group":"BRIDGE"},{"address":"0x718B310Be805e3Df552621b3ea11b59871183D19","name":"liveone-fiat-gateway-service-gas","minBalance":5,"group":"LIVEONE"},{"address":"0xfeD5BEf12E4Cd3C42E697Baff743d65E83b5f005","name":"liveone-minting-wallet","minBalance":1,"group":"LIVEONE"},{"address":"0xeC9b0dEEE224c759D99D1ebb90330Ed9A275beBb","name":"liveone-fiat-gateway-contract","minBalance":10,"type":"ERC20","erc20TokenAddress":"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174","tokenSymbol":"USDC","group":"LIVEONE"}]}]},{"name":"ETHEREUM","nativeTokenSymbol":"ETH","networks":[{"name":"MAINNET","cereTokenContractAddress":"0x2da719db753dfa10a62e140f436e1d67f2ddb0d6","rpcUrl":"https://main-light.eth.linkpool.io","accounts":[{"address":"0x8fe028Eb002bbc3ec45c5dF8acfFf67eC95B6f88","name":"ethereum-erc20-handler","minBalance":10000000,"type":"ERC20","erc20TokenAddress":"0x2da719db753dfa10a62e140f436e1d67f2ddb0d6","tokenSymbol":"CERE","group":"BRIDGE"}]},{"name":"TESTNET","cereTokenContractAddress":"0x0b10e304088b2BA2B2acfD2f72573FAaD31a13A5","rpcUrl":" https://rpc.goerli.mudit.blog","accounts":[{"address":"0x92c1576845703089CF6c0788379ED81f75F45dd5","name":"ethereum-erc20-handler","minBalance":10000000,"type":"ERC20","erc20TokenAddress":"0x0b10e304088b2BA2B2acfD2f72573FAaD31a13A5","tokenSymbol":"CERE","group":"BRIDGE"}]}]}]
MAX_BALANCE=1
REQUESTS_PER_DAY=100
REQUESTS_PER_IP_PER_DAY=3
REQUESTS_PER_IP_PER_DAY=3
NETWORK_INIT_TIMEOUT_MS=5000
2 changes: 1 addition & 1 deletion api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "api",
"version": "0.31.0",
"version": "0.32.0",
"description": "PolkaStats API",
"author": "Mario Pino Uceda",
"license": "Apache-2.0",
Expand Down
30 changes: 17 additions & 13 deletions api/src/services/cereNetworkService.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,28 @@ const networkParams = new Map();
let initialized = false;

async function init() {
const promises = [];
const cereConfig = blockchains.find(blockchain => blockchain.name === blockchainNames.CERE);
cereConfig.networks.forEach(network => {
const promise = async() => ({
name: network.name,
rpc: await initNetwork(network.rpcUrl, network.faucetMnemonic)
});
promises.push(promise());
});
const res = await Promise.all(promises);
res.forEach(network => {
networkParams.set(network.name, network.rpc);
});

await Promise.all(cereConfig.networks.map(async network => {
try {
const rpc = await initNetwork(network.rpcUrl, network.faucetMnemonic);
networkParams.set(network.name, rpc);
} catch (error) {
console.error(`Failed to initialize network ${network.name}:`, error);
}
}));

initialized = true;
}

async function initNetwork(url, faucetMnemonic) {
const api = await initProvider(url);
const timeout = process.env.NETWORK_INIT_TIMEOUT_MS || 5000;

const api = await Promise.race([
initProvider(url),
new Promise((_, reject) => setTimeout(() => reject(new Error(`Timed out connecting to ${url}`)), timeout))
]);

if (faucetMnemonic) {
const faucet = await initFaucet(faucetMnemonic);
return {api, faucet};
Expand Down
2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "backend",
"version": "0.31.0",
"version": "0.32.0",
"description": "PolkaStats NG Backend",
"author": "Mario Pino Uceda",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "frontend",
"version": "0.31.0",
"version": "0.32.0",
"description": "PolkaStats NG frontend",
"author": "Mario Pino Uceda",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "cerestats",
"version": "0.31.0",
"version": "0.32.0",
"description": "Cere Stats mono repo",
"repository": {
"type": "git",
Expand Down

0 comments on commit 21198af

Please sign in to comment.