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
1answer
33 views

Passing an array to a function gets misinterpreted by the evm as value=20 causing INVALID_ARGUMENT error

I made an effort to cut out all the irrelevant parts of the code and get a minimal version still able to reproduce the error, these are the 3 smart contracts involved: // SPDX-License-Identifier: MIT ...
0
votes
0answers
10 views

Can you mine Bitcoin on the Ethereum Virtual Machine?

Code can be written on a smart contract to be deployed to the network, where nodes do the computational work for a fee and a given gas work. I was wondering if it would be theorectically possible, to ...
0
votes
1answer
23 views

How is the output of a contract call encoded?

Hi I have a proxy contract A which delegates function execution to implementation contract B using the standard OpenZeppelin code: assembly { calldatacopy(0, 0, calldatasize()) ...
0
votes
1answer
35 views

I am getting Returned error: VM Exception while processing transaction: invalid opcode error

I am getting an Invalid Opcode error while calling the refundAmount function which will refund the amount to the customer and cancel his/her ticket bookings. registrations is a structure mapping and ...
1
vote
0answers
9 views

Is there a table detailing all Ethereum protocol versions and which hard forks they correspond to?

Ethereum nodes have a protocol version parameter (https://web3py.readthedocs.io/en/stable/web3.eth.html#web3.eth.Eth.protocol_version). Is there a good source for Ethereum protocol versions and the ...
4
votes
0answers
34 views

What is an EVM externality?

While reading the OpenEthereum codebase, I encountered this type: /// Externalities interface for EVMs pub trait Ext { /// Returns the storage value for a given key if reversion happens on the ...
1
vote
1answer
39 views

Is it possible to trigger an ERC777 receiver hook by receiving ERC20 tokens?

I noticed that the callTokensReceived hook is called when using a few of the ERC777 functions but I am wondering how this could be triggered if an ERC20 token was sent to it? Example (pseudo code): ...
0
votes
1answer
49 views

address payable[] public causing SWC 110 and execption state

This is the output of mythril ==== Exception State ==== SWC ID: 110 Severity: Medium Contract: XXXXXXX Function name: recipients(uint256) PC address: 2067 Estimated Gas Usage: 1089 - 1184 An assertion ...
0
votes
1answer
12 views

Are gasless functions that can be performed client-side possible in solidity?

Suppose I have a contract which performs an arbitrary mathematical calculation like: contract Add2Plus2 { ... function add2plus2() external view { return 2 + 2; } ....
2
votes
2answers
101 views

What happens if GitHub path for import changes?

I wondered what happens if for example OpenZeppelin changes the path of a contract I have imported like this: import "@openzeppelin/contracts/token/ERC721/ERC721.sol";? Will my contract ...
0
votes
1answer
72 views

ERC20, correct way of setting totalSupply

whats the correct way of setting the totalSupply and why? decimals = 18; totalSupply = 10000 or decimals = 18; totalSupply = 10000 * (10 ** uint256(decimals)); Whats the correct way? What's the ...
0
votes
0answers
16 views

Distribution of tokens right away after ERC20.transferFrom

I would like to ask a question about token distribution with overriding ERC20 transferFrom function. IERC20 Token; function buy(uint256 id) external onlyCardPayable(id, PaymentTypes....
0
votes
1answer
18 views

What is better to use when querying a large but fixed number of structs - an array or a mapping?

In general, it seems as though mappings generally result in cheaper operations. What about when the number of elements are fixed (say, 20K) and setting the elements only ever occur once? Would a ...
2
votes
1answer
50 views

Efficiently swapping elements in Solidity arrays

Given an array of length 10,000 how computationally expensive would it be to swap elements within the array (e.g. by performing a swap of elements at randomly generated indices i and j) 10,000 times? ...
1
vote
1answer
17 views

Is there an ABI for wallet addresses?

If I am using the Web3 library, and I want to fetch a list of all tokens associated with my user account, would I be completely wrong in thinking that I need to use: const myAccount = new web3.eth....
1
vote
0answers
18 views

get constructor args from contract deploy tx

this question comes from this post: What does etherscan mean by "Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)"? My goal is to read contract ...
0
votes
1answer
183 views

Estimate Gas cost for a function call in solidity (on-chain)

I'm looking forward to get transaction cost for a particular function call in solidity onChain. I found methods using the web3.estimateGasCost(). But i need is, i should be able to calculate this on-...
2
votes
1answer
19 views

In the geth codebase where is the smart contract function executed

I'm looking to add some logging code to Geth. I have a vm created with a single geth node and private blockchain running. I've deployed a smart contract to it. I want to initiate a transaction on ...
1
vote
1answer
38 views

What is a machine state in Ethereum?

Section 9.4.1. of Ethereum paper (Petersburg version 41c1837 — 2021-02-14), states that: The machine state μ is defined as the tuple (g,pc,m,i,s) which are the gas available, the program counter pc ∈ ...
0
votes
0answers
20 views

Why must gas limit be set to 900 more than actual gas usage?

I have a contract which a specific function call will always cost x gas. However, setting the gas limit of the transaction to anything less than x + 900 will result in an out of gas error. What is ...
3
votes
1answer
70 views

Adding new custom opcode to solidity

I have a problem with adding new opcode to solidity. I'm using solc (on C++) and geth(ethereum on Go). I want to add new opcode, that takes address payable, uint256, uint256, bytes memory and returns ...
0
votes
2answers
107 views

How does a node execute the smart contract in the EVM and update the blockchain with result of contract execution

I would like to understand how the Ethereum Node is loading the contract bytecode in the EVM and then write everything that it needs, back to the blockchain. This is how I understand it. The contract ...
0
votes
1answer
25 views

EVM bytecode instrumentation

How can I instrument the EVM bytecode for runtime monitoring? Is there any technique or implementation for that?
0
votes
0answers
15 views

What is the purpose of EVM tags, their haphazard arrangement and their relationship to functions?

I want to understand the purpose of tags in EVM assembly and their relationship with Solidity function. pragma solidity ^0.5.1; import './Mod.sol'; contract MOFTest{ ModifiedBank mb; ...
0
votes
1answer
19 views

What happens when you send a non-state-changing transaction to the transaction pool

I understand that there are 2 endpoints for smart contracts. Call() for running view/pure function and SendTransaction() for state-changing transactions. Obviously a state-changing transaction sent to ...
2
votes
1answer
185 views

How to remove/increase execution timeout of the geth's evm?

I am performing some benchmarking with the Ethereum Virtual Machine. I have a contract with just one function that calculates the prime numbers until 100k. However, I am not able to get my results as ...
1
vote
0answers
12 views

How do I get solcjs to compile yul

I want to write a smart contract using pure Yul but I have no idea how I'm meant to configure / run solcjs to compile my yul code down to bytecode. Any pointers would be much appreciated.
0
votes
1answer
38 views

Smart Contract Shared Ownership

Can A smart contract ownership be shared. If No!, is the restriction imposed at the EVM level Otherwise how can shared ownership be achieved.
2
votes
0answers
144 views

What is the difference between the STATICCALL and CALL EVM opcodes?

Besides the regular and very common CALL, the Ethereum Virtual Machine has the STATICCALL opcode. In which ways does it differ from the regular CALL? Edit: This is not a duplicate because this ...
0
votes
0answers
16 views

Is 2^64 enough for centuries?

I want my smart contract to lock funds for 100 years. Somebody may use it to lock funds for even more time. Will 2^64 "markets" (anyone can create a new consecutively numbered market) be ...
0
votes
1answer
32 views

How do I order strings in Solidity?

I'm a newbie to smart contract development, and I'm looking to order strings using solidity, I don't care that much what kind of ordering method (alphabetical for example) is used, I just want it to ...
3
votes
2answers
316 views

Who will execute the smart contract for us?

I want to know who will help us execute when we call the functions in the smart contract. Is it the miner who put this transaction in the block? Hope you can give me some help, Thanks!
0
votes
1answer
32 views

JS Testing: A contract calling a function in another contract which creates a contract

I want to test three contracts in total: Main.sol, Factory.sol, PCE.sol Here's the flow I want: accounts[0] calls factoryStart in Main.sol Main.sol should call a function in Factory.sol, passing the ...
1
vote
1answer
59 views

Preserve msg.sender but not storage

In this particular scheme, we pass the address of the Attacker contract in Victim.foo. By using delegatecall, we maintain the msg.sender field, but we are not using the storage of Storage but Attacker'...
0
votes
0answers
142 views

Infura-Like caching layer to store all Events in local nodes for fast retrieve

Anyone who has tried to use a local Ethereum node to run any complex DApp will have realized that it is impossible to do so because there is a huge problem of slowness in the retrievement of large ...
0
votes
0answers
40 views

How to pass a non-deployed Smart Contract to a deployed contract and call a function on it?

I'm currently trying to pass a Smart Contract (which is NOT deployed) in byte code format as an argument to another Smart Contract (which is deployed). From within the deployed contract I want to run ...
0
votes
0answers
13 views

Transaction Gas limit vs gas used vs start gas

I was inspecting one of my transactions on ropsten and I noticed something was off. The gas limit and gas spent as shown on etherscan and in metamask are 45666 and 29034 respectively so far so good. ...
3
votes
3answers
279 views

Does an SSTORE where the new value is the same as the existing value cost gas?

For example (in Vyper): @external def foo(bar: uint256): self.baz = bar foo(3) foo(3) # Is the gas cost here still 5000? Is it better to do this instead? def foo(bar: uint256): if self.baz != ...
0
votes
1answer
18 views

Do different clients use different amounts of gas?

I'm trying to understand clients/nodes a bit can someone help clarify the below for me. My understanding is that each client implements the EVM in their own way. Smart contracts are written in ...
0
votes
1answer
59 views

Is it possible to get the current transaction's transactionIndex from within a Solidity function call?

Is it somehow possible to get the current transaction's index in the block from within Solidity? or to derive this in some indirect way?
0
votes
0answers
20 views

Comparing EVM execution times

My understanding is that there are several different implementations of EVMs (geth, parity etc.). Do the different implementations effect the execution times of smart contracts? I wanted to test the ...
3
votes
0answers
65 views

Geth, how to revert back to certain EVM state/block

I am trying to fuzz a smart contract on Geth, which involves contract state exploration. In order to explore a contract state S1, different contract functions with different inputs will be executed on ...
2
votes
0answers
166 views

What other blockchains support the EVM execution model?

In essence I'm interested in which other chains (mostly Layer 1) I can deploy Solidity smart contracts to? I know of TRON. And I also know Cosmos, Polkadot and NEAR have at least some support. But ...
1
vote
1answer
117 views

Storage Address of Smart Contract Variables

I need to know storage address of solidity smart contract variables before its deployment. how can I get this?
0
votes
1answer
318 views

How to encode data for low level call? (Compound/Uniswap governence)

I can't get the transaction to execute no matter how much I play with it. I know that it reverts during the secondary call because I always get this revert message: Timelock::executeTransaction: ...
1
vote
0answers
18 views

About Buidler Evm

1.How can I execute payable functions, like this putting the Value in the Builder console? 2.Can someone tell me the way to be able to change the address on the Buidler evm console? To execute ...
1
vote
1answer
46 views

How does the EVM identify a dynamic type in the function calldata?

So as per the ABI encoding specifications mentioned in Solidity Docs, for a dynamic array, the data location (in bytes from start, for the data part) is specified at first, followed by the length of ...
0
votes
1answer
97 views

Clarification on how Calldata persists on the blockchain and how Optimistic Rollups use it

So I see that a lot of optimistic rollup solutions say that they store the chain's transaction data on Ethereum via "calldata" which is way cheaper in gas costs than contract storage (I ...
0
votes
0answers
25 views

How does ecrecover get compiled?

How does ecrecover() in solidity work? Looking at ethervm.io there doesn't seem to be an opcode for ecrecover? To what bytes is a ecrecover() call compiled?
0
votes
0answers
43 views

Does the EVM have an opcode to check private key signatures?

I have plain and simple desire. I want my dapp users to be able to generate some data payload, sign it with their private key, and send it using any external channel (eg JSON between apps) to a ...

1
2 3 4 5
12