Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Sign in
issue
issue
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 23
    • Issues 23
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar

新注册的用户请输入邮箱并保存,随后登录邮箱激活账号。后续可直接使用邮箱登录!

  • chainmaker
  • issueissue
  • Issues
  • #1140

Closed
Open
Opened Jul 29, 2024 by jie ma@alleysira2 of 2 tasks completed2/2 tasks

Excessive Gas Consumption Due to Index Out of Range Bug in chainmaker/vm-evm

【问题分类】

  • 智能合约相关
  • EVM

【问题描述】

When the deployed bytecode does not end with an opcode that is set finished: true (e.g., STOP, RETURN, REVERT, SELFDESTRUCT), the sealevm will charge all of the provided gas and raise an index out of range error.

As vm-evm is implemented based on SealEVM, the Index Out of Range Bug in SealEVM also affects the chainmaker vm-evm. Detailes can be found in SealEVM issue.

【相关日志文件】

I check the code in vm-evm at https://git.chainmaker.org.cn/chainmaker/vm-evm/-/blob/master/evm-go/instructions/instructions.go#L190. This line will also cause a index out of range panic.

image This the result from SealEVM.

image

Expected value from geth.

{"pc":0,"op":96,"gas":"0xffffff","gasCost":"0x3","memSize":0,"stack":[],"depth":1,"refund":0,"opName":"PUSH1"}
{"pc":2,"op":96,"gas":"0xfffffc","gasCost":"0x3","memSize":0,"stack":["0x0"],"depth":1,"refund":0,"opName":"PUSH1"}
{"pc":4,"op":1,"gas":"0xfffff9","gasCost":"0x3","memSize":0,"stack":["0x0","0x0"],"depth":1,"refund":0,"opName":"ADD"}
{"pc":5,"op":0,"gas":"0xfffff6","gasCost":"0x0","memSize":0,"stack":["0x0"],"depth":1,"refund":0,"opName":"STOP"}
{"output":"","gasUsed":"0x9"}

Result from SealEVM.

{"pc":0,"op":96,"gas":"0xfffffc","gasCost":"0x3","memory":"0x","stack":null,"opName":"PUSH1"}
{"pc":2,"op":96,"gas":"0xfffff9","gasCost":"0x3","memory":"0x","stack":["0x0"],"opName":"PUSH1"}
{"pc":4,"op":1,"gas":"0xfffff6","gasCost":"0x3","memory":"0x","stack":["0x0","0x0"],"opName":"ADD"}
{"output":"","gasUsed":"0xffffff","exitOpcode":"STOP","error":""}

【系统信息】

  • **chainmaker-go version * : All versions of vm-evm are affected.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: chainmaker/issue#1140

Copyright © 2021 ChainMaker Org. All Rights Reserved. 长安链 版权所有。