Out of gas when clearing arrays

Target releaseTBD
Epic
Document status
DRAFT
Document owner
Designer
Developers
QA

Goals

  • Reduce Risk

Background and strategic fit

Bugs in Ethereum contracts have led to ETH being locked up.  This specific example has locked up 1100 ETH because the large array cannot be cleared without blowing the gas limit.  The RChain compiler should throw an error on this pattern.

Prevent the following problem from happening:

GovernMental

As posted by reddit user ethererik on GovernMental's 1100 ETH jackpot payout is stuck because it uses too much gas , the payout for this pyramid scheme may be stuck because the payout code requires the array of past creditors and amounts to be cleared, and this operation costs too much gas. The code to clear internal storage is:

creditorAddresses = new address[](0);
creditorAmounts = new uint[](0);

Apparently 1100 ethers are stuck in limbo.

WARNING - This is a situation Smart Contract developers need to be aware of!

The question How to clear large arrays without blowing the gas limit? has one answer to work around this issue. Thanks @Nick Johnson.

Assumptions

Requirements

#TitleUser StoryImportanceNotes
1
2    

User interaction and design

Questions

Below is a list of questions to be addressed as a result of this requirements document:

QuestionOutcome

Not Doing