Skip to content

Commit

Permalink
Merge branch 'develop' into authorizations-list-migration
Browse files Browse the repository at this point in the history
  • Loading branch information
kingpinXD authored Jun 24, 2024
2 parents 613159a + a1af629 commit 4803425
Show file tree
Hide file tree
Showing 176 changed files with 2,019 additions and 3,285 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
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
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" ]
44 changes: 27 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,15 +225,17 @@ 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
Expand All @@ -242,24 +246,30 @@ zetanode-upgrade: zetanode

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-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

stop-localnet:
start-e2e-import-mainnet-test: zetanode
@echo "--> Starting e2e import-data test"
cd contrib/localnet/ && ./scripts/import-data.sh mainnet && $(DOCKER) compose -f docker-compose.yml -f docker-compose-import-data.yml up -d
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
1 change: 0 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,6 @@ func New(
appOpts servertypes.AppOptions,
baseAppOptions ...func(*baseapp.BaseApp),
) *App {

appCodec := encodingConfig.Codec
cdc := encodingConfig.Amino
interfaceRegistry := encodingConfig.InterfaceRegistry
Expand Down
1 change: 0 additions & 1 deletion app/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
func (app *App) ExportAppStateAndValidators(
forZeroHeight bool, jailAllowedAddrs []string, modulesToExport []string,
) (servertypes.ExportedApp, error) {

// as if they could withdraw from the start of the next block
ctx := app.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()})

Expand Down
6 changes: 5 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
* [2340](https://github.com/zeta-chain/node/pull/2340) - add ValidateInbound method for cctx orchestrator
* [2344](https://github.com/zeta-chain/node/pull/2344) - group common data of EVM/Bitcoin signer and observer using base structs
* [2357](https://github.com/zeta-chain/node/pull/2357) - integrate base Signer structure into EVM/Bitcoin Signer
* [2375](https://github.com/zeta-chain/node/pull/2375) - improve & speedup code formatting

### Tests

Expand All @@ -67,8 +68,10 @@
* [2299](https://github.com/zeta-chain/node/pull/2299) - add `zetae2e` command to deploy test contracts
* [2360](https://github.com/zeta-chain/node/pull/2360) - add stateful e2e tests.
* [2349](https://github.com/zeta-chain/node/pull/2349) - add TestBitcoinDepositRefund and WithdrawBitcoinMultipleTimes E2E tests
* [2368](https://github.com/zeta-chain/node/pull/2368) - eliminate panic usage across testing suite
* [2369](https://github.com/zeta-chain/node/pull/2369) - fix random cross-chain swap failure caused by using tiny UTXO


### Fixes

* [1484](https://github.com/zeta-chain/node/issues/1484) - replaced hard-coded `MaxLookaheadNonce` with a default lookback factor
Expand All @@ -90,6 +93,7 @@
* [2191](https://github.com/zeta-chain/node/pull/2191) - Fixed conditional logic for the docker build step for non release builds to not overwrite the github tag
* [2192](https://github.com/zeta-chain/node/pull/2192) - Added release status checker and updater pipeline that will update release statuses when they go live on network
* [2335](https://github.com/zeta-chain/node/pull/2335) - ci: updated the artillery report to publish to artillery cloud
* [2377](https://github.com/zeta-chain/node/pull/2377) - ci: adjusted sast-linters.yml to not scan itself, nor alert on removal of nosec.

## v17.0.0

Expand Down Expand Up @@ -529,4 +533,4 @@ Getting the correct TSS address for Bitcoin now requires proviidng the Bitcoin c
### CI

* [1218](https://github.com/zeta-chain/node/pull/1218) - cross-compile release binaries and simplify PR testings
* [1302](https://github.com/zeta-chain/node/pull/1302) - add mainnet builds to goreleaser
* [1302](https://github.com/zeta-chain/node/pull/1302) - add mainnet builds to goreleaser
1 change: 0 additions & 1 deletion cmd/zetaclientd/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ func DebugCmd() *cobra.Command {
if err != nil {
return err
}

}
fmt.Println("BallotIdentifier : ", ballotIdentifier)

Expand Down
2 changes: 1 addition & 1 deletion cmd/zetaclientd/gen_pre_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var GenPrePramsCmd = &cobra.Command{
Use: "gen-pre-params <path>",
Short: "Generate pre parameters for TSS",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, args []string) error {
startTime := time.Now()
preParams, err := keygen.GeneratePreParams(time.Second * 300)
if err != nil {
Expand Down
1 change: 0 additions & 1 deletion cmd/zetaclientd/keygen_tss.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ func SetTSSPubKey(tss *mc.TSS, logger zerolog.Logger) error {
}
logger.Info().Msgf("TSS address in hex: %s", tss.EVMAddress().Hex())
return nil

}
func TestTSS(tss *mc.TSS, logger zerolog.Logger) error {
keygenLogger := logger.With().Str("module", "test-keygen").Logger()
Expand Down
1 change: 0 additions & 1 deletion cmd/zetaclientd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,4 @@ func SetupConfigForTest() {
})

rand.Seed(time.Now().UnixNano())

}
2 changes: 0 additions & 2 deletions cmd/zetaclientd/p2p_diagnostics.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ func RunDiagnostics(
hotkeyPk cryptotypes.PrivKey,
cfg config.Config,
) error {

startLogger.Warn().Msg("P2P Diagnostic mode enabled")
startLogger.Warn().Msgf("seed peer: %s", peers)
priKey := secp256k1.PrivKey(hotkeyPk.Bytes()[:32])
Expand All @@ -46,7 +45,6 @@ func RunDiagnostics(
var s *metrics.TelemetryServer
if len(peers) == 0 {
startLogger.Warn().Msg("No seed peer specified; assuming I'm the host")

}
p2pPriKey, err := crypto.UnmarshalSecp256k1PrivateKey(priKey[:])
if err != nil {
Expand Down
Loading

0 comments on commit 4803425

Please sign in to comment.