Skip to content

Commit

Permalink
Merge pull request #105 from Cerebellum-Network/release/2.6.0
Browse files Browse the repository at this point in the history
Release v2.6.0
  • Loading branch information
Andrei Navoichyk authored Sep 12, 2022
2 parents 59373bc + 9e635ad commit 33886e2
Show file tree
Hide file tree
Showing 14 changed files with 102 additions and 322 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.36
args: --timeout=5m
- name: Lint
run: make lint
- name: License Check
run: make license-check
79 changes: 21 additions & 58 deletions .github/workflows/dev.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright 2020 ChainSafe Systems
# SPDX-License-Identifier: LGPL-3.0-only

name: Release to dev
on:
push:
Expand All @@ -7,64 +10,24 @@ on:

jobs:
build:
runs-on: [self-hosted, cere-network-large-workers]
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v3
- name: Process version
id: version
run: |
echo "::set-output name=version::dev-${{ github.run_attempt}}-$(git rev-parse --short HEAD)"
- name: Configure AWS credentials for push images
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.ORG_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.ORG_AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build and push docker image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: crb-${{ github.event.repository.name }}
uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile
push: true
no-cache: true
build-args: |
NPM_TOKEN=${{ secrets.NPM_TOKEN }}
tags: ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ steps.version.outputs.version }}
uses: Cerebellum-Network/reusable-workflows/.github/workflows/build-and-push-docker.yaml@master
with:
runs-on: '["self-hosted", "cere-network-large-workers"]'
org: cerebellumnetwork
environment: dev
image: crb-${{ github.event.repository.name }}
repository: crb-${{ github.event.repository.name }}
file: ./Dockerfile
secrets: inherit

deploy:
runs-on: [self-hosted, cere-network-dev-deployer]
uses: Cerebellum-Network/reusable-workflows/.github/workflows/deploy-with-helm.yaml@master
needs: build
steps:
- uses: actions/checkout@v3
with:
repository: ${{ secrets.K8S_DEPLOYMENT_CONFIGS_REPOSITORY }}
token: ${{ secrets.TRIGGER_GITHUB_TOKEN }}
- uses: azure/setup-helm@v1
with:
version: ${{ secrets.HELM_VERSION }}
- uses: azure/setup-kubectl@v1
with:
version: ${{ secrets.KUBECTL_VERSION }}
- name: Deploy
env:
HELM_RELEASE: network-relayer
HELM_REPO_PATH: network/network-relayer
NAMESPACE: network
ENVIRONMENT: dev
run: |
helm upgrade --install ${HELM_RELEASE} ${HELM_REPO_PATH} \
-f ${HELM_REPO_PATH}/envs/${ENVIRONMENT}.yaml \
--set global.image.tag=${{ needs.build.outputs.version }} \
--debug --atomic --cleanup-on-fail \
--timeout 5m \
-n ${NAMESPACE}
with:
runs-on: '["self-hosted", "cere-network-dev-deployer"]'
helm-repo-path: network/network-relayer
helm-release: network-relayer
namespace: network
tag: ${{ needs.build.outputs.version }}
environment: dev
secrets: inherit
80 changes: 22 additions & 58 deletions .github/workflows/prod.yaml
Original file line number Diff line number Diff line change
@@ -1,69 +1,33 @@
# Copyright 2020 ChainSafe Systems
# SPDX-License-Identifier: LGPL-3.0-only

name: Release to prod
on:
push:
branches:
- master-cere
workflow_dispatch:

jobs:
build:
runs-on: [self-hosted, cere-network-large-workers]
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v3
- name: Process version
id: version
run: |
echo "::set-output name=version::prd-${{ github.run_attempt}}-$(git rev-parse --short HEAD)"
- name: Configure AWS credentials for push images
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.ORG_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.ORG_AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build and push docker image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: crb-${{ github.event.repository.name }}
uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile
push: true
no-cache: true
build-args: |
NPM_TOKEN=${{ secrets.NPM_TOKEN }}
tags: ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ steps.version.outputs.version }}
uses: Cerebellum-Network/reusable-workflows/.github/workflows/build-and-push-docker.yaml@master
with:
runs-on: '["self-hosted", "cere-network-large-workers"]'
org: cerebellumnetwork
environment: prod
image: crb-${{ github.event.repository.name }}
repository: crb-${{ github.event.repository.name }}
file: ./Dockerfile
secrets: inherit

deploy:
runs-on: [self-hosted, cere-network-prd-deployer]
uses: Cerebellum-Network/reusable-workflows/.github/workflows/deploy-with-helm.yaml@master
needs: build
steps:
- uses: actions/checkout@v3
with:
repository: ${{ secrets.K8S_DEPLOYMENT_CONFIGS_REPOSITORY }}
token: ${{ secrets.TRIGGER_GITHUB_TOKEN }}
- uses: azure/setup-helm@v1
with:
version: ${{ secrets.HELM_VERSION }}
- uses: azure/setup-kubectl@v1
with:
version: ${{ secrets.KUBECTL_VERSION }}
- name: Deploy
env:
HELM_RELEASE: network-relayer
HELM_REPO_PATH: network/network-relayer
NAMESPACE: network
ENVIRONMENT: prod
run: |
helm upgrade --install ${HELM_RELEASE} ${HELM_REPO_PATH} \
-f ${HELM_REPO_PATH}/envs/${ENVIRONMENT}.yaml \
--set global.image.tag=${{ needs.build.outputs.version }} \
--debug --atomic --cleanup-on-fail \
--timeout 5m \
-n ${NAMESPACE}
with:
runs-on: '["self-hosted", "cere-network-prd-deployer"]'
helm-repo-path: network/network-relayer
helm-release: network-relayer
namespace: network
tag: ${{ needs.build.outputs.version }}
environment: prod
secrets: inherit
79 changes: 21 additions & 58 deletions .github/workflows/stage.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright 2020 ChainSafe Systems
# SPDX-License-Identifier: LGPL-3.0-only

name: Release to stage
on:
push:
Expand All @@ -7,64 +10,24 @@ on:

jobs:
build:
runs-on: [self-hosted, cere-network-large-workers]
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v3
- name: Process version
id: version
run: |
echo "::set-output name=version::stg-${{ github.run_attempt}}-$(git rev-parse --short HEAD)"
- name: Configure AWS credentials for push images
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.ORG_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.ORG_AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build and push docker image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: crb-${{ github.event.repository.name }}
uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile
push: true
no-cache: true
build-args: |
NPM_TOKEN=${{ secrets.NPM_TOKEN }}
tags: ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ steps.version.outputs.version }}
uses: Cerebellum-Network/reusable-workflows/.github/workflows/build-and-push-docker.yaml@master
with:
runs-on: '["self-hosted", "cere-network-large-workers"]'
org: cerebellumnetwork
environment: stage
image: crb-${{ github.event.repository.name }}
repository: crb-${{ github.event.repository.name }}
file: ./Dockerfile
secrets: inherit

deploy:
runs-on: [self-hosted, cere-network-stg-deployer]
uses: Cerebellum-Network/reusable-workflows/.github/workflows/deploy-with-helm.yaml@master
needs: build
steps:
- uses: actions/checkout@v3
with:
repository: ${{ secrets.K8S_DEPLOYMENT_CONFIGS_REPOSITORY }}
token: ${{ secrets.TRIGGER_GITHUB_TOKEN }}
- uses: azure/setup-helm@v1
with:
version: ${{ secrets.HELM_VERSION }}
- uses: azure/setup-kubectl@v1
with:
version: ${{ secrets.KUBECTL_VERSION }}
- name: Deploy
env:
HELM_RELEASE: network-relayer
HELM_REPO_PATH: network/network-relayer
NAMESPACE: network
ENVIRONMENT: stage
run: |
helm upgrade --install ${HELM_RELEASE} ${HELM_REPO_PATH} \
-f ${HELM_REPO_PATH}/envs/${ENVIRONMENT}.yaml \
--set global.image.tag=${{ needs.build.outputs.version }} \
--debug --atomic --cleanup-on-fail \
--timeout 5m \
-n ${NAMESPACE}
with:
runs-on: '["self-hosted", "cere-network-stg-deployer"]'
helm-repo-path: network/network-relayer
helm-release: network-relayer
namespace: network
tag: ${{ needs.build.outputs.version }}
environment: stage
secrets: inherit
8 changes: 8 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,14 @@ issues:
source: "^//go:generate "
text: "long-lines"

- linters:
- gosec
text: "Potential file inclusion via variable"

- linters:
- contextcheck
text: "Non-inherited new context"

# Independently from option `exclude` we use default exclude patterns,
# it can be disabled by this option. To list all
# excluded by default patterns execute `golangci-lint run --help`.
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ get:
go mod tidy && go mod download

get-lint:
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s v1.31.0
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.46.2

.PHONY: lint
lint:
Expand Down Expand Up @@ -61,13 +61,13 @@ rebuild-contracts:
license:
@echo " > \033[32mAdding license headers...\033[0m "
GO111MODULE=off go get -u github.com/google/addlicense
addlicense -c "ChainSafe Systems" -f ./scripts/header.txt -y 2020 .
~/go/bin/addlicense -c "ChainSafe Systems" -f ./scripts/header.txt -y 2020 .

## license-check: Checks for missing license headers
license-check:
@echo " > \033[Checking for license headers...\033[0m "
GO111MODULE=off go get -u github.com/google/addlicense
addlicense -check -c "ChainSafe Systems" -f ./scripts/header.txt -y 2020 .
~/go/bin/addlicense -check -c "ChainSafe Systems" -f ./scripts/header.txt -y 2020 .

## Install dependency subkey
install-subkey:
Expand All @@ -77,7 +77,7 @@ install-subkey:
## Runs go test for all packages except the solidity bindings
test:
@echo " > \033[32mRunning tests...\033[0m "
go test -coverprofile=cover.out -v `go list ./... | grep -v bindings | grep -v e2e`
go test -p 1 -coverprofile=cover.out -v `go list ./... | grep -v bindings | grep -v e2e`

test-e2e:
@echo " > \033[32mRunning e2e tests...\033[0m "
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@
# Release Notes

## vNext
- ...
-

## v2.6.0
- Fixed unit tests and linter
- Updated `go-substrate-rpc-client` lib to v2.0.2-cere
- Added startBlock logs
- Implemented liveness/readiness probe

## v2.5.2
- Increased ExecuteBlockWatchLimit to 500 for Ethereum/Polygon
Expand Down Expand Up @@ -216,7 +222,7 @@ docker-compose up
```
2. Run executable:
```
build/chainbridge --config config/config.json --keystore ./keys --verbosity trce --metrics
build/chainbridge --config config/config.json --keystore ./keys --verbosity trce --metrics --blockstore ./blockstore
```

# Testing
Expand Down
2 changes: 1 addition & 1 deletion chains/ethereum/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func InitializeChain(chainCfg *core.ChainConfig, logger log15.Logger, sysErr cha
}

if chainId != uint8(chainCfg.Id) {
logger.Warn("Bridge chainId and configuration chainId do not match", "bridge", chainId, "configuration", chainCfg.Id)
logger.Warn("Bridge chainId and configuration chainId do not match", "bridge", chainId, "configuration", chainCfg.Id)
}

erc20HandlerContract, err := erc20Handler.NewERC20Handler(cfg.erc20HandlerContract, conn.Client())
Expand Down
2 changes: 1 addition & 1 deletion chains/ethereum/chain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func TestChain_ListenerShutdownOnFailure(t *testing.T) {
if err.Error() != ErrFatalPolling.Error() {
t.Fatalf("Unexpected error: %s", err)
}
case <-time.After(time.Second * 30):
case <-time.After(time.Second * 90):
t.Fatal("Test timed out")
}

Expand Down
2 changes: 1 addition & 1 deletion chains/ethereum/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ func (l *listener) start() error {
// Polling begins at the block defined in `l.cfg.startBlock`. Failed attempts to fetch the latest block or parse
// a block will be retried up to BlockRetryLimit times before continuing to the next block.
func (l *listener) pollBlocks() error {
l.log.Info("Polling Blocks...")
var currentBlock = l.cfg.startBlock
l.log.Info("Polling Blocks...", "startBlock", currentBlock)
var retry = BlockRetryLimit
for {
select {
Expand Down
Loading

0 comments on commit 33886e2

Please sign in to comment.