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

[Proxy colonies M2] feat: Proxy colonies M2 #322

Draft
wants to merge 41 commits into
base: feat/proxy-colonies-dev-env
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
8bdbf50
build: update colony-js and disable version checks
bassgeta Nov 5, 2024
bd054d0
wip
bassgeta Nov 20, 2024
b16fc7b
feat: parsing of proxy colony events and initial graphql scaffolding
bassgeta Nov 25, 2024
8b62f45
build: rework block-ingestor to use pnpm workspaces
bassgeta Nov 28, 2024
34bcb41
Build: Add docker files and start scripts
mmioana Nov 29, 2024
9044907
Feat: Create proxy chain app
bassgeta Dec 2, 2024
e00f0c1
Feat: Add multi-chain info to colony action and update multi-chain ha…
bassgeta Dec 5, 2024
6ad5fdd
Feat: Add create event details to colony model
mmioana Dec 12, 2024
a36068f
feat: calculate the colony creation salt and validate it
bassgeta Dec 19, 2024
36a6fdb
fix: post rebase alignments
bassgeta Jan 20, 2025
8a31eed
Fix: Replace CHAIN_CONTRACT_ADDRESS with CHAIN_NETWORK_CONTRACT
mmioana Jan 16, 2025
a5bc8d0
Feat: Handle disable proxy colony metadataDelta event
mmioana Dec 23, 2024
1ed9085
feat: get colonyAddress when requesting a proxy colony and the initia…
bassgeta Jan 6, 2025
d562f21
Feat: Re-enable deployed proxy colony
mmioana Jan 6, 2025
1292b94
feat: create proxy colony requested motion
bassgeta Jan 7, 2025
6471046
feat: link action that finalized a motion to the motion and the motio…
bassgeta Jan 10, 2025
3e21f53
Feat: Allow addition of proxy colonies with multisig
davecreaser Jan 9, 2025
bc9570b
Fix multisig connection to finalization action
davecreaser Jan 15, 2025
9c2e900
feat: handle enabling and disabling of a proxy colony via a motion
rumzledz Jan 9, 2025
09147c5
feat: remove redundant operation parsing
rumzledz Jan 14, 2025
6a40455
feat: add support for enabling and disable proxy colonies via multi-sig
rumzledz Jan 13, 2025
d8fab9d
feat: remove redundant operation parsing
rumzledz Jan 14, 2025
0133fcb
Move targetChainId up to the top level of colonyAction
davecreaser Jan 16, 2025
4ed62b5
Fixes after rebase
davecreaser Jan 21, 2025
4bac0fe
update main workflow to build main chain
bogdan-1337 Jan 22, 2025
1dafb46
cicd: add changes to dockerfile and new proxy build workflow
bogdan-1337 Jan 22, 2025
c246908
cicd: update dockerfile build target logic
bogdan-1337 Jan 22, 2025
b8b53d8
cicd: declare build target in final stage
bogdan-1337 Jan 22, 2025
01eafa4
cicd: rename cicd workflows and update ecr repo for qa prod proxy cha…
bogdan-1337 Jan 22, 2025
983e0b6
Fix: Align generated.ts
mmioana Jan 22, 2025
51a5de1
Feat: Add available chain upon proxy block ingestor start
mmioana Jan 22, 2025
10d4a8e
Feat: Add cleanup functionality for proxy block ingestor
mmioana Jan 22, 2025
4ac06d5
Fix: Update imports order
mmioana Jan 22, 2025
43cb151
Merge pull request #319 from JoinColony/feat/dynamically-add-supporte…
mmioana Jan 24, 2025
1b39cf3
feat: decouple multiChainInfo into a new model and use 2 flags to see…
bassgeta Jan 28, 2025
a4abbb3
Merge pull request #323 from JoinColony/feat/4060-multichain-lag-fix
bassgeta Jan 30, 2025
a795b8a
Feat: M2 Proxy Colonies has started - will be removed
mmioana Jan 23, 2025
d3fdf8f
feat: handle proxy colony incoming funds
iamsamgibbs Jan 28, 2025
6174747
Feat: Handle colony native token funds claims on different chain
mmioana Jan 28, 2025
7432071
Chore: Update colony js package version
mmioana Feb 5, 2025
e079ec1
Merge pull request #331 from JoinColony/refactor/4235-remove-colony-c…
mmioana Feb 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
24 changes: 0 additions & 24 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,24 +0,0 @@
STATS_PORT=10001

VERBOSE_OUTPUT=false

CHAIN_RPC_ENDPOINT=http://localhost:8545
CHAIN_NETWORK_CONTRACT=0x777760996135F0791E2e1a74aFAa060711197777

AWS_APPSYNC_ENDPOINT=http://localhost:20002/graphql
AWS_APPSYNC_KEY=da2-fakeApiId123456

NODE_ENV=development

BLOCK_TIME=5 # in seconds

# Number of blocks to process in a single batch
# Helps greatly with fast networks (ie: Arbitrum)
BLOCK_PAGING_SIZE=1000

# Needed for notifications via magicbell
MAGICBELL_API_KEY=
MAGICBELL_API_SECRET=

# Used to set a local key so that in development you only recieve notifications from your current dev env
MAGICBELL_DEV_KEY=
17 changes: 14 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,19 @@ module.exports = {
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: ['./tsconfig.json'],
project: [
'./tsconfig.base.json',
'./packages/*/tsconfig.json',
'./apps/*/tsconfig.json'
],
tsconfigRootDir: __dirname,
},
rules: {
semi: 'off',
'@typescript-eslint/semi': ['error', 'always'],
'@typescript-eslint/strict-boolean-expressions': 'off',
'@typescript-eslint/restrict-template-expressions': 'off',
'@typescript-eslint/consistent-type-definitions': 'off',
'comma-dangle': 'off',
'@typescript-eslint/comma-dangle': ['error', 'always-multiline'],
'@typescript-eslint/no-misused-promises': 'off',
Expand All @@ -25,6 +31,10 @@ module.exports = {
'no-useless-return': 'off',
'@typescript-eslint/member-delimiter-style': 'off',
'@typescript-eslint/indent': 'off',
'@typescript-eslint/array-type': 'off',
'@typescript-eslint/prefer-nullish-coalescing': 'off',
'@typescript-eslint/prefer-optional-chain': 'off',
'@typescript-eslint/return-await': 'off',
'@typescript-eslint/space-before-function-paren': [
'error',
{
Expand All @@ -36,8 +46,9 @@ module.exports = {
},
ignorePatterns: [
'codegen.ts',
'src/graphql/generated.ts',
'packages/graphql/codegen.ts',
'packages/graphql/src/generated.ts',
'wagmi.config.ts',
'src/constants/abis.ts',
'packages/blocks/src/constants/abis.ts',
],
};
257 changes: 124 additions & 133 deletions .github/workflows/build-deploy-proxy.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
name: Build and deploy cdapp block-ingestor proxy chain docker image

on:
name: Block ingestor proxy chain - Build and deploy

on:
workflow_dispatch: # Allows manual workflow trigger
repository_dispatch: # Allows API workflow trigger
types: [cdapp-block-ingestor-proxy-chain]

# push:
# branches:
# - master # Automatically deploy on commits to master
Expand All @@ -24,41 +23,37 @@ env:
COMMIT_HASH: ${{ github.event.client_payload.COMMIT_HASH != null && github.event.client_payload.COMMIT_HASH || github.sha }}

jobs:

# Build cdapp block-ingestor and push to AWS ECR
buildAndPush:

runs-on: ubuntu-latest

steps:

- name: Echo Env Vars through Context
run: |
echo "$GITHUB_CONTEXT"

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_QA }}
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_QA }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_QA }}
aws-region: ${{ env.AWS_REGION }}

- name: Login to Amazon ECR
id: login-ecr
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Checkout

- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Checkout relevant branch
run:
git checkout ${{ github.event.client_payload.COMMIT_HASH != null && github.event.client_payload.COMMIT_HASH || github.sha }}

run: git checkout ${{ github.event.client_payload.COMMIT_HASH != null && github.event.client_payload.COMMIT_HASH || github.sha }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build and push
uses: docker/build-push-action@v3
with:
Expand All @@ -70,16 +65,15 @@ jobs:
tags: |
${{ env.ECR_REPOSITORY }}:run-${{ github.run_number }}
${{ env.ECR_REPOSITORY }}:${{ env.COMMIT_HASH }}

- uses: sarisia/actions-status-discord@c193626e5ce172002b8161e116aa897de7ab5383
if: always()
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
title: "Build and push cdapp block-ingestor"
title: 'Build and push cdapp block-ingestor'

# Deploy cdapp block-ingestor to QA environment
deployQA:

needs: buildAndPush

runs-on: ubuntu-latest
Expand All @@ -88,68 +82,66 @@ jobs:
NAMESPACE: cdapp
CLUSTER_NAME: qa-cluster
ENVIRONMENT_TAG: qa
REPOSITORY_NAME: cdapp/block-ingestor
REPOSITORY_NAME: cdapp/block-ingestor-proxy-chain

steps:
- name: Configure AWS credentials for ECR
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_QA }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_QA }}
aws-region: ${{ env.AWS_REGION }}

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Echo current image and tag new image
run: |
echo -e "Getting image info...\n"

echo -e "###### Current image being used ######\n"
SHA256=$(aws ecr batch-get-image --repository-name ${{ env.REPOSITORY_NAME }} --image-ids imageTag=${{ env.ENVIRONMENT_TAG }} --output json | jq '.images[].imageId.imageDigest')
aws ecr batch-get-image --repository-name ${{ env.REPOSITORY_NAME }} --image-ids imageDigest=$SHA256 --output json | jq '.images[].imageId'

- name: Configure AWS credentials for ECR
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_QA }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_QA }}
aws-region: ${{ env.AWS_REGION }}

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Echo current image and tag new image
run: |
echo -e "Getting image info...\n"

echo -e "###### Current image being used ######\n"
SHA256=$(aws ecr batch-get-image --repository-name ${{ env.REPOSITORY_NAME }} --image-ids imageTag=${{ env.ENVIRONMENT_TAG }} --output json | jq '.images[].imageId.imageDigest')
aws ecr batch-get-image --repository-name ${{ env.REPOSITORY_NAME }} --image-ids imageDigest=$SHA256 --output json | jq '.images[].imageId'

echo -e "\n###### Tagging new image with environment tag ######"
MANIFEST=$(aws ecr batch-get-image --repository-name ${{ env.REPOSITORY_NAME }} --image-ids imageTag=${{ env.COMMIT_HASH }} --output json | jq --raw-output --join-output '.images[0].imageManifest')
aws ecr put-image --repository-name ${{ env.REPOSITORY_NAME }} --image-tag ${{ env.ENVIRONMENT_TAG }} --image-manifest "$MANIFEST"

echo -e "\n###### New image being used ######\n"
SHA256=$(aws ecr batch-get-image --repository-name ${{ env.REPOSITORY_NAME }} --image-ids imageTag=${{ env.ENVIRONMENT_TAG }} --output json | jq '.images[].imageId.imageDigest')
aws ecr batch-get-image --repository-name ${{ env.REPOSITORY_NAME }} --image-ids imageDigest=$SHA256 --output json | jq '.images[].imageId'

- name: Configure AWS credentials for EKS
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_QA }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_QA }}
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID_QA }}:role/eks-admin
role-session-name: github-cicd
role-duration-seconds: 1200
aws-region: ${{ env.AWS_REGION }}

- name: Configure AWS EKS
run: |
aws eks --region ${{ env.AWS_REGION }} update-kubeconfig --name ${{ env.CLUSTER_NAME }}

- name: Deploy to Kubernetes cluster
run: |
kubectl rollout restart deployment/cdapp-block-ingestor-${{ env.ENVIRONMENT_TAG }}-polygon-amoy -n ${{ env.NAMESPACE }}

- name: Validate Kubernetes deployment
run: |
kubectl rollout status deployment/cdapp-block-ingestor-${{ env.ENVIRONMENT_TAG }}-polygon-amoy -n ${{ env.NAMESPACE }}

- uses: sarisia/actions-status-discord@c193626e5ce172002b8161e116aa897de7ab5383
if: always()
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
title: "Deploy cdapp block-ingestor to ${{ env.ENVIRONMENT_TAG }}-polygon-amoy"
echo -e "\n###### Tagging new image with environment tag ######"
MANIFEST=$(aws ecr batch-get-image --repository-name ${{ env.REPOSITORY_NAME }} --image-ids imageTag=${{ env.COMMIT_HASH }} --output json | jq --raw-output --join-output '.images[0].imageManifest')
aws ecr put-image --repository-name ${{ env.REPOSITORY_NAME }} --image-tag ${{ env.ENVIRONMENT_TAG }} --image-manifest "$MANIFEST"

echo -e "\n###### New image being used ######\n"
SHA256=$(aws ecr batch-get-image --repository-name ${{ env.REPOSITORY_NAME }} --image-ids imageTag=${{ env.ENVIRONMENT_TAG }} --output json | jq '.images[].imageId.imageDigest')
aws ecr batch-get-image --repository-name ${{ env.REPOSITORY_NAME }} --image-ids imageDigest=$SHA256 --output json | jq '.images[].imageId'

- name: Configure AWS credentials for EKS
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_QA }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_QA }}
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID_QA }}:role/eks-admin
role-session-name: github-cicd
role-duration-seconds: 1200
aws-region: ${{ env.AWS_REGION }}

- name: Configure AWS EKS
run: |
aws eks --region ${{ env.AWS_REGION }} update-kubeconfig --name ${{ env.CLUSTER_NAME }}

- name: Deploy to Kubernetes cluster
run: |
kubectl rollout restart deployment/cdapp-block-ingestor-${{ env.ENVIRONMENT_TAG }}-polygon-amoy -n ${{ env.NAMESPACE }}

- name: Validate Kubernetes deployment
run: |
kubectl rollout status deployment/cdapp-block-ingestor-${{ env.ENVIRONMENT_TAG }}-polygon-amoy -n ${{ env.NAMESPACE }}

- uses: sarisia/actions-status-discord@c193626e5ce172002b8161e116aa897de7ab5383
if: always()
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
title: 'Deploy cdapp block-ingestor to ${{ env.ENVIRONMENT_TAG }}-polygon-amoy'

# Deploy cdapp block-ingestor to Prod environment
deployProd:

needs: deployQA

environment: prod
Expand All @@ -160,61 +152,60 @@ jobs:
NAMESPACE: cdapp
CLUSTER_NAME: prod-cluster
ENVIRONMENT_TAG: prod
REPOSITORY_NAME: cdapp/block-ingestor
REPOSITORY_NAME: cdapp/block-ingestor-proxy-chain

steps:
- name: Configure AWS credentials for ECR
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_QA }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_QA }}
aws-region: ${{ env.AWS_REGION }}

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Echo current image and tag new image
run: |
echo -e "Getting image info...\n"

echo -e "###### Current image being used ######\n"
SHA256=$(aws ecr batch-get-image --repository-name ${{ env.REPOSITORY_NAME }} --image-ids imageTag=${{ env.ENVIRONMENT_TAG }} --output json | jq '.images[].imageId.imageDigest')
aws ecr batch-get-image --repository-name ${{ env.REPOSITORY_NAME }} --image-ids imageDigest=$SHA256 --output json | jq '.images[].imageId'

echo -e "\n###### Tagging new image with environment tag ######"
MANIFEST=$(aws ecr batch-get-image --repository-name ${{ env.REPOSITORY_NAME }} --image-ids imageTag=${{ env.COMMIT_HASH }} --output json | jq --raw-output --join-output '.images[0].imageManifest')
aws ecr put-image --repository-name ${{ env.REPOSITORY_NAME }} --image-tag ${{ env.ENVIRONMENT_TAG }} --image-manifest "$MANIFEST"

- name: Configure AWS credentials for ECR
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_QA }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_QA }}
aws-region: ${{ env.AWS_REGION }}

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Echo current image and tag new image
run: |
echo -e "Getting image info...\n"

echo -e "###### Current image being used ######\n"
SHA256=$(aws ecr batch-get-image --repository-name ${{ env.REPOSITORY_NAME }} --image-ids imageTag=${{ env.ENVIRONMENT_TAG }} --output json | jq '.images[].imageId.imageDigest')
aws ecr batch-get-image --repository-name ${{ env.REPOSITORY_NAME }} --image-ids imageDigest=$SHA256 --output json | jq '.images[].imageId'

echo -e "\n###### Tagging new image with environment tag ######"
MANIFEST=$(aws ecr batch-get-image --repository-name ${{ env.REPOSITORY_NAME }} --image-ids imageTag=${{ env.COMMIT_HASH }} --output json | jq --raw-output --join-output '.images[0].imageManifest')
aws ecr put-image --repository-name ${{ env.REPOSITORY_NAME }} --image-tag ${{ env.ENVIRONMENT_TAG }} --image-manifest "$MANIFEST"

echo -e "\n###### New image being used ######\n"
SHA256=$(aws ecr batch-get-image --repository-name ${{ env.REPOSITORY_NAME }} --image-ids imageTag=${{ env.ENVIRONMENT_TAG }} --output json | jq '.images[].imageId.imageDigest')
aws ecr batch-get-image --repository-name ${{ env.REPOSITORY_NAME }} --image-ids imageDigest=$SHA256 --output json | jq '.images[].imageId'

- name: Configure AWS credentials for EKS
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_PROD }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_PROD }}
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID_PROD }}:role/eks-admin
role-session-name: github-cicd
role-duration-seconds: 1200
aws-region: ${{ env.AWS_REGION }}

- name: Configure AWS EKS
run: |
aws eks --region ${{ env.AWS_REGION }} update-kubeconfig --name ${{ env.CLUSTER_NAME }}

- name: Deploy to Kubernetes cluster
run: |
kubectl rollout restart deployment/cdapp-block-ingestor-${{ env.ENVIRONMENT_TAG }}-polygon-mainnet -n ${{ env.NAMESPACE }}

- name: Validate Kubernetes deployment
run: |
kubectl rollout status deployment/cdapp-block-ingestor-${{ env.ENVIRONMENT_TAG }}-polygon-mainnet -n ${{ env.NAMESPACE }}

- uses: sarisia/actions-status-discord@c193626e5ce172002b8161e116aa897de7ab5383
if: always()
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
title: "Deploy cdapp block-ingestor to ${{ env.ENVIRONMENT_TAG }}-polygon-mainnet"
echo -e "\n###### New image being used ######\n"
SHA256=$(aws ecr batch-get-image --repository-name ${{ env.REPOSITORY_NAME }} --image-ids imageTag=${{ env.ENVIRONMENT_TAG }} --output json | jq '.images[].imageId.imageDigest')
aws ecr batch-get-image --repository-name ${{ env.REPOSITORY_NAME }} --image-ids imageDigest=$SHA256 --output json | jq '.images[].imageId'

- name: Configure AWS credentials for EKS
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_PROD }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_PROD }}
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID_PROD }}:role/eks-admin
role-session-name: github-cicd
role-duration-seconds: 1200
aws-region: ${{ env.AWS_REGION }}

- name: Configure AWS EKS
run: |
aws eks --region ${{ env.AWS_REGION }} update-kubeconfig --name ${{ env.CLUSTER_NAME }}

- name: Deploy to Kubernetes cluster
run: |
kubectl rollout restart deployment/cdapp-block-ingestor-${{ env.ENVIRONMENT_TAG }}-polygon-mainnet -n ${{ env.NAMESPACE }}

- name: Validate Kubernetes deployment
run: |
kubectl rollout status deployment/cdapp-block-ingestor-${{ env.ENVIRONMENT_TAG }}-polygon-mainnet -n ${{ env.NAMESPACE }}

- uses: sarisia/actions-status-discord@c193626e5ce172002b8161e116aa897de7ab5383
if: always()
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
title: 'Deploy cdapp block-ingestor to ${{ env.ENVIRONMENT_TAG }}-polygon-mainnet'
Loading