This is a mocked version and doesn't behave exactly as it would in a real EVM. extcodecopy copies a zero-length mocked byte slice to memory.
(evm *EVM)
| 395 | // |
| 396 | // extcodecopy copies a zero-length mocked byte slice to memory. |
| 397 | func extcodecopy(evm *EVM) { |
| 398 | _ = evm.Stack.Pop() // Pop external address off the stack |
| 399 | destMemOffsetU256 := evm.Stack.Pop() |
| 400 | _ = evm.Stack.Pop() // Pop offset of the external code to copy. This isn't used. |
| 401 | sizeU256 := evm.Stack.Pop() |
| 402 | |
| 403 | destMemOffset, size := destMemOffsetU256.Uint64(), sizeU256.Uint64() |
| 404 | |
| 405 | extCodeCopy := []byte{} // mocked (no external code) |
| 406 | memExpansionCost := evm.Memory.Store(destMemOffset, extCodeCopy) // extCode has zero length |
| 407 | |
| 408 | wordSize := toWordSize(size) |
| 409 | dynamicGas := 3*wordSize + memExpansionCost + 2600 // '2600' here represents "address access cost" and can be 100 for warm access, but we are assuming cold access since this is a mocked version. |
| 410 | |
| 411 | evm.PC++ |
| 412 | evm.deductGas(dynamicGas) |
| 413 | dgMap[EXTCODECOPY] = dynamicGas |
| 414 | } |
| 415 | |
| 416 | // returndatasize pushes a mocked (zero-value) length of the return data onto the stack. |
| 417 | func returndatasize(evm *EVM) { |
nothing calls this directly
no test coverage detected