You can fork the mainnet using hardhat and then send transactions to this forks, this means that it will simulate having the same state as mainnet, but it will work as a local development network. You can start from hardhats documentation here
Yes, this can fail. This line of code will send ETH to msg.sender. Msg.sender could be anyone, including another smart contract. When a smart contract directly receives any amount of ETH, the "receive()" fallback function when gets called and its code, if any, would be executed. This fallback function may fail and cause entire transaction to revert....
I found from the yellow paper that CALLDATACOPY just copy 0 to memory if the memory index is greater than or equal to its second input value, which in this case, CALLDATASIZE.
So what this byte code is doing is to make memory[0xe0: 0xe0 + 0x60] = 0.(start from 0xe0 due to this code, uint8 memory a = [1, 2, 3];, which makes memory[0x40: 0x60] = 0xe0)
From the transaction trace it did a single externall call and reverted.
One simple way is to use StringBuilder to append the strings as arguments for kaccak256, then to use library web3j to use sha3 method.
StringBuilder sb = new StringBuilder(arg1);
byte hash = Hash.sha3(Numeric.hexStringToByteArray(String.valueOf(sb)));
The ability to use the PC opcode directly in Solidity was removed in Solidity 0.7. However, you may be able to use PC again in the future via the verbatim assembly builtin. Currently, you can only use verbatim in contracts written in yul. If the Solidity team decides to expose verbatim for normal Solidity contracts, it will allow you to inject arbitrary ...
The answer to this question is actually much more interesting than it seems :-).
If you're doing this call on-chain then you're limited by the block gas limit minus the amount of gas that you need to use to be able to trigger the call in the first place.
However... if you're doing this off-chain (e.g., a front-end is using the eth_call RPC method) then your ...
If you can get hold of the contract's source code, you could use Hardhat to get the Solidity stack traces. Hardhat Network is a debugging-first EVM implementation, built for low-level development of smart contracts.
Shameless plug: start from my Solidity template, which is using Hardhat: https://github.com/paulrberg/solidity-template:
Side note: see Nomic ...
No, that's just a linear counter that disregards the EVM rule that push instructions increase the program counter (PC) by at least 2 (as compared to all others opcodes, which increase the PC by 1).
The program counter is to be found on the column on the left-hand side, next to the opcodes:
The EVM increases the program counter (PC) by one for all opcodes except for PUSH and its derivatives. As per the docs on Source Mappings:
Each of these elements corresponds to an instruction, i.e. you cannot use the byte offset but have to use the instruction offset (push instructions are longer than a single byte).
Thus when the EVM sees this:
This is a wonderful question! The problem you're running into is that in Ethereum the code that you provide to CREATE is executed. We call this code "init code" and it's expected to return the resulting "deployed code". So what you really need is some piece of code that when executed will use the RETURN opcode to return the _bytecode that ...