diff --git a/CHANGELOG.md b/CHANGELOG.md index 86e3454d3f4..b473680caec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ ## Improvements +- chore!: markets: remove stray unixfs constants, features and references ([filecoin-project/lotus#12217](https://github.com/filecoin-project/lotus/pull/12217)) + # v1.27.1 / 2024-06-24 This release, v1.27.1, is an OPTIONAL lotus release. It is HIGHLY RECOMMENDED for node operators that are building Filecoin index off lotus! diff --git a/api/api_full.go b/api/api_full.go index 1a52334df9f..599e0040fe8 100644 --- a/api/api_full.go +++ b/api/api_full.go @@ -870,7 +870,7 @@ type FullNode interface { // newLeaseExpiration cannot be further than 5 minutes in the future. // It is recommended to call F3Participate every 60 seconds // with newLeaseExpiration set 2min into the future. - // The oldLeaseExpiration has to be set to newLeaseExpiration of the last successfull call. + // The oldLeaseExpiration has to be set to newLeaseExpiration of the last successful call. // For the first call to F3Participate, set the oldLeaseExpiration to zero value/time in the past. // F3Participate will return true if the lease was accepted. // The minerID has to be the ID address of the miner. diff --git a/build/openrpc/full.json b/build/openrpc/full.json index 01791a98bea..80c82ca75dc 100644 --- a/build/openrpc/full.json +++ b/build/openrpc/full.json @@ -6588,7 +6588,7 @@ { "name": "Filecoin.F3Participate", "description": "```go\nfunc (s *FullNodeStruct) F3Participate(p0 context.Context, p1 address.Address, p2 time.Time, p3 time.Time) (bool, error) {\n\tif s.Internal.F3Participate == nil {\n\t\treturn false, ErrNotSupported\n\t}\n\treturn s.Internal.F3Participate(p0, p1, p2, p3)\n}\n```", - "summary": "F3Participate should be called by a storage provider to participate in signing F3 consensus.\nCalling this API gives the lotus node a lease to sign in F3 on behalf of given SP.\nThe lease should be active only on one node. The lease will expire at the newLeaseExpiration.\nTo continue participating in F3 with the given node, call F3Participate again before\nthe newLeaseExpiration time.\nnewLeaseExpiration cannot be further than 5 minutes in the future.\nIt is recommended to call F3Participate every 60 seconds\nwith newLeaseExpiration set 2min into the future.\nThe oldLeaseExpiration has to be set to newLeaseExpiration of the last successfull call.\nFor the first call to F3Participate, set the oldLeaseExpiration to zero value/time in the past.\nF3Participate will return true if the lease was accepted.\nThe minerID has to be the ID address of the miner.\n", + "summary": "F3Participate should be called by a storage provider to participate in signing F3 consensus.\nCalling this API gives the lotus node a lease to sign in F3 on behalf of given SP.\nThe lease should be active only on one node. The lease will expire at the newLeaseExpiration.\nTo continue participating in F3 with the given node, call F3Participate again before\nthe newLeaseExpiration time.\nnewLeaseExpiration cannot be further than 5 minutes in the future.\nIt is recommended to call F3Participate every 60 seconds\nwith newLeaseExpiration set 2min into the future.\nThe oldLeaseExpiration has to be set to newLeaseExpiration of the last successful call.\nFor the first call to F3Participate, set the oldLeaseExpiration to zero value/time in the past.\nF3Participate will return true if the lease was accepted.\nThe minerID has to be the ID address of the miner.\n", "paramStructure": "by-position", "params": [ { diff --git a/build/params_shared_vals.go b/build/params_shared_vals.go index 25cfdd2ea32..4d759dfa4a5 100644 --- a/build/params_shared_vals.go +++ b/build/params_shared_vals.go @@ -15,12 +15,6 @@ import ( "github.com/filecoin-project/lotus/chain/actors/policy" ) -// ///// -// Storage - -const UnixfsChunkSize uint64 = 1 << 20 -const UnixfsLinksPerLevel = 1024 - // ///// // Consensus / Network @@ -123,8 +117,3 @@ const InitialBaseFee = 100e6 const MinimumBaseFee = 100 const PackingEfficiencyNum = 4 const PackingEfficiencyDenom = 5 - -// revive:disable-next-line:exported -// Actor consts -// TODO: pieceSize unused from actors -var MinDealDuration, MaxDealDuration = policy.DealDurationBounds(0) diff --git a/build/params_testground.go b/build/params_testground.go index 864603d169d..209d8050056 100644 --- a/build/params_testground.go +++ b/build/params_testground.go @@ -21,9 +21,6 @@ import ( ) var ( - UnixfsChunkSize = uint64(1 << 20) - UnixfsLinksPerLevel = 1024 - BlocksPerEpoch = uint64(builtin2.ExpectedLeadersPerEpoch) BlockMessageLimit = 512 BlockGasLimit = int64(100_000_000_000) @@ -77,10 +74,6 @@ var ( return v }() - // Actor consts - // TODO: pieceSize unused from actors - MinDealDuration, MaxDealDuration = policy.DealDurationBounds(0) - PackingEfficiencyNum int64 = 4 PackingEfficiencyDenom int64 = 5 diff --git a/documentation/en/api-v1-unstable-methods.md b/documentation/en/api-v1-unstable-methods.md index 87538e805f2..ecb9053b248 100644 --- a/documentation/en/api-v1-unstable-methods.md +++ b/documentation/en/api-v1-unstable-methods.md @@ -2331,7 +2331,7 @@ the newLeaseExpiration time. newLeaseExpiration cannot be further than 5 minutes in the future. It is recommended to call F3Participate every 60 seconds with newLeaseExpiration set 2min into the future. -The oldLeaseExpiration has to be set to newLeaseExpiration of the last successfull call. +The oldLeaseExpiration has to be set to newLeaseExpiration of the last successful call. For the first call to F3Participate, set the oldLeaseExpiration to zero value/time in the past. F3Participate will return true if the lease was accepted. The minerID has to be the ID address of the miner. diff --git a/go.mod b/go.mod index 5f82d43f124..6745f201c07 100644 --- a/go.mod +++ b/go.mod @@ -83,7 +83,6 @@ require ( github.com/ipfs/boxo v0.20.0 github.com/ipfs/go-block-format v0.2.0 github.com/ipfs/go-cid v0.4.1 - 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 github.com/ipfs/go-ds-leveldb v0.5.0 @@ -178,7 +177,6 @@ require ( github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/cilium/ebpf v0.9.1 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect - github.com/crackcomm/go-gitignore v0.0.0-20231225121904-e25f5bc08668 // indirect github.com/cskr/pubsub v1.0.2 // indirect github.com/daaku/go.zipexe v1.0.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect @@ -309,7 +307,6 @@ require ( github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasttemplate v1.0.1 // indirect github.com/whyrusleeping/cbor v0.0.0-20171005072247-63513f603b11 // indirect - github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f // indirect github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 // indirect github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect diff --git a/go.sum b/go.sum index 5295acdbb89..b6d2065a3c3 100644 --- a/go.sum +++ b/go.sum @@ -89,8 +89,6 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRF github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE= -github.com/alecthomas/units v0.0.0-20231202071711-9a357b53e9c9 h1:ez/4by2iGztzR4L0zgAOR8lTQK9VlyBVVd7G4omaOQs= -github.com/alecthomas/units v0.0.0-20231202071711-9a357b53e9c9/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= github.com/ardanlabs/darwin/v2 v2.0.0 h1:XCisQMgQ5EG+ZvSEcADEo+pyfIMKyWAGnn5o2TgriYE= github.com/ardanlabs/darwin/v2 v2.0.0/go.mod h1:MubZ2e9DAYGaym0mClSOi183NYahrrfKxvSy1HMhoes= @@ -175,8 +173,6 @@ github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:ma github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/crackcomm/go-gitignore v0.0.0-20231225121904-e25f5bc08668 h1:ZFUue+PNxmHlu7pYv+IYMtqlaO/0VwaGEqKepZf9JpA= -github.com/crackcomm/go-gitignore v0.0.0-20231225121904-e25f5bc08668/go.mod h1:p1d6YEZWvFzEh4KLyvBcVSnrfNDDvK2zfK/4x2v/4pE= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/cskr/pubsub v1.0.2 h1:vlOzMhl6PFn60gRlTQQsIfVwaPB/B/8MziK8FhEPt/0= github.com/cskr/pubsub v1.0.2/go.mod h1:/8MzYXk/NJAz782G8RPkFzXTZVu63VotefPnR9TIRis= @@ -592,8 +588,6 @@ github.com/ipfs/go-cid v0.2.0/go.mod h1:P+HXFDF4CVhaVayiEb4wkAy7zBHxBwsJyt0Y5U6M github.com/ipfs/go-cid v0.3.2/go.mod h1:gQ8pKqT/sUxGY+tIwy1RPpAojYu7jAyCp5Tz1svoupw= github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= github.com/ipfs/go-cid v0.4.1/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= github.com/ipfs/go-datastore v0.0.5/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= github.com/ipfs/go-datastore v0.1.1/go.mod h1:w38XXW9kVFNp57Zj5knbKWM2T+KOZCGDRVNdgPHtbHw= diff --git a/itests/kit/files.go b/itests/kit/files.go index 0fb4cc83979..bbd400b59ff 100644 --- a/itests/kit/files.go +++ b/itests/kit/files.go @@ -1,37 +1,16 @@ package kit import ( - "bufio" "bytes" - "context" "io" "math/rand" "os" "testing" - "github.com/ipfs/boxo/blockservice" - bstore "github.com/ipfs/boxo/blockstore" - chunk "github.com/ipfs/boxo/chunker" - offline "github.com/ipfs/boxo/exchange/offline" - "github.com/ipfs/boxo/files" - "github.com/ipfs/boxo/ipld/merkledag" - "github.com/ipfs/boxo/ipld/unixfs/importer/balanced" - ihelper "github.com/ipfs/boxo/ipld/unixfs/importer/helpers" - "github.com/ipfs/go-cid" - "github.com/ipfs/go-cidutil" - ds "github.com/ipfs/go-datastore" - dssync "github.com/ipfs/go-datastore/sync" - ipldformat "github.com/ipfs/go-ipld-format" - "github.com/ipld/go-car" "github.com/minio/blake2b-simd" - mh "github.com/multiformats/go-multihash" "github.com/stretchr/testify/require" ) -const unixfsChunkSize int64 = 1 << 10 - -var defaultHashFunction = uint64(mh.BLAKE2B_MIN + 31) - // CreateRandomFile creates a random file with the provided seed and the // provided size. func CreateRandomFile(t *testing.T, rseed, size int) (path string) { @@ -51,92 +30,6 @@ func CreateRandomFile(t *testing.T, rseed, size int) (path string) { return file.Name() } -// CreateRandomFile creates a normal file with the provided seed and the -// provided size and then transforms it to a CARv1 file and returns it. -func CreateRandomCARv1(t *testing.T, rseed, size int, opts ...GeneratedDAGOpts) (carV1FilePath string, origFilePath string) { - ctx := context.Background() - if size == 0 { - size = 1600 - } - - source := io.LimitReader(rand.New(rand.NewSource(int64(rseed))), int64(size)) - - file, err := os.CreateTemp(t.TempDir(), "sourcefile.dat") - require.NoError(t, err) - - n, err := io.Copy(file, source) - require.NoError(t, err) - require.EqualValues(t, n, size) - - // - _, err = file.Seek(0, io.SeekStart) - require.NoError(t, err) - bs := bstore.NewBlockstore(dssync.MutexWrap(ds.NewMapDatastore())) - dagSvc := merkledag.NewDAGService(blockservice.New(bs, offline.Exchange(bs))) - - root := writeUnixfsDAG(ctx, t, file, dagSvc, opts...) - - // create a CARv1 file from the DAG - tmp, err := os.CreateTemp(t.TempDir(), "randcarv1") - require.NoError(t, err) - require.NoError(t, car.WriteCar(ctx, dagSvc, []cid.Cid{root}, tmp)) - _, err = tmp.Seek(0, io.SeekStart) - require.NoError(t, err) - hd, err := car.ReadHeader(bufio.NewReader(tmp)) - require.NoError(t, err) - require.EqualValues(t, 1, hd.Version) - require.Len(t, hd.Roots, 1) - require.NoError(t, tmp.Close()) - - return tmp.Name(), file.Name() -} - -type GeneratedDAGOpts struct { - ChunkSize int64 - Maxlinks int -} - -func writeUnixfsDAG(ctx context.Context, t *testing.T, rd io.Reader, dag ipldformat.DAGService, opts ...GeneratedDAGOpts) cid.Cid { - dagOpts := GeneratedDAGOpts{ - ChunkSize: unixfsChunkSize, - Maxlinks: 1024, - } - if len(opts) > 0 { - dagOpts = opts[0] - } - - rpf := files.NewReaderFile(rd) - - // generate the dag and get the root - // import to UnixFS - prefix, err := merkledag.PrefixForCidVersion(1) - require.NoError(t, err) - prefix.MhType = defaultHashFunction - - bufferedDS := ipldformat.NewBufferedDAG(ctx, dag) - params := ihelper.DagBuilderParams{ - Maxlinks: dagOpts.Maxlinks, - RawLeaves: true, - CidBuilder: cidutil.InlineBuilder{ - Builder: prefix, - Limit: 126, - }, - Dagserv: bufferedDS, - } - - db, err := params.New(chunk.NewSizeSplitter(rpf, dagOpts.ChunkSize)) - require.NoError(t, err) - - nd, err := balanced.Layout(db) - require.NoError(t, err) - require.NotEqualValues(t, cid.Undef, nd.Cid()) - - err = bufferedDS.Commit() - require.NoError(t, err) - require.NoError(t, rpf.Close()) - return nd.Cid() -} - // AssertFilesEqual compares two files by blake2b hash equality and // fails the test if unequal. func AssertFilesEqual(t *testing.T, left, right string) { diff --git a/node/modules/storageminer.go b/node/modules/storageminer.go index 11b2420a7a0..04a0a53768c 100644 --- a/node/modules/storageminer.go +++ b/node/modules/storageminer.go @@ -412,7 +412,7 @@ func F3Participation(mctx helpers.MetricsCtx, lc fx.Lifecycle, api v1api.FullNod continue } - // we have succeded in giving a lease, reset the backoff + // we have succeeded in giving a lease, reset the backoff b.Reset() oldLease = newLease diff --git a/storage/sectorblocks/blocks.go b/storage/sectorblocks/blocks.go index 4b84e18fbcb..9affdac008f 100644 --- a/storage/sectorblocks/blocks.go +++ b/storage/sectorblocks/blocks.go @@ -23,12 +23,6 @@ import ( "github.com/filecoin-project/lotus/storage/sealer/storiface" ) -type SealSerialization uint8 - -const ( - SerializationUnixfs0 SealSerialization = 'u' -) - var dsPrefix = datastore.NewKey("/sealedblocks") var ErrNotFound = errors.New("not found")