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

feat(example): deploy bytecode from scratch #1767

Merged
merged 4 commits into from
Sep 18, 2024
Merged

Conversation

clearloop
Copy link
Contributor

@clearloop clearloop commented Sep 13, 2024

Introduces an example about deploying raw bytecode with revm with storage operations as example, it includes:

  • set up a basic REVM from scratch
  • concat [init_code, runtime_bytecode, constructor_params ] as bytecode
  • deploy the bytecode with REVM
  • verify the storage operation from init_code in the deployed contract
  • passing params to constructor with codecopy

@clearloop clearloop changed the title feat(example): deploy bytecode from stratch feat(example): deploy bytecode from scratch Sep 13, 2024
@clearloop clearloop marked this pull request as ready for review September 13, 2024 17:50

/// [ PUSH1, 0x01, PUSH1, 0x17, PUSH1, 0x1f, CODECOPY, PUSH0, MLOAD, PUSH0, SSTORE ]
const INIT_CODE: &[u8] = &[
0x60, 0x01, 0x60, 0x17, 0x60, 0x1f, 0x39, 0x5f, 0x51, 0x5f, 0x55,
Copy link
Member

Choose a reason for hiding this comment

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

Nit, you could use exact notion from the comment if you include, revm::interpreter::opcode::*

Copy link
Member

@rakita rakita left a comment

Choose a reason for hiding this comment

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

Cool example, Left one nit but lgtm otherwise.

@rakita rakita merged commit 54d2415 into bluealloy:main Sep 18, 2024
27 checks passed
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.

2 participants