New answers tagged

1

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


1

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....


0

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[3] memory a = [1, 2, 3];, which makes memory[0x40: 0x60] = 0xe0) But ...


0

From the transaction trace it did a single externall call and reverted. "type": "CALL", "from": "0xa3bab7a95ed40c2a62c7a1ac4ef2043f8b7a1cb6", "to": "0x51bc0f8a859fc64c69df3e8802dd6ed2709904a7", "value": "0x0", "gas": "0x2d7478", "gasUsed":...


0

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); sb.append(arg2); sb.append(arg3); byte[] hash = Hash.sha3(Numeric.hexStringToByteArray(String.valueOf(sb)));


2

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 ...


2

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 ...


1

That would be the block gas limit. Any transaction that is more expensive than the block gas limit would automatically revert since you can't have a transaction spread across multiple blocks.


0

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 ...


0

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:


0

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: PUSH1 0 ...


2

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 ...


2

Yes, if objects is a variable at contract level then changes will be persisted between transactions.


0

function mintToken() private private means the function can only be called from within the contract itself, try to change it to public or external and it should work


Top 50 recent answers are included