Skip to main content

Questions tagged [storage]

all questions regarding data and storage on the ethereum blockchain

Filter by
Sorted by
Tagged with
3 votes
2 answers
74 views
+50

Is the new transient storage immutable?

I just found out about EIP-1153, and that there's a new type of storage: transient, which exists in the scope of a one single transaction. Do I understand this correctly: Contract A can write ...
Andrew Slock's user avatar
0 votes
1 answer
53 views

find which mapping and slot a key belongs to

How is it possible to know which mapping a key belongs to? For storage mappings how is it possible to know if a key belongs to a mapping or another? For example, there are 2 mappings on the contract (...
alb2001's user avatar
0 votes
3 answers
58 views

What's the best practice to storing encoded data on-chain?

I need to store some encoded data on-chain that I can then decode to obtain the original data. The idea is that this data comes in the form of a JSON. Is it possible to do this? Must fields in the ...
Falcon Stakepool's user avatar
3 votes
1 answer
27 views

If the `Free pointer` is stored at `0x40` what do the rest of `0x41` to `0x5f` do?

Layout in Memory Solidity reserves four 32-byte slots, with specific byte ranges (inclusive of endpoints) being used as follows: 0x00 - 0x3f (64 bytes): scratch space for hashing methods 0x40 - ...
shadow's user avatar
  • 307
1 vote
1 answer
16 views

getting invalid opcode

this is my Solidity code // SPDX-License-Identifier: MIT pragma solidity ^0.8.7; // pragma solidity ^0.8.0; // pragma solidity >=0.8.0 <0.9.0; contract SimpleStorage { uint256 ...
Shlok Bhargude's user avatar
0 votes
1 answer
32 views

What is `local storage` as opposed to `storage`

From solidity docs (https://docs.soliditylang.org/en/v0.8.4/types.html#data-location ) - Every reference type has an additional annotation, the “data location”, about where it is stored. There are ...
shadow's user avatar
  • 307
0 votes
0 answers
22 views

What are the types of merkle patricia nodes?

Another question related to a popular paper that always appears at the top of google search. Related question: To what extent has 2018 mLSM paper influenced ethereum data structure? How is the ...
Pavel Fedotov's user avatar
1 vote
1 answer
41 views

To what extent categorization: full node, light node and fast node is relevant today?

Found such categorization from "mLSM: Making Authenticated Storage Faster in Ethereum" paper https://www.usenix.org/system/files/conference/hotstorage18/hotstorage18-paper-raju.pdf. There ...
Pavel Fedotov's user avatar
1 vote
1 answer
66 views

To what extent has 2018 mLSM paper influenced ethereum data structure?

mLSM: Making Authenticated Storage Faster in Ethereum Authors: Pandian Raju, Soujanya Ponnapalli, Evan Kaminsky, Gilad Oved, and Zachary Keener, University of Texas at Austin; Vijay Chidambaram, ...
Pavel Fedotov's user avatar
0 votes
1 answer
17 views

Efficiently Visualizing and Retrieval Ethereum Smart Contract Events on Decentralized Storage

I want to know what are the recommended decentralized storage solutions (IPFS or sub-graph)? and general process for retrieving them for front-end visualization?
Awais Ahmad's user avatar
1 vote
1 answer
33 views

Storage ops / gas spent

Is it possible to know the amount of storage operations (or gas spent) that are between, let's say 4 functions, or a full contract? Is foundry capable of this? Thanks!
dNyrM's user avatar
  • 938
0 votes
0 answers
10 views

Storage algorithms for Decentralized Storage System

I am working on a project to build a decentralized storage system compatible with Ethereum blockchain. I am confused between Erasure coding and Proof-of-Replication to use for data redundancy storage ...
Shrigouri's user avatar
0 votes
1 answer
193 views

Upgrading Smart Contracts with New Fields: How to Safely Modify Storage Layout

I'm working on upgrading my Ethereum smart contract, which utilizes upgradable smart contract patterns. Currently, I have a struct named GovernorCountingSimpleStorage with existing fields, and I want ...
Agilulfo's user avatar
0 votes
0 answers
21 views

Getting the block id of where a value is stored

let's say I have a contract such as contract Example { mapping (uint256 => string) messages; uint256 currentMessage = 0; function addMessage (string calldata message) external returns (...
shaharsol's user avatar
  • 571
0 votes
1 answer
34 views

Copying memory[] to storage not supported on initialization

I have a data structure where: The smart contract holds an array of structs (a "community") in state That struct has an array of structs ("delegates") When I try initialize one ...
RanierResearch's user avatar
0 votes
1 answer
78 views

Decode the multiple variables stored in one storage slot

In the following code the 3 declared variables will be packed and stored in one slot together. When the slot 0 zero is accessed to get the value we get an encoded value, like here we get ...
priyanshu bindal's user avatar
1 vote
1 answer
68 views

How does the proxy contract gets the storage variables of Implementation contract?

I understand that proxies use delegatecall to execute the logic contract's function with its own storage. But what happens when we define any storage variables in the logic contract as well as ...
Solidity Nerd's user avatar
3 votes
2 answers
50 views

In Ethereum, if a variable is set to zero, is it removed from storage trie?

If a variable is set to zero, is it removed from storage trie? If not, why not? Seems it would save a lot of storage space.
BipedalJoe's user avatar
0 votes
1 answer
32 views

Storage behaviour in ReentrancyGuardUpgradable

I'm working on the UUPS upgradable proxy pattern and need to implement the ReentrancyGuard to my contract. While I was checking the contract code, I found the storage declaration is a little bit ...
colton huang.'s user avatar
0 votes
1 answer
22 views

Ethernaut Alien Codex Gas Estimation Failed

When i call attack() or exploit() function the remix shows Gas Estimation Failed. The code is copied from existing solution available on internet. so code is correct, can someone please help me why I ...
Shubham's user avatar
  • 25
0 votes
1 answer
94 views

How do I manually find the storage slot for a string greater than 32 bytes?

This is my contract: SPDX-License-Identifier: MIT pragma solidity 0.8.22; contract StringStorage { string short_string = "ABCD"; string long_string = "...
davidastro's user avatar
0 votes
0 answers
21 views

Solidity design pattern drawbacks

I was ask by a friend to give feedback on his solidity project. I came over a general design pattern issue, which is not good from an object oriented point of view. I try to outline the projects ...
Rachain's user avatar
  • 91
0 votes
1 answer
230 views

How to decode storage value of a struct

On Uniswap V3 Pool contract, we have slot0 struct which is located on slot 0 of the storage struct Slot0 { // the current price uint160 sqrtPriceX96; // the current tick ...
Billy Adelphia's user avatar
0 votes
1 answer
182 views

Find slot of private variable

How do I find the slot of a private variable? I know that Foundry has the method stdstorage.sig(), but that only works for variables with public getters, so private ones are out of scope. Thanks!
dNyrM's user avatar
  • 938
1 vote
1 answer
475 views

Automatically getting implementation contract for eip 1967 proxy

Let's say I wanted to write code which looks at a smart contract, detects whether it is an upgradeable proxy, and then fetches the contract address. Something like so: const functionNames = abi.map((...
Abraham P's user avatar
  • 103
2 votes
1 answer
45 views

Has Solidity Introduced Storage Optimization for Smaller Integer Types in Structs?

I am working on a project where storage efficiency is of utmost importance. Specifically, I have a scenario where I want to store an ID of type uint16 and a code of type uint8. The current plan is to ...
MShakeG's user avatar
  • 1,825
1 vote
1 answer
103 views

Do custom errors and events take up storage in Solidity?

For example, is slot 0 in this contract the uint256 x or does the custom error take up this slot? Same thing for events. contract Foo { error CustomError(); uint256 x; }
Rohan Nero's user avatar
  • 1,635
3 votes
2 answers
160 views

assertEq() fails on seemingly same strings

I have a simple contract that just sets a string private state variable in contract's slot 1. Below, I write a test that is supposed to set that private string variable to a new value and then I go in ...
SKA's user avatar
  • 47
3 votes
2 answers
149 views

Are storage variables tightly packed like struct fields?

Tight variable packing is a known coding pattern in Solidity for saving gas by placing struct fields that are lower than 256 bits closer to one another. Does this logic apply to storage variables? ...
Paul Razvan Berg's user avatar
2 votes
1 answer
36 views

What do original, current, and new value mean in the context of pricing storage updates?

I've heard these terms thrown around in discussions surrounding storage pricing in the EVM. But what do they mean, more precisely?
Paul Razvan Berg's user avatar
1 vote
2 answers
289 views

Remove the element from array where order matters?

I am presenting my use case here. Let's think of a dating app where each candidate enters their preferences and we store their data and add them to an array. when someone enters that matches with any ...
Rashid Ul Haq's user avatar
0 votes
1 answer
29 views

Unable to change the storage using Delegate call

// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract Preservation { // public library contracts address public timeZone1Library; address public timeZone2Library; address public ...
kumar's user avatar
  • 61
1 vote
1 answer
160 views

How to change the storage using Delegate call

// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract Preservation { // public library contracts address public timeZone1Library; address public timeZone2Library; address public ...
kumar's user avatar
  • 61
0 votes
1 answer
10 views

How the uint changes to address type in solidity when using delegatecall?

pragma solidity ^0.8.18; contract One{ address public first; address public second; address public third; function setaddress(address _address)public { third = _address; }...
kumar's user avatar
  • 61
0 votes
1 answer
19 views

Ethereumjs putContractStorage throws an error

I'm experimenting with Ethereumjs and having issues with the putContractStorage from vm.stateManager. The following code snippet: const { VM } = require('@ethereumjs/vm') const vm1 = new VM() const ...
Andreas Tzionis's user avatar
0 votes
1 answer
93 views

What are Pros and cons of deploying a new minimal proxy contract for every minted token vs minting all in a single contract?

[I am thinking about NFTs but it might be a broader idea] It is intuitive to think that deploying a new minimal proxy contract exclusive for every new minted token (like an ERC721 with totalSupply of ...
Rafael Werlang's user avatar
1 vote
0 answers
24 views

Struct string not saving to storage from mapping

Good morning guys, I would like to get some help with some declaration that I am doing in my solidity contract, basically I want to have some data on my registry from a user, such as if it is admin, ...
Marxian's user avatar
  • 66
1 vote
0 answers
147 views

Foundry : cast storage command storage slot argument posing length issue

When I try to get the private variable stored at storage slot 0 of the contract storage using the cast storage command, cast storage <my-contract-address> 0 --rpc-url <my-rpc-url> I get ...
h4mster's user avatar
  • 11
0 votes
1 answer
84 views

Problem with access private uint in a contract

I want to access a private data in a smart contract, I know that it is located in the second slot, and I use this code : await web3.eth.getStorageAt('0xeB51Bceb2F930aC619815E96FfB8E57C84Fb67Cd' , 1) ...
Mehran Ra's user avatar
  • 588
1 vote
2 answers
36 views

Where is the return data from an external call stored?

In ethervm.io, RETURNDATASIZE is described as follows. RETURNDATASIZE : Byzantium hardfork, EIP-211: the size of the returned data from the last external call, in bytes The smart contract has 3 ...
imelon2's user avatar
  • 570
1 vote
1 answer
111 views

Call to a view function returns an incorrect value

I'm currently developing a private network for a client using geth 1.11.3 and have encountered an unusual behavior. Here is a simple contract: pragma solidity ^0.8.0; contract Test { string public ...
Naple's user avatar
  • 13
1 vote
1 answer
56 views

Null keys when using `debug_storageRangeAt`

I'm currently trying to use the debug_storageRangeAt on a Hyperledger Besu RPC to extract the contract storage. For some contracts I get the expected response which is a list of keys and values: "...
Valentín Fernández's user avatar
1 vote
2 answers
139 views

Is it possible to define interface getters for arrays of structs?

Given a state variable defined like this: struct Segment { uint256 foo; uint256 bar; } Segment[] public override segments; Is it possible to define a getter in an interface? I've tried this ...
Paul Razvan Berg's user avatar
1 vote
1 answer
31 views

i have an upgradable smart contract with 3 mappings, i set only the first two in the initialize function

i have an upgradable smart contract with 3 mappings, i set only the first two in the initialize function . pragma solidity ^0.8.0; contract ContractA { mapping(uint256 => address) public ...
noro meb's user avatar
  • 368
0 votes
1 answer
253 views

Can you run an Ethereum node with a USB 3.2 SSD?

I've not seen much discussion around running an Ethereum node with an USB 3.2 SSD, like this one, with ~1050MB/s read/write speeds and 2TB. Would this work as storage for an ethereum node? What about ...
Danny B's user avatar
  • 323
0 votes
2 answers
2k views

Ethereum full node size (default vs archive)

I'm looking at etherscan right now and I have 2 questions. There are 2 versions of full node sync chart, default and archive, what is the difference between them? And why is it that in the FULL NODE ...
MSSONG's user avatar
  • 1
1 vote
2 answers
104 views

Are nodes in Merkle Patricia Tree ever deleted?

I was researching how contract storage works. I know that the world state is a Merkle Patricia Trie, containing all active Ethereum adresses with their storageRoot (and their nonce, balance, and ...
Hackndo's user avatar
  • 121
1 vote
1 answer
281 views

EVM Storage and LevelDB

Recently, I studied about EVM storage and LevelDB as a state database. And here's my question. I'm confused about relationship between levelDB and EVM storage. When a transaction that activates a ...
the.ETHEREUM's user avatar
2 votes
1 answer
199 views

Do immutable variables influence the contract bytecode?

Suppose you have a contract like this: pragma solidity >=0.8.19; contract Bar { uint256 public immutable value; constructor(uint256 value_) { value = value_; } } Will Bar ...
Paul Razvan Berg's user avatar
1 vote
1 answer
28 views

How many strings can i store inside a mapping before the contract fails to work?

I have a single contract that is on the verge of its size limit (One more function and i wont be able to deploy anymore) Within this contract, there is a mapping that I want to feed with strings after ...
PupSt4r's user avatar
  • 65

1
2 3 4 5
13