3

I am checking the OP codes of a function (smart-contract), in Rinkeby. In my implementation there are 6 SSTORE op. - 4 of them, have 5000 GAS. - 2 of them, have 200 GAS.

5000 GAS is justified, based upon the yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf). I am not able to find out the reason for 200 GAS though.

Thanks in advance.

3

This is due to the net gas metering eip, which lowers the gas cost of subsequent updates to the same slot within the same transaction to 200. It was included in the Constantinople fork, but the Petersburg fork (which both occurred at the same time on mainnet) removed the EIP due to security issues around reentrancy. The Petersburg fork isn't scheduled to happen on Rinkeby until block 9,999,999, which explains why you're seeing this on Rinkeby but wont see it on mainnet. I suggest you use one of the other testnets, as Rinkeby is the only one where the fork hasn't happened.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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