-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Blockhash difference in state tests #17
Comments
Nope, that's not statetests, it's for VM-tests. |
But let's try to properly change it for statestests too, and see if the tests still pass |
So what happens is:
|
The example trace from this issue report:
That is, |
Also relevant: NethermindEth/nethermind#3201 |
|
So basically Geth, Besu and OE all return 0x0 on BLOCKHASH(0x831fc01b15af74fc30c) while Nethermind returns Keccak(0x831fc01b15af74fc30c).
Netherminds Blockhash provider:
https://github.com/NethermindEth/nethermind/blob/master/src/Nethermind/Nethermind.Evm.Test/TestBlockhashProvider.cs
https://github.com/NethermindEth/nethermind/blob/master/src/Nethermind/Ethereum.Test.Base/TestBlockhashProvider.cs
The state test documentation also states that
" Since the data of the blockchain is not given, the opcode BLOCKHASH could not return the hashes of the corresponding blocks. Therefore we define the hash of block number n to be SHA256("n")."
https://www.ethdocs.org/en/latest/contracts-and-transactions/ethereum-tests/state_tests/index.html (first paragraph)
Geth replaces the function correctly in state tests (https://github.com/ethereum/go-ethereum/blob/71c37d82adaa2b69ea98ce0c5505489d6b711c1e/tests/vm_test_util.go#L157) but I think it is not patched in the evm binary.
Test
``` { "nethermind-caller": { "env": { "currentCoinbase": "b94f5374fce5edbc8e2a8697c15331677e6ebf0b", "currentDifficulty": "0x20000", "currentGasLimit": "0x26e1f476fe1e22", "currentNumber": "0x1", "currentTimestamp": "0x3e8", "previousHash": "0x0000000000000000000000000000000000000000000000000000000000000000" }, "pre": { "0x00000000000000000000000000000000000000aa": { "code": "0x6000600060006000600060bb612d28f1", "storage": {}, "balance": "0x5", "nonce": "0x0" }, "0x00000000000000000000000000000000000000bb": { "code": "0x690831fc01b15af74fc30c40805260006000f3", "storage": {}, "balance": "0x5", "nonce": "0x0" }, "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b": { "code": "0x", "storage": {}, "balance": "0xffffffff", "nonce": "0x0" } }, "transaction": { "gasPrice": "0x1", "nonce": "0x0", "to": "0x00000000000000000000000000000000000000AA", "data": [ "0x" ], "gasLimit": [ "0x7a1200" ], "value": [ "0x01" ], "secretKey": "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8" }, "out": "0x", "post": { "Istanbul": [ { "hash": "0000000000000000000000000000000000000000000000000000000000000000", "logs": "0000000000000000000000000000000000000000000000000000000000000000", "indexes": { "data": 0, "gas": 0, "value": 0 } } ] } } } ```Geth output
Geth:Nethermind output
Nethermind:The text was updated successfully, but these errors were encountered: