-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: switch to raw multihashes for blocks #6816
Conversation
5535749
to
df993a3
Compare
df993a3
to
19bdde9
Compare
@Stebalien other than the right import versions here, this should be good. |
aa3757e
to
f0f8f89
Compare
@Stebalien some sharness tests are failing because some outputs changed from CidV0 to CidV1 (i.e. Shall I patch at the core/commands level (i.e. we can convert to CidV0 in the places we do I think things get messy with sharness. If I'm getting it right, So a sharness test adding a hash with CidV1 and then checking that |
I'm going to work on fixing sharness tests directly |
Yai all green :) @Stebalien can you check my last commits? (btw it seems it fast-forwarded a merge from master or something and did not create a merge commit, making the history a bit dirty). |
2e32814
to
24f9109
Compare
This one seems ok in terms of tests and everything, it just needed some rebase. |
I will look at it more closely though, particularly the GC part. |
Not that they will ever happen in the current implementation, but it makes the linter happy and covers our back for future.
This fixes some tests which expect "refs local" and "repo gc" outputs to match the CIDs produced when adding data. These operations are now outputting CIDv1-raw hashes, regardless of the original CIDs used to address those blocks, so some tests fail. The fix is usually: * To use "block stat" to check if a block was correctly gc'ed * To convert the CIDs to multihash (using cid-fmt) and compare those instead
This sharness test provides 2 datastore blocks directly. One of them (corresponding to an "insecure block") is not a CIDv0 therefore it needs to be migrated and stored with its raw-multihash ID. The (raw) CID of the block used in the test remains the same. The other block needs no changes.
Compare multihashes rather than CIDs.
d219ad7
to
b55a943
Compare
@hsanjuan the only thing I clobbered/ignored in the rebase was 163794e (t0081-repo-pinning.sh re-enable the offline daemon), since I figured it might've been intentional that we were running some of the tests with the daemon off and some with it on, but in offline mode. If so we can just remove the extraneous comments. This issue seems unrelated to the main thrust of the PR, but ended up here as you were cleaning things up (thanks for that 🙏). |
HASH_MH=`cid-fmt -b base32 "%M" "$HASH"` && | ||
HARDCODED_HASH_MH=`cid-fmt -b base32 "%M" "QmYCvbfNbCwFR45HiNP45rwJgvatpiW38D961L5qAhUM5Y"` && | ||
EMPTY_DIR_MH=`cid-fmt -b base32 "%M" "$EMPTY_DIR"` && | ||
HASH_WELCOME_DOCS_MH=`cid-fmt -b base32 "%M" "$HASH_WELCOME_DOCS"` && | ||
ipfs refs local | cid-fmt -b base32 --filter "%M" >actual8 && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need cid-fmt
here, or can we use ipfs cid format
? Generally, asking here and through the PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know, this was done before ipfs cid format
was there. Worth fixing in a different PR accross all tests?
grep -q "removed $(to_raw_cid $LEAF3)" repo_gc_out && | ||
grep -q "removed $(to_raw_cid $LEAF4)" repo_gc_out && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These don't seem necessary since we're already doing raw leaves, but it can't hurt
@@ -85,7 +89,7 @@ test_gc_robust_part1() { | |||
|
|||
test_expect_success "'ipfs repo gc' should be ok now" ' | |||
ipfs repo gc | tee repo_gc_out | |||
grep -q "removed $LEAF2" repo_gc_out | |||
grep -q "removed $(to_raw_cid $LEAF2)" repo_gc_out |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem necessary since we're already doing raw leaves, but it can't hurt
github.com/ipfs/go-fs-lock v0.0.7 | ||
github.com/ipfs/go-graphsync v0.11.0 | ||
github.com/ipfs/go-ipfs-blockstore v0.2.1 | ||
github.com/ipfs/go-ipfs-blockstore v1.1.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: Update dist CID to point at latest migration
@@ -36,7 +36,7 @@ const LockFile = "repo.lock" | |||
var log = logging.Logger("fsrepo") | |||
|
|||
// version number that we are currently expecting to see | |||
var RepoVersion = 11 | |||
var RepoVersion = 12 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: bumped repo version
@@ -10,7 +10,7 @@ import ( | |||
|
|||
const ( | |||
// Current distribution to fetch migrations from | |||
CurrentIpfsDist = "/ipfs/QmP7tLxzhLU1KauTRX3jkVkF93pCv4skcceyUYMhf4AKJR" // fs-repo-migrations v2.0.2 | |||
CurrentIpfsDist = "/ipfs/QmPweMoUxWFt1MSpYwLWsHB1GBcyYYDKPnANdERMY4U6hK" // fs-repo-11-to-12 v1.0.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: Bumped to latest version of dist.ipfs.io
Part of: #6815