Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b5d65fdfd0 | ||
|
|
f43be205b7 | ||
|
|
19a794e930 |
+4
-20
@@ -1,6 +1,6 @@
|
||||
# Lotus changelog
|
||||
|
||||
# v1.21.0-rc2 / 2023-03-29
|
||||
# v1.21.0-rc1 / 2023-03-21
|
||||
|
||||
This is an optional but highly recommended feature release of Lotus. It includes numerous improvements and enhancements for node operators, ETH RPC-providers and storage providers.
|
||||
|
||||
@@ -11,10 +11,7 @@ Before upgrading to this feature release read carefully through these bullet poi
|
||||
- Starting from this release, the SplitStore feature is automatically activated on new nodes. However, for existing Lotus users, you need to explicitly configure SplitStore by uncommenting the `EnableSplitstore` option in your `config.toml` file. To enable SplitStore, set `EnableSplitstore=true`, and to disable it, set `EnableSplitstore=false`. **It's important to note that your Lotus node will not start unless this configuration is properly set. Set it to false if you are running a full archival node!**
|
||||
- This feature release requires a **minimum Go version of v1.19.7 or higher to successfully build Lotus**. Additionally, Go version v1.20 and higher is now also supported.
|
||||
- **Storage Providers:** The proofs libraries now have CUDA enabled by default, which requires you to install (CUDA)[https://lotus.filecoin.io/tutorials/lotus-miner/cuda/] if you haven't already done so. If you prefer to use OpenCL on your GPUs instead, you can use the `FFI_USE_OPENCL=1` flag when building from source. On the other hand, if you want to disable GPUs altogether, you can use the `FFI_NO_GPU=1` environment variable when building from source.
|
||||
- **Storage Providers:** The `lotus-miner sectors extend` command has been refactored to the functionality of `lotus-miner sectors renew`. The issue where extions did not work has been fixed in this release candidate.
|
||||
- **Exchanges/Node operators/RPC-providers::** Execution traces (returned from `lotus state exec-trace`, `lotus state replay`, etc.), has changed to account for changes introduced by the by the FVM. **Please make sure to read the `Execution trace format change` section carefully, as these are interface breaking changes**
|
||||
- **Syncing issues:** If you have been struggling with syncing issues in normal operations you can try to adjust the amount of threads used for more concurrent FMV execution through via the `LOTUS_FVM_CONCURRENCY` enviroment variable. It is set to 4 threads by default. Recommended formula for concurrency == YOUR_RAM/4 , but max is 128. If you are a Storage Provider and are pushing many messages within a short period of time, exporting `LOTUS_SKIP_APPLY_TS_MESSAGE_CALL_WITH_GAS=1` will also help with keeping in sync.
|
||||
- **Catching up from a Snapshot:** Users have noticed that catching up sync from a snapshot is taking a lot longer these day. This is largely related to the built-in market actor consuming a lot of computational demand for block validation. A FIP for a short-term mitigation for this is currently in Last Call and will be included network version 19 upgrade if accepted. You [can read the FIP here.](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0060.md)
|
||||
- **Exchanges:** Execution traces (returned from `lotus state exec-trace`, `lotus state replay`, etc.), has changed to account for changes introduced by the by the FVM. **Please make sure to read the `Execution trace format change` section carefully, as these are interface breaking changes**
|
||||
|
||||
## Highlights
|
||||
|
||||
@@ -29,10 +26,8 @@ SplitStore also has some new configuration settings that you can set in your con
|
||||
|
||||
The SplitStore also has two new commands:
|
||||
|
||||
- `lotus chain prune hot` is a much less resource-intensive GC and is best suited for situations where you don't have the spare disk space for a full GC.
|
||||
- `lotus chain prune hot-moving` will run a full moving garbage collection of the hotstore. This commands create a new hotstore before deleting the old one so you need working room in the hotstore directory. The current size of a fully GC'd hotstore is around 295 GiB so you need to make sure you have at least that available.
|
||||
|
||||
You can read more about the new SplitStore commands in [the documentation](https://lotus.filecoin.io/lotus/configure/splitstore/#manual-chain-store-garbage-collection).
|
||||
- `lotus chain prune hot` will run an online (badger vlog) garbage collection on the hotstore.
|
||||
- `lotus chain prune hot-moving` will run an moving garbage collection the hotstore
|
||||
|
||||
**RPC API improvements**
|
||||
|
||||
@@ -103,12 +98,6 @@ The `lotus-Miner sector list` is now running in parallel - which should speed up
|
||||
|
||||
## Improvements
|
||||
|
||||
- backport: fix: miner: correctly count sector extensions (10555) ([filecoin-project/lotus#10555](https://github.com/filecoin-project/lotus/pull/10555))
|
||||
- Fixes the issue with sector extensions.
|
||||
- fix: proving: Initialize slice with with same length as partition (#10574) ([filecoin-project/lotus#10574])(https://github.com/filecoin-project/lotus/pull/10574)
|
||||
- Fixes an issue where `lotus-miner proving compute window-post` paniced when trying to make skipped sectors human readable.
|
||||
- feat: stmgr: speed up calculation of genesis circ supply (#10553) ([filecoin-project/lotus#10553])(https://github.com/filecoin-project/lotus/pull/10553)
|
||||
- perf: eth: gas estimate set applyTsMessages false (#10546) ([filecoin-project/lotus#10456](https://github.com/filecoin-project/lotus/pull/10546))
|
||||
- feat: config: Force existing users to opt into new defaults (#10488) ([filecoin-project/lotus#10488](https://github.com/filecoin-project/lotus/pull/10488))
|
||||
- Force existing users to opt into the new SplitStore defaults.
|
||||
- fix: splitstore: Demote now common logs (#10516) ([filecoin-project/lotus#10516](https://github.com/filecoin-project/lotus/pull/10516))
|
||||
@@ -182,9 +171,6 @@ The `lotus-Miner sector list` is now running in parallel - which should speed up
|
||||
- github.com/filecoin-project/go-fil-markets (v1.25.2 -> v1.27.0-rc1):
|
||||
- github.com/filecoin-project/go-jsonrpc (v0.2.1 -> v0.2.3):
|
||||
- github.com/filecoin-project/go-statemachine (v1.0.2 -> v1.0.3):
|
||||
- github.com/ipfs/go-cid (v0.3.2 -> v0.4.0):
|
||||
- github.com/ipfs/go-libipfs (v0.5.0 -> v0.7.0):
|
||||
- github.com/ipfs/go-path (v0.3.0 -> v0.3.1):
|
||||
- deps: update go-libp2p-pubsub to v0.9.3 ([filecoin-project/lotus#10483](https://github.com/filecoin-project/lotus/pull/10483))
|
||||
- deps: Update go-jsonrpc to v0.2.2 ([filecoin-project/lotus#10395](https://github.com/filecoin-project/lotus/pull/10395))
|
||||
- Update to go-data-transfer v2 and libp2p, still wip ([filecoin-project/lotus#10382](https://github.com/filecoin-project/lotus/pull/10382))
|
||||
@@ -192,7 +178,6 @@ The `lotus-Miner sector list` is now running in parallel - which should speed up
|
||||
- chore: node: migrate go-bitswap to go-libipfs/bitswap ([filecoin-project/lotus#10138](https://github.com/filecoin-project/lotus/pull/10138))
|
||||
- chore: all: bump go-libipfs to replace go-block-format ([filecoin-project/lotus#10126](https://github.com/filecoin-project/lotus/pull/10126))
|
||||
- chore: market: Upgrade to index-provider 0.10.0 ([filecoin-project/lotus#9981](https://github.com/filecoin-project/lotus/pull/9981))
|
||||
- chore: all: bump go-libipfs ([filecoin-project/lotus#10563](https://github.com/filecoin-project/lotus/pull/10563))
|
||||
|
||||
## Others
|
||||
- Update service_developer_bug_report.yml ([filecoin-project/lotus#10321](https://github.com/filecoin-project/lotus/pull/10321))
|
||||
@@ -222,7 +207,6 @@ The `lotus-Miner sector list` is now running in parallel - which should speed up
|
||||
- chore: update ffi to increase execution parallelism (#10480) ([filecoin-project/lotus#10480](https://github.com/filecoin-project/lotus/pull/10480))
|
||||
- chore: update the FFI for release (#10435) ([filecoin-project/lotus#10444](https://github.com/filecoin-project/lotus/pull/10444))
|
||||
- build: bump version to v1.21.0-dev ([filecoin-project/lotus#10249](https://github.com/filecoin-project/lotus/pull/10249))
|
||||
- build: docker: Update GO-version (#10591) ([filecoin-project/lotus#10249](https://github.com/filecoin-project/lotus/pull/10591))
|
||||
- chore: merge release/v1.20.0 into master ([filecoin-project/lotus#10184](https://github.com/filecoin-project/lotus/pull/10184))
|
||||
- docs: API Gateway: patch documentation note about make gen command ([filecoin-project/lotus#10422](https://github.com/filecoin-project/lotus/pull/10422))
|
||||
- chore: docs: fix docs typos ([filecoin-project/lotus#10155](https://github.com/filecoin-project/lotus/pull/10155))
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
#####################################
|
||||
FROM golang:1.19.7-buster AS lotus-builder
|
||||
FROM golang:1.18.8-buster AS lotus-builder
|
||||
MAINTAINER Lotus Development Team
|
||||
|
||||
RUN apt-get update && apt-get install -y ca-certificates build-essential clang ocl-icd-opencl-dev ocl-icd-libopencl1 jq libhwloc-dev
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
##### DEPRECATED
|
||||
|
||||
FROM golang:1.19.7-buster AS builder-deps
|
||||
FROM golang:1.18.8-buster AS builder-deps
|
||||
MAINTAINER Lotus Development Team
|
||||
|
||||
RUN apt-get update && apt-get install -y ca-certificates build-essential clang ocl-icd-opencl-dev ocl-icd-libopencl1 jq libhwloc-dev
|
||||
|
||||
@@ -71,10 +71,10 @@ For other distributions you can find the required dependencies [here.](https://l
|
||||
|
||||
#### Go
|
||||
|
||||
To build Lotus, you need a working installation of [Go 1.19.7 or higher](https://golang.org/dl/):
|
||||
To build Lotus, you need a working installation of [Go 1.18.8 or higher](https://golang.org/dl/):
|
||||
|
||||
```bash
|
||||
wget -c https://golang.org/dl/go1.19.7.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local
|
||||
wget -c https://golang.org/dl/go1.18.8.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local
|
||||
```
|
||||
|
||||
**TIP:**
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ package blockstore
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
httpapi "github.com/ipfs/go-ipfs-http-client"
|
||||
@@ -103,7 +103,7 @@ func (i *IPFSBlockstore) Get(ctx context.Context, cid cid.Cid) (blocks.Block, er
|
||||
return nil, xerrors.Errorf("getting ipfs block: %w", err)
|
||||
}
|
||||
|
||||
data, err := io.ReadAll(rd)
|
||||
data, err := ioutil.ReadAll(rd)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1
-1
@@ -37,7 +37,7 @@ func BuildTypeString() string {
|
||||
}
|
||||
|
||||
// BuildVersion is the local build version
|
||||
const BuildVersion = "1.21.0-rc2"
|
||||
const BuildVersion = "1.21.0-rc1"
|
||||
|
||||
func UserVersion() string {
|
||||
if os.Getenv("LOTUS_VERSION_IGNORE_COMMIT") == "1" {
|
||||
|
||||
+13
-12
@@ -4,6 +4,7 @@ import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"go/format"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
@@ -65,7 +66,7 @@ func generateAdapters() error {
|
||||
}
|
||||
|
||||
{
|
||||
af, err := os.ReadFile(filepath.Join(actDir, "actor.go.template"))
|
||||
af, err := ioutil.ReadFile(filepath.Join(actDir, "actor.go.template"))
|
||||
if err != nil {
|
||||
return xerrors.Errorf("loading actor template: %w", err)
|
||||
}
|
||||
@@ -89,7 +90,7 @@ func generateAdapters() error {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := os.WriteFile(filepath.Join(actDir, fmt.Sprintf("%s.go", act)), fmted, 0666); err != nil {
|
||||
if err := ioutil.WriteFile(filepath.Join(actDir, fmt.Sprintf("%s.go", act)), fmted, 0666); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@@ -99,7 +100,7 @@ func generateAdapters() error {
|
||||
}
|
||||
|
||||
func generateState(actDir string, versions []int) error {
|
||||
af, err := os.ReadFile(filepath.Join(actDir, "state.go.template"))
|
||||
af, err := ioutil.ReadFile(filepath.Join(actDir, "state.go.template"))
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return nil // skip
|
||||
@@ -122,7 +123,7 @@ func generateState(actDir string, versions []int) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := os.WriteFile(filepath.Join(actDir, fmt.Sprintf("v%d.go", version)), b.Bytes(), 0666); err != nil {
|
||||
if err := ioutil.WriteFile(filepath.Join(actDir, fmt.Sprintf("v%d.go", version)), b.Bytes(), 0666); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@@ -131,7 +132,7 @@ func generateState(actDir string, versions []int) error {
|
||||
}
|
||||
|
||||
func generateMessages(actDir string) error {
|
||||
af, err := os.ReadFile(filepath.Join(actDir, "message.go.template"))
|
||||
af, err := ioutil.ReadFile(filepath.Join(actDir, "message.go.template"))
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return nil // skip
|
||||
@@ -154,7 +155,7 @@ func generateMessages(actDir string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := os.WriteFile(filepath.Join(actDir, fmt.Sprintf("message%d.go", version)), b.Bytes(), 0666); err != nil {
|
||||
if err := ioutil.WriteFile(filepath.Join(actDir, fmt.Sprintf("message%d.go", version)), b.Bytes(), 0666); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@@ -164,7 +165,7 @@ func generateMessages(actDir string) error {
|
||||
|
||||
func generatePolicy(policyPath string) error {
|
||||
|
||||
pf, err := os.ReadFile(policyPath + ".template")
|
||||
pf, err := ioutil.ReadFile(policyPath + ".template")
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return nil // skip
|
||||
@@ -186,7 +187,7 @@ func generatePolicy(policyPath string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := os.WriteFile(policyPath, b.Bytes(), 0666); err != nil {
|
||||
if err := ioutil.WriteFile(policyPath, b.Bytes(), 0666); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -195,7 +196,7 @@ func generatePolicy(policyPath string) error {
|
||||
|
||||
func generateBuiltin(builtinPath string) error {
|
||||
|
||||
bf, err := os.ReadFile(builtinPath + ".template")
|
||||
bf, err := ioutil.ReadFile(builtinPath + ".template")
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return nil // skip
|
||||
@@ -217,7 +218,7 @@ func generateBuiltin(builtinPath string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := os.WriteFile(builtinPath, b.Bytes(), 0666); err != nil {
|
||||
if err := ioutil.WriteFile(builtinPath, b.Bytes(), 0666); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -226,7 +227,7 @@ func generateBuiltin(builtinPath string) error {
|
||||
|
||||
func generateRegistry(registryPath string) error {
|
||||
|
||||
bf, err := os.ReadFile(registryPath + ".template")
|
||||
bf, err := ioutil.ReadFile(registryPath + ".template")
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return nil // skip
|
||||
@@ -247,7 +248,7 @@ func generateRegistry(registryPath string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := os.WriteFile(registryPath, b.Bytes(), 0666); err != nil {
|
||||
if err := ioutil.WriteFile(registryPath, b.Bytes(), 0666); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -5,7 +5,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"io/ioutil"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
@@ -167,7 +167,7 @@ func NewGeneratorWithSectorsAndUpgradeSchedule(numSectors int, us stmgr.UpgradeS
|
||||
|
||||
maddr1 := genesis2.MinerAddress(0)
|
||||
|
||||
m1temp, err := os.MkdirTemp("", "preseal")
|
||||
m1temp, err := ioutil.TempDir("", "preseal")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -179,7 +179,7 @@ func NewGeneratorWithSectorsAndUpgradeSchedule(numSectors int, us stmgr.UpgradeS
|
||||
|
||||
maddr2 := genesis2.MinerAddress(1)
|
||||
|
||||
m2temp, err := os.MkdirTemp("", "preseal")
|
||||
m2temp, err := ioutil.TempDir("", "preseal")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
+2
-1
@@ -9,6 +9,7 @@ import (
|
||||
"fmt"
|
||||
"html/template"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"reflect"
|
||||
"sort"
|
||||
@@ -1089,7 +1090,7 @@ var StateComputeStateCmd = &cli.Command{
|
||||
|
||||
var stout *lapi.ComputeStateOutput
|
||||
if csofile := cctx.String("compute-state-output"); csofile != "" {
|
||||
data, err := os.ReadFile(csofile)
|
||||
data, err := ioutil.ReadFile(csofile)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"path"
|
||||
@@ -64,7 +65,7 @@ func ClientExportStream(apiAddr string, apiAuth http.Header, eref api.ExportRef,
|
||||
}
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
em, err := io.ReadAll(resp.Body)
|
||||
em, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("reading error body: %w", err)
|
||||
}
|
||||
|
||||
+2
-1
@@ -6,6 +6,7 @@ import (
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
@@ -336,7 +337,7 @@ var walletImport = &cli.Command{
|
||||
inpdata = indata
|
||||
|
||||
} else {
|
||||
fdata, err := os.ReadFile(cctx.Args().First())
|
||||
fdata, err := ioutil.ReadFile(cctx.Args().First())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"math"
|
||||
"net/http"
|
||||
_ "net/http/pprof"
|
||||
@@ -157,7 +158,7 @@ var importBenchCmd = &cli.Command{
|
||||
if rdir := cctx.String("repodir"); rdir != "" {
|
||||
tdir = rdir
|
||||
} else {
|
||||
tmp, err := os.MkdirTemp("", "lotus-import-bench")
|
||||
tmp, err := ioutil.TempDir("", "lotus-import-bench")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"math/big"
|
||||
"math/rand"
|
||||
"os"
|
||||
@@ -196,7 +197,7 @@ var sealBenchCmd = &cli.Command{
|
||||
return xerrors.Errorf("creating sectorbuilder dir: %w", err)
|
||||
}
|
||||
|
||||
tsdir, err := os.MkdirTemp(sdir, "bench")
|
||||
tsdir, err := ioutil.TempDir(sdir, "bench")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -286,7 +287,7 @@ var sealBenchCmd = &cli.Command{
|
||||
// sectorbuilder directory... we need a better way to handle
|
||||
// this in other cases
|
||||
|
||||
fdata, err := os.ReadFile(filepath.Join(sbdir, "pre-seal-"+maddr.String()+".json"))
|
||||
fdata, err := ioutil.ReadFile(filepath.Join(sbdir, "pre-seal-"+maddr.String()+".json"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -636,7 +637,7 @@ func runSeals(sb *ffiwrapper.Sealer, sbfs *basicfs.Provider, numSectors int, par
|
||||
return err
|
||||
}
|
||||
|
||||
if err := os.WriteFile(saveC2inp, b, 0664); err != nil {
|
||||
if err := ioutil.WriteFile(saveC2inp, b, 0664); err != nil {
|
||||
log.Warnf("%+v", err)
|
||||
}
|
||||
}
|
||||
@@ -750,7 +751,7 @@ var proveCmd = &cli.Command{
|
||||
return xerrors.Errorf("Usage: lotus-bench prove [input.json]")
|
||||
}
|
||||
|
||||
inb, err := os.ReadFile(c.Args().First())
|
||||
inb, err := ioutil.ReadFile(c.Args().First())
|
||||
if err != nil {
|
||||
return xerrors.Errorf("reading input file: %w", err)
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strconv"
|
||||
"time"
|
||||
@@ -443,7 +444,7 @@ var simpleCommit1 = &cli.Command{
|
||||
return err
|
||||
}
|
||||
|
||||
if err := os.WriteFile(cctx.Args().Get(4), b, 0664); err != nil {
|
||||
if err := ioutil.WriteFile(cctx.Args().Get(4), b, 0664); err != nil {
|
||||
log.Warnf("%+v", err)
|
||||
}
|
||||
|
||||
@@ -477,7 +478,7 @@ var simpleCommit2 = &cli.Command{
|
||||
return xerrors.Errorf("Usage: lotus-bench prove [input.json]")
|
||||
}
|
||||
|
||||
inb, err := os.ReadFile(c.Args().First())
|
||||
inb, err := ioutil.ReadFile(c.Args().First())
|
||||
if err != nil {
|
||||
return xerrors.Errorf("reading input file: %w", err)
|
||||
}
|
||||
@@ -860,7 +861,7 @@ var simpleProveReplicaUpdate1 = &cli.Command{
|
||||
return xerrors.Errorf("json marshal vanilla proofs: %w", err)
|
||||
}
|
||||
|
||||
if err := os.WriteFile(cctx.Args().Get(7), vpjb, 0666); err != nil {
|
||||
if err := ioutil.WriteFile(cctx.Args().Get(7), vpjb, 0666); err != nil {
|
||||
return xerrors.Errorf("writing vanilla proofs file: %w", err)
|
||||
}
|
||||
|
||||
@@ -933,7 +934,7 @@ var simpleProveReplicaUpdate2 = &cli.Command{
|
||||
return xerrors.Errorf("parse commr: %w", err)
|
||||
}
|
||||
|
||||
vpb, err := os.ReadFile(cctx.Args().Get(3))
|
||||
vpb, err := ioutil.ReadFile(cctx.Args().Get(3))
|
||||
if err != nil {
|
||||
return xerrors.Errorf("reading valilla proof file: %w", err)
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
@@ -63,7 +63,7 @@ func VerifyToken(token, remoteIP string) (Response, error) {
|
||||
return resp, err
|
||||
}
|
||||
|
||||
b, err := io.ReadAll(r.Body)
|
||||
b, err := ioutil.ReadAll(r.Body)
|
||||
_ = r.Body.Close() // close immediately after reading finished
|
||||
if err != nil {
|
||||
return resp, err
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"encoding/binary"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -245,7 +246,7 @@ var initCmd = &cli.Command{
|
||||
return xerrors.Errorf("marshaling storage config: %w", err)
|
||||
}
|
||||
|
||||
if err := os.WriteFile(filepath.Join(lr.Path(), "sectorstore.json"), b, 0644); err != nil {
|
||||
if err := ioutil.WriteFile(filepath.Join(lr.Path(), "sectorstore.json"), b, 0644); err != nil {
|
||||
return xerrors.Errorf("persisting storage metadata (%s): %w", filepath.Join(lr.Path(), "sectorstore.json"), err)
|
||||
}
|
||||
|
||||
@@ -291,7 +292,7 @@ func migratePreSealMeta(ctx context.Context, api v1api.FullNode, metadata string
|
||||
return xerrors.Errorf("expanding preseal dir: %w", err)
|
||||
}
|
||||
|
||||
b, err := os.ReadFile(metadata)
|
||||
b, err := ioutil.ReadFile(metadata)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("reading preseal metadata: %w", err)
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"github.com/docker/go-units"
|
||||
@@ -58,7 +59,7 @@ var restoreCmd = &cli.Command{
|
||||
return xerrors.Errorf("expanding storage config path: %w", err)
|
||||
}
|
||||
|
||||
cfb, err := os.ReadFile(cf)
|
||||
cfb, err := ioutil.ReadFile(cf)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("reading storage config: %w", err)
|
||||
}
|
||||
|
||||
@@ -658,10 +658,6 @@ It will not send any messages to the chain.`,
|
||||
for _, i := range res {
|
||||
var postParam SubmitWindowedPoStParams
|
||||
postParam.Deadline = i.Deadline
|
||||
|
||||
// Initialize the postParam.Partitions slice with the same length as i.Partitions
|
||||
postParam.Partitions = make([]PoStPartition, len(i.Partitions))
|
||||
|
||||
for id, part := range i.Partitions {
|
||||
postParam.Partitions[id].Index = part.Index
|
||||
count, err := part.Skipped.Count()
|
||||
|
||||
@@ -1160,9 +1160,8 @@ var sectorsExtendCmd = &cli.Command{
|
||||
}
|
||||
|
||||
sectorsInDecl := int(sectorsWithoutClaimsCount) + len(sectorsWithClaims)
|
||||
scount += sectorsInDecl
|
||||
|
||||
if scount > addrSectors || len(p.Extensions) >= declMax {
|
||||
if scount+sectorsInDecl > addrSectors || len(p.Extensions) >= declMax {
|
||||
params = append(params, p)
|
||||
p = miner.ExtendSectorExpiration2Params{}
|
||||
scount = sectorsInDecl
|
||||
@@ -1231,7 +1230,7 @@ var sectorsExtendCmd = &cli.Command{
|
||||
smsg, err := fullApi.MpoolPushMessage(ctx, &types.Message{
|
||||
From: mi.Worker,
|
||||
To: maddr,
|
||||
Method: builtin.MethodsMiner.ExtendSectorExpiration2,
|
||||
Method: builtin.MethodsMiner.ExtendSectorExpiration,
|
||||
Value: big.Zero(),
|
||||
Params: sp,
|
||||
}, spec)
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"math/bits"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -166,7 +167,7 @@ over time
|
||||
return xerrors.Errorf("marshaling storage config: %w", err)
|
||||
}
|
||||
|
||||
if err := os.WriteFile(filepath.Join(p, metaFile), b, 0644); err != nil {
|
||||
if err := ioutil.WriteFile(filepath.Join(p, metaFile), b, 0644); err != nil {
|
||||
return xerrors.Errorf("persisting storage metadata (%s): %w", filepath.Join(p, metaFile), err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"encoding/csv"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
_ "net/http/pprof"
|
||||
"os"
|
||||
@@ -758,7 +759,7 @@ func (r *refunder) EnsureMinerMinimums(ctx context.Context, tipset *types.TipSet
|
||||
return nil, err
|
||||
}
|
||||
|
||||
w := io.Discard
|
||||
w := ioutil.Discard
|
||||
if len(output) != 0 {
|
||||
f, err := os.Create(output)
|
||||
if err != nil {
|
||||
@@ -1298,7 +1299,7 @@ func loadChainEpoch(fn string) (abi.ChainEpoch, error) {
|
||||
err = f.Close()
|
||||
}()
|
||||
|
||||
raw, err := io.ReadAll(f)
|
||||
raw, err := ioutil.ReadAll(f)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
+15
-14
@@ -4,6 +4,7 @@ import (
|
||||
"encoding/csv"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -79,7 +80,7 @@ var genesisNewCmd = &cli.Command{
|
||||
return err
|
||||
}
|
||||
|
||||
if err := os.WriteFile(genf, genb, 0644); err != nil {
|
||||
if err := ioutil.WriteFile(genf, genb, 0644); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -102,7 +103,7 @@ var genesisAddMinerCmd = &cli.Command{
|
||||
}
|
||||
|
||||
var template genesis.Template
|
||||
genb, err := os.ReadFile(genf)
|
||||
genb, err := ioutil.ReadFile(genf)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("read genesis template: %w", err)
|
||||
}
|
||||
@@ -116,7 +117,7 @@ var genesisAddMinerCmd = &cli.Command{
|
||||
return xerrors.Errorf("expand preseal file path: %w", err)
|
||||
}
|
||||
miners := map[string]genesis.Miner{}
|
||||
minb, err := os.ReadFile(minf)
|
||||
minb, err := ioutil.ReadFile(minf)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("read preseal file: %w", err)
|
||||
}
|
||||
@@ -155,7 +156,7 @@ var genesisAddMinerCmd = &cli.Command{
|
||||
return err
|
||||
}
|
||||
|
||||
if err := os.WriteFile(genf, genb, 0644); err != nil {
|
||||
if err := ioutil.WriteFile(genf, genb, 0644); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -195,7 +196,7 @@ var genesisAddMsigsCmd = &cli.Command{
|
||||
}
|
||||
|
||||
var template genesis.Template
|
||||
b, err := os.ReadFile(genf)
|
||||
b, err := ioutil.ReadFile(genf)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("read genesis template: %w", err)
|
||||
}
|
||||
@@ -236,7 +237,7 @@ var genesisAddMsigsCmd = &cli.Command{
|
||||
return err
|
||||
}
|
||||
|
||||
if err := os.WriteFile(genf, b, 0644); err != nil {
|
||||
if err := ioutil.WriteFile(genf, b, 0644); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
@@ -338,7 +339,7 @@ var genesisSetVRKCmd = &cli.Command{
|
||||
}
|
||||
|
||||
var template genesis.Template
|
||||
b, err := os.ReadFile(genf)
|
||||
b, err := ioutil.ReadFile(genf)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("read genesis template: %w", err)
|
||||
}
|
||||
@@ -403,7 +404,7 @@ var genesisSetVRKCmd = &cli.Command{
|
||||
return err
|
||||
}
|
||||
|
||||
if err := os.WriteFile(genf, b, 0644); err != nil {
|
||||
if err := ioutil.WriteFile(genf, b, 0644); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
@@ -434,7 +435,7 @@ var genesisSetRemainderCmd = &cli.Command{
|
||||
}
|
||||
|
||||
var template genesis.Template
|
||||
b, err := os.ReadFile(genf)
|
||||
b, err := ioutil.ReadFile(genf)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("read genesis template: %w", err)
|
||||
}
|
||||
@@ -499,7 +500,7 @@ var genesisSetRemainderCmd = &cli.Command{
|
||||
return err
|
||||
}
|
||||
|
||||
if err := os.WriteFile(genf, b, 0644); err != nil {
|
||||
if err := ioutil.WriteFile(genf, b, 0644); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
@@ -528,7 +529,7 @@ var genesisSetActorVersionCmd = &cli.Command{
|
||||
}
|
||||
|
||||
var template genesis.Template
|
||||
b, err := os.ReadFile(genf)
|
||||
b, err := ioutil.ReadFile(genf)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("read genesis template: %w", err)
|
||||
}
|
||||
@@ -549,7 +550,7 @@ var genesisSetActorVersionCmd = &cli.Command{
|
||||
return err
|
||||
}
|
||||
|
||||
if err := os.WriteFile(genf, b, 0644); err != nil {
|
||||
if err := ioutil.WriteFile(genf, b, 0644); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
@@ -606,7 +607,7 @@ var genesisSetVRKSignersCmd = &cli.Command{
|
||||
}
|
||||
|
||||
var template genesis.Template
|
||||
b, err := os.ReadFile(genf)
|
||||
b, err := ioutil.ReadFile(genf)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("read genesis template: %w", err)
|
||||
}
|
||||
@@ -661,7 +662,7 @@ var genesisSetVRKSignersCmd = &cli.Command{
|
||||
return err
|
||||
}
|
||||
|
||||
if err := os.WriteFile(genf, b, 0644); err != nil {
|
||||
if err := ioutil.WriteFile(genf, b, 0644); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"github.com/docker/go-units"
|
||||
@@ -113,7 +114,7 @@ var preSealCmd = &cli.Command{
|
||||
var k *types.KeyInfo
|
||||
if c.String("key") != "" {
|
||||
k = new(types.KeyInfo)
|
||||
kh, err := os.ReadFile(c.String("key"))
|
||||
kh, err := ioutil.ReadFile(c.String("key"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
@@ -134,7 +135,7 @@ func PreSeal(maddr address.Address, spt abi.RegisteredSealProof, offset abi.Sect
|
||||
return nil, nil, xerrors.Errorf("marshaling storage config: %w", err)
|
||||
}
|
||||
|
||||
if err := os.WriteFile(filepath.Join(sbroot, "sectorstore.json"), b, 0644); err != nil {
|
||||
if err := ioutil.WriteFile(filepath.Join(sbroot, "sectorstore.json"), b, 0644); err != nil {
|
||||
return nil, nil, xerrors.Errorf("persisting storage metadata (%s): %w", filepath.Join(sbroot, "storage.json"), err)
|
||||
}
|
||||
}
|
||||
@@ -227,7 +228,7 @@ func WriteGenesisMiner(maddr address.Address, sbroot string, gm *genesis.Miner,
|
||||
|
||||
log.Infof("Writing preseal manifest to %s", filepath.Join(sbroot, "pre-seal-"+maddr.String()+".json"))
|
||||
|
||||
if err := os.WriteFile(filepath.Join(sbroot, "pre-seal-"+maddr.String()+".json"), out, 0664); err != nil {
|
||||
if err := ioutil.WriteFile(filepath.Join(sbroot, "pre-seal-"+maddr.String()+".json"), out, 0664); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -238,7 +239,7 @@ func WriteGenesisMiner(maddr address.Address, sbroot string, gm *genesis.Miner,
|
||||
}
|
||||
|
||||
// TODO: allow providing key
|
||||
if err := os.WriteFile(filepath.Join(sbroot, "pre-seal-"+maddr.String()+".key"), []byte(hex.EncodeToString(b)), 0664); err != nil {
|
||||
if err := ioutil.WriteFile(filepath.Join(sbroot, "pre-seal-"+maddr.String()+".key"), []byte(hex.EncodeToString(b)), 0664); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
@@ -29,7 +30,7 @@ var base16Cmd = &cli.Command{
|
||||
input = strings.NewReader(cctx.Args().First())
|
||||
}
|
||||
|
||||
bytes, err := io.ReadAll(input)
|
||||
bytes, err := ioutil.ReadAll(input)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
@@ -29,7 +30,7 @@ var base32Cmd = &cli.Command{
|
||||
input = strings.NewReader(cctx.Args().First())
|
||||
}
|
||||
|
||||
bytes, err := io.ReadAll(input)
|
||||
bytes, err := ioutil.ReadAll(input)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
@@ -37,7 +38,7 @@ var base64Cmd = &cli.Command{
|
||||
input = strings.NewReader(cctx.Args().First())
|
||||
}
|
||||
|
||||
bytes, err := io.ReadAll(input)
|
||||
bytes, err := ioutil.ReadAll(input)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"github.com/urfave/cli/v2"
|
||||
@@ -317,7 +318,7 @@ func decodeToByte(cctx *cli.Context, i int) ([]byte, error) {
|
||||
if i > 0 {
|
||||
return nil, xerrors.Errorf("need more than %d args", i)
|
||||
}
|
||||
r, err := io.ReadAll(os.Stdin)
|
||||
r, err := ioutil.ReadAll(os.Stdin)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"io/ioutil"
|
||||
"sort"
|
||||
"strconv"
|
||||
|
||||
@@ -537,7 +537,7 @@ var finalResultCmd = &cli.Command{
|
||||
// Returns voted sorted by votes from earliest to latest
|
||||
func getVotesMap(file string) ([]Vote, error) {
|
||||
var votes []Vote
|
||||
vb, err := os.ReadFile(file)
|
||||
vb, err := ioutil.ReadFile(file)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("read vote: %w", err)
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
@@ -80,7 +81,7 @@ var jwtTokenCmd = &cli.Command{
|
||||
defer inputFile.Close() //nolint:errcheck
|
||||
input := bufio.NewReader(inputFile)
|
||||
|
||||
encoded, err := io.ReadAll(input)
|
||||
encoded, err := ioutil.ReadAll(input)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -122,7 +123,7 @@ var jwtTokenCmd = &cli.Command{
|
||||
return err
|
||||
}
|
||||
|
||||
return os.WriteFile(cctx.String("output"), token, 0600)
|
||||
return ioutil.WriteFile(cctx.String("output"), token, 0600)
|
||||
},
|
||||
}
|
||||
|
||||
@@ -141,7 +142,7 @@ var jwtNewCmd = &cli.Command{
|
||||
|
||||
keyName := cctx.Args().First()
|
||||
|
||||
sk, err := io.ReadAll(io.LimitReader(rand.Reader, 32))
|
||||
sk, err := ioutil.ReadAll(io.LimitReader(rand.Reader, 32))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -183,6 +184,6 @@ var jwtNewCmd = &cli.Command{
|
||||
}
|
||||
|
||||
filenameToken := fmt.Sprintf("jwt-%s.token", keyName)
|
||||
return os.WriteFile(filenameToken, token, 0600)
|
||||
return ioutil.WriteFile(filenameToken, token, 0600)
|
||||
},
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
@@ -67,7 +68,7 @@ var keyinfoVerifyCmd = &cli.Command{
|
||||
defer inputFile.Close() //nolint:errcheck
|
||||
input := bufio.NewReader(inputFile)
|
||||
|
||||
keyContent, err := io.ReadAll(input)
|
||||
keyContent, err := ioutil.ReadAll(input)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -161,7 +162,7 @@ var keyinfoImportCmd = &cli.Command{
|
||||
input = bufio.NewReader(inputFile)
|
||||
}
|
||||
|
||||
encoded, err := io.ReadAll(input)
|
||||
encoded, err := ioutil.ReadAll(input)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -273,7 +274,7 @@ var keyinfoInfoCmd = &cli.Command{
|
||||
input = bufio.NewReader(inputFile)
|
||||
}
|
||||
|
||||
encoded, err := io.ReadAll(input)
|
||||
encoded, err := ioutil.ReadAll(input)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
@@ -96,7 +97,7 @@ var rpcCmd = &cli.Command{
|
||||
return err
|
||||
}
|
||||
|
||||
rb, err := io.ReadAll(resp.Body)
|
||||
rb, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
@@ -463,7 +464,7 @@ var runCmd = &cli.Command{
|
||||
return xerrors.Errorf("marshaling storage config: %w", err)
|
||||
}
|
||||
|
||||
if err := os.WriteFile(filepath.Join(lr.Path(), "sectorstore.json"), b, 0644); err != nil {
|
||||
if err := ioutil.WriteFile(filepath.Join(lr.Path(), "sectorstore.json"), b, 0644); err != nil {
|
||||
return xerrors.Errorf("persisting storage metadata (%s): %w", filepath.Join(lr.Path(), "sectorstore.json"), err)
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
@@ -120,7 +121,7 @@ var storageAttachCmd = &cli.Command{
|
||||
return xerrors.Errorf("marshaling storage config: %w", err)
|
||||
}
|
||||
|
||||
if err := os.WriteFile(filepath.Join(p, metaFile), b, 0644); err != nil {
|
||||
if err := ioutil.WriteFile(filepath.Join(p, metaFile), b, 0644); err != nil {
|
||||
return xerrors.Errorf("persisting storage metadata (%s): %w", filepath.Join(p, metaFile), err)
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -10,6 +10,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"runtime/pprof"
|
||||
@@ -243,7 +244,7 @@ var DaemonCmd = &cli.Command{
|
||||
|
||||
var genBytes []byte
|
||||
if cctx.String("genesis") != "" {
|
||||
genBytes, err = os.ReadFile(cctx.String("genesis"))
|
||||
genBytes, err = ioutil.ReadFile(cctx.String("genesis"))
|
||||
if err != nil {
|
||||
return xerrors.Errorf("reading genesis: %w", err)
|
||||
}
|
||||
@@ -399,7 +400,7 @@ func importKey(ctx context.Context, api lapi.FullNode, f string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
hexdata, err := os.ReadFile(f)
|
||||
hexdata, err := ioutil.ReadFile(f)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ package conformance
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@@ -106,7 +107,7 @@ func TestConformance(t *testing.T) {
|
||||
// Run a test for each vector.
|
||||
for _, v := range vectors {
|
||||
path := filepath.Join(corpusRoot, v)
|
||||
raw, err := os.ReadFile(path)
|
||||
raw, err := ioutil.ReadFile(path)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to read test raw file: %s", path)
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"math"
|
||||
"os"
|
||||
"os/exec"
|
||||
@@ -327,7 +328,7 @@ func dumpThreeWayStateDiff(r Reporter, vector *schema.TestVector, bs blockstore.
|
||||
// writeStateToTempCAR writes the provided roots to a temporary CAR that'll be
|
||||
// cleaned up via t.Cleanup(). It returns the full path of the temp file.
|
||||
func writeStateToTempCAR(bs blockstore.Blockstore, roots ...cid.Cid) (string, error) {
|
||||
tmp, err := os.CreateTemp("", "lotus-tests-*.car")
|
||||
tmp, err := ioutil.TempFile("", "lotus-tests-*.car")
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("failed to create temp file to dump CAR for diffing: %w", err)
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ USAGE:
|
||||
lotus-miner [global options] command [command options] [arguments...]
|
||||
|
||||
VERSION:
|
||||
1.21.0-rc2
|
||||
1.21.0-rc1
|
||||
|
||||
COMMANDS:
|
||||
init Initialize a lotus miner repo
|
||||
|
||||
@@ -7,7 +7,7 @@ USAGE:
|
||||
lotus-worker [global options] command [command options] [arguments...]
|
||||
|
||||
VERSION:
|
||||
1.21.0-rc2
|
||||
1.21.0-rc1
|
||||
|
||||
COMMANDS:
|
||||
run Start lotus worker
|
||||
|
||||
@@ -7,7 +7,7 @@ USAGE:
|
||||
lotus [global options] command [command options] [arguments...]
|
||||
|
||||
VERSION:
|
||||
1.21.0-rc2
|
||||
1.21.0-rc1
|
||||
|
||||
COMMANDS:
|
||||
daemon Start a lotus daemon process
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/fs"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@@ -18,7 +19,7 @@ const (
|
||||
)
|
||||
|
||||
func main() {
|
||||
db, err := os.ReadFile(os.Args[2])
|
||||
db, err := ioutil.ReadFile(os.Args[2])
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -37,7 +38,7 @@ func main() {
|
||||
if filepath.Ext(path) != ".go" {
|
||||
return nil
|
||||
}
|
||||
fb, err := os.ReadFile(path)
|
||||
fb, err := ioutil.ReadFile(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -109,7 +110,7 @@ func main() {
|
||||
|
||||
if rewrite {
|
||||
fmt.Printf("write %s\n", path)
|
||||
if err := os.WriteFile(path, []byte(strings.Join(outLines, "\n")), 0664); err != nil {
|
||||
if err := ioutil.WriteFile(path, []byte(strings.Join(outLines, "\n")), 0664); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module github.com/filecoin-project/lotus
|
||||
|
||||
go 1.19
|
||||
go 1.18
|
||||
|
||||
retract v1.14.0 // Accidentally force-pushed tag, use v1.14.1+ instead.
|
||||
|
||||
@@ -78,7 +78,7 @@ require (
|
||||
github.com/influxdata/influxdb1-client v0.0.0-20200827194710-b269163b24ab
|
||||
github.com/ipfs/bbloom v0.0.4
|
||||
github.com/ipfs/go-blockservice v0.5.0
|
||||
github.com/ipfs/go-cid v0.4.0
|
||||
github.com/ipfs/go-cid v0.3.2
|
||||
github.com/ipfs/go-cidutil v0.1.0
|
||||
github.com/ipfs/go-datastore v0.6.0
|
||||
github.com/ipfs/go-ds-badger2 v0.1.3
|
||||
@@ -97,7 +97,7 @@ require (
|
||||
github.com/ipfs/go-ipfs-util v0.0.2
|
||||
github.com/ipfs/go-ipld-cbor v0.0.6
|
||||
github.com/ipfs/go-ipld-format v0.4.0
|
||||
github.com/ipfs/go-libipfs v0.7.0
|
||||
github.com/ipfs/go-libipfs v0.5.0
|
||||
github.com/ipfs/go-log/v2 v2.5.1
|
||||
github.com/ipfs/go-merkledag v0.9.0
|
||||
github.com/ipfs/go-metrics-interface v0.0.1
|
||||
@@ -244,7 +244,7 @@ require (
|
||||
github.com/ipfs/go-ipld-legacy v0.1.1 // indirect
|
||||
github.com/ipfs/go-ipns v0.3.0 // indirect
|
||||
github.com/ipfs/go-log v1.0.5 // indirect
|
||||
github.com/ipfs/go-path v0.3.1 // indirect
|
||||
github.com/ipfs/go-path v0.3.0 // indirect
|
||||
github.com/ipfs/go-peertaskqueue v0.8.1 // indirect
|
||||
github.com/ipfs/go-verifcid v0.0.2 // indirect
|
||||
github.com/ipld/go-ipld-adl-hamt v0.0.0-20220616142416-9004dbd839e0 // indirect
|
||||
|
||||
@@ -698,8 +698,8 @@ github.com/ipfs/go-cid v0.0.6/go.mod h1:6Ux9z5e+HpkQdckYoX1PG/6xqKspzlEIR5SDmgqg
|
||||
github.com/ipfs/go-cid v0.0.7/go.mod h1:6Ux9z5e+HpkQdckYoX1PG/6xqKspzlEIR5SDmgqgC/I=
|
||||
github.com/ipfs/go-cid v0.1.0/go.mod h1:rH5/Xv83Rfy8Rw6xG+id3DYAMUVmem1MowoKwdXmN2o=
|
||||
github.com/ipfs/go-cid v0.2.0/go.mod h1:P+HXFDF4CVhaVayiEb4wkAy7zBHxBwsJyt0Y5U6MLro=
|
||||
github.com/ipfs/go-cid v0.4.0 h1:a4pdZq0sx6ZSxbCizebnKiMCx/xI/aBBFlB73IgH4rA=
|
||||
github.com/ipfs/go-cid v0.4.0/go.mod h1:uQHwDeX4c6CtyrFwdqyhpNcxVewur1M7l7fNU7LKwZk=
|
||||
github.com/ipfs/go-cid v0.3.2 h1:OGgOd+JCFM+y1DjWPmVH+2/4POtpDzwcr7VgnB7mZXc=
|
||||
github.com/ipfs/go-cid v0.3.2/go.mod h1:gQ8pKqT/sUxGY+tIwy1RPpAojYu7jAyCp5Tz1svoupw=
|
||||
github.com/ipfs/go-cidutil v0.1.0 h1:RW5hO7Vcf16dplUU60Hs0AKDkQAVPVplr7lk97CFL+Q=
|
||||
github.com/ipfs/go-cidutil v0.1.0/go.mod h1:e7OEVBMIv9JaOxt9zaGEmAoSlXW9jdFZ5lP/0PwcfpA=
|
||||
github.com/ipfs/go-datastore v0.0.1/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE=
|
||||
@@ -731,6 +731,7 @@ github.com/ipfs/go-ds-leveldb v0.5.0 h1:s++MEBbD3ZKc9/8/njrn4flZLnCuY9I79v94gBUN
|
||||
github.com/ipfs/go-ds-leveldb v0.5.0/go.mod h1:d3XG9RUDzQ6V4SHi8+Xgj9j1XuEk1z82lquxrVbml/Q=
|
||||
github.com/ipfs/go-ds-measure v0.2.0 h1:sG4goQe0KDTccHMyT45CY1XyUbxe5VwTKpg2LjApYyQ=
|
||||
github.com/ipfs/go-ds-measure v0.2.0/go.mod h1:SEUD/rE2PwRa4IQEC5FuNAmjJCyYObZr9UvVh8V3JxE=
|
||||
github.com/ipfs/go-fetcher v1.6.1/go.mod h1:27d/xMV8bodjVs9pugh/RCjjK2OZ68UgAMspMdingNo=
|
||||
github.com/ipfs/go-filestore v1.2.0 h1:O2wg7wdibwxkEDcl7xkuQsPvJFRBVgVSsOJ/GP6z3yU=
|
||||
github.com/ipfs/go-filestore v1.2.0/go.mod h1:HLJrCxRXquTeEEpde4lTLMaE/MYJZD7WHLkp9z6+FF8=
|
||||
github.com/ipfs/go-fs-lock v0.0.6/go.mod h1:OTR+Rj9sHiRubJh3dRhD15Juhd/+w6VPOY28L7zESmM=
|
||||
@@ -804,8 +805,8 @@ github.com/ipfs/go-ipld-legacy v0.1.1 h1:BvD8PEuqwBHLTKqlGFTHSwrwFOMkVESEvwIYwR2
|
||||
github.com/ipfs/go-ipld-legacy v0.1.1/go.mod h1:8AyKFCjgRPsQFf15ZQgDB8Din4DML/fOmKZkkFkrIEg=
|
||||
github.com/ipfs/go-ipns v0.3.0 h1:ai791nTgVo+zTuq2bLvEGmWP1M0A6kGTXUsgv/Yq67A=
|
||||
github.com/ipfs/go-ipns v0.3.0/go.mod h1:3cLT2rbvgPZGkHJoPO1YMJeh6LtkxopCkKFcio/wE24=
|
||||
github.com/ipfs/go-libipfs v0.7.0 h1:Mi54WJTODaOL2/ZSm5loi3SwI3jI2OuFWUrQIkJ5cpM=
|
||||
github.com/ipfs/go-libipfs v0.7.0/go.mod h1:KsIf/03CqhICzyRGyGo68tooiBE2iFbI/rXW7FhAYr0=
|
||||
github.com/ipfs/go-libipfs v0.5.0 h1:gtvzeoTdUHPUN4B5izzyBS3Cxtpvi+l7hd2mmjN+teM=
|
||||
github.com/ipfs/go-libipfs v0.5.0/go.mod h1:iZ9QyhzNr3AkxRXrbQYb//rv7iLyvZJX0GNuc3lJDiQ=
|
||||
github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM=
|
||||
github.com/ipfs/go-log v1.0.0/go.mod h1:JO7RzlMK6rA+CIxFMLOuB6Wf5b81GDiKElL7UPSIKjA=
|
||||
github.com/ipfs/go-log v1.0.1/go.mod h1:HuWlQttfN6FWNHRhlY5yMk/lW7evQC0HHGOxEwMRR8I=
|
||||
@@ -837,15 +838,17 @@ github.com/ipfs/go-metrics-interface v0.0.1 h1:j+cpbjYvu4R8zbleSs36gvB7jR+wsL2fG
|
||||
github.com/ipfs/go-metrics-interface v0.0.1/go.mod h1:6s6euYU4zowdslK0GKHmqaIZ3j/b/tL7HTWtJ4VPgWY=
|
||||
github.com/ipfs/go-metrics-prometheus v0.0.2 h1:9i2iljLg12S78OhC6UAiXi176xvQGiZaGVF1CUVdE+s=
|
||||
github.com/ipfs/go-metrics-prometheus v0.0.2/go.mod h1:ELLU99AQQNi+zX6GCGm2lAgnzdSH3u5UVlCdqSXnEks=
|
||||
github.com/ipfs/go-path v0.3.1 h1:wkeaCWE/NTuuPGlEkLTsED5UkzfKYZpxaFFPgk8ZVLE=
|
||||
github.com/ipfs/go-path v0.3.1/go.mod h1:eNLsxJEEMxn/CDzUJ6wuNl+6No6tEUhOZcPKsZsYX0E=
|
||||
github.com/ipfs/go-path v0.3.0 h1:tkjga3MtpXyM5v+3EbRvOHEoo+frwi4oumw5K+KYWyA=
|
||||
github.com/ipfs/go-path v0.3.0/go.mod h1:NOScsVgxfC/eIw4nz6OiGwK42PjaSJ4Y/ZFPn1Xe07I=
|
||||
github.com/ipfs/go-peertaskqueue v0.1.0/go.mod h1:Jmk3IyCcfl1W3jTW3YpghSwSEC6IJ3Vzz/jUmWw8Z0U=
|
||||
github.com/ipfs/go-peertaskqueue v0.7.0/go.mod h1:M/akTIE/z1jGNXMU7kFB4TeSEFvj68ow0Rrb04donIU=
|
||||
github.com/ipfs/go-peertaskqueue v0.8.1 h1:YhxAs1+wxb5jk7RvS0LHdyiILpNmRIRnZVztekOF0pg=
|
||||
github.com/ipfs/go-peertaskqueue v0.8.1/go.mod h1:Oxxd3eaK279FxeydSPPVGHzbwVeHjatZ2GA8XD+KbPU=
|
||||
github.com/ipfs/go-unixfs v0.2.2-0.20190827150610-868af2e9e5cb/go.mod h1:IwAAgul1UQIcNZzKPYZWOCijryFBeCV79cNubPzol+k=
|
||||
github.com/ipfs/go-unixfs v0.2.4/go.mod h1:SUdisfUjNoSDzzhGVxvCL9QO/nKdwXdr+gbMUdqcbYw=
|
||||
github.com/ipfs/go-unixfs v0.4.3 h1:EdDc1sNZNFDUlo4UrVAvvAofVI5EwTnKu8Nv8mgXkWQ=
|
||||
github.com/ipfs/go-unixfs v0.4.3/go.mod h1:TSG7G1UuT+l4pNj91raXAPkX0BhJi3jST1FDTfQ5QyM=
|
||||
github.com/ipfs/go-unixfsnode v1.1.2/go.mod h1:5dcE2x03pyjHk4JjamXmunTMzz+VUtqvPwZjIEkfV6s=
|
||||
github.com/ipfs/go-unixfsnode v1.5.2 h1:CvsiTt58W2uR5dD8bqQv+aAY0c1qolmXmSyNbPHYiew=
|
||||
github.com/ipfs/go-unixfsnode v1.5.2/go.mod h1:NlOebRwYx8lMCNMdhAhEspYPBD3obp7TE0LvBqHY+ks=
|
||||
github.com/ipfs/go-verifcid v0.0.1/go.mod h1:5Hrva5KBeIog4A+UpqlaIU+DEstipcJYQQZc0g37pY0=
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -195,7 +196,7 @@ func validateDMUnixFile(r io.Reader) error {
|
||||
}
|
||||
|
||||
func testDMExportAsCar(ctx context.Context, client *kit.TestFullNode, expDirective api.ExportRef, tempDir string) error {
|
||||
out, err := os.CreateTemp(tempDir, "exp-test")
|
||||
out, err := ioutil.TempFile(tempDir, "exp-test")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -213,7 +214,7 @@ func testDMExportAsCar(ctx context.Context, client *kit.TestFullNode, expDirecti
|
||||
return validateDMCar(out)
|
||||
}
|
||||
func tesV0RetrievalAsCar(ctx context.Context, client *kit.TestFullNode, retOrder api0.RetrievalOrder, tempDir string) error {
|
||||
out, err := os.CreateTemp(tempDir, "exp-test")
|
||||
out, err := ioutil.TempFile(tempDir, "exp-test")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package kit
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"math/rand"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -109,7 +110,7 @@ func RunClientTest(t *testing.T, cmds []*lcli.Command, clientNode *TestFullNode)
|
||||
|
||||
// Retrieve the first file from the Miner
|
||||
// client retrieve <cid> <file path>
|
||||
tmpdir, err := os.MkdirTemp(os.TempDir(), "test-cli-client")
|
||||
tmpdir, err := ioutil.TempDir(os.TempDir(), "test-cli-client")
|
||||
require.NoError(t, err)
|
||||
path := filepath.Join(tmpdir, "outfile.dat")
|
||||
|
||||
@@ -143,13 +144,13 @@ func createRandomFile(rseed, size int) ([]byte, string, error) {
|
||||
data := make([]byte, size)
|
||||
rand.New(rand.NewSource(int64(rseed))).Read(data)
|
||||
|
||||
dir, err := os.MkdirTemp(os.TempDir(), "test-make-deal-")
|
||||
dir, err := ioutil.TempDir(os.TempDir(), "test-make-deal-")
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
|
||||
path := filepath.Join(dir, "sourcefile.dat")
|
||||
err = os.WriteFile(path, data, 0644)
|
||||
err = ioutil.WriteFile(path, data, 0644)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
|
||||
@@ -6,9 +6,9 @@ import (
|
||||
"crypto/rand"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -234,7 +234,7 @@ func (n *Ensemble) MinerEnroll(minerNode *TestMiner, full *TestFullNode, opts ..
|
||||
peerId, err := peer.IDFromPrivateKey(privkey)
|
||||
require.NoError(n.t, err)
|
||||
|
||||
tdir, err := os.MkdirTemp("", "preseal-memgen")
|
||||
tdir, err := ioutil.TempDir("", "preseal-memgen")
|
||||
require.NoError(n.t, err)
|
||||
|
||||
minerCnt := len(n.inactive.miners) + len(n.active.miners)
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -203,7 +204,7 @@ func (tm *TestMiner) AddStorage(ctx context.Context, t *testing.T, conf func(*st
|
||||
b, err := json.MarshalIndent(cfg, "", " ")
|
||||
require.NoError(t, err)
|
||||
|
||||
err = os.WriteFile(filepath.Join(p, metaFile), b, 0644)
|
||||
err = ioutil.WriteFile(filepath.Join(p, metaFile), b, 0644)
|
||||
require.NoError(t, err)
|
||||
|
||||
err = tm.StorageAddLocal(ctx, p)
|
||||
|
||||
@@ -3,6 +3,7 @@ package kit
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
@@ -66,7 +67,7 @@ func (tm *TestWorker) AddStorage(ctx context.Context, t *testing.T, conf func(*s
|
||||
b, err := json.MarshalIndent(cfg, "", " ")
|
||||
require.NoError(t, err)
|
||||
|
||||
err = os.WriteFile(filepath.Join(p, metaFile), b, 0644)
|
||||
err = ioutil.WriteFile(filepath.Join(p, metaFile), b, 0644)
|
||||
require.NoError(t, err)
|
||||
|
||||
err = tm.StorageAddLocal(ctx, p)
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@@ -76,7 +77,7 @@ func TestLogRestore(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 1, len(fls))
|
||||
|
||||
bf, err := os.ReadFile(filepath.Join(logdir, fls[0].Name()))
|
||||
bf, err := ioutil.ReadFile(filepath.Join(logdir, fls[0].Name()))
|
||||
require.NoError(t, err)
|
||||
|
||||
ds2 := datastore.NewMapDatastore()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package consensus
|
||||
|
||||
import (
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
@@ -69,7 +69,7 @@ func DefaultClusterRaftConfig() *ClusterRaftConfig {
|
||||
cfg.RaftConfig.LocalID = "will_be_set_automatically"
|
||||
|
||||
// Set up logging
|
||||
cfg.RaftConfig.LogOutput = io.Discard
|
||||
cfg.RaftConfig.LogOutput = ioutil.Discard
|
||||
return &cfg
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ func NewClusterRaftConfig(userRaftConfig *config.UserRaftConfig) *ClusterRaftCon
|
||||
cfg.RaftConfig.LocalID = "will_be_set_automatically"
|
||||
|
||||
// Set up logging
|
||||
cfg.RaftConfig.LogOutput = io.Discard
|
||||
cfg.RaftConfig.LogOutput = ioutil.Discard
|
||||
|
||||
return &cfg
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"path"
|
||||
@@ -157,7 +158,7 @@ func ReaderParamEncoder(addr string) jsonrpc.Option {
|
||||
}
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
b, _ := io.ReadAll(resp.Body)
|
||||
b, _ := ioutil.ReadAll(resp.Body)
|
||||
log.Errorf("sending reader param (%s): non-200 status: %s, msg: '%s'", u.String(), resp.Status, string(b))
|
||||
return
|
||||
}
|
||||
@@ -181,7 +182,7 @@ func ReaderParamEncoder(addr string) jsonrpc.Option {
|
||||
defer resp.Body.Close() //nolint
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
b, _ := io.ReadAll(resp.Body)
|
||||
b, _ := ioutil.ReadAll(resp.Body)
|
||||
log.Errorf("sending reader param (%s): non-200 status: %s, msg: '%s'", u.String(), resp.Status, string(b))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"github.com/ipfs/go-blockservice"
|
||||
@@ -67,7 +68,7 @@ func CreateFilestore(ctx context.Context, srcPath string, dstPath string) (cid.C
|
||||
return cid.Undef, xerrors.Errorf("failed to create reader path file: %w", err)
|
||||
}
|
||||
|
||||
f, err := os.CreateTemp("", "")
|
||||
f, err := ioutil.TempFile("", "")
|
||||
if err != nil {
|
||||
return cid.Undef, xerrors.Errorf("failed to create temp file: %w", err)
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
@@ -66,7 +67,7 @@ func TestRoundtripUnixFS_Dense(t *testing.T) {
|
||||
// ensure contents of the initial input file and the output file are identical.
|
||||
fo, err := os.Open(tmpOutput)
|
||||
require.NoError(t, err)
|
||||
bz2, err := io.ReadAll(fo)
|
||||
bz2, err := ioutil.ReadAll(fo)
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, fo.Close())
|
||||
require.Equal(t, inputContents, bz2)
|
||||
@@ -106,7 +107,7 @@ func TestRoundtripUnixFS_Filestore(t *testing.T) {
|
||||
// ensure contents of the initial input file and the output file are identical.
|
||||
fo, err := os.Open(tmpOutput)
|
||||
require.NoError(t, err)
|
||||
bz2, err := io.ReadAll(fo)
|
||||
bz2, err := ioutil.ReadAll(fo)
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, fo.Close())
|
||||
require.Equal(t, inputContents, bz2)
|
||||
|
||||
@@ -4,6 +4,7 @@ package dagstore
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/url"
|
||||
"strings"
|
||||
"testing"
|
||||
@@ -38,7 +39,7 @@ func TestLotusMount(t *testing.T) {
|
||||
io.ReaderAt
|
||||
io.Seeker
|
||||
}{
|
||||
ReadCloser: io.NopCloser(strings.NewReader("testing")),
|
||||
ReadCloser: ioutil.NopCloser(strings.NewReader("testing")),
|
||||
ReaderAt: nil,
|
||||
Seeker: nil,
|
||||
}
|
||||
@@ -47,7 +48,7 @@ func TestLotusMount(t *testing.T) {
|
||||
io.ReaderAt
|
||||
io.Seeker
|
||||
}{
|
||||
ReadCloser: io.NopCloser(strings.NewReader("testing")),
|
||||
ReadCloser: ioutil.NopCloser(strings.NewReader("testing")),
|
||||
ReaderAt: nil,
|
||||
Seeker: nil,
|
||||
}
|
||||
@@ -65,7 +66,7 @@ func TestLotusMount(t *testing.T) {
|
||||
rd, err := mnt.Fetch(context.Background())
|
||||
require.NoError(t, err)
|
||||
|
||||
bz, err := io.ReadAll(rd)
|
||||
bz, err := ioutil.ReadAll(rd)
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, rd.Close())
|
||||
require.Equal(t, []byte("testing"), bz)
|
||||
@@ -84,7 +85,7 @@ func TestLotusMount(t *testing.T) {
|
||||
// fetching on this mount should get us back the same data.
|
||||
rd, err = mnt2.Fetch(context.Background())
|
||||
require.NoError(t, err)
|
||||
bz, err = io.ReadAll(rd)
|
||||
bz, err = ioutil.ReadAll(rd)
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, rd.Close())
|
||||
require.Equal(t, []byte("testing"), bz)
|
||||
|
||||
@@ -2,13 +2,14 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"sort"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func run() error {
|
||||
tfb, err := os.ReadFile("./node/config/types.go")
|
||||
tfb, err := ioutil.ReadFile("./node/config/types.go")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
+2
-1
@@ -4,6 +4,7 @@ import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"reflect"
|
||||
"regexp"
|
||||
@@ -46,7 +47,7 @@ func FromFile(path string, opts ...LoadCfgOpt) (interface{}, error) {
|
||||
return nil, err
|
||||
}
|
||||
defer file.Close() //nolint:errcheck,staticcheck // The file is RO
|
||||
cfgBs, err := io.ReadAll(file)
|
||||
cfgBs, err := ioutil.ReadAll(file)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("failed to read config for validation checks %w", err)
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package config
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -49,7 +50,7 @@ func TestParitalConfig(t *testing.T) {
|
||||
}
|
||||
|
||||
{
|
||||
f, err := os.CreateTemp("", "config-*.toml")
|
||||
f, err := ioutil.TempFile("", "config-*.toml")
|
||||
fname := f.Name()
|
||||
|
||||
assert.NoError(err, "tmp file shold not error")
|
||||
@@ -114,7 +115,7 @@ func TestValidateConfigSetsEnableSplitstore(t *testing.T) {
|
||||
assert.False(t, MatchEnableSplitstoreField(string(cfgCommentedOutEnableSS)))
|
||||
|
||||
// write config with commented out EnableSplitstore to file
|
||||
f, err := os.CreateTemp("", "config.toml")
|
||||
f, err := ioutil.TempFile("", "config.toml")
|
||||
fname := f.Name()
|
||||
assert.NoError(t, err)
|
||||
defer func() {
|
||||
@@ -131,7 +132,7 @@ func TestValidateConfigSetsEnableSplitstore(t *testing.T) {
|
||||
|
||||
// Loading without a config file and a default fails if the default fallback is disabled
|
||||
func TestFailToFallbackToDefault(t *testing.T) {
|
||||
dir, err := os.MkdirTemp("", "dirWithNoFiles")
|
||||
dir, err := ioutil.TempDir("", "dirWithNoFiles")
|
||||
assert.NoError(t, err)
|
||||
defer assert.NoError(t, os.RemoveAll(dir))
|
||||
nonExistantFileName := dir + "/notarealfile"
|
||||
|
||||
@@ -3,6 +3,7 @@ package config
|
||||
import (
|
||||
"encoding/json"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"golang.org/x/xerrors"
|
||||
@@ -42,7 +43,7 @@ func WriteStorageFile(path string, config storiface.StorageConfig) error {
|
||||
return xerrors.Errorf("marshaling storage config: %w", err)
|
||||
}
|
||||
|
||||
if err := os.WriteFile(path, b, 0644); err != nil {
|
||||
if err := ioutil.WriteFile(path, b, 0644); err != nil {
|
||||
return xerrors.Errorf("persisting storage config (%s): %w", path, err)
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"embed"
|
||||
"os"
|
||||
"io/ioutil"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
@@ -77,7 +77,7 @@ func TestImportLocal(t *testing.T) {
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
outBytes, err := os.ReadFile(out1)
|
||||
outBytes, err := ioutil.ReadFile(out1)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, b, outBytes)
|
||||
|
||||
@@ -128,7 +128,7 @@ func TestImportLocal(t *testing.T) {
|
||||
err = files.WriteTo(file, exportedPath)
|
||||
require.NoError(t, err)
|
||||
|
||||
exportedBytes, err := os.ReadFile(exportedPath)
|
||||
exportedBytes, err := ioutil.ReadFile(exportedPath)
|
||||
require.NoError(t, err)
|
||||
|
||||
// compare original file to recreated unixfs file.
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"crypto/rand"
|
||||
"errors"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
@@ -146,7 +147,7 @@ func APISecret(keystore types.KeyStore, lr repo.LockedRepo) (*dtypes.APIAlg, err
|
||||
if errors.Is(err, types.ErrKeyInfoNotFound) {
|
||||
log.Warn("Generating new API secret")
|
||||
|
||||
sk, err := io.ReadAll(io.LimitReader(rand.Reader, 32))
|
||||
sk, err := ioutil.ReadAll(io.LimitReader(rand.Reader, 32))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"github.com/ipfs/go-blockservice"
|
||||
@@ -59,7 +60,7 @@ func MakeGenesis(outFile, genesisTemplate string) func(bs dtypes.ChainBlockstore
|
||||
return nil, err
|
||||
}
|
||||
|
||||
fdata, err := os.ReadFile(genesisTemplate)
|
||||
fdata, err := ioutil.ReadFile(genesisTemplate)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("reading preseals json: %w", err)
|
||||
}
|
||||
|
||||
+8
-7
@@ -6,6 +6,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@@ -328,7 +329,7 @@ func (fsr *FsRepo) APIEndpoint() (multiaddr.Multiaddr, error) {
|
||||
}
|
||||
defer f.Close() //nolint: errcheck // Read only op
|
||||
|
||||
data, err := io.ReadAll(f)
|
||||
data, err := ioutil.ReadAll(f)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("failed to read %q: %w", p, err)
|
||||
}
|
||||
@@ -353,7 +354,7 @@ func (fsr *FsRepo) APIToken() ([]byte, error) {
|
||||
}
|
||||
defer f.Close() //nolint: errcheck // Read only op
|
||||
|
||||
tb, err := io.ReadAll(f)
|
||||
tb, err := ioutil.ReadAll(f)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -581,7 +582,7 @@ func (fsr *fsLockedRepo) SetConfig(c func(interface{})) error {
|
||||
}
|
||||
|
||||
// write buffer of TOML bytes to config file
|
||||
err = os.WriteFile(fsr.configPath, buf.Bytes(), 0644)
|
||||
err = ioutil.WriteFile(fsr.configPath, buf.Bytes(), 0644)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -634,14 +635,14 @@ func (fsr *fsLockedRepo) SetAPIEndpoint(ma multiaddr.Multiaddr) error {
|
||||
if err := fsr.stillValid(); err != nil {
|
||||
return err
|
||||
}
|
||||
return os.WriteFile(fsr.join(fsAPI), []byte(ma.String()), 0644)
|
||||
return ioutil.WriteFile(fsr.join(fsAPI), []byte(ma.String()), 0644)
|
||||
}
|
||||
|
||||
func (fsr *fsLockedRepo) SetAPIToken(token []byte) error {
|
||||
if err := fsr.stillValid(); err != nil {
|
||||
return err
|
||||
}
|
||||
return os.WriteFile(fsr.join(fsAPIToken), token, 0600)
|
||||
return ioutil.WriteFile(fsr.join(fsAPIToken), token, 0600)
|
||||
}
|
||||
|
||||
func (fsr *fsLockedRepo) KeyStore() (types.KeyStore, error) {
|
||||
@@ -710,7 +711,7 @@ func (fsr *fsLockedRepo) Get(name string) (types.KeyInfo, error) {
|
||||
}
|
||||
defer file.Close() //nolint: errcheck // read only op
|
||||
|
||||
data, err := io.ReadAll(file)
|
||||
data, err := ioutil.ReadAll(file)
|
||||
if err != nil {
|
||||
return types.KeyInfo{}, xerrors.Errorf("reading key '%s': %w", name, err)
|
||||
}
|
||||
@@ -759,7 +760,7 @@ func (fsr *fsLockedRepo) put(rawName string, info types.KeyInfo, retries int) er
|
||||
return xerrors.Errorf("encoding key '%s': %w", name, err)
|
||||
}
|
||||
|
||||
err = os.WriteFile(keyPath, keyData, 0600)
|
||||
err = ioutil.WriteFile(keyPath, keyData, 0600)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("writing key '%s': %w", name, err)
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package repo
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sync"
|
||||
@@ -102,7 +103,7 @@ func (lmem *lockedMemRepo) Path() string {
|
||||
return lmem.mem.tempDir
|
||||
}
|
||||
|
||||
t, err := os.MkdirTemp(os.TempDir(), "lotus-memrepo-temp-")
|
||||
t, err := ioutil.TempDir(os.TempDir(), "lotus-memrepo-temp-")
|
||||
if err != nil {
|
||||
panic(err) // only used in tests, probably fine
|
||||
}
|
||||
@@ -141,7 +142,7 @@ func (lmem *lockedMemRepo) initSectorStore(t string) {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
if err := os.WriteFile(filepath.Join(t, "sectorstore.json"), b, 0644); err != nil {
|
||||
if err := ioutil.WriteFile(filepath.Join(t, "sectorstore.json"), b, 0644); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package paths_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
@@ -378,7 +378,7 @@ func TestRemoteGetSector(t *testing.T) {
|
||||
|
||||
if !tc.isDir {
|
||||
// create file
|
||||
tempFile, err := os.CreateTemp("", "TestRemoteGetSector-")
|
||||
tempFile, err := ioutil.TempFile("", "TestRemoteGetSector-")
|
||||
require.NoError(t, err)
|
||||
|
||||
defer func() {
|
||||
@@ -390,7 +390,7 @@ func TestRemoteGetSector(t *testing.T) {
|
||||
path = tempFile.Name()
|
||||
} else {
|
||||
// create dir with a file
|
||||
tempFile2, err := os.CreateTemp("", "TestRemoteGetSector-")
|
||||
tempFile2, err := ioutil.TempFile("", "TestRemoteGetSector-")
|
||||
require.NoError(t, err)
|
||||
defer func() {
|
||||
_ = os.Remove(tempFile2.Name())
|
||||
@@ -435,7 +435,7 @@ func TestRemoteGetSector(t *testing.T) {
|
||||
_ = resp.Body.Close()
|
||||
}()
|
||||
|
||||
bz, err := io.ReadAll(resp.Body)
|
||||
bz, err := ioutil.ReadAll(resp.Body)
|
||||
require.NoError(t, err)
|
||||
|
||||
// assert expected status code
|
||||
|
||||
@@ -3,6 +3,7 @@ package paths
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"math/bits"
|
||||
"math/rand"
|
||||
"os"
|
||||
@@ -150,7 +151,7 @@ func (st *Local) OpenPath(ctx context.Context, p string) error {
|
||||
st.localLk.Lock()
|
||||
defer st.localLk.Unlock()
|
||||
|
||||
mb, err := os.ReadFile(filepath.Join(p, MetaFile))
|
||||
mb, err := ioutil.ReadFile(filepath.Join(p, MetaFile))
|
||||
if err != nil {
|
||||
return xerrors.Errorf("reading storage metadata for %s: %w", p, err)
|
||||
}
|
||||
@@ -246,7 +247,7 @@ func (st *Local) Redeclare(ctx context.Context, filterId *storiface.ID, dropMiss
|
||||
defer st.localLk.Unlock()
|
||||
|
||||
for id, p := range st.paths {
|
||||
mb, err := os.ReadFile(filepath.Join(p.local, MetaFile))
|
||||
mb, err := ioutil.ReadFile(filepath.Join(p.local, MetaFile))
|
||||
if err != nil {
|
||||
return xerrors.Errorf("reading storage metadata for %s: %w", p.local, err)
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package paths
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
@@ -62,7 +63,7 @@ func (t *TestingLocalStorage) init(subpath string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := os.WriteFile(metaFile, mb, 0644); err != nil {
|
||||
if err := ioutil.WriteFile(metaFile, mb, 0644); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"math/bits"
|
||||
"net/http"
|
||||
"net/url"
|
||||
@@ -411,7 +412,7 @@ func (r *Remote) FsStat(ctx context.Context, id storiface.ID) (fsutil.FsStat, er
|
||||
case 404:
|
||||
return fsutil.FsStat{}, errPathNotFound
|
||||
case 500:
|
||||
b, err := io.ReadAll(resp.Body)
|
||||
b, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return fsutil.FsStat{}, xerrors.Errorf("fsstat: got http 500, then failed to read the error: %w", err)
|
||||
}
|
||||
@@ -767,7 +768,7 @@ func (r *Remote) GenerateSingleVanillaProof(ctx context.Context, minerID abi.Act
|
||||
log.Debugw("reading vanilla proof from remote not-found response", "url", url, "store", info.ID)
|
||||
continue
|
||||
}
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("resp.Body ReadAll: %w", err)
|
||||
}
|
||||
@@ -779,7 +780,7 @@ func (r *Remote) GenerateSingleVanillaProof(ctx context.Context, minerID abi.Act
|
||||
return nil, xerrors.Errorf("non-200 code from %s: '%s'", url, strings.TrimSpace(string(body)))
|
||||
}
|
||||
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
if err := resp.Body.Close(); err != nil {
|
||||
log.Error("response close: ", err)
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
@@ -47,7 +48,7 @@ func createTestStorage(t *testing.T, p string, seal bool, att ...*paths.Local) s
|
||||
b, err := json.MarshalIndent(cfg, "", " ")
|
||||
require.NoError(t, err)
|
||||
|
||||
require.NoError(t, os.WriteFile(filepath.Join(p, metaFile), b, 0644))
|
||||
require.NoError(t, ioutil.WriteFile(filepath.Join(p, metaFile), b, 0644))
|
||||
|
||||
for _, s := range att {
|
||||
require.NoError(t, s.OpenPath(context.Background(), p))
|
||||
@@ -129,7 +130,7 @@ func TestMoveShared(t *testing.T) {
|
||||
|
||||
data := make([]byte, 2032)
|
||||
data[1] = 54
|
||||
require.NoError(t, os.WriteFile(sp.Sealed, data, 0666))
|
||||
require.NoError(t, ioutil.WriteFile(sp.Sealed, data, 0666))
|
||||
fmt.Println("write to ", sp.Sealed)
|
||||
|
||||
require.NoError(t, index.StorageDeclareSector(ctx, storiface.ID(sid.Sealed), s1ref.ID, storiface.FTSealed, true))
|
||||
@@ -144,7 +145,7 @@ func TestMoveShared(t *testing.T) {
|
||||
require.Equal(t, id1, storiface.ID(sid.Sealed))
|
||||
fmt.Println("read from ", sp.Sealed)
|
||||
|
||||
read, err := os.ReadFile(sp.Sealed)
|
||||
read, err := ioutil.ReadFile(sp.Sealed)
|
||||
require.NoError(t, err)
|
||||
require.EqualValues(t, data, read)
|
||||
}
|
||||
@@ -356,7 +357,7 @@ func TestReader(t *testing.T) {
|
||||
mockCheckAllocation(pf, offset, size, emptyPartialFile,
|
||||
true, nil)
|
||||
|
||||
f, err := os.CreateTemp("", "TestReader-")
|
||||
f, err := ioutil.TempFile("", "TestReader-")
|
||||
require.NoError(t, err)
|
||||
_, err = f.Write(bz)
|
||||
require.NoError(t, err)
|
||||
@@ -501,7 +502,7 @@ func TestReader(t *testing.T) {
|
||||
require.NoError(t, os.Remove(f.Name()))
|
||||
}
|
||||
|
||||
bz, err := io.ReadAll(rd)
|
||||
bz, err := ioutil.ReadAll(rd)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, tc.expectedSectorBytes, bz)
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"math/bits"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -1094,7 +1095,7 @@ func (sb *Sealer) FinalizeSectorInto(ctx context.Context, sector storiface.Secto
|
||||
}
|
||||
defer done()
|
||||
|
||||
files, err := os.ReadDir(paths.Cache)
|
||||
files, err := ioutil.ReadDir(paths.Cache)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"math/rand"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -129,7 +130,7 @@ func (s *seal) unseal(t *testing.T, sb *Sealer, sp *basicfs.Provider, si storifa
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
expect, _ := io.ReadAll(data(si.ID.Number, 1016))
|
||||
expect, _ := ioutil.ReadAll(data(si.ID.Number, 1016))
|
||||
if !bytes.Equal(b.Bytes(), expect) {
|
||||
t.Fatal("read wrong bytes")
|
||||
}
|
||||
@@ -159,7 +160,7 @@ func (s *seal) unseal(t *testing.T, sb *Sealer, sp *basicfs.Provider, si storifa
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
expect, _ = io.ReadAll(data(si.ID.Number, 1016))
|
||||
expect, _ = ioutil.ReadAll(data(si.ID.Number, 1016))
|
||||
require.Equal(t, expect, b.Bytes())
|
||||
|
||||
b.Reset()
|
||||
@@ -239,12 +240,12 @@ func corrupt(t *testing.T, sealer *Sealer, id storiface.SectorRef) {
|
||||
}
|
||||
|
||||
func getGrothParamFileAndVerifyingKeys(s abi.SectorSize) {
|
||||
dat, err := os.ReadFile("../../../build/proof-params/parameters.json")
|
||||
dat, err := ioutil.ReadFile("../../../build/proof-params/parameters.json")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
datSrs, err := os.ReadFile("../../../build/proof-params/srs-inner-product.json")
|
||||
datSrs, err := ioutil.ReadFile("../../../build/proof-params/srs-inner-product.json")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -280,7 +281,7 @@ func TestSealAndVerify(t *testing.T) {
|
||||
|
||||
getGrothParamFileAndVerifyingKeys(sectorSize)
|
||||
|
||||
cdir, err := os.MkdirTemp("", "sbtest-c-")
|
||||
cdir, err := ioutil.TempDir("", "sbtest-c-")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -351,7 +352,7 @@ func TestSealPoStNoCommit(t *testing.T) {
|
||||
|
||||
getGrothParamFileAndVerifyingKeys(sectorSize)
|
||||
|
||||
dir, err := os.MkdirTemp("", "sbtest")
|
||||
dir, err := ioutil.TempDir("", "sbtest")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -415,7 +416,7 @@ func TestSealAndVerify3(t *testing.T) {
|
||||
|
||||
getGrothParamFileAndVerifyingKeys(sectorSize)
|
||||
|
||||
dir, err := os.MkdirTemp("", "sbtest")
|
||||
dir, err := ioutil.TempDir("", "sbtest")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -493,7 +494,7 @@ func TestSealAndVerifyAggregate(t *testing.T) {
|
||||
|
||||
getGrothParamFileAndVerifyingKeys(sectorSize)
|
||||
|
||||
cdir, err := os.MkdirTemp("", "sbtest-c-")
|
||||
cdir, err := ioutil.TempDir("", "sbtest-c-")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -575,7 +576,7 @@ func BenchmarkWriteWithAlignment(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
b.StopTimer()
|
||||
rf, w, _ := commpffi.ToReadableFile(bytes.NewReader(bytes.Repeat([]byte{0xff, 0}, int(bt/2))), int64(bt))
|
||||
tf, _ := os.CreateTemp("/tmp/", "scrb-")
|
||||
tf, _ := ioutil.TempFile("/tmp/", "scrb-")
|
||||
b.StartTimer()
|
||||
|
||||
ffi.WriteWithAlignment(abi.RegisteredSealProof_StackedDrg2KiBV1, rf, bt, tf, nil) // nolint:errcheck
|
||||
@@ -734,7 +735,7 @@ func TestGenerateUnsealedCID(t *testing.T) {
|
||||
func TestAddPiece512M(t *testing.T) {
|
||||
sz := abi.PaddedPieceSize(512 << 20).Unpadded()
|
||||
|
||||
cdir, err := os.MkdirTemp("", "sbtest-c-")
|
||||
cdir, err := ioutil.TempDir("", "sbtest-c-")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -778,7 +779,7 @@ func BenchmarkAddPiece512M(b *testing.B) {
|
||||
sz := abi.PaddedPieceSize(512 << 20).Unpadded()
|
||||
b.SetBytes(int64(sz))
|
||||
|
||||
cdir, err := os.MkdirTemp("", "sbtest-c-")
|
||||
cdir, err := ioutil.TempDir("", "sbtest-c-")
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
@@ -820,7 +821,7 @@ func BenchmarkAddPiece512M(b *testing.B) {
|
||||
func TestAddPiece512MPadded(t *testing.T) {
|
||||
sz := abi.PaddedPieceSize(512 << 20).Unpadded()
|
||||
|
||||
cdir, err := os.MkdirTemp("", "sbtest-c-")
|
||||
cdir, err := ioutil.TempDir("", "sbtest-c-")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -889,7 +890,7 @@ func TestMulticoreSDR(t *testing.T) {
|
||||
|
||||
getGrothParamFileAndVerifyingKeys(sectorSize)
|
||||
|
||||
dir, err := os.MkdirTemp("", "sbtest")
|
||||
dir, err := ioutil.TempDir("", "sbtest")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -994,7 +995,7 @@ func TestPoStChallengeAssumptions(t *testing.T) {
|
||||
func TestDCAPCloses(t *testing.T) {
|
||||
sz := abi.PaddedPieceSize(2 << 10).Unpadded()
|
||||
|
||||
cdir, err := os.MkdirTemp("", "sbtest-c-")
|
||||
cdir, err := ioutil.TempDir("", "sbtest-c-")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package fr32_test
|
||||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
@@ -16,7 +17,7 @@ import (
|
||||
)
|
||||
|
||||
func TestWriteTwoPcs(t *testing.T) {
|
||||
tf, _ := os.CreateTemp("/tmp/", "scrb-")
|
||||
tf, _ := ioutil.TempFile("/tmp/", "scrb-")
|
||||
|
||||
paddedSize := abi.PaddedPieceSize(16 << 20)
|
||||
n := 2
|
||||
@@ -42,7 +43,7 @@ func TestWriteTwoPcs(t *testing.T) {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
ffiBytes, err := io.ReadAll(tf)
|
||||
ffiBytes, err := ioutil.ReadAll(tf)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package fr32_test
|
||||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"math/rand"
|
||||
"os"
|
||||
"testing"
|
||||
@@ -18,7 +19,7 @@ import (
|
||||
|
||||
func padFFI(buf []byte) []byte {
|
||||
rf, w, _ := commpffi.ToReadableFile(bytes.NewReader(buf), int64(len(buf)))
|
||||
tf, _ := os.CreateTemp("/tmp/", "scrb-")
|
||||
tf, _ := ioutil.TempFile("/tmp/", "scrb-")
|
||||
|
||||
_, _, _, err := ffi.WriteWithAlignment(abi.RegisteredSealProof_StackedDrg32GiBV1, rf, abi.UnpaddedPieceSize(len(buf)), tf, nil)
|
||||
if err != nil {
|
||||
@@ -32,7 +33,7 @@ func padFFI(buf []byte) []byte {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
padded, err := io.ReadAll(tf)
|
||||
padded, err := ioutil.ReadAll(tf)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package fr32_test
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
@@ -27,7 +27,7 @@ func TestUnpadReader(t *testing.T) {
|
||||
}
|
||||
|
||||
// using bufio reader to make sure reads are big enough for the padreader - it can't handle small reads right now
|
||||
readered, err := io.ReadAll(bufio.NewReaderSize(r, 512))
|
||||
readered, err := ioutil.ReadAll(bufio.NewReaderSize(r, 512))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@@ -45,7 +46,7 @@ func (t testStorage) DiskUsage(path string) (int64, error) {
|
||||
}
|
||||
|
||||
func newTestStorage(t *testing.T) *testStorage {
|
||||
tp, err := os.MkdirTemp(os.TempDir(), "sealer-test-")
|
||||
tp, err := ioutil.TempDir(os.TempDir(), "sealer-test-")
|
||||
require.NoError(t, err)
|
||||
|
||||
{
|
||||
@@ -57,7 +58,7 @@ func newTestStorage(t *testing.T) *testStorage {
|
||||
}, "", " ")
|
||||
require.NoError(t, err)
|
||||
|
||||
err = os.WriteFile(filepath.Join(tp, "sectorstore.json"), b, 0644)
|
||||
err = ioutil.WriteFile(filepath.Join(tp, "sectorstore.json"), b, 0644)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"crypto/sha256"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"math/rand"
|
||||
"sync"
|
||||
|
||||
@@ -460,7 +461,7 @@ func (mgr *SectorMgr) ReadPiece(ctx context.Context, sector storiface.SectorRef,
|
||||
io.Seeker
|
||||
io.ReaderAt
|
||||
}{
|
||||
ReadCloser: io.NopCloser(br),
|
||||
ReadCloser: ioutil.NopCloser(br),
|
||||
Seeker: br,
|
||||
ReaderAt: br,
|
||||
}, false, nil
|
||||
|
||||
@@ -3,7 +3,7 @@ package sealer
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"math/rand"
|
||||
"net"
|
||||
"net/http"
|
||||
@@ -346,7 +346,7 @@ func (p *pieceProviderTestHarness) readPiece(t *testing.T, offset storiface.Unpa
|
||||
defer func() { _ = rd.Close() }()
|
||||
|
||||
// Make sure the input matches the output
|
||||
readData, err := io.ReadAll(rd)
|
||||
readData, err := ioutil.ReadAll(rd)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, expectedBytes, readData)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user