Hot answers tagged

1

I had to change quite a few things to get this code to compile, but the important piece you were missing is that public functions can't return storage references (because an external caller couldn't do anything with that), but internal (or private) functions can: pragma solidity 0.5.11; contract A { struct Prop { uint256 foo; // empty ...


1

Yes, it does for the first case but if foo is an address, no, there are no storage efficiency gains. If I apply the changes mentioned in the question body, I end up spending a whopping 20,134 less gas for adding a new struct in the mapping. See transactions on Rinkeby: Without Tight Packing ~ 109,607 gas With Tight Packing ~ 89,473 gas The example ...


Only top voted, non community-wiki answers of a minimum length are eligible