Skip to content

Commit

Permalink
escope: relinking
Browse files Browse the repository at this point in the history
  • Loading branch information
supragya committed Apr 20, 2024
1 parent e233544 commit 99d344f
Show file tree
Hide file tree
Showing 61 changed files with 230 additions and 230 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/gotest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:

# -------------- Test utilities
- name: Test util
run: go test -v github.com/Blockpour/Blockpour-Geth-Indexer/util -v -cover -coverpkg=github.com/Blockpour/Blockpour-Geth-Indexer/util -coverprofile=profile.cov
run: go test -v github.com/supragya/EtherScope/util -v -cover -coverpkg=github.com/supragya/EtherScope/util -coverprofile=profile.cov

- name: Coverage report for util
run: go tool cover -func profile.cov
Expand All @@ -37,7 +37,7 @@ jobs:

# -------------- Test masterslave pool
- name: Test mspool
run: go test -v github.com/Blockpour/Blockpour-Geth-Indexer/mspool -v -cover -coverpkg=github.com/Blockpour/Blockpour-Geth-Indexer/mspool -coverprofile=profile.cov
run: go test -v github.com/supragya/EtherScope/mspool -v -cover -coverpkg=github.com/supragya/EtherScope/mspool -coverprofile=profile.cov

- name: Coverage report for mspool
run: go tool cover -func profile.cov
Expand All @@ -46,15 +46,15 @@ jobs:

# -------------- Test gograph
- name: Test indexer
run: go test -v github.com/Blockpour/Blockpour-Geth-Indexer/gograph -v -cover -coverpkg=github.com/Blockpour/Blockpour-Geth-Indexer/gograph -coverprofile=profile.cov
run: go test -v github.com/supragya/EtherScope/gograph -v -cover -coverpkg=github.com/supragya/EtherScope/gograph -coverprofile=profile.cov

- name: Coverage report for gograph
run: go tool cover -func profile.cov


# -------------- Test realtime indexer
- name: Test indexer
run: go test -v github.com/Blockpour/Blockpour-Geth-Indexer/indexer -v -cover -coverpkg=github.com/Blockpour/Blockpour-Geth-Indexer/indexer -coverprofile=profile.cov
run: go test -v github.com/supragya/EtherScope/indexer -v -cover -coverpkg=github.com/supragya/EtherScope/indexer -coverprofile=profile.cov

- name: Coverage report for indexer
run: go tool cover -func profile.cov
Expand All @@ -63,4 +63,4 @@ jobs:
# run: find . -name go.mod -execdir go test ./... -v -cover -coverpkg=./... -coverprofile=profile.cov ./... \;

# - name: Coverage for all modules
# run: find . -name go.mod -execdir go tool cover -func profile.cov \;
# run: find . -name go.mod -execdir go tool cover -func profile.cov \;
16 changes: 8 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@ COPY ./version version
COPY ./algorand algorand

RUN go build -ldflags="\
-X 'github.com/Blockpour/Blockpour-Geth-Indexer/version.buildCommit=$buildCommit' \
-X 'github.com/Blockpour/Blockpour-Geth-Indexer/version.gittag=$gittag' \
-X 'github.com/Blockpour/Blockpour-Geth-Indexer/version.buildTime=$buildtime' \
-X 'github.com/Blockpour/Blockpour-Geth-Indexer/version.builder=$builder' \
-X 'github.com/Blockpour/Blockpour-Geth-Indexer/version.gover=$gover'" \
-o build/bgidx
-X 'github.com/supragya/EtherScope/version.buildCommit=$buildCommit' \
-X 'github.com/supragya/EtherScope/version.gittag=$gittag' \
-X 'github.com/supragya/EtherScope/version.buildTime=$buildtime' \
-X 'github.com/supragya/EtherScope/version.builder=$builder' \
-X 'github.com/supragya/EtherScope/version.gover=$gover'" \
-o build/escope

# App did not start correctly in Alpine, but perhaps a solution for this could be found
FROM golang:1.19.3

WORKDIR /geth-indexer

COPY --from=build /geth-indexer/build/bgidx /geth-indexer/bgidx
COPY --from=build /geth-indexer/build/escope /geth-indexer/escope

RUN "printf \"%s\" \"$CONFIG\" > ./config.yaml"

CMD ["./bgidx", "realtime", "-c", "config.yaml"]
CMD ["./escope", "realtime", "-c", "config.yaml"]
18 changes: 9 additions & 9 deletions Dockerfile.multiarch
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,21 @@ COPY ./version version
COPY ./algorand algorand

RUN env GOOS=$TARGETOS GOARCH=$TARGETARCH go build -ldflags="\
-X 'github.com/Blockpour/Blockpour-Geth-Indexer/version.buildCommit=$buildCommit' \
-X 'github.com/Blockpour/Blockpour-Geth-Indexer/version.gittag=$gittag' \
-X 'github.com/Blockpour/Blockpour-Geth-Indexer/version.buildTime=$buildtime' \
-X 'github.com/Blockpour/Blockpour-Geth-Indexer/version.builder=$builder' \
-X 'github.com/Blockpour/Blockpour-Geth-Indexer/version.gover=$gover'" \
-o build/bgidx
-X 'github.com/supragya/EtherScope/version.buildCommit=$buildCommit' \
-X 'github.com/supragya/EtherScope/version.gittag=$gittag' \
-X 'github.com/supragya/EtherScope/version.buildTime=$buildtime' \
-X 'github.com/supragya/EtherScope/version.builder=$builder' \
-X 'github.com/supragya/EtherScope/version.gover=$gover'" \
-o build/escope

FROM --platform=$TARGETPLATFORM golang:1.19.3

WORKDIR /geth-indexer

COPY --from=build /geth-indexer/build/bgidx /geth-indexer/bgidx
COPY --from=build /geth-indexer/build/escope /geth-indexer/escope
COPY --from=build /geth-indexer/libs libs

ENTRYPOINT \
mkdir -p /.blockpour/bgidx && \
mkdir -p /.supragya/escope && \
printf "%s" "$CONFIG" > ./config.yaml && \
./bgidx realtime -c ./config.yaml
./escope realtime -c ./config.yaml
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ GO=go
GOVER=$(shell go version)
GOBUILD=$(GO) build
BINDIR=build
BINCLI=bgidx
BINCLI=escope
INSTALLLOC=/usr/local/bin/$(BINCLI)
RELEASE=$(shell git describe --tags --abbrev=0)
BUILDCOMMIT=$(shell git rev-parse HEAD | cut -c 1-7)
Expand All @@ -13,11 +13,11 @@ BUILDER=$(shell uname -n)

build:
$(GOBUILD) -ldflags="\
-X 'github.com/Blockpour/Blockpour-Geth-Indexer/version.buildCommit=$(BUILDLINE)@$(BUILDCOMMIT)' \
-X 'github.com/Blockpour/Blockpour-Geth-Indexer/version.gittag=$(CURRENTTAG)' \
-X 'github.com/Blockpour/Blockpour-Geth-Indexer/version.buildTime=$(CURRENTTIME)' \
-X 'github.com/Blockpour/Blockpour-Geth-Indexer/version.builder=$(BUILDER)' \
-X 'github.com/Blockpour/Blockpour-Geth-Indexer/version.gover=$(GOVER)' \
-X 'github.com/supragya/EtherScope/version.buildCommit=$(BUILDLINE)@$(BUILDCOMMIT)' \
-X 'github.com/supragya/EtherScope/version.gittag=$(CURRENTTAG)' \
-X 'github.com/supragya/EtherScope/version.buildTime=$(CURRENTTIME)' \
-X 'github.com/supragya/EtherScope/version.builder=$(BUILDER)' \
-X 'github.com/supragya/EtherScope/version.gover=$(GOVER)' \
-linkmode=external" \
-o $(BINDIR)/$(BINCLI)
clean:
Expand Down Expand Up @@ -48,4 +48,4 @@ dockerbuildx:
--build-arg 'buildTime=$(CURRENTTIME)' \
--build-arg 'builder=$(BUILDER)' \
--build-arg 'gover=$(GOVER)' \
-f ./Dockerfile.multiarch .
-f ./Dockerfile.multiarch .
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
# Blockpour Geth Indexer
`bgidx` program aims to index an EVM like chain using go-ethereum clients via RPCs.
# supragya Geth Indexer
`escope` program aims to index an EVM like chain using go-ethereum clients via RPCs.

![Test run status](https://github.com/Blockpour/Blockpour-Geth-Indexer/actions/workflows/gotest.yaml/badge.svg?branch=feat/v0.3.0)
![Test run status](https://github.com/supragya/EtherScope/actions/workflows/gotest.yaml/badge.svg?branch=feat/v0.3.0)
## Building
Build the application using:
- Setup golang abi modules via abigen using `./scripts/setup_abi.sh`.
- `make build` or `make build -B` (force) to build `build/bgidx`
- `make install` to install the built `bgidx` into `/usr/local/bin/bgidx` bringing it into $PATH.
- `make uninstall` removes `/usr/local/bin/bgidx`
- `make build` or `make build -B` (force) to build `build/escope`
- `make install` to install the built `escope` into `/usr/local/bin/escope` bringing it into $PATH.
- `make uninstall` removes `/usr/local/bin/escope`

## Asserting version of a built artifact
`bgidx` while building is stamped with build information such as git commit, CI process, time of build etc. so as to allow identification while in production.
`escope` while building is stamped with build information such as git commit, CI process, time of build etc. so as to allow identification while in production.
```
$ bgidx --version
bgidx version v0.0.1 build main@5c6c6c5
$ escope --version
escope version v0.0.1 build main@5c6c6c5
compiled at 23-05-2022 04:29:22 by travisci
using go version go1.17.8 linux/amd64
```

## Indexer modes
`bgidx` runs in two different modes:
- **Realtime**: Aims to stay on head of the concerned blockchain and update the backend database in realtime. Can be run using `bgidx realtime -c <config.yaml>`
- **Backfill**: Aims to backfill a range of blocks in the past and update the backend database, rewriting the entries for concerned blocks. Can be run using `bgidx backfill -c <config.yaml>`
`escope` runs in two different modes:
- **Realtime**: Aims to stay on head of the concerned blockchain and update the backend database in realtime. Can be run using `escope realtime -c <config.yaml>`
- **Backfill**: Aims to backfill a range of blocks in the past and update the backend database, rewriting the entries for concerned blocks. Can be run using `escope backfill -c <config.yaml>`

Example config file(s) is available at `test/configs/testcfg.yaml`

Expand Down
10 changes: 5 additions & 5 deletions algorand/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ BUILDER=$(shell uname -n)

build:
$(GOBUILD) -ldflags="\
-X 'github.com/Blockpour/Blockpour-Geth-Indexer/algorand/version.buildCommit=$(BUILDLINE)@$(BUILDCOMMIT)' \
-X 'github.com/Blockpour/Blockpour-Geth-Indexer/algorand/version.buildTime=$(CURRENTTIME)' \
-X 'github.com/Blockpour/Blockpour-Geth-Indexer/algorand/version.builder=$(BUILDER)' \
-X 'github.com/Blockpour/Blockpour-Geth-Indexer/algorand/version.gover=$(GOVER)' \
-X 'github.com/supragya/EtherScope/algorand/version.buildCommit=$(BUILDLINE)@$(BUILDCOMMIT)' \
-X 'github.com/supragya/EtherScope/algorand/version.buildTime=$(CURRENTTIME)' \
-X 'github.com/supragya/EtherScope/algorand/version.builder=$(BUILDER)' \
-X 'github.com/supragya/EtherScope/algorand/version.gover=$(GOVER)' \
-linkmode=external" \
-o $(BINDIR)/$(BINCLI)
clean:
Expand All @@ -25,4 +25,4 @@ install:
cp $(BINDIR)/$(BINCLI) $(INSTALLLOC)

uninstall:
rm $(INSTALLLOC)
rm $(INSTALLLOC)
6 changes: 3 additions & 3 deletions algorand/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ Be sure to restart the node after modifying the configuration.
## Indexer Config

If using self hosted node:
algodUrl: "http://algorand.blockpour.local:8080"
indexerUrl: "http://algorand.blockpour.local:8980"
algodUrl: "http://algorand.supragya.local:8080"
indexerUrl: "http://algorand.supragya.local:8980"

If using the quicknode, the algodUrl and indexerUrl should be in this format (including token and suffix)
algodUrl: "https://<project-moniker>.algorand-mainnet.discover.quiknode.pro/<token>/algod"
Expand All @@ -43,4 +43,4 @@ indexerUrl: "https://<project-moniker>.algorand-mainnet.discover.quiknode.pro/<t

## Troubleshooting

`curl algorand.blockpour.local:8980/health`
`curl algorand.supragya.local:8980/health`
2 changes: 1 addition & 1 deletion algorand/common/common.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package common

import "github.com/Blockpour/Blockpour-Geth-Indexer/algorand/types"
import "github.com/supragya/EtherScope/algorand/types"

const tinymanV1AppId = 552635992
const tinymanV2AppId = 1002541853
Expand Down
2 changes: 1 addition & 1 deletion algorand/config/config.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package config

import (
"github.com/Blockpour/Blockpour-Geth-Indexer/algorand/util"
"github.com/supragya/EtherScope/algorand/util"
"github.com/spf13/viper"
)

Expand Down
2 changes: 1 addition & 1 deletion algorand/node/algofi.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"strconv"
"sync"

types "github.com/Blockpour/Blockpour-Geth-Indexer/algorand/types"
types "github.com/supragya/EtherScope/algorand/types"
)

/*
Expand Down
16 changes: 8 additions & 8 deletions algorand/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import (
"sync"
"time"

"github.com/Blockpour/Blockpour-Geth-Indexer/algorand/common"
"github.com/Blockpour/Blockpour-Geth-Indexer/algorand/logger"
"github.com/Blockpour/Blockpour-Geth-Indexer/algorand/pricing"
"github.com/Blockpour/Blockpour-Geth-Indexer/algorand/rpc"
"github.com/Blockpour/Blockpour-Geth-Indexer/algorand/service"
"github.com/Blockpour/Blockpour-Geth-Indexer/algorand/sink"
types "github.com/Blockpour/Blockpour-Geth-Indexer/algorand/types"
util "github.com/Blockpour/Blockpour-Geth-Indexer/algorand/util"
"github.com/supragya/EtherScope/algorand/common"
"github.com/supragya/EtherScope/algorand/logger"
"github.com/supragya/EtherScope/algorand/pricing"
"github.com/supragya/EtherScope/algorand/rpc"
"github.com/supragya/EtherScope/algorand/service"
"github.com/supragya/EtherScope/algorand/sink"
types "github.com/supragya/EtherScope/algorand/types"
util "github.com/supragya/EtherScope/algorand/util"
"github.com/google/uuid"
)

Expand Down
8 changes: 4 additions & 4 deletions algorand/node/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"fmt"
"testing"

"github.com/Blockpour/Blockpour-Geth-Indexer/algorand/common"
"github.com/Blockpour/Blockpour-Geth-Indexer/algorand/logger"
types "github.com/Blockpour/Blockpour-Geth-Indexer/algorand/types"
util "github.com/Blockpour/Blockpour-Geth-Indexer/algorand/util"
"github.com/supragya/EtherScope/algorand/common"
"github.com/supragya/EtherScope/algorand/logger"
types "github.com/supragya/EtherScope/algorand/types"
util "github.com/supragya/EtherScope/algorand/util"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion algorand/node/tinymanv1.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"strconv"
"sync"

types "github.com/Blockpour/Blockpour-Geth-Indexer/algorand/types"
types "github.com/supragya/EtherScope/algorand/types"
)

func (n *Node) processTinymanV1Swap(g types.TxGroup, index int, results map[int][]types.Swap, wg *sync.WaitGroup, mt *sync.Mutex) error {
Expand Down
2 changes: 1 addition & 1 deletion algorand/node/tinymanv2.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"strconv"
"sync"

types "github.com/Blockpour/Blockpour-Geth-Indexer/algorand/types"
types "github.com/supragya/EtherScope/algorand/types"
)

func (n *Node) processTinymanV2Swap(g types.TxGroup, index int, results map[int][]types.Swap, wg *sync.WaitGroup, mt *sync.Mutex) error {
Expand Down
6 changes: 3 additions & 3 deletions algorand/pricing/pricing.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"errors"
"math"

"github.com/Blockpour/Blockpour-Geth-Indexer/algorand/common"
"github.com/Blockpour/Blockpour-Geth-Indexer/algorand/rpc"
"github.com/Blockpour/Blockpour-Geth-Indexer/algorand/types"
"github.com/supragya/EtherScope/algorand/common"
"github.com/supragya/EtherScope/algorand/rpc"
"github.com/supragya/EtherScope/algorand/types"
)

type PricingEngine struct {
Expand Down
4 changes: 2 additions & 2 deletions algorand/pricing/pricing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"testing"

"github.com/Blockpour/Blockpour-Geth-Indexer/algorand/common"
"github.com/Blockpour/Blockpour-Geth-Indexer/algorand/rpc"
"github.com/supragya/EtherScope/algorand/common"
"github.com/supragya/EtherScope/algorand/rpc"
"github.com/stretchr/testify/assert"
)

Expand Down
6 changes: 3 additions & 3 deletions algorand/rpc/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"math"
"time"

"github.com/Blockpour/Blockpour-Geth-Indexer/algorand/common"
"github.com/Blockpour/Blockpour-Geth-Indexer/algorand/types"
"github.com/Blockpour/Blockpour-Geth-Indexer/algorand/util"
"github.com/supragya/EtherScope/algorand/common"
"github.com/supragya/EtherScope/algorand/types"
"github.com/supragya/EtherScope/algorand/util"
"github.com/algorand/go-algorand-sdk/client/v2/algod"
"github.com/algorand/go-algorand-sdk/client/v2/common/models"
"github.com/algorand/go-algorand-sdk/client/v2/indexer"
Expand Down
4 changes: 2 additions & 2 deletions algorand/rpc/rpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"testing"

"github.com/Blockpour/Blockpour-Geth-Indexer/algorand/common"
"github.com/Blockpour/Blockpour-Geth-Indexer/algorand/types"
"github.com/supragya/EtherScope/algorand/common"
"github.com/supragya/EtherScope/algorand/types"
"github.com/algorand/go-algorand-sdk/client/v2/common/models"
"github.com/stretchr/testify/assert"
)
Expand Down
6 changes: 3 additions & 3 deletions algorand/rpc/transfer.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"fmt"
"math"

"github.com/Blockpour/Blockpour-Geth-Indexer/algorand/common"
"github.com/Blockpour/Blockpour-Geth-Indexer/algorand/types"
"github.com/Blockpour/Blockpour-Geth-Indexer/algorand/util"
"github.com/supragya/EtherScope/algorand/common"
"github.com/supragya/EtherScope/algorand/types"
"github.com/supragya/EtherScope/algorand/util"
"github.com/algorand/go-algorand-sdk/client/v2/common/models"
)

Expand Down
2 changes: 1 addition & 1 deletion algorand/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"errors"
"sync"

"github.com/Blockpour/Blockpour-Geth-Indexer/algorand/logger"
"github.com/supragya/EtherScope/algorand/logger"
)

var (
Expand Down
10 changes: 5 additions & 5 deletions algorand/sink/rabbitmq.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"fmt"
"time"

"github.com/Blockpour/Blockpour-Geth-Indexer/algorand/config"
"github.com/Blockpour/Blockpour-Geth-Indexer/algorand/logger"
"github.com/Blockpour/Blockpour-Geth-Indexer/algorand/service"
"github.com/Blockpour/Blockpour-Geth-Indexer/algorand/version"
"github.com/supragya/EtherScope/algorand/config"
"github.com/supragya/EtherScope/algorand/logger"
"github.com/supragya/EtherScope/algorand/service"
"github.com/supragya/EtherScope/algorand/version"
"github.com/spf13/viper"
"github.com/streadway/amqp"
)
Expand All @@ -23,7 +23,7 @@ var (
Name: "queue",
Type: "string",
Necessity: "always needed",
Default: "bgidx_processed",
Default: "escope_processed",
},
{
Name: "secureConnection",
Expand Down
2 changes: 1 addition & 1 deletion algorand/sink/sink.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package sink

import "github.com/Blockpour/Blockpour-Geth-Indexer/algorand/service"
import "github.com/supragya/EtherScope/algorand/service"

type OutputSink interface {
service.Service
Expand Down
Loading

0 comments on commit 99d344f

Please sign in to comment.