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

Update Metadata Documentation #14052

Merged
merged 1 commit into from Mar 31, 2023
Merged

Conversation

kuzdogan
Copy link
Member

  • Update the example metadata JSON to follow the alphabetically ordered canonical format. Also add the "errors" field in devdoc and userdoc.

  • Shorten the CBOR encoding part and add a link to https://playground.sourcify.dev

    • I think this is demonstrated better in action.
    • Also the previous docs were both giving the example of 0xa264 as well as mentioning multiple times not to use this pattern. It's better to not mention this pattern at all and to explain the correct way to decode.
  • Update the explanation for the Source Code Verification section

@github-actions
Copy link

Thank you for your contribution to the Solidity compiler! A team member will follow up shortly.

If you haven't read our contributing guidelines and our review checklist before, please do it now, this makes the reviewing process and accepting your contribution smoother.

If you have any questions or need our help, feel free to post them in the PR or talk to us directly on the #solidity-dev channel on Matrix.

Comment on lines 134 to 135
// Required for Solidity.
"evmVersion": "london"
Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure if this is Required but I believe so. Where can I find the schema of the metadata or a validation for that?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I have no idea, but the best I can do is the parser/validator used in our tests, which would lead me to believe that evmVersion is in fact a mandatory field.

docs/metadata.rst Outdated Show resolved Hide resolved
docs/metadata.rst Outdated Show resolved Hide resolved
docs/metadata.rst Outdated Show resolved Hide resolved
docs/metadata.rst Outdated Show resolved Hide resolved
Copy link
Collaborator

@nikola-matic nikola-matic left a comment

Choose a reason for hiding this comment

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

The JSON is malformed due to missing commas (,) in certain places - I think I caught all of them, but I'd still suggest running the entire object through something like jq just to make sure.
Otherwise, looks good. Fix and squash, and it should be good to merge.

docs/metadata.rst Outdated Show resolved Hide resolved
docs/metadata.rst Outdated Show resolved Hide resolved
docs/metadata.rst Outdated Show resolved Hide resolved
docs/metadata.rst Outdated Show resolved Hide resolved
docs/metadata.rst Outdated Show resolved Hide resolved
docs/metadata.rst Outdated Show resolved Hide resolved
nikola-matic
nikola-matic previously approved these changes Mar 23, 2023
Copy link
Collaborator

@nikola-matic nikola-matic left a comment

Choose a reason for hiding this comment

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

Looks good. Please squash the commits before merging.

@kuzdogan
Copy link
Member Author

kuzdogan commented Mar 31, 2023

Added "appends to runtime bytecode" explicitly as it is not necessarily found at the end of the creation bytecode.

I find it useful to break down the contents of the metadata when explaining into two:

  • How to interact with the contract: ABI, and NatSpec documentation.
  • How to reproduce the compilation and verify a deployed contract:
    compiler version, compiler settings, and source files used.

Changed the first paragraph to this to quickly give an overview of the purpose of the file as well as its contents

nikola-matic
nikola-matic previously approved these changes Mar 31, 2023
Copy link
Collaborator

@nikola-matic nikola-matic left a comment

Choose a reason for hiding this comment

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

Squash the commits please.

@kuzdogan
Copy link
Member Author

Squash the commits please.

Sorry I thought this was meant for the person merging to click "Squash and merge" in the PR. Do I need to squash, i.e. rebase and force-push everything into one commit?

@nikola-matic
Copy link
Collaborator

Squash the commits please.

Sorry I thought this was meant for the person merging to click "Squash and merge" in the PR. Do I need to squash, i.e. rebase and force-push everything into one commit?

Yes, but now that you mention it, let me check how the Squash and merge feature works here before you do anything. :D

@nikola-matic
Copy link
Collaborator

@kuzdogan yeah, it seems like it's a configurable feature, and I have no idea how we have it configured, so please rebase, squash into one commit, and force push, and I'll merge it.

Squashed into single commit

Squashed commits:
Sort metadata JSON, add errors to devdoc & userdoc

Sorts the example metadata in the alphabetical order,
as this is the way output by the compiler.

Add playground.sourcify.dev link

Update metadata documentation content

Fix trailing whitespaces

Add new line after code-block

Fix unexpected indentation

Fix unexpected unindent

Fix unexpected unindent - 2

Suggestions from code review: wording, punctuation

Co-authored-by: Nikola Matić <nikola.matic@ethereum.org>
Fix missing trailing commas

Co-authored-by: Nikola Matić <nikola.matic@ethereum.org>
Order yul settings, fix trailing commas

Explicitly state appended to the runtime bytecode

Break down metadata content into two points

Remove trailing whitespace
@nikola-matic nikola-matic merged commit f2dc3d3 into ethereum:develop Mar 31, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants