From 948b6a9cd320aca9660e73f9c05b5af135246210 Mon Sep 17 00:00:00 2001 From: Rod Vagg Date: Fri, 15 Sep 2023 21:32:54 +1000 Subject: [PATCH] fix: trust most linksystems --- pkg/internal/itest/http_fetch_test.go | 3 +++ pkg/net/client/client_test.go | 2 ++ pkg/retriever/bitswapretriever_test.go | 2 ++ pkg/retriever/httpretriever_test.go | 1 + 4 files changed, 8 insertions(+) diff --git a/pkg/internal/itest/http_fetch_test.go b/pkg/internal/itest/http_fetch_test.go index b223d3b6..6618a854 100644 --- a/pkg/internal/itest/http_fetch_test.go +++ b/pkg/internal/itest/http_fetch_test.go @@ -606,6 +606,7 @@ func TestHttpFetch(t *testing.T) { lsys := cidlink.DefaultLinkSystem() lsys.SetReadStorage(store) lsys.SetWriteStorage(store) + lsys.TrustedStorage = true _, err := traversal.Config{ Root: srcData.Root, Selector: selectorparse.CommonSelector_ExploreAllRecursively, @@ -645,6 +646,7 @@ func TestHttpFetch(t *testing.T) { lsys := cidlink.DefaultLinkSystem() lsys.SetReadStorage(store) lsys.SetWriteStorage(store) + lsys.TrustedStorage = true _, err := traversal.Config{ Root: srcData.Root, Selector: selectorparse.CommonSelector_ExploreAllRecursively, @@ -701,6 +703,7 @@ func TestHttpFetch(t *testing.T) { lsys := cidlink.DefaultLinkSystem() lsys.SetReadStorage(store) lsys.SetWriteStorage(store) + lsys.TrustedStorage = true _, err := traversal.Config{ Root: srcData.Root, Selector: selectorparse.CommonSelector_ExploreAllRecursively, diff --git a/pkg/net/client/client_test.go b/pkg/net/client/client_test.go index 5fd8a5cd..d3baa062 100644 --- a/pkg/net/client/client_test.go +++ b/pkg/net/client/client_test.go @@ -36,6 +36,7 @@ func TestClient(t *testing.T) { } p := peer.ID("testpeer") linkSys := cidlink.DefaultLinkSystem() + linkSys.TrustedStorage = true gotLoadFor := cid.Undef linkSys.StorageReadOpener = func(linkCtx ipld.LinkContext, lnk ipld.Link) (io.Reader, error) { gotLoadFor = lnk.(cidlink.Link).Cid @@ -89,6 +90,7 @@ func TestClient_BadSelector(t *testing.T) { } p := peer.ID("testpeer") linkSys := cidlink.DefaultLinkSystem() + linkSys.TrustedStorage = true selector := basicnode.NewFloat(100.2) proposal := &retrievaltypes.DealProposal{ PayloadCID: cid.MustParse("bafyreibdoxfay27gf4ye3t5a7aa5h4z2azw7hhhz36qrbf5qleldj76qfa"), diff --git a/pkg/retriever/bitswapretriever_test.go b/pkg/retriever/bitswapretriever_test.go index 3c315627..49ba1301 100644 --- a/pkg/retriever/bitswapretriever_test.go +++ b/pkg/retriever/bitswapretriever_test.go @@ -41,6 +41,7 @@ func TestBitswapRetriever(t *testing.T) { lsys := cidlink.DefaultLinkSystem() lsys.SetReadStorage(store) lsys.SetWriteStorage(store) + lsys.TrustedStorage = true tbc1 := gstestutil.SetupBlockChain(ctx, t, lsys, 1000, 100) tbc2 := gstestutil.SetupBlockChain(ctx, t, lsys, 1000, 100) var tbc1Cids []cid.Cid @@ -600,6 +601,7 @@ func makeLsys(blocks []blocks.Block, threadsafe bool) *linking.LinkSystem { } lsys.SetReadStorage(store) lsys.SetWriteStorage(store) + lsys.TrustedStorage = true return &lsys } diff --git a/pkg/retriever/httpretriever_test.go b/pkg/retriever/httpretriever_test.go index 89fd859c..08cee90c 100644 --- a/pkg/retriever/httpretriever_test.go +++ b/pkg/retriever/httpretriever_test.go @@ -46,6 +46,7 @@ func TestHTTPRetriever(t *testing.T) { lsys := cidlink.DefaultLinkSystem() lsys.SetReadStorage(store) lsys.SetWriteStorage(store) + lsys.TrustedStorage = true tbc1 := gstestutil.SetupBlockChain(ctx, t, lsys, 1000, 100) tbc2 := gstestutil.SetupBlockChain(ctx, t, lsys, 1000, 100) var tbc1Cids []cid.Cid