From cde3a4e02ed9dd035accf9e724a14b6b93a2e64d Mon Sep 17 00:00:00 2001 From: hiepmai-babylonchain <167088365+hiepmai-babylonchain@users.noreply.github.com> Date: Wed, 24 Jul 2024 17:35:19 +0700 Subject: [PATCH 1/6] feat: Add github actions (#22) --- .circleci/config.yml | 105 ---------------------------------- .github/workflows/ci.yml | 21 +++++++ .github/workflows/publish.yml | 25 ++++++++ Makefile | 2 +- bin/local-startup.sh | 6 +- 5 files changed, 51 insertions(+), 108 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/publish.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 2626d7b..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,105 +0,0 @@ -version: 2.1 - -orbs: - aws-ecr: circleci/aws-ecr@8.2.1 - go: circleci/go@1.9.0 - kubernetes: circleci/kubernetes@1.3.1 - helm: circleci/helm@2.0.1 - -jobs: - build_lint_tests: - machine: - image: ubuntu-2204:2024.01.1 - resource_class: large - steps: - - go/install: - version: "1.21.4" - - checkout - - run: - name: Print Go environment - command: "go env" - - restore_cache: # restores saved cache if no changes are detected since last run - keys: - - go-mod-v6-{{ checksum "go.sum" }} - - add_ssh_keys - - run: - name: Build Staking Expiry Checker - command: make build - - save_cache: - key: go-mod-v6-{{ checksum "go.sum" }} - paths: - - "/home/circleci/.go_workspace/pkg/mod" - - run: - name: Lint - command: | - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.55.2 - ./bin/golangci-lint run - - run: - name: Run tests - command: | - make tests - - build_docker: - machine: - image: ubuntu-2204:2024.01.1 - resource_class: large - steps: - - checkout - - add_ssh_keys - - aws-ecr/build-image: - push-image: false - dockerfile: Dockerfile - path: ./contrib/images/staking-expiry-checker/ - build-path: ./ - tag: "$CIRCLE_SHA1,$CIRCLE_TAG" - repo: "staking-expiry-checker" - extra-build-args: "--secret id=sshKey,src=/home/circleci/.ssh/$DEPLOY_KEY_NAME" - - run: - name: Save Docker image to export it to workspace - command: | - docker save $(docker image ls --format '{{.Repository}}:{{.Tag}}') > /tmp/staking-expiry-checker.tar - - persist_to_workspace: - root: /tmp - paths: - - staking-expiry-checker.tar - - push_docker: - machine: - image: ubuntu-2204:2024.01.1 - resource_class: large - steps: - - add_ssh_keys - - attach_workspace: - at: /tmp - - run: - name: Load Docker image from workspace - command: | - docker load -i /tmp/staking-expiry-checker.tar - - aws-ecr/ecr-login: - aws-access-key-id: AWS_ACCESS_KEY_ID - aws-secret-access-key: AWS_SECRET_ACCESS_KEY - region: "$AWS_REGION" - - aws-ecr/push-image: - registry-id: AWS_ECR_REGISTRY_ID - region: "$AWS_REGION" - repo: "staking-expiry-checker" - tag: "$CIRCLE_SHA1,$CIRCLE_TAG" - -workflows: - CICD: - jobs: - - build_lint_tests - - build_docker: - filters: - tags: - only: /.*/ - - push_docker: - requires: - - build_docker - filters: - tags: - only: /.*/ - branches: - only: - - main - - dev diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..d37ad66 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,21 @@ +name: ci + +on: + pull_request: + branches: + - '**' + +jobs: + lint_test: + uses: babylonchain/.github/.github/workflows/reusable_go_lint_test.yml@v0.1.0 + with: + run-unit-tests: true + run-integration-tests: false + run-lint: true + + docker_pipeline: + uses: babylonchain/.github/.github/workflows/reusable_docker_pipeline.yml@v0.1.0 + secrets: inherit + with: + publish: false + dockerfile: ./contrib/images/staking-expiry-checker/Dockerfile \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..9c4281a --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,25 @@ +name: docker_publish + +on: + push: + branches: + - 'main' + - 'dev' + tags: + - '*' + +jobs: + lint_test: + uses: babylonchain/.github/.github/workflows/reusable_go_lint_test.yml@v0.1.0 + with: + run-unit-tests: true + run-integration-tests: false + run-lint: true + + docker_pipeline: + needs: ["lint_test"] + uses: babylonchain/.github/.github/workflows/reusable_docker_pipeline.yml@v0.1.0 + secrets: inherit + with: + publish: true + dockerfile: ./contrib/images/staking-expiry-checker/Dockerfile \ No newline at end of file diff --git a/Makefile b/Makefile index 89289a7..dd30582 100644 --- a/Makefile +++ b/Makefile @@ -46,6 +46,6 @@ generate-mock-interface: cd internal/db && mockery --name=DbInterface --output=../../tests/mocks --outpkg=mocks --filename=mock_db_client.go cd internal/btcclient && mockery --name=BtcInterface --output=../../tests/mocks --outpkg=mocks --filename=mock_btc_client.go -tests: +test: ./bin/local-startup.sh; go test -v -cover ./... diff --git a/bin/local-startup.sh b/bin/local-startup.sh index 5e49df8..de93a91 100755 --- a/bin/local-startup.sh +++ b/bin/local-startup.sh @@ -7,7 +7,7 @@ if [ $(docker ps -q -f name=^/${MONGO_CONTAINER_NAME}$) ]; then else echo "Starting MongoDB" # Start MongoDB - docker-compose up mongodb -d + docker-compose up -d mongodb fi # Check if the RabbitMQ container is already running @@ -17,5 +17,7 @@ if [ $(docker ps -q -f name=^/${RABBITMQ_CONTAINER_NAME}$) ]; then else echo "Starting RabbitMQ" # Start RabbitMQ - docker-compose up rabbitmq -d + docker-compose up -d rabbitmq + # Wait for RabbitMQ to start + sleep 10 fi \ No newline at end of file From a3b62543cd3942dd4c5cbcb4e2f20b6a0a56fbf7 Mon Sep 17 00:00:00 2001 From: wjrjerome Date: Tue, 30 Jul 2024 13:29:21 +1000 Subject: [PATCH 2/6] fix: config should allow btc signet --- internal/config/btc.go | 2 +- internal/utils/utils.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/config/btc.go b/internal/config/btc.go index c380f9d..e29af71 100644 --- a/internal/config/btc.go +++ b/internal/config/btc.go @@ -14,7 +14,7 @@ type BtcConfig struct { When true, connections use HTTP. When false, HTTPS is used for secure communication. */ DisableTLS bool `mapstructure:"disable-tls"` - // NetParams defines the network parameters (e.g., mainnet, testnet). + // NetParams defines the network parameters (e.g., mainnet, testnet & signet). NetParams string `mapstructure:"net-params"` // RpcUser is the username for RPC server authentication. RpcUser string `mapstructure:"rpc-user"` diff --git a/internal/utils/utils.go b/internal/utils/utils.go index a5aba7e..de68560 100644 --- a/internal/utils/utils.go +++ b/internal/utils/utils.go @@ -43,6 +43,7 @@ func GetValidNetParams() map[string]bool { BtcTestnet.String(): true, BtcSimnet.String(): true, BtcRegtest.String(): true, + BtcSignet.String(): true, } return params From ffc2aeefd891354f8239e09d07d2772824f33516 Mon Sep 17 00:00:00 2001 From: wjrjerome Date: Tue, 30 Jul 2024 20:55:49 +1000 Subject: [PATCH 3/6] chore: update to babylon lab --- .github/workflows/ci.yml | 4 ++-- .github/workflows/publish.yml | 4 ++-- LICENSE | 6 ++--- cmd/staking-expiry-checker/main.go | 16 +++++++------- contrib/images/Makefile | 4 ++-- .../images/staking-expiry-checker/Dockerfile | 12 +++++----- docker-compose.yml | 2 +- go.mod | 4 ++-- go.sum | 4 ++-- internal/btcclient/btcclient.go | 6 ++--- internal/config/btc.go | 2 +- internal/config/config.go | 2 +- internal/db/dbclient.go | 4 ++-- internal/db/interface.go | 2 +- internal/observability/metrics/metrics.go | 2 +- internal/poller/poller.go | 2 +- internal/queue/queue.go | 6 ++--- internal/services/service.go | 8 +++---- tests/expired_delegations_test.go | 6 ++--- tests/mocks/mock_db_client.go | 2 +- tests/setup.go | 22 +++++++++---------- 21 files changed, 60 insertions(+), 60 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d37ad66..40a9e3f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,14 +7,14 @@ on: jobs: lint_test: - uses: babylonchain/.github/.github/workflows/reusable_go_lint_test.yml@v0.1.0 + uses: babylonlabs-io/.github/.github/workflows/reusable_go_lint_test.yml@v0.2.0 with: run-unit-tests: true run-integration-tests: false run-lint: true docker_pipeline: - uses: babylonchain/.github/.github/workflows/reusable_docker_pipeline.yml@v0.1.0 + uses: babylonlabs-io/.github/.github/workflows/reusable_docker_pipeline.yml@v0.2.0 secrets: inherit with: publish: false diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 9c4281a..cfd87b6 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -10,7 +10,7 @@ on: jobs: lint_test: - uses: babylonchain/.github/.github/workflows/reusable_go_lint_test.yml@v0.1.0 + uses: babylonlabs-io/.github/.github/workflows/reusable_go_lint_test.yml@v0.2.0 with: run-unit-tests: true run-integration-tests: false @@ -18,7 +18,7 @@ jobs: docker_pipeline: needs: ["lint_test"] - uses: babylonchain/.github/.github/workflows/reusable_docker_pipeline.yml@v0.1.0 + uses: babylonlabs-io/.github/.github/workflows/reusable_docker_pipeline.yml@v0.2.0 secrets: inherit with: publish: true diff --git a/LICENSE b/LICENSE index ed4bc22..9530ea8 100644 --- a/LICENSE +++ b/LICENSE @@ -8,14 +8,14 @@ License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved. Parameters -Licensor: Babylonchain, Inc. +Licensor: Babylon Labs, Ltd. Licensed Work: staking-expiry-checker - The Licensed Work is (c) 2024 Babylonchain, Inc. + The Licensed Work is (c) 2024 Babylon Labs, Ltd. Additional Use Grant: None. -Change Date: 2027-05-15 (March 15th, 2027] +Change Date: 2027-05-15 (March 15th, 2027) Change License: Apache 2.0 diff --git a/cmd/staking-expiry-checker/main.go b/cmd/staking-expiry-checker/main.go index 125b487..b103085 100644 --- a/cmd/staking-expiry-checker/main.go +++ b/cmd/staking-expiry-checker/main.go @@ -7,14 +7,14 @@ import ( "github.com/joho/godotenv" "github.com/rs/zerolog/log" - "github.com/babylonchain/staking-expiry-checker/cmd/staking-expiry-checker/cli" - "github.com/babylonchain/staking-expiry-checker/internal/btcclient" - "github.com/babylonchain/staking-expiry-checker/internal/config" - "github.com/babylonchain/staking-expiry-checker/internal/db" - "github.com/babylonchain/staking-expiry-checker/internal/observability/metrics" - "github.com/babylonchain/staking-expiry-checker/internal/poller" - "github.com/babylonchain/staking-expiry-checker/internal/queue" - "github.com/babylonchain/staking-expiry-checker/internal/services" + "github.com/babylonlabs-io/staking-expiry-checker/cmd/staking-expiry-checker/cli" + "github.com/babylonlabs-io/staking-expiry-checker/internal/btcclient" + "github.com/babylonlabs-io/staking-expiry-checker/internal/config" + "github.com/babylonlabs-io/staking-expiry-checker/internal/db" + "github.com/babylonlabs-io/staking-expiry-checker/internal/observability/metrics" + "github.com/babylonlabs-io/staking-expiry-checker/internal/poller" + "github.com/babylonlabs-io/staking-expiry-checker/internal/queue" + "github.com/babylonlabs-io/staking-expiry-checker/internal/services" ) func init() { diff --git a/contrib/images/Makefile b/contrib/images/Makefile index 8260469..d44c8ad 100644 --- a/contrib/images/Makefile +++ b/contrib/images/Makefile @@ -3,8 +3,8 @@ DOCKER = $(shell which docker) .PHONY: staking-expiry-checker staking-expiry-checker-rmi staking-expiry-checker: - $(DOCKER) build --tag babylonchain/staking-expiry-checker -f staking-expiry-checker/Dockerfile \ + $(DOCKER) build --tag babylonlabs-io/staking-expiry-checker -f staking-expiry-checker/Dockerfile \ $(shell git rev-parse --show-toplevel) staking-expiry-checker-rmi: - $(DOCKER) rmi babylonchain/staking-expiry-checker 2>/dev/null; true + $(DOCKER) rmi babylonlabs-io/staking-expiry-checker 2>/dev/null; true diff --git a/contrib/images/staking-expiry-checker/Dockerfile b/contrib/images/staking-expiry-checker/Dockerfile index 628cfe8..1d7f5e9 100644 --- a/contrib/images/staking-expiry-checker/Dockerfile +++ b/contrib/images/staking-expiry-checker/Dockerfile @@ -15,12 +15,12 @@ RUN apk add --no-cache \ openssh # Build -WORKDIR /go/src/github.com/babylonchain/staking-expiry-checker +WORKDIR /go/src/github.com/babylonlabs-io/staking-expiry-checker # Cache dependencies -COPY go.mod go.sum /go/src/github.com/babylonchain/staking-expiry-checker/ +COPY go.mod go.sum /go/src/github.com/babylonlabs-io/staking-expiry-checker/ # Copy the rest of the files -COPY ./ /go/src/github.com/babylonchain/staking-expiry-checker/ +COPY ./ /go/src/github.com/babylonlabs-io/staking-expiry-checker/ RUN LDFLAGS='-extldflags "-static" -v' \ @@ -37,12 +37,12 @@ RUN addgroup --gid 1138 -S staking-expiry-checker && adduser --uid 1138 -S staki RUN apk add bash curl jq # Label should match your github repo -LABEL org.opencontainers.image.source="https://github.com/babylonchain/staking-expiry-checker:${VERSION}" +LABEL org.opencontainers.image.source="https://github.com/babylonlabs-io/staking-expiry-checker:${VERSION}" # Copy over binaries from the build-env -COPY --from=builder /go/src/github.com/babylonchain/staking-expiry-checker/build/staking-expiry-checker /bin/staking-expiry-checker -COPY --from=builder /go/src/github.com/babylonchain/staking-expiry-checker/contrib/images/staking-expiry-checker/entrypoint.sh /bin/entrypoint.sh +COPY --from=builder /go/src/github.com/babylonlabs-io/staking-expiry-checker/build/staking-expiry-checker /bin/staking-expiry-checker +COPY --from=builder /go/src/github.com/babylonlabs-io/staking-expiry-checker/contrib/images/staking-expiry-checker/entrypoint.sh /bin/entrypoint.sh WORKDIR /home/staking-expiry-checker RUN chown -R staking-expiry-checker /home/staking-expiry-checker diff --git a/docker-compose.yml b/docker-compose.yml index 78fca1d..17d0726 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ version: "3.9" services: staking-expiry-checker: - image: babylonchain/staking-expiry-checker:latest + image: babylonlabs/staking-expiry-checker:latest container_name: staking-expiry-checker environment: - CONFIG=/home/staking-expiry-checker/config.yml diff --git a/go.mod b/go.mod index 3cab9d9..4a5bed3 100644 --- a/go.mod +++ b/go.mod @@ -1,9 +1,9 @@ -module github.com/babylonchain/staking-expiry-checker +module github.com/babylonlabs-io/staking-expiry-checker go 1.21.6 require ( - github.com/babylonchain/staking-queue-client v0.2.0 + github.com/babylonlabs-io/staking-queue-client v0.4.1 github.com/btcsuite/btcd v0.24.0 github.com/rabbitmq/amqp091-go v1.9.0 github.com/spf13/viper v1.18.2 diff --git a/go.sum b/go.sum index ac38a24..8c3100a 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,6 @@ github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/babylonchain/staking-queue-client v0.2.0 h1:kktKgXJXDAheBv82s7LV5L2CPAfzhtHllNrIopXGjIo= -github.com/babylonchain/staking-queue-client v0.2.0/go.mod h1:mEgA6N3SnwFwGEOsUYr/HdjpKa13Wck08MS7VY/Icvo= +github.com/babylonlabs-io/staking-queue-client v0.4.1 h1:AW+jtrNxZYN/isRx+njqjHbUU9CzhF42Ke6roK+0N3I= +github.com/babylonlabs-io/staking-queue-client v0.4.1/go.mod h1:n3fr3c+9LNiJlyETmcrVk94Zn76rAADhGZKxX+rVf+Q= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= diff --git a/internal/btcclient/btcclient.go b/internal/btcclient/btcclient.go index 9749235..9dce989 100644 --- a/internal/btcclient/btcclient.go +++ b/internal/btcclient/btcclient.go @@ -4,9 +4,9 @@ import ( "github.com/btcsuite/btcd/chaincfg" "github.com/btcsuite/btcd/rpcclient" - "github.com/babylonchain/staking-expiry-checker/internal/config" - "github.com/babylonchain/staking-expiry-checker/internal/observability/metrics" - "github.com/babylonchain/staking-expiry-checker/internal/utils" + "github.com/babylonlabs-io/staking-expiry-checker/internal/config" + "github.com/babylonlabs-io/staking-expiry-checker/internal/observability/metrics" + "github.com/babylonlabs-io/staking-expiry-checker/internal/utils" ) type BtcClient struct { diff --git a/internal/config/btc.go b/internal/config/btc.go index e29af71..b474f29 100644 --- a/internal/config/btc.go +++ b/internal/config/btc.go @@ -3,7 +3,7 @@ package config import ( "fmt" - "github.com/babylonchain/staking-expiry-checker/internal/utils" + "github.com/babylonlabs-io/staking-expiry-checker/internal/utils" ) type BtcConfig struct { diff --git a/internal/config/config.go b/internal/config/config.go index b62c766..3800dad 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -5,7 +5,7 @@ import ( "os" "strings" - queue "github.com/babylonchain/staking-queue-client/config" + queue "github.com/babylonlabs-io/staking-queue-client/config" "github.com/spf13/viper" ) diff --git a/internal/db/dbclient.go b/internal/db/dbclient.go index 7963402..083d401 100644 --- a/internal/db/dbclient.go +++ b/internal/db/dbclient.go @@ -9,8 +9,8 @@ import ( "go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo/options" - "github.com/babylonchain/staking-expiry-checker/internal/config" - "github.com/babylonchain/staking-expiry-checker/internal/db/model" + "github.com/babylonlabs-io/staking-expiry-checker/internal/config" + "github.com/babylonlabs-io/staking-expiry-checker/internal/db/model" ) type Database struct { diff --git a/internal/db/interface.go b/internal/db/interface.go index 6a7f3b3..76de8ad 100644 --- a/internal/db/interface.go +++ b/internal/db/interface.go @@ -3,7 +3,7 @@ package db import ( "context" - "github.com/babylonchain/staking-expiry-checker/internal/db/model" + "github.com/babylonlabs-io/staking-expiry-checker/internal/db/model" "go.mongodb.org/mongo-driver/bson/primitive" ) diff --git a/internal/observability/metrics/metrics.go b/internal/observability/metrics/metrics.go index 3a77ae5..e6b07df 100644 --- a/internal/observability/metrics/metrics.go +++ b/internal/observability/metrics/metrics.go @@ -11,7 +11,7 @@ import ( "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/rs/zerolog/log" - "github.com/babylonchain/staking-expiry-checker/internal/utils" + "github.com/babylonlabs-io/staking-expiry-checker/internal/utils" ) type Outcome string diff --git a/internal/poller/poller.go b/internal/poller/poller.go index 22d1307..f31e5c3 100644 --- a/internal/poller/poller.go +++ b/internal/poller/poller.go @@ -6,7 +6,7 @@ import ( "github.com/rs/zerolog/log" - "github.com/babylonchain/staking-expiry-checker/internal/services" + "github.com/babylonlabs-io/staking-expiry-checker/internal/services" ) type Poller struct { diff --git a/internal/queue/queue.go b/internal/queue/queue.go index f792c52..4592b16 100644 --- a/internal/queue/queue.go +++ b/internal/queue/queue.go @@ -7,9 +7,9 @@ import ( "github.com/rs/zerolog/log" - "github.com/babylonchain/staking-expiry-checker/internal/observability/metrics" - "github.com/babylonchain/staking-queue-client/client" - queueConfig "github.com/babylonchain/staking-queue-client/config" + "github.com/babylonlabs-io/staking-expiry-checker/internal/observability/metrics" + "github.com/babylonlabs-io/staking-queue-client/client" + queueConfig "github.com/babylonlabs-io/staking-queue-client/config" ) type QueueManager struct { diff --git a/internal/services/service.go b/internal/services/service.go index be76ce2..627b4f3 100644 --- a/internal/services/service.go +++ b/internal/services/service.go @@ -3,10 +3,10 @@ package services import ( "context" - "github.com/babylonchain/staking-expiry-checker/internal/btcclient" - "github.com/babylonchain/staking-expiry-checker/internal/db" - "github.com/babylonchain/staking-expiry-checker/internal/queue" - queueclient "github.com/babylonchain/staking-queue-client/client" + "github.com/babylonlabs-io/staking-expiry-checker/internal/btcclient" + "github.com/babylonlabs-io/staking-expiry-checker/internal/db" + "github.com/babylonlabs-io/staking-expiry-checker/internal/queue" + queueclient "github.com/babylonlabs-io/staking-queue-client/client" ) type Service struct { diff --git a/tests/expired_delegations_test.go b/tests/expired_delegations_test.go index ee7286e..19eb347 100644 --- a/tests/expired_delegations_test.go +++ b/tests/expired_delegations_test.go @@ -5,9 +5,9 @@ import ( "testing" "time" - "github.com/babylonchain/staking-expiry-checker/internal/db/model" - "github.com/babylonchain/staking-expiry-checker/tests/mocks" - "github.com/babylonchain/staking-queue-client/client" + "github.com/babylonlabs-io/staking-expiry-checker/internal/db/model" + "github.com/babylonlabs-io/staking-expiry-checker/tests/mocks" + "github.com/babylonlabs-io/staking-queue-client/client" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" "go.mongodb.org/mongo-driver/bson/primitive" diff --git a/tests/mocks/mock_db_client.go b/tests/mocks/mock_db_client.go index b241de9..33d3bfa 100644 --- a/tests/mocks/mock_db_client.go +++ b/tests/mocks/mock_db_client.go @@ -7,7 +7,7 @@ import ( mock "github.com/stretchr/testify/mock" - model "github.com/babylonchain/staking-expiry-checker/internal/db/model" + model "github.com/babylonlabs-io/staking-expiry-checker/internal/db/model" primitive "go.mongodb.org/mongo-driver/bson/primitive" ) diff --git a/tests/setup.go b/tests/setup.go index 4ee5de1..9bde6f0 100644 --- a/tests/setup.go +++ b/tests/setup.go @@ -14,17 +14,17 @@ import ( "go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo/options" - "github.com/babylonchain/staking-expiry-checker/internal/btcclient" - "github.com/babylonchain/staking-expiry-checker/internal/config" - "github.com/babylonchain/staking-expiry-checker/internal/db" - "github.com/babylonchain/staking-expiry-checker/internal/db/model" - "github.com/babylonchain/staking-expiry-checker/internal/observability/metrics" - "github.com/babylonchain/staking-expiry-checker/internal/poller" - "github.com/babylonchain/staking-expiry-checker/internal/queue" - "github.com/babylonchain/staking-expiry-checker/internal/services" - "github.com/babylonchain/staking-queue-client/client" - - queueconfig "github.com/babylonchain/staking-queue-client/config" + "github.com/babylonlabs-io/staking-expiry-checker/internal/btcclient" + "github.com/babylonlabs-io/staking-expiry-checker/internal/config" + "github.com/babylonlabs-io/staking-expiry-checker/internal/db" + "github.com/babylonlabs-io/staking-expiry-checker/internal/db/model" + "github.com/babylonlabs-io/staking-expiry-checker/internal/observability/metrics" + "github.com/babylonlabs-io/staking-expiry-checker/internal/poller" + "github.com/babylonlabs-io/staking-expiry-checker/internal/queue" + "github.com/babylonlabs-io/staking-expiry-checker/internal/services" + "github.com/babylonlabs-io/staking-queue-client/client" + + queueconfig "github.com/babylonlabs-io/staking-queue-client/config" ) type TestServerDependency struct { From 071e7036dc15aca68295474a9e50c13244f6602a Mon Sep 17 00:00:00 2001 From: wjrjerome Date: Tue, 30 Jul 2024 21:51:23 +1000 Subject: [PATCH 4/6] chore: keep the local env rabbitmq credentials aligned with other services --- config/config-docker.yml | 4 ++-- config/config-local.yml | 4 ++-- docker-compose.yml | 4 ++-- tests/config-test.yml | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/config/config-docker.yml b/config/config-docker.yml index 0234d9a..a95b2be 100644 --- a/config/config-docker.yml +++ b/config/config-docker.yml @@ -13,8 +13,8 @@ btc: rpc-user: rpcuser rpc-pass: rpcpass queue: - queue_user: guest # can be replaced by values in .env file - queue_password: guest + queue_user: user # can be replaced by values in .env file + queue_password: password url: "localhost:5672" processing_timeout: 5 # 5 second msg_max_retry_attempts: 10 diff --git a/config/config-local.yml b/config/config-local.yml index 1800178..e3b0584 100644 --- a/config/config-local.yml +++ b/config/config-local.yml @@ -13,8 +13,8 @@ btc: rpc-user: rpcuser rpc-pass: rpcpass queue: - queue_user: guest # can be replaced by values in .env file - queue_password: guest + queue_user: user # can be replaced by values in .env file + queue_password: password url: "localhost:5672" processing_timeout: 5 # 5 second msg_max_retry_attempts: 3 diff --git a/docker-compose.yml b/docker-compose.yml index 78fca1d..bd79ef2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -29,7 +29,7 @@ services: - "5672:5672" # AMQP protocol port - "15672:15672" # Management UI port environment: - RABBITMQ_DEFAULT_USER: guest - RABBITMQ_DEFAULT_PASS: guest + RABBITMQ_DEFAULT_USER: user + RABBITMQ_DEFAULT_PASS: password volumes: - "./rabbitmq_data:/var/lib/rabbitmq" diff --git a/tests/config-test.yml b/tests/config-test.yml index 47f1bd4..870442a 100644 --- a/tests/config-test.yml +++ b/tests/config-test.yml @@ -13,8 +13,8 @@ btc: rpc-user: rpcuser rpc-pass: rpcpass queue: - queue_user: guest # can be replaced by values in .env file - queue_password: guest + queue_user: user # can be replaced by values in .env file + queue_password: password url: "localhost:5672" processing_timeout: 60 # 5 second msg_max_retry_attempts: 2 From aeb16a9c1fa563fabf0d3d89295e4bc20bb9a7bb Mon Sep 17 00:00:00 2001 From: wjrjerome Date: Wed, 7 Aug 2024 21:36:26 +1000 Subject: [PATCH 5/6] fix: run docker compose without dash --- Makefile | 4 ++-- bin/local-startup.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index dd30582..5353616 100644 --- a/Makefile +++ b/Makefile @@ -33,10 +33,10 @@ build-docker: $(MAKE) BBN_PRIV_DEPLOY_KEY=${BBN_PRIV_DEPLOY_KEY} -C contrib/images staking-expiry-checker start-staking-expiry-checker: build-docker stop-service - docker-compose up -d + docker compose up -d stop-service: - docker-compose down + docker compose down run-local: ./bin/local-startup.sh; diff --git a/bin/local-startup.sh b/bin/local-startup.sh index de93a91..5c80f49 100755 --- a/bin/local-startup.sh +++ b/bin/local-startup.sh @@ -7,7 +7,7 @@ if [ $(docker ps -q -f name=^/${MONGO_CONTAINER_NAME}$) ]; then else echo "Starting MongoDB" # Start MongoDB - docker-compose up -d mongodb + docker compose up -d mongodb fi # Check if the RabbitMQ container is already running @@ -17,7 +17,7 @@ if [ $(docker ps -q -f name=^/${RABBITMQ_CONTAINER_NAME}$) ]; then else echo "Starting RabbitMQ" # Start RabbitMQ - docker-compose up -d rabbitmq + docker compose up -d rabbitmq # Wait for RabbitMQ to start sleep 10 fi \ No newline at end of file From 19911734adb8b6e2acded96ed7a29b6952007679 Mon Sep 17 00:00:00 2001 From: Crypto Minion <154598612+jrwbabylonlab@users.noreply.github.com> Date: Fri, 16 Aug 2024 18:51:00 +1000 Subject: [PATCH 6/6] chore: modify-license (#4) * chore: modify-license --- LICENSE | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 75 insertions(+), 5 deletions(-) diff --git a/LICENSE b/LICENSE index 9530ea8..5d73d61 100644 --- a/LICENSE +++ b/LICENSE @@ -8,14 +8,84 @@ License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved. Parameters -Licensor: Babylon Labs, Ltd. +Licensor: Babylon Labs Ltd. -Licensed Work: staking-expiry-checker +Licensed Work: Staking Expiry Checker The Licensed Work is (c) 2024 Babylon Labs, Ltd. -Additional Use Grant: None. - -Change Date: 2027-05-15 (March 15th, 2027) +Additional Use Grant: + +In addition to the uses permitted under the non-production license below, +we grant you a limited, non-exclusive, non-transferable, non-sublicensable, +revocable license, limited as set forth below, to use the Licensed Work +in this repository for production commercial uses built on or using and integrated +with the Babylon Protocol, not including Competing Uses. + +Any use beyond the scope of this license, including uses that are not built on or +using and integrated with the Babylon Protocol, or are Competing Uses, +will terminate this license to you, automatically and without notice. + +This License applies separately and solely to the specific versions of the Licensed Work +in the specified repository on or before the date of this License, and we may require a +different license and different provisions for each subsequent version of the +Licensed Work released by us. + +"Babylon Labs", "we", "our", or "us" means Babylon Labs Ltd. + +"Babylon Protocol" means the Bitcoin staking protocol as further described in the documentation +here (https://docs.babylonlabs.io/docs/introduction/babylon-overview), as updated from time to time. + +"Competing Use" means any use of the Licensed Work in any product, software, protocol, network, +application, or service that is made available to any party and that +(i) substitutes for the use of the Babylon Protocol, +(ii) offers the same or substantially similar functionality as the Babylon Protocol or +(iii) is built on or uses a protocol with substantially similar functionality as the Babylon Protocol +or otherwise facilitates the staking of bitcoin other than by utilizing the Babylon Protocol. + +The provisions in this License apply to each individual, entity, group, or association +(each and collectively, "you" or "your") who uses the Licensed Work for production, +and you agree to such provisions. Your production use of the Licensed Work is conditional on your +agreement to this License. If you do not agree and consent to be bound to this License, +do not so use the Software. + +If you do not fall within the limited scope of this license as described above or below, +or are otherwise not in strict compliance with this License, then this production license does not +extend to you and does not grant you any production use, including any copying, distributing, or +making any derivative use of the Licensed Work for production purposes. + +Limited Scope of License. Your commercial production license to the Licensed Work +under this License does not extend to any use: + +1. unless you have legal capacity to consent and agree to be bound by this License; +2. unless you have the technical knowledge necessary or advisable to understand and evaluate the + risks of using the Licensed Work and the Babylon Protocol; +3. if you are a resident or agent of, or an entity organized, incorporated or doing business in, + Afghanistan, Belarus, Bosnia and Herzegovina, Burundi, Central African Republic, Crimea, Cuba, + Democratic People's Republic of Korea, Democratic Republic of the Congo, + Donetsk or Luhansk Regions of Ukraine, Eritrea, Guinea, Guinea-Bissau, Haiti, Iran, Iraq, Lebanon, + Libya, Mali, Myanmar, Nicaragua, Russia, Somalia, South Sudan, Sudan, Syria, Venezuela, Yemen, + or Zimbabwe or any other country to which the United States, the United Kingdom, + the European Union or any of its member states or the United Nations or any of its member states + (collectively, the "Major Jurisdictions") embargoes goods or imposes sanctions + (such embargoed or sanctioned territories, collectively, the "Restricted Territories"); +4. if you are, or if you directly or indirectly own or control, from any person or entity that is + listed on any sanctions list or equivalent maintained by any of the Major Jurisdictions + (collectively, "Sanctions Lists Persons"); +5. to transact in or with any Restricted Territories or Sanctions List Persons; +6. if you are a U.S. Person as defined in 17 CFR ยง 230.902, or currently or ordinarily located or + resident in (or incorporated or organized in) the United States of America, Canada, or + Australia (collectively, "Excluded Jurisdictions"), or to transact in or with Excluded Jurisdictions; +7. to defraud, or otherwise materially mislead, any person; +8. in violation of applicable laws, rules or regulations in your relevant jurisdiction; +9. that circumvents any sanctions or export controls targeting you or the country or territory where + you are located; or +10. in any activity that transmits, exchanges, or is otherwise supported by the direct or indirect + proceeds of criminal or fraudulent activity. + +Any production use of the Licensed Work by you confirms your agreement to the foregoing limitations, +and your understanding and agreement that they are limitations and not restrictions. + +Change Date: 2027-03-15 (March 15th, 2027) Change License: Apache 2.0