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 51386fe..b624ad1 100644 --- a/Makefile +++ b/Makefile @@ -40,8 +40,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 @@ -51,6 +49,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 2d1f552..a254953 100644 --- a/README.md +++ b/README.md @@ -12,11 +12,13 @@ go-sequencing defines a generic sequencing interface for modular blockchains ## Sequencing Interface + | Method | Params | Return | | ------------- | -------------------------------------------------------- | --------------- | | `SubmitRollupTransaction` | `context.Context`, `rollupId RollupId`, `tx Tx` | `error` | | `GetNextBatch` | `context.Context`, `lastBatchHash Hash` | `batch Batch`, `timestamp Time` `error` | | `VerifyBatch` | `context.Context`, `batchHash Hash` | `success bool`, `error` | + Note: `Batch` is []`Tx` and `Tx` is `[]byte`. Also `Hash` and `RollupId` are `[]byte`. @@ -24,16 +26,17 @@ Note: `Batch` is []`Tx` and `Tx` is `[]byte`. Also `Hash` and `RollupId` are `[] The following implementations are available: -* [centralized-sequencer](https://github.com/rollkit/centralized-sequencer) implements a centralized sequencer that posts rollup transactions to Celestia DA. -* [astria-sequencer](https://github.com/rollkit/astria-sequencer) implements a Astria sequencer middleware that connects to Astria shared sequencer. +* [centralized-sequencer][centralized] implements a centralized sequencer that + posts rollup transactions to Celestia DA. +* [astria-sequencer][astria] implements a Astria sequencer middleware that + connects to Astria shared sequencer. In addition the following helper implementations are available: -* [DummySequencer](https://github.com/rollkit/go-sequencing/blob/main/test/dummy.go) implements -a Mock sequencer useful for testing. -* [Proxy](https://github.com/rollkit/go-sequencing/tree/main/proxy) implements a proxy -server that forwards requests to a gRPC server. The proxy client -can be used directly to interact with the sequencer service. +* [DummySequencer][dummy] implements a Mock sequencer useful for testing. +* [Proxy][proxy] implements a proxy server that forwards requests to a gRPC + server. The proxy client can be used directly to interact with the sequencer + service. ## Helpful commands @@ -57,10 +60,9 @@ 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/go-da/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! +If you're looking for issues to work on, try looking at the [good first issue +list][gfi]. Issues with this tag are suitable for a new external contributor +and is a great way to find something you can help with! Please join our [Community Discord](https://discord.com/invite/YsnTPcSfWQ) @@ -68,4 +70,10 @@ 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). + +[centralized]: +[astria]: +[dummy]: https://github.com/rollkit/go-sequencing/blob/main/test/dummy.go +[proxy]: https://github.com/rollkit/go-sequencing/tree/main/proxy +[gfi]: https://github.com/rollkit/go-da/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22 diff --git a/buf.gen.yaml b/buf.gen.yaml index 9fc7a0d..6e1acd3 100644 --- a/buf.gen.yaml +++ b/buf.gen.yaml @@ -3,8 +3,9 @@ version: v1beta1 # The plugins to run. plugins: # The name of the plugin. - - name: gocosmos - # The the relative output directory. + - name: + gocosmos + # The the relative output directory. out: types/pb # Any options to provide to the plugin. opt: @@ -12,4 +13,4 @@ plugins: - Mgoogle/protobuf/duration.proto=github.com/golang/protobuf/ptypes/duration - Mgoogle/protobuf/wrappers.proto=github.com/cosmos/gogoproto/types - plugins=grpc - - paths=source_relative \ No newline at end of file + - paths=source_relative diff --git a/buf.yaml b/buf.yaml index 5bfe5e3..420c902 100644 --- a/buf.yaml +++ b/buf.yaml @@ -25,4 +25,4 @@ lint: - tendermint breaking: use: - - FILE \ No newline at end of file + - FILE diff --git a/go.mod b/go.mod index d9ba403..aaa9a34 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21.0 require ( github.com/cosmos/gogoproto v1.7.0 - google.golang.org/grpc v1.66.0 + google.golang.org/grpc v1.67.0 ) require ( diff --git a/go.sum b/go.sum index 3b5acdd..3c7c2b1 100644 --- a/go.sum +++ b/go.sum @@ -12,7 +12,7 @@ golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed h1:J6izYgfBXAI3xTKLgxzTmUltdYaLsuBxFCgDHWJ/eXg= google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= -google.golang.org/grpc v1.66.0 h1:DibZuoBznOxbDQxRINckZcUvnCEvrW9pcWIE2yF9r1c= -google.golang.org/grpc v1.66.0/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= diff --git a/proxy/grpc/client.go b/proxy/grpc/client.go index fd93e21..1a15626 100644 --- a/proxy/grpc/client.go +++ b/proxy/grpc/client.go @@ -7,6 +7,7 @@ import ( "google.golang.org/grpc" types "github.com/cosmos/gogoproto/types" + "github.com/rollkit/go-sequencing" pbseq "github.com/rollkit/go-sequencing/types/pb/sequencing" ) diff --git a/proxy/grpc/server.go b/proxy/grpc/server.go index 558b577..307bcff 100644 --- a/proxy/grpc/server.go +++ b/proxy/grpc/server.go @@ -8,6 +8,7 @@ import ( "github.com/rollkit/go-sequencing" types "github.com/cosmos/gogoproto/types" + pbseq "github.com/rollkit/go-sequencing/types/pb/sequencing" )