New answers tagged

1

Keep in mind uint previousBalances = balanceOf[_from] + balanceOf[_to]; could already have been overflowed when checking the assertion later. So the transfer will fail even if its correct. But thats unlikely bcs it requires that both sender and recepient have more than uint256 tokens/eth together. Only then it fails.


0

I'm working on this as well. There is an opcode called extcodehash. It says The EXTCODEHASH of the account without code is c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 what is the keccack256 hash of empty data So I think there is a possibility to check isContract by using this extcodehash combined with the c5d2460186f72... function ...


1

Indeed it does run it. First point, though, is that this is a property of the Solidity compiler, not the EVM itself - it could, if it thought it was correct, just not generate the EVM bytecode, so it wouldn't be run. However, there is an issue of side-effects. The result of computationallyHeavyFunction() might not matter, but the function could modify ...


1

It runs it. The first line casts f as uint. =0 is pointess because it defaults to 0. The second line invokes a function and assigns the response to f. It would also be okay to: uint f = 0 * computationallyHeavyFunction(); Of course, f is 0 in any case. Hope it helps.


0

The CALL opcode is the one to use for sending funds. Yes, it is unusual that there is no opcode for just sending funds: How does a Solidity fallback function work with the raw CALL opcode of the EVM? Why does an empty message still invoke the code of the contract?


0

I'm no EVM assembly wizard, nor do I have the environment set up to test this and debug it for you -- but I'll try to give some advice / ideas for how I would go about doing this. The comments in the Assembly are great at walking us through what is going on, so let's walk through them.. The steps I see in the comments: Build the Child runtime asm Turn ...


0

As long as no vote was cast by the majority to change the OPCODE prices, every client will have the same prices, otherwise they will fork and create an isolated network. If the majority casts a vote for changing the prices, you will recognize this by Ethereum being hardforked into 2 different Ethereum Blockchains (like ETH and ETC).


0

If you are on a testing blockchain you can just delete the cache and chains folder. Editing the file user_defaults to read "tracing":true did not solve the issue for me.


2

Ethereum Classic is still on the Byzantium EVM, when I compiled it as Byzantium instead of Constantinople it worked fine. ETC should be on Constantinople in January.


0

So I am betting on the fact that at least one of these 2 lines will revert The only line in your code which may revert is msg.sender.transfer(_available). This line will revert if address(this).balance < _available. If msg.sender is a contract, then it may revert also when address(this).balance >= _available. Other than that, the line balances[msg....


0

Your code looks fine to me. If you take a look at the SafeMath library's subtraction function, you can see that it works in a similar manner: function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } What you're doing ...


0

Some tokens use a special value in allowance to minimize gas fees when used in combination with approve/transferFrom. If allowance is that special value it will skip updating it, saving one storage modification. If you perform multiple transactions for example in decentralized exchanges you will have important savings over time. It is a "hackish" way to ...


1

If exponent is integer (I assume exponent is time in seconds, right?), then I would recommend you to use this function from ABDK Math 64.64: https://github.com/abdk-consulting/abdk-libraries-solidity/blob/master/ABDKMath64x64.sol#L327


1

I don't quite agree with the comment either. EVM is a vital part of Ethereum blockchain and it's not isolated in any sense. It's a virtual machine, so it's a rather abstract construct which doesn't exist in any physical place but is distributed among all nodes. EVM refers to the execution environment and it's run on top of blockchain. I guess in theory you ...


1

You have to pay some gas for every byte in data field of a transaction. After Istanbul fork new cost are given in EIP 2028 16 gas a non-zero byte (it was 68 gas) 4 gas a zero byte (it didn't change) So if your addresses have a zero byte the transaction will be 12 gas cheaper.


2

This question is a continuation from: How to setup ethereum to work on gpus for complex smart contract execution? As I tried clarifying already in the linked question but let me try to explain a bit differently: 1) The clients (Geth, Parity) are not running inside the blockchain. They only implement the blockchain functionality and provide access to the ...


1

Let's clarify some concepts first. 1) Ethereum is not a powerful execution environment. In fact it's a very inefficient one and it's not meant for any real computations. This applies directly to also smart contracts. 2) Ethereum is not meant for any sort of mass computing, be it however trivial. Computations are expensive (gas costs). Ethereum is much ...


1

Using remix.ethereum.org, here is an example that can help. The input, which is the same as calldata, is 0x29ae811475944220b52381f169021a7c3f2947dfd0d2b1fb95e6cd92358e0a7997c8a9a1000000000000000000000000000000000000000000000000000000000000000f. (This is calling file( 0x75944220b52381f169021a7c3f2947dfd0d2b1fb95e6cd92358e0a7997c8a9a1, 15)) calldataload is ...


Top 50 recent answers are included