Skip to content
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: overwrite mem block timestamp if CKB median time is less than tip block #625

Merged
merged 1 commit into from
Mar 24, 2022

Conversation

jjyr
Copy link
Collaborator

@jjyr jjyr commented Mar 23, 2022

Godwoken relies on CKB median time to produce layer2 block. In some situation, the CKB median time will be less than tip layer2 block's timestamp, for example: CKB re-org.
So a contract developer may submit a transaction with a timestamp t1, and then execute a tx with a timestamp t2, and the t2 may be less than t1. This may cause logic error in contract.

This PR fix this by overwrite a later timestamp to mem-pool's block info if median time is less than the tip block's timestamp. This PR also adjust the default genesis block's timestamp, if user doesn't specific the timestamp of the genesis, we would use a earlier timestamp as the genesis, so it won't conflict with the CKB's median time in the development environment.

@jjyr jjyr requested review from Flouse and zeroqn March 23, 2022 09:40
@jjyr jjyr force-pushed the fix-timestamp-in-mem-block branch from 5ba9f9b to fb08a96 Compare March 23, 2022 09:59
Flouse added a commit to Flouse/godwoken-docker-prebuilds that referenced this pull request Mar 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants