Skip to content

Commit

Permalink
Merge branch 'v0.34.x-celestia' into v0.34.x-celestia
Browse files Browse the repository at this point in the history
  • Loading branch information
rootulp authored Sep 24, 2024
2 parents 7d87a82 + 4392e84 commit 3500173
Show file tree
Hide file tree
Showing 80 changed files with 589 additions and 797 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check-generated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
steps:
- uses: actions/setup-go@v4
with:
go-version: "1.22.6"
go-version: "1.23.1"

- uses: actions/checkout@v4
with:
Expand Down
26 changes: 13 additions & 13 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,25 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "1.22.6"
go-version: "1.23.1"
- name: Create a file with all the pkgs
run: go list ./... > pkgs.txt
- name: Split pkgs into 4 files
run: split -d -n l/4 pkgs.txt pkgs.txt.part.
# cache multiple
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: "${{ github.sha }}-00"
path: ./pkgs.txt.part.00
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: "${{ github.sha }}-01"
path: ./pkgs.txt.part.01
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: "${{ github.sha }}-02"
path: ./pkgs.txt.part.02
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: "${{ github.sha }}-03"
path: ./pkgs.txt.part.03
Expand All @@ -48,7 +48,7 @@ jobs:
steps:
- uses: actions/setup-go@v4
with:
go-version: "1.22.6"
go-version: "1.23.1"
- uses: actions/checkout@v3
- uses: technote-space/get-diff-action@v6
with:
Expand All @@ -70,23 +70,23 @@ jobs:
steps:
- uses: actions/setup-go@v4
with:
go-version: "1.22.6"
go-version: "1.23.1"
- uses: actions/checkout@v3
- uses: technote-space/get-diff-action@v6
with:
PATTERNS: |
**/**.go
go.mod
go.sum
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4.1.8
with:
name: "${{ github.sha }}-${{ matrix.part }}"
if: env.GIT_DIFF
- name: test & coverage report creation
run: |
cat pkgs.txt.part.${{ matrix.part }} | xargs go test -mod=readonly -timeout 8m -race -coverprofile=${{ matrix.part }}profile.out -covermode=atomic
if: env.GIT_DIFF
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: "${{ github.sha }}-${{ matrix.part }}-coverage"
path: ./${{ matrix.part }}profile.out
Expand All @@ -102,19 +102,19 @@ jobs:
**/**.go
go.mod
go.sum
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4.1.8
with:
name: "${{ github.sha }}-00-coverage"
if: env.GIT_DIFF
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4.1.8
with:
name: "${{ github.sha }}-01-coverage"
if: env.GIT_DIFF
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4.1.8
with:
name: "${{ github.sha }}-02-coverage"
if: env.GIT_DIFF
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4.1.8
with:
name: "${{ github.sha }}-03-coverage"
if: env.GIT_DIFF
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
steps:
- uses: actions/setup-go@v4
with:
go-version: '1.22.6'
go-version: '1.23.1'

- uses: actions/checkout@v4

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-nightly-34x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
steps:
- uses: actions/setup-go@v4
with:
go-version: '1.22.6'
go-version: '1.23.1'

- uses: actions/checkout@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
steps:
- uses: actions/setup-go@v4
with:
go-version: '1.22.6'
go-version: '1.23.1'
- uses: actions/checkout@v3
- uses: technote-space/get-diff-action@v6
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/fuzz-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
steps:
- uses: actions/setup-go@v4
with:
go-version: '1.22.6'
go-version: '1.23.1'

- uses: actions/checkout@v4

Expand Down Expand Up @@ -45,14 +45,14 @@ jobs:
continue-on-error: true

- name: Archive crashers
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: crashers
path: test/fuzz/**/crashers
retention-days: 1

- name: Archive suppressions
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: suppressions
path: test/fuzz/**/suppressions
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/govulncheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
go-version: "1.22.6"
go-version: "1.23.1"
- uses: actions/checkout@v3
- uses: technote-space/get-diff-action@v6
with:
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,13 @@ jobs:
timeout-minutes: 8
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'

- uses: golangci/golangci-lint-action@v4.0.0
- uses: golangci/golangci-lint-action@v6.1.0
with:
# Required: the version of golangci-lint is required and
# must be specified without patch version: we always use the
# latest patch version.
version: v1.56.2
version: v1.61.0
args: --timeout 10m
github-token: ${{ secrets.github_token }}
2 changes: 1 addition & 1 deletion .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

- uses: actions/setup-go@v4
with:
go-version: '1.22.6'
go-version: '1.23.1'

# Similar check to ./release-version.yml, but enforces this when pushing
# tags. The ./release-version.yml check can be bypassed and is mainly
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

- uses: actions/setup-go@v4
with:
go-version: '1.22.6'
go-version: '1.23.1'

- name: Check version
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

- uses: actions/setup-go@v4
with:
go-version: '1.22.6'
go-version: '1.23.1'

- name: Generate release notes
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
steps:
- uses: actions/setup-go@v4
with:
go-version: "1.22.6"
go-version: "1.23.1"
- uses: actions/checkout@v3
- uses: technote-space/get-diff-action@v6
with:
Expand Down Expand Up @@ -57,7 +57,7 @@ jobs:
steps:
- uses: actions/setup-go@v4
with:
go-version: "1.22.2"
go-version: "1.23.1"
- uses: actions/checkout@v4
- uses: technote-space/get-diff-action@v6
with:
Expand Down Expand Up @@ -89,7 +89,7 @@ jobs:
steps:
- uses: actions/setup-go@v4
with:
go-version: "1.22.2"
go-version: "1.23.1"
- uses: actions/checkout@v4
- uses: technote-space/get-diff-action@v6
with:
Expand Down
2 changes: 1 addition & 1 deletion DOCKER/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Use a build arg to ensure that both stages use the same,
# hopefully current, go version.
ARG GOLANG_BASE_IMAGE=golang:1.22.6-alpine
ARG GOLANG_BASE_IMAGE=golang:1.23.1-alpine

# stage 1 Generate CometBFT Binary
FROM --platform=$BUILDPLATFORM $GOLANG_BASE_IMAGE as builder
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ format:

lint:
@echo "--> Running linter"
@go run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.56.2 run
@go run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.61.0 run
.PHONY: lint

vulncheck:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ This repo intends on preserving the minimal possible diff with [cometbft/cometbf
- **specific to Celestia**: consider if [celestia-app](https://github.com/celestiaorg/celestia-app) is a better target
- **not specific to Celestia**: consider making the contribution upstream in CometBFT

1. [Install Go](https://go.dev/doc/install) 1.22.6+
1. [Install Go](https://go.dev/doc/install) 1.23.1+
2. Fork this repo
3. Clone your fork
4. Find an issue to work on (see [good first issues](https://github.com/celestiaorg/celestia-core/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22))
Expand Down
2 changes: 1 addition & 1 deletion abci/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ To get up and running quickly, see the [getting started guide](../docs/app-dev/g
A detailed description of the ABCI methods and message types is contained in:

- [The main spec](https://github.com/cometbft/cometbft/blob/v0.34.x/spec/abci/README.md)
- [A protobuf file](./types/types.proto)
- [A protobuf file](../proto/abci/types.proto)
- [A Go interface](./types/application.go)

## Protocol Buffers
Expand Down
1 change: 1 addition & 0 deletions abci/client/grpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ func (cli *grpcClient) OnStart() error {

RETRY_LOOP:
for {
//nolint:staticcheck
conn, err := grpc.Dial(cli.addr, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithContextDialer(dialerFunc))
if err != nil {
if cli.mustConnect {
Expand Down
3 changes: 3 additions & 0 deletions abci/example/counter/counter.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ func (app *Application) DeliverTx(req types.RequestDeliverTx) types.ResponseDeli
tx8 := make([]byte, 8)
copy(tx8[len(tx8)-len(req.Tx):], req.Tx)
txValue := binary.BigEndian.Uint64(tx8)
//nolint:gosec
if txValue != uint64(app.txCount) {
return types.ResponseDeliverTx{
Code: code.CodeTypeBadNonce,
Expand All @@ -72,6 +73,7 @@ func (app *Application) CheckTx(req types.RequestCheckTx) types.ResponseCheckTx
tx8 := make([]byte, 8)
copy(tx8[len(tx8)-len(req.Tx):], req.Tx)
txValue := binary.BigEndian.Uint64(tx8)
//nolint:gosec
if txValue < uint64(app.txCount) {
return types.ResponseCheckTx{
Code: code.CodeTypeBadNonce,
Expand All @@ -87,6 +89,7 @@ func (app *Application) Commit() (resp types.ResponseCommit) {
return types.ResponseCommit{}
}
hash := make([]byte, 8)
//nolint:gosec
binary.BigEndian.PutUint64(hash, uint64(app.txCount))
return types.ResponseCommit{Data: hash}
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/cometbft/commands/debug/dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func dumpCmdHandler(_ *cobra.Command, args []string) error {
cfg.EnsureRoot(conf.RootDir)

dumpDebugData(outDir, conf, rpc)

//nolint:gosec
ticker := time.NewTicker(time.Duration(frequency) * time.Second)
for range ticker.C {
dumpDebugData(outDir, conf, rpc)
Expand Down
1 change: 1 addition & 0 deletions cmd/cometbft/commands/debug/io.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,6 @@ func writeStateJSONToFile(state interface{}, dir, filename string) error {
return fmt.Errorf("failed to encode state dump: %w", err)
}

//nolint:gosec
return os.WriteFile(path.Join(dir, filename), stateJSON, os.ModePerm)
}
1 change: 1 addition & 0 deletions cmd/cometbft/commands/debug/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,6 @@ func dumpProfile(dir, addr, profile string, debug int) error {
return fmt.Errorf("failed to read %s profile response body: %w", profile, err)
}

//nolint:gosec
return os.WriteFile(path.Join(dir, fmt.Sprintf("%s.out", profile)), body, os.ModePerm)
}
1 change: 1 addition & 0 deletions cmd/cometbft/commands/reindex_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ func eventReIndex(cmd *cobra.Command, args eventReIndexArgs) error {
for i := range b.Data.Txs {
tr := abcitypes.TxResult{
Height: b.Height,
//nolint:gosec
Index: uint32(i),
Tx: b.Data.Txs[i],
Result: *(r.DeliverTxs[i]),
Expand Down
4 changes: 2 additions & 2 deletions consensus/byzantine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -465,8 +465,8 @@ func TestByzantineConflictingProposalsWithPartition(t *testing.T) {
case <-done:
case <-tick.C:
for i, reactor := range reactors {
t.Logf(fmt.Sprintf("Consensus Reactor %v", i))
t.Logf(fmt.Sprintf("%v", reactor))
t.Logf("Consensus Reactor %v", i)
t.Logf("%v", reactor)
}
t.Fatalf("Timed out waiting for all validators to commit first block")
}
Expand Down
2 changes: 2 additions & 0 deletions consensus/mempool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ func (app *CounterApplication) Info(req abci.RequestInfo) abci.ResponseInfo {

func (app *CounterApplication) DeliverTx(req abci.RequestDeliverTx) abci.ResponseDeliverTx {
txValue := txAsUint64(req.Tx)
//nolint:gosec
if txValue != uint64(app.txCount) {
return abci.ResponseDeliverTx{
Code: code.CodeTypeBadNonce,
Expand Down Expand Up @@ -248,6 +249,7 @@ func (app *CounterApplication) Commit() abci.ResponseCommit {
return abci.ResponseCommit{}
}
hash := make([]byte, 8)
//nolint:gosec
binary.BigEndian.PutUint64(hash, uint64(app.txCount))
return abci.ResponseCommit{Data: hash}
}
Expand Down
2 changes: 2 additions & 0 deletions consensus/reactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,7 @@ func (conR *Reactor) gossipDataForCatchup(logger log.Logger, rs *cstypes.RoundSt
conR.traceClient,
prs.Height,
prs.Round,
//nolint:gosec
uint32(index),
true,
string(peer.ID()),
Expand Down Expand Up @@ -1381,6 +1382,7 @@ func (ps *PeerState) PickVoteToSend(votes types.VoteSetReader) (vote *types.Vote
return nil, false // Not something worth sending
}
if index, ok := votes.BitArray().Sub(psVotes).PickRandom(); ok {
//nolint:gosec
return votes.GetByIndex(int32(index)), true
}
return nil, false
Expand Down
1 change: 1 addition & 0 deletions consensus/wal.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ func (enc *WALEncoder) Encode(v *TimedWALMessage) error {
}

crc := crc32.Checksum(data, crc32c)
//nolint:gosec
length := uint32(len(data))
if length > maxMsgSizeBytes {
return fmt.Errorf("msg is too big: %d bytes, max: %d bytes", length, maxMsgSizeBytes)
Expand Down
1 change: 1 addition & 0 deletions crypto/merkle/tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ func getSplitPoint(length int64) int64 {
}
uLength := uint(length)
bitlen := bits.Len(uLength)
//nolint:gosec
k := int64(1 << uint(bitlen-1))
if k == length {
k >>= 1
Expand Down
Loading

0 comments on commit 3500173

Please sign in to comment.