Skip to content

Instantly share code, notes, and snippets.

@trung
Last active March 12, 2019 21:06
Show Gist options
  • Save trung/dbbb8c90d397e2d439378cbfe4411149 to your computer and use it in GitHub Desktop.
Save trung/dbbb8c90d397e2d439378cbfe4411149 to your computer and use it in GitHub Desktop.
CodeCopy
func opCodeCopy(pc *uint64, evm *EVM, contract *Contract, memory *Memory, stack *Stack) ([]byte, error) {
var (
memOffset = stack.pop()
codeOffset = stack.pop()
length = stack.pop()
)
codeCopy := getDataBig(contract.Code, codeOffset, length)
memory.Set(memOffset.Uint64(), length.Uint64(), codeCopy)
+ if length.Cmp(big.NewInt(32)) == 0 {
+ address := common.BytesToAddress(codeCopy)
+ if evm.StateDB.Exist(address) {
+ log.Info("Found affected contract", "address", address.Hex())
+ }
+ }
evm.interpreter.intPool.put(memOffset, codeOffset, length)
return nil, nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment