gno icon indicating copy to clipboard operation
gno copied to clipboard

feat: add p/demo/evm (ethereum vm)

Open Tchips46 opened this issue 8 months ago • 3 comments

Description

A pure package capable of interpreting and executing EVM byte codes, it follows the @moul idea in https://github.com/gnolang/hackerspace/issues/12 :

Introducing a Gno-based EVM (Ethereum Virtual Machine) that serves as an intriguing proof of concept rather than a production-ready solution. It initially focuses on providing comprehensive logic support while future enhancements aim to bridge "syscalls." This capability allows for writing Solidity contracts that can be interpreted by Gno, unlocking new possibilities for bytecode execution. It's worth mentioning that this project holds the potential to offer a novel approach for verifying successful contract porting and exploring other potential use cases.

This implementation aims to follow the EVM spec closely, enabling accurate interpretation of smart contract bytecode in a Gno-native environment. It opens the door to cross-chain compatibility experiments.

See also: gnolang/gno#885 (p/demo/bf).

References

https://ethervm.io/ – Opcode explorer and visualizer

https://www.evm.codes/ – Detailed reference for EVM opcodes

Tchips46 avatar Apr 18 '25 15:04 Tchips46

🛠 PR Checks Summary

All Automated Checks passed. ✅

Manual Checks (for Reviewers):
  • [ ] IGNORE the bot requirements for this PR (force green CI check)
  • [ ] The pull request description provides enough details
Read More

🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers.

✅ Automated Checks (for Contributors):

🟢 Maintainers must be able to edit this pull request (more info) 🟢 Pending initial approval by a review team member, or review from tech-staff

☑️ Contributor Actions:
  1. Fix any issues flagged by automated checks.
  2. Follow the Contributor Checklist to ensure your PR is ready for review.
    • Add new tests, or document why they are unnecessary.
    • Provide clear examples/screenshots, if necessary.
    • Update documentation, if required.
    • Ensure no breaking changes, or include BREAKING CHANGE notes.
    • Link related issues/PRs, where applicable.
☑️ Reviewer Actions:
  1. Complete manual checks for the PR, including the guidelines and additional checks if applicable.
📚 Resources:
Debug
Automated Checks
Maintainers must be able to edit this pull request (more info)

If

🟢 Condition met
└── 🟢 And
    ├── 🟢 The base branch matches this pattern: ^master$
    └── 🟢 The pull request was created from a fork (head branch repo: Tchips46/gno)

Then

🟢 Requirement satisfied
└── 🟢 Maintainer can modify this pull request

Pending initial approval by a review team member, or review from tech-staff

If

🟢 Condition met
└── 🟢 And
    ├── 🟢 The base branch matches this pattern: ^master$
    └── 🟢 Not (🔴 Pull request author is a member of the team: tech-staff)

Then

🟢 Requirement satisfied
└── 🟢 If
    ├── 🟢 Condition
    │   └── 🟢 Or
    │       ├── 🔴 At least one of these user(s) reviewed the pull request: [jefft0 leohhhn n0izn0iz notJoon omarsy x1unix] (with state "APPROVED")
    │       ├── 🟢 At least 1 user(s) of the team tech-staff reviewed pull request
    │       └── 🟢 This pull request is a draft
    └── 🟢 Then
        └── 🟢 Not (🔴 This label is applied to pull request: review/triage-pending)

Manual Checks
**IGNORE** the bot requirements for this PR (force green CI check)

If

🟢 Condition met
└── 🟢 On every pull request

Can be checked by

  • Any user with comment edit permission
The pull request description provides enough details

If

🟢 Condition met
└── 🟢 And
    ├── 🟢 Not (🔴 Pull request author is a member of the team: core-contributors)
    └── 🟢 Not (🔴 Pull request author is user: dependabot[bot])

Can be checked by

  • team core-contributors

Gno2D2 avatar Apr 18 '25 15:04 Gno2D2

Codecov Report

:x: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
tm2/pkg/bft/node/node.go 0.00% 1 Missing :warning:

:loudspeaker: Thoughts on this report? Let us know!

codecov[bot] avatar May 23 '25 07:05 codecov[bot]

@mvertes about the disassembler: do you want to see byte disassemble into EVM instructions (such as PUSH1, JUMPDEST, MLOAD...) or a disassebler in pseudo-gno ?

paulogarithm avatar Jun 10 '25 13:06 paulogarithm

feedback:

  • don't "spend gas", but count it (starts from 0, and is increased at usage)
  • allow specifying an execution limit eventually, if 0, no limit, else, act like the normal "gas"
  • allow execution without a tx (query)
  • add txlink to help generating a call directly in the contracts
  • would be nice to "list" all the existing api calls available foo(uint256, uint256), maybe not possible with just the bytecode?

moul avatar Jun 26 '25 09:06 moul

Hey @Tchips46,

I'll take a look at this, but it's gonna take me a minute to go over the changes 🙏 Is there anything I should know about before diving in (assumptions you guys went with)?

zivkovicmilos avatar Jul 15 '25 09:07 zivkovicmilos

Hey @zivkovicmilos,

We didn't implemented the pre-compiled contracts involving complex algorithms that are used only by very few persons because of the time. Don't hesitate if you a have any questions and good luck !

Tchips46 avatar Jul 15 '25 11:07 Tchips46

The CI is failing currently, and I'm not sure we'll be able to get reviews from @mvertes or @zivkovicmilos currently as they're busy with launch. I'll move this to draft and you can feel free to continue working on this PR and make it review-ready.

leohhhn avatar Aug 26 '25 14:08 leohhhn