-
Notifications
You must be signed in to change notification settings - Fork 487
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
Fix bug parent hash on BlockV2
upgrade
#570
Fix bug parent hash on BlockV2
upgrade
#570
Conversation
The current PR changes the meaning of parent hash though. For the majority of Ethereum dapps, it just shouldn't matter at all, and we can set the parent hash to even I'd prefer you change this PR to a runtime migration (decode
This bug could have been detected if Substrate wasn't silently failing on those should-be-panic cases. It's essentially a migration bug. With above we could have prevented it together with |
I agree that runtime migration is preferable. @sorpaas for visibility, as we talked:
That's not the case, as |
@sorpaas added the migration functions. I still think reading |
Please pull master. |
# Conflicts: # frame/ethereum/src/lib.rs
* Fix bug parent hash on `BlockV2` upgrade * BlockV0 -> BlockV2 migration utility functions
* Fix bug parent hash on `BlockV2` upgrade * BlockV0 -> BlockV2 migration utility functions
This bug can be reproduced after storage upgrade from
BlockV0
toBlockV2
, and only if the preceding block contained transactions. In that case thecurrent_block_hash
function will try to decodeBlockV2
, failing to do so because the block containsTransactionV0
s and returningNone
, defaulting toH256::default()
, rendering the parent hash useless and of course messing the block hashing of the subsequent blocks.This PR proposes just use the already existing
BlockHash
storage and query it using the previous block number.This is a pretty nasty bug and should merged in asap @sorpaas . Also, do you have any suggestion on how to test this type of situation in frontier?