Skip to content

Commit

Permalink
Merge pull request #296 from covalenthq/develop
Browse files Browse the repository at this point in the history
Use `go.work` to specify go module updates
  • Loading branch information
noslav authored Jan 17, 2025
2 parents 2c01ac7 + d99020e commit 8aeb554
Showing 18 changed files with 237 additions and 277 deletions.
18 changes: 0 additions & 18 deletions .github/workflows/elrond-build-skip.yml

This file was deleted.

58 changes: 0 additions & 58 deletions .github/workflows/elrond-build.yml

This file was deleted.

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -95,4 +95,5 @@ artifacts

ganache_data
temp
out
out
.editorconfig
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@ run:
modules-download-mode: readonly
skip-files:
- "internal/config/utils_test.go"
- "internal/config/env_config_test.go"
skip-dirs:
- internal/metrics
- bin/
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -9,11 +9,11 @@ RUN CGO_ENABLED=0 GOOS=linux go build -a -ldflags="-s -w" -o bsp-agent ./cmd/bsp
RUN CGO_ENABLED=0 GOOS=linux go build -a -ldflags="-s -w" -o bsp-extractor ./scripts/extractor.go
RUN CGO_ENABLED=0 GOOS=linux go build -a -ldflags="-s -w" -o bsp-extractor-2 ./scripts/replica/extractor2.go
# Runtime/test - second phase.
FROM alpine:3.20
FROM alpine:3.21
RUN mkdir /app
WORKDIR /app
RUN apk update && apk add --no-cache bash
RUN mkdir -p bin/block-ethereum bin/block-elrond
RUN mkdir -p bin/block-ethereum
COPY --from=builder /build/bsp-agent /app
COPY --from=builder /build/entry.sh /app
COPY --from=builder /build/data /app/data
11 changes: 0 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -25,17 +25,6 @@ run-agent-eth:
--log-folder ./logs/ \
--ipfs-pinner-server="http://127.0.0.1:3000/"

run-agent-elrond:
@echo "---- Running Agent from cmd/bspagent ----"
@go run ./cmd/bspagent/*.go \
--redis-url="redis://username:@localhost:6379/0?topic=replication#replicate" \
--avro-codec-path="./codec/block-elrond.avsc" \
--binary-file-path="./bin/block-elrond/" \
--proof-chain-address=0xbFCa723A2661350f86f397CEdF807D6e596d7874 \
--websocket-urls="34.69.250.147:20000 34.69.250.147:20001 34.69.250.147:20002 34.69.250.147:20003" \
--consumer-timeout=8000 \
--ipfs-pinner-server="http://127.0.0.1:3000/"

test:
@echo "---- Testing Agent from cmd/bspagent ----"
@go test ./... -coverprofile=coverage.out
9 changes: 2 additions & 7 deletions cmd/bspagent/main.go
Original file line number Diff line number Diff line change
@@ -65,7 +65,7 @@ func init() {

func main() {
log.Info("bsp-agent command line config: ", utils.GetConfig(flag.CommandLine))
chainType := getChainFromConfig(agconfig)
chainType := getChainFromConfig()
agentNode = node.NewAgentNode(chainType, agconfig)

setupMetrics()
@@ -96,11 +96,6 @@ func setupMetrics() {
}
}

func getChainFromConfig(agconfig *config.AgentConfig) node.ChainType {
webSockUrls := agconfig.ChainConfig.WebsocketURLs
if webSockUrls != "" {
return node.Elrond
}

func getChainFromConfig() node.ChainType {
return node.Ethereum
}
Binary file modified data/redis/dump.rdb
Binary file not shown.
28 changes: 9 additions & 19 deletions entry.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
#!/bin/bash
if [ "$BLOCKCHAIN" == "elrond" ]
then
timeout 120s ./bsp-agent --redis-url=redis://username:@redis:6379/0?topic=replication-2#replicate \
--avro-codec-path=./codec/block-elrond.avsc \
--binary-file-path=./bin/block-elrond/ \
--proof-chain-address=0xEa2ff902dbeEECcc828757B881b343F9316752e5\
--consumer-timeout=15 \
--websocket-urls="34.69.250.147:20000 34.69.250.147:20001 34.69.250.147:20002 34.69.250.147:20003"

else
./bsp-agent --redis-url=redis://username:@redis:6379/0?topic=replication#replicate \
--avro-codec-path=./codec/block-ethereum.avsc \
--binary-file-path=./bin/block-ethereum/ \
--block-divisor=3 \
--log-folder ./logs/ \
--proof-chain-address=0xEa2ff902dbeEECcc828757B881b343F9316752e5 \
--metrics --metrics.port 6063 --metrics.addr 0.0.0.0 \
--consumer-timeout=15 \
--ipfs-pinner-server="http://ipfs-pinner:3001/"
fi
./bsp-agent --redis-url=redis://username:@redis:6379/0?topic=replication#replicate \
--avro-codec-path=./codec/block-ethereum.avsc \
--binary-file-path=./bin/block-ethereum/ \
--block-divisor=3 \
--log-folder ./logs/ \
--proof-chain-address=0xEa2ff902dbeEECcc828757B881b343F9316752e5 \
--metrics --metrics.port 6063 --metrics.addr 0.0.0.0 \
--consumer-timeout=15 \
--ipfs-pinner-server="http://ipfs-pinner:3001/"
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -11,14 +11,14 @@ require (
github.com/ethereum/go-ethereum v1.14.12
github.com/go-redis/redis/v7 v7.4.1
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb
github.com/gorilla/websocket v1.5.3
github.com/gorilla/websocket v1.5.3 // indirect
github.com/ipfs/go-cid v0.1.0
github.com/kelseyhightower/envconfig v1.4.0
github.com/linkedin/goavro/v2 v2.13.0
github.com/linkedin/goavro/v2 v2.13.1
github.com/satori/go.uuid v1.2.0
github.com/sirupsen/logrus v1.9.3
github.com/ubiq/go-ubiq v3.0.1+incompatible
golang.org/x/sys v0.28.0
golang.org/x/sys v0.29.0
google.golang.org/api v0.122.0 // indirect
gopkg.in/avro.v0 v0.0.0-20171217001914-a730b5802183
)
14 changes: 6 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
@@ -463,8 +463,8 @@ github.com/lib/pq v1.0.0 h1:X5PMW56eZitiTeO7tKzZxFCSpbFZJtkMMooicw2us9A=
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM=
github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4=
github.com/linkedin/goavro/v2 v2.13.0 h1:L8eI8GcuciwUkt41Ej62joSZS4kKaYIUdze+6for9NU=
github.com/linkedin/goavro/v2 v2.13.0/go.mod h1:KXx+erlq+RPlGSPmLF7xGo6SAbh8sCQ53x064+ioxhk=
github.com/linkedin/goavro/v2 v2.13.1 h1:4qZ5M0QzQFDRqccsroJlgOJznqAS/TpdvXg55h429+I=
github.com/linkedin/goavro/v2 v2.13.1/go.mod h1:KXx+erlq+RPlGSPmLF7xGo6SAbh8sCQ53x064+ioxhk=
github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
@@ -762,8 +762,6 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.0.0-20210506145944-38f3c27a63bf/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8=
golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30=
golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M=
golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U=
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
@@ -889,17 +887,17 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU=
golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=
3 changes: 3 additions & 0 deletions go.work
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
go 1.22.5

use .
Loading
Oops, something went wrong.

0 comments on commit 8aeb554

Please sign in to comment.