You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm assuming here that the hash field should be the expected stateRoot .
In the test, note that the transaction has a gasPrice of 0 -> hence gas pricing will not change the stateRoot whatsoever, so we do not care about this pricing.
Here's my reasoning:
The test has a contract (0x095e7baea6a6c7c4c2dfeb977efac326af552d87) which calls itself. The first call selfdestructs to 0x02 and then it selfdestructs to 0x01.
The touched accounts are thus 0x01 and 0x02. In EIP-158 (Spurious Dragon) will remove account 0x01 from the trie, since it is DEAD (it does exist in the trie, but has zero balance, zero code and zero nonce). However, in Tangerine Whistle, it will stay. This should be the sole difference between Tangerine Whistle and Spurious Dragon.
Why then does Frontier/Homestead have a different state root? Well, this is because the CALL itself goes Out-Of-Gas in this hard fork. If you inspect the deployed code at the contract, you see that GAS gets forwarded to the CALL. Pre-TF this semantic was GAS - 20, since CALL used 20 gas. TF changed this; if you forward more than the available gas, instead of going OOG, you forward all the remaining gas. Hence, in Frontier/Homestead, the entire transaction goes OOG and thus no selfdestruct happened.
I want to note that in my tests, the EIP-158 test passes, but the EIP-150 tests does not pass. I think either the test is wrong somehow or my analysis is wrong and I'd love to get some help here.
For completeness, this is the EIP-150 state dump I'd expect:
Here non-defined values are empty buffers, i.e. they are 0.
This is the state root I'm getting: cf78ad0da35b6779d038ce6cd5d32e8eac81090b1f6a1d4430d6047dc2ce7e5c, while c5ac5551ef0c7f49c4a25c02c117046045adf7ba7cc672f91d5a1d2ea3a5837d is expected.
As a final note, I find it weird that in these LegacyTests the gasPrice is set to 0; you'd like to reflect the gas cost changes of these forks in the stateRoot I'd imagine.
The text was updated successfully, but these errors were encountered:
The issue is resolved; the problem was that our VM did not put an empty coinbase account in the Trie. After Tangerine Whistle, this is not a problem, as it would be cleaned up when removing empty "touched" accounts. An empty coinbase account in this case should exist, because the test suite expects that the miner account gets touched and all gas fee get put into this account - in this case, these fees are 0, and thus by Spurious Dragon this account is removed.
Hey there - we are implementing Tangerine Whistle (EIP-150) and I cannot get this specific test to work. I do not understand why.
I'm assuming here that the
hash
field should be the expectedstateRoot
.In the test, note that the transaction has a
gasPrice
of 0 -> hence gas pricing will not change the stateRoot whatsoever, so we do not care about this pricing.Here's my reasoning:
The test has a contract (
0x095e7baea6a6c7c4c2dfeb977efac326af552d87
) which calls itself. The first call selfdestructs to0x02
and then it selfdestructs to0x01
.The touched accounts are thus
0x01
and0x02
. InEIP-158
(Spurious Dragon) will remove account0x01
from the trie, since it isDEAD
(it does exist in the trie, but has zero balance, zero code and zero nonce). However, in Tangerine Whistle, it will stay. This should be the sole difference between Tangerine Whistle and Spurious Dragon.Why then does Frontier/Homestead have a different state root? Well, this is because the
CALL
itself goes Out-Of-Gas in this hard fork. If you inspect the deployed code at the contract, you see thatGAS
gets forwarded to theCALL
. Pre-TF this semantic wasGAS - 20
, sinceCALL
used 20 gas. TF changed this; if you forward more than the available gas, instead of going OOG, you forward all the remaining gas. Hence, in Frontier/Homestead, the entire transaction goes OOG and thus no selfdestruct happened.I want to note that in my tests, the EIP-158 test passes, but the EIP-150 tests does not pass. I think either the test is wrong somehow or my analysis is wrong and I'd love to get some help here.
For completeness, this is the EIP-150 state dump I'd expect:
Here non-defined values are empty buffers, i.e. they are 0.
This is the state root I'm getting:
cf78ad0da35b6779d038ce6cd5d32e8eac81090b1f6a1d4430d6047dc2ce7e5c
, whilec5ac5551ef0c7f49c4a25c02c117046045adf7ba7cc672f91d5a1d2ea3a5837d
is expected.Linked issue: Issue 431.
As a final note, I find it weird that in these LegacyTests the gasPrice is set to 0; you'd like to reflect the gas cost changes of these forks in the stateRoot I'd imagine.
The text was updated successfully, but these errors were encountered: