Questions tagged [evm]

EVM is the Ethereum Virtual Machine, the protected, distributed "sandbox area" (virtual machine) where contract execution occurs, replicated on every node in the network. EVM is also the name of the bytecode that runs on the virtual machine -- what Solidity, Serpent and LL get compiled down to before deployment.

Filter by
Sorted by
Tagged with
2
votes
1answer
10 views

How to perform delegate call inside of view call (staticall)?

Inside view method it's not possible to do delegatecall due to compilation errors. Is there any way to delegate view calls?
1
vote
0answers
21 views

How can EVM tracer REVERT at depth == 1, then continue successfully?

I'm observing fault() (and step() with log.op.toString() == 'REVERT') with log.getDepth() == 1 in a tracer, followed by another step() instruction. (getTransactipnReceipt() shows status: 0x1, and ...
2
votes
1answer
55 views

Why is there a SHA256 pre-compiled contract when SHA256 is also an opcode?

The question is in the title :). Trying to understand why there is both an opcode and pre-compiled contract for SHA256. To execute the computation, would people canonically "CALL" into the pre-...
0
votes
1answer
21 views

Gnosis multisig wallet, Error in call method

This is an external function which will be called when a transaction have enough number of confirmations. function external_call(address destination, uint value, uint dataLength, bytes data) ...
3
votes
0answers
21 views

What is the purpose of DUP1 at the beginning of contact creation bytecode?

I am trying to analyse the bytecode of creating a contract and I can't figure out why there is a need for the 006 DUP1 opcode in the snippet below. 000 PUSH1 80 002 PUSH1 40 004 MSTORE 005 CALLVALUE ...
1
vote
0answers
33 views

Gas cost for ether transfer < 9000

According to the Yellow Paper, creating a transaction costs 21000 gas (regardless if it contains value) and creating a message call with non-zero call value costs at at least 9000 gas. Yet when I call ...
4
votes
2answers
69 views

Function to execute raw bytecode in EVM

Suppose, I have the following bytecode (0x610101610102016000526001601ff3) that pushes two numbers to the stack, adds them and returns the value. Now I want to write a function in Solidity that will ...
0
votes
0answers
45 views

get event logs and debug trace from eth_call

I am looking for a way to execute a transaction locally (using local geth/parity node) for simulation only, before actually submitting it to blockchain. I know that I can use 'eth_call' RPC call and ...
1
vote
1answer
28 views

Validating equality between two address variables

I'm testing the challengeOpponent function in my Connect4 contract in remix. The function creates a new Escrow contract instance so that each player in the game has a place to hold their funds until ...
1
vote
1answer
24 views

Using assembly to create a fallback function with a return value?

Is it possible to use Solidity assembly to create a fallback function that makes a DELEGATECALL to another contract, and then uses assembly to correctly store the return value of the DELEGATECALL in ...
0
votes
2answers
26 views

Costs of storing an empty dynamic array of length 2**256-1 vs length 4

If the array is completely empty, is it more expensive to store uint[] of length 2**256-1 vs of length 4?
0
votes
0answers
19 views

Where's a contract storage stored exactly and how does it interact with the blockchain? [duplicate]

From what I've understood a contract is a special account that gets initialized with a 256 bit array and this array is stored as the root hash of a merkle tree, is that correct? But where is this ...
1
vote
1answer
28 views

does EVM support pop() that returns the last element?

pop() that returns the last element is a method I have found would be good to have in smart contract development. Since v0.5.0 released a year ago, Solidity supports pop() for removing the last ...
1
vote
1answer
63 views

Why does not Ethereum allow removing all entries from a mapping, like clear() in Python

Is it common that dictionaries like mapping(uint => uint) foo; cannot be cleared with something like clear()? What is the reason deleting mappings aren't allowed in Ethereum?
0
votes
2answers
41 views

Use uint[] to map uint(address) to uint

Is there any reason not to use uint[2**160-1] addressIndex; instead of mapping(address => uint) addressIndex; ?
0
votes
1answer
18 views

ERC20 decimals and gas costs

This question is twofold: The standard number of decimals for an ERC20 token is 18. If we lower this number, can we expect decreased gas costs when creating/transferring the token, since this should ...
0
votes
1answer
38 views

How to distinguish uint and int types during evm execution (via opcode)

I am searching for a long time on net. But no use. Please help or try to give some ideas how to achieve this Orz. I'm doing some security-related attempts on Ethereum EVM (very immature, just an ...
3
votes
1answer
26 views

Solidity assembly: why is the length of _bytes added to _bytes before mload()?

For example in BytesLib: https://github.com/GNSPS/solidity-bytes-utils/blob/master/contracts/BytesLib.sol#L348 (Edit: Note that the same pattern is used for lengths: 1, 2, 4, 8, 16, and 32) ...
0
votes
1answer
44 views

gasCost of opcode “STATICCALL” in Geth VM Trace

{ "pc": 4765, "op": "STATICCALL", "gas": 222711, "gasCost": 219243, "depth": 1, ... } As above, Geth VM Trace (https://etherscan.io/vmtrace?txhash=...
1
vote
1answer
24 views

Is it considered secure at all to use passwords and private keys in the code of smart contract?

Basically something like: function transfer(address to, string privkey) { if(privkey == "cd33434343...") { msg.sender.transfer(this.balance); } } The above is obviously flawed since the privkey is ...
2
votes
1answer
45 views

Map Bytecode of Function to Function Within Entire Bytecode

Is it possible to distinguish a functions bytecode out of an entire contracts bytecode? For example, when I pull the bytecode from a contract address, I get something like: ...
2
votes
2answers
47 views

Revert()/throw/invalid are so powerful they can even put back an already self-destructed contract, but is there a way to surpass such limitation?

I know this sounds confusing so let me explain: In this case below a transaction will succeed and a contract will be first destroyed and then re-initialized on the same address (yes, I didn't think ...
1
vote
1answer
30 views

Are simultanous transactions possible (basic but potentially very dangerous security concern…most likely impossible…)?

Long story short I am curious how a contract stores variables in memory, so is it possible to spam say 100 transactions at once and the values to be changed afterwards...I am sure I am giving bad ...
4
votes
0answers
54 views

UNGAS and why was GAS made available to programming smart contracts?

Hardforks, such as Istanbul, have illustrated the best practice that smart contracts should not make any assumptions about gas. Gas costs have, can, and will change, for example: Is transfer() still ...
0
votes
0answers
23 views

How Gas Cost is defined in EVM gas table?

i was checking into EVM gas table (https://docs.google.com/spreadsheets/d/1n6mRqkBz3iWcOlRem_mO09GtSKEKrAsfO7Frgx18pNU/edit#gid=0) (even though it is old sheet) Have few question: On what basis for ...
0
votes
2answers
25 views

uint f = 0, f *= computationallyHeavyFunction(), does EVM run computationallyHeavyFunction()?

uint f = 0; f *= computationallyHeavyFunction(); Does EVM run computationallyHeavyFunction(), or does it evaluate f = 0 and then omit further computation?
1
vote
1answer
10 views

How do I send funds from a contract to an account using bytecode?

The instruction CREATE will send funds to a new account. Is there another instruction for sending funds to an account that already exists? Or I just have to use CREATE as if the account doesn't exist?
2
votes
1answer
42 views

Modifying simple function with inline assembly

I'm trying to write a super simple contract that's gas efficient utilizing inline assembly in solidity. All this function needs to do is create a child smart contract with one function, self destruct....
0
votes
1answer
34 views

Unable to deploy contract (2 lines of code) to chain (ETC)

Anyone know what causes this contract to not deploy on Ethereum Classic? contract A{ function b() public returns(uint) {return 4;} uint public c = b(); } Deploying the contract on ...
0
votes
2answers
36 views

Is this function prone to underflow hacking?

So I want to write as simple as possible withdrawal function in a token contract which also doesn't use Safemath for one very simple reason: I admit I don't understand well enough data types in EVM so ...
0
votes
0answers
25 views

Downgrade version of evm

I've installed the evm via apt-get, it returns me an unwanted version which is newest one. I've tried to find the older version to install but it returned nothing. I want to get evm version 1.7.3. Is ...
0
votes
1answer
23 views

Does it make sense to require token value to be anything but negative to prevent hack (more details below…)?

I was asked to validate a smart contract for a token and a function that puzzled me looks like that: function transferFrom(address _from, address _to, uint tokens) { require(...
1
vote
1answer
35 views

fraction**veryLargeNumber type math in EVM

A fraction like 0.5**1/31556926, raised to an exponent in the range of 10^9. What are the best ways to do that in a smart contract?
1
vote
1answer
22 views

EVM is sandboxed program execution environment

I read following content about EVM: It is vital to also note that EVM operates in a sandboxed environment- it is totally isolated from the main Blockchain network, and works perfectly as a testing ...
1
vote
1answer
18 views

Explanation for small variation in gasUsed while recursively deploying same contract

https://github.com/christianlundkvist/simple-multisig/blob/master/contracts/SimpleMultiSig.sol I'm deploying the above contract recursively and I find that the gasUsed varies by specifically 12 gas. ...
0
votes
1answer
45 views

Can we extend ethereum client or smart contract to use external libraries?

Basically the question is to extend the ethereum clients to bring some capabilities of external libraries on the blockchain either by extending the ethereum client or by using inside smart contracts ...
0
votes
1answer
30 views

How to setup ethereum to work on gpus for complex smart contract execution?

Basically the question is to apply some gpu intensive tasks like machine learning algorithms etc using smart contracts, is this possible using any of the available ethereum clients like geth or parity ...
1
vote
1answer
85 views

What data is in 'calldataload'?

I want to parse event logs that are generated by the contract shown below, which assigns different sections of calldataload to the 4 Topics, and the Data section, of the event logs. Topic 0 receives ...
2
votes
1answer
58 views

Who confirms Ropsten and Rinkeby transactions?

Basic or more like "fundamental" question I guess: So if I got that right, each time someone runs Geth/Parity or other software they all become part of the EVM (ethereum virtual machine). However ...
0
votes
1answer
21 views

Can I call a contract function in the “data” element via web3, especially when I am using conversion to bytes?

In other words, say In Python I have something like that: signed_txn = w3.eth.account.signTransaction(dict( nonce=w3.eth.getTransactionCount('0x0000000000000000000000000000000'), gasPrice = ...
1
vote
3answers
44 views

Basic question I guess but is “web3” a client in the sense that I want to use a very simple client to interact with the network?

Long story short I need a way to send programmatically a raw transaction without any bounds checkings or any checks...now I am not trying to abuse or flood the network - my goal is to attempt to send ...
0
votes
1answer
38 views

How dangerous the 'short address' attack is as of 2019, October and what ways there are to mitigate it?

From what I read there's a well public knowledge of reantrancy and underflows/overflows due to the cases of documented hacks and stolen ether - yet the short address attack seems less known. I know in ...
1
vote
0answers
58 views

Solidity calldata for an array of structs

I'm trying to create the calldata offchain for an on-chain low-level call to a method that accepts an array of structs as an argument. I'm not sure how to encode the calldata for this. Here's a ...
1
vote
1answer
38 views

Different gas usage of trivial reverting contract function

We are currently testing functions on Ropsten test network and have an issue regarding the gas usage. Our functions sometimes use 12 gas more and we can not fathom why that would be the case. To test ...
0
votes
1answer
14 views

Can block validation be done using machine Learning Algorithms?

I am looking for a new era of products that leverages the potential of Machine Learning and the blockchain, Thinking of different aspects of Blockchain which can be improved with the help of machine ...
2
votes
0answers
18 views

Why is it required to know the function selector in a smart contract to call the function? [duplicate]

I understand what a function selector is and how it is computed: The first four bytes of the call data for a function call specifies the function to be called. It is the first (left, high-order ...
0
votes
1answer
22 views

Where does contract’s call failure behavior is definied in the yellow paper?

If a contract’s call succeeds then 0x1 is pushed on the stack and 0x0 otherwise. Where is this behavior defined in the yellow paper ? Also, are there cases were sending ether isn’t reverted in ...
2
votes
1answer
82 views

If a function calls another function in another contract, where is the called function executed?

When a contract calls a function in another contract, is the called function executed in the same EVM as the caller function, in another EVM on the same node or in another random node?
0
votes
1answer
27 views

Why some transaction errors lead to discarding the whole block?

In terms of go-ethereum code, transaction errors can be grouped into (I made up the terminology) several categories by their effect on state transition. System errors: like database connection issues....
0
votes
1answer
55 views

How to call ecrecover() in pure assembly?

If I do remember correctly, it’s a contract built‑in in the Ethereum Virtual machine, isn’t it? if yes, what’s the address to call for it?

1
2 3 4 5
11