Compare commits

...
Author SHA1 Message Date
Jiaying Wang caa6dd9c41 Merge pull request #10594 from filecoin-project/phi/v1210-rc2
build: release: v1.21.0-rc2
2023-03-29 15:59:56 -04:00
Aayush a724a713da refactor: stop using deprecated io/ioutil 2023-03-29 15:38:46 -04:00
Phi d5a3ddbf7e Add longer validation time cause to changelog
Add longer validation time cause to changelog
2023-03-29 20:39:29 +02:00
Aayush Rajasekaran b40ab4bd44 Merge pull request #10595 from filecoin-project/asr/backport
Backport  #10546, #10553
2023-03-29 14:31:43 -04:00
Phi 7a95ed063d Bump version in changelog
Bump version in changelog
2023-03-29 20:31:05 +02:00
Phi 199a1d9e75 Update Changelog with backports
Update Changelog with backports
2023-03-29 20:30:01 +02:00
Aayush 3120852eb9 feat: supply: only grab genesis msig locks for writes 2023-03-29 14:26:15 -04:00
Aayush 24381411f2 feat: supply: drop genesis market locked funds 2023-03-29 14:26:08 -04:00
06294351fa perf: eth: gas estimate set applyTsMessages false (#10546)
* have gas estimate call callInternal with applyTsMessages = false and other calls with applyTsMessages=true for gas caclulation optimization

* set applyTsMessages = true in CallWithGas call in shed

* update test with new callwithgas api optimization for eth call

* Update chain/stmgr/call.go

Co-authored-by: Łukasz Magiera <magik6k@users.noreply.github.com>

* env flag LOTUS_SKIP_APPLY_TS_MESSAGE_CALL_WITH_GAS must be 1 in order to have applyTsMessages change

* env flag LOTUS_SKIP_APPLY_TS_MESSAGE_CALL_WITH_GAS must be 1 in order to have applyTsMessages change

* make sure that even if we arent apply ts messages we grab ts messages from the particular user who is requesting gas estimation

---------

Co-authored-by: Jiaying Wang <42981373+jennijuju@users.noreply.github.com>
Co-authored-by: Łukasz Magiera <magik6k@users.noreply.github.com>
Co-authored-by: Ubuntu <ubuntu@ip-10-0-4-29.us-east-2.compute.internal>
2023-03-29 14:25:40 -04:00
Phi d3d5f92985 Update changelog for v1.21.0-rc2
Update changelog for v1.21.0-rc2
2023-03-29 20:11:50 +02:00
Phi ca1247e0d9 Update go.mod
Update go.mod
2023-03-29 19:50:14 +02:00
Phi a647390bef build: release: v1.21.0-rc2
build: release: v1.21.0-rc2
2023-03-29 19:38:47 +02:00
Phi-rjan db869853c4 Merge pull request #10591 from filecoin-project/phi/backport-go-update
build: docker: Update GO-version
2023-03-29 17:31:46 +02:00
Phi 9d5e789d88 build: docker: Update GO-version
build: docker: Update GO-version
2023-03-29 17:12:43 +02:00
Aayush Rajasekaran 0b018e56cd Merge pull request #10555 from filecoin-project/asr/fix-extend-sectors-backport
backport: fix: miner: correctly count sector extensions
2023-03-28 09:40:42 -04:00
Phi-rjan 7eae362c1e Merge pull request #10563 from Jorropo/release/v1.21.0
chore: all: bump go-libipfs
2023-03-28 08:42:46 +02:00
Phi-rjan af428b6298 Merge pull request #10574 from filecoin-project/phi/backport-slice-fix
fix: proving: Initialize slice with with same length as partition
2023-03-27 16:28:02 +02:00
Phi 8bb7272bb1 Initialize with same length as partition
Initialize the postParam.Partitions slice with the same length as i.Partitions before iterating over it in the loop.
2023-03-27 15:54:59 +02:00
Jorropo 0e73c69035 chore: all: bump go-libipfs
(cherry picked from commit f48c6268f8)
2023-03-25 10:15:21 +01:00
Aayush 7b55de21bd fix: miner: call ExtendSectorExpiration2 2023-03-23 17:32:55 -04:00
Aayush a467e1ab31 fix: miner: correctly count sector extensions 2023-03-23 17:32:51 -04:00
Phi-rjan 3f8a41cfe8 Merge pull request #10524 from filecoin-project/jen/v121
chore: build: v1.21.0-rc1
2023-03-22 17:13:12 +01:00
Phi a8580e234d Add callout to exchanges
Add callout to exchanges about the execution traces. Also moving the `execution trace format changes` section to above the contributors section.
2023-03-22 15:07:21 +01:00
Phi 938d2d9f5b Add RPC API highlight
Add RPC API highlight
2023-03-21 19:55:06 +01:00
Phi c8af33f163 chore: build: Update Changelog for v1.21.0
chore: build: Update Changelog for v1.21.0
2023-03-21 14:33:36 +01:00
Jennifer Wang 57133a8f66 release v1.21.0-rc1 prep 2023-03-21 01:10:32 -04:00
87 changed files with 515 additions and 265 deletions
+279 -1
View File
@@ -1,6 +1,238 @@
# Lotus changelog
# UNRELEASED
# 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.
## ☢️ Upgrade Warnings ☢️
Before upgrading to this feature release read carefully through these bullet points:
- Starting from this release, the SplitStore feature is automatically activated on new nodes. However, for existing Lotus users, you need to explicitly configure SplitStore by uncommenting the `EnableSplitstore` option in your `config.toml` file. To enable SplitStore, set `EnableSplitstore=true`, and to disable it, set `EnableSplitstore=false`. **It's important to note that your Lotus node will not start unless this configuration is properly set. Set it to false if you are running a full archival node!**
- This feature release requires a **minimum Go version of v1.19.7 or higher to successfully build Lotus**. Additionally, Go version v1.20 and higher is now also supported.
- **Storage Providers:** The proofs libraries now have CUDA enabled by default, which requires you to install (CUDA)[https://lotus.filecoin.io/tutorials/lotus-miner/cuda/] if you haven't already done so. If you prefer to use OpenCL on your GPUs instead, you can use the `FFI_USE_OPENCL=1` flag when building from source. On the other hand, if you want to disable GPUs altogether, you can use the `FFI_NO_GPU=1` environment variable when building from source.
- **Storage Providers:** The `lotus-miner sectors extend` command has been refactored to the functionality of `lotus-miner sectors renew`. The issue where extions did not work has been fixed in this release candidate.
- **Exchanges/Node operators/RPC-providers::** Execution traces (returned from `lotus state exec-trace`, `lotus state replay`, etc.), has changed to account for changes introduced by the by the FVM. **Please make sure to read the `Execution trace format change` section carefully, as these are interface breaking changes**
- **Syncing issues:** If you have been struggling with syncing issues in normal operations you can try to adjust the amount of threads used for more concurrent FMV execution through via the `LOTUS_FVM_CONCURRENCY` enviroment variable. It is set to 4 threads by default. Recommended formula for concurrency == YOUR_RAM/4 , but max is 128. If you are a Storage Provider and are pushing many messages within a short period of time, exporting `LOTUS_SKIP_APPLY_TS_MESSAGE_CALL_WITH_GAS=1` will also help with keeping in sync.
- **Catching up from a Snapshot:** Users have noticed that catching up sync from a snapshot is taking a lot longer these day. This is largely related to the built-in market actor consuming a lot of computational demand for block validation. A FIP for a short-term mitigation for this is currently in Last Call and will be included network version 19 upgrade if accepted. You [can read the FIP here.](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0060.md)
## Highlights
**SplitStore**
This feature release introduces numerous improvements and fixes to tackle SplitStore related issues that has been reported. With this feature release SplitStore is automatically activated by default 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!**
SplitStore also has some new configuration settings that you can set in your config.toml file:
- `HotstoreMaxSpaceTarget` suggests the max allowed space (in bytes) the hotstore can take.
- `HotstoreMaxSpaceThreshold` a moving GC will be triggered when total moving size exceeds this threshold (in bytes).
- `HotstoreMaxSpaceSafetyBuffer` a safety buffer to prevent moving GC from an overflowing disk.
The SplitStore also has two new commands:
- `lotus chain prune hot` is a much less resource-intensive GC and is best suited for situations where you don't have the spare disk space for a full GC.
- `lotus chain prune hot-moving` will run a full moving garbage collection of the hotstore. This commands create a new hotstore before deleting the old one so you need working room in the hotstore directory. The current size of a fully GC'd hotstore is around 295 GiB so you need to make sure you have at least that available.
You can read more about the new SplitStore commands in [the documentation](https://lotus.filecoin.io/lotus/configure/splitstore/#manual-chain-store-garbage-collection).
**RPC API improvements**
This feature release includes all the RPC API improvements made in the Lotus v1.20.x patch releases. It includes an updated FFI that sets the FVM parallelism to 4 by default.
Node operators with higher memory specs can experiment with setting LOTUS_FVM_CONCURRENCY to higher values, up to 48, to allow for more concurrent FVM execution.
**Experimental scheduler assigners**
In this release there are four new expirmental scheduler assigners:
- The `experiment-spread-qcount` - similar to the spread assigner but also takes nto account task counts which are in running/preparing/queued states.
- The `experiment-spread-tasks` - similar to the spread assigner, but counts running tasks on a per-task-type basis
- The `experiment-spread-tasks-qcount` - similar to the spread assigner, but also takes into account task counts which are in running/preparing/queued states, as well as counting running tasks on a per-task-type basis. Check the results for this assigner on ([storage-only lotus-workers here](https://github.com/filecoin-project/lotus/issues/8566#issuecomment-1446978856)).
- The `experiment-random` - In each schedule loop the assinger figures a set of all workers which can handle the task and then picks a random one. Check the results for this assigner on ([storage-only lotus-workers here](https://github.com/filecoin-project/lotus/issues/8566#issuecomment-1447064218)).
**Graceful shutdown of lotus-workers**
We have cleaned up some commands in the `lotus-worker` to make it less confusing how to gracefully shutting down a `lotus-worker` while there are incoming sealing tasks in the pipeline. To shut down a `lotus-worker` gracefully:
1. `lotus-worker tasks disable --all` and wait for the worker to finish processing its current tasks.
2. `lotus-worker stop` to detach it and do maintenance/upgrades.
**CLI speedups**
The `lotus-Miner sector list` is now running in parallel - which should speed up the process from anywhere between 2x-10x+. You can tune it additionally with the `check-parallelism` option in the command. The `Lotus-Miner info` command also has a large speed improvement, as calls to the lotus legacy market has been removed.
## New features
- feat: splitstore: Splitstore enabled by default (#10429) ([filecoin-project/lotus#10429](https://github.com/filecoin-project/lotus/pull/10429))
- Enables SplitStore by default on new Lotus nodes. Existing Lotus users need to explicitly configure
- feat: splitstore: Configure max space used by hotstore and GC makes best effort to respect ([filecoin-project/lotus#10391](https://github.com/filecoin-project/lotus/pull/10391))
- Adds three new configs for setting the maximum allowed space the hotstore can take.
- feat: splitstore: Badger GC of hotstore command ([filecoin-project/lotus#10387](https://github.com/filecoin-project/lotus/pull/10387))
- Adds a `lotus chain prune hot` command, to run the garbage collection of the hotstore in a user driven way.
- feat: sched: Assigner experiments ([filecoin-project/lotus#10356](https://github.com/filecoin-project/lotus/pull/10356))
- Introduces experimental scheduler assigners that works better for setups that uses storage-only lotus-workers.
- fix: wdpost: disabled post worker handling ([filecoin-project/lotus#10394](https://github.com/filecoin-project/lotus/pull/10394))
- Improved scheduling logic for Proof-of-SpaceTime workers.
- feat: cli: list claims and remove expired claims ([filecoin-project/lotus#9875](https://github.com/filecoin-project/lotus/pull/9875))
- Adds a command to list claims made by a provider `lotus filplus list-claims`. And `lotus filplus remove-expired-claims` to remove expired claims.
- feat: cli: make sectors list much faster ([filecoin-project/lotus#10202](https://github.com/filecoin-project/lotus/pull/10202))
- Makes `lotus-miner sector list` checks run in parallel.
- feat: cli: Add an EVM command to fetch a contract's bytecode ([filecoin-project/lotus#10443](https://github.com/filecoin-project/lotus/pull/10443))
- Adds an `lotus evm bytecode` command to fetch a contract's bytecode.
- feat: mempool: Reduce minimum replace fee from 1.25x to 1.1x (#10416) ([filecoin-project/lotus#10416](https://github.com/filecoin-project/lotus/pull/10416))
- Reduces replacement message fee logic to help include update message replacements from developers using Ethereum tools like MetaMask.
- feat: update renew-sectors with FIP-0045 logic ([filecoin-project/lotus#10328](https://github.com/filecoin-project/lotus/pull/10328))
- Updates the `lotus-miner sectors extend` with FIP-0045 logic to include the ability to drop claims and set the maximum number of messages contained in a message.
- feat: IPC: Abstract common consensus functions and consensus interface ([filecoin-project/lotus#9481](https://github.com/filecoin-project/lotus/pull/9481))
- Add eudico's consensus interface to Lotus and implement EC behind that interface. This abstraction is the stepping-stone for Mir's integration.
- fix: worker: add all tasks flag ([filecoin-project/lotus#10232](https://github.com/filecoin-project/lotus/pull/10232))
- Adds an `all` flag for the `lotus-worker tasks enable/disable` cmds.
- feat:shed:add cid to cbor serialization command ([filecoin-project/lotus#10032](https://github.com/filecoin-project/lotus/pull/10032))
- Adds two `lotus-shed` commands, `lotus-shed cid bytes` and `lotus-shed cid cbor` to serialize cid to cbor and cid to bytes.
- feat: add toolshed commands to inspect statetree size ([filecoin-project/lotus#9982](https://github.com/filecoin-project/lotus/pull/9982))
- Adds two commands, `lotus-shed stat-actor` and `lotus-shed stat-obj` that work with an offline lotus repo to report dag size stats.
- feat: shed: encode address to bytes ([filecoin-project/lotus#10105](https://github.com/filecoin-project/lotus/pull/10105))
- Adds a `lotus-shed address encode` for encoding a filecoin address to hex bytes.
- feat: chain: export-range ([filecoin-project/lotus#10145](https://github.com/filecoin-project/lotus/pull/10145))
- Adds a `lotus chain export-range` command that can create archival-grade ranged exports of the chain as quickly as possible.
- feat: stmgr: cache migrated stateroots ([filecoin-project/lotus#10282](https://github.com/filecoin-project/lotus/pull/10282))
- Cache network migration results to avoid running migrations twice.
- feat: shed: Add a tool to read data from sectors ([filecoin-project/lotus#10169](https://github.com/filecoin-project/lotus/pull/10169))
- Adds a lotus-shed sectors read command that extract data from sectors from a running lotus-miner deployment.
- feat: cli: Refactor renew and remove extend ([filecoin-project/lotus#9920](https://github.com/filecoin-project/lotus/pull/9920))
- Refactors the `lotus-miner sectors extend` command to have the functionality of `lotus-miner sectors renew`. The `lotus-miner sectors renew` command has been deprecated.
- feat: shed: Add beneficiary commands ([filecoin-project/lotus#10037](https://github.com/filecoin-project/lotus/pull/10037))
- Adds the beneficiary address command to `lotus-shed`. You can now use `lotus-shed actor propose-change-beneficiary` and `lotus-shed actor confirm-change-beneficiary` to change beneficiary addresses.
## Improvements
- backport: fix: miner: correctly count sector extensions (10555) ([filecoin-project/lotus#10555](https://github.com/filecoin-project/lotus/pull/10555))
- Fixes the issue with sector extensions.
- fix: proving: Initialize slice with with same length as partition (#10574) ([filecoin-project/lotus#10574])(https://github.com/filecoin-project/lotus/pull/10574)
- Fixes an issue where `lotus-miner proving compute window-post` paniced when trying to make skipped sectors human readable.
- feat: stmgr: speed up calculation of genesis circ supply (#10553) ([filecoin-project/lotus#10553])(https://github.com/filecoin-project/lotus/pull/10553)
- perf: eth: gas estimate set applyTsMessages false (#10546) ([filecoin-project/lotus#10456](https://github.com/filecoin-project/lotus/pull/10546))
- feat: config: Force existing users to opt into new defaults (#10488) ([filecoin-project/lotus#10488](https://github.com/filecoin-project/lotus/pull/10488))
- Force existing users to opt into the new SplitStore defaults.
- fix: splitstore: Demote now common logs (#10516) ([filecoin-project/lotus#10516](https://github.com/filecoin-project/lotus/pull/10516))
- fix: splitstore: Don't enforce walking receipt tree during compaction ([filecoin-project/lotus#10502](https://github.com/filecoin-project/lotus/pull/10502))
- fix: splitstore: Fix the overzealous fix (#10366) ([filecoin-project/lotus#10366](https://github.com/filecoin-project/lotus/pull/10366))
- fix: splitstore: Two fixes, better logging and comments (#10332) ([filecoin-project/lotus#10332](https://github.com/filecoin-project/lotus/pull/10332))
- fix: fsm: shutdown removed sectors FSMs ([filecoin-project/lotus#10363](https://github.com/filecoin-project/lotus/pull/10363))
- Fixes an issue where removed sectors still got state machine events.
- fix: rpcenc: Don't hang when source dies ([filecoin-project/lotus#10116](https://github.com/filecoin-project/lotus/pull/10116))
- Fixes an issue where AddPiece tasks could get stuck if the Boost process was abruptly lost.
- fix: make debugging windowPoSt-failures human readable ([filecoin-project/lotus#10390](https://github.com/filecoin-project/lotus/pull/10390))
- Makes the skipped sector list in `lotus-miner proving compute window-post` human readable.
- fix: cli: Hide `lotus-worker set` command ([filecoin-project/lotus#10384](https://github.com/filecoin-project/lotus/pull/10384))
- Hides the `lotus-worker set` command. This command will be deprecated later.
- fix: worker: Hide `wait-quiet` cmd ([filecoin-project/lotus#10331](https://github.com/filecoin-project/lotus/pull/10331))
- Hides the `lotus-worker wait-quiet` command. This command will be deprecated later.
- fix: post: Tune down default post-parallel-reads ([filecoin-project/lotus#10365](https://github.com/filecoin-project/lotus/pull/10365))
- Tuning down the default post-parallel-reads to a more conservative number to prevent sectors from being skipped due to network timeouts.
- fix: cli: error if backup file already exists ([filecoin-project/lotus#10209](https://github.com/filecoin-project/lotus/pull/10209))
- Error out if a backup file with the same name already exists when using the `lotus-miner backup` or `lotus backup` command
- fix: cli: option to set-seal-delay in seconds ([filecoin-project/lotus#10208](https://github.com/filecoin-project/lotus/pull/10208))
- Adds the option to specify `lotus-miner sectors set-seal-delay` in seconds
- fix: cli: extend cmd to get the right sector number ([filecoin-project/lotus#10182](https://github.com/filecoin-project/lotus/pull/10182))
- Making sure the `lotus-miner sectors extend` command gets the correct sector number.
- feat: wdpost: Emit more detailed errors ([filecoin-project/lotus#10121](https://github.com/filecoin-project/lotus/pull/10121))
- Emits more detailed windowPoSt error messages, making it easier to debug PoSt issues.
- fix: Lotus Gateway: Add missing methods - master ([filecoin-project/lotus#10420](https://github.com/filecoin-project/lotus/pull/10420))
- Adds `StateNetworkName`, `MpoolGetNonce`, `StateCall` and `StateDecodeParams` methods to Lotus Gateway.
- fix: stmgr: don't attempt to lookup genesis state (#10472) ([filecoin-project/lotus#10472](https://github.com/filecoin-project/lotus/pull/10472))
- feat: gateway: export StateVerifierStatus ([filecoin-project/lotus#10477](https://github.com/filecoin-project/lotus/pull/10477))
- fix: gateway: correctly apply the fee history lookback max ([filecoin-project/lotus#10464](https://github.com/filecoin-project/lotus/pull/10464))
- fix: gateway: drop overzealous guard on MsigGetVested ([filecoin-project/lotus#10451](https://github.com/filecoin-project/lotus/pull/10451))
- feat: apply gateway lookback limit to eth API lookback ([filecoin-project/lotus#10467](https://github.com/filecoin-project/lotus/pull/10467))
- fix: revert "Eth API: drop support for 'pending' block parameter." ([filecoin-project/lotus#10474](https://github.com/filecoin-project/lotus/pull/10474))
- fix: Eth API: make net_version return the chain ID ([filecoin-project/lotus#10456](https://github.com/filecoin-project/lotus/pull/10456))
- fix: eth: handle a potential divide by zero in receipt handling ([filecoin-project/lotus#10495](https://github.com/filecoin-project/lotus/pull/10495))
- fix: ethrpc: Don't lock up when eth subscriber goes away ([filecoin-project/lotus#10485](https://github.com/filecoin-project/lotus/pull/10485))
- feat: eth: Avoid StateCompute in EthTxnReceipt lookup (#10460) ([filecoin-project/lotus#10460](https://github.com/filecoin-project/lotus/pull/10460))
- feat: eth: optimize eth block loading + eth_feeHistory ([filecoin-project/lotus#10446](https://github.com/filecoin-project/lotus/pull/10446))
- feat: state: skip tipset execution when possible ([filecoin-project/lotus#10445](https://github.com/filecoin-project/lotus/pull/10445))
- feat: eth API: reject masked ID addresses embedded in f410f payloads ([filecoin-project/lotus#10440](https://github.com/filecoin-project/lotus/pull/10440))
- fix: Eth API: make block parameter parsing sounder. ([filecoin-project/lotus#10427](https://github.com/filecoin-project/lotus/pull/10427))
- fix: eth API: return correct txIdx around null blocks (#10419) ([filecoin-project/lotus#10419](https://github.com/filecoin-project/lotus/pull/10419))
- fix: EthAPI: use StateCompute for feeHistory; apply minimum gas premium (#10413) ([filecoin-project/lotus#10413](https://github.com/filecoin-project/lotus/pull/10413))
- refactor: EthAPI: Drop unnecessary param from newEthTxReceipt ([filecoin-project/lotus#10411](https://github.com/filecoin-project/lotus/pull/10411))
- fix: eth API: correct gateway restrictions, drop unimplemented methods ([filecoin-project/lotus#10409](https://github.com/filecoin-project/lotus/pull/10409))
- fix: EthAPI: Correctly get parent hash ([filecoin-project/lotus#10389](https://github.com/filecoin-project/lotus/pull/10389))
- fix: EthAPI: Make newEthBlockFromFilecoinTipSet faster and correct ([filecoin-project/lotus#10380](https://github.com/filecoin-project/lotus/pull/10380))
- fix: eth: incorrect struct tags (#10309) ([filecoin-project/lotus#10309](https://github.com/filecoin-project/lotus/pull/10309))
- refactor: update cache to the new generic version (#10463) ([filecoin-project/lotus#10463](https://github.com/filecoin-project/lotus/pull/10463))
- feat: consensus: log ApplyBlock timing/gas stats ([filecoin-project/lotus#10470](https://github.com/filecoin-project/lotus/pull/10470))
- feat: chain: make chain tipset fetching 1000x faster ([filecoin-project/lotus#10423](https://github.com/filecoin-project/lotus/pull/10423))
- chain: explicitly check that gasLimit is above zero ([filecoin-project/lotus#10198](https://github.com/filecoin-project/lotus/pull/10198))
- feat: blockstore: Envvar can adjust badger compaction worker poolsize ([filecoin-project/lotus#9973](https://github.com/filecoin-project/lotus/pull/9973))
- feat: stmgr: add env to disable premigrations ([filecoin-project/lotus#10283](https://github.com/filecoin-project/lotus/pull/10283))
- chore: Remove legacy market info from lotus-miner info ([filecoin-project/lotus#10364](https://github.com/filecoin-project/lotus/pull/10364))
- Removes the legacy market info in the `Lotus-Miner info`. Speeds up the command significantly.
- chore: blockstore: Plumb through a proper Flush() method on all blockstores ([filecoin-project/lotus#10465](https://github.com/filecoin-project/lotus/pull/10465))
- fix: extend LOTUS_CHAIN_BADGERSTORE_DISABLE_FSYNC to the markset ([filecoin-project/lotus#10172](https://github.com/filecoin-project/lotus/pull/10172))
- feat: vm: switch to the new exec trace format (#10372) ([filecoin-project/lotus#10372](https://github.com/filecoin-project/lotus/pull/10372))
- fix: Remove workaround that is no longer needed ([filecoin-project/lotus#9995](https://github.com/filecoin-project/lotus/pull/9995))
- feat: Check for allocation expiry when waiting to seal sectors ([filecoin-project/lotus#9878](https://github.com/filecoin-project/lotus/pull/9878))
- feat: Allow libp2p user agent to be overriden ([filecoin-project/lotus#10149](https://github.com/filecoin-project/lotus/pull/10149))
- feat: cli: Add global color flag ([filecoin-project/lotus#10022](https://github.com/filecoin-project/lotus/pull/10022))
- fix: should not serve non v0 api in v0 ([filecoin-project/lotus#10066](https://github.com/filecoin-project/lotus/pull/10066))
- fix: build: drop drand incentinet servers ([filecoin-project/lotus#10476](https://github.com/filecoin-project/lotus/pull/10476))
- fix: sealing: stub out the FileSize function on Windows ([filecoin-project/lotus#10035](https://github.com/filecoin-project/lotus/pull/10035))
## Dependencies
- github.com/filecoin-project/go-dagaggregator-unixfs (v0.2.0 -> v0.3.0):
- github.com/filecoin-project/go-fil-markets (v1.25.2 -> v1.27.0-rc1):
- github.com/filecoin-project/go-jsonrpc (v0.2.1 -> v0.2.3):
- github.com/filecoin-project/go-statemachine (v1.0.2 -> v1.0.3):
- github.com/ipfs/go-cid (v0.3.2 -> v0.4.0):
- github.com/ipfs/go-libipfs (v0.5.0 -> v0.7.0):
- github.com/ipfs/go-path (v0.3.0 -> v0.3.1):
- deps: update go-libp2p-pubsub to v0.9.3 ([filecoin-project/lotus#10483](https://github.com/filecoin-project/lotus/pull/10483))
- deps: Update go-jsonrpc to v0.2.2 ([filecoin-project/lotus#10395](https://github.com/filecoin-project/lotus/pull/10395))
- Update to go-data-transfer v2 and libp2p, still wip ([filecoin-project/lotus#10382](https://github.com/filecoin-project/lotus/pull/10382))
- dep: ipld: update ipld prime to v0.20.0 ([filecoin-project/lotus#10247](https://github.com/filecoin-project/lotus/pull/10247))
- chore: node: migrate go-bitswap to go-libipfs/bitswap ([filecoin-project/lotus#10138](https://github.com/filecoin-project/lotus/pull/10138))
- chore: all: bump go-libipfs to replace go-block-format ([filecoin-project/lotus#10126](https://github.com/filecoin-project/lotus/pull/10126))
- chore: market: Upgrade to index-provider 0.10.0 ([filecoin-project/lotus#9981](https://github.com/filecoin-project/lotus/pull/9981))
- chore: all: bump go-libipfs ([filecoin-project/lotus#10563](https://github.com/filecoin-project/lotus/pull/10563))
## Others
- Update service_developer_bug_report.yml ([filecoin-project/lotus#10321](https://github.com/filecoin-project/lotus/pull/10321))
- Update service_developer_bug_report.yml ([filecoin-project/lotus#10321](https://github.com/filecoin-project/lotus/pull/10321))
- chore: github: Service-provider/dev bug template ([filecoin-project/lotus#10321](https://github.com/filecoin-project/lotus/pull/10321))
- chore: github: update enhancement and feature templates ([filecoin-project/lotus#10291](https://github.com/filecoin-project/lotus/pull/10291))
- chore: github: Update bug_report template ([filecoin-project/lotus#10289](https://github.com/filecoin-project/lotus/pull/10289))
- fix: itest: avoid failing the test when we race the miner ([filecoin-project/lotus#10461](https://github.com/filecoin-project/lotus/pull/10461))
- fix: github: Discussion and FIP links in `New Issue` ([filecoin-project/lotus#10268](https://github.com/filecoin-project/lotus/pull/10268))
- fix: state: short-circuit genesis state computation ([filecoin-project/lotus#10397](https://github.com/filecoin-project/lotus/pull/10397))
- fix: rpcenc: deflake TestReaderRedirectDrop ([filecoin-project/lotus#10406](https://github.com/filecoin-project/lotus/pull/10406))
- fix: tests: Fix TestMinerAllInfo test ([filecoin-project/lotus#10319](https://github.com/filecoin-project/lotus/pull/10319))
- fix: tests: Make TestWorkerKeyChange not flaky ([filecoin-project/lotus#10320](https://github.com/filecoin-project/lotus/pull/10320))
- test: eth: make sure we can deploy a new placeholder on transfer (#10281) ([filecoin-project/lotus#10281](https://github.com/filecoin-project/lotus/pull/10281))
- fix: itests: Fix flaky paych test ([filecoin-project/lotus#10100](https://github.com/filecoin-project/lotus/pull/10100))
- fix: cli: add ArgsUsage ([filecoin-project/lotus#10147](https://github.com/filecoin-project/lotus/pull/10147))
- chore: cli: cleanup cli ([filecoin-project/lotus#10114](https://github.com/filecoin-project/lotus/pull/10114))
- chore: cli: Remove unneeded individual color flags ([filecoin-project/lotus#10028](https://github.com/filecoin-project/lotus/pull/10028))
- fix: cli: remove requirements in helptext ([filecoin-project/lotus#9969](https://github.com/filecoin-project/lotus/pull/9969))
- chore: build: release v1.21.0-rc1 prep ([filecoin-project/lotus#10524](https://github.com/filecoin-project/lotus/pull/10524))
- chore: merge release/v1.20.0 into master ([filecoin-project/lotus#10308](https://github.com/filecoin-project/lotus/pull/10308))
- chore: merge release branch into master ([filecoin-project/lotus#10272](https://github.com/filecoin-project/lotus/pull/10272))
- chore: merge release/v1.20.0 into master ([filecoin-project/lotus#10238](https://github.com/filecoin-project/lotus/pull/10238))
- chore: releases to master ([filecoin-project/lotus#10490](https://github.com/filecoin-project/lotus/pull/10490))
- chore: merge releases into master ([filecoin-project/lotus#10377](https://github.com/filecoin-project/lotus/pull/10377))
- chore: merge release/v1.20.0 into master ([filecoin-project/lotus#10030](https://github.com/filecoin-project/lotus/pull/10030))
- chore: update ffi to increase execution parallelism (#10480) ([filecoin-project/lotus#10480](https://github.com/filecoin-project/lotus/pull/10480))
- chore: update the FFI for release (#10435) ([filecoin-project/lotus#10444](https://github.com/filecoin-project/lotus/pull/10444))
- build: bump version to v1.21.0-dev ([filecoin-project/lotus#10249](https://github.com/filecoin-project/lotus/pull/10249))
- build: docker: Update GO-version (#10591) ([filecoin-project/lotus#10249](https://github.com/filecoin-project/lotus/pull/10591))
- chore: merge release/v1.20.0 into master ([filecoin-project/lotus#10184](https://github.com/filecoin-project/lotus/pull/10184))
- docs: API Gateway: patch documentation note about make gen command ([filecoin-project/lotus#10422](https://github.com/filecoin-project/lotus/pull/10422))
- chore: docs: fix docs typos ([filecoin-project/lotus#10155](https://github.com/filecoin-project/lotus/pull/10155))
- chore: docker: Add back <<network>> parameter for docker push ([filecoin-project/lotus#10096](https://github.com/filecoin-project/lotus/pull/10096))
- chore: docker: Properly balance <<?>> in circleci docker config ([filecoin-project/lotus#10088](https://github.com/filecoin-project/lotus/pull/10088))
- chore: ci: Fix dirty git state when building docker images ([filecoin-project/lotus#10125](https://github.com/filecoin-project/lotus/pull/10125))
- chore: build: Remove AppImage and Snapcraft build automation ([filecoin-project/lotus#10003](https://github.com/filecoin-project/lotus/pull/10003))
- chore: ci: Update codeql to v2 ([filecoin-project/lotus#10120](https://github.com/filecoin-project/lotus/pull/10120))
- feat: ci: make ci more efficient ([filecoin-project/lotus#9910](https://github.com/filecoin-project/lotus/pull/9910))
- feat: scripts: go.mod dep diff script ([filecoin-project/lotus#9711](https://github.com/filecoin-project/lotus/pull/9711))
## Execution Trace Format Changes
@@ -154,6 +386,52 @@ New <code>ExecutionTrace</code>:
</details>
## Contributors
| Contributor | Commits | Lines ± | Files Changed |
|-------------|---------|---------|---------------|
| Hannah Howard | 2 | +2909/-6026 | 84 |
| Łukasz Magiera | 42 | +2967/-1848 | 95 |
| Steven Allen | 20 | +1703/-1345 | 88 |
| Alfonso de la Rocha | 17 | +823/-1808 | 86 |
| Peter Rabbitson | 9 | +1957/-219 | 34 |
| Geoff Stuart | 12 | +818/-848 | 29 |
| hannahhoward | 5 | +507/-718 | 36 |
| Hector Sanjuan | 6 | +443/-726 | 35 |
| Kevin Li | 1 | +1124/-14 | 22 |
| zenground0 | 30 | +791/-269 | 88 |
| frrist | 1 | +992/-16 | 13 |
| Travis Person | 4 | +837/-53 | 24 |
| Phi | 20 | +622/-254 | 34 |
| Ian Davis | 7 | +35/-729 | 20 |
| Aayush | 10 | +378/-177 | 40 |
| Raúl Kripalani | 15 | +207/-138 | 19 |
| Arsenii Petrovich | 7 | +248/-94 | 30 |
| ZenGround0 | 5 | +238/-39 | 15 |
| Neel Virdy | 1 | +109/-107 | 58 |
| ychiao | 1 | +135/-39 | 3 |
| Jorropo | 2 | +87/-82 | 67 |
| Marten Seemann | 8 | +69/-64 | 17 |
| Rod Vagg | 1 | +55/-16 | 3 |
| Masih H. Derkani | 3 | +39/-27 | 12 |
| raulk | 2 | +30/-29 | 5 |
| dependabot[bot] | 4 | +37/-17 | 8 |
| beck | 2 | +38/-2 | 2 |
| Jennifer Wang | 4 | +20/-19 | 19 |
| Richard Guan | 3 | +28/-8 | 5 |
| omahs | 7 | +14/-14 | 7 |
| dirkmc | 2 | +19/-7 | 6 |
| David Choi | 2 | +16/-5 | 2 |
| Mike Greenberg | 1 | +18/-1 | 1 |
| Adin Schmahmann | 1 | +19/-0 | 2 |
| Phi-rjan | 5 | +12/-4 | 5 |
| Dirk McCormick | 2 | +6/-6 | 3 |
| Aayush Rajasekaran | 2 | +9/-3 | 2 |
| Jiaying Wang | 5 | +6/-4 | 5 |
| Anjor Kanekar | 1 | +5/-5 | 1 |
| vyzo | 1 | +3/-3 | 2 |
| 0x5459 | 1 | +1/-1 | 1 |
# v1.20.3 / 2023-03-09
A 🐈 stepped on the ⌨️ and made a mistake while resolving conflicts 😨. This releases only includes #10439 to fix that mistake. v1.20.2 is retracted - Please skip v1.20.2 and **only** update to v1.20.3!!!
+1 -1
View File
@@ -1,5 +1,5 @@
#####################################
FROM golang:1.18.8-buster AS lotus-builder
FROM golang:1.19.7-buster AS lotus-builder
MAINTAINER Lotus Development Team
RUN apt-get update && apt-get install -y ca-certificates build-essential clang ocl-icd-opencl-dev ocl-icd-libopencl1 jq libhwloc-dev
+1 -1
View File
@@ -1,6 +1,6 @@
##### DEPRECATED
FROM golang:1.18.8-buster AS builder-deps
FROM golang:1.19.7-buster AS builder-deps
MAINTAINER Lotus Development Team
RUN apt-get update && apt-get install -y ca-certificates build-essential clang ocl-icd-opencl-dev ocl-icd-libopencl1 jq libhwloc-dev
+2 -2
View File
@@ -71,10 +71,10 @@ For other distributions you can find the required dependencies [here.](https://l
#### Go
To build Lotus, you need a working installation of [Go 1.18.8 or higher](https://golang.org/dl/):
To build Lotus, you need a working installation of [Go 1.19.7 or higher](https://golang.org/dl/):
```bash
wget -c https://golang.org/dl/go1.18.8.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local
wget -c https://golang.org/dl/go1.19.7.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local
```
**TIP:**
+2 -2
View File
@@ -3,7 +3,7 @@ package blockstore
import (
"bytes"
"context"
"io/ioutil"
"io"
"github.com/ipfs/go-cid"
httpapi "github.com/ipfs/go-ipfs-http-client"
@@ -103,7 +103,7 @@ func (i *IPFSBlockstore) Get(ctx context.Context, cid cid.Cid) (blocks.Block, er
return nil, xerrors.Errorf("getting ipfs block: %w", err)
}
data, err := ioutil.ReadAll(rd)
data, err := io.ReadAll(rd)
if err != nil {
return nil, err
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -37,7 +37,7 @@ func BuildTypeString() string {
}
// BuildVersion is the local build version
const BuildVersion = "1.21.0-dev"
const BuildVersion = "1.21.0-rc2"
func UserVersion() string {
if os.Getenv("LOTUS_VERSION_IGNORE_COMMIT") == "1" {
+12 -13
View File
@@ -4,7 +4,6 @@ import (
"bytes"
"fmt"
"go/format"
"io/ioutil"
"os"
"path/filepath"
"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 {
return xerrors.Errorf("loading actor template: %w", err)
}
@@ -90,7 +89,7 @@ func generateAdapters() error {
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
}
}
@@ -100,7 +99,7 @@ func generateAdapters() 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 os.IsNotExist(err) {
return nil // skip
@@ -123,7 +122,7 @@ func generateState(actDir string, versions []int) error {
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
}
}
@@ -132,7 +131,7 @@ func generateState(actDir string, versions []int) 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 os.IsNotExist(err) {
return nil // skip
@@ -155,7 +154,7 @@ func generateMessages(actDir string) error {
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
}
}
@@ -165,7 +164,7 @@ func generateMessages(actDir string) error {
func generatePolicy(policyPath string) error {
pf, err := ioutil.ReadFile(policyPath + ".template")
pf, err := os.ReadFile(policyPath + ".template")
if err != nil {
if os.IsNotExist(err) {
return nil // skip
@@ -187,7 +186,7 @@ func generatePolicy(policyPath string) error {
return err
}
if err := ioutil.WriteFile(policyPath, b.Bytes(), 0666); err != nil {
if err := os.WriteFile(policyPath, b.Bytes(), 0666); err != nil {
return err
}
@@ -196,7 +195,7 @@ func generatePolicy(policyPath string) error {
func generateBuiltin(builtinPath string) error {
bf, err := ioutil.ReadFile(builtinPath + ".template")
bf, err := os.ReadFile(builtinPath + ".template")
if err != nil {
if os.IsNotExist(err) {
return nil // skip
@@ -218,7 +217,7 @@ func generateBuiltin(builtinPath string) error {
return err
}
if err := ioutil.WriteFile(builtinPath, b.Bytes(), 0666); err != nil {
if err := os.WriteFile(builtinPath, b.Bytes(), 0666); err != nil {
return err
}
@@ -227,7 +226,7 @@ func generateBuiltin(builtinPath string) error {
func generateRegistry(registryPath string) error {
bf, err := ioutil.ReadFile(registryPath + ".template")
bf, err := os.ReadFile(registryPath + ".template")
if err != nil {
if os.IsNotExist(err) {
return nil // skip
@@ -248,7 +247,7 @@ func generateRegistry(registryPath string) error {
return err
}
if err := ioutil.WriteFile(registryPath, b.Bytes(), 0666); err != nil {
if err := os.WriteFile(registryPath, b.Bytes(), 0666); err != nil {
return err
}
+3 -3
View File
@@ -5,7 +5,7 @@ import (
"context"
"fmt"
"io"
"io/ioutil"
"os"
"sync/atomic"
"time"
@@ -167,7 +167,7 @@ func NewGeneratorWithSectorsAndUpgradeSchedule(numSectors int, us stmgr.UpgradeS
maddr1 := genesis2.MinerAddress(0)
m1temp, err := ioutil.TempDir("", "preseal")
m1temp, err := os.MkdirTemp("", "preseal")
if err != nil {
return nil, err
}
@@ -179,7 +179,7 @@ func NewGeneratorWithSectorsAndUpgradeSchedule(numSectors int, us stmgr.UpgradeS
maddr2 := genesis2.MinerAddress(1)
m2temp, err := ioutil.TempDir("", "preseal")
m2temp, err := os.MkdirTemp("", "preseal")
if err != nil {
return nil, err
}
+16 -6
View File
@@ -52,8 +52,8 @@ func (sm *StateManager) Call(ctx context.Context, msg *types.Message, ts *types.
}
// CallWithGas calculates the state for a given tipset, and then applies the given message on top of that state.
func (sm *StateManager) CallWithGas(ctx context.Context, msg *types.Message, priorMsgs []types.ChainMsg, ts *types.TipSet) (*api.InvocResult, error) {
return sm.callInternal(ctx, msg, priorMsgs, ts, cid.Undef, sm.GetNetworkVersion, true, true)
func (sm *StateManager) CallWithGas(ctx context.Context, msg *types.Message, priorMsgs []types.ChainMsg, ts *types.TipSet, applyTsMessages bool) (*api.InvocResult, error) {
return sm.callInternal(ctx, msg, priorMsgs, ts, cid.Undef, sm.GetNetworkVersion, true, applyTsMessages)
}
// CallAtStateAndVersion allows you to specify a message to execute on the given stateCid and network version.
@@ -117,12 +117,22 @@ func (sm *StateManager) callInternal(ctx context.Context, msg *types.Message, pr
if stateCid == cid.Undef {
stateCid = ts.ParentState()
}
tsMsgs, err := sm.cs.MessagesForTipset(ctx, ts)
if err != nil {
return nil, xerrors.Errorf("failed to lookup messages for parent tipset: %w", err)
}
if applyTsMessages {
tsMsgs, err := sm.cs.MessagesForTipset(ctx, ts)
if err != nil {
return nil, xerrors.Errorf("failed to lookup messages for parent tipset: %w", err)
}
priorMsgs = append(tsMsgs, priorMsgs...)
} else {
var filteredTsMsgs []types.ChainMsg
for _, tsMsg := range tsMsgs {
//TODO we should technically be normalizing the filecoin address of from when we compare here
if tsMsg.VMMessage().From == msg.VMMessage().From {
filteredTsMsgs = append(filteredTsMsgs, tsMsg)
}
}
priorMsgs = append(filteredTsMsgs, priorMsgs...)
}
// Technically, the tipset we're passing in here should be ts+1, but that may not exist.
+2 -2
View File
@@ -340,7 +340,7 @@ func testForkRefuseCall(t *testing.T, nullsBefore, nullsAfter int) {
currentHeight := ts.TipSet.TipSet().Height()
// CallWithGas calls on top of the given tipset.
ret, err := sm.CallWithGas(ctx, m, nil, ts.TipSet.TipSet())
ret, err := sm.CallWithGas(ctx, m, nil, ts.TipSet.TipSet(), true)
if parentHeight <= testForkHeight && currentHeight >= testForkHeight {
// If I had a fork, or I _will_ have a fork, it should fail.
require.Equal(t, ErrExpensiveFork, err)
@@ -361,7 +361,7 @@ func testForkRefuseCall(t *testing.T, nullsBefore, nullsAfter int) {
// Calls without a tipset should walk back to the last non-fork tipset.
// We _verify_ that the migration wasn't run multiple times at the end of the
// test.
ret, err = sm.CallWithGas(ctx, m, nil, nil)
ret, err = sm.CallWithGas(ctx, m, nil, nil, true)
require.NoError(t, err)
require.True(t, ret.MsgRct.ExitCode.IsSuccess())
+1 -2
View File
@@ -130,8 +130,7 @@ type StateManager struct {
postIgnitionVesting []msig0.State
postCalicoVesting []msig0.State
genesisPledge abi.TokenAmount
genesisMarketFunds abi.TokenAmount
genesisPledge abi.TokenAmount
tsExec Executor
tsExecMonitor ExecMonitor
+10 -12
View File
@@ -51,17 +51,13 @@ func (sm *StateManager) setupGenesisVestingSchedule(ctx context.Context) error {
return xerrors.Errorf("loading state tree: %w", err)
}
gmf, err := getFilMarketLocked(ctx, sTree)
if err != nil {
return xerrors.Errorf("setting up genesis market funds: %w", err)
}
gp, err := getFilPowerLocked(ctx, sTree)
if err != nil {
return xerrors.Errorf("setting up genesis pledge: %w", err)
}
sm.genesisMarketFunds = gmf
sm.genesisMsigLk.Lock()
defer sm.genesisMsigLk.Unlock()
sm.genesisPledge = gp
totalsByEpoch := make(map[abi.ChainEpoch]abi.TokenAmount)
@@ -128,6 +124,8 @@ func (sm *StateManager) setupPostIgnitionVesting(ctx context.Context) error {
totalsByEpoch[sixYears] = big.NewInt(100_000_000)
totalsByEpoch[sixYears] = big.Add(totalsByEpoch[sixYears], big.NewInt(300_000_000))
sm.genesisMsigLk.Lock()
defer sm.genesisMsigLk.Unlock()
sm.postIgnitionVesting = make([]msig0.State, 0, len(totalsByEpoch))
for k, v := range totalsByEpoch {
ns := msig0.State{
@@ -178,6 +176,9 @@ func (sm *StateManager) setupPostCalicoVesting(ctx context.Context) error {
totalsByEpoch[sixYears] = big.Add(totalsByEpoch[sixYears], big.NewInt(300_000_000))
totalsByEpoch[sixYears] = big.Add(totalsByEpoch[sixYears], big.NewInt(9_805_053))
sm.genesisMsigLk.Lock()
defer sm.genesisMsigLk.Unlock()
sm.postCalicoVesting = make([]msig0.State, 0, len(totalsByEpoch))
for k, v := range totalsByEpoch {
ns := msig0.State{
@@ -198,21 +199,20 @@ func (sm *StateManager) setupPostCalicoVesting(ctx context.Context) error {
func (sm *StateManager) GetFilVested(ctx context.Context, height abi.ChainEpoch) (abi.TokenAmount, error) {
vf := big.Zero()
sm.genesisMsigLk.Lock()
defer sm.genesisMsigLk.Unlock()
// TODO: combine all this?
if sm.preIgnitionVesting == nil || sm.genesisPledge.IsZero() || sm.genesisMarketFunds.IsZero() {
if sm.preIgnitionVesting == nil || sm.genesisPledge.IsZero() {
err := sm.setupGenesisVestingSchedule(ctx)
if err != nil {
return vf, xerrors.Errorf("failed to setup pre-ignition vesting schedule: %w", err)
}
}
if sm.postIgnitionVesting == nil {
err := sm.setupPostIgnitionVesting(ctx)
if err != nil {
return vf, xerrors.Errorf("failed to setup post-ignition vesting schedule: %w", err)
}
}
if sm.postCalicoVesting == nil {
err := sm.setupPostCalicoVesting(ctx)
@@ -246,8 +246,6 @@ func (sm *StateManager) GetFilVested(ctx context.Context, height abi.ChainEpoch)
if height <= build.UpgradeAssemblyHeight {
// continue to use preIgnitionGenInfos, nothing changed at the Ignition epoch
vf = big.Add(vf, sm.genesisPledge)
// continue to use preIgnitionGenInfos, nothing changed at the Ignition epoch
vf = big.Add(vf, sm.genesisMarketFunds)
}
return vf, nil
+1 -2
View File
@@ -9,7 +9,6 @@ import (
"fmt"
"html/template"
"io"
"io/ioutil"
"os"
"reflect"
"sort"
@@ -1090,7 +1089,7 @@ var StateComputeStateCmd = &cli.Command{
var stout *lapi.ComputeStateOutput
if csofile := cctx.String("compute-state-output"); csofile != "" {
data, err := ioutil.ReadFile(csofile)
data, err := os.ReadFile(csofile)
if err != nil {
return err
}
+1 -2
View File
@@ -4,7 +4,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"path"
@@ -65,7 +64,7 @@ func ClientExportStream(apiAddr string, apiAuth http.Header, eref api.ExportRef,
}
if resp.StatusCode != http.StatusOK {
em, err := ioutil.ReadAll(resp.Body)
em, err := io.ReadAll(resp.Body)
if err != nil {
return nil, xerrors.Errorf("reading error body: %w", err)
}
+1 -2
View File
@@ -6,7 +6,6 @@ import (
"encoding/hex"
"encoding/json"
"fmt"
"io/ioutil"
"os"
"strings"
@@ -337,7 +336,7 @@ var walletImport = &cli.Command{
inpdata = indata
} else {
fdata, err := ioutil.ReadFile(cctx.Args().First())
fdata, err := os.ReadFile(cctx.Args().First())
if err != nil {
return err
}
+1 -2
View File
@@ -6,7 +6,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"math"
"net/http"
_ "net/http/pprof"
@@ -158,7 +157,7 @@ var importBenchCmd = &cli.Command{
if rdir := cctx.String("repodir"); rdir != "" {
tdir = rdir
} else {
tmp, err := ioutil.TempDir("", "lotus-import-bench")
tmp, err := os.MkdirTemp("", "lotus-import-bench")
if err != nil {
return err
}
+4 -5
View File
@@ -4,7 +4,6 @@ import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"math/big"
"math/rand"
"os"
@@ -197,7 +196,7 @@ var sealBenchCmd = &cli.Command{
return xerrors.Errorf("creating sectorbuilder dir: %w", err)
}
tsdir, err := ioutil.TempDir(sdir, "bench")
tsdir, err := os.MkdirTemp(sdir, "bench")
if err != nil {
return err
}
@@ -287,7 +286,7 @@ var sealBenchCmd = &cli.Command{
// sectorbuilder directory... we need a better way to handle
// 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 {
return err
}
@@ -637,7 +636,7 @@ func runSeals(sb *ffiwrapper.Sealer, sbfs *basicfs.Provider, numSectors int, par
return err
}
if err := ioutil.WriteFile(saveC2inp, b, 0664); err != nil {
if err := os.WriteFile(saveC2inp, b, 0664); err != nil {
log.Warnf("%+v", err)
}
}
@@ -751,7 +750,7 @@ var proveCmd = &cli.Command{
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 {
return xerrors.Errorf("reading input file: %w", err)
}
+4 -5
View File
@@ -5,7 +5,6 @@ import (
"encoding/base64"
"encoding/json"
"fmt"
"io/ioutil"
"os"
"strconv"
"time"
@@ -444,7 +443,7 @@ var simpleCommit1 = &cli.Command{
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)
}
@@ -478,7 +477,7 @@ var simpleCommit2 = &cli.Command{
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 {
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)
}
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)
}
@@ -934,7 +933,7 @@ var simpleProveReplicaUpdate2 = &cli.Command{
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 {
return xerrors.Errorf("reading valilla proof file: %w", err)
}
+2 -2
View File
@@ -6,7 +6,7 @@ package main
import (
"encoding/json"
"io/ioutil"
"io"
"net/http"
"net/url"
"os"
@@ -63,7 +63,7 @@ func VerifyToken(token, remoteIP string) (Response, error) {
return resp, err
}
b, err := ioutil.ReadAll(r.Body)
b, err := io.ReadAll(r.Body)
_ = r.Body.Close() // close immediately after reading finished
if err != nil {
return resp, err
+2 -3
View File
@@ -7,7 +7,6 @@ import (
"encoding/binary"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"os"
"path/filepath"
@@ -246,7 +245,7 @@ var initCmd = &cli.Command{
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)
}
@@ -292,7 +291,7 @@ func migratePreSealMeta(ctx context.Context, api v1api.FullNode, metadata string
return xerrors.Errorf("expanding preseal dir: %w", err)
}
b, err := ioutil.ReadFile(metadata)
b, err := os.ReadFile(metadata)
if err != nil {
return xerrors.Errorf("reading preseal metadata: %w", err)
}
+1 -2
View File
@@ -3,7 +3,6 @@ package main
import (
"context"
"encoding/json"
"io/ioutil"
"os"
"github.com/docker/go-units"
@@ -59,7 +58,7 @@ var restoreCmd = &cli.Command{
return xerrors.Errorf("expanding storage config path: %w", err)
}
cfb, err := ioutil.ReadFile(cf)
cfb, err := os.ReadFile(cf)
if err != nil {
return xerrors.Errorf("reading storage config: %w", err)
}
+4
View File
@@ -658,6 +658,10 @@ It will not send any messages to the chain.`,
for _, i := range res {
var postParam SubmitWindowedPoStParams
postParam.Deadline = i.Deadline
// Initialize the postParam.Partitions slice with the same length as i.Partitions
postParam.Partitions = make([]PoStPartition, len(i.Partitions))
for id, part := range i.Partitions {
postParam.Partitions[id].Index = part.Index
count, err := part.Skipped.Count()
+3 -2
View File
@@ -1160,8 +1160,9 @@ var sectorsExtendCmd = &cli.Command{
}
sectorsInDecl := int(sectorsWithoutClaimsCount) + len(sectorsWithClaims)
scount += sectorsInDecl
if scount+sectorsInDecl > addrSectors || len(p.Extensions) >= declMax {
if scount > addrSectors || len(p.Extensions) >= declMax {
params = append(params, p)
p = miner.ExtendSectorExpiration2Params{}
scount = sectorsInDecl
@@ -1230,7 +1231,7 @@ var sectorsExtendCmd = &cli.Command{
smsg, err := fullApi.MpoolPushMessage(ctx, &types.Message{
From: mi.Worker,
To: maddr,
Method: builtin.MethodsMiner.ExtendSectorExpiration,
Method: builtin.MethodsMiner.ExtendSectorExpiration2,
Value: big.Zero(),
Params: sp,
}, spec)
+1 -2
View File
@@ -4,7 +4,6 @@ import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"math/bits"
"os"
"path/filepath"
@@ -167,7 +166,7 @@ over time
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)
}
}
+2 -3
View File
@@ -7,7 +7,6 @@ import (
"encoding/csv"
"fmt"
"io"
"io/ioutil"
"net/http"
_ "net/http/pprof"
"os"
@@ -759,7 +758,7 @@ func (r *refunder) EnsureMinerMinimums(ctx context.Context, tipset *types.TipSet
return nil, err
}
w := ioutil.Discard
w := io.Discard
if len(output) != 0 {
f, err := os.Create(output)
if err != nil {
@@ -1299,7 +1298,7 @@ func loadChainEpoch(fn string) (abi.ChainEpoch, error) {
err = f.Close()
}()
raw, err := ioutil.ReadAll(f)
raw, err := io.ReadAll(f)
if err != nil {
return 0, err
}
+14 -15
View File
@@ -4,7 +4,6 @@ import (
"encoding/csv"
"encoding/json"
"fmt"
"io/ioutil"
"os"
"strconv"
"strings"
@@ -80,7 +79,7 @@ var genesisNewCmd = &cli.Command{
return err
}
if err := ioutil.WriteFile(genf, genb, 0644); err != nil {
if err := os.WriteFile(genf, genb, 0644); err != nil {
return err
}
@@ -103,7 +102,7 @@ var genesisAddMinerCmd = &cli.Command{
}
var template genesis.Template
genb, err := ioutil.ReadFile(genf)
genb, err := os.ReadFile(genf)
if err != nil {
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)
}
miners := map[string]genesis.Miner{}
minb, err := ioutil.ReadFile(minf)
minb, err := os.ReadFile(minf)
if err != nil {
return xerrors.Errorf("read preseal file: %w", err)
}
@@ -156,7 +155,7 @@ var genesisAddMinerCmd = &cli.Command{
return err
}
if err := ioutil.WriteFile(genf, genb, 0644); err != nil {
if err := os.WriteFile(genf, genb, 0644); err != nil {
return err
}
@@ -196,7 +195,7 @@ var genesisAddMsigsCmd = &cli.Command{
}
var template genesis.Template
b, err := ioutil.ReadFile(genf)
b, err := os.ReadFile(genf)
if err != nil {
return xerrors.Errorf("read genesis template: %w", err)
}
@@ -237,7 +236,7 @@ var genesisAddMsigsCmd = &cli.Command{
return err
}
if err := ioutil.WriteFile(genf, b, 0644); err != nil {
if err := os.WriteFile(genf, b, 0644); err != nil {
return err
}
return nil
@@ -339,7 +338,7 @@ var genesisSetVRKCmd = &cli.Command{
}
var template genesis.Template
b, err := ioutil.ReadFile(genf)
b, err := os.ReadFile(genf)
if err != nil {
return xerrors.Errorf("read genesis template: %w", err)
}
@@ -404,7 +403,7 @@ var genesisSetVRKCmd = &cli.Command{
return err
}
if err := ioutil.WriteFile(genf, b, 0644); err != nil {
if err := os.WriteFile(genf, b, 0644); err != nil {
return err
}
return nil
@@ -435,7 +434,7 @@ var genesisSetRemainderCmd = &cli.Command{
}
var template genesis.Template
b, err := ioutil.ReadFile(genf)
b, err := os.ReadFile(genf)
if err != nil {
return xerrors.Errorf("read genesis template: %w", err)
}
@@ -500,7 +499,7 @@ var genesisSetRemainderCmd = &cli.Command{
return err
}
if err := ioutil.WriteFile(genf, b, 0644); err != nil {
if err := os.WriteFile(genf, b, 0644); err != nil {
return err
}
return nil
@@ -529,7 +528,7 @@ var genesisSetActorVersionCmd = &cli.Command{
}
var template genesis.Template
b, err := ioutil.ReadFile(genf)
b, err := os.ReadFile(genf)
if err != nil {
return xerrors.Errorf("read genesis template: %w", err)
}
@@ -550,7 +549,7 @@ var genesisSetActorVersionCmd = &cli.Command{
return err
}
if err := ioutil.WriteFile(genf, b, 0644); err != nil {
if err := os.WriteFile(genf, b, 0644); err != nil {
return err
}
return nil
@@ -607,7 +606,7 @@ var genesisSetVRKSignersCmd = &cli.Command{
}
var template genesis.Template
b, err := ioutil.ReadFile(genf)
b, err := os.ReadFile(genf)
if err != nil {
return xerrors.Errorf("read genesis template: %w", err)
}
@@ -662,7 +661,7 @@ var genesisSetVRKSignersCmd = &cli.Command{
return err
}
if err := ioutil.WriteFile(genf, b, 0644); err != nil {
if err := os.WriteFile(genf, b, 0644); err != nil {
return err
}
return nil
+1 -2
View File
@@ -4,7 +4,6 @@ import (
"encoding/hex"
"encoding/json"
"fmt"
"io/ioutil"
"os"
"github.com/docker/go-units"
@@ -114,7 +113,7 @@ var preSealCmd = &cli.Command{
var k *types.KeyInfo
if c.String("key") != "" {
k = new(types.KeyInfo)
kh, err := ioutil.ReadFile(c.String("key"))
kh, err := os.ReadFile(c.String("key"))
if err != nil {
return err
}
+3 -4
View File
@@ -6,7 +6,6 @@ import (
"encoding/hex"
"encoding/json"
"fmt"
"io/ioutil"
"os"
"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)
}
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)
}
}
@@ -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"))
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
}
@@ -239,7 +238,7 @@ func WriteGenesisMiner(maddr address.Address, sbroot string, gm *genesis.Miner,
}
// 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
}
}
+1 -2
View File
@@ -4,7 +4,6 @@ import (
"encoding/hex"
"fmt"
"io"
"io/ioutil"
"os"
"strings"
@@ -30,7 +29,7 @@ var base16Cmd = &cli.Command{
input = strings.NewReader(cctx.Args().First())
}
bytes, err := ioutil.ReadAll(input)
bytes, err := io.ReadAll(input)
if err != nil {
return nil
}
+1 -2
View File
@@ -3,7 +3,6 @@ package main
import (
"fmt"
"io"
"io/ioutil"
"os"
"strings"
@@ -30,7 +29,7 @@ var base32Cmd = &cli.Command{
input = strings.NewReader(cctx.Args().First())
}
bytes, err := ioutil.ReadAll(input)
bytes, err := io.ReadAll(input)
if err != nil {
return nil
}
+1 -2
View File
@@ -4,7 +4,6 @@ import (
"encoding/base64"
"fmt"
"io"
"io/ioutil"
"os"
"strings"
@@ -38,7 +37,7 @@ var base64Cmd = &cli.Command{
input = strings.NewReader(cctx.Args().First())
}
bytes, err := ioutil.ReadAll(input)
bytes, err := io.ReadAll(input)
if err != nil {
return nil
}
+1 -2
View File
@@ -5,7 +5,6 @@ import (
"encoding/hex"
"fmt"
"io"
"io/ioutil"
"os"
"github.com/urfave/cli/v2"
@@ -318,7 +317,7 @@ func decodeToByte(cctx *cli.Context, i int) ([]byte, error) {
if i > 0 {
return nil, xerrors.Errorf("need more than %d args", i)
}
r, err := ioutil.ReadAll(os.Stdin)
r, err := io.ReadAll(os.Stdin)
if err != nil {
return nil, err
}
+2 -2
View File
@@ -5,7 +5,7 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"os"
"sort"
"strconv"
@@ -537,7 +537,7 @@ var finalResultCmd = &cli.Command{
// Returns voted sorted by votes from earliest to latest
func getVotesMap(file string) ([]Vote, error) {
var votes []Vote
vb, err := ioutil.ReadFile(file)
vb, err := os.ReadFile(file)
if err != nil {
return nil, xerrors.Errorf("read vote: %w", err)
}
+1 -1
View File
@@ -240,7 +240,7 @@ var replayOfflineCmd = &cli.Command{
}
tw := tabwriter.NewWriter(os.Stdout, 8, 2, 2, ' ', tabwriter.AlignRight)
res, err := sm.CallWithGas(ctx, msg, []types.ChainMsg{}, executionTs)
res, err := sm.CallWithGas(ctx, msg, []types.ChainMsg{}, executionTs, true)
if err != nil {
return err
}
+4 -5
View File
@@ -7,7 +7,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"os"
"strings"
@@ -81,7 +80,7 @@ var jwtTokenCmd = &cli.Command{
defer inputFile.Close() //nolint:errcheck
input := bufio.NewReader(inputFile)
encoded, err := ioutil.ReadAll(input)
encoded, err := io.ReadAll(input)
if err != nil {
return err
}
@@ -123,7 +122,7 @@ var jwtTokenCmd = &cli.Command{
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()
sk, err := ioutil.ReadAll(io.LimitReader(rand.Reader, 32))
sk, err := io.ReadAll(io.LimitReader(rand.Reader, 32))
if err != nil {
return err
}
@@ -184,6 +183,6 @@ var jwtNewCmd = &cli.Command{
}
filenameToken := fmt.Sprintf("jwt-%s.token", keyName)
return ioutil.WriteFile(filenameToken, token, 0600)
return os.WriteFile(filenameToken, token, 0600)
},
}
+3 -4
View File
@@ -7,7 +7,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"os"
"path"
"strings"
@@ -68,7 +67,7 @@ var keyinfoVerifyCmd = &cli.Command{
defer inputFile.Close() //nolint:errcheck
input := bufio.NewReader(inputFile)
keyContent, err := ioutil.ReadAll(input)
keyContent, err := io.ReadAll(input)
if err != nil {
return err
}
@@ -162,7 +161,7 @@ var keyinfoImportCmd = &cli.Command{
input = bufio.NewReader(inputFile)
}
encoded, err := ioutil.ReadAll(input)
encoded, err := io.ReadAll(input)
if err != nil {
return err
}
@@ -274,7 +273,7 @@ var keyinfoInfoCmd = &cli.Command{
input = bufio.NewReader(inputFile)
}
encoded, err := ioutil.ReadAll(input)
encoded, err := io.ReadAll(input)
if err != nil {
return err
}
+1 -2
View File
@@ -6,7 +6,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"os"
@@ -97,7 +96,7 @@ var rpcCmd = &cli.Command{
return err
}
rb, err := ioutil.ReadAll(resp.Body)
rb, err := io.ReadAll(resp.Body)
if err != nil {
return err
}
+1 -2
View File
@@ -4,7 +4,6 @@ import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"net"
"net/http"
"os"
@@ -464,7 +463,7 @@ var runCmd = &cli.Command{
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)
}
+1 -2
View File
@@ -2,7 +2,6 @@ package main
import (
"encoding/json"
"io/ioutil"
"os"
"path/filepath"
@@ -121,7 +120,7 @@ var storageAttachCmd = &cli.Command{
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)
}
}
+2 -3
View File
@@ -10,7 +10,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
"runtime/pprof"
@@ -244,7 +243,7 @@ var DaemonCmd = &cli.Command{
var genBytes []byte
if cctx.String("genesis") != "" {
genBytes, err = ioutil.ReadFile(cctx.String("genesis"))
genBytes, err = os.ReadFile(cctx.String("genesis"))
if err != nil {
return xerrors.Errorf("reading genesis: %w", err)
}
@@ -400,7 +399,7 @@ func importKey(ctx context.Context, api lapi.FullNode, f string) error {
return err
}
hexdata, err := ioutil.ReadFile(f)
hexdata, err := os.ReadFile(f)
if err != nil {
return err
}
+1 -2
View File
@@ -5,7 +5,6 @@ package conformance
import (
"encoding/json"
"io/ioutil"
"os"
"path/filepath"
"strings"
@@ -107,7 +106,7 @@ func TestConformance(t *testing.T) {
// Run a test for each vector.
for _, v := range vectors {
path := filepath.Join(corpusRoot, v)
raw, err := ioutil.ReadFile(path)
raw, err := os.ReadFile(path)
if err != nil {
t.Fatalf("failed to read test raw file: %s", path)
}
+1 -2
View File
@@ -6,7 +6,6 @@ import (
"context"
"encoding/base64"
"fmt"
"io/ioutil"
"math"
"os"
"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
// cleaned up via t.Cleanup(). It returns the full path of the temp file.
func writeStateToTempCAR(bs blockstore.Blockstore, roots ...cid.Cid) (string, error) {
tmp, err := ioutil.TempFile("", "lotus-tests-*.car")
tmp, err := os.CreateTemp("", "lotus-tests-*.car")
if err != nil {
return "", fmt.Errorf("failed to create temp file to dump CAR for diffing: %w", err)
}
+1 -1
View File
@@ -7,7 +7,7 @@ USAGE:
lotus-miner [global options] command [command options] [arguments...]
VERSION:
1.21.0-dev
1.21.0-rc2
COMMANDS:
init Initialize a lotus miner repo
+1 -1
View File
@@ -7,7 +7,7 @@ USAGE:
lotus-worker [global options] command [command options] [arguments...]
VERSION:
1.21.0-dev
1.21.0-rc2
COMMANDS:
run Start lotus worker
+1 -1
View File
@@ -7,7 +7,7 @@ USAGE:
lotus [global options] command [command options] [arguments...]
VERSION:
1.21.0-dev
1.21.0-rc2
COMMANDS:
daemon Start a lotus daemon process
+3 -4
View File
@@ -5,7 +5,6 @@ import (
"encoding/json"
"fmt"
"io/fs"
"io/ioutil"
"os"
"path/filepath"
"strings"
@@ -19,7 +18,7 @@ const (
)
func main() {
db, err := ioutil.ReadFile(os.Args[2])
db, err := os.ReadFile(os.Args[2])
if err != nil {
panic(err)
}
@@ -38,7 +37,7 @@ func main() {
if filepath.Ext(path) != ".go" {
return nil
}
fb, err := ioutil.ReadFile(path)
fb, err := os.ReadFile(path)
if err != nil {
return err
}
@@ -110,7 +109,7 @@ func main() {
if rewrite {
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
}
}
+4 -4
View File
@@ -1,6 +1,6 @@
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.
@@ -78,7 +78,7 @@ require (
github.com/influxdata/influxdb1-client v0.0.0-20200827194710-b269163b24ab
github.com/ipfs/bbloom v0.0.4
github.com/ipfs/go-blockservice v0.5.0
github.com/ipfs/go-cid v0.3.2
github.com/ipfs/go-cid v0.4.0
github.com/ipfs/go-cidutil v0.1.0
github.com/ipfs/go-datastore v0.6.0
github.com/ipfs/go-ds-badger2 v0.1.3
@@ -97,7 +97,7 @@ require (
github.com/ipfs/go-ipfs-util v0.0.2
github.com/ipfs/go-ipld-cbor v0.0.6
github.com/ipfs/go-ipld-format v0.4.0
github.com/ipfs/go-libipfs v0.5.0
github.com/ipfs/go-libipfs v0.7.0
github.com/ipfs/go-log/v2 v2.5.1
github.com/ipfs/go-merkledag v0.9.0
github.com/ipfs/go-metrics-interface v0.0.1
@@ -244,7 +244,7 @@ require (
github.com/ipfs/go-ipld-legacy v0.1.1 // indirect
github.com/ipfs/go-ipns v0.3.0 // indirect
github.com/ipfs/go-log v1.0.5 // indirect
github.com/ipfs/go-path v0.3.0 // indirect
github.com/ipfs/go-path v0.3.1 // indirect
github.com/ipfs/go-peertaskqueue v0.8.1 // indirect
github.com/ipfs/go-verifcid v0.0.2 // indirect
github.com/ipld/go-ipld-adl-hamt v0.0.0-20220616142416-9004dbd839e0 // indirect
+6 -9
View File
@@ -698,8 +698,8 @@ github.com/ipfs/go-cid v0.0.6/go.mod h1:6Ux9z5e+HpkQdckYoX1PG/6xqKspzlEIR5SDmgqg
github.com/ipfs/go-cid v0.0.7/go.mod h1:6Ux9z5e+HpkQdckYoX1PG/6xqKspzlEIR5SDmgqgC/I=
github.com/ipfs/go-cid v0.1.0/go.mod h1:rH5/Xv83Rfy8Rw6xG+id3DYAMUVmem1MowoKwdXmN2o=
github.com/ipfs/go-cid v0.2.0/go.mod h1:P+HXFDF4CVhaVayiEb4wkAy7zBHxBwsJyt0Y5U6MLro=
github.com/ipfs/go-cid v0.3.2 h1:OGgOd+JCFM+y1DjWPmVH+2/4POtpDzwcr7VgnB7mZXc=
github.com/ipfs/go-cid v0.3.2/go.mod h1:gQ8pKqT/sUxGY+tIwy1RPpAojYu7jAyCp5Tz1svoupw=
github.com/ipfs/go-cid v0.4.0 h1:a4pdZq0sx6ZSxbCizebnKiMCx/xI/aBBFlB73IgH4rA=
github.com/ipfs/go-cid v0.4.0/go.mod h1:uQHwDeX4c6CtyrFwdqyhpNcxVewur1M7l7fNU7LKwZk=
github.com/ipfs/go-cidutil v0.1.0 h1:RW5hO7Vcf16dplUU60Hs0AKDkQAVPVplr7lk97CFL+Q=
github.com/ipfs/go-cidutil v0.1.0/go.mod h1:e7OEVBMIv9JaOxt9zaGEmAoSlXW9jdFZ5lP/0PwcfpA=
github.com/ipfs/go-datastore v0.0.1/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE=
@@ -731,7 +731,6 @@ github.com/ipfs/go-ds-leveldb v0.5.0 h1:s++MEBbD3ZKc9/8/njrn4flZLnCuY9I79v94gBUN
github.com/ipfs/go-ds-leveldb v0.5.0/go.mod h1:d3XG9RUDzQ6V4SHi8+Xgj9j1XuEk1z82lquxrVbml/Q=
github.com/ipfs/go-ds-measure v0.2.0 h1:sG4goQe0KDTccHMyT45CY1XyUbxe5VwTKpg2LjApYyQ=
github.com/ipfs/go-ds-measure v0.2.0/go.mod h1:SEUD/rE2PwRa4IQEC5FuNAmjJCyYObZr9UvVh8V3JxE=
github.com/ipfs/go-fetcher v1.6.1/go.mod h1:27d/xMV8bodjVs9pugh/RCjjK2OZ68UgAMspMdingNo=
github.com/ipfs/go-filestore v1.2.0 h1:O2wg7wdibwxkEDcl7xkuQsPvJFRBVgVSsOJ/GP6z3yU=
github.com/ipfs/go-filestore v1.2.0/go.mod h1:HLJrCxRXquTeEEpde4lTLMaE/MYJZD7WHLkp9z6+FF8=
github.com/ipfs/go-fs-lock v0.0.6/go.mod h1:OTR+Rj9sHiRubJh3dRhD15Juhd/+w6VPOY28L7zESmM=
@@ -805,8 +804,8 @@ github.com/ipfs/go-ipld-legacy v0.1.1 h1:BvD8PEuqwBHLTKqlGFTHSwrwFOMkVESEvwIYwR2
github.com/ipfs/go-ipld-legacy v0.1.1/go.mod h1:8AyKFCjgRPsQFf15ZQgDB8Din4DML/fOmKZkkFkrIEg=
github.com/ipfs/go-ipns v0.3.0 h1:ai791nTgVo+zTuq2bLvEGmWP1M0A6kGTXUsgv/Yq67A=
github.com/ipfs/go-ipns v0.3.0/go.mod h1:3cLT2rbvgPZGkHJoPO1YMJeh6LtkxopCkKFcio/wE24=
github.com/ipfs/go-libipfs v0.5.0 h1:gtvzeoTdUHPUN4B5izzyBS3Cxtpvi+l7hd2mmjN+teM=
github.com/ipfs/go-libipfs v0.5.0/go.mod h1:iZ9QyhzNr3AkxRXrbQYb//rv7iLyvZJX0GNuc3lJDiQ=
github.com/ipfs/go-libipfs v0.7.0 h1:Mi54WJTODaOL2/ZSm5loi3SwI3jI2OuFWUrQIkJ5cpM=
github.com/ipfs/go-libipfs v0.7.0/go.mod h1:KsIf/03CqhICzyRGyGo68tooiBE2iFbI/rXW7FhAYr0=
github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM=
github.com/ipfs/go-log v1.0.0/go.mod h1:JO7RzlMK6rA+CIxFMLOuB6Wf5b81GDiKElL7UPSIKjA=
github.com/ipfs/go-log v1.0.1/go.mod h1:HuWlQttfN6FWNHRhlY5yMk/lW7evQC0HHGOxEwMRR8I=
@@ -838,17 +837,15 @@ github.com/ipfs/go-metrics-interface v0.0.1 h1:j+cpbjYvu4R8zbleSs36gvB7jR+wsL2fG
github.com/ipfs/go-metrics-interface v0.0.1/go.mod h1:6s6euYU4zowdslK0GKHmqaIZ3j/b/tL7HTWtJ4VPgWY=
github.com/ipfs/go-metrics-prometheus v0.0.2 h1:9i2iljLg12S78OhC6UAiXi176xvQGiZaGVF1CUVdE+s=
github.com/ipfs/go-metrics-prometheus v0.0.2/go.mod h1:ELLU99AQQNi+zX6GCGm2lAgnzdSH3u5UVlCdqSXnEks=
github.com/ipfs/go-path v0.3.0 h1:tkjga3MtpXyM5v+3EbRvOHEoo+frwi4oumw5K+KYWyA=
github.com/ipfs/go-path v0.3.0/go.mod h1:NOScsVgxfC/eIw4nz6OiGwK42PjaSJ4Y/ZFPn1Xe07I=
github.com/ipfs/go-path v0.3.1 h1:wkeaCWE/NTuuPGlEkLTsED5UkzfKYZpxaFFPgk8ZVLE=
github.com/ipfs/go-path v0.3.1/go.mod h1:eNLsxJEEMxn/CDzUJ6wuNl+6No6tEUhOZcPKsZsYX0E=
github.com/ipfs/go-peertaskqueue v0.1.0/go.mod h1:Jmk3IyCcfl1W3jTW3YpghSwSEC6IJ3Vzz/jUmWw8Z0U=
github.com/ipfs/go-peertaskqueue v0.7.0/go.mod h1:M/akTIE/z1jGNXMU7kFB4TeSEFvj68ow0Rrb04donIU=
github.com/ipfs/go-peertaskqueue v0.8.1 h1:YhxAs1+wxb5jk7RvS0LHdyiILpNmRIRnZVztekOF0pg=
github.com/ipfs/go-peertaskqueue v0.8.1/go.mod h1:Oxxd3eaK279FxeydSPPVGHzbwVeHjatZ2GA8XD+KbPU=
github.com/ipfs/go-unixfs v0.2.2-0.20190827150610-868af2e9e5cb/go.mod h1:IwAAgul1UQIcNZzKPYZWOCijryFBeCV79cNubPzol+k=
github.com/ipfs/go-unixfs v0.2.4/go.mod h1:SUdisfUjNoSDzzhGVxvCL9QO/nKdwXdr+gbMUdqcbYw=
github.com/ipfs/go-unixfs v0.4.3 h1:EdDc1sNZNFDUlo4UrVAvvAofVI5EwTnKu8Nv8mgXkWQ=
github.com/ipfs/go-unixfs v0.4.3/go.mod h1:TSG7G1UuT+l4pNj91raXAPkX0BhJi3jST1FDTfQ5QyM=
github.com/ipfs/go-unixfsnode v1.1.2/go.mod h1:5dcE2x03pyjHk4JjamXmunTMzz+VUtqvPwZjIEkfV6s=
github.com/ipfs/go-unixfsnode v1.5.2 h1:CvsiTt58W2uR5dD8bqQv+aAY0c1qolmXmSyNbPHYiew=
github.com/ipfs/go-unixfsnode v1.5.2/go.mod h1:NlOebRwYx8lMCNMdhAhEspYPBD3obp7TE0LvBqHY+ks=
github.com/ipfs/go-verifcid v0.0.1/go.mod h1:5Hrva5KBeIog4A+UpqlaIU+DEstipcJYQQZc0g37pY0=
@@ -5,7 +5,6 @@ import (
"context"
"fmt"
"io"
"io/ioutil"
"os"
"testing"
"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 {
out, err := ioutil.TempFile(tempDir, "exp-test")
out, err := os.CreateTemp(tempDir, "exp-test")
if err != nil {
return err
}
@@ -214,7 +213,7 @@ func testDMExportAsCar(ctx context.Context, client *kit.TestFullNode, expDirecti
return validateDMCar(out)
}
func tesV0RetrievalAsCar(ctx context.Context, client *kit.TestFullNode, retOrder api0.RetrievalOrder, tempDir string) error {
out, err := ioutil.TempFile(tempDir, "exp-test")
out, err := os.CreateTemp(tempDir, "exp-test")
if err != nil {
return err
}
+3 -4
View File
@@ -3,7 +3,6 @@ package kit
import (
"context"
"fmt"
"io/ioutil"
"math/rand"
"os"
"path/filepath"
@@ -110,7 +109,7 @@ func RunClientTest(t *testing.T, cmds []*lcli.Command, clientNode *TestFullNode)
// Retrieve the first file from the Miner
// client retrieve <cid> <file path>
tmpdir, err := ioutil.TempDir(os.TempDir(), "test-cli-client")
tmpdir, err := os.MkdirTemp(os.TempDir(), "test-cli-client")
require.NoError(t, err)
path := filepath.Join(tmpdir, "outfile.dat")
@@ -144,13 +143,13 @@ func createRandomFile(rseed, size int) ([]byte, string, error) {
data := make([]byte, size)
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 {
return nil, "", err
}
path := filepath.Join(dir, "sourcefile.dat")
err = ioutil.WriteFile(path, data, 0644)
err = os.WriteFile(path, data, 0644)
if err != nil {
return nil, "", err
}
+2 -2
View File
@@ -6,9 +6,9 @@ import (
"crypto/rand"
"encoding/binary"
"fmt"
"io/ioutil"
"net"
"net/http"
"os"
"sync"
"testing"
"time"
@@ -234,7 +234,7 @@ func (n *Ensemble) MinerEnroll(minerNode *TestMiner, full *TestFullNode, opts ..
peerId, err := peer.IDFromPrivateKey(privkey)
require.NoError(n.t, err)
tdir, err := ioutil.TempDir("", "preseal-memgen")
tdir, err := os.MkdirTemp("", "preseal-memgen")
require.NoError(n.t, err)
minerCnt := len(n.inactive.miners) + len(n.active.miners)
+1 -2
View File
@@ -4,7 +4,6 @@ import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"net"
"os"
"path/filepath"
@@ -204,7 +203,7 @@ func (tm *TestMiner) AddStorage(ctx context.Context, t *testing.T, conf func(*st
b, err := json.MarshalIndent(cfg, "", " ")
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)
err = tm.StorageAddLocal(ctx, p)
+1 -2
View File
@@ -3,7 +3,6 @@ package kit
import (
"context"
"encoding/json"
"io/ioutil"
"net"
"net/http"
"os"
@@ -67,7 +66,7 @@ func (tm *TestWorker) AddStorage(ctx context.Context, t *testing.T, conf func(*s
b, err := json.MarshalIndent(cfg, "", " ")
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)
err = tm.StorageAddLocal(ctx, p)
+1 -2
View File
@@ -5,7 +5,6 @@ import (
"bytes"
"context"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
@@ -77,7 +76,7 @@ func TestLogRestore(t *testing.T) {
require.NoError(t, err)
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)
ds2 := datastore.NewMapDatastore()
+3 -3
View File
@@ -1,7 +1,7 @@
package consensus
import (
"io/ioutil"
"io"
"path/filepath"
"time"
@@ -69,7 +69,7 @@ func DefaultClusterRaftConfig() *ClusterRaftConfig {
cfg.RaftConfig.LocalID = "will_be_set_automatically"
// Set up logging
cfg.RaftConfig.LogOutput = ioutil.Discard
cfg.RaftConfig.LogOutput = io.Discard
return &cfg
}
@@ -91,7 +91,7 @@ func NewClusterRaftConfig(userRaftConfig *config.UserRaftConfig) *ClusterRaftCon
cfg.RaftConfig.LocalID = "will_be_set_automatically"
// Set up logging
cfg.RaftConfig.LogOutput = ioutil.Discard
cfg.RaftConfig.LogOutput = io.Discard
return &cfg
+2 -3
View File
@@ -6,7 +6,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"path"
@@ -158,7 +157,7 @@ func ReaderParamEncoder(addr string) jsonrpc.Option {
}
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))
return
}
@@ -182,7 +181,7 @@ func ReaderParamEncoder(addr string) jsonrpc.Option {
defer resp.Body.Close() //nolint
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))
return
}
+1 -2
View File
@@ -4,7 +4,6 @@ import (
"context"
"fmt"
"io"
"io/ioutil"
"os"
"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)
}
f, err := ioutil.TempFile("", "")
f, err := os.CreateTemp("", "")
if err != nil {
return cid.Undef, xerrors.Errorf("failed to create temp file: %w", err)
}
+2 -3
View File
@@ -5,7 +5,6 @@ import (
"bytes"
"context"
"io"
"io/ioutil"
"os"
"strings"
"testing"
@@ -67,7 +66,7 @@ func TestRoundtripUnixFS_Dense(t *testing.T) {
// ensure contents of the initial input file and the output file are identical.
fo, err := os.Open(tmpOutput)
require.NoError(t, err)
bz2, err := ioutil.ReadAll(fo)
bz2, err := io.ReadAll(fo)
require.NoError(t, err)
require.NoError(t, fo.Close())
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.
fo, err := os.Open(tmpOutput)
require.NoError(t, err)
bz2, err := ioutil.ReadAll(fo)
bz2, err := io.ReadAll(fo)
require.NoError(t, err)
require.NoError(t, fo.Close())
require.Equal(t, inputContents, bz2)
+4 -5
View File
@@ -4,7 +4,6 @@ package dagstore
import (
"context"
"io"
"io/ioutil"
"net/url"
"strings"
"testing"
@@ -39,7 +38,7 @@ func TestLotusMount(t *testing.T) {
io.ReaderAt
io.Seeker
}{
ReadCloser: ioutil.NopCloser(strings.NewReader("testing")),
ReadCloser: io.NopCloser(strings.NewReader("testing")),
ReaderAt: nil,
Seeker: nil,
}
@@ -48,7 +47,7 @@ func TestLotusMount(t *testing.T) {
io.ReaderAt
io.Seeker
}{
ReadCloser: ioutil.NopCloser(strings.NewReader("testing")),
ReadCloser: io.NopCloser(strings.NewReader("testing")),
ReaderAt: nil,
Seeker: nil,
}
@@ -66,7 +65,7 @@ func TestLotusMount(t *testing.T) {
rd, err := mnt.Fetch(context.Background())
require.NoError(t, err)
bz, err := ioutil.ReadAll(rd)
bz, err := io.ReadAll(rd)
require.NoError(t, err)
require.NoError(t, rd.Close())
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.
rd, err = mnt2.Fetch(context.Background())
require.NoError(t, err)
bz, err = ioutil.ReadAll(rd)
bz, err = io.ReadAll(rd)
require.NoError(t, err)
require.NoError(t, rd.Close())
require.Equal(t, []byte("testing"), bz)
+1 -2
View File
@@ -2,14 +2,13 @@ package main
import (
"fmt"
"io/ioutil"
"os"
"sort"
"strings"
)
func run() error {
tfb, err := ioutil.ReadFile("./node/config/types.go")
tfb, err := os.ReadFile("./node/config/types.go")
if err != nil {
return err
}
+1 -2
View File
@@ -4,7 +4,6 @@ import (
"bytes"
"fmt"
"io"
"io/ioutil"
"os"
"reflect"
"regexp"
@@ -47,7 +46,7 @@ func FromFile(path string, opts ...LoadCfgOpt) (interface{}, error) {
return nil, err
}
defer file.Close() //nolint:errcheck,staticcheck // The file is RO
cfgBs, err := ioutil.ReadAll(file)
cfgBs, err := io.ReadAll(file)
if err != nil {
return nil, xerrors.Errorf("failed to read config for validation checks %w", err)
}
+3 -4
View File
@@ -3,7 +3,6 @@ package config
import (
"bytes"
"io/ioutil"
"os"
"testing"
"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()
assert.NoError(err, "tmp file shold not error")
@@ -115,7 +114,7 @@ func TestValidateConfigSetsEnableSplitstore(t *testing.T) {
assert.False(t, MatchEnableSplitstoreField(string(cfgCommentedOutEnableSS)))
// write config with commented out EnableSplitstore to file
f, err := ioutil.TempFile("", "config.toml")
f, err := os.CreateTemp("", "config.toml")
fname := f.Name()
assert.NoError(t, err)
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
func TestFailToFallbackToDefault(t *testing.T) {
dir, err := ioutil.TempDir("", "dirWithNoFiles")
dir, err := os.MkdirTemp("", "dirWithNoFiles")
assert.NoError(t, err)
defer assert.NoError(t, os.RemoveAll(dir))
nonExistantFileName := dir + "/notarealfile"
+1 -2
View File
@@ -3,7 +3,6 @@ package config
import (
"encoding/json"
"io"
"io/ioutil"
"os"
"golang.org/x/xerrors"
@@ -43,7 +42,7 @@ func WriteStorageFile(path string, config storiface.StorageConfig) error {
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)
}
+3 -3
View File
@@ -5,7 +5,7 @@ import (
"bytes"
"context"
"embed"
"io/ioutil"
"os"
"path/filepath"
"strings"
"testing"
@@ -77,7 +77,7 @@ func TestImportLocal(t *testing.T) {
})
require.NoError(t, err)
outBytes, err := ioutil.ReadFile(out1)
outBytes, err := os.ReadFile(out1)
require.NoError(t, err)
require.Equal(t, b, outBytes)
@@ -128,7 +128,7 @@ func TestImportLocal(t *testing.T) {
err = files.WriteTo(file, exportedPath)
require.NoError(t, err)
exportedBytes, err := ioutil.ReadFile(exportedPath)
exportedBytes, err := os.ReadFile(exportedPath)
require.NoError(t, err)
// compare original file to recreated unixfs file.
+13 -2
View File
@@ -6,6 +6,7 @@ import (
"encoding/json"
"errors"
"fmt"
"os"
"sort"
"strconv"
"sync"
@@ -888,9 +889,14 @@ func (a *EthModule) applyMessage(ctx context.Context, msg *types.Message, tsk ty
return nil, xerrors.Errorf("cannot get tipset: %w", err)
}
applyTsMessages := true
if os.Getenv("LOTUS_SKIP_APPLY_TS_MESSAGE_CALL_WITH_GAS") == "1" {
applyTsMessages = false
}
// Try calling until we find a height with no migration.
for {
res, err = a.StateManager.CallWithGas(ctx, msg, []types.ChainMsg{}, ts)
res, err = a.StateManager.CallWithGas(ctx, msg, []types.ChainMsg{}, ts, applyTsMessages)
if err != stmgr.ErrExpensiveFork {
break
}
@@ -959,10 +965,15 @@ func gasSearch(
high := msg.GasLimit
low := msg.GasLimit
applyTsMessages := true
if os.Getenv("LOTUS_SKIP_APPLY_TS_MESSAGE_CALL_WITH_GAS") == "1" {
applyTsMessages = false
}
canSucceed := func(limit int64) (bool, error) {
msg.GasLimit = limit
res, err := smgr.CallWithGas(ctx, &msg, priorMsgs, ts)
res, err := smgr.CallWithGas(ctx, &msg, priorMsgs, ts, applyTsMessages)
if err != nil {
return false, xerrors.Errorf("CallWithGas failed: %w", err)
}
+7 -1
View File
@@ -4,6 +4,7 @@ import (
"context"
"math"
"math/rand"
"os"
"sort"
lru "github.com/hashicorp/golang-lru/v2"
@@ -276,10 +277,15 @@ func gasEstimateCallWithGas(
priorMsgs = append(priorMsgs, m)
}
applyTsMessages := true
if os.Getenv("LOTUS_SKIP_APPLY_TS_MESSAGE_CALL_WITH_GAS") == "1" {
applyTsMessages = false
}
// Try calling until we find a height with no migration.
var res *api.InvocResult
for {
res, err = smgr.CallWithGas(ctx, &msg, priorMsgs, ts)
res, err = smgr.CallWithGas(ctx, &msg, priorMsgs, ts, applyTsMessages)
if err != stmgr.ErrExpensiveFork {
break
}
+1 -2
View File
@@ -5,7 +5,6 @@ import (
"crypto/rand"
"errors"
"io"
"io/ioutil"
"os"
"path/filepath"
"time"
@@ -147,7 +146,7 @@ func APISecret(keystore types.KeyStore, lr repo.LockedRepo) (*dtypes.APIAlg, err
if errors.Is(err, types.ErrKeyInfoNotFound) {
log.Warn("Generating new API secret")
sk, err := ioutil.ReadAll(io.LimitReader(rand.Reader, 32))
sk, err := io.ReadAll(io.LimitReader(rand.Reader, 32))
if err != nil {
return nil, err
}
+1 -2
View File
@@ -5,7 +5,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"os"
"github.com/ipfs/go-blockservice"
@@ -60,7 +59,7 @@ func MakeGenesis(outFile, genesisTemplate string) func(bs dtypes.ChainBlockstore
return nil, err
}
fdata, err := ioutil.ReadFile(genesisTemplate)
fdata, err := os.ReadFile(genesisTemplate)
if err != nil {
return nil, xerrors.Errorf("reading preseals json: %w", err)
}
+7 -8
View File
@@ -6,7 +6,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"strings"
@@ -329,7 +328,7 @@ func (fsr *FsRepo) APIEndpoint() (multiaddr.Multiaddr, error) {
}
defer f.Close() //nolint: errcheck // Read only op
data, err := ioutil.ReadAll(f)
data, err := io.ReadAll(f)
if err != nil {
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
tb, err := ioutil.ReadAll(f)
tb, err := io.ReadAll(f)
if err != nil {
return nil, err
}
@@ -582,7 +581,7 @@ func (fsr *fsLockedRepo) SetConfig(c func(interface{})) error {
}
// 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 {
return err
}
@@ -635,14 +634,14 @@ func (fsr *fsLockedRepo) SetAPIEndpoint(ma multiaddr.Multiaddr) error {
if err := fsr.stillValid(); err != nil {
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 {
if err := fsr.stillValid(); err != nil {
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) {
@@ -711,7 +710,7 @@ func (fsr *fsLockedRepo) Get(name string) (types.KeyInfo, error) {
}
defer file.Close() //nolint: errcheck // read only op
data, err := ioutil.ReadAll(file)
data, err := io.ReadAll(file)
if err != nil {
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)
}
err = ioutil.WriteFile(keyPath, keyData, 0600)
err = os.WriteFile(keyPath, keyData, 0600)
if err != nil {
return xerrors.Errorf("writing key '%s': %w", name, err)
}
+2 -3
View File
@@ -3,7 +3,6 @@ package repo
import (
"context"
"encoding/json"
"io/ioutil"
"os"
"path/filepath"
"sync"
@@ -103,7 +102,7 @@ func (lmem *lockedMemRepo) Path() string {
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 {
panic(err) // only used in tests, probably fine
}
@@ -142,7 +141,7 @@ func (lmem *lockedMemRepo) initSectorStore(t string) {
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)
}
}
+4 -4
View File
@@ -2,7 +2,7 @@ package paths_test
import (
"fmt"
"io/ioutil"
"io"
"net/http"
"net/http/httptest"
"os"
@@ -378,7 +378,7 @@ func TestRemoteGetSector(t *testing.T) {
if !tc.isDir {
// create file
tempFile, err := ioutil.TempFile("", "TestRemoteGetSector-")
tempFile, err := os.CreateTemp("", "TestRemoteGetSector-")
require.NoError(t, err)
defer func() {
@@ -390,7 +390,7 @@ func TestRemoteGetSector(t *testing.T) {
path = tempFile.Name()
} else {
// create dir with a file
tempFile2, err := ioutil.TempFile("", "TestRemoteGetSector-")
tempFile2, err := os.CreateTemp("", "TestRemoteGetSector-")
require.NoError(t, err)
defer func() {
_ = os.Remove(tempFile2.Name())
@@ -435,7 +435,7 @@ func TestRemoteGetSector(t *testing.T) {
_ = resp.Body.Close()
}()
bz, err := ioutil.ReadAll(resp.Body)
bz, err := io.ReadAll(resp.Body)
require.NoError(t, err)
// assert expected status code
+2 -3
View File
@@ -3,7 +3,6 @@ package paths
import (
"context"
"encoding/json"
"io/ioutil"
"math/bits"
"math/rand"
"os"
@@ -151,7 +150,7 @@ func (st *Local) OpenPath(ctx context.Context, p string) error {
st.localLk.Lock()
defer st.localLk.Unlock()
mb, err := ioutil.ReadFile(filepath.Join(p, MetaFile))
mb, err := os.ReadFile(filepath.Join(p, MetaFile))
if err != nil {
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()
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 {
return xerrors.Errorf("reading storage metadata for %s: %w", p.local, err)
}
+1 -2
View File
@@ -3,7 +3,6 @@ package paths
import (
"context"
"encoding/json"
"io/ioutil"
"os"
"path/filepath"
"testing"
@@ -63,7 +62,7 @@ func (t *TestingLocalStorage) init(subpath string) error {
return err
}
if err := ioutil.WriteFile(metaFile, mb, 0644); err != nil {
if err := os.WriteFile(metaFile, mb, 0644); err != nil {
return err
}
+3 -4
View File
@@ -5,7 +5,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"math/bits"
"net/http"
"net/url"
@@ -412,7 +411,7 @@ func (r *Remote) FsStat(ctx context.Context, id storiface.ID) (fsutil.FsStat, er
case 404:
return fsutil.FsStat{}, errPathNotFound
case 500:
b, err := ioutil.ReadAll(resp.Body)
b, err := io.ReadAll(resp.Body)
if err != nil {
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)
continue
}
body, err := ioutil.ReadAll(resp.Body)
body, err := io.ReadAll(resp.Body)
if err != nil {
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)))
}
body, err := ioutil.ReadAll(resp.Body)
body, err := io.ReadAll(resp.Body)
if err != nil {
if err := resp.Body.Close(); err != nil {
log.Error("response close: ", err)
+5 -6
View File
@@ -6,7 +6,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/http/httptest"
"os"
@@ -48,7 +47,7 @@ func createTestStorage(t *testing.T, p string, seal bool, att ...*paths.Local) s
b, err := json.MarshalIndent(cfg, "", " ")
require.NoError(t, err)
require.NoError(t, ioutil.WriteFile(filepath.Join(p, metaFile), b, 0644))
require.NoError(t, os.WriteFile(filepath.Join(p, metaFile), b, 0644))
for _, s := range att {
require.NoError(t, s.OpenPath(context.Background(), p))
@@ -130,7 +129,7 @@ func TestMoveShared(t *testing.T) {
data := make([]byte, 2032)
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)
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))
fmt.Println("read from ", sp.Sealed)
read, err := ioutil.ReadFile(sp.Sealed)
read, err := os.ReadFile(sp.Sealed)
require.NoError(t, err)
require.EqualValues(t, data, read)
}
@@ -357,7 +356,7 @@ func TestReader(t *testing.T) {
mockCheckAllocation(pf, offset, size, emptyPartialFile,
true, nil)
f, err := ioutil.TempFile("", "TestReader-")
f, err := os.CreateTemp("", "TestReader-")
require.NoError(t, err)
_, err = f.Write(bz)
require.NoError(t, err)
@@ -502,7 +501,7 @@ func TestReader(t *testing.T) {
require.NoError(t, os.Remove(f.Name()))
}
bz, err := ioutil.ReadAll(rd)
bz, err := io.ReadAll(rd)
require.NoError(t, err)
require.Equal(t, tc.expectedSectorBytes, bz)
}
+1 -2
View File
@@ -11,7 +11,6 @@ import (
"encoding/base64"
"encoding/json"
"io"
"io/ioutil"
"math/bits"
"os"
"path/filepath"
@@ -1095,7 +1094,7 @@ func (sb *Sealer) FinalizeSectorInto(ctx context.Context, sector storiface.Secto
}
defer done()
files, err := ioutil.ReadDir(paths.Cache)
files, err := os.ReadDir(paths.Cache)
if err != nil {
return err
}
+14 -15
View File
@@ -5,7 +5,6 @@ import (
"context"
"fmt"
"io"
"io/ioutil"
"math/rand"
"os"
"path/filepath"
@@ -130,7 +129,7 @@ func (s *seal) unseal(t *testing.T, sb *Sealer, sp *basicfs.Provider, si storifa
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) {
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)
}
expect, _ = ioutil.ReadAll(data(si.ID.Number, 1016))
expect, _ = io.ReadAll(data(si.ID.Number, 1016))
require.Equal(t, expect, b.Bytes())
b.Reset()
@@ -240,12 +239,12 @@ func corrupt(t *testing.T, sealer *Sealer, id storiface.SectorRef) {
}
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 {
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 {
panic(err)
}
@@ -281,7 +280,7 @@ func TestSealAndVerify(t *testing.T) {
getGrothParamFileAndVerifyingKeys(sectorSize)
cdir, err := ioutil.TempDir("", "sbtest-c-")
cdir, err := os.MkdirTemp("", "sbtest-c-")
if err != nil {
t.Fatal(err)
}
@@ -352,7 +351,7 @@ func TestSealPoStNoCommit(t *testing.T) {
getGrothParamFileAndVerifyingKeys(sectorSize)
dir, err := ioutil.TempDir("", "sbtest")
dir, err := os.MkdirTemp("", "sbtest")
if err != nil {
t.Fatal(err)
}
@@ -416,7 +415,7 @@ func TestSealAndVerify3(t *testing.T) {
getGrothParamFileAndVerifyingKeys(sectorSize)
dir, err := ioutil.TempDir("", "sbtest")
dir, err := os.MkdirTemp("", "sbtest")
if err != nil {
t.Fatal(err)
}
@@ -494,7 +493,7 @@ func TestSealAndVerifyAggregate(t *testing.T) {
getGrothParamFileAndVerifyingKeys(sectorSize)
cdir, err := ioutil.TempDir("", "sbtest-c-")
cdir, err := os.MkdirTemp("", "sbtest-c-")
if err != nil {
t.Fatal(err)
}
@@ -576,7 +575,7 @@ func BenchmarkWriteWithAlignment(b *testing.B) {
for i := 0; i < b.N; i++ {
b.StopTimer()
rf, w, _ := commpffi.ToReadableFile(bytes.NewReader(bytes.Repeat([]byte{0xff, 0}, int(bt/2))), int64(bt))
tf, _ := ioutil.TempFile("/tmp/", "scrb-")
tf, _ := os.CreateTemp("/tmp/", "scrb-")
b.StartTimer()
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) {
sz := abi.PaddedPieceSize(512 << 20).Unpadded()
cdir, err := ioutil.TempDir("", "sbtest-c-")
cdir, err := os.MkdirTemp("", "sbtest-c-")
if err != nil {
t.Fatal(err)
}
@@ -779,7 +778,7 @@ func BenchmarkAddPiece512M(b *testing.B) {
sz := abi.PaddedPieceSize(512 << 20).Unpadded()
b.SetBytes(int64(sz))
cdir, err := ioutil.TempDir("", "sbtest-c-")
cdir, err := os.MkdirTemp("", "sbtest-c-")
if err != nil {
b.Fatal(err)
}
@@ -821,7 +820,7 @@ func BenchmarkAddPiece512M(b *testing.B) {
func TestAddPiece512MPadded(t *testing.T) {
sz := abi.PaddedPieceSize(512 << 20).Unpadded()
cdir, err := ioutil.TempDir("", "sbtest-c-")
cdir, err := os.MkdirTemp("", "sbtest-c-")
if err != nil {
t.Fatal(err)
}
@@ -890,7 +889,7 @@ func TestMulticoreSDR(t *testing.T) {
getGrothParamFileAndVerifyingKeys(sectorSize)
dir, err := ioutil.TempDir("", "sbtest")
dir, err := os.MkdirTemp("", "sbtest")
if err != nil {
t.Fatal(err)
}
@@ -995,7 +994,7 @@ func TestPoStChallengeAssumptions(t *testing.T) {
func TestDCAPCloses(t *testing.T) {
sz := abi.PaddedPieceSize(2 << 10).Unpadded()
cdir, err := ioutil.TempDir("", "sbtest-c-")
cdir, err := os.MkdirTemp("", "sbtest-c-")
if err != nil {
t.Fatal(err)
}
+2 -3
View File
@@ -3,7 +3,6 @@ package fr32_test
import (
"bytes"
"io"
"io/ioutil"
"os"
"testing"
@@ -17,7 +16,7 @@ import (
)
func TestWriteTwoPcs(t *testing.T) {
tf, _ := ioutil.TempFile("/tmp/", "scrb-")
tf, _ := os.CreateTemp("/tmp/", "scrb-")
paddedSize := abi.PaddedPieceSize(16 << 20)
n := 2
@@ -43,7 +42,7 @@ func TestWriteTwoPcs(t *testing.T) {
panic(err)
}
ffiBytes, err := ioutil.ReadAll(tf)
ffiBytes, err := io.ReadAll(tf)
if err != nil {
panic(err)
}
+2 -3
View File
@@ -3,7 +3,6 @@ package fr32_test
import (
"bytes"
"io"
"io/ioutil"
"math/rand"
"os"
"testing"
@@ -19,7 +18,7 @@ import (
func padFFI(buf []byte) []byte {
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)
if err != nil {
@@ -33,7 +32,7 @@ func padFFI(buf []byte) []byte {
panic(err)
}
padded, err := ioutil.ReadAll(tf)
padded, err := io.ReadAll(tf)
if err != nil {
panic(err)
}
+2 -2
View File
@@ -3,7 +3,7 @@ package fr32_test
import (
"bufio"
"bytes"
"io/ioutil"
"io"
"testing"
"github.com/stretchr/testify/require"
@@ -27,7 +27,7 @@ func TestUnpadReader(t *testing.T) {
}
// using bufio reader to make sure reads are big enough for the padreader - it can't handle small reads right now
readered, err := ioutil.ReadAll(bufio.NewReaderSize(r, 512))
readered, err := io.ReadAll(bufio.NewReaderSize(r, 512))
if err != nil {
t.Fatal(err)
}
+2 -3
View File
@@ -7,7 +7,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"strings"
@@ -46,7 +45,7 @@ func (t testStorage) DiskUsage(path string) (int64, error) {
}
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)
{
@@ -58,7 +57,7 @@ func newTestStorage(t *testing.T) *testStorage {
}, "", " ")
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)
}
+1 -2
View File
@@ -6,7 +6,6 @@ import (
"crypto/sha256"
"fmt"
"io"
"io/ioutil"
"math/rand"
"sync"
@@ -461,7 +460,7 @@ func (mgr *SectorMgr) ReadPiece(ctx context.Context, sector storiface.SectorRef,
io.Seeker
io.ReaderAt
}{
ReadCloser: ioutil.NopCloser(br),
ReadCloser: io.NopCloser(br),
Seeker: br,
ReaderAt: br,
}, false, nil
+2 -2
View File
@@ -3,7 +3,7 @@ package sealer
import (
"bytes"
"context"
"io/ioutil"
"io"
"math/rand"
"net"
"net/http"
@@ -346,7 +346,7 @@ func (p *pieceProviderTestHarness) readPiece(t *testing.T, offset storiface.Unpa
defer func() { _ = rd.Close() }()
// Make sure the input matches the output
readData, err := ioutil.ReadAll(rd)
readData, err := io.ReadAll(rd)
require.NoError(t, err)
require.Equal(t, expectedBytes, readData)
}