Skip to content

Commit

Permalink
Dusk-8
Browse files Browse the repository at this point in the history
  • Loading branch information
aopoltorzhicky committed Jul 3, 2024
1 parent 5cadac5 commit e9af641
Show file tree
Hide file tree
Showing 49 changed files with 1,147 additions and 508 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.22.1'
go-version: '1.22.4'
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
Expand Down
2 changes: 1 addition & 1 deletion build/api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# ---------------------------------------------------------------------
# The first stage container, for building the application
# ---------------------------------------------------------------------
FROM golang:1.22.1-alpine as builder
FROM golang:1.22.4-alpine as builder

ENV CGO_ENABLED=0
ENV GO111MODULE=on
Expand Down
2 changes: 1 addition & 1 deletion build/indexer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# ---------------------------------------------------------------------
# The first stage container, for building the application
# ---------------------------------------------------------------------
FROM golang:1.22.1-alpine as builder
FROM golang:1.22.4-alpine as builder

ENV CGO_ENABLED=0
ENV GO111MODULE=on
Expand Down
29 changes: 4 additions & 25 deletions cmd/api/handler/address.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
package handler

import (
"encoding/hex"
"net/http"
"time"

Expand Down Expand Up @@ -64,12 +63,7 @@ func (handler *AddressHandler) Get(c echo.Context) error {
return badRequestError(c, err)
}

hash, err := hex.DecodeString(req.Hash)
if err != nil {
return badRequestError(c, err)
}

address, err := handler.address.ByHash(c.Request().Context(), hash)
address, err := handler.address.ByHash(c.Request().Context(), req.Hash)
if err != nil {
return handleError(c, err, handler.address)
}
Expand Down Expand Up @@ -171,12 +165,7 @@ func (handler *AddressHandler) Transactions(c echo.Context) error {
}
req.SetDefault()

hash, err := hex.DecodeString(req.Hash)
if err != nil {
return badRequestError(c, err)
}

address, err := handler.address.ByHash(c.Request().Context(), hash)
address, err := handler.address.ByHash(c.Request().Context(), req.Hash)
if err != nil {
return handleError(c, err, handler.address)
}
Expand Down Expand Up @@ -269,12 +258,7 @@ func (handler *AddressHandler) Actions(c echo.Context) error {

req.SetDefault()

hash, err := hex.DecodeString(req.Hash)
if err != nil {
return badRequestError(c, err)
}

address, err := handler.address.ByHash(c.Request().Context(), hash)
address, err := handler.address.ByHash(c.Request().Context(), req.Hash)
if err != nil {
return handleError(c, err, handler.address)
}
Expand Down Expand Up @@ -350,12 +334,7 @@ func (handler *AddressHandler) Rollups(c echo.Context) error {

req.SetDefault()

hash, err := hex.DecodeString(req.Hash)
if err != nil {
return badRequestError(c, err)
}

address, err := handler.address.ByHash(c.Request().Context(), hash)
address, err := handler.address.ByHash(c.Request().Context(), req.Hash)
if err != nil {
return handleError(c, err, handler.address)
}
Expand Down
6 changes: 3 additions & 3 deletions cmd/api/handler/block_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (

var (
testAddress = storage.Address{
Hash: testsuite.RandomHash(20),
Hash: testsuite.RandomAddress(),
Id: 1,
Nonce: 10,
ActionsCount: 1,
Expand All @@ -41,7 +41,7 @@ var (
Id: 1,
},
}
testAddressHash = hex.EncodeToString(testAddress.Hash)
testAddressHash = testAddress.Hash
testBlock = storage.Block{
Id: 1,
Hash: []byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31},
Expand Down Expand Up @@ -519,7 +519,7 @@ func (s *BlockTestSuite) TestGetTransactions() {
s.Require().EqualValues(8, tx.GasUsed)
s.Require().EqualValues(1, tx.ActionsCount)
s.Require().EqualValues(10, tx.Nonce)
s.Require().EqualValues(hex.EncodeToString(testAddress.Hash), tx.Signer)
s.Require().EqualValues(testAddress.Hash, tx.Signer)
s.Require().Equal("codespace", tx.Codespace)
s.Require().Equal(types.StatusSuccess, tx.Status)
}
9 changes: 4 additions & 5 deletions cmd/api/handler/tx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package handler

import (
"context"
"encoding/hex"
"encoding/json"
"net/http"
"net/http/httptest"
Expand Down Expand Up @@ -83,7 +82,7 @@ func (s *TxTestSuite) TestGet() {
s.Require().EqualValues(8, tx.GasUsed)
s.Require().EqualValues(1, tx.ActionsCount)
s.Require().EqualValues(10, tx.Nonce)
s.Require().EqualValues(hex.EncodeToString(testAddress.Hash), tx.Signer)
s.Require().EqualValues(testAddress.Hash, tx.Signer)
s.Require().Equal("codespace", tx.Codespace)
s.Require().Equal(types.StatusSuccess, tx.Status)
}
Expand Down Expand Up @@ -149,7 +148,7 @@ func (s *TxTestSuite) TestList() {
s.Require().EqualValues(8, tx.GasUsed)
s.Require().EqualValues(1, tx.ActionsCount)
s.Require().EqualValues(10, tx.Nonce)
s.Require().EqualValues(hex.EncodeToString(testAddress.Hash), tx.Signer)
s.Require().EqualValues(testAddress.Hash, tx.Signer)
s.Require().Equal("codespace", tx.Codespace)
s.Require().Equal(types.StatusSuccess, tx.Status)
}
Expand Down Expand Up @@ -246,7 +245,7 @@ func (s *TxTestSuite) TestListTime() {
s.Require().EqualValues(8, tx.GasUsed)
s.Require().EqualValues(1, tx.ActionsCount)
s.Require().EqualValues(10, tx.Nonce)
s.Require().EqualValues(hex.EncodeToString(testAddress.Hash), tx.Signer)
s.Require().EqualValues(testAddress.Hash, tx.Signer)
s.Require().Equal("codespace", tx.Codespace)
s.Require().Equal(types.StatusSuccess, tx.Status)
}
Expand Down Expand Up @@ -299,7 +298,7 @@ func (s *TxTestSuite) TestListWithActions() {
s.Require().EqualValues(8, tx.GasUsed)
s.Require().EqualValues(1, tx.ActionsCount)
s.Require().EqualValues(10, tx.Nonce)
s.Require().EqualValues(hex.EncodeToString(testAddress.Hash), tx.Signer)
s.Require().EqualValues(testAddress.Hash, tx.Signer)
s.Require().Equal("codespace", tx.Codespace)
s.Require().Equal(types.StatusSuccess, tx.Status)
}
Expand Down
73 changes: 36 additions & 37 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
module github.com/celenium-io/astria-indexer

go 1.22.1
go 1.22.4

require (
buf.build/gen/go/astria/primitives/protocolbuffers/go v1.34.1-20240522191247-b00a6d16e1dc.1
buf.build/gen/go/astria/protocol-apis/protocolbuffers/go v1.34.1-20240522191249-03d524dae8d2.1
github.com/cometbft/cometbft v0.38.6
buf.build/gen/go/astria/primitives/protocolbuffers/go v1.34.2-20240626163506-691883836b9e.2
buf.build/gen/go/astria/protocol-apis/protocolbuffers/go v1.34.2-20240627184145-2eaea785eb7d.2
github.com/cometbft/cometbft v0.38.7
github.com/dipdup-io/workerpool v0.0.4
github.com/dipdup-net/go-lib v0.3.6
github.com/dipdup-net/indexer-sdk v0.0.5
Expand All @@ -14,26 +14,27 @@ require (
github.com/go-playground/validator/v10 v10.15.0
github.com/go-testfixtures/testfixtures/v3 v3.9.0
github.com/goccy/go-json v0.10.2
github.com/gorilla/websocket v1.5.0
github.com/gorilla/websocket v1.5.1
github.com/grafana/pyroscope-go v1.1.1
github.com/json-iterator/go v1.1.12
github.com/labstack/echo-contrib v0.15.0
github.com/labstack/echo/v4 v4.11.4
github.com/lib/pq v1.10.9
github.com/pactus-project/pactus v1.3.0
github.com/pkg/errors v0.9.1
github.com/rs/zerolog v1.31.0
github.com/rs/zerolog v1.33.0
github.com/shopspring/decimal v1.3.1
github.com/spf13/cobra v1.8.0
github.com/stretchr/testify v1.8.4
github.com/stretchr/testify v1.9.0
github.com/swaggo/echo-swagger v1.4.1
github.com/swaggo/swag v1.16.1
github.com/uptrace/bun v1.1.14
go.opentelemetry.io/otel v1.19.0
go.opentelemetry.io/otel/sdk v1.19.0
go.opentelemetry.io/otel/trace v1.19.0
go.opentelemetry.io/otel v1.27.0
go.opentelemetry.io/otel/sdk v1.27.0
go.opentelemetry.io/otel/trace v1.27.0
go.uber.org/mock v0.4.0
golang.org/x/time v0.5.0
google.golang.org/protobuf v1.34.1
google.golang.org/protobuf v1.34.2
)

require (
Expand All @@ -42,21 +43,21 @@ require (
github.com/ClickHouse/ch-go v0.58.0 // indirect
github.com/ClickHouse/clickhouse-go/v2 v2.13.0 // indirect
github.com/KyleBanks/depth v1.2.1 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/Microsoft/hcsshim v0.11.4 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/andybalholm/brotli v1.0.5 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/containerd/containerd v1.7.11 // indirect
github.com/containerd/log v0.1.0 // indirect
github.com/cosmos/gogoproto v1.4.11 // indirect
github.com/cosmos/gogoproto v1.4.12 // indirect
github.com/cpuguy83/dockercfg v0.3.1 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect
github.com/docker/distribution v2.8.2+incompatible // indirect
github.com/docker/docker v24.0.9+incompatible // indirect
github.com/docker/go-connections v0.4.0 // indirect
Expand All @@ -67,7 +68,7 @@ require (
github.com/go-faster/errors v0.6.1 // indirect
github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.6.0 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.6 // indirect
Expand All @@ -80,9 +81,9 @@ require (
github.com/go-sql-driver/mysql v1.7.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/uuid v1.4.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/grafana/pyroscope-go/godeltaprof v0.1.6 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
Expand All @@ -92,15 +93,14 @@ require (
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/klauspost/compress v1.17.4 // indirect
github.com/klauspost/compress v1.17.8 // indirect
github.com/labstack/gommon v0.4.2 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-sqlite3 v1.14.17 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/moby/patternmatcher v0.5.0 // indirect
github.com/moby/sys/sequential v0.5.0 // indirect
github.com/moby/sys/user v0.1.0 // indirect
Expand All @@ -115,14 +115,14 @@ require (
github.com/opencontainers/image-spec v1.1.0-rc4 // indirect
github.com/opencontainers/runc v1.2.0-rc.1 // indirect
github.com/paulmach/orb v0.10.0 // indirect
github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc // indirect
github.com/petermattis/goid v0.0.0-20231207134359-e60b3f734c67 // indirect
github.com/pierrec/lz4/v4 v4.1.18 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_golang v1.16.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.42.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/rogpeppe/go-internal v1.11.0 // indirect
github.com/prometheus/client_golang v1.19.1 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.53.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
github.com/sasha-s/go-deadlock v0.3.1 // indirect
github.com/segmentio/asm v1.2.0 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
Expand All @@ -138,17 +138,16 @@ require (
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
github.com/vmihailenco/tagparser v0.1.2 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
go.opentelemetry.io/otel/metric v1.19.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/sync v0.5.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/tools v0.15.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f // indirect
google.golang.org/grpc v1.60.0 // indirect
go.opentelemetry.io/otel/metric v1.27.0 // indirect
golang.org/x/crypto v0.24.0 // indirect
golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 // indirect
google.golang.org/grpc v1.64.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
gorm.io/driver/mysql v1.5.1 // indirect
Expand Down
Loading

0 comments on commit e9af641

Please sign in to comment.