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 metadata and fit new spec #134

Merged
merged 15 commits into from
Oct 14, 2024
Merged

Add metadata and fit new spec #134

merged 15 commits into from
Oct 14, 2024

Conversation

Ben-Rey
Copy link
Collaborator

@Ben-Rey Ben-Rey commented Oct 3, 2024

No description provided.

@thomas-senechal thomas-senechal linked an issue Oct 4, 2024 that may be closed by this pull request
11 tasks
This was referenced Oct 8, 2024
Copy link
Member

@damip damip left a comment

Choose a reason for hiding this comment

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

Very good SC overall. A few questions and comments:

  • coin management: so we go for spending the coins of the SC if it has any instead outside of deweb stuff instead of checking that enough coins were passed during the call to cover for storage expenses ? if so, let's make sure we document it clearly
  • why did you make Location something that is not just another metadata ?
  • let's make sure the client does not call any SC functions for reading purposes but only looks into the datastore directly. That way we can implement https://forum.massa.community/t/immutability-and-upgradability-dilemma-in-deweb/110/2 in the future

@Ben-Rey Ben-Rey requested a review from damip October 9, 2024 20:21
}
assert(_getTotalChunk(files[i].hashLocation) > 0, 'File does not exist');

_deleteFile(files[i].hashLocation);
Copy link
Member

@damip damip Oct 10, 2024

Choose a reason for hiding this comment

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

we should discuss metadata support for files contained inside subdirectories within ZIP files. Currently, the SC assumes that only files with available chunks can have metadata. Would be nice to be able to set metadata and location - but not chunks (eg. chunk_count entry absent) - for some files that would be "virtual" files.

See spec https://forum.massa.community/t/community-feedback-proposal-for-improving-website-storage-on-deweb/82/15#p-319-smart-contract-code-2

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

As it's not a requirement for the v1 use case, can it be discussed for a v2 ?

Copy link
Member

Choose a reason for hiding this comment

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

okay, maybe let's open an issue to not forget :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure

*/
export function constructor(_: StaticArray<u8>): void {
if (!Context.isDeployingContract()) return;

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

@damip damip Oct 10, 2024

Choose a reason for hiding this comment

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

to remove any ambiguity with other products, the tag should contain the explicit string "deweb". That way we can unambuously auto-detect that an address is hosting a website and under which version of the format to know how to decode it depending on the version

Copy link
Member

Choose a reason for hiding this comment

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

for example it could be [VERSION_TAG][string: "massa_website"] -> "1"

@Ben-Rey Ben-Rey requested a review from peterjah October 14, 2024 08:03
hashLocation: StaticArray<u8>,
totalChunk: u32,
): void {
Storage.set(fileChunkCountKey(hashLocation), u32ToBytes(totalChunk));
Copy link
Contributor

@peterjah peterjah Oct 14, 2024

Choose a reason for hiding this comment

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

it seems this is never deleted,it should be done when deleting a file ok i get it!

@Ben-Rey Ben-Rey force-pushed the add-metadata-and-fit-new-spec branch from 866c753 to 53d9241 Compare October 14, 2024 15:24
@Ben-Rey Ben-Rey merged commit fb14f21 into main Oct 14, 2024
11 checks passed
@thomas-senechal thomas-senechal deleted the add-metadata-and-fit-new-spec branch October 25, 2024 10:31
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.

Remake WebsiteStorer SC
3 participants