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 opcode info in compiling-smart-contracts #12217

Merged
merged 2 commits into from
Mar 19, 2024
Merged

Conversation

allwin199
Copy link
Contributor

@allwin199 allwin199 commented Feb 17, 2024

Compiling smart contract page doesn't have info about opcodes.

Description

In compiling smart contracts page an example of how smart contract is converted to opcodes is provided. But there is missing info about opcodes. This PR adds info about what are opcodes and what is the relation between opcodes and EVM.

Related Issue

Summary by CodeRabbit

  • Documentation
    • Added a section on EVM opcodes in the smart contracts compiling documentation, explaining their significance and providing additional resources for further information.

@github-actions github-actions bot added the content 🖋️ This involves copy additions or edits label Feb 17, 2024
Copy link

netlify bot commented Feb 17, 2024

Deploy Preview for ethereumorg ready!

Name Link
🔨 Latest commit a0e2017
🔍 Latest deploy log https://app.netlify.com/sites/ethereumorg/deploys/65f9eeefbbbdfd0008673a6d
😎 Deploy Preview https://deploy-preview-12217--ethereumorg.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Member

@wackerow wackerow left a comment

Choose a reason for hiding this comment

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

Thanks @allwin199! Left a suggestion... if that looks good, just drop a comment, or go ahead and commit this suggestion and we'll get it in

Copy link
Contributor

coderabbitai bot commented Mar 19, 2024

Walkthrough

This update introduces a new section on Ethereum Virtual Machine (EVM) opcodes in the documentation for compiling smart contracts. It aims to enhance understanding by explaining the role of opcodes as the low-level instructions that drive the execution of smart contracts on the Ethereum blockchain. A link for further information is also provided, enriching the content with valuable resources for deeper exploration.

Changes

File(s) Change Summary
public/content/developers/docs/smart-contracts/compiling/index.md Added a section on EVM opcodes, explaining their significance and role in contract execution, along with an external link for more detailed information.

Assessment against linked issues

Objective Addressed Explanation
Add info about Opcodes in compiling smart contracts. (#12216)
Explain the role of opcodes related to EVM and its relevance to smart contract compilation. (#12216)

The code changes effectively address the primary objectives outlined in the linked issue by adding detailed information about EVM opcodes and their importance in the context of compiling smart contracts. The inclusion of an external link for further reading also aligns with the goal of providing comprehensive information on the subject.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 2

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between c881349 and a0e2017.
Files selected for processing (1)
  • public/content/developers/docs/smart-contracts/compiling/index.md (1 hunks)
Additional comments: 2
public/content/developers/docs/smart-contracts/compiling/index.md (2)
  • 36-39: The addition of the section on EVM opcodes is well-integrated and provides valuable information to the reader. It's concise and directly addresses the knowledge gap identified in the PR objectives. However, consider adding a few examples of common opcodes and their use cases to further enrich this section.
  • 33-42: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [12-12]

Consider revising "smart contracts" and "Ethereum virtual machine" to ensure consistency in capitalization throughout the document. Typically, "Ethereum Virtual Machine" is capitalized as it's a proper noun.

Comment on lines 33 to 42
PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x41 JUMPI PUSH1 0x0 CALLDATALOAD PUSH29 0x100000000000000000000000000000000000000000000000000000000 SWAP1 DIV PUSH4 0xFFFFFFFF AND DUP1 PUSH4 0xCFAE3217 EQ PUSH2 0x46 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x52 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x5B PUSH2 0xD6 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 DUP1 PUSH1 0x20 ADD DUP3 DUP2 SUB DUP3 MSTORE DUP4 DUP2 DUP2 MLOAD DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP DUP1 MLOAD SWAP1 PUSH1 0x20 ADD SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x9B JUMPI DUP1 DUP3 ADD MLOAD DUP2 DUP5 ADD MSTORE PUSH1 0x20 DUP2 ADD SWAP1 POP PUSH2 0x80 JUMP JUMPDEST POP POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0xC8 JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH1 0x60 PUSH1 0x40 DUP1 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0x5 DUP2 MSTORE PUSH1 0x20 ADD PUSH32 0x48656C6C6F000000000000000000000000000000000000000000000000000000 DUP2 MSTORE POP SWAP1 POP SWAP1 JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 SLT 0xec 0xe 0xf5 0xf8 SLT 0xc7 0x2d STATICCALL ADDRESS SHR 0xdb COINBASE 0xb1 BALANCE 0xe8 0xf8 DUP14 0xda 0xad DUP13 LOG1 0x4c 0xb4 0x26 0xc2 DELEGATECALL PUSH7 0x8994D3E002900
```

These are called **opcodes**. EVM opcodes are the low-level instructions that the Ethereum Virtual Machine (EVM) can execute. Each opcode represents a specific operation, such as arithmetic operations, logical operations, data manipulation, control flow, etc.

[More on opcodes](/developers/docs/evm/opcodes/)

## Web applications {#web-applications}

The compiler will also produce the **Application Binary Interface (ABI)** which you need in order for your application to understand the contract and call the contract's functions.
Copy link
Contributor

Choose a reason for hiding this comment

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

📝 NOTE
This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [16-16]

To improve readability, consider adding a comma after "contract" in the phrase "to be able to run your contract it needs to be in bytecode."

- to be able to run your contract it needs to be in **bytecode**.
+ to be able to run your contract, it needs to be in **bytecode**.

📝 NOTE
This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [46-46]

The phrase "in order for you to" can be simplified to "for you to" for conciseness without losing meaning.

- in order for you to call on your smart contract in your web app's interface.
+ for you to call on your smart contract in your web app's interface.

Copy link
Member

@wackerow wackerow 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! Thanks @allwin199!

@wackerow wackerow merged commit 23d44c3 into ethereum:dev Mar 19, 2024
6 checks passed
Copy link

gitpoap-bot bot commented Mar 19, 2024

Congrats, your important contribution to this open-source project has earned you a GitPOAP!

Be sure to join the Ethereum.org discord if you are interested in contributing further to the project or have any questions for the team.

GitPOAP: 2024 Ethereum.org Contributor:

GitPOAP: 2024 Ethereum.org Contributor GitPOAP Badge

Head to gitpoap.io & connect your GitHub account to mint!

Learn more about GitPOAPs here.

@wackerow
Copy link
Member

@all-contributors please add @allwin199 for content

Copy link
Contributor

@wackerow

I've put up a pull request to add @allwin199! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content 🖋️ This involves copy additions or edits
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add info about Opcodes in compiling smart contracts.
2 participants