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
0
votes
0answers
3 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
18 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
21 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
27 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
62 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
39 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
14 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
34 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
25 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
39 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
36 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
41 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
25 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
50 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
21 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
40 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
35 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
21 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
20 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
70 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
44 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
20 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
34 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
38 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
36 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
15 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
21 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
81 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
47 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?
2
votes
2answers
103 views

How to assemble a contract’s code?

I wrote a contract into bare assembly (no solidity or Vhyper syntax and with all address being static). How to convert it into bytecode? If possible using the new http://remix.ethereum.org or another ...
0
votes
0answers
12 views

What is EVM15 as a Solidity output target?

In the Solidity compiler help menu solc --help, I noticed that evm15 is one of the new compilation targets in addition to evm and ewasm. I know what ewasm stands for, but what's the difference between ...
2
votes
0answers
22 views

How to get a call graph for the binary code of a contract?

I need a call graph generator for the assembler level of smart contract code in order to analyse solidity compiler bugs. In that way, porosity is excatly what I need ! However there are too much bugs ...
0
votes
1answer
45 views

How is Ethereum Virtual Machine (EVM) isolated (sandboxed)?

I always had this question in mind: What are the used technologies, in order to achieve the isolation of the EVM? does it just run as an isolated process in its own namespaces using the linux feature ...
0
votes
0answers
13 views

Pulling EVM Bytecode of Contract Address [duplicate]

Is there a way to pull the EVM bytecode of a given contract address? Using Web3 perhaps? I believe using the web3.eth.Contract command may get access to the contract, but I am specifically looking ...
2
votes
1answer
51 views

Why Ethereum sets user balance to MaxBig256 whenever a contract query is performed?

There is a strange behaviour on user wallet balances when performing a contract call (that is supposed to have no cost). Balance is right (expected value) until a free call is requested to a contract. ...
0
votes
1answer
24 views

Loading modified contracts keeping the same super class

I am trying to implement upgrade of contracts. One pattern by [1] is to have a layer to resolve the actual address of a contract. I implemented that adding the Pausable manipulation. My idea was to ...
0
votes
1answer
26 views

EVM Stack - number of elements

The words in the stack are 256-bit, therefore 32 bytes in hexadecimal representation. The Ethereum Yellow Paper states “the stack as a size of 1024”, although it does not say what (bits/words). A ...

1 2 3 4 5 10