7

I have a contract that will store a lot of data. Offline solutions really don't apply to the problem I'm trying to solve, short of caching (but then I have a cache invalidation problem I'd have to solve too).

I only need to update small amounts of data at a time, so that fits easily under maxGas because of the "gas charge only on changing to non-zero value" feature of the EVM, but I need to be able to read a large amount of data at a time, and I'm having problems with that.

When I try to read a large amount via a solidity ABI, I get an out of gas error in the geth logfile (but nothing programmatically from web3.js call() which doesn't even take a gas argument), and I just get all zeros from web3.js despite the fact that I've modified a memory location.

Will web3.eth.getStorageAt work more efficiently or will it also run out of gas? If this method works better than invoking the EVM, and I'm using fixed arrays, how do I find the address of the data? Is there an alternative solution that minimizes overhead on the Ethereum node I'm talking to?

example code:

uint8 [10][10][100][100] public blocks;
// this quietly runs out of gas even in a call()
function getBlocks() returns (uint8[10][10][100][100]) {
        return blocks;
    }
}

1 Answer 1

2

Calls should not be rate limited. I think there was a bug in the RPC that for some reason assigned a default gas limit to calls. Could you try with this PR against develop? https://github.com/ethereum/go-ethereum/pull/2308

3
  • that's most likely it. However invoking the EVM still seems inefficient. Isn't there a way to locate the raw address of the fixed-size array?
    – Paul S
    Commented Mar 8, 2016 at 17:34
  • I can't upgrade to Homestead for another 3 weeks, critical demo juncture...I'll post an update when I get there.
    – Paul S
    Commented Mar 8, 2016 at 17:34
  • Take care, the Homestead chain will be immediately incompatible with the current Frontier chain. The moment the switch over happens, old clients on the main net will be left behind (already happened on the test net). Commented Mar 9, 2016 at 7:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.