Skip to content

Commit

Permalink
conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
lumtis committed Jun 26, 2024
2 parents ce1d372 + a97bf13 commit 17cc141
Show file tree
Hide file tree
Showing 445 changed files with 16,238 additions and 10,380 deletions.
20 changes: 20 additions & 0 deletions .coderabbit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
reviews:
path_filters:
- "**/*.pb.go"
- "**/*.pb.gw.go"
path_instructions:
- path: '**/*.go'
instructions: >-
Review the Go code, point out issues relative to principles of clean
code, expressiveness, and performance.
- path: '**/*.proto'
instructions: >-
Review the Protobuf definitions, point out issues relative to
compatibility, and expressiveness.
- path: '**/*.sh'
instructions: >-
Review the shell scripts, point out issues relative to security,
performance, and maintainability.
auto_review:
base_branches:
- develop
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
* @brewmaster012 @kingpinXD @lumtis @ws4charlie @skosito
* @brewmaster012 @kingpinXD @lumtis @ws4charlie @skosito @swift1337

.github/** @zeta-chain/devops
50 changes: 50 additions & 0 deletions .github/ISSUE_TEMPLATE/syncing.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Having difficulties setting up or syncing a node
description: Please fill out the following form to help us understand and resolve your issue with setting up or syncing a node. Provide as much detail as possible to ensure a quick and accurate resolution.
labels: ["infra"]
body:
- type: dropdown
attributes:
label: Which environment are you setting a node for?
options:
- Mainnet
- Testnet
- type: dropdown
attributes:
label: Does your machine match the technical requirements?
description: See https://www.zetachain.com/docs/nodes/start-here/requirements/
options:
- "Yes"
- "No"
- type: dropdown
attributes:
label: Have you completed the setup?
description: See https://www.zetachain.com/docs/nodes/start-here/setup/
options:
- "Yes"
- "No"
- type: dropdown
attributes:
label: Which method are you using?
description: If you used different methods, please, create separate issues.
options:
- Snapshot
- KSYNC
- type: dropdown
attributes:
label: Did you build your binary from source or download it from the Releases page?
description: "We recommend using binaries from our Releases page: https://github.com/zeta-chain/node/releases"
options:
- "Downloaded from Releases page"
- "Built locally"
- type: textarea
attributes:
label: Please, share the contents of config.toml
description: By default the file is in `$HOME/.zetacored/config/`
- type: textarea
attributes:
label: Please, share the contents of app.toml
description: By default the file is in `$HOME/.zetacored/config/`
- type: textarea
attributes:
label: Additional details
description: Any other information that might help us resolve your issue.
6 changes: 2 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,7 @@ jobs:
- name: Full Log Dump On Failure
if: failure()
run: |
cd contrib/localnet
docker compose logs
make stop-localnet
- name: Notify Slack on Failure
if: failure() && github.event_name == 'push' && github.ref == 'refs/heads/develop'
Expand All @@ -167,8 +166,7 @@ jobs:
- name: Stop Private Network
if: always()
run: |
cd contrib/localnet/
docker compose down
make stop-localnet
- name: Clean Up Workspace
if: always()
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-nightly-performance-testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: "EXECUTE:LOADTESTS"
uses: artilleryio/action-cli@v1
with:
command: run .github/actions/performance-tests/art.yaml --output ./report.json
command: run .github/actions/performance-tests/art.yaml --record --key ${{ secrets.ARTILLERY_KEY }} --output ./report.json

- name: "GENERATE:REPORT"
uses: artilleryio/action-cli@v1
Expand Down
12 changes: 4 additions & 8 deletions .github/workflows/execute_advanced_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ jobs:
- name: Full Log Dump On Failure
if: failure()
run: |
cd contrib/localnet
docker compose logs
make stop-localnet
- name: Notify Slack on Failure
if: failure() && github.event_name == 'schedule'
Expand Down Expand Up @@ -82,8 +81,7 @@ jobs:
- name: Full Log Dump On Failure
if: failure()
run: |
cd contrib/localnet
docker compose logs
make stop-localnet
- name: Notify Slack on Failure
if: failure() && github.event_name == 'schedule'
Expand Down Expand Up @@ -114,8 +112,7 @@ jobs:
- name: Full Log Dump On Failure
if: failure()
run: |
cd contrib/localnet
docker compose logs
make stop-localnet
e2e-performance-test:
if: ${{ github.event.inputs.e2e-performance-test == 'true' }}
Expand All @@ -137,5 +134,4 @@ jobs:
- name: Full Log Dump On Failure
if: failure()
run: |
cd contrib/localnet
docker compose logs
make stop-localnet
8 changes: 3 additions & 5 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,10 @@ jobs:

- name: Run golangci-lint
if: ${{ github.event.inputs.skip_checks != 'true' }}
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v6
with:
version: v1.54
version: v1.59
skip-cache: true
args: --out-format=json

- name: Mark Job Complete Skipped
if: ${{ github.event.inputs.skip_checks == 'true' }}
Expand Down Expand Up @@ -340,8 +339,7 @@ jobs:
- name: Stop Private Network
if: ${{ always() && github.event.inputs.skip_checks != 'true' }}
run: |
cd contrib/localnet/
docker compose down
make stop-localnet
- name: Clean Up Workspace
if: always()
Expand Down
18 changes: 11 additions & 7 deletions .github/workflows/sast-linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,10 @@ jobs:
go-version: '1.20'

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v6
with:
version: v1.54
version: v1.59
skip-cache: true
args: --out-format=json

nosec_alert:
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -105,7 +104,14 @@ jobs:
echo "Changed files: ${{ steps.changed-files.outputs.all_changed_files }}"
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
if git diff ${{ github.event.pull_request.base.sha }} $file | grep -q nosec; then
# Skip this workflow file
if [ "$file" == ".github/workflows/sast-linters.yml" ] || [ "$file" == "changelog.md" ]; then
echo "Skipping nosec check for $file"
continue
fi
# Only consider additions of "nosec", marked by '+'
if git diff ${{ github.event.pull_request.base.sha }} $file | grep -q '^+.*nosec'; then
echo "nosec detected in $file"
nosec_list+=("$file,")
nosec_detected=1
Expand All @@ -119,6 +125,7 @@ jobs:
echo "nosec_files=$nosec_list_string" >> $GITHUB_ENV
echo "nosec_detected=$nosec_detected" >> $GITHUB_ENV
- name: Report nosec uses
uses: mshick/add-pr-comment@v2
if: env.nosec_detected == 1
Expand Down Expand Up @@ -150,6 +157,3 @@ jobs:
run: |
DIFF=$(git diff ${{ github.event.pull_request.base.sha }})
echo "$DIFF" | grep -P '#nosec(?!(\sG\d{3}))(?![^\s\t])([\s\t]*|$)' && echo "nosec without specified rule found!" && exit 1 || exit 0
37 changes: 25 additions & 12 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
run:
go: '1.20' # as in go.mod
timeout: 5m
tests: false # exclude test from linting

linters:
disable-all: true
enable:
Expand All @@ -18,24 +23,32 @@ linters:
- bodyclose
- unconvert
- unused
- gci
- gofmt
- whitespace

linters-settings:
gocyclo:
min-complexity: 11
errcheck:
ignore: fmt:.*,io/ioutil:^Read.*,github.com/spf13/cobra:MarkFlagRequired,github.com/spf13/viper:BindPFlag
golint:
min-confidence: 1.1
exclude-functions:
- fmt:.*
- io/ioutil:^Read.*,
- github.com/spf13/cobra:MarkFlagRequired
- github.com/spf13/viper:BindPFlag
exhaustive:
check-generated: false
exhaustivestruct:
check-generated: false
gci:
# Gci controls Go package import order and makes it always deterministic
# https://golangci-lint.run/usage/linters/#gci
sections:
- standard
- default
- prefix(github.com/zeta-chain/zetacore)
skip-generated: true

issues:
exclude-generated: strict
exclude:
- composite
run:
tests: false
deadline: 15m
timeout: 5m
skip-files:
- ".*\\.pb\\.go$"

exclude-dirs: [ ".git", ".github" ]
7 changes: 3 additions & 4 deletions Dockerfile-localnet
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,11 @@ RUN mkdir -p /root/.zetacored/cosmovisor/genesis/bin && \
ENV PATH /root/.zetacored/cosmovisor/current/bin/:/root/.zetaclientd/upgrades/current/:${PATH}

COPY contrib/localnet/scripts /root
COPY contrib/localnet/preparams /root/preparams
COPY contrib/localnet/ssh_config /root/.ssh/config
COPY contrib/localnet/ssh_config /etc/ssh/ssh_config.d/localnet.conf
COPY contrib/localnet/zetacored /root/zetacored
COPY contrib/localnet/tss /root/tss

RUN chmod 755 /root/*.sh
RUN chmod 755 /root/*.sh && \
chmod 644 /etc/ssh/ssh_config.d/localnet.conf

WORKDIR /usr/local/bin
EXPOSE 22
Expand Down
51 changes: 34 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ HSM_BUILD_FLAGS := -tags pebbledb,ledger,hsm_test

export DOCKER_BUILDKIT := 1

# parameters for localnet docker compose files
# set defaults to empty to prevent docker warning
export LOCALNET_MODE
export E2E_ARGS := $(E2E_ARGS)
export UPGRADE_HEIGHT
export ZETACORED_IMPORT_GENESIS_DATA
export ZETACORED_START_PERIOD := 30s

clean: clean-binaries clean-dir clean-test-dir clean-coverage

clean-binaries:
Expand Down Expand Up @@ -145,14 +153,8 @@ gosec:
### Formatting ###
###############################################################################

fmt-import:
@bash ./scripts/fmt-imports.sh
@PHONY: fmt-import

fmt-golines:
@echo "--> Formatting Go lines"
@bash ./scripts/fmt-golines.sh
.PHONY: fmt-golines
fmt:
@bash ./scripts/fmt.sh

###############################################################################
### Generation commands ###
Expand Down Expand Up @@ -199,7 +201,7 @@ mocks:
.PHONY: mocks

# generate also includes Go code formatting
generate: proto-gen openapi specs typescript docs-zetacored mocks fmt-import fmt-golines
generate: proto-gen openapi specs typescript docs-zetacored mocks fmt
.PHONY: generate

###############################################################################
Expand All @@ -223,36 +225,51 @@ start-e2e-test: zetanode

start-e2e-admin-test: zetanode
@echo "--> Starting e2e admin test"
cd contrib/localnet/ && $(DOCKER) compose -f docker-compose.yml -f docker-compose-admin.yml up -d
export E2E_ARGS="--skip-regular --test-admin" && \
cd contrib/localnet/ && $(DOCKER) compose -f docker-compose.yml -f docker-compose-additionalevm.yml up -d

start-e2e-performance-test: zetanode
@echo "--> Starting e2e performance test"
cd contrib/localnet/ && $(DOCKER) compose -f docker-compose.yml -f docker-compose-performance.yml up -d
export E2E_ARGS="--test-performance" && \
cd contrib/localnet/ && $(DOCKER) compose -f docker-compose.yml up -d

start-stress-test: zetanode
@echo "--> Starting stress test"
cd contrib/localnet/ && $(DOCKER) compose -f docker-compose.yml -f docker-compose-stresstest.yml up -d
cd contrib/localnet/ && $(DOCKER) compose -f docker-compose.yml -f docker-compose-stress.yml up -d

#TODO: replace OLD_VERSION with v16 tag once its available
zetanode-upgrade: zetanode
@echo "Building zetanode-upgrade"
$(DOCKER) build -t zetanode:old -f Dockerfile-localnet --target old-runtime --build-arg OLD_VERSION='release/v16' .
$(DOCKER) build -t zetanode:old -f Dockerfile-localnet --target old-runtime --build-arg OLD_VERSION='release/v17' .
$(DOCKER) build -t orchestrator -f contrib/localnet/orchestrator/Dockerfile.fastbuild .
.PHONY: zetanode-upgrade

start-upgrade-test: zetanode-upgrade
@echo "--> Starting upgrade test"
export LOCALNET_MODE=upgrade && \
export UPGRADE_HEIGHT=225 && \
cd contrib/localnet/ && $(DOCKER) compose -f docker-compose.yml -f docker-compose-upgrade.yml up -d

start-upgrade-test-light: zetanode-upgrade
@echo "--> Starting light upgrade test (no ZetaChain state populating before upgrade)"
cd contrib/localnet/ && $(DOCKER) compose -f docker-compose.yml -f docker-compose-upgrade.yml -f docker-compose-upgrade-light.yml up -d
export LOCALNET_MODE=upgrade && \
export UPGRADE_HEIGHT=90 && \
cd contrib/localnet/ && $(DOCKER) compose -f docker-compose.yml -f docker-compose-upgrade.yml up -d

start-localnet: zetanode
start-localnet: zetanode start-localnet-skip-build

start-localnet-skip-build:
@echo "--> Starting localnet"
cd contrib/localnet/ && $(DOCKER) compose -f docker-compose.yml -f docker-compose-setup-only.yml up -d
export LOCALNET_MODE=setup-only && \
cd contrib/localnet/ && $(DOCKER) compose -f docker-compose.yml up -d

start-e2e-import-mainnet-test: zetanode
@echo "--> Starting e2e import-data test"
export ZETACORED_IMPORT_GENESIS_DATA=true && \
export ZETACORED_START_PERIOD=10m && \
cd contrib/localnet/ && ./scripts/import-data.sh mainnet && $(DOCKER) compose -f docker-compose.yml up -d

stop-test:
stop-localnet:
cd contrib/localnet/ && $(DOCKER) compose down --remove-orphans

###############################################################################
Expand Down
Loading

0 comments on commit 17cc141

Please sign in to comment.