diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 14c2668..6e98b5f 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -7,17 +7,22 @@ updates: open-pull-requests-limit: 10 labels: - T:dependencies + # Group all patch updates into a single PR + groups: + patch-updates: + applies-to: version-updates + update-types: + - "patch" - package-ecosystem: gomod directory: "/" schedule: - interval: weekly - open-pull-requests-limit: 10 - labels: - - T:dependencies - - package-ecosystem: docker - directory: "/docker" - schedule: - interval: weekly + interval: daily open-pull-requests-limit: 10 labels: - T:dependencies + # Group all patch updates into a single PR + groups: + patch-updates: + applies-to: version-updates + update-types: + - "patch" diff --git a/.golangci.yml b/.golangci.yml index 690483b..d85cb58 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -4,7 +4,7 @@ run: linters: enable: - - deadcode + - errorlint - errcheck - gofmt - goimports @@ -15,18 +15,26 @@ linters: - misspell - revive - staticcheck - - structcheck - typecheck + - unconvert - unused - - varcheck issues: exclude-use-default: false + # mempool and indexer code is borrowed from Tendermint + exclude-dirs: + - mempool + - state/indexer + - state/txindex + - third_party include: - - EXC0012 # EXC0012 revive: Annoying issue about not having a comment. - - EXC0014 # EXC0014 revive: Annoying issue about not having a comment. + - EXC0012 # EXC0012 revive: Annoying issue about not having a comment. The rare codebase has such comments + - EXC0014 # EXC0014 revive: Annoying issue about not having a comment. The rare codebase has such comments linters-settings: + gosec: + excludes: + - G115 revive: rules: - name: package-comments diff --git a/.yamllint.yml b/.yamllint.yml new file mode 100644 index 0000000..cd2a9e8 --- /dev/null +++ b/.yamllint.yml @@ -0,0 +1,9 @@ +--- +# Built from docs https://yamllint.readthedocs.io/en/stable/configuration.html +extends: default + +rules: + # 120 chars should be enough, but don't fail if a line is longer + line-length: + max: 120 + level: warning diff --git a/Makefile b/Makefile index 967e1a7..f91e3bb 100644 --- a/Makefile +++ b/Makefile @@ -46,8 +46,6 @@ lint: vet @golangci-lint run @echo "--> Running markdownlint" @markdownlint --config .markdownlint.yaml '**/*.md' - @echo "--> Running hadolint" - @hadolint docker/mockserv.Dockerfile @echo "--> Running yamllint" @yamllint --no-warnings . -c .yamllint.yml @@ -57,6 +55,8 @@ lint: vet fmt: @echo "--> Formatting markdownlint" @markdownlint --config .markdownlint.yaml '**/*.md' -f + @echo "--> Formatting go" + @golangci-lint run --fix .PHONY: fmt ## vet: Run go vet diff --git a/README.md b/README.md index 5ff6a6d..2c10ade 100644 --- a/README.md +++ b/README.md @@ -29,19 +29,22 @@ make build ## Usage -centralized-sequencer exposes a gRPC service that can be used with any gRPC client to -sequence rollup transactions to the celestia network. +centralized-sequencer exposes a gRPC service that can be used with any gRPC +client to sequence rollup transactions to the celestia network. ## Example Run centralized-sequencer by specifying DA network details: + ```sh ./build/centralized-sequencer -da_address -da_auth_token -da_namespace $(openssl rand -hex 10) ``` + ## Flags + | Flag | Usage | Default | | ---------------------------- |-----------------------------------------|-----------------------------| | `batch-time` | time in seconds to wait before generating a new batch | 2 seconds | @@ -51,6 +54,7 @@ Run centralized-sequencer by specifying DA network details: | `host` | centralized sequencer host | localhost | | `port` | centralized sequencer port | 50051 | | `listen-all` |listen on all network interfaces (0.0.0.0) instead of just localhost|disabled| + See `./build/centralized-sequencer --help` for details. @@ -83,8 +87,8 @@ We welcome your contributions! Everyone is welcome to contribute, whether it's in the form of code, documentation, bug reports, feature requests, or anything else. -If you're looking for issues to work on, try looking at the -[good first issue list](https://github.com/rollkit/centralized-sequencer/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22). +If you're looking for issues to work on, try looking at the [good first issue +list](https://github.com/rollkit/centralized-sequencer/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22). Issues with this tag are suitable for a new external contributor and is a great way to find something you can help with! @@ -94,4 +98,4 @@ to ask questions, discuss your ideas, and connect with other contributors. ## Code of Conduct -See our Code of Conduct [here](https://docs.celestia.org/community/coc). \ No newline at end of file +See our Code of Conduct [here](https://docs.celestia.org/community/coc). diff --git a/go.mod b/go.mod index 4741e08..8f61b6d 100644 --- a/go.mod +++ b/go.mod @@ -10,6 +10,7 @@ require ( github.com/rollkit/go-da v0.5.0 github.com/rollkit/go-sequencing v0.0.0-20240906080441-430ed2125493 github.com/rollkit/rollkit v0.13.6 + github.com/stretchr/testify v1.9.0 ) require ( @@ -71,7 +72,6 @@ require ( github.com/prometheus/procfs v0.12.0 // indirect github.com/sasha-s/go-deadlock v0.3.1 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect - github.com/stretchr/testify v1.9.0 // indirect github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect go.etcd.io/bbolt v1.3.7 // indirect go.opencensus.io v0.24.0 // indirect diff --git a/main.go b/main.go index 0b5e34c..fa110a5 100644 --- a/main.go +++ b/main.go @@ -18,7 +18,7 @@ import ( const ( defaultHost = "localhost" defaultPort = "50051" - defaultBatchTime = time.Duration(2 * time.Second) + defaultBatchTime = 2 * time.Second defaultDA = "http://localhost:26658" ) diff --git a/sequencing/sequencer.go b/sequencing/sequencer.go index 8ec7cb3..53c178d 100644 --- a/sequencing/sequencer.go +++ b/sequencing/sequencer.go @@ -132,7 +132,7 @@ func NewSequencer(daAddress, daAuthToken string, daNamespace []byte, batchTime t if err != nil { return nil, fmt.Errorf("error while establishing connection to DA layer: %w", err) } - dalc := da.NewDAClient(dac, -1, 0, goda.Namespace(daNamespace)) + dalc := da.NewDAClient(dac, -1, 0, goda.Namespace(daNamespace)) // nolint:unconvert maxBlobSize, err := dalc.DA.MaxBlobSize(ctx) if err != nil { return nil, err diff --git a/sequencing/sequencer_test.go b/sequencing/sequencer_test.go index 4f115d3..a770e85 100644 --- a/sequencing/sequencer_test.go +++ b/sequencing/sequencer_test.go @@ -7,11 +7,12 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + proxy "github.com/rollkit/go-da/proxy/jsonrpc" goDATest "github.com/rollkit/go-da/test" "github.com/rollkit/go-sequencing" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) const (