Skip to content

Commit

Permalink
Update to go 1.24 (#669)
Browse files Browse the repository at this point in the history
* Update to go 1.24

* Fix lint version in CI.

* Fix mockery

* revert solana ci change

* Swap deprecated linter
  • Loading branch information
winder authored Feb 26, 2025
1 parent d3fde0a commit f794997
Show file tree
Hide file tree
Showing 26 changed files with 80 additions and 75 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ccip-ocr3-build-lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
run: make
- name: Install linter
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.62.2
make install-golangcilint
- name: Run linter
run: make lint
- name: Run protobuf linter
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/solana.yml
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ jobs:
git diff --exit-code
- name: Install linter
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.62.2
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.64.5
- name: Run linter
run: make lint-go
- name: Print lint report artifact
Expand Down
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ build: ensure_go_version
generate: ensure_go_version clean-generate proto-generate generate-mocks

generate-mocks: ensure_go_version
go install github.com/vektra/mockery/v2@v2.43.2
go install github.com/vektra/mockery/v2@v2.52.3
mockery

# If you have a different version of protoc installed, you can use the following command to generate the protobuf files
Expand All @@ -47,10 +47,10 @@ test:
go test -race -fullpath -shuffle on -count $(TEST_COUNT) -coverprofile=$(COVERAGE_FILE) \
`go list ./... | grep -Ev 'chainlink-ccip/internal/mocks|chainlink-ccip/mocks|chainlink-ccip/pkg/ocrtypecodec/v1/ocrtypecodecpb'`

lint: ensure_go_version ensure_golangcilint_1_62_2
lint: ensure_go_version ensure_golangcilint
golangci-lint run -c .golangci.yml

lint-fix: ensure_go_version ensure_golangcilint_1_62_2
lint-fix: ensure_go_version ensure_golangcilint
golangci-lint run -c .golangci.yml --fix

checks: test lint
Expand All @@ -67,13 +67,13 @@ install-protoc:
go install google.golang.org/protobuf/cmd/[email protected]

install-golangcilint:
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.62.2
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.64.5

ensure_go_version:
@go version | grep -q 'go1.23' || (echo "Please use go1.23" && exit 1)
@go version | grep -q 'go1.24' || (echo "Please use go1.24" && exit 1)

ensure_golangcilint_1_62_2:
@golangci-lint --version | grep -q '1.62.2' || (echo "Please use golangci-lint 1.62.2" && exit 1)
ensure_golangcilint:
@golangci-lint --version | grep -q '1.64.5' || (echo "Please use golangci-lint 1.64.5, make install-golangcilint" && exit 1)

ensure_protoc_28_0:
@$(PROTOC_BIN) --version | grep -q 'libprotoc 28.0' || (echo "Please use protoc 28.0, (make install-protoc)" && exit 1)
Expand Down
2 changes: 1 addition & 1 deletion chains/solana/.golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ run:
linters:
enable:
- exhaustive
- exportloopref
- copyloopvar
- revive
- goimports
- gosec
Expand Down
2 changes: 1 addition & 1 deletion chains/solana/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/smartcontractkit/chainlink-ccip/chains/solana

go 1.23.3
go 1.24

require (
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
Expand Down
14 changes: 7 additions & 7 deletions commit/plugin_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1019,16 +1019,16 @@ func noReportMerkleOutcome(r rmntypes.RemoteConfig) merkleroot.Outcome {
}
}

func newRandomFees() (types.ChainFeeComponents, ccipocr3.BigInt, ccipocr3.BigInt) {
func newRandomFees() (components types.ChainFeeComponents, nativePrice ccipocr3.BigInt, usdPrices ccipocr3.BigInt) {
execFee := big.NewInt(rand.RandomInt64())
dataAvFee := big.NewInt(rand.RandomInt64())
nativePrice := big.NewInt(rand.RandomInt64())
usdPrices := chainfee.FeeComponentsToPackedFee(chainfee.ComponentsUSDPrices{
ExecutionFeePriceUSD: mathslib.CalculateUsdPerUnitGas(execFee, nativePrice),
DataAvFeePriceUSD: mathslib.CalculateUsdPerUnitGas(dataAvFee, nativePrice),
nativePriceI := big.NewInt(rand.RandomInt64())
usdPricesF := chainfee.FeeComponentsToPackedFee(chainfee.ComponentsUSDPrices{
ExecutionFeePriceUSD: mathslib.CalculateUsdPerUnitGas(execFee, nativePriceI),
DataAvFeePriceUSD: mathslib.CalculateUsdPerUnitGas(dataAvFee, nativePriceI),
})

return types.ChainFeeComponents{ExecutionFee: execFee, DataAvailabilityFee: dataAvFee},
ccipocr3.NewBigInt(nativePrice),
ccipocr3.NewBigInt(usdPrices)
ccipocr3.NewBigInt(nativePriceI),
ccipocr3.NewBigInt(usdPricesF)
}
12 changes: 7 additions & 5 deletions execute/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,17 +165,19 @@ func getPendingExecutedReports(
canExecute CanExecuteHandle,
ts time.Time,
lggr logger.Logger,
) (exectypes.CommitObservations, []exectypes.CommitData, []exectypes.CommitData, error) {
var fullyExecutedFinalized []exectypes.CommitData
var fullyExecutedUnfinalized []exectypes.CommitData

) (
groupedCommits exectypes.CommitObservations,
fullyExecutedFinalized []exectypes.CommitData,
fullyExecutedUnfinalized []exectypes.CommitData,
err error,
) {
commitReports, err := ccipReader.CommitReportsGTETimestamp(ctx, ts, 1000) // todo: configurable limit
if err != nil {
return nil, nil, nil, err
}
lggr.Debugw("commit reports", "commitReports", commitReports, "count", len(commitReports))

groupedCommits := groupByChainSelector(commitReports)
groupedCommits = groupByChainSelector(commitReports)
lggr.Debugw("grouped commits before removing fully executed reports",
"groupedCommits", groupedCommits, "count", len(groupedCommits))

Expand Down
5 changes: 1 addition & 4 deletions execute/plugin_functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,16 +270,13 @@ func groupByChainSelector(
// The provided reports must be sorted by sequence number range starting sequence number.
func combineReportsAndMessages(
reports []exectypes.CommitData, executedMessages []cciptypes.SeqNum,
) ( /* pending */ []exectypes.CommitData /* executed */, []exectypes.CommitData) {
) (pending []exectypes.CommitData, fullyExecuted []exectypes.CommitData) {
if len(executedMessages) == 0 {
return reports, nil
}

// filtered contains the reports with fully executed messages removed
// and the executed messages appended to the report sorted by sequence number.
var pending []exectypes.CommitData
var fullyExecuted []exectypes.CommitData

for i, report := range reports {
reportRange := report.SequenceNumberRange

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/smartcontractkit/chainlink-ccip

go 1.23.3
go 1.24

require (
github.com/deckarep/golang-set/v2 v2.6.0
Expand Down
10 changes: 5 additions & 5 deletions mocks/chainlink_common/contract_writer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions mocks/commit/merkleroot/observer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions mocks/commit/merkleroot/rmn/controller.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions mocks/commit/merkleroot/rmn/stream.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions mocks/internal_/plugincommon/chain_support.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 11 additions & 5 deletions mocks/internal_/plugincommon/plugin_processor.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions mocks/internal_/reader/home_chain.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f794997

Please sign in to comment.