Skip to content
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

Add IPFS hash of source files to metadata. #6599

Merged
merged 2 commits into from
May 15, 2019
Merged

Add IPFS hash of source files to metadata. #6599

merged 2 commits into from
May 15, 2019

Conversation

chriseth
Copy link
Contributor

No description provided.

@@ -0,0 +1,360 @@
/*
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file was already part of this repository at some point :)

@stackenbotten
Copy link

There was an error when running test_check_style for commit 7ced487a4f3caee3682d564126ce244eeebc5423:

Error: Trailing whitespace found:
 libdevcore/picosha2.h:38:namespace detail 
 libdevcore/picosha2.h:69: 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 
 libdevcore/picosha2.h:121: 
 libdevcore/picosha2.h:130: 
 libdevcore/picosha2.h:166: } 
 libdevcore/picosha2.h:214: detail::hash256_block(h_, buffer_.begin()+i, buffer_.begin()+i+64); 
 libdevcore/picosha2.h:266: data_length_digits_, data_length_digits_+4, 

Please check that your changes are working as intended.

@stackenbotten
Copy link

There was an error when running test_check_style for commit 00af3ac48adddde0c1743db6172a533b28ad0110:

Error: Trailing whitespace found:
 libdevcore/picosha2.h:38:namespace detail 
 libdevcore/picosha2.h:69: 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 
 libdevcore/picosha2.h:121: 
 libdevcore/picosha2.h:130: 
 libdevcore/picosha2.h:166: } 
 libdevcore/picosha2.h:214: detail::hash256_block(h_, buffer_.begin()+i, buffer_.begin()+i+64); 
 libdevcore/picosha2.h:266: data_length_digits_, data_length_digits_+4, 

Please check that your changes are working as intended.

@axic
Copy link
Member

axic commented Apr 25, 2019

@chriseth
Copy link
Contributor Author

Ah nice! I couldn't find anything similar to your pbdag.proto, though.

@codecov
Copy link

codecov bot commented Apr 29, 2019

Codecov Report

❗ No coverage uploaded for pull request base (develop@ca4b1bc). Click here to learn what that means.
The diff coverage is 96.27%.

Impacted file tree graph

@@            Coverage Diff             @@
##             develop    #6599   +/-   ##
==========================================
  Coverage           ?   87.02%           
==========================================
  Files              ?      412           
  Lines              ?    40059           
  Branches           ?     4730           
==========================================
  Hits               ?    34862           
  Misses             ?     3628           
  Partials           ?     1569
Flag Coverage Δ
#all 87.02% <96.27%> (?)
#syntax 25.45% <3.12%> (?)

@stackenbotten
Copy link

There was an error when running test_check_style for commit c0098303723ef586fabcd9e45dedec10187ba337:

Error: Trailing whitespace found:
 libdevcore/picosha2.h:130: 
 libdevcore/picosha2.h:139: 
 libdevcore/picosha2.h:189: detail::hash256_block(h_, buffer_.begin()+i, buffer_.begin()+i+64); 

Please check that your changes are working as intended.

@stackenbotten
Copy link

There was an error when running test_check_style for commit bebee0c44bf61c26d32f4c816eb4abd924f2e216:

Coding style error:
 libdevcore/picosha2.h:201: if(remains > 55)
 libdevcore/picosha2.h:230: if(data_length_digits_[i] >= 65536u)
 libdevcore/picosha2.h:217: for (const uint32_t* iter = h_; iter != h_+8; ++iter)
 libdevcore/picosha2.h:51:static const uint32_t add_constant[64] = {
 libdevcore/picosha2.h:70:static const uint32_t initial_message_digest[8] = {
 libdevcore/picosha2.h:77: return (x&y)^((~x)&z);
 libdevcore/picosha2.h:82: return (x&y)^(x&z)^(y&z);
 libdevcore/picosha2.h:219: *(first++) = detail::mask_8bit(static_cast<uint8_t>((*iter >> (24-8*i))));

Please check that your changes are working as intended.

@stackenbotten
Copy link

There was an error when running test_check_style for commit c31e19ff62b18d7559db1ae5d1af5553fa0e6242:

Coding style error:
 libdevcore/picosha2.h:201: if(remains > 55)
 libdevcore/picosha2.h:230: if(data_length_digits_[i] >= 65536u)
 libdevcore/picosha2.h:217: for (const uint32_t* iter = h_; iter != h_+8; ++iter)
 libdevcore/picosha2.h:51:static const uint32_t add_constant[64] = {
 libdevcore/picosha2.h:70:static const uint32_t initial_message_digest[8] = {
 libdevcore/picosha2.h:77: return (x&y)^((~x)&z);
 libdevcore/picosha2.h:82: return (x&y)^(x&z)^(y&z);
 libdevcore/picosha2.h:219: *(first++) = detail::mask_8bit(static_cast<uint8_t>((*iter >> (24-8*i))));

Please check that your changes are working as intended.

@chriseth chriseth changed the title [WIP] Tools to compute UnixFS IPFS hash. Add IPFS hash of source files to metadata. May 6, 2019
@chriseth chriseth marked this pull request as ready for review May 6, 2019 12:50
@stackenbotten
Copy link

There was an error when running test_check_style for commit 75d52633e0467333c488aa5fefe882105064f74b:

Coding style error:
 libdevcore/picosha2.h:219: *(first++) = detail::mask_8bit(static_cast<uint8_t>((*iter >> (24-8*i))));

Please check that your changes are working as intended.

{
if (ipfsUrlCached.empty())
if (scanner->source().size() < 1025 * 256)
ipfsUrlCached = "ipfs://" + dev::ipfsHashBase58(scanner->source());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should decide which URL format to use. The IPFS project seems to prefer /ipfs/<hash>, but I don't think this is usable here because we just have a list of URLs instead of a key-value mapping. I have seen ipfs://ipfs/<hash>, but I'm not sure what the consensus is inside the ipfs project. @axic do you know more here?

Copy link
Member

@leonardoalt leonardoalt May 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ipfs/kubo#1678 (comment)

The canonical way seems to be /ipfs/hash/path, where compatibility versions exist, for example ipfs:/ipfs/hash/path

They say use this everywhere you can!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See below (there are 2 years between the two comments...)

{
if (ipfsUrlCached.empty())
if (scanner->source().size() < 1025 * 256)
ipfsUrlCached = "dweb:/ipfs/" + dev::ipfsHashBase58(scanner->source());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is the recommended way to denote IPFS URIs as per ipfs/specs#152 (comment)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It depends on which "upgrade stage" we want to be ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We cannot use /ipfs because we need a scheme, and I think we can afford not using ipfs:// because this is just a json artefact and not a website.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

string const& CompilerStack::Source::ipfsUrl() const
{
if (ipfsUrlCached.empty())
if (scanner->source().size() < 1025 * 256)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1025?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@leonardoalt leonardoalt deleted the ipfsHash branch August 9, 2019 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants