github.com/ethereum/go-ethereum@v1.16.1/core/vm/program/readme.md (about) 1 ### What is this 2 3 In many cases, we have a need to create somewhat nontrivial bytecode, for testing various 4 quirks related to state transition or evm execution. 5 6 For example, we want to have a `CREATE2`- op create a contract, which is then invoked, and when invoked does a selfdestruct-to-self. 7 8 It is overkill to go full solidity, but it is also a bit tricky do assemble this by concatenating bytes. 9 10 This utility takes an approach from [goevmlab](https://github.com/holiman/goevmlab/) where it has been used for several years, 11 a go-lang utility to assemble evm bytecode. 12 13 Using this utility, the case above can be expressed as: 14 ```golang 15 // Some runtime code 16 runtime := program.New().Ops(vm.ADDRESS, vm.SELFDESTRUCT).Bytecode() 17 // A constructor returning the runtime code 18 initcode := program.New().ReturnData(runtime).Bytecode() 19 // A factory invoking the constructor 20 outer := program.New().Create2AndCall(initcode, nil).Bytecode() 21 ``` 22 23 ### Warning 24 25 This package is a utility for testing, _not_ for production. As such: 26 27 - There are not package guarantees. We might iterate heavily on this package, and do backwards-incompatible changes without warning 28 - There are no quality-guarantees. These utilities may produce evm-code that is non-functional. YMMV. 29 - There are no stability-guarantees. The utility will `panic` if the inputs do not align / make sense. 30