diff --git a/core/commands/add.go b/core/commands/add.go index 12a38aaebe7..9f686e14b9f 100644 --- a/core/commands/add.go +++ b/core/commands/add.go @@ -210,9 +210,6 @@ See 'dag export' and 'dag import' for more information. if !ok { return fmt.Errorf("unrecognized hash function: %q", strings.ToLower(hashFunStr)) } - if _, err := mh.GetHasher(hashFunCode); err != nil { - return err - } enc, err := cmdenv.GetCidEncoder(req) if err != nil { diff --git a/core/commands/files.go b/core/commands/files.go index e48abba2815..bba14a1e10f 100644 --- a/core/commands/files.go +++ b/core/commands/files.go @@ -1245,7 +1245,10 @@ func getFileHandle(r *mfs.Root, path string, create bool, builder cid.Builder) ( } nd := dag.NodeWithData(ft.FilePBData(nil, 0)) - nd.SetCidBuilder(builder) + err = nd.SetCidBuilder(builder) + if err != nil { + return nil, err + } err = pdir.AddChild(fname, nd) if err != nil { return nil, err diff --git a/core/commands/object/object.go b/core/commands/object/object.go index 332d28f560d..44864d04664 100644 --- a/core/commands/object/object.go +++ b/core/commands/object/object.go @@ -537,7 +537,9 @@ func deserializeNode(nd *Node, dataFieldEncoding string) (*dag.ProtoNode, error) Cid: c, } } - dagnode.SetLinks(links) + if err := dagnode.SetLinks(links); err != nil { + return nil, err + } return dagnode, nil } diff --git a/core/coreapi/object.go b/core/coreapi/object.go index d2bd08addec..28dd0df08f6 100644 --- a/core/coreapi/object.go +++ b/core/coreapi/object.go @@ -405,7 +405,9 @@ func deserializeNode(nd *Node, dataFieldEncoding string) (*dag.ProtoNode, error) Cid: c, } } - dagnode.SetLinks(links) + if err := dagnode.SetLinks(links); err != nil { + return nil, err + } return dagnode, nil } diff --git a/core/coreapi/unixfs.go b/core/coreapi/unixfs.go index d43bfe3132b..3d6966ac1ef 100644 --- a/core/coreapi/unixfs.go +++ b/core/coreapi/unixfs.go @@ -176,7 +176,10 @@ func (api *UnixfsAPI) Add(ctx context.Context, files files.Node, opts ...options md := dagtest.Mock() emptyDirNode := ft.EmptyDirNode() // Use the same prefix for the "empty" MFS root as for the file adder. - emptyDirNode.SetCidBuilder(fileAdder.CidBuilder) + err := emptyDirNode.SetCidBuilder(fileAdder.CidBuilder) + if err != nil { + return nil, err + } mr, err := mfs.NewRoot(ctx, md, emptyDirNode, nil) if err != nil { return nil, err diff --git a/core/coreunix/add.go b/core/coreunix/add.go index 54e5873a9d4..16ccbaefac7 100644 --- a/core/coreunix/add.go +++ b/core/coreunix/add.go @@ -87,7 +87,10 @@ func (adder *Adder) mfsRoot() (*mfs.Root, error) { return adder.mroot, nil } rnode := unixfs.EmptyDirNode() - rnode.SetCidBuilder(adder.CidBuilder) + err := rnode.SetCidBuilder(adder.CidBuilder) + if err != nil { + return nil, err + } mr, err := mfs.NewRoot(adder.ctx, adder.dagService, rnode, nil) if err != nil { return nil, err @@ -384,7 +387,10 @@ func (adder *Adder) addSymlink(path string, l *files.Symlink) error { } dagnode := dag.NodeWithData(sdata) - dagnode.SetCidBuilder(adder.CidBuilder) + err = dagnode.SetCidBuilder(adder.CidBuilder) + if err != nil { + return err + } err = adder.dagService.Add(adder.ctx, dagnode) if err != nil { return err diff --git a/docs/examples/kubo-as-a-library/go.mod b/docs/examples/kubo-as-a-library/go.mod index 9b8a8772828..6806f0a2fae 100644 --- a/docs/examples/kubo-as-a-library/go.mod +++ b/docs/examples/kubo-as-a-library/go.mod @@ -97,7 +97,7 @@ require ( github.com/ipfs/go-ipns v0.3.0 // indirect github.com/ipfs/go-log v1.0.5 // indirect github.com/ipfs/go-log/v2 v2.5.1 // indirect - github.com/ipfs/go-merkledag v0.6.0 // indirect + github.com/ipfs/go-merkledag v0.8.1 // indirect github.com/ipfs/go-metrics-interface v0.0.1 // indirect github.com/ipfs/go-mfs v0.2.1 // indirect github.com/ipfs/go-namesys v0.5.0 // indirect diff --git a/docs/examples/kubo-as-a-library/go.sum b/docs/examples/kubo-as-a-library/go.sum index a74d0f1a943..809bd317078 100644 --- a/docs/examples/kubo-as-a-library/go.sum +++ b/docs/examples/kubo-as-a-library/go.sum @@ -623,8 +623,9 @@ github.com/ipfs/go-merkledag v0.0.6/go.mod h1:QYPdnlvkOg7GnQRofu9XZimC5ZW5Wi3bKy github.com/ipfs/go-merkledag v0.2.3/go.mod h1:SQiXrtSts3KGNmgOzMICy5c0POOpUNQLvB3ClKnBAlk= github.com/ipfs/go-merkledag v0.3.2/go.mod h1:fvkZNNZixVW6cKSZ/JfLlON5OlgTXNdRLz0p6QG/I2M= github.com/ipfs/go-merkledag v0.5.1/go.mod h1:cLMZXx8J08idkp5+id62iVftUQV+HlYJ3PIhDfZsjA4= -github.com/ipfs/go-merkledag v0.6.0 h1:oV5WT2321tS4YQVOPgIrWHvJ0lJobRTerU+i9nmUCuA= github.com/ipfs/go-merkledag v0.6.0/go.mod h1:9HSEwRd5sV+lbykiYP+2NC/3o6MZbKNaa4hfNcH5iH0= +github.com/ipfs/go-merkledag v0.8.1 h1:N3yrqSre/ffvdwtHL4MXy0n7XH+VzN8DlzDrJySPa94= +github.com/ipfs/go-merkledag v0.8.1/go.mod h1:uYUlWE34GhbcTjGuUDEcdPzsEtOdnOupL64NgSRjmWI= github.com/ipfs/go-metrics-interface v0.0.1 h1:j+cpbjYvu4R8zbleSs36gvB7jR+wsL2fGD6n0jO4kdg= github.com/ipfs/go-metrics-interface v0.0.1/go.mod h1:6s6euYU4zowdslK0GKHmqaIZ3j/b/tL7HTWtJ4VPgWY= github.com/ipfs/go-metrics-prometheus v0.0.2/go.mod h1:ELLU99AQQNi+zX6GCGm2lAgnzdSH3u5UVlCdqSXnEks= diff --git a/go.mod b/go.mod index af5f3706343..207de393acc 100644 --- a/go.mod +++ b/go.mod @@ -51,7 +51,7 @@ require ( github.com/ipfs/go-ipns v0.3.0 github.com/ipfs/go-log v1.0.5 github.com/ipfs/go-log/v2 v2.5.1 - github.com/ipfs/go-merkledag v0.6.0 + github.com/ipfs/go-merkledag v0.8.1 github.com/ipfs/go-metrics-interface v0.0.1 github.com/ipfs/go-metrics-prometheus v0.0.2 github.com/ipfs/go-mfs v0.2.1 diff --git a/go.sum b/go.sum index b476d5f2aa5..8a24817a36b 100644 --- a/go.sum +++ b/go.sum @@ -611,8 +611,9 @@ github.com/ipfs/go-merkledag v0.0.6/go.mod h1:QYPdnlvkOg7GnQRofu9XZimC5ZW5Wi3bKy github.com/ipfs/go-merkledag v0.2.3/go.mod h1:SQiXrtSts3KGNmgOzMICy5c0POOpUNQLvB3ClKnBAlk= github.com/ipfs/go-merkledag v0.3.2/go.mod h1:fvkZNNZixVW6cKSZ/JfLlON5OlgTXNdRLz0p6QG/I2M= github.com/ipfs/go-merkledag v0.5.1/go.mod h1:cLMZXx8J08idkp5+id62iVftUQV+HlYJ3PIhDfZsjA4= -github.com/ipfs/go-merkledag v0.6.0 h1:oV5WT2321tS4YQVOPgIrWHvJ0lJobRTerU+i9nmUCuA= github.com/ipfs/go-merkledag v0.6.0/go.mod h1:9HSEwRd5sV+lbykiYP+2NC/3o6MZbKNaa4hfNcH5iH0= +github.com/ipfs/go-merkledag v0.8.1 h1:N3yrqSre/ffvdwtHL4MXy0n7XH+VzN8DlzDrJySPa94= +github.com/ipfs/go-merkledag v0.8.1/go.mod h1:uYUlWE34GhbcTjGuUDEcdPzsEtOdnOupL64NgSRjmWI= github.com/ipfs/go-metrics-interface v0.0.1 h1:j+cpbjYvu4R8zbleSs36gvB7jR+wsL2fGD6n0jO4kdg= 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= diff --git a/test/dependencies/go.mod b/test/dependencies/go.mod index 51e8021506f..1a0eea2260f 100644 --- a/test/dependencies/go.mod +++ b/test/dependencies/go.mod @@ -13,7 +13,7 @@ require ( github.com/ipfs/go-ipfs-blockstore v1.2.0 github.com/ipfs/go-ipfs-exchange-offline v0.2.0 github.com/ipfs/go-log v1.0.5 - github.com/ipfs/go-merkledag v0.6.0 + github.com/ipfs/go-merkledag v0.8.1 github.com/ipfs/go-unixfs v0.3.1 github.com/ipfs/hang-fds v0.1.0 github.com/ipfs/iptb v1.4.0 diff --git a/test/dependencies/go.sum b/test/dependencies/go.sum index 3c148639d0c..47bd100f4e2 100644 --- a/test/dependencies/go.sum +++ b/test/dependencies/go.sum @@ -664,8 +664,8 @@ github.com/ipfs/go-merkledag v0.0.6/go.mod h1:QYPdnlvkOg7GnQRofu9XZimC5ZW5Wi3bKy github.com/ipfs/go-merkledag v0.2.3/go.mod h1:SQiXrtSts3KGNmgOzMICy5c0POOpUNQLvB3ClKnBAlk= github.com/ipfs/go-merkledag v0.3.2/go.mod h1:fvkZNNZixVW6cKSZ/JfLlON5OlgTXNdRLz0p6QG/I2M= github.com/ipfs/go-merkledag v0.5.1/go.mod h1:cLMZXx8J08idkp5+id62iVftUQV+HlYJ3PIhDfZsjA4= -github.com/ipfs/go-merkledag v0.6.0 h1:oV5WT2321tS4YQVOPgIrWHvJ0lJobRTerU+i9nmUCuA= -github.com/ipfs/go-merkledag v0.6.0/go.mod h1:9HSEwRd5sV+lbykiYP+2NC/3o6MZbKNaa4hfNcH5iH0= +github.com/ipfs/go-merkledag v0.8.1 h1:N3yrqSre/ffvdwtHL4MXy0n7XH+VzN8DlzDrJySPa94= +github.com/ipfs/go-merkledag v0.8.1/go.mod h1:uYUlWE34GhbcTjGuUDEcdPzsEtOdnOupL64NgSRjmWI= github.com/ipfs/go-metrics-interface v0.0.1 h1:j+cpbjYvu4R8zbleSs36gvB7jR+wsL2fGD6n0jO4kdg= github.com/ipfs/go-metrics-interface v0.0.1/go.mod h1:6s6euYU4zowdslK0GKHmqaIZ3j/b/tL7HTWtJ4VPgWY= github.com/ipfs/go-path v0.0.7/go.mod h1:6KTKmeRnBXgqrTvzFrPV3CamxcgvXX/4z79tfAd2Sno= diff --git a/test/sharness/t0042-add-skip.sh b/test/sharness/t0042-add-skip.sh index 64d8e1a7c41..9da78163c45 100755 --- a/test/sharness/t0042-add-skip.sh +++ b/test/sharness/t0042-add-skip.sh @@ -93,10 +93,6 @@ EOF test_cmp expected actual ' - test_expect_failure "'ipfs add' with an unregistered hash and wrapped leaves fails without crashing" ' - ipfs add --hash poseidon-bls12_381-a2-fc1 --raw-leaves=false -r mountdir/planets - ' - } # should work offline