Merge pull request #10594 from filecoin-project/phi/v1210-rc2
build: release: v1.21.0-rc2
This commit is contained in:
commit
caa6dd9c41
24
CHANGELOG.md
24
CHANGELOG.md
@ -1,6 +1,6 @@
|
|||||||
# Lotus changelog
|
# Lotus changelog
|
||||||
|
|
||||||
# v1.21.0-rc1 / 2023-03-21
|
# v1.21.0-rc2 / 2023-03-29
|
||||||
|
|
||||||
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.
|
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,7 +11,10 @@ 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!**
|
- 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.
|
- 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 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.
|
||||||
- **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**
|
- **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)
|
||||||
|
|
||||||
## Highlights
|
## Highlights
|
||||||
|
|
||||||
@ -26,8 +29,10 @@ SplitStore also has some new configuration settings that you can set in your con
|
|||||||
|
|
||||||
The SplitStore also has two new commands:
|
The SplitStore also has two new commands:
|
||||||
|
|
||||||
- `lotus chain prune hot` will run an online (badger vlog) garbage collection on the hotstore.
|
- `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 an moving garbage collection the hotstore
|
- `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).
|
||||||
|
|
||||||
**RPC API improvements**
|
**RPC API improvements**
|
||||||
|
|
||||||
@ -98,6 +103,12 @@ The `lotus-Miner sector list` is now running in parallel - which should speed up
|
|||||||
|
|
||||||
## Improvements
|
## 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))
|
- 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.
|
- 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))
|
- fix: splitstore: Demote now common logs (#10516) ([filecoin-project/lotus#10516](https://github.com/filecoin-project/lotus/pull/10516))
|
||||||
@ -171,6 +182,9 @@ 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-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-jsonrpc (v0.2.1 -> v0.2.3):
|
||||||
- github.com/filecoin-project/go-statemachine (v1.0.2 -> v1.0.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-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))
|
- 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))
|
- Update to go-data-transfer v2 and libp2p, still wip ([filecoin-project/lotus#10382](https://github.com/filecoin-project/lotus/pull/10382))
|
||||||
@ -178,6 +192,7 @@ 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: 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: 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: 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
|
## Others
|
||||||
- Update service_developer_bug_report.yml ([filecoin-project/lotus#10321](https://github.com/filecoin-project/lotus/pull/10321))
|
- Update service_developer_bug_report.yml ([filecoin-project/lotus#10321](https://github.com/filecoin-project/lotus/pull/10321))
|
||||||
@ -207,6 +222,7 @@ 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 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))
|
- 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: 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))
|
- 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))
|
- 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))
|
- chore: docs: fix docs typos ([filecoin-project/lotus#10155](https://github.com/filecoin-project/lotus/pull/10155))
|
||||||
|
@ -3,7 +3,7 @@ package blockstore
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"io/ioutil"
|
"io"
|
||||||
|
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
httpapi "github.com/ipfs/go-ipfs-http-client"
|
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)
|
return nil, xerrors.Errorf("getting ipfs block: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
data, err := ioutil.ReadAll(rd)
|
data, err := io.ReadAll(rd)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -37,7 +37,7 @@ func BuildTypeString() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// BuildVersion is the local build version
|
// BuildVersion is the local build version
|
||||||
const BuildVersion = "1.21.0-rc1"
|
const BuildVersion = "1.21.0-rc2"
|
||||||
|
|
||||||
func UserVersion() string {
|
func UserVersion() string {
|
||||||
if os.Getenv("LOTUS_VERSION_IGNORE_COMMIT") == "1" {
|
if os.Getenv("LOTUS_VERSION_IGNORE_COMMIT") == "1" {
|
||||||
|
@ -4,7 +4,6 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"go/format"
|
"go/format"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
@ -66,7 +65,7 @@ func generateAdapters() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
af, err := ioutil.ReadFile(filepath.Join(actDir, "actor.go.template"))
|
af, err := os.ReadFile(filepath.Join(actDir, "actor.go.template"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("loading actor template: %w", err)
|
return xerrors.Errorf("loading actor template: %w", err)
|
||||||
}
|
}
|
||||||
@ -90,7 +89,7 @@ func generateAdapters() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ioutil.WriteFile(filepath.Join(actDir, fmt.Sprintf("%s.go", act)), fmted, 0666); err != nil {
|
if err := os.WriteFile(filepath.Join(actDir, fmt.Sprintf("%s.go", act)), fmted, 0666); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -100,7 +99,7 @@ func generateAdapters() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func generateState(actDir string, versions []int) error {
|
func generateState(actDir string, versions []int) error {
|
||||||
af, err := ioutil.ReadFile(filepath.Join(actDir, "state.go.template"))
|
af, err := os.ReadFile(filepath.Join(actDir, "state.go.template"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
return nil // skip
|
return nil // skip
|
||||||
@ -123,7 +122,7 @@ func generateState(actDir string, versions []int) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ioutil.WriteFile(filepath.Join(actDir, fmt.Sprintf("v%d.go", version)), b.Bytes(), 0666); err != nil {
|
if err := os.WriteFile(filepath.Join(actDir, fmt.Sprintf("v%d.go", version)), b.Bytes(), 0666); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -132,7 +131,7 @@ func generateState(actDir string, versions []int) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func generateMessages(actDir string) error {
|
func generateMessages(actDir string) error {
|
||||||
af, err := ioutil.ReadFile(filepath.Join(actDir, "message.go.template"))
|
af, err := os.ReadFile(filepath.Join(actDir, "message.go.template"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
return nil // skip
|
return nil // skip
|
||||||
@ -155,7 +154,7 @@ func generateMessages(actDir string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ioutil.WriteFile(filepath.Join(actDir, fmt.Sprintf("message%d.go", version)), b.Bytes(), 0666); err != nil {
|
if err := os.WriteFile(filepath.Join(actDir, fmt.Sprintf("message%d.go", version)), b.Bytes(), 0666); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -165,7 +164,7 @@ func generateMessages(actDir string) error {
|
|||||||
|
|
||||||
func generatePolicy(policyPath string) error {
|
func generatePolicy(policyPath string) error {
|
||||||
|
|
||||||
pf, err := ioutil.ReadFile(policyPath + ".template")
|
pf, err := os.ReadFile(policyPath + ".template")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
return nil // skip
|
return nil // skip
|
||||||
@ -187,7 +186,7 @@ func generatePolicy(policyPath string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ioutil.WriteFile(policyPath, b.Bytes(), 0666); err != nil {
|
if err := os.WriteFile(policyPath, b.Bytes(), 0666); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,7 +195,7 @@ func generatePolicy(policyPath string) error {
|
|||||||
|
|
||||||
func generateBuiltin(builtinPath string) error {
|
func generateBuiltin(builtinPath string) error {
|
||||||
|
|
||||||
bf, err := ioutil.ReadFile(builtinPath + ".template")
|
bf, err := os.ReadFile(builtinPath + ".template")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
return nil // skip
|
return nil // skip
|
||||||
@ -218,7 +217,7 @@ func generateBuiltin(builtinPath string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ioutil.WriteFile(builtinPath, b.Bytes(), 0666); err != nil {
|
if err := os.WriteFile(builtinPath, b.Bytes(), 0666); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,7 +226,7 @@ func generateBuiltin(builtinPath string) error {
|
|||||||
|
|
||||||
func generateRegistry(registryPath string) error {
|
func generateRegistry(registryPath string) error {
|
||||||
|
|
||||||
bf, err := ioutil.ReadFile(registryPath + ".template")
|
bf, err := os.ReadFile(registryPath + ".template")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
return nil // skip
|
return nil // skip
|
||||||
@ -248,7 +247,7 @@ func generateRegistry(registryPath string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ioutil.WriteFile(registryPath, b.Bytes(), 0666); err != nil {
|
if err := os.WriteFile(registryPath, b.Bytes(), 0666); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"os"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -167,7 +167,7 @@ func NewGeneratorWithSectorsAndUpgradeSchedule(numSectors int, us stmgr.UpgradeS
|
|||||||
|
|
||||||
maddr1 := genesis2.MinerAddress(0)
|
maddr1 := genesis2.MinerAddress(0)
|
||||||
|
|
||||||
m1temp, err := ioutil.TempDir("", "preseal")
|
m1temp, err := os.MkdirTemp("", "preseal")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -179,7 +179,7 @@ func NewGeneratorWithSectorsAndUpgradeSchedule(numSectors int, us stmgr.UpgradeS
|
|||||||
|
|
||||||
maddr2 := genesis2.MinerAddress(1)
|
maddr2 := genesis2.MinerAddress(1)
|
||||||
|
|
||||||
m2temp, err := ioutil.TempDir("", "preseal")
|
m2temp, err := os.MkdirTemp("", "preseal")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"html/template"
|
"html/template"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"reflect"
|
"reflect"
|
||||||
"sort"
|
"sort"
|
||||||
@ -1090,7 +1089,7 @@ var StateComputeStateCmd = &cli.Command{
|
|||||||
|
|
||||||
var stout *lapi.ComputeStateOutput
|
var stout *lapi.ComputeStateOutput
|
||||||
if csofile := cctx.String("compute-state-output"); csofile != "" {
|
if csofile := cctx.String("compute-state-output"); csofile != "" {
|
||||||
data, err := ioutil.ReadFile(csofile)
|
data, err := os.ReadFile(csofile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"path"
|
"path"
|
||||||
@ -65,7 +64,7 @@ func ClientExportStream(apiAddr string, apiAuth http.Header, eref api.ExportRef,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if resp.StatusCode != http.StatusOK {
|
if resp.StatusCode != http.StatusOK {
|
||||||
em, err := ioutil.ReadAll(resp.Body)
|
em, err := io.ReadAll(resp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, xerrors.Errorf("reading error body: %w", err)
|
return nil, xerrors.Errorf("reading error body: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@ import (
|
|||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@ -337,7 +336,7 @@ var walletImport = &cli.Command{
|
|||||||
inpdata = indata
|
inpdata = indata
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
fdata, err := ioutil.ReadFile(cctx.Args().First())
|
fdata, err := os.ReadFile(cctx.Args().First())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"math"
|
"math"
|
||||||
"net/http"
|
"net/http"
|
||||||
_ "net/http/pprof"
|
_ "net/http/pprof"
|
||||||
@ -158,7 +157,7 @@ var importBenchCmd = &cli.Command{
|
|||||||
if rdir := cctx.String("repodir"); rdir != "" {
|
if rdir := cctx.String("repodir"); rdir != "" {
|
||||||
tdir = rdir
|
tdir = rdir
|
||||||
} else {
|
} else {
|
||||||
tmp, err := ioutil.TempDir("", "lotus-import-bench")
|
tmp, err := os.MkdirTemp("", "lotus-import-bench")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"math/big"
|
"math/big"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"os"
|
"os"
|
||||||
@ -197,7 +196,7 @@ var sealBenchCmd = &cli.Command{
|
|||||||
return xerrors.Errorf("creating sectorbuilder dir: %w", err)
|
return xerrors.Errorf("creating sectorbuilder dir: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
tsdir, err := ioutil.TempDir(sdir, "bench")
|
tsdir, err := os.MkdirTemp(sdir, "bench")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -287,7 +286,7 @@ var sealBenchCmd = &cli.Command{
|
|||||||
// sectorbuilder directory... we need a better way to handle
|
// sectorbuilder directory... we need a better way to handle
|
||||||
// this in other cases
|
// this in other cases
|
||||||
|
|
||||||
fdata, err := ioutil.ReadFile(filepath.Join(sbdir, "pre-seal-"+maddr.String()+".json"))
|
fdata, err := os.ReadFile(filepath.Join(sbdir, "pre-seal-"+maddr.String()+".json"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -637,7 +636,7 @@ func runSeals(sb *ffiwrapper.Sealer, sbfs *basicfs.Provider, numSectors int, par
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ioutil.WriteFile(saveC2inp, b, 0664); err != nil {
|
if err := os.WriteFile(saveC2inp, b, 0664); err != nil {
|
||||||
log.Warnf("%+v", err)
|
log.Warnf("%+v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -751,7 +750,7 @@ var proveCmd = &cli.Command{
|
|||||||
return xerrors.Errorf("Usage: lotus-bench prove [input.json]")
|
return xerrors.Errorf("Usage: lotus-bench prove [input.json]")
|
||||||
}
|
}
|
||||||
|
|
||||||
inb, err := ioutil.ReadFile(c.Args().First())
|
inb, err := os.ReadFile(c.Args().First())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("reading input file: %w", err)
|
return xerrors.Errorf("reading input file: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ import (
|
|||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
@ -444,7 +443,7 @@ var simpleCommit1 = &cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ioutil.WriteFile(cctx.Args().Get(4), b, 0664); err != nil {
|
if err := os.WriteFile(cctx.Args().Get(4), b, 0664); err != nil {
|
||||||
log.Warnf("%+v", err)
|
log.Warnf("%+v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -478,7 +477,7 @@ var simpleCommit2 = &cli.Command{
|
|||||||
return xerrors.Errorf("Usage: lotus-bench prove [input.json]")
|
return xerrors.Errorf("Usage: lotus-bench prove [input.json]")
|
||||||
}
|
}
|
||||||
|
|
||||||
inb, err := ioutil.ReadFile(c.Args().First())
|
inb, err := os.ReadFile(c.Args().First())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("reading input file: %w", err)
|
return xerrors.Errorf("reading input file: %w", err)
|
||||||
}
|
}
|
||||||
@ -861,7 +860,7 @@ var simpleProveReplicaUpdate1 = &cli.Command{
|
|||||||
return xerrors.Errorf("json marshal vanilla proofs: %w", err)
|
return xerrors.Errorf("json marshal vanilla proofs: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ioutil.WriteFile(cctx.Args().Get(7), vpjb, 0666); err != nil {
|
if err := os.WriteFile(cctx.Args().Get(7), vpjb, 0666); err != nil {
|
||||||
return xerrors.Errorf("writing vanilla proofs file: %w", err)
|
return xerrors.Errorf("writing vanilla proofs file: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -934,7 +933,7 @@ var simpleProveReplicaUpdate2 = &cli.Command{
|
|||||||
return xerrors.Errorf("parse commr: %w", err)
|
return xerrors.Errorf("parse commr: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
vpb, err := ioutil.ReadFile(cctx.Args().Get(3))
|
vpb, err := os.ReadFile(cctx.Args().Get(3))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("reading valilla proof file: %w", err)
|
return xerrors.Errorf("reading valilla proof file: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
@ -63,7 +63,7 @@ func VerifyToken(token, remoteIP string) (Response, error) {
|
|||||||
return resp, err
|
return resp, err
|
||||||
}
|
}
|
||||||
|
|
||||||
b, err := ioutil.ReadAll(r.Body)
|
b, err := io.ReadAll(r.Body)
|
||||||
_ = r.Body.Close() // close immediately after reading finished
|
_ = r.Body.Close() // close immediately after reading finished
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return resp, err
|
return resp, err
|
||||||
|
@ -7,7 +7,6 @@ import (
|
|||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@ -246,7 +245,7 @@ var initCmd = &cli.Command{
|
|||||||
return xerrors.Errorf("marshaling storage config: %w", err)
|
return xerrors.Errorf("marshaling storage config: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ioutil.WriteFile(filepath.Join(lr.Path(), "sectorstore.json"), b, 0644); err != nil {
|
if err := os.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)
|
return xerrors.Errorf("persisting storage metadata (%s): %w", filepath.Join(lr.Path(), "sectorstore.json"), err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -292,7 +291,7 @@ func migratePreSealMeta(ctx context.Context, api v1api.FullNode, metadata string
|
|||||||
return xerrors.Errorf("expanding preseal dir: %w", err)
|
return xerrors.Errorf("expanding preseal dir: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
b, err := ioutil.ReadFile(metadata)
|
b, err := os.ReadFile(metadata)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("reading preseal metadata: %w", err)
|
return xerrors.Errorf("reading preseal metadata: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ package main
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/docker/go-units"
|
"github.com/docker/go-units"
|
||||||
@ -59,7 +58,7 @@ var restoreCmd = &cli.Command{
|
|||||||
return xerrors.Errorf("expanding storage config path: %w", err)
|
return xerrors.Errorf("expanding storage config path: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
cfb, err := ioutil.ReadFile(cf)
|
cfb, err := os.ReadFile(cf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("reading storage config: %w", err)
|
return xerrors.Errorf("reading storage config: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"math/bits"
|
"math/bits"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@ -167,7 +166,7 @@ over time
|
|||||||
return xerrors.Errorf("marshaling storage config: %w", err)
|
return xerrors.Errorf("marshaling storage config: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ioutil.WriteFile(filepath.Join(p, metaFile), b, 0644); err != nil {
|
if err := os.WriteFile(filepath.Join(p, metaFile), b, 0644); err != nil {
|
||||||
return xerrors.Errorf("persisting storage metadata (%s): %w", filepath.Join(p, metaFile), err)
|
return xerrors.Errorf("persisting storage metadata (%s): %w", filepath.Join(p, metaFile), err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@ import (
|
|||||||
"encoding/csv"
|
"encoding/csv"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
_ "net/http/pprof"
|
_ "net/http/pprof"
|
||||||
"os"
|
"os"
|
||||||
@ -759,7 +758,7 @@ func (r *refunder) EnsureMinerMinimums(ctx context.Context, tipset *types.TipSet
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
w := ioutil.Discard
|
w := io.Discard
|
||||||
if len(output) != 0 {
|
if len(output) != 0 {
|
||||||
f, err := os.Create(output)
|
f, err := os.Create(output)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -1299,7 +1298,7 @@ func loadChainEpoch(fn string) (abi.ChainEpoch, error) {
|
|||||||
err = f.Close()
|
err = f.Close()
|
||||||
}()
|
}()
|
||||||
|
|
||||||
raw, err := ioutil.ReadAll(f)
|
raw, err := io.ReadAll(f)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@ import (
|
|||||||
"encoding/csv"
|
"encoding/csv"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@ -80,7 +79,7 @@ var genesisNewCmd = &cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ioutil.WriteFile(genf, genb, 0644); err != nil {
|
if err := os.WriteFile(genf, genb, 0644); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,7 +102,7 @@ var genesisAddMinerCmd = &cli.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
var template genesis.Template
|
var template genesis.Template
|
||||||
genb, err := ioutil.ReadFile(genf)
|
genb, err := os.ReadFile(genf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("read genesis template: %w", err)
|
return xerrors.Errorf("read genesis template: %w", err)
|
||||||
}
|
}
|
||||||
@ -117,7 +116,7 @@ var genesisAddMinerCmd = &cli.Command{
|
|||||||
return xerrors.Errorf("expand preseal file path: %w", err)
|
return xerrors.Errorf("expand preseal file path: %w", err)
|
||||||
}
|
}
|
||||||
miners := map[string]genesis.Miner{}
|
miners := map[string]genesis.Miner{}
|
||||||
minb, err := ioutil.ReadFile(minf)
|
minb, err := os.ReadFile(minf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("read preseal file: %w", err)
|
return xerrors.Errorf("read preseal file: %w", err)
|
||||||
}
|
}
|
||||||
@ -156,7 +155,7 @@ var genesisAddMinerCmd = &cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ioutil.WriteFile(genf, genb, 0644); err != nil {
|
if err := os.WriteFile(genf, genb, 0644); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,7 +195,7 @@ var genesisAddMsigsCmd = &cli.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
var template genesis.Template
|
var template genesis.Template
|
||||||
b, err := ioutil.ReadFile(genf)
|
b, err := os.ReadFile(genf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("read genesis template: %w", err)
|
return xerrors.Errorf("read genesis template: %w", err)
|
||||||
}
|
}
|
||||||
@ -237,7 +236,7 @@ var genesisAddMsigsCmd = &cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ioutil.WriteFile(genf, b, 0644); err != nil {
|
if err := os.WriteFile(genf, b, 0644); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@ -339,7 +338,7 @@ var genesisSetVRKCmd = &cli.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
var template genesis.Template
|
var template genesis.Template
|
||||||
b, err := ioutil.ReadFile(genf)
|
b, err := os.ReadFile(genf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("read genesis template: %w", err)
|
return xerrors.Errorf("read genesis template: %w", err)
|
||||||
}
|
}
|
||||||
@ -404,7 +403,7 @@ var genesisSetVRKCmd = &cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ioutil.WriteFile(genf, b, 0644); err != nil {
|
if err := os.WriteFile(genf, b, 0644); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@ -435,7 +434,7 @@ var genesisSetRemainderCmd = &cli.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
var template genesis.Template
|
var template genesis.Template
|
||||||
b, err := ioutil.ReadFile(genf)
|
b, err := os.ReadFile(genf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("read genesis template: %w", err)
|
return xerrors.Errorf("read genesis template: %w", err)
|
||||||
}
|
}
|
||||||
@ -500,7 +499,7 @@ var genesisSetRemainderCmd = &cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ioutil.WriteFile(genf, b, 0644); err != nil {
|
if err := os.WriteFile(genf, b, 0644); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@ -529,7 +528,7 @@ var genesisSetActorVersionCmd = &cli.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
var template genesis.Template
|
var template genesis.Template
|
||||||
b, err := ioutil.ReadFile(genf)
|
b, err := os.ReadFile(genf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("read genesis template: %w", err)
|
return xerrors.Errorf("read genesis template: %w", err)
|
||||||
}
|
}
|
||||||
@ -550,7 +549,7 @@ var genesisSetActorVersionCmd = &cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ioutil.WriteFile(genf, b, 0644); err != nil {
|
if err := os.WriteFile(genf, b, 0644); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@ -607,7 +606,7 @@ var genesisSetVRKSignersCmd = &cli.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
var template genesis.Template
|
var template genesis.Template
|
||||||
b, err := ioutil.ReadFile(genf)
|
b, err := os.ReadFile(genf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("read genesis template: %w", err)
|
return xerrors.Errorf("read genesis template: %w", err)
|
||||||
}
|
}
|
||||||
@ -662,7 +661,7 @@ var genesisSetVRKSignersCmd = &cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ioutil.WriteFile(genf, b, 0644); err != nil {
|
if err := os.WriteFile(genf, b, 0644); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
@ -4,7 +4,6 @@ import (
|
|||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/docker/go-units"
|
"github.com/docker/go-units"
|
||||||
@ -114,7 +113,7 @@ var preSealCmd = &cli.Command{
|
|||||||
var k *types.KeyInfo
|
var k *types.KeyInfo
|
||||||
if c.String("key") != "" {
|
if c.String("key") != "" {
|
||||||
k = new(types.KeyInfo)
|
k = new(types.KeyInfo)
|
||||||
kh, err := ioutil.ReadFile(c.String("key"))
|
kh, err := os.ReadFile(c.String("key"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@ import (
|
|||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
@ -135,7 +134,7 @@ func PreSeal(maddr address.Address, spt abi.RegisteredSealProof, offset abi.Sect
|
|||||||
return nil, nil, xerrors.Errorf("marshaling storage config: %w", err)
|
return nil, nil, xerrors.Errorf("marshaling storage config: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ioutil.WriteFile(filepath.Join(sbroot, "sectorstore.json"), b, 0644); err != nil {
|
if err := os.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)
|
return nil, nil, xerrors.Errorf("persisting storage metadata (%s): %w", filepath.Join(sbroot, "storage.json"), err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -228,7 +227,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"))
|
log.Infof("Writing preseal manifest to %s", filepath.Join(sbroot, "pre-seal-"+maddr.String()+".json"))
|
||||||
|
|
||||||
if err := ioutil.WriteFile(filepath.Join(sbroot, "pre-seal-"+maddr.String()+".json"), out, 0664); err != nil {
|
if err := os.WriteFile(filepath.Join(sbroot, "pre-seal-"+maddr.String()+".json"), out, 0664); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -239,7 +238,7 @@ func WriteGenesisMiner(maddr address.Address, sbroot string, gm *genesis.Miner,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: allow providing key
|
// TODO: allow providing key
|
||||||
if err := ioutil.WriteFile(filepath.Join(sbroot, "pre-seal-"+maddr.String()+".key"), []byte(hex.EncodeToString(b)), 0664); err != nil {
|
if err := os.WriteFile(filepath.Join(sbroot, "pre-seal-"+maddr.String()+".key"), []byte(hex.EncodeToString(b)), 0664); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@ import (
|
|||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@ -30,7 +29,7 @@ var base16Cmd = &cli.Command{
|
|||||||
input = strings.NewReader(cctx.Args().First())
|
input = strings.NewReader(cctx.Args().First())
|
||||||
}
|
}
|
||||||
|
|
||||||
bytes, err := ioutil.ReadAll(input)
|
bytes, err := io.ReadAll(input)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ package main
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@ -30,7 +29,7 @@ var base32Cmd = &cli.Command{
|
|||||||
input = strings.NewReader(cctx.Args().First())
|
input = strings.NewReader(cctx.Args().First())
|
||||||
}
|
}
|
||||||
|
|
||||||
bytes, err := ioutil.ReadAll(input)
|
bytes, err := io.ReadAll(input)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@ import (
|
|||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@ -38,7 +37,7 @@ var base64Cmd = &cli.Command{
|
|||||||
input = strings.NewReader(cctx.Args().First())
|
input = strings.NewReader(cctx.Args().First())
|
||||||
}
|
}
|
||||||
|
|
||||||
bytes, err := ioutil.ReadAll(input)
|
bytes, err := io.ReadAll(input)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ import (
|
|||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
@ -318,7 +317,7 @@ func decodeToByte(cctx *cli.Context, i int) ([]byte, error) {
|
|||||||
if i > 0 {
|
if i > 0 {
|
||||||
return nil, xerrors.Errorf("need more than %d args", i)
|
return nil, xerrors.Errorf("need more than %d args", i)
|
||||||
}
|
}
|
||||||
r, err := ioutil.ReadAll(os.Stdin)
|
r, err := io.ReadAll(os.Stdin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"os"
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
@ -537,7 +537,7 @@ var finalResultCmd = &cli.Command{
|
|||||||
// Returns voted sorted by votes from earliest to latest
|
// Returns voted sorted by votes from earliest to latest
|
||||||
func getVotesMap(file string) ([]Vote, error) {
|
func getVotesMap(file string) ([]Vote, error) {
|
||||||
var votes []Vote
|
var votes []Vote
|
||||||
vb, err := ioutil.ReadFile(file)
|
vb, err := os.ReadFile(file)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, xerrors.Errorf("read vote: %w", err)
|
return nil, xerrors.Errorf("read vote: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@ -81,7 +80,7 @@ var jwtTokenCmd = &cli.Command{
|
|||||||
defer inputFile.Close() //nolint:errcheck
|
defer inputFile.Close() //nolint:errcheck
|
||||||
input := bufio.NewReader(inputFile)
|
input := bufio.NewReader(inputFile)
|
||||||
|
|
||||||
encoded, err := ioutil.ReadAll(input)
|
encoded, err := io.ReadAll(input)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -123,7 +122,7 @@ var jwtTokenCmd = &cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return ioutil.WriteFile(cctx.String("output"), token, 0600)
|
return os.WriteFile(cctx.String("output"), token, 0600)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,7 +141,7 @@ var jwtNewCmd = &cli.Command{
|
|||||||
|
|
||||||
keyName := cctx.Args().First()
|
keyName := cctx.Args().First()
|
||||||
|
|
||||||
sk, err := ioutil.ReadAll(io.LimitReader(rand.Reader, 32))
|
sk, err := io.ReadAll(io.LimitReader(rand.Reader, 32))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -184,6 +183,6 @@ var jwtNewCmd = &cli.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
filenameToken := fmt.Sprintf("jwt-%s.token", keyName)
|
filenameToken := fmt.Sprintf("jwt-%s.token", keyName)
|
||||||
return ioutil.WriteFile(filenameToken, token, 0600)
|
return os.WriteFile(filenameToken, token, 0600)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
@ -68,7 +67,7 @@ var keyinfoVerifyCmd = &cli.Command{
|
|||||||
defer inputFile.Close() //nolint:errcheck
|
defer inputFile.Close() //nolint:errcheck
|
||||||
input := bufio.NewReader(inputFile)
|
input := bufio.NewReader(inputFile)
|
||||||
|
|
||||||
keyContent, err := ioutil.ReadAll(input)
|
keyContent, err := io.ReadAll(input)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -162,7 +161,7 @@ var keyinfoImportCmd = &cli.Command{
|
|||||||
input = bufio.NewReader(inputFile)
|
input = bufio.NewReader(inputFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
encoded, err := ioutil.ReadAll(input)
|
encoded, err := io.ReadAll(input)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -274,7 +273,7 @@ var keyinfoInfoCmd = &cli.Command{
|
|||||||
input = bufio.NewReader(inputFile)
|
input = bufio.NewReader(inputFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
encoded, err := ioutil.ReadAll(input)
|
encoded, err := io.ReadAll(input)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
@ -97,7 +96,7 @@ var rpcCmd = &cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
rb, err := ioutil.ReadAll(resp.Body)
|
rb, err := io.ReadAll(resp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
@ -464,7 +463,7 @@ var runCmd = &cli.Command{
|
|||||||
return xerrors.Errorf("marshaling storage config: %w", err)
|
return xerrors.Errorf("marshaling storage config: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ioutil.WriteFile(filepath.Join(lr.Path(), "sectorstore.json"), b, 0644); err != nil {
|
if err := os.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)
|
return xerrors.Errorf("persisting storage metadata (%s): %w", filepath.Join(lr.Path(), "sectorstore.json"), err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
@ -121,7 +120,7 @@ var storageAttachCmd = &cli.Command{
|
|||||||
return xerrors.Errorf("marshaling storage config: %w", err)
|
return xerrors.Errorf("marshaling storage config: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ioutil.WriteFile(filepath.Join(p, metaFile), b, 0644); err != nil {
|
if err := os.WriteFile(filepath.Join(p, metaFile), b, 0644); err != nil {
|
||||||
return xerrors.Errorf("persisting storage metadata (%s): %w", filepath.Join(p, metaFile), err)
|
return xerrors.Errorf("persisting storage metadata (%s): %w", filepath.Join(p, metaFile), err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,6 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"runtime/pprof"
|
"runtime/pprof"
|
||||||
@ -244,7 +243,7 @@ var DaemonCmd = &cli.Command{
|
|||||||
|
|
||||||
var genBytes []byte
|
var genBytes []byte
|
||||||
if cctx.String("genesis") != "" {
|
if cctx.String("genesis") != "" {
|
||||||
genBytes, err = ioutil.ReadFile(cctx.String("genesis"))
|
genBytes, err = os.ReadFile(cctx.String("genesis"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("reading genesis: %w", err)
|
return xerrors.Errorf("reading genesis: %w", err)
|
||||||
}
|
}
|
||||||
@ -400,7 +399,7 @@ func importKey(ctx context.Context, api lapi.FullNode, f string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
hexdata, err := ioutil.ReadFile(f)
|
hexdata, err := os.ReadFile(f)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ package conformance
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
@ -107,7 +106,7 @@ func TestConformance(t *testing.T) {
|
|||||||
// Run a test for each vector.
|
// Run a test for each vector.
|
||||||
for _, v := range vectors {
|
for _, v := range vectors {
|
||||||
path := filepath.Join(corpusRoot, v)
|
path := filepath.Join(corpusRoot, v)
|
||||||
raw, err := ioutil.ReadFile(path)
|
raw, err := os.ReadFile(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed to read test raw file: %s", path)
|
t.Fatalf("failed to read test raw file: %s", path)
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"math"
|
"math"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
@ -328,7 +327,7 @@ func dumpThreeWayStateDiff(r Reporter, vector *schema.TestVector, bs blockstore.
|
|||||||
// writeStateToTempCAR writes the provided roots to a temporary CAR that'll be
|
// 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.
|
// cleaned up via t.Cleanup(). It returns the full path of the temp file.
|
||||||
func writeStateToTempCAR(bs blockstore.Blockstore, roots ...cid.Cid) (string, error) {
|
func writeStateToTempCAR(bs blockstore.Blockstore, roots ...cid.Cid) (string, error) {
|
||||||
tmp, err := ioutil.TempFile("", "lotus-tests-*.car")
|
tmp, err := os.CreateTemp("", "lotus-tests-*.car")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("failed to create temp file to dump CAR for diffing: %w", err)
|
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...]
|
lotus-miner [global options] command [command options] [arguments...]
|
||||||
|
|
||||||
VERSION:
|
VERSION:
|
||||||
1.21.0-rc1
|
1.21.0-rc2
|
||||||
|
|
||||||
COMMANDS:
|
COMMANDS:
|
||||||
init Initialize a lotus miner repo
|
init Initialize a lotus miner repo
|
||||||
|
@ -7,7 +7,7 @@ USAGE:
|
|||||||
lotus-worker [global options] command [command options] [arguments...]
|
lotus-worker [global options] command [command options] [arguments...]
|
||||||
|
|
||||||
VERSION:
|
VERSION:
|
||||||
1.21.0-rc1
|
1.21.0-rc2
|
||||||
|
|
||||||
COMMANDS:
|
COMMANDS:
|
||||||
run Start lotus worker
|
run Start lotus worker
|
||||||
|
@ -7,7 +7,7 @@ USAGE:
|
|||||||
lotus [global options] command [command options] [arguments...]
|
lotus [global options] command [command options] [arguments...]
|
||||||
|
|
||||||
VERSION:
|
VERSION:
|
||||||
1.21.0-rc1
|
1.21.0-rc2
|
||||||
|
|
||||||
COMMANDS:
|
COMMANDS:
|
||||||
daemon Start a lotus daemon process
|
daemon Start a lotus daemon process
|
||||||
|
@ -5,7 +5,6 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
@ -19,7 +18,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
db, err := ioutil.ReadFile(os.Args[2])
|
db, err := os.ReadFile(os.Args[2])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
@ -38,7 +37,7 @@ func main() {
|
|||||||
if filepath.Ext(path) != ".go" {
|
if filepath.Ext(path) != ".go" {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
fb, err := ioutil.ReadFile(path)
|
fb, err := os.ReadFile(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -110,7 +109,7 @@ func main() {
|
|||||||
|
|
||||||
if rewrite {
|
if rewrite {
|
||||||
fmt.Printf("write %s\n", path)
|
fmt.Printf("write %s\n", path)
|
||||||
if err := ioutil.WriteFile(path, []byte(strings.Join(outLines, "\n")), 0664); err != nil {
|
if err := os.WriteFile(path, []byte(strings.Join(outLines, "\n")), 0664); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
2
go.mod
2
go.mod
@ -1,6 +1,6 @@
|
|||||||
module github.com/filecoin-project/lotus
|
module github.com/filecoin-project/lotus
|
||||||
|
|
||||||
go 1.18
|
go 1.19
|
||||||
|
|
||||||
retract v1.14.0 // Accidentally force-pushed tag, use v1.14.1+ instead.
|
retract v1.14.0 // Accidentally force-pushed tag, use v1.14.1+ instead.
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
@ -196,7 +195,7 @@ func validateDMUnixFile(r io.Reader) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func testDMExportAsCar(ctx context.Context, client *kit.TestFullNode, expDirective api.ExportRef, tempDir string) error {
|
func testDMExportAsCar(ctx context.Context, client *kit.TestFullNode, expDirective api.ExportRef, tempDir string) error {
|
||||||
out, err := ioutil.TempFile(tempDir, "exp-test")
|
out, err := os.CreateTemp(tempDir, "exp-test")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -214,7 +213,7 @@ func testDMExportAsCar(ctx context.Context, client *kit.TestFullNode, expDirecti
|
|||||||
return validateDMCar(out)
|
return validateDMCar(out)
|
||||||
}
|
}
|
||||||
func tesV0RetrievalAsCar(ctx context.Context, client *kit.TestFullNode, retOrder api0.RetrievalOrder, tempDir string) error {
|
func tesV0RetrievalAsCar(ctx context.Context, client *kit.TestFullNode, retOrder api0.RetrievalOrder, tempDir string) error {
|
||||||
out, err := ioutil.TempFile(tempDir, "exp-test")
|
out, err := os.CreateTemp(tempDir, "exp-test")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ package kit
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@ -110,7 +109,7 @@ func RunClientTest(t *testing.T, cmds []*lcli.Command, clientNode *TestFullNode)
|
|||||||
|
|
||||||
// Retrieve the first file from the Miner
|
// Retrieve the first file from the Miner
|
||||||
// client retrieve <cid> <file path>
|
// client retrieve <cid> <file path>
|
||||||
tmpdir, err := ioutil.TempDir(os.TempDir(), "test-cli-client")
|
tmpdir, err := os.MkdirTemp(os.TempDir(), "test-cli-client")
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
path := filepath.Join(tmpdir, "outfile.dat")
|
path := filepath.Join(tmpdir, "outfile.dat")
|
||||||
|
|
||||||
@ -144,13 +143,13 @@ func createRandomFile(rseed, size int) ([]byte, string, error) {
|
|||||||
data := make([]byte, size)
|
data := make([]byte, size)
|
||||||
rand.New(rand.NewSource(int64(rseed))).Read(data)
|
rand.New(rand.NewSource(int64(rseed))).Read(data)
|
||||||
|
|
||||||
dir, err := ioutil.TempDir(os.TempDir(), "test-make-deal-")
|
dir, err := os.MkdirTemp(os.TempDir(), "test-make-deal-")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, "", err
|
return nil, "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
path := filepath.Join(dir, "sourcefile.dat")
|
path := filepath.Join(dir, "sourcefile.dat")
|
||||||
err = ioutil.WriteFile(path, data, 0644)
|
err = os.WriteFile(path, data, 0644)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, "", err
|
return nil, "", err
|
||||||
}
|
}
|
||||||
|
@ -6,9 +6,9 @@ import (
|
|||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"os"
|
||||||
"sync"
|
"sync"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
@ -234,7 +234,7 @@ func (n *Ensemble) MinerEnroll(minerNode *TestMiner, full *TestFullNode, opts ..
|
|||||||
peerId, err := peer.IDFromPrivateKey(privkey)
|
peerId, err := peer.IDFromPrivateKey(privkey)
|
||||||
require.NoError(n.t, err)
|
require.NoError(n.t, err)
|
||||||
|
|
||||||
tdir, err := ioutil.TempDir("", "preseal-memgen")
|
tdir, err := os.MkdirTemp("", "preseal-memgen")
|
||||||
require.NoError(n.t, err)
|
require.NoError(n.t, err)
|
||||||
|
|
||||||
minerCnt := len(n.inactive.miners) + len(n.active.miners)
|
minerCnt := len(n.inactive.miners) + len(n.active.miners)
|
||||||
|
@ -4,7 +4,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@ -204,7 +203,7 @@ func (tm *TestMiner) AddStorage(ctx context.Context, t *testing.T, conf func(*st
|
|||||||
b, err := json.MarshalIndent(cfg, "", " ")
|
b, err := json.MarshalIndent(cfg, "", " ")
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
err = ioutil.WriteFile(filepath.Join(p, metaFile), b, 0644)
|
err = os.WriteFile(filepath.Join(p, metaFile), b, 0644)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
err = tm.StorageAddLocal(ctx, p)
|
err = tm.StorageAddLocal(ctx, p)
|
||||||
|
@ -3,7 +3,6 @@ package kit
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io/ioutil"
|
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
@ -67,7 +66,7 @@ func (tm *TestWorker) AddStorage(ctx context.Context, t *testing.T, conf func(*s
|
|||||||
b, err := json.MarshalIndent(cfg, "", " ")
|
b, err := json.MarshalIndent(cfg, "", " ")
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
err = ioutil.WriteFile(filepath.Join(p, metaFile), b, 0644)
|
err = os.WriteFile(filepath.Join(p, metaFile), b, 0644)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
err = tm.StorageAddLocal(ctx, p)
|
err = tm.StorageAddLocal(ctx, p)
|
||||||
|
@ -5,7 +5,6 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
@ -77,7 +76,7 @@ func TestLogRestore(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, 1, len(fls))
|
require.Equal(t, 1, len(fls))
|
||||||
|
|
||||||
bf, err := ioutil.ReadFile(filepath.Join(logdir, fls[0].Name()))
|
bf, err := os.ReadFile(filepath.Join(logdir, fls[0].Name()))
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
ds2 := datastore.NewMapDatastore()
|
ds2 := datastore.NewMapDatastore()
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package consensus
|
package consensus
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ func DefaultClusterRaftConfig() *ClusterRaftConfig {
|
|||||||
cfg.RaftConfig.LocalID = "will_be_set_automatically"
|
cfg.RaftConfig.LocalID = "will_be_set_automatically"
|
||||||
|
|
||||||
// Set up logging
|
// Set up logging
|
||||||
cfg.RaftConfig.LogOutput = ioutil.Discard
|
cfg.RaftConfig.LogOutput = io.Discard
|
||||||
return &cfg
|
return &cfg
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ func NewClusterRaftConfig(userRaftConfig *config.UserRaftConfig) *ClusterRaftCon
|
|||||||
cfg.RaftConfig.LocalID = "will_be_set_automatically"
|
cfg.RaftConfig.LocalID = "will_be_set_automatically"
|
||||||
|
|
||||||
// Set up logging
|
// Set up logging
|
||||||
cfg.RaftConfig.LogOutput = ioutil.Discard
|
cfg.RaftConfig.LogOutput = io.Discard
|
||||||
|
|
||||||
return &cfg
|
return &cfg
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"path"
|
"path"
|
||||||
@ -158,7 +157,7 @@ func ReaderParamEncoder(addr string) jsonrpc.Option {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if resp.StatusCode != http.StatusOK {
|
if resp.StatusCode != http.StatusOK {
|
||||||
b, _ := ioutil.ReadAll(resp.Body)
|
b, _ := io.ReadAll(resp.Body)
|
||||||
log.Errorf("sending reader param (%s): non-200 status: %s, msg: '%s'", u.String(), resp.Status, string(b))
|
log.Errorf("sending reader param (%s): non-200 status: %s, msg: '%s'", u.String(), resp.Status, string(b))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -182,7 +181,7 @@ func ReaderParamEncoder(addr string) jsonrpc.Option {
|
|||||||
defer resp.Body.Close() //nolint
|
defer resp.Body.Close() //nolint
|
||||||
|
|
||||||
if resp.StatusCode != http.StatusOK {
|
if resp.StatusCode != http.StatusOK {
|
||||||
b, _ := ioutil.ReadAll(resp.Body)
|
b, _ := io.ReadAll(resp.Body)
|
||||||
log.Errorf("sending reader param (%s): non-200 status: %s, msg: '%s'", u.String(), resp.Status, string(b))
|
log.Errorf("sending reader param (%s): non-200 status: %s, msg: '%s'", u.String(), resp.Status, string(b))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/ipfs/go-blockservice"
|
"github.com/ipfs/go-blockservice"
|
||||||
@ -68,7 +67,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)
|
return cid.Undef, xerrors.Errorf("failed to create reader path file: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
f, err := ioutil.TempFile("", "")
|
f, err := os.CreateTemp("", "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return cid.Undef, xerrors.Errorf("failed to create temp file: %w", err)
|
return cid.Undef, xerrors.Errorf("failed to create temp file: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
@ -67,7 +66,7 @@ func TestRoundtripUnixFS_Dense(t *testing.T) {
|
|||||||
// ensure contents of the initial input file and the output file are identical.
|
// ensure contents of the initial input file and the output file are identical.
|
||||||
fo, err := os.Open(tmpOutput)
|
fo, err := os.Open(tmpOutput)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
bz2, err := ioutil.ReadAll(fo)
|
bz2, err := io.ReadAll(fo)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.NoError(t, fo.Close())
|
require.NoError(t, fo.Close())
|
||||||
require.Equal(t, inputContents, bz2)
|
require.Equal(t, inputContents, bz2)
|
||||||
@ -107,7 +106,7 @@ func TestRoundtripUnixFS_Filestore(t *testing.T) {
|
|||||||
// ensure contents of the initial input file and the output file are identical.
|
// ensure contents of the initial input file and the output file are identical.
|
||||||
fo, err := os.Open(tmpOutput)
|
fo, err := os.Open(tmpOutput)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
bz2, err := ioutil.ReadAll(fo)
|
bz2, err := io.ReadAll(fo)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.NoError(t, fo.Close())
|
require.NoError(t, fo.Close())
|
||||||
require.Equal(t, inputContents, bz2)
|
require.Equal(t, inputContents, bz2)
|
||||||
|
@ -4,7 +4,6 @@ package dagstore
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
@ -39,7 +38,7 @@ func TestLotusMount(t *testing.T) {
|
|||||||
io.ReaderAt
|
io.ReaderAt
|
||||||
io.Seeker
|
io.Seeker
|
||||||
}{
|
}{
|
||||||
ReadCloser: ioutil.NopCloser(strings.NewReader("testing")),
|
ReadCloser: io.NopCloser(strings.NewReader("testing")),
|
||||||
ReaderAt: nil,
|
ReaderAt: nil,
|
||||||
Seeker: nil,
|
Seeker: nil,
|
||||||
}
|
}
|
||||||
@ -48,7 +47,7 @@ func TestLotusMount(t *testing.T) {
|
|||||||
io.ReaderAt
|
io.ReaderAt
|
||||||
io.Seeker
|
io.Seeker
|
||||||
}{
|
}{
|
||||||
ReadCloser: ioutil.NopCloser(strings.NewReader("testing")),
|
ReadCloser: io.NopCloser(strings.NewReader("testing")),
|
||||||
ReaderAt: nil,
|
ReaderAt: nil,
|
||||||
Seeker: nil,
|
Seeker: nil,
|
||||||
}
|
}
|
||||||
@ -66,7 +65,7 @@ func TestLotusMount(t *testing.T) {
|
|||||||
rd, err := mnt.Fetch(context.Background())
|
rd, err := mnt.Fetch(context.Background())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
bz, err := ioutil.ReadAll(rd)
|
bz, err := io.ReadAll(rd)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.NoError(t, rd.Close())
|
require.NoError(t, rd.Close())
|
||||||
require.Equal(t, []byte("testing"), bz)
|
require.Equal(t, []byte("testing"), bz)
|
||||||
@ -85,7 +84,7 @@ func TestLotusMount(t *testing.T) {
|
|||||||
// fetching on this mount should get us back the same data.
|
// fetching on this mount should get us back the same data.
|
||||||
rd, err = mnt2.Fetch(context.Background())
|
rd, err = mnt2.Fetch(context.Background())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
bz, err = ioutil.ReadAll(rd)
|
bz, err = io.ReadAll(rd)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.NoError(t, rd.Close())
|
require.NoError(t, rd.Close())
|
||||||
require.Equal(t, []byte("testing"), bz)
|
require.Equal(t, []byte("testing"), bz)
|
||||||
|
@ -2,14 +2,13 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
func run() error {
|
func run() error {
|
||||||
tfb, err := ioutil.ReadFile("./node/config/types.go")
|
tfb, err := os.ReadFile("./node/config/types.go")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"reflect"
|
"reflect"
|
||||||
"regexp"
|
"regexp"
|
||||||
@ -47,7 +46,7 @@ func FromFile(path string, opts ...LoadCfgOpt) (interface{}, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
defer file.Close() //nolint:errcheck,staticcheck // The file is RO
|
defer file.Close() //nolint:errcheck,staticcheck // The file is RO
|
||||||
cfgBs, err := ioutil.ReadAll(file)
|
cfgBs, err := io.ReadAll(file)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, xerrors.Errorf("failed to read config for validation checks %w", err)
|
return nil, xerrors.Errorf("failed to read config for validation checks %w", err)
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ package config
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
@ -50,7 +49,7 @@ func TestParitalConfig(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
f, err := ioutil.TempFile("", "config-*.toml")
|
f, err := os.CreateTemp("", "config-*.toml")
|
||||||
fname := f.Name()
|
fname := f.Name()
|
||||||
|
|
||||||
assert.NoError(err, "tmp file shold not error")
|
assert.NoError(err, "tmp file shold not error")
|
||||||
@ -115,7 +114,7 @@ func TestValidateConfigSetsEnableSplitstore(t *testing.T) {
|
|||||||
assert.False(t, MatchEnableSplitstoreField(string(cfgCommentedOutEnableSS)))
|
assert.False(t, MatchEnableSplitstoreField(string(cfgCommentedOutEnableSS)))
|
||||||
|
|
||||||
// write config with commented out EnableSplitstore to file
|
// write config with commented out EnableSplitstore to file
|
||||||
f, err := ioutil.TempFile("", "config.toml")
|
f, err := os.CreateTemp("", "config.toml")
|
||||||
fname := f.Name()
|
fname := f.Name()
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
defer func() {
|
defer func() {
|
||||||
@ -132,7 +131,7 @@ func TestValidateConfigSetsEnableSplitstore(t *testing.T) {
|
|||||||
|
|
||||||
// Loading without a config file and a default fails if the default fallback is disabled
|
// Loading without a config file and a default fails if the default fallback is disabled
|
||||||
func TestFailToFallbackToDefault(t *testing.T) {
|
func TestFailToFallbackToDefault(t *testing.T) {
|
||||||
dir, err := ioutil.TempDir("", "dirWithNoFiles")
|
dir, err := os.MkdirTemp("", "dirWithNoFiles")
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
defer assert.NoError(t, os.RemoveAll(dir))
|
defer assert.NoError(t, os.RemoveAll(dir))
|
||||||
nonExistantFileName := dir + "/notarealfile"
|
nonExistantFileName := dir + "/notarealfile"
|
||||||
|
@ -3,7 +3,6 @@ package config
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
@ -43,7 +42,7 @@ func WriteStorageFile(path string, config storiface.StorageConfig) error {
|
|||||||
return xerrors.Errorf("marshaling storage config: %w", err)
|
return xerrors.Errorf("marshaling storage config: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ioutil.WriteFile(path, b, 0644); err != nil {
|
if err := os.WriteFile(path, b, 0644); err != nil {
|
||||||
return xerrors.Errorf("persisting storage config (%s): %w", path, err)
|
return xerrors.Errorf("persisting storage config (%s): %w", path, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"embed"
|
"embed"
|
||||||
"io/ioutil"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
@ -77,7 +77,7 @@ func TestImportLocal(t *testing.T) {
|
|||||||
})
|
})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
outBytes, err := ioutil.ReadFile(out1)
|
outBytes, err := os.ReadFile(out1)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, b, outBytes)
|
require.Equal(t, b, outBytes)
|
||||||
|
|
||||||
@ -128,7 +128,7 @@ func TestImportLocal(t *testing.T) {
|
|||||||
err = files.WriteTo(file, exportedPath)
|
err = files.WriteTo(file, exportedPath)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
exportedBytes, err := ioutil.ReadFile(exportedPath)
|
exportedBytes, err := os.ReadFile(exportedPath)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
// compare original file to recreated unixfs file.
|
// compare original file to recreated unixfs file.
|
||||||
|
@ -5,7 +5,6 @@ import (
|
|||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"errors"
|
"errors"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"time"
|
"time"
|
||||||
@ -147,7 +146,7 @@ func APISecret(keystore types.KeyStore, lr repo.LockedRepo) (*dtypes.APIAlg, err
|
|||||||
if errors.Is(err, types.ErrKeyInfoNotFound) {
|
if errors.Is(err, types.ErrKeyInfoNotFound) {
|
||||||
log.Warn("Generating new API secret")
|
log.Warn("Generating new API secret")
|
||||||
|
|
||||||
sk, err := ioutil.ReadAll(io.LimitReader(rand.Reader, 32))
|
sk, err := io.ReadAll(io.LimitReader(rand.Reader, 32))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/ipfs/go-blockservice"
|
"github.com/ipfs/go-blockservice"
|
||||||
@ -60,7 +59,7 @@ func MakeGenesis(outFile, genesisTemplate string) func(bs dtypes.ChainBlockstore
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
fdata, err := ioutil.ReadFile(genesisTemplate)
|
fdata, err := os.ReadFile(genesisTemplate)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, xerrors.Errorf("reading preseals json: %w", err)
|
return nil, xerrors.Errorf("reading preseals json: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
@ -329,7 +328,7 @@ func (fsr *FsRepo) APIEndpoint() (multiaddr.Multiaddr, error) {
|
|||||||
}
|
}
|
||||||
defer f.Close() //nolint: errcheck // Read only op
|
defer f.Close() //nolint: errcheck // Read only op
|
||||||
|
|
||||||
data, err := ioutil.ReadAll(f)
|
data, err := io.ReadAll(f)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, xerrors.Errorf("failed to read %q: %w", p, err)
|
return nil, xerrors.Errorf("failed to read %q: %w", p, err)
|
||||||
}
|
}
|
||||||
@ -354,7 +353,7 @@ func (fsr *FsRepo) APIToken() ([]byte, error) {
|
|||||||
}
|
}
|
||||||
defer f.Close() //nolint: errcheck // Read only op
|
defer f.Close() //nolint: errcheck // Read only op
|
||||||
|
|
||||||
tb, err := ioutil.ReadAll(f)
|
tb, err := io.ReadAll(f)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -582,7 +581,7 @@ func (fsr *fsLockedRepo) SetConfig(c func(interface{})) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// write buffer of TOML bytes to config file
|
// write buffer of TOML bytes to config file
|
||||||
err = ioutil.WriteFile(fsr.configPath, buf.Bytes(), 0644)
|
err = os.WriteFile(fsr.configPath, buf.Bytes(), 0644)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -635,14 +634,14 @@ func (fsr *fsLockedRepo) SetAPIEndpoint(ma multiaddr.Multiaddr) error {
|
|||||||
if err := fsr.stillValid(); err != nil {
|
if err := fsr.stillValid(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return ioutil.WriteFile(fsr.join(fsAPI), []byte(ma.String()), 0644)
|
return os.WriteFile(fsr.join(fsAPI), []byte(ma.String()), 0644)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fsr *fsLockedRepo) SetAPIToken(token []byte) error {
|
func (fsr *fsLockedRepo) SetAPIToken(token []byte) error {
|
||||||
if err := fsr.stillValid(); err != nil {
|
if err := fsr.stillValid(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return ioutil.WriteFile(fsr.join(fsAPIToken), token, 0600)
|
return os.WriteFile(fsr.join(fsAPIToken), token, 0600)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fsr *fsLockedRepo) KeyStore() (types.KeyStore, error) {
|
func (fsr *fsLockedRepo) KeyStore() (types.KeyStore, error) {
|
||||||
@ -711,7 +710,7 @@ func (fsr *fsLockedRepo) Get(name string) (types.KeyInfo, error) {
|
|||||||
}
|
}
|
||||||
defer file.Close() //nolint: errcheck // read only op
|
defer file.Close() //nolint: errcheck // read only op
|
||||||
|
|
||||||
data, err := ioutil.ReadAll(file)
|
data, err := io.ReadAll(file)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return types.KeyInfo{}, xerrors.Errorf("reading key '%s': %w", name, err)
|
return types.KeyInfo{}, xerrors.Errorf("reading key '%s': %w", name, err)
|
||||||
}
|
}
|
||||||
@ -760,7 +759,7 @@ func (fsr *fsLockedRepo) put(rawName string, info types.KeyInfo, retries int) er
|
|||||||
return xerrors.Errorf("encoding key '%s': %w", name, err)
|
return xerrors.Errorf("encoding key '%s': %w", name, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = ioutil.WriteFile(keyPath, keyData, 0600)
|
err = os.WriteFile(keyPath, keyData, 0600)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("writing key '%s': %w", name, err)
|
return xerrors.Errorf("writing key '%s': %w", name, err)
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ package repo
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"sync"
|
"sync"
|
||||||
@ -103,7 +102,7 @@ func (lmem *lockedMemRepo) Path() string {
|
|||||||
return lmem.mem.tempDir
|
return lmem.mem.tempDir
|
||||||
}
|
}
|
||||||
|
|
||||||
t, err := ioutil.TempDir(os.TempDir(), "lotus-memrepo-temp-")
|
t, err := os.MkdirTemp(os.TempDir(), "lotus-memrepo-temp-")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err) // only used in tests, probably fine
|
panic(err) // only used in tests, probably fine
|
||||||
}
|
}
|
||||||
@ -142,7 +141,7 @@ func (lmem *lockedMemRepo) initSectorStore(t string) {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ioutil.WriteFile(filepath.Join(t, "sectorstore.json"), b, 0644); err != nil {
|
if err := os.WriteFile(filepath.Join(t, "sectorstore.json"), b, 0644); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package paths_test
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"os"
|
"os"
|
||||||
@ -378,7 +378,7 @@ func TestRemoteGetSector(t *testing.T) {
|
|||||||
|
|
||||||
if !tc.isDir {
|
if !tc.isDir {
|
||||||
// create file
|
// create file
|
||||||
tempFile, err := ioutil.TempFile("", "TestRemoteGetSector-")
|
tempFile, err := os.CreateTemp("", "TestRemoteGetSector-")
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
@ -390,7 +390,7 @@ func TestRemoteGetSector(t *testing.T) {
|
|||||||
path = tempFile.Name()
|
path = tempFile.Name()
|
||||||
} else {
|
} else {
|
||||||
// create dir with a file
|
// create dir with a file
|
||||||
tempFile2, err := ioutil.TempFile("", "TestRemoteGetSector-")
|
tempFile2, err := os.CreateTemp("", "TestRemoteGetSector-")
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer func() {
|
defer func() {
|
||||||
_ = os.Remove(tempFile2.Name())
|
_ = os.Remove(tempFile2.Name())
|
||||||
@ -435,7 +435,7 @@ func TestRemoteGetSector(t *testing.T) {
|
|||||||
_ = resp.Body.Close()
|
_ = resp.Body.Close()
|
||||||
}()
|
}()
|
||||||
|
|
||||||
bz, err := ioutil.ReadAll(resp.Body)
|
bz, err := io.ReadAll(resp.Body)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
// assert expected status code
|
// assert expected status code
|
||||||
|
@ -3,7 +3,6 @@ package paths
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io/ioutil"
|
|
||||||
"math/bits"
|
"math/bits"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"os"
|
"os"
|
||||||
@ -151,7 +150,7 @@ func (st *Local) OpenPath(ctx context.Context, p string) error {
|
|||||||
st.localLk.Lock()
|
st.localLk.Lock()
|
||||||
defer st.localLk.Unlock()
|
defer st.localLk.Unlock()
|
||||||
|
|
||||||
mb, err := ioutil.ReadFile(filepath.Join(p, MetaFile))
|
mb, err := os.ReadFile(filepath.Join(p, MetaFile))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("reading storage metadata for %s: %w", p, err)
|
return xerrors.Errorf("reading storage metadata for %s: %w", p, err)
|
||||||
}
|
}
|
||||||
@ -247,7 +246,7 @@ func (st *Local) Redeclare(ctx context.Context, filterId *storiface.ID, dropMiss
|
|||||||
defer st.localLk.Unlock()
|
defer st.localLk.Unlock()
|
||||||
|
|
||||||
for id, p := range st.paths {
|
for id, p := range st.paths {
|
||||||
mb, err := ioutil.ReadFile(filepath.Join(p.local, MetaFile))
|
mb, err := os.ReadFile(filepath.Join(p.local, MetaFile))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("reading storage metadata for %s: %w", p.local, err)
|
return xerrors.Errorf("reading storage metadata for %s: %w", p.local, err)
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ package paths
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
@ -63,7 +62,7 @@ func (t *TestingLocalStorage) init(subpath string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ioutil.WriteFile(metaFile, mb, 0644); err != nil {
|
if err := os.WriteFile(metaFile, mb, 0644); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"math/bits"
|
"math/bits"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
@ -412,7 +411,7 @@ func (r *Remote) FsStat(ctx context.Context, id storiface.ID) (fsutil.FsStat, er
|
|||||||
case 404:
|
case 404:
|
||||||
return fsutil.FsStat{}, errPathNotFound
|
return fsutil.FsStat{}, errPathNotFound
|
||||||
case 500:
|
case 500:
|
||||||
b, err := ioutil.ReadAll(resp.Body)
|
b, err := io.ReadAll(resp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fsutil.FsStat{}, xerrors.Errorf("fsstat: got http 500, then failed to read the error: %w", err)
|
return fsutil.FsStat{}, xerrors.Errorf("fsstat: got http 500, then failed to read the error: %w", err)
|
||||||
}
|
}
|
||||||
@ -768,7 +767,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)
|
log.Debugw("reading vanilla proof from remote not-found response", "url", url, "store", info.ID)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
body, err := ioutil.ReadAll(resp.Body)
|
body, err := io.ReadAll(resp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, xerrors.Errorf("resp.Body ReadAll: %w", err)
|
return nil, xerrors.Errorf("resp.Body ReadAll: %w", err)
|
||||||
}
|
}
|
||||||
@ -780,7 +779,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)))
|
return nil, xerrors.Errorf("non-200 code from %s: '%s'", url, strings.TrimSpace(string(body)))
|
||||||
}
|
}
|
||||||
|
|
||||||
body, err := ioutil.ReadAll(resp.Body)
|
body, err := io.ReadAll(resp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err := resp.Body.Close(); err != nil {
|
if err := resp.Body.Close(); err != nil {
|
||||||
log.Error("response close: ", err)
|
log.Error("response close: ", err)
|
||||||
|
@ -6,7 +6,6 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"os"
|
"os"
|
||||||
@ -48,7 +47,7 @@ func createTestStorage(t *testing.T, p string, seal bool, att ...*paths.Local) s
|
|||||||
b, err := json.MarshalIndent(cfg, "", " ")
|
b, err := json.MarshalIndent(cfg, "", " ")
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
require.NoError(t, ioutil.WriteFile(filepath.Join(p, metaFile), b, 0644))
|
require.NoError(t, os.WriteFile(filepath.Join(p, metaFile), b, 0644))
|
||||||
|
|
||||||
for _, s := range att {
|
for _, s := range att {
|
||||||
require.NoError(t, s.OpenPath(context.Background(), p))
|
require.NoError(t, s.OpenPath(context.Background(), p))
|
||||||
@ -130,7 +129,7 @@ func TestMoveShared(t *testing.T) {
|
|||||||
|
|
||||||
data := make([]byte, 2032)
|
data := make([]byte, 2032)
|
||||||
data[1] = 54
|
data[1] = 54
|
||||||
require.NoError(t, ioutil.WriteFile(sp.Sealed, data, 0666))
|
require.NoError(t, os.WriteFile(sp.Sealed, data, 0666))
|
||||||
fmt.Println("write to ", sp.Sealed)
|
fmt.Println("write to ", sp.Sealed)
|
||||||
|
|
||||||
require.NoError(t, index.StorageDeclareSector(ctx, storiface.ID(sid.Sealed), s1ref.ID, storiface.FTSealed, true))
|
require.NoError(t, index.StorageDeclareSector(ctx, storiface.ID(sid.Sealed), s1ref.ID, storiface.FTSealed, true))
|
||||||
@ -145,7 +144,7 @@ func TestMoveShared(t *testing.T) {
|
|||||||
require.Equal(t, id1, storiface.ID(sid.Sealed))
|
require.Equal(t, id1, storiface.ID(sid.Sealed))
|
||||||
fmt.Println("read from ", sp.Sealed)
|
fmt.Println("read from ", sp.Sealed)
|
||||||
|
|
||||||
read, err := ioutil.ReadFile(sp.Sealed)
|
read, err := os.ReadFile(sp.Sealed)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.EqualValues(t, data, read)
|
require.EqualValues(t, data, read)
|
||||||
}
|
}
|
||||||
@ -357,7 +356,7 @@ func TestReader(t *testing.T) {
|
|||||||
mockCheckAllocation(pf, offset, size, emptyPartialFile,
|
mockCheckAllocation(pf, offset, size, emptyPartialFile,
|
||||||
true, nil)
|
true, nil)
|
||||||
|
|
||||||
f, err := ioutil.TempFile("", "TestReader-")
|
f, err := os.CreateTemp("", "TestReader-")
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
_, err = f.Write(bz)
|
_, err = f.Write(bz)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
@ -502,7 +501,7 @@ func TestReader(t *testing.T) {
|
|||||||
require.NoError(t, os.Remove(f.Name()))
|
require.NoError(t, os.Remove(f.Name()))
|
||||||
}
|
}
|
||||||
|
|
||||||
bz, err := ioutil.ReadAll(rd)
|
bz, err := io.ReadAll(rd)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, tc.expectedSectorBytes, bz)
|
require.Equal(t, tc.expectedSectorBytes, bz)
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,6 @@ import (
|
|||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"math/bits"
|
"math/bits"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@ -1095,7 +1094,7 @@ func (sb *Sealer) FinalizeSectorInto(ctx context.Context, sector storiface.Secto
|
|||||||
}
|
}
|
||||||
defer done()
|
defer done()
|
||||||
|
|
||||||
files, err := ioutil.ReadDir(paths.Cache)
|
files, err := os.ReadDir(paths.Cache)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@ -130,7 +129,7 @@ func (s *seal) unseal(t *testing.T, sb *Sealer, sp *basicfs.Provider, si storifa
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
expect, _ := ioutil.ReadAll(data(si.ID.Number, 1016))
|
expect, _ := io.ReadAll(data(si.ID.Number, 1016))
|
||||||
if !bytes.Equal(b.Bytes(), expect) {
|
if !bytes.Equal(b.Bytes(), expect) {
|
||||||
t.Fatal("read wrong bytes")
|
t.Fatal("read wrong bytes")
|
||||||
}
|
}
|
||||||
@ -160,7 +159,7 @@ func (s *seal) unseal(t *testing.T, sb *Sealer, sp *basicfs.Provider, si storifa
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
expect, _ = ioutil.ReadAll(data(si.ID.Number, 1016))
|
expect, _ = io.ReadAll(data(si.ID.Number, 1016))
|
||||||
require.Equal(t, expect, b.Bytes())
|
require.Equal(t, expect, b.Bytes())
|
||||||
|
|
||||||
b.Reset()
|
b.Reset()
|
||||||
@ -240,12 +239,12 @@ func corrupt(t *testing.T, sealer *Sealer, id storiface.SectorRef) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getGrothParamFileAndVerifyingKeys(s abi.SectorSize) {
|
func getGrothParamFileAndVerifyingKeys(s abi.SectorSize) {
|
||||||
dat, err := ioutil.ReadFile("../../../build/proof-params/parameters.json")
|
dat, err := os.ReadFile("../../../build/proof-params/parameters.json")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
datSrs, err := ioutil.ReadFile("../../../build/proof-params/srs-inner-product.json")
|
datSrs, err := os.ReadFile("../../../build/proof-params/srs-inner-product.json")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
@ -281,7 +280,7 @@ func TestSealAndVerify(t *testing.T) {
|
|||||||
|
|
||||||
getGrothParamFileAndVerifyingKeys(sectorSize)
|
getGrothParamFileAndVerifyingKeys(sectorSize)
|
||||||
|
|
||||||
cdir, err := ioutil.TempDir("", "sbtest-c-")
|
cdir, err := os.MkdirTemp("", "sbtest-c-")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -352,7 +351,7 @@ func TestSealPoStNoCommit(t *testing.T) {
|
|||||||
|
|
||||||
getGrothParamFileAndVerifyingKeys(sectorSize)
|
getGrothParamFileAndVerifyingKeys(sectorSize)
|
||||||
|
|
||||||
dir, err := ioutil.TempDir("", "sbtest")
|
dir, err := os.MkdirTemp("", "sbtest")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -416,7 +415,7 @@ func TestSealAndVerify3(t *testing.T) {
|
|||||||
|
|
||||||
getGrothParamFileAndVerifyingKeys(sectorSize)
|
getGrothParamFileAndVerifyingKeys(sectorSize)
|
||||||
|
|
||||||
dir, err := ioutil.TempDir("", "sbtest")
|
dir, err := os.MkdirTemp("", "sbtest")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -494,7 +493,7 @@ func TestSealAndVerifyAggregate(t *testing.T) {
|
|||||||
|
|
||||||
getGrothParamFileAndVerifyingKeys(sectorSize)
|
getGrothParamFileAndVerifyingKeys(sectorSize)
|
||||||
|
|
||||||
cdir, err := ioutil.TempDir("", "sbtest-c-")
|
cdir, err := os.MkdirTemp("", "sbtest-c-")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -576,7 +575,7 @@ func BenchmarkWriteWithAlignment(b *testing.B) {
|
|||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
b.StopTimer()
|
b.StopTimer()
|
||||||
rf, w, _ := commpffi.ToReadableFile(bytes.NewReader(bytes.Repeat([]byte{0xff, 0}, int(bt/2))), int64(bt))
|
rf, w, _ := commpffi.ToReadableFile(bytes.NewReader(bytes.Repeat([]byte{0xff, 0}, int(bt/2))), int64(bt))
|
||||||
tf, _ := ioutil.TempFile("/tmp/", "scrb-")
|
tf, _ := os.CreateTemp("/tmp/", "scrb-")
|
||||||
b.StartTimer()
|
b.StartTimer()
|
||||||
|
|
||||||
ffi.WriteWithAlignment(abi.RegisteredSealProof_StackedDrg2KiBV1, rf, bt, tf, nil) // nolint:errcheck
|
ffi.WriteWithAlignment(abi.RegisteredSealProof_StackedDrg2KiBV1, rf, bt, tf, nil) // nolint:errcheck
|
||||||
@ -735,7 +734,7 @@ func TestGenerateUnsealedCID(t *testing.T) {
|
|||||||
func TestAddPiece512M(t *testing.T) {
|
func TestAddPiece512M(t *testing.T) {
|
||||||
sz := abi.PaddedPieceSize(512 << 20).Unpadded()
|
sz := abi.PaddedPieceSize(512 << 20).Unpadded()
|
||||||
|
|
||||||
cdir, err := ioutil.TempDir("", "sbtest-c-")
|
cdir, err := os.MkdirTemp("", "sbtest-c-")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -779,7 +778,7 @@ func BenchmarkAddPiece512M(b *testing.B) {
|
|||||||
sz := abi.PaddedPieceSize(512 << 20).Unpadded()
|
sz := abi.PaddedPieceSize(512 << 20).Unpadded()
|
||||||
b.SetBytes(int64(sz))
|
b.SetBytes(int64(sz))
|
||||||
|
|
||||||
cdir, err := ioutil.TempDir("", "sbtest-c-")
|
cdir, err := os.MkdirTemp("", "sbtest-c-")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
b.Fatal(err)
|
b.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -821,7 +820,7 @@ func BenchmarkAddPiece512M(b *testing.B) {
|
|||||||
func TestAddPiece512MPadded(t *testing.T) {
|
func TestAddPiece512MPadded(t *testing.T) {
|
||||||
sz := abi.PaddedPieceSize(512 << 20).Unpadded()
|
sz := abi.PaddedPieceSize(512 << 20).Unpadded()
|
||||||
|
|
||||||
cdir, err := ioutil.TempDir("", "sbtest-c-")
|
cdir, err := os.MkdirTemp("", "sbtest-c-")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -890,7 +889,7 @@ func TestMulticoreSDR(t *testing.T) {
|
|||||||
|
|
||||||
getGrothParamFileAndVerifyingKeys(sectorSize)
|
getGrothParamFileAndVerifyingKeys(sectorSize)
|
||||||
|
|
||||||
dir, err := ioutil.TempDir("", "sbtest")
|
dir, err := os.MkdirTemp("", "sbtest")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -995,7 +994,7 @@ func TestPoStChallengeAssumptions(t *testing.T) {
|
|||||||
func TestDCAPCloses(t *testing.T) {
|
func TestDCAPCloses(t *testing.T) {
|
||||||
sz := abi.PaddedPieceSize(2 << 10).Unpadded()
|
sz := abi.PaddedPieceSize(2 << 10).Unpadded()
|
||||||
|
|
||||||
cdir, err := ioutil.TempDir("", "sbtest-c-")
|
cdir, err := os.MkdirTemp("", "sbtest-c-")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ package fr32_test
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
@ -17,7 +16,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestWriteTwoPcs(t *testing.T) {
|
func TestWriteTwoPcs(t *testing.T) {
|
||||||
tf, _ := ioutil.TempFile("/tmp/", "scrb-")
|
tf, _ := os.CreateTemp("/tmp/", "scrb-")
|
||||||
|
|
||||||
paddedSize := abi.PaddedPieceSize(16 << 20)
|
paddedSize := abi.PaddedPieceSize(16 << 20)
|
||||||
n := 2
|
n := 2
|
||||||
@ -43,7 +42,7 @@ func TestWriteTwoPcs(t *testing.T) {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
ffiBytes, err := ioutil.ReadAll(tf)
|
ffiBytes, err := io.ReadAll(tf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ package fr32_test
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
@ -19,7 +18,7 @@ import (
|
|||||||
|
|
||||||
func padFFI(buf []byte) []byte {
|
func padFFI(buf []byte) []byte {
|
||||||
rf, w, _ := commpffi.ToReadableFile(bytes.NewReader(buf), int64(len(buf)))
|
rf, w, _ := commpffi.ToReadableFile(bytes.NewReader(buf), int64(len(buf)))
|
||||||
tf, _ := ioutil.TempFile("/tmp/", "scrb-")
|
tf, _ := os.CreateTemp("/tmp/", "scrb-")
|
||||||
|
|
||||||
_, _, _, err := ffi.WriteWithAlignment(abi.RegisteredSealProof_StackedDrg32GiBV1, rf, abi.UnpaddedPieceSize(len(buf)), tf, nil)
|
_, _, _, err := ffi.WriteWithAlignment(abi.RegisteredSealProof_StackedDrg32GiBV1, rf, abi.UnpaddedPieceSize(len(buf)), tf, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -33,7 +32,7 @@ func padFFI(buf []byte) []byte {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
padded, err := ioutil.ReadAll(tf)
|
padded, err := io.ReadAll(tf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ package fr32_test
|
|||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"bytes"
|
"bytes"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"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
|
// using bufio reader to make sure reads are big enough for the padreader - it can't handle small reads right now
|
||||||
readered, err := ioutil.ReadAll(bufio.NewReaderSize(r, 512))
|
readered, err := io.ReadAll(bufio.NewReaderSize(r, 512))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
@ -46,7 +45,7 @@ func (t testStorage) DiskUsage(path string) (int64, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func newTestStorage(t *testing.T) *testStorage {
|
func newTestStorage(t *testing.T) *testStorage {
|
||||||
tp, err := ioutil.TempDir(os.TempDir(), "sealer-test-")
|
tp, err := os.MkdirTemp(os.TempDir(), "sealer-test-")
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -58,7 +57,7 @@ func newTestStorage(t *testing.T) *testStorage {
|
|||||||
}, "", " ")
|
}, "", " ")
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
err = ioutil.WriteFile(filepath.Join(tp, "sectorstore.json"), b, 0644)
|
err = os.WriteFile(filepath.Join(tp, "sectorstore.json"), b, 0644)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@ import (
|
|||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
@ -461,7 +460,7 @@ func (mgr *SectorMgr) ReadPiece(ctx context.Context, sector storiface.SectorRef,
|
|||||||
io.Seeker
|
io.Seeker
|
||||||
io.ReaderAt
|
io.ReaderAt
|
||||||
}{
|
}{
|
||||||
ReadCloser: ioutil.NopCloser(br),
|
ReadCloser: io.NopCloser(br),
|
||||||
Seeker: br,
|
Seeker: br,
|
||||||
ReaderAt: br,
|
ReaderAt: br,
|
||||||
}, false, nil
|
}, false, nil
|
||||||
|
@ -3,7 +3,7 @@ package sealer
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
@ -346,7 +346,7 @@ func (p *pieceProviderTestHarness) readPiece(t *testing.T, offset storiface.Unpa
|
|||||||
defer func() { _ = rd.Close() }()
|
defer func() { _ = rd.Close() }()
|
||||||
|
|
||||||
// Make sure the input matches the output
|
// Make sure the input matches the output
|
||||||
readData, err := ioutil.ReadAll(rd)
|
readData, err := io.ReadAll(rd)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, expectedBytes, readData)
|
require.Equal(t, expectedBytes, readData)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user