Daniel Martí
de6c03deae
amend the CidFromReader slice extension math
...
The append+make slice extension idiom works, but note that append uses
the slice's length as its base. We need to append the number of bytes
required for length to reach cidLength, not the capacity.
The added test case panicked before this change, and works now:
--- FAIL: TestReadCidsFromBuffer (0.00s)
panic: runtime error: slice bounds out of range [:73] with capacity 64 [recovered]
panic: runtime error: slice bounds out of range [:73] with capacity 64
goroutine 37 [running]:
testing.tRunner.func1.2({0x570d60, 0xc000016438})
testing/testing.go:1203 +0x24e
testing.tRunner.func1()
testing/testing.go:1206 +0x218
panic({0x570d60, 0xc000016438})
runtime/panic.go:1038 +0x215
github.com/ipfs/go-cid.CidFromReader({0x5b0e20, 0xc000010900})
github.com/ipfs/go-cid/cid.go:803 +0x75f
github.com/ipfs/go-cid.TestReadCidsFromBuffer(0xc00014ba00)
github.com/ipfs/go-cid/cid_test.go:710 +0x625
testing.tRunner(0xc00014ba00, 0x58af38)
testing/testing.go:1253 +0x102
created by testing.(*T).Run
testing/testing.go:1300 +0x35a
exit status 2
FAIL github.com/ipfs/go-cid 0.004s
v0.1.0
2021-07-16 10:10:50 +01:00
Daniel Martí
c4c8760a80
implement CidFromReader
...
And reuse two CidFromBytes tests for it, which includes both CIDv0 and
CIDv1 cases as inputs, as well as some inputs that should error.
Fixes #126 .
2021-07-15 01:01:22 +01:00
Steven Allen
8e9280df3d
Merge pull request #118 from ipfs/multihash-update
...
Update go-multihash. Now uses registry system.
2021-06-25 17:23:48 -07:00
Eric Myhre
b4bcfe45c9
Update go-multihash.
...
You can't see it from here, but go-mulithash now uses registry system,
so it's reasonably possible to introduce new hashers, and to use
(some parts of!) go-multihash without bringing in lots of transitive
dependencies.
The main package of go-multihash still brings in everything
transitively that it did before, so go-cid's transitives aren't
shrinking, and no code is changing here... but it's closer.
If we did cut over to the new go-mulithash/core, we could make
many transitive dependencies become optional.
2021-06-25 16:05:47 -07:00
Marten Seemann
979bf3fb85
Merge pull request #125 from ipfs/web3-bot/sync
...
sync: update CI config files
2021-06-01 12:40:31 -07:00
web3-bot
95ec98a9cc
update .github/workflows/go-check.yml
2021-06-01 16:53:30 +00:00
web3-bot
1c23d3b694
update .github/workflows/go-test.yml
2021-06-01 16:53:30 +00:00
web3-bot
5b5d1329c5
update .github/workflows/automerge.yml
2021-06-01 16:53:30 +00:00
web3-bot
a42c04af93
sync: update CI config files ( #124 )
2021-05-12 15:13:58 +00:00
Steven Allen
0582f6b9b2
Merge pull request #122 from iand/chore/repo-health
...
chore: fixups from running go vet, go fmt and staticcheck
2021-05-10 08:32:22 -07:00
Ian Davis
0717510dfb
chore: fixups from running go vet, go fmt and staticcheck
2021-05-07 15:43:00 +01:00
dependabot-preview[bot]
e530276a70
Bump github.com/multiformats/go-varint from 0.0.5 to 0.0.6
...
Bumps [github.com/multiformats/go-varint](https://github.com/multiformats/go-varint ) from 0.0.5 to 0.0.6.
- [Release notes](https://github.com/multiformats/go-varint/releases )
- [Commits](https://github.com/multiformats/go-varint/compare/v0.0.5...v0.0.6 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com >
2020-10-15 14:27:46 +11:00
dependabot-preview[bot]
45f4147a06
Bump github.com/multiformats/go-multihash from 0.0.13 to 0.0.14
...
Bumps [github.com/multiformats/go-multihash](https://github.com/multiformats/go-multihash ) from 0.0.13 to 0.0.14.
- [Release notes](https://github.com/multiformats/go-multihash/releases )
- [Commits](https://github.com/multiformats/go-multihash/compare/v0.0.13...v0.0.14 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com >
2020-10-15 14:12:37 +11:00
Rod Vagg
b34ad3cfa5
s/characters/bytes
2020-10-15 14:05:52 +11:00
gammazero
ec089b8a53
Fix inaccurate comment for uvarint
...
This fixes the comment to be consistent with the code, and fixes spelling.
Fixes Issue #111
2020-10-15 14:05:52 +11:00
Rod Vagg
efe2d2de45
coverage: more tests for cid
2020-10-15 14:00:36 +11:00
Rod Vagg
46aac88838
coverage: more tests for varint
2020-10-15 14:00:36 +11:00
Rod Vagg
f60e346b24
coverage: more tests for builder
2020-10-15 14:00:36 +11:00
Rod Vagg
8647a1d84b
fix: make tests run with Go 1.15
...
> ./cid_test.go:451:52: conversion from uint64 to string yields a string of one rune, not a string of digits (did you mean fmt.Sprint(x)?)
2020-10-15 14:00:36 +11:00
Alex Good
de49849130
Add the dagjose multiformat
2020-10-15 14:00:36 +11:00
Whyrusleeping
8b9ff3906e
Merge pull request #109 from ipfs/feat/optimize-prefix
...
feat: optimize cid.Prefix
v0.0.7
2020-07-23 09:15:54 -07:00
Steven Allen
f7cb4c91eb
feat: optimize cid.Prefix
...
We call this frequently and having to allocate here is really unfortunate.
2020-07-22 19:45:20 -07:00
Peter Rabbitson
85cd30874e
Merge pull request #107 from ipfs/chore/base36_support
...
Chore/base36 support
v0.0.6
2020-05-25 18:15:04 +02:00
Peter Rabbitson
12e2623f35
gx-era file no longer relevant
2020-05-25 18:08:48 +02:00
Marcin Rataj
d683e9243c
test: lowercase base36
...
Base36 was introduced mainly for use in DNS, and various user agents
force lowercase, so tests should use that instead.
License: MIT
Signed-off-by: Marcin Rataj <lidel@lidel.org >
2020-05-25 17:46:16 +02:00
Peter Rabbitson
18af217de6
Add explicit base36 test
2020-05-25 14:06:26 +02:00
Peter Rabbitson
9830f823b5
Base36 support
2020-05-25 13:51:07 +02:00
Peter Rabbitson
d110f73c43
Remove gx remnants
2020-05-25 13:50:43 +02:00
Steven Allen
95a7ed4233
Merge pull request #104 from rvagg/rvagg/filecoin-codecs
...
feat: add Filecoin multicodecs
2020-05-25 00:46:19 -07:00
Rod Vagg
8dd6fe2778
feat: add Filecoin multicodecs
...
* fil-commitment-unsealed
* fil-commitment-sealed
Ref: https://github.com/multiformats/multicodec/pull/161
Ref: https://github.com/multiformats/multicodec/pull/172
2020-05-13 11:22:42 +10:00
Hector Sanjuan
a25d68f3e4
Add autocomment configuration
2020-05-04 12:05:06 +02:00
Whyrusleeping
7c82f3b81c
Merge pull request #103 from ipfs/fix/write-to-interface
...
avoid calling the method WriteTo if we don't satisfy its contract
2020-05-01 16:06:55 -07:00
Jeromy
75caa6bdbd
avoid calling the method WriteTo if we don't satisfy its contract
2020-05-01 16:04:36 -07:00
Whyrusleeping
c1c89c20c1
Merge pull request #102 from ipfs/feat/add-methods-for-using-less-memory
...
add a couple useful methods
2020-05-01 15:54:35 -07:00
Eric Myhre
628a0123ed
Slightly more documentation comment.
2020-05-02 00:52:07 +02:00
Jeromy
266e76d591
properly satisfy writerTo interface
2020-05-01 15:44:06 -07:00
Jeromy
7d7cb88d78
add a couple useful methods
2020-05-01 15:01:28 -07:00
Steven Allen
723b4ab105
Merge pull request #101 from vmx/patch-1
...
chore: make comment reflect the code
2020-04-29 09:27:52 -07:00
Volker Mische
9cb3848e51
chore: make comment reflect the code
...
During the change to default CIDV1 to Base32, the corresponding code
comment wasn't updated.
2020-04-28 16:02:21 +02:00
Hector Sanjuan
f458e04107
Add standard issue template
2020-04-27 11:27:08 +02:00
Steven Allen
72cd3d39d7
Merge pull request #99 from ipfs/fix/minimal-encoding
...
fix: enforce minimal encoding
v0.0.5
2020-02-04 12:12:58 -08:00
Steven Allen
c1b740035a
fix: enforce minimal encoding
...
Note: this removes two errors that don't appear to be used by anyone.
2020-02-03 20:55:45 -08:00
Steven Allen
3da5bbbe45
Merge pull request #92 from b5/chore_remove_gx
...
docs(readme): remove reference to gx
v0.0.4
2019-12-09 06:47:25 -06:00
Steven Allen
9d598bbdbd
Merge pull request #98 from ipfs/dependabot/go_modules/github.com/multiformats/go-multihash-0.0.10
...
Bump github.com/multiformats/go-multihash from 0.0.9 to 0.0.10
2019-12-09 06:24:09 -06:00
dependabot-preview[bot]
b420452400
Bump github.com/multiformats/go-multihash from 0.0.9 to 0.0.10
...
Bumps [github.com/multiformats/go-multihash](https://github.com/multiformats/go-multihash ) from 0.0.9 to 0.0.10.
- [Release notes](https://github.com/multiformats/go-multihash/releases )
- [Commits](https://github.com/multiformats/go-multihash/compare/v0.0.9...v0.0.10 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com >
2019-12-09 11:21:09 +00:00
Steven Allen
ed7dab1755
Merge pull request #97 from ipfs/fix/parse-panic
...
fix parsing issues and nits
2019-12-03 09:50:46 -05:00
Steven Allen
5df89959a0
test: test parsing non-sha256 hashes
2019-12-02 20:41:59 -05:00
Steven Allen
60ab0f84f0
chore: avoid magic numbers
2019-12-02 20:35:36 -05:00
Steven Allen
08e15f8a6c
chore: avoid re-validated already validated CIDs
2019-12-02 20:35:27 -05:00
Steven Allen
58b483a841
fix: avoid panicing if we try to parse a non-sha multihash as a CIDv0
...
I'm pretty sure we never call `Parse` multihashes anyways, but we should be careful.
2019-12-02 20:34:30 -05:00