Skip to content

Commit 3f0947b

Browse files
authored
Merge pull request #10433 from ipfs/release-v0.29.0
Release: v0.29.0 [skip changelog]
2 parents e7f0f34 + b35cd62 commit 3f0947b

File tree

34 files changed

+1230
-611
lines changed

34 files changed

+1230
-611
lines changed

.github/workflows/gotest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
make -j "$PARALLEL" test/unit/gotest.junit.xml &&
4646
[[ ! $(jq -s -c 'map(select(.Action == "fail")) | .[]' test/unit/gotest.json) ]]
4747
- name: Upload coverage to Codecov
48-
uses: codecov/codecov-action@7afa10ed9b269c561c2336fd862446844e0cbf71 # v4.2.0
48+
uses: codecov/codecov-action@6d798873df2b1b8e5846dba6fb86631229fbcb17 # v4.4.0
4949
if: failure() || success()
5050
with:
5151
name: unittests

.github/workflows/sharness.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
# increasing parallelism beyond 10 doesn't speed up the tests much
5656
PARALLEL: ${{ github.repository == 'ipfs/kubo' && 10 || 3 }}
5757
- name: Upload coverage report
58-
uses: codecov/codecov-action@7afa10ed9b269c561c2336fd862446844e0cbf71 # v4.2.0
58+
uses: codecov/codecov-action@6d798873df2b1b8e5846dba6fb86631229fbcb17 # v4.4.0
5959
if: failure() || success()
6060
with:
6161
name: sharness

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Kubo Changelogs
22

3+
- [v0.29](docs/changelogs/v0.29.md)
34
- [v0.28](docs/changelogs/v0.28.md)
45
- [v0.27](docs/changelogs/v0.27.md)
56
- [v0.26](docs/changelogs/v0.26.md)

client/rpc/pin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ package rpc
33
import (
44
"context"
55
"encoding/json"
6+
"errors"
67
"io"
78
"strings"
89

910
"github.com/ipfs/boxo/path"
1011
"github.com/ipfs/go-cid"
1112
iface "github.com/ipfs/kubo/core/coreiface"
1213
caopts "github.com/ipfs/kubo/core/coreiface/options"
13-
"github.com/pkg/errors"
1414
)
1515

1616
type PinAPI HttpApi

config/config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ type Config struct {
3636
Experimental Experiments
3737
Plugins Plugins
3838
Pinning Pinning
39+
Import Import
3940

4041
Internal Internal // experimental/unstable options
4142
}

config/import.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package config
2+
3+
const (
4+
DefaultCidVersion = 0
5+
DefaultUnixFSRawLeaves = false
6+
DefaultUnixFSChunker = "size-262144"
7+
DefaultHashFunction = "sha2-256"
8+
)
9+
10+
// Import configures the default options for ingesting data. This affects commands
11+
// that ingest data, such as 'ipfs add', 'ipfs dag put, 'ipfs block put', 'ipfs files write'.
12+
type Import struct {
13+
CidVersion OptionalInteger
14+
UnixFSRawLeaves Flag
15+
UnixFSChunker OptionalString
16+
HashFunction OptionalString
17+
}

config/profile.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,28 @@ fetching may be degraded.
204204
return nil
205205
},
206206
},
207+
"legacy-cid-v0": {
208+
Description: `Makes UnixFS import produce legacy CIDv0 with no raw leaves, sha2-256 and 256 KiB chunks.`,
209+
210+
Transform: func(c *Config) error {
211+
c.Import.CidVersion = *NewOptionalInteger(0)
212+
c.Import.UnixFSRawLeaves = False
213+
c.Import.UnixFSChunker = *NewOptionalString("size-262144")
214+
c.Import.HashFunction = *NewOptionalString("sha2-256")
215+
return nil
216+
},
217+
},
218+
"test-cid-v1": {
219+
Description: `Makes UnixFS import produce modern CIDv1 with raw leaves, sha2-256 and 1 MiB chunks.`,
220+
221+
Transform: func(c *Config) error {
222+
c.Import.CidVersion = *NewOptionalInteger(1)
223+
c.Import.UnixFSRawLeaves = True
224+
c.Import.UnixFSChunker = *NewOptionalString("size-1048576")
225+
c.Import.HashFunction = *NewOptionalString("sha2-256")
226+
return nil
227+
},
228+
},
207229
}
208230

209231
func getAvailablePort() (port int, err error) {

core/commands/add.go

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
gopath "path"
99
"strings"
1010

11+
"github.com/ipfs/kubo/config"
1112
"github.com/ipfs/kubo/core/commands/cmdenv"
1213

1314
"github.com/cheggaaa/pb"
@@ -155,12 +156,12 @@ See 'dag export' and 'dag import' for more information.
155156
cmds.BoolOption(trickleOptionName, "t", "Use trickle-dag format for dag generation."),
156157
cmds.BoolOption(onlyHashOptionName, "n", "Only chunk and hash - do not write to disk."),
157158
cmds.BoolOption(wrapOptionName, "w", "Wrap files with a directory object."),
158-
cmds.StringOption(chunkerOptionName, "s", "Chunking algorithm, size-[bytes], rabin-[min]-[avg]-[max] or buzhash").WithDefault("size-262144"),
159+
cmds.StringOption(chunkerOptionName, "s", "Chunking algorithm, size-[bytes], rabin-[min]-[avg]-[max] or buzhash"),
159160
cmds.BoolOption(rawLeavesOptionName, "Use raw blocks for leaf nodes."),
160161
cmds.BoolOption(noCopyOptionName, "Add the file using filestore. Implies raw-leaves. (experimental)"),
161162
cmds.BoolOption(fstoreCacheOptionName, "Check the filestore for pre-existing blocks. (experimental)"),
162163
cmds.IntOption(cidVersionOptionName, "CID version. Defaults to 0 unless an option that depends on CIDv1 is passed. Passing version 1 will cause the raw-leaves option to default to true."),
163-
cmds.StringOption(hashOptionName, "Hash function to use. Implies CIDv1 if not sha2-256. (experimental)").WithDefault("sha2-256"),
164+
cmds.StringOption(hashOptionName, "Hash function to use. Implies CIDv1 if not sha2-256. (experimental)"),
164165
cmds.BoolOption(inlineOptionName, "Inline small blocks into CIDs. (experimental)"),
165166
cmds.IntOption(inlineLimitOptionName, "Maximum block size to inline. (experimental)").WithDefault(32),
166167
cmds.BoolOption(pinOptionName, "Pin locally to protect added files from garbage collection.").WithDefault(true),
@@ -191,6 +192,16 @@ See 'dag export' and 'dag import' for more information.
191192
return err
192193
}
193194

195+
nd, err := cmdenv.GetNode(env)
196+
if err != nil {
197+
return err
198+
}
199+
200+
cfg, err := nd.Repo.Config()
201+
if err != nil {
202+
return err
203+
}
204+
194205
progress, _ := req.Options[progressOptionName].(bool)
195206
trickle, _ := req.Options[trickleOptionName].(bool)
196207
wrap, _ := req.Options[wrapOptionName].(bool)
@@ -207,6 +218,24 @@ See 'dag export' and 'dag import' for more information.
207218
inlineLimit, _ := req.Options[inlineLimitOptionName].(int)
208219
toFilesStr, toFilesSet := req.Options[toFilesOptionName].(string)
209220

221+
if chunker == "" {
222+
chunker = cfg.Import.UnixFSChunker.WithDefault(config.DefaultUnixFSChunker)
223+
}
224+
225+
if hashFunStr == "" {
226+
hashFunStr = cfg.Import.HashFunction.WithDefault(config.DefaultHashFunction)
227+
}
228+
229+
if !cidVerSet && !cfg.Import.CidVersion.IsDefault() {
230+
cidVerSet = true
231+
cidVer = int(cfg.Import.CidVersion.WithDefault(config.DefaultCidVersion))
232+
}
233+
234+
if !rbset && cfg.Import.UnixFSRawLeaves != config.Default {
235+
rbset = true
236+
rawblks = cfg.Import.UnixFSRawLeaves.WithDefault(config.DefaultUnixFSRawLeaves)
237+
}
238+
210239
if onlyHash && toFilesSet {
211240
return fmt.Errorf("%s and %s options are not compatible", onlyHashOptionName, toFilesOptionName)
212241
}

core/commands/block.go

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88

99
"github.com/ipfs/boxo/files"
1010

11+
"github.com/ipfs/kubo/config"
1112
cmdenv "github.com/ipfs/kubo/core/commands/cmdenv"
1213
"github.com/ipfs/kubo/core/commands/cmdutils"
1314

@@ -153,7 +154,7 @@ only for backward compatibility when a legacy CIDv0 is required (--format=v0).
153154
},
154155
Options: []cmds.Option{
155156
cmds.StringOption(blockCidCodecOptionName, "Multicodec to use in returned CID").WithDefault("raw"),
156-
cmds.StringOption(mhtypeOptionName, "Multihash hash function").WithDefault("sha2-256"),
157+
cmds.StringOption(mhtypeOptionName, "Multihash hash function"),
157158
cmds.IntOption(mhlenOptionName, "Multihash hash length").WithDefault(-1),
158159
cmds.BoolOption(pinOptionName, "Pin added blocks recursively").WithDefault(false),
159160
cmdutils.AllowBigBlockOption,
@@ -165,7 +166,21 @@ only for backward compatibility when a legacy CIDv0 is required (--format=v0).
165166
return err
166167
}
167168

169+
nd, err := cmdenv.GetNode(env)
170+
if err != nil {
171+
return err
172+
}
173+
174+
cfg, err := nd.Repo.Config()
175+
if err != nil {
176+
return err
177+
}
178+
168179
mhtype, _ := req.Options[mhtypeOptionName].(string)
180+
if mhtype == "" {
181+
mhtype = cfg.Import.HashFunction.WithDefault(config.DefaultHashFunction)
182+
}
183+
169184
mhtval, ok := mh.Names[mhtype]
170185
if !ok {
171186
return fmt.Errorf("unrecognized multihash function: %s", mhtype)

core/commands/dag/dag.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ into an object of the specified format.
8787
cmds.StringOption("store-codec", "Codec that the stored object will be encoded with").WithDefault("dag-cbor"),
8888
cmds.StringOption("input-codec", "Codec that the input object is encoded in").WithDefault("dag-json"),
8989
cmds.BoolOption("pin", "Pin this object when adding."),
90-
cmds.StringOption("hash", "Hash function to use").WithDefault("sha2-256"),
90+
cmds.StringOption("hash", "Hash function to use"),
9191
cmdutils.AllowBigBlockOption,
9292
},
9393
Run: dagPut,

0 commit comments

Comments
 (0)