Skip to content

Commit

Permalink
chore: upgrade go and rust version
Browse files Browse the repository at this point in the history
go 1.18 -> go 1.20
rust 1.67.1 -> 1.72.0
  • Loading branch information
0x5459 committed Sep 4, 2023
1 parent e5e2fdf commit c903637
Show file tree
Hide file tree
Showing 114 changed files with 2,910 additions and 1,069 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ body:
placeholder: |
e.g.
damocles-manager version v0.3.0-rc1-prod-git.f97994a
vc-worker v0.3.0-rc1-git.f97994a
damocles-worker v0.3.0-rc1-git.f97994a
validations:
required: true
- type: textarea
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/damocles-manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: setup go
uses: actions/setup-go@v4
with:
go-version: "1.18"
go-version: "1.20"

- name: cache paths
id: cache-paths
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.manager
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.19.7-buster AS build
FROM golang:1.20.7-buster AS build

RUN apt-get update && apt-get install -y tzdata ca-certificates build-essential clang ocl-icd-opencl-dev ocl-icd-libopencl1 jq libhwloc-dev

Expand Down
3 changes: 0 additions & 3 deletions damocles-manager/.golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ linters:
- gosec
- unconvert
- staticcheck
- varcheck
- structcheck
- deadcode
- exportloopref

# We don't want to skip builtin/
Expand Down
2 changes: 1 addition & 1 deletion damocles-manager/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,4 @@ check-go-mod:
$(GO) mod tidy

dev-env:
$(GO) install -v github.com/golangci/golangci-lint/cmd/golangci-lint@v1.46.1
$(GO) install -v github.com/golangci/golangci-lint/cmd/golangci-lint@v1.54.2
Original file line number Diff line number Diff line change
Expand Up @@ -593,10 +593,10 @@ var utilSealerProvingCheckProvableCmd = &cli.Command{
return fmt.Errorf("failed to load network version: %w", err)
}

for parIdx, par := range partitions {
for parIdx := range partitions {
sectors := make(map[abi.SectorNumber]struct{})

sectorInfos, err := api.Chain.StateMinerSectors(ctx, maddr, &par.LiveSectors, types.EmptyTSK)
sectorInfos, err := api.Chain.StateMinerSectors(ctx, maddr, &partitions[parIdx].LiveSectors, types.EmptyTSK)
if err != nil {
return err
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2450,7 +2450,7 @@ var utilSealerSectorsUnsealCmd = &cli.Command{
}

// get sector id
sectorID := abi.SectorID{}
sectorID := abi.SectorID{} //nolint:all
// todo: rm sectorState when we can get deal by dealID
var sectorState *core.SectorState
if cctx.IsSet("actor") && cctx.IsSet("sector") {
Expand Down
2 changes: 2 additions & 0 deletions damocles-manager/cmd/damocles-manager/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"net"
"net/http"
"time"

"github.com/dtynn/dix"
"github.com/etherlabsio/healthcheck/v2"
Expand Down Expand Up @@ -113,6 +114,7 @@ func serveAPI(ctx context.Context, stopper dix.StopFunc, apiService *APIService,
BaseContext: func(net.Listener) context.Context {
return ctx
},
ReadHeaderTimeout: 10 * time.Second,
}

errCh := make(chan error, 1)
Expand Down
4 changes: 2 additions & 2 deletions damocles-manager/dep/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func Miner() dix.Option {
)
}

func NewGatewayClients(gctx GlobalContext, lc fx.Lifecycle, cfg *modules.SafeConfig) (GatewayClients, error) {
func NewGatewayClients(_ GlobalContext, lc fx.Lifecycle, cfg *modules.SafeConfig) (GatewayClients, error) {
cfg.Lock()
urls, commonToken := cfg.Common.API.Gateway, cfg.Common.API.Token
cfg.Unlock()
Expand Down Expand Up @@ -64,7 +64,7 @@ func NewGatewayClients(gctx GlobalContext, lc fx.Lifecycle, cfg *modules.SafeCon
return ret, nil
}

func NewMarketEventClients(gctx GlobalContext, lc fx.Lifecycle, cfg *modules.SafeConfig, gatewayClients GatewayClients) (MarketEventClients, error) {
func NewMarketEventClients(_ GlobalContext, lc fx.Lifecycle, cfg *modules.SafeConfig, gatewayClients GatewayClients) (MarketEventClients, error) {
cfg.Lock()
var addr, token string
if cfg.Common.API.Market != nil {
Expand Down
2 changes: 1 addition & 1 deletion damocles-manager/dep/sealer_constructor.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ func BuildChainClient(gctx GlobalContext, lc fx.Lifecycle, scfg *modules.Config,
return ccli, nil
}

func BuildMinerAPI(gctx GlobalContext, lc fx.Lifecycle, capi chain.API, scfg *modules.SafeConfig) (core.MinerAPI, error) {
func BuildMinerAPI(_ GlobalContext, lc fx.Lifecycle, capi chain.API, scfg *modules.SafeConfig) (core.MinerAPI, error) {
mapi := chain.NewMinerAPI(capi, scfg)

lc.Append(fx.Hook{
Expand Down
2 changes: 1 addition & 1 deletion damocles-manager/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/ipfs-force-community/damocles/damocles-manager

go 1.18
go 1.20

require (
contrib.go.opencensus.io/exporter/prometheus v0.4.0
Expand Down
2 changes: 1 addition & 1 deletion damocles-manager/modules/config_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func ParseFIL(raw string) (FIL, error) {
return FIL{}, fmt.Errorf("number string length too large: %d", len(s))
}

r, ok := new(mbig.Rat).SetString(s)
r, ok := new(mbig.Rat).SetString(s) //nolint:gosec
if !ok {
return FIL{}, fmt.Errorf("failed to parse %q as a decimal number", raw)
}
Expand Down
6 changes: 1 addition & 5 deletions damocles-manager/modules/impl/commitmgr/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,5 @@ func checkCommit(ctx context.Context, si core.SectorState, proof []byte, tok cor
return &ErrInvalidProof{fmt.Errorf("invalid proof (compute error?)")}
}

if err := checkPieces(ctx, maddr, si, api); err != nil {
return err
}

return nil
return checkPieces(ctx, maddr, si, api)
}
2 changes: 1 addition & 1 deletion damocles-manager/modules/impl/commitmgr/commitmgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ func (c *CommitmentMgrImpl) TerminateState(ctx context.Context, sid abi.SectorID
return sector.TerminateInfo, nil
}

func (c *CommitmentMgrImpl) handleMessage(ctx context.Context, mid abi.ActorID, msg *messager.Message, mlog *logging.ZapLogger) (core.OnChainState, *string) {
func (c *CommitmentMgrImpl) handleMessage(_ context.Context, mid abi.ActorID, msg *messager.Message, mlog *logging.ZapLogger) (core.OnChainState, *string) {
mlog = mlog.With("msg-cid", msg.ID, "msg-state", messager.MessageStateToString(msg.State))
if msg.SignedCid != nil {
mlog = mlog.With("msg-signed-cid", msg.SignedCid.String())
Expand Down
12 changes: 6 additions & 6 deletions damocles-manager/modules/impl/mock/commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type commitMgr struct {
}
}

func (c *commitMgr) SubmitPreCommit(ctx context.Context, sid abi.SectorID, info core.PreCommitInfo, hardReset bool) (core.SubmitPreCommitResp, error) {
func (c *commitMgr) SubmitPreCommit(_ context.Context, sid abi.SectorID, info core.PreCommitInfo, hardReset bool) (core.SubmitPreCommitResp, error) {
c.pres.Lock()
defer c.pres.Unlock()

Expand All @@ -57,7 +57,7 @@ func (c *commitMgr) SubmitPreCommit(ctx context.Context, sid abi.SectorID, info
}, nil
}

func (c *commitMgr) PreCommitState(ctx context.Context, sid abi.SectorID) (core.PollPreCommitStateResp, error) {
func (c *commitMgr) PreCommitState(_ context.Context, sid abi.SectorID) (core.PollPreCommitStateResp, error) {
c.pres.RLock()
defer c.pres.RUnlock()

Expand All @@ -74,7 +74,7 @@ func (c *commitMgr) PreCommitState(ctx context.Context, sid abi.SectorID) (core.
}, nil
}

func (c *commitMgr) SubmitProof(ctx context.Context, sid abi.SectorID, info core.ProofInfo, hardReset bool) (core.SubmitProofResp, error) {
func (c *commitMgr) SubmitProof(_ context.Context, sid abi.SectorID, info core.ProofInfo, hardReset bool) (core.SubmitProofResp, error) {
c.proofs.Lock()
defer c.proofs.Unlock()

Expand All @@ -95,7 +95,7 @@ func (c *commitMgr) SubmitProof(ctx context.Context, sid abi.SectorID, info core
}, nil
}

func (c *commitMgr) ProofState(ctx context.Context, sid abi.SectorID) (core.PollProofStateResp, error) {
func (c *commitMgr) ProofState(_ context.Context, sid abi.SectorID) (core.PollProofStateResp, error) {
c.proofs.RLock()
defer c.proofs.RUnlock()

Expand All @@ -112,7 +112,7 @@ func (c *commitMgr) ProofState(ctx context.Context, sid abi.SectorID) (core.Poll
}, nil
}

func (c *commitMgr) SubmitTerminate(ctx context.Context, sid abi.SectorID) (core.SubmitTerminateResp, error) {
func (c *commitMgr) SubmitTerminate(_ context.Context, sid abi.SectorID) (core.SubmitTerminateResp, error) {
c.terminates.Lock()
defer c.terminates.Unlock()

Expand All @@ -131,6 +131,6 @@ func (c *commitMgr) SubmitTerminate(ctx context.Context, sid abi.SectorID) (core
}, nil
}

func (c *commitMgr) TerminateState(ctx context.Context, sid abi.SectorID) (core.TerminateInfo, error) {
func (c *commitMgr) TerminateState(context.Context, abi.SectorID) (core.TerminateInfo, error) {
return core.TerminateInfo{}, nil
}
2 changes: 1 addition & 1 deletion damocles-manager/modules/impl/mock/deal.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func NewDealManager() core.DealManager {
type nullDeal struct {
}

func (*nullDeal) Acquire(ctx context.Context, sid abi.SectorID, spec core.AcquireDealsSpec, lifetime *core.AcquireDealsLifetime, wjob core.SectorWorkerJob) (core.Deals, error) {
func (*nullDeal) Acquire(_ context.Context, _ abi.SectorID, spec core.AcquireDealsSpec, _ *core.AcquireDealsLifetime, _ core.SectorWorkerJob) (core.Deals, error) {
b, err := json.Marshal(spec)
if err != nil {
return nil, fmt.Errorf("marshal core.AcquireDealsSpec: %w", err)
Expand Down
4 changes: 2 additions & 2 deletions damocles-manager/modules/impl/mock/miner.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type minerAPI struct {
proofType abi.RegisteredSealProof
}

func (m *minerAPI) GetInfo(ctx context.Context, minerID abi.ActorID) (*core.MinerInfo, error) {
func (m *minerAPI) GetInfo(_ context.Context, minerID abi.ActorID) (*core.MinerInfo, error) {
if minerID != m.minerID {
return nil, fmt.Errorf("miner id '%s' not found", minerID)
}
Expand All @@ -41,7 +41,7 @@ func (m *minerAPI) GetInfo(ctx context.Context, minerID abi.ActorID) (*core.Mine
}, nil
}

func (m *minerAPI) GetMinerConfig(ctx context.Context, minerID abi.ActorID) (*modules.MinerConfig, error) {
func (m *minerAPI) GetMinerConfig(_ context.Context, minerID abi.ActorID) (*modules.MinerConfig, error) {
if minerID != m.minerID {
return nil, fmt.Errorf("miner id '%s' not found", minerID)
}
Expand Down
8 changes: 4 additions & 4 deletions damocles-manager/modules/impl/mock/randomness.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,28 @@ type random struct {
wdcommit [32]byte
}

func (r *random) GetTicket(ctx context.Context, tsk types.TipSetKey, epoch abi.ChainEpoch, mid abi.ActorID) (core.Ticket, error) {
func (r *random) GetTicket(_ context.Context, _ types.TipSetKey, epoch abi.ChainEpoch, _ abi.ActorID) (core.Ticket, error) {
return core.Ticket{
Ticket: r.ticket[:],
Epoch: epoch,
}, nil
}

func (r *random) GetSeed(ctx context.Context, tsk types.TipSetKey, epoch abi.ChainEpoch, mid abi.ActorID) (core.Seed, error) {
func (r *random) GetSeed(_ context.Context, _ types.TipSetKey, epoch abi.ChainEpoch, _ abi.ActorID) (core.Seed, error) {
return core.Seed{
Seed: r.seed[:],
Epoch: epoch,
}, nil
}

func (r *random) GetWindowPoStChanlleengeRand(ctx context.Context, tsk types.TipSetKey, epoch abi.ChainEpoch, mid abi.ActorID) (core.WindowPoStRandomness, error) {
func (r *random) GetWindowPoStChanlleengeRand(_ context.Context, _ types.TipSetKey, epoch abi.ChainEpoch, _ abi.ActorID) (core.WindowPoStRandomness, error) {
return core.WindowPoStRandomness{
Rand: r.wdchallenge[:],
Epoch: epoch,
}, nil
}

func (r *random) GetWindowPoStCommitRand(ctx context.Context, tsk types.TipSetKey, epoch abi.ChainEpoch) (core.WindowPoStRandomness, error) {
func (r *random) GetWindowPoStCommitRand(_ context.Context, _ types.TipSetKey, epoch abi.ChainEpoch) (core.WindowPoStRandomness, error) {
return core.WindowPoStRandomness{
Rand: r.wdcommit[:],
Epoch: epoch,
Expand Down
Loading

0 comments on commit c903637

Please sign in to comment.