Saturday, June 14, 2025
No Result
View All Result
DOLLAR BITCOIN
Shop
  • Home
  • Blockchain
  • Bitcoin
  • Cryptocurrency
  • Altcoin
  • Ethereum
  • Market & Analysis
  • DeFi
  • More
    • Dogecoin
    • NFTs
    • XRP
    • Regulations
  • Shop
    • Bitcoin Book
    • Bitcoin Coin
    • Bitcoin Hat
    • Bitcoin Merch
    • Bitcoin Miner
    • Bitcoin Miner Machine
    • Bitcoin Shirt
    • Bitcoin Standard
    • Bitcoin Wallet
DOLLAR BITCOIN
No Result
View All Result
Home Ethereum

Solidity Storage Array Bugs | Ethereum Foundation Blog

n70products by n70products
December 2, 2024
in Ethereum
0
Solidity Storage Array Bugs | Ethereum Foundation Blog
0
SHARES
0
VIEWS
Share on FacebookShare on Twitter


Solidity Storage Array Bug Announcement

This weblog submit is about two bugs linked to storage arrays that are in any other case unrelated. Each have been current within the compiler for a very long time and have solely been found now despite the fact that a contract containing them ought to very possible present malfunctions in assessments.

Daenam Kim with assist from Nguyen Pham, each from Curvegrid found a problem the place invalid information is saved in reference to arrays of signed integers.

This bug has been current since Solidity 0.4.7 and we think about it the extra severe of the 2. If these arrays use damaging integers in a sure scenario, it should trigger information corruption and thus the bug needs to be simple to detect.

Via the Ethereum bug bounty program, we obtained a report a couple of flaw throughout the new experimental ABI encoder (known as ABIEncoderV2). The brand new ABI encoder continues to be marked as experimental, however we however assume that this deserves a distinguished announcement since it’s already used on mainnet.
Credit to Ming Chuan Lin (of https://www.secondstate.io) for each discovering and fixing the bug!

The 0.5.10 release accommodates the fixes to the bugs.
In the meanwhile, we don’t plan to publish a repair to the legacy 0.4.x collection of Solidity, however we would if there may be widespread demand.

Each bugs needs to be simply seen in assessments that contact the related code paths.

Particulars concerning the two bugs may be discovered under.

Signed Integer Array Bug

Who needs to be involved

If in case you have deployed contracts which use signed integer arrays in storage and both straight assign

  • a literal array with at the least one damaging worth in it (x = [-1, -2, -3];) or
  • an current array of a totally different signed integer kind

to it, this may result in information corruption within the storage array.

Contracts that solely assign particular person array parts (i.e. with x[2] = -1;) should not affected.

Methods to examine if contract is susceptible

In case you use signed integer arrays in storage, attempt to run assessments the place you employ damaging values. The impact needs to be that the precise worth saved is optimistic as an alternative of damaging.

If in case you have a contract that meets these situations, and wish to confirm whether or not the contract is certainly susceptible, you’ll be able to attain out to us by way of security@ethereum.org.

Technical particulars

Storage arrays may be assigned from arrays of various kind. Throughout this copy and task operation, a sort conversion is carried out on every of the weather. Along with the conversion, particularly if the signed integer kind is shorter than 256 bits, sure bits of the worth must be zeroed out in preparation for storing a number of values in the identical storage slot.

Which bits to zero out was incorrectly decided from the supply and never the goal kind. This results in too many bits being zeroed out. Specifically, the signal bit might be zero which makes the worth optimistic.

ABIEncoderV2 Array Bug

Who needs to be involved

If in case you have deployed contracts which use the experimental ABI encoder V2, then these may be affected. Because of this solely contracts which use the next directive throughout the supply code may be affected:

pragma experimental ABIEncoderV2;

Moreover, there are a selection of necessities for the bug to set off. See technical particulars additional under for extra info.

Methods to examine if contract is susceptible

The bug solely manifests itself when the entire following situations are met:

  • Storage information involving arrays or structs is shipped on to an exterior operate name, to abi.encode or to occasion information with out prior task to an area (reminiscence) variable AND
  • this information both accommodates an array of structs or an array of statically-sized arrays (i.e. at the least two-dimensional).

Along with that, within the following scenario, your code is NOT affected:

  • in the event you solely return such information and don’t use it in abi.encode, exterior calls or occasion information.

Attainable penalties

Naturally, any bug can have wildly various penalties relying on this system management stream, however we count on that that is extra prone to result in malfunction than exploitability.

The bug, when triggered, will below sure circumstances ship corrupt parameters on technique invocations to different contracts.

Technical particulars

Through the encoding course of, the experimental ABI encoder doesn’t correctly advance to the following component in an array in case the weather occupy greater than a single slot in storage.

That is solely the case for parts which are structs or statically-sized arrays. Arrays of dynamically-sized arrays or of elementary datatypes should not affected.

The precise impact you will note is that information is “shifted” within the encoded array: If in case you have an array of kind uint[2][] and it accommodates the info
[[1, 2], [3, 4], [5, 6]], then it will likely be encoded as [[1, 2], [2, 3], [3, 4]] as a result of the encoder solely advances by a single slot between parts as an alternative of two.

This submit was collectively composed by @axic, @chriseth, @holiman



Source link

Tags: ArrayBlogBugsEthereumFoundationSolidityStorage
Previous Post

Dogecoin Boom Over? Crypto Analyst Warns Of Sell Signal

Next Post

Crypto Analyst Says Litecoin Is About To Pull An XRP, Here’s What He Means

Next Post
Crypto Analyst Says Litecoin Is About To Pull An XRP, Here’s What He Means

Crypto Analyst Says Litecoin Is About To Pull An XRP, Here's What He Means

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Premium Content

Ethereum’s breakout alert: Can bulls take ETH to $4,000?

Ethereum’s breakout alert: Can bulls take ETH to $4,000?

December 12, 2024
Tether’s crosschain USDT0 stablecoin launches on OP Superchain

Tether’s crosschain USDT0 stablecoin launches on OP Superchain

March 27, 2025
Solana, Ethereum battle for blockchain dominance: Is there a clear winner?

Solana, Ethereum battle for blockchain dominance: Is there a clear winner?

August 9, 2024
Ethereum Set For A Bullish Breakout? Expert Cites Strong Upside Potential

Ethereum Set For A Bullish Breakout? Expert Cites Strong Upside Potential

November 5, 2024
Ledger Hardware Wallet Black Friday Offer

Ledger Hardware Wallet Black Friday Offer

December 26, 2023
Optimism, Arbitrum and how 2023 was the year of the L2s

Optimism, Arbitrum and how 2023 was the year of the L2s

December 28, 2023

Recent Posts

  • Here Are the Possible Bearish Targets for Bitcoin After BTC Fails To Break Out Above Major Level, According to Crypto Analyst
  • Trump Media’s Bitcoin Treasury Deal Deemed ‘Effective’ By SEC
  • Bitcoin Price Crash To $94,000 Imminent As Fibonacci Resistance Is At Stake

Categories

  • Altcoin
  • Bitcoin
  • Blockchain
  • Blog
  • Cryptocurrency
  • DeFi
  • Dogecoin
  • Ethereum
  • Market & Analysis
  • NFTs
  • Regulations
  • XRP

Recommended

Here Are the Possible Bearish Targets for Bitcoin After BTC Fails To Break Out Above Major Level, According to Crypto Analyst

Here Are the Possible Bearish Targets for Bitcoin After BTC Fails To Break Out Above Major Level, According to Crypto Analyst

June 14, 2025
Trump Media’s Bitcoin Treasury Deal Deemed ‘Effective’ By SEC

Trump Media’s Bitcoin Treasury Deal Deemed ‘Effective’ By SEC

June 14, 2025

© 2023 Dollar-Bitcoin | All Rights Reserved

No Result
View All Result
  • Home
  • Blockchain
  • Bitcoin
  • Cryptocurrency
  • Altcoin
  • Ethereum
  • Market & Analysis
  • DeFi
  • More
    • Dogecoin
    • NFTs
    • XRP
    • Regulations
  • Shop
    • Bitcoin Book
    • Bitcoin Coin
    • Bitcoin Hat
    • Bitcoin Merch
    • Bitcoin Miner
    • Bitcoin Miner Machine
    • Bitcoin Shirt
    • Bitcoin Standard
    • Bitcoin Wallet

© 2023 Dollar-Bitcoin | All Rights Reserved

Are you sure want to unlock this post?
Unlock left : 0
Are you sure want to cancel subscription?
Go to mobile version