Skip to content

Commit 596dd78

Browse files
authored
Merge pull request #684 from rsksmart/QA-Test
QA-Test -> Stable-Test - v2.1.2
2 parents c5f286f + 3453249 commit 596dd78

File tree

178 files changed

+4745
-1492
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

178 files changed

+4745
-1492
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @Luisfc68 @MaximStanciu8 @gsoares85 @Dominikkq @AndresQuijano

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,5 @@ jobs:
5656
- name: golangci-lint
5757
uses: golangci/golangci-lint-action@ec5d18412c0aeab7936cb16880d708ba2a64e1ae #v6.2.0
5858
with:
59-
version: v1.55.2
59+
version: v1.63.4
60+
skip-pkg-cache: true

.github/workflows/codeql.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ name: "CodeQL"
22

33
on:
44
push:
5-
branches: [ "master", "Stable-Test", "QA-Test"]
5+
branches: [ "master", "Stable-Test", "QA-Test", "flyover-*" ]
66
pull_request:
7-
branches: [ "master", "Stable-Test", "QA-Test"]
87
schedule:
98
- cron: "0 0 * * 1"
109

.github/workflows/e2e.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,11 @@ jobs:
2727
run: cd docker-compose/local/ && ./gh-action-env.sh $GITHUB_TOKEN
2828

2929
- name: Building LPS environment...
30-
run: cd docker-compose/local/ && LPS_STAGE=regtest sh lps-env.sh up
30+
run: cd docker-compose/local/ && LPS_STAGE=regtest ./lps-env.sh up
31+
shell: bash
3132

3233
- name: Checking LPS health...
3334
run: curl -X GET http://localhost:8080/health
3435

3536
- name: Shutting LPS environment down...
36-
run: cd docker-compose/local/ && LPS_STAGE=regtest sh lps-env.sh down
37+
run: cd docker-compose/local/ && LPS_STAGE=regtest ./lps-env.sh down

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ build/
2323
/utils/*
2424
/**/.env.regtest
2525
/**/gh_token.txt
26+
/**/geth_keystore/
2627
/**/local/cookie_jar.txt
2728
!sample-config.env
2829
/**/*.env

.golangci.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,30 @@ run:
22
allow-parallel-runners: true
33
timeout: 3m
44
tests: true
5-
skip-dirs:
5+
issues:
6+
exclude-dirs:
67
- internal/adapters/dataproviders/rootstock/bindings
8+
- test/mocks
79
linters:
810
presets:
911
- bugs
1012
- complexity
1113
- unused
1214
- performance
1315
linters-settings:
16+
errcheck:
17+
check-type-assertions: true
18+
check-blank: true
19+
govet:
20+
enable:
21+
- nilness
22+
- defers
23+
- lostcancel
24+
- nilfunc
25+
- shadow
26+
- unusedwrite
1427
exhaustive:
15-
default-signifies-exhaustive: true
28+
default-signifies-exhaustive: true
29+
gosec:
30+
excludes:
31+
- G115 # TODO update project to cast safely

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/golangci/golangci-lint
3-
rev: v1.55.2
3+
rev: v1.63.4
44
hooks:
55
- id: golangci-lint-full
66
- repo: https://github.com/commitizen-tools/commitizen

Makefile

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,22 @@
1-
.PHONY: test all clean
1+
.PHONY: test all clean utils
22

33
COVER_FILE = coverage/cover.out
44
TEMPORAL_COVER_FILE =$(shell pwd)/coverage/cover.out.temp
55

66
filter_coverage_file = grep -v "internal/adapters/dataproviders/rootstock/bindings" $(1) > coverage/temp.txt && mv coverage/temp.txt $(1)
77

8+
define utils_build
9+
CGO_ENABLED=0 go build -v -o ./utils/update_provider_url ./cmd/utils/update_provider_url/update_provider_url.go
10+
CGO_ENABLED=0 go build -v -o ./utils/register_pegin ./cmd/utils/register_pegin/register_pegin.go
11+
CGO_ENABLED=0 go build -v -o ./utils/refund_user_pegout ./cmd/utils/refund_user_pegout/refund_user_pegout.go
12+
CGO_ENABLED=0 go build -v -o ./utils/key_conversion ./cmd/utils/key_conversion/key_conversion.go
13+
endef
14+
815
tools: download
916
go install github.com/parvez3019/go-swagger3@fef3d30b0707883c389261bf26297eebd10d7216 #v1.0.3
1017
go install golang.org/x/vuln/cmd/govulncheck@latest
1118
pip3 install pre-commit && pre-commit install
12-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin v1.55.2
19+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin v1.63.4
1320
brew install mockery && brew upgrade mockery # installation with brew is because mockery team doesnt recommend to install with go install, if you don't have brew feel free to comment this line and install mockery with other method
1421

1522
download:
@@ -23,12 +30,17 @@ validation: lint
2330
go mod verify
2431
govulncheck ./... # should fail on non informational vulnerabilities
2532

33+
COMMIT_TAG ?= $(shell git describe --exact-match --tags)
2634
COMMIT_HASH ?= $(shell git rev-parse HEAD)
2735
SOURCE_VERSION := $(COMMIT_HASH)
36+
SOURCE_TAG := $(COMMIT_TAG)
37+
2838
build: download
2939
mkdir -p build && cd build
30-
@echo "Building liquidity-provider-server $(SOURCE_VERSION)"
31-
CGO_ENABLED=0 go build -v -installsuffix 'static' -ldflags="-s -X 'main.BuildVersion=$(SOURCE_VERSION)' -X 'main.BuildTime=$(shell date)'" -o ./build/liquidity-provider-server ./cmd/application/main.go
40+
@echo "Building liquidity-provider-server $(SOURCE_TAG) ($(SOURCE_VERSION))"
41+
CGO_ENABLED=0 go build -v -installsuffix 'static' \
42+
-ldflags="-s -X 'main.BuildVersion=$(SOURCE_VERSION)' -X 'main.BuildTime=$(shell date)' -X 'github.com/rsksmart/liquidity-provider-server/internal/usecases/liquidity_provider.BuildVersion=$(SOURCE_TAG)' -X 'github.com/rsksmart/liquidity-provider-server/internal/usecases/liquidity_provider.BuildRevision=$(SOURCE_VERSION)'" \
43+
-o ./build/liquidity-provider-server ./cmd/application/main.go
3244

3345
api:
3446
go-swagger3 --module-path . \
@@ -38,26 +50,40 @@ api:
3850

3951
coverage: clean
4052
mkdir -p coverage
41-
go test -v -race -covermode=atomic -coverpkg=./pkg/...,./internal/...,./cmd/... -coverprofile=$(TEMPORAL_COVER_FILE) ./pkg/... ./internal/... ./cmd/...
53+
go test -timeout 30m -v -race -covermode=atomic -coverpkg=./pkg/...,./internal/...,./cmd/... -coverprofile=$(TEMPORAL_COVER_FILE) ./pkg/... ./internal/... ./cmd/...
4254
$(call filter_coverage_file, $(TEMPORAL_COVER_FILE))
4355
go tool cover -func "$(TEMPORAL_COVER_FILE)" && go tool cover -html="$(TEMPORAL_COVER_FILE)"
4456
rm $(TEMPORAL_COVER_FILE)
4557

4658
coverage-report: clean
4759
mkdir -p coverage
48-
go test -v -race -covermode=atomic -coverpkg=./pkg/...,./internal/...,./cmd/... -coverprofile=$(COVER_FILE) ./pkg/... ./internal/... ./cmd/...
60+
go test -timeout 30m -v -race -covermode=atomic -coverpkg=./pkg/...,./internal/...,./cmd/... -coverprofile=$(COVER_FILE) ./pkg/... ./internal/... ./cmd/...
4961
$(call filter_coverage_file, $(COVER_FILE))
5062

5163
test: clean
5264
mkdir -p coverage
53-
go test -v -race -covermode=atomic -coverpkg=./pkg/...,./internal/...,./cmd/... -coverprofile=$(TEMPORAL_COVER_FILE) ./pkg/... ./internal/... ./cmd/...
65+
go test -timeout 30m -v -race -covermode=atomic -coverpkg=./pkg/...,./internal/...,./cmd/... -coverprofile=$(TEMPORAL_COVER_FILE) ./pkg/... ./internal/... ./cmd/...
5466
$(call filter_coverage_file, $(TEMPORAL_COVER_FILE))
5567
go tool cover -func $(TEMPORAL_COVER_FILE)
5668
rm $(TEMPORAL_COVER_FILE)
5769

5870
clean:
5971
rm -rf build $(TEMPORAL_COVER_FILE)
6072

61-
utils:
62-
mkdir -p utils && cd utils
63-
CGO_ENABLED=0 go build -v -o ./utils/update_provider_url ./cmd/utils/update_provider_url.go
73+
utils: download
74+
rm -rf utils
75+
mkdir -p utils
76+
$(utils_build)
77+
78+
utils-docker:
79+
rm -rf utils
80+
mkdir -p utils
81+
docker build -f docker-compose/utils/Dockerfile --output=utils .
82+
83+
MONITOR_PORT ?= 8090
84+
monitoring:
85+
docker build -f docker-compose/monitoring/Dockerfile -t monitoring .
86+
docker run \
87+
-p $(MONITOR_PORT):$(MONITOR_PORT) \
88+
-e MONITOR_PORT=$(MONITOR_PORT) \
89+
monitoring

OpenApi.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,20 @@ components:
604604
- refundPegoutTxHash
605605
- bridgeRefundTxHash
606606
type: object
607+
ServerInfoDTO:
608+
properties:
609+
revision:
610+
description: Version commit hash
611+
example: b7bf393a2b1cedde8ee15b00780f44e6e5d2ba9d
612+
type: string
613+
version:
614+
description: Server version tag
615+
example: v1.0.0
616+
type: string
617+
required:
618+
- version
619+
- revision
620+
type: object
607621
Services:
608622
properties:
609623
btc:
@@ -983,6 +997,17 @@ paths:
983997
$ref: '#/components/schemas/DepositEventDTO'
984998
description: Successfully retrieved the user quotes
985999
summary: GetUserQuotes
1000+
/version:
1001+
get:
1002+
description: ' Returns the server version and revision'
1003+
responses:
1004+
"200":
1005+
content:
1006+
application/json:
1007+
schema:
1008+
$ref: '#/components/schemas/ServerInfoDTO'
1009+
description: ""
1010+
summary: Get server version
9861011
servers:
9871012
- description: ' Testnet'
9881013
url: https://lps.testnet.flyover.rif.technology

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,35 @@ mentioned before are the minimal dependencies, but in order to run a fully funct
5656
The [cmd/utils](cmd/utils) directory contains scripts with different utilities for the liquidity providers. You can either run them directly
5757
with `go run` or build them with `make utils`. You can run the scripts with the `--help` flag to see the available options. The current utilities are:
5858
- **update_provider_url**: updates the URL of a liquidity provider provided when the discovery function of the Liquidity Bridge Contract is executed.
59+
- **register_pegin**: register a PegIn transaction within the Liquidity Bridge Contract. Most times, this script is only required to execute refunds
60+
on special cases. This script requires an input file whose structure can be found [the input-example.json](cmd/utils/register_pegin/input-example.json) file.
61+
- **refund_user_pegout**: executes a refund for a user's peg-out operation through the Liquidity Bridge Contract. This is used when a peg-out operation needs to be refunded back to the user's RSK address. The script requires the quote hash of the operation to refund.
62+
- **key_conversion**: shows the corresponding BTC and RSK address for a given private key and encrypts it into a keystore, accepts the key either in WIF or hex format. The key can be provided through the terminal, a file or an existing keystore.
63+
64+
### Monitoring Service
65+
The project includes a Bitcoin balance monitoring service that tracks specified BTC addresses and exposes metrics at `http://<host>:8080/metrics` using Prometheus `https://prometheus.io/`.
66+
67+
To run the monitoring service with the default port (8090):
68+
```bash
69+
make monitoring
70+
```
71+
72+
To run the monitoring service with a custom port (e.g., 8091):
73+
```bash
74+
make monitoring MONITOR_PORT=8091
75+
```
76+
77+
The service is configured in `docker-compose/monitoring/src/config.ts` and supports both testnet and mainnet monitoring:
78+
79+
- MONITORED_ADDRESSES: The set of addresses to be monitored. Each address should have an alias that will be used in the metrics.
80+
- MONITOR_CONFIG: The configuration for the monitoring service.
81+
- pollingIntervalSeconds: How often the service will check the bitcoin balance of the monitored addresses in seconds.
82+
- monitorName: The name of the monitoring service.
83+
- network: The network to monitor (mainnet or testnet).
84+
- port: The port where the service will be exposed.
85+
86+
The service can be configured to monitor other addresses by modifying the `MONITORED_ADDRESSES` array in `docker-compose/monitoring/src/config.ts`.
87+
5988

6089
### More information
6190
If you're looking forward to integrate with Flyover Protocol then you can check the [Flyover SDK repository](https://github.com/rsksmart/unified-bridges-sdk/tree/main/packages/flyover-sdk).

0 commit comments

Comments
 (0)