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
1
vote
0answers
14 views

Can EVM Istambul release run contracts compiled with solidity up to v0.8.4?

Reading from the Solidity release notes, for release 0.5.14 I read "Set the default EVM version to Istanbul". While for 0.8.5 I read: "Set the default EVM version to Berlin". Does ...
1
vote
0answers
14 views

What is the maximum amount of data that a node can send to a client?

Here is a simple smart contract, with a bytes32 array called items in storage. // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract SmartContract { bytes32[] public items; ...
2
votes
0answers
22 views

Smart contract function signature only 1 byte

I have noticed some contract calls only contain the function signature in the 1st byte of the input data. For example: ...
0
votes
0answers
7 views

How to add a custom opcode in go-ethereum which support running an executable from the local ethereum node? [closed]

I have looked into the custom addition of opcodes Adding new custom opcode to solidity but I wanted some opcodes which can help me access the files. Any help will be appreciated, Thanking you in ...
1
vote
0answers
15 views

Could not connect to your Ethereum client with the following parameters: (Ganache)

Could not connect to your Ethereum client with the following parameters: - host > 127.0.0.1 - port > 7545 - network_id > * Please check that your Ethereum client: - is running - ...
1
vote
1answer
34 views

Understanding Solidity Inline Assembly

I am new to inline assembly. I have tried understanding different opcodes, and understood quite a bit, but still not be able to correlate them in context to STATICCALL opcode. Kindly help me ...
0
votes
0answers
6 views

What is the problem with the unstability of `evmdis`

I am analysing bamboo compiler and I could not deassemble bytecode generated by bamboo with evmdis. The father of bamboo compiler @pirapira said that there is no wonder if evmdis does not work over ...
1
vote
1answer
33 views

What happens if i deploy a contract to an address that already has eth?

I know it is possible to calculate the contract address in solidity by using the create2 opcode. Let's say I transfer 1 ether to a random address. Then I deploy a contract with a payable transfer ...
0
votes
1answer
16 views

It is possible to have a mapping with dynamic arrays as a value?

I would to achieve a dynamic generic storage, and I would to create something like this contract GenericStorage{ mapping (string => int[]) db; function createList(string memory key) ...
1
vote
0answers
11 views

Function argument sizes and gas usage

Is there any penalty for the amount of data passed to a function? Asking because I see non-linear behavior in gas usage during testing when sending more than 31 items in the array. struct Payment { ...
1
vote
1answer
32 views

Are these two equal: web3.eth.getCode(<contract-address>) === type(Contract).creationCode

This question has been asked before in all sorts of convoluted ways. I am asking a very simple question and would like a very straight forward answer (if possible). What does the result of the call to ...
0
votes
1answer
35 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
27 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
44 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
41 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
10 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
37 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
82 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
53 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
14 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
113 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
151 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
19 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
70 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
21 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
443 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
25 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
46 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
21 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
100 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
152 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
33 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
16 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 ...
3
votes
1answer
257 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
16 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
47 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
2answers
203 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
17 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
43 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 ...
4
votes
2answers
336 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
36 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
61 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
150 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
53 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
14 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
350 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 ...

1
2 3 4 5
12