From 8eecfcb4a637f36e952e7aaefc39a0fdb44eac1d Mon Sep 17 00:00:00 2001 From: Jorropo Date: Tue, 26 Sep 2023 11:35:08 +0200 Subject: [PATCH 1/6] tests: use the latest tag to run helia interop All PRs have been merged: - https://github.com/ipfs/helia/pull/200 - https://github.com/ipfs/helia-unixfs/pull/68 - https://github.com/ipfs/helia-ipns/pull/72 --- .github/workflows/build.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 49ac96690..16fd611d5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -80,10 +80,6 @@ jobs: path: interop - name: Checkout latest tag run: | - exit 0 # temporary while theses pull requests are released: - # https://github.com/ipfs/helia/pull/200 - # https://github.com/ipfs/helia-unixfs/pull/68 - # https://github.com/ipfs/helia-ipns/pull/72 export TAG="$(git describe --tags --abbrev=0)" echo "Running tests against: $TAG" git checkout "$TAG" From 1d295eae92e5b61cfd75e1629b990acb331b79ce Mon Sep 17 00:00:00 2001 From: Jorropo Date: Tue, 26 Sep 2023 11:37:30 +0200 Subject: [PATCH 2/6] tests: use latest npm-kubo https://github.com/ipfs/npm-kubo/pull/62 has been released in v0.22.0. --- .github/workflows/build.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 16fd611d5..e3090696f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -90,8 +90,6 @@ jobs: working-directory: interop - run: npm install working-directory: interop/packages/interop - - run: npm install --ignore-scripts --save "ipfs/npm-go-ipfs#4441b8a60f1cfee3035a9e4bb824dfcca08e9b01" # temporary while https://github.com/ipfs/npm-go-ipfs/pull/62 is being bubbled - working-directory: interop/packages/interop - run: npm test working-directory: interop/packages/interop env: From 600c71bc3c024bb646a8e72d8f072ef9ab23147e Mon Sep 17 00:00:00 2001 From: Jorropo Date: Tue, 26 Sep 2023 10:33:05 +0000 Subject: [PATCH 3/6] chore: update version --- version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.go b/version.go index 5eb0e2981..bed881f01 100644 --- a/version.go +++ b/version.go @@ -11,7 +11,7 @@ import ( var CurrentCommit string // CurrentVersionNumber is the current application's version literal. -const CurrentVersionNumber = "0.23.0-dev" +const CurrentVersionNumber = "0.24.0-dev" const ApiVersion = "/kubo/" + CurrentVersionNumber + "/" //nolint From de173df9e36f1cff9e237f482ecb609ea90d9e35 Mon Sep 17 00:00:00 2001 From: "P. Reis" <76563803+patrickReiis@users.noreply.github.com> Date: Wed, 27 Sep 2023 05:36:49 -0300 Subject: [PATCH 4/6] fix(commands/cid): error on CIDv0 w/ custom -b, upgrade to CIDv1 w/ custom -b, empty -v Co-authored-by: Henrique Dias --- core/commands/cid.go | 7 ++- core/commands/cid_test.go | 111 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 117 insertions(+), 1 deletion(-) create mode 100644 core/commands/cid_test.go diff --git a/core/commands/cid.go b/core/commands/cid.go index 017a5d191..b2e8f131d 100644 --- a/core/commands/cid.go +++ b/core/commands/cid.go @@ -80,11 +80,16 @@ The optional format string is a printf style format string: switch verStr { case "": - // noop + if baseStr != "" { + opts.verConv = toCidV1 + } case "0": if opts.newCodec != 0 && opts.newCodec != cid.DagProtobuf { return fmt.Errorf("cannot convert to CIDv0 with any codec other than dag-pb") } + if baseStr != "" && baseStr != "base58btc" { + return fmt.Errorf("cannot convert to CIDv0 with any multibase other than the implicit base58btc") + } opts.verConv = toCidV0 case "1": opts.verConv = toCidV1 diff --git a/core/commands/cid_test.go b/core/commands/cid_test.go new file mode 100644 index 000000000..106296282 --- /dev/null +++ b/core/commands/cid_test.go @@ -0,0 +1,111 @@ +package commands + +import ( + "testing" + + cmds "github.com/ipfs/go-ipfs-cmds" + "github.com/multiformats/go-multibase" +) + +func TestCidFmtCmd(t *testing.T) { + t.Parallel() + + // Test 'error when -v 0 is present and a custom -b is passed' + t.Run("ipfs cid format -b z -v 0", func(t *testing.T) { + t.Parallel() + + type testV0PresentAndCustomBaseCase struct { + MultibaseName string + ExpectedErrMsg string + } + + var testV0PresentAndCustomBaseCases []testV0PresentAndCustomBaseCase + + for _, e := range multibase.EncodingToStr { + var testCase testV0PresentAndCustomBaseCase + + if e == "base58btc" { + testCase.MultibaseName = e + testCase.ExpectedErrMsg = "" + testV0PresentAndCustomBaseCases = append(testV0PresentAndCustomBaseCases, testCase) + continue + } + testCase.MultibaseName = e + testCase.ExpectedErrMsg = "cannot convert to CIDv0 with any multibase other than the implicit base58btc" + testV0PresentAndCustomBaseCases = append(testV0PresentAndCustomBaseCases, testCase) + } + + for _, e := range testV0PresentAndCustomBaseCases { + + // Mock request + req := &cmds.Request{ + Options: map[string]interface{}{ + cidVerisonOptionName: "0", + cidMultibaseOptionName: e.MultibaseName, + cidFormatOptionName: "%s", + }, + } + + // Response emitter + resp := cmds.ResponseEmitter(nil) + + // Call the CidFmtCmd function with the mock request and response + err := cidFmtCmd.Run(req, resp, nil) + if err == nil && e.MultibaseName == "base58btc" { + continue + } + + errMsg := err.Error() + if errMsg != e.ExpectedErrMsg { + t.Errorf("Expected %s, got %s instead", e.ExpectedErrMsg, errMsg) + } + } + }) + + // Test 'upgrade CID to v1 when passing a custom -b and no -v is specified' + t.Run("ipfs cid format -b z", func(t *testing.T) { + t.Parallel() + + type testImplicitVersionAndCustomMultibaseCase struct { + Ver string + CidV1 string + CidV0 string + MultibaseName string + } + + var testCases = []testImplicitVersionAndCustomMultibaseCase{ + { + Ver: "", + CidV1: "zdj7WWwMSWGoyxYkkT7mHgYvr6tV8CYd77aYxxqSbg9HsiMcE", + CidV0: "QmPr755CxWUwt39C2Yiw4UGKrv16uZhSgeZJmoHUUS9TSJ", + MultibaseName: "z", + }, + { + Ver: "", + CidV1: "CAFYBEIDI7ZABPGG3S63QW3AJG2XAZNE4NJQPN777WLWYRAIDG3TE5QFN3A======", + CidV0: "QmVQVyEijmLb2cBQrowNQsaPbnUnJhfDK1sYe3wepm6ySf", + MultibaseName: "base32padupper", + }, + } + for _, e := range testCases { + // Mock request + req := &cmds.Request{ + Options: map[string]interface{}{ + cidVerisonOptionName: e.Ver, + cidMultibaseOptionName: e.MultibaseName, + cidFormatOptionName: "%s", + }, + } + + // Response emitter + resp := cmds.ResponseEmitter(nil) + + // Call the CidFmtCmd function with the mock request and response + err := cidFmtCmd.Run(req, resp, nil) + + if err != nil { + t.Error(err) + } + } + }) +} From a4efea5c76f95438956a43228f32a0cd61960190 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Sep 2023 21:52:41 +0000 Subject: [PATCH 5/6] chore(deps): bump actions/checkout from 3 to 4 Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/gateway-conformance.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gateway-conformance.yml b/.github/workflows/gateway-conformance.yml index f663cebd3..b766b2a9f 100644 --- a/.github/workflows/gateway-conformance.yml +++ b/.github/workflows/gateway-conformance.yml @@ -142,7 +142,7 @@ jobs: with: name: ${{ github.job }} - name: Checkout kubo-gateway - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: path: kubo-gateway - name: Build kubo-gateway From 695bf66674931a138862b6fa2cb0b16dc2f6ddd8 Mon Sep 17 00:00:00 2001 From: Laurent Senta Date: Mon, 2 Oct 2023 12:05:19 +0200 Subject: [PATCH 6/6] ci: gateway-conformance v0.4 --- .github/workflows/gateway-conformance.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/gateway-conformance.yml b/.github/workflows/gateway-conformance.yml index b766b2a9f..754a2e5a8 100644 --- a/.github/workflows/gateway-conformance.yml +++ b/.github/workflows/gateway-conformance.yml @@ -41,7 +41,7 @@ jobs: steps: # 1. Download the gateway-conformance fixtures - name: Download gateway-conformance fixtures - uses: ipfs/gateway-conformance/.github/actions/extract-fixtures@v0.3 + uses: ipfs/gateway-conformance/.github/actions/extract-fixtures@v0.4 with: output: fixtures @@ -96,7 +96,7 @@ jobs: # 6. Run the gateway-conformance tests - name: Run gateway-conformance tests - uses: ipfs/gateway-conformance/.github/actions/test@v0.3 + uses: ipfs/gateway-conformance/.github/actions/test@v0.4 with: gateway-url: http://127.0.0.1:8080 json: output.json @@ -129,7 +129,7 @@ jobs: steps: # 1. Download the gateway-conformance fixtures - name: Download gateway-conformance fixtures - uses: ipfs/gateway-conformance/.github/actions/extract-fixtures@v0.3 + uses: ipfs/gateway-conformance/.github/actions/extract-fixtures@v0.4 with: output: fixtures @@ -202,7 +202,7 @@ jobs: # 9. Run the gateway-conformance tests over libp2p - name: Run gateway-conformance tests over libp2p - uses: ipfs/gateway-conformance/.github/actions/test@v0.3 + uses: ipfs/gateway-conformance/.github/actions/test@v0.4 with: gateway-url: http://127.0.0.1:8092 json: output.json