我只是在从事geth开发,并试图对evm操作代码实现(如opAdd)进行一些修改以进行调试。
编译完成后,我发现有一个命令“evm”允许我运行字节码,而无需将它部署到私有链中。
然而,帮助消息是令人困惑的,关于此命令的指南是有限的。是否有任何指南或示例来帮助学习有关此命令使用的更多信息?还是我应该继续用'geth‘而不是'evm'?
谢谢!
发布于 2022-04-29 17:32:06
这个答案来得太迟了,但可能会对后来者有所帮助。首先,与geth一起提供的旧evm工具已经四年没有维护了。因此,在问题发布之前,它就已经被否决了。但是,命令make编译的带有自述的新的那个仍然是活动的,并添加了许多有用的函数。
其次,如果您仍然需要这个工具,请执行evm阅读它的帮助信息。对不起,有些汉字,但您不会遇到问题,协助翻译,并容易理解它的确切含义。此外,百苏和过时的提供了一些示例。我主要使用它作为堆栈跟踪日志与evm --codefile FILE_PATH --debug --statdump run。
最后,EVM追踪和调试JSON-RPC可能是现在的好选择。
evm [global options] command [command options] [arguments...]
VERSION:
1.10.17-stable-25c9b49f
COMMANDS:
compile compiles easm source to evm binary //evm 抽象语法树,已经废弃
disasm disassembles evm binary //字节码生成操作码
run run arbitrary evm binary //运行字节码,预期的下一个参数是一串16进制字节码,而不是文件
statetest executes the given state tests //不清楚它检查状态输入是什么
transition executes a full state transition //不清楚状态转移的工具是什么
transaction performs transaction validation
block-builder builds a block
help Shows a list of commands or help for one command
GLOBAL OPTIONS:
--bench benchmark the execution //基准测试
--create indicates the action should be create rather than call
--debug output full trace logs //跟踪执行堆栈、存储
--verbosity value sets the verbosity level (default: 0)
--code value EVM code //直接在命令行中以字节码为参数
--codefile value File containing EVM code. If '-' is specified, code is read from stdin //从文件在寻找输入
--gas value gas limit for the evm (default: 10000000000)
--price value price set for the evm (default: 0)
--value value value set for the evm (default: 0)
--dump dumps the state after the run
--input value input for the EVM //部署时的构造函数参数
--inputfile value file containing input for the EVM //从文件中读取构造函数参数
--memprofile value creates a memory profile at the given path
--cpuprofile value creates a CPU profile at the given path
--statdump displays stack and heap memory information
--prestate value JSON file with prestate (genesis) config
--json output trace logs in machine readable format (json)
--sender value The transaction origin
--receiver value The transaction receiver (execution context)
--nomemory disable memory output
--nostack disable stack output
--nostorage disable storage output
--noreturndata enable return data output
--help, -h show help
--version, -v print the versionhttps://ethereum.stackexchange.com/questions/68650
复制相似问题