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: check header timestamp in parlia task #46

Merged
merged 3 commits into from
Jun 27, 2024

Conversation

j75689
Copy link
Collaborator

@j75689 j75689 commented Jun 27, 2024

Description

Add header timestamp check to protect fake blocks from the future.

Rationale

predict timestamp is the trusted header(read from chain) timestamp plus the block interval times the difference between the latest header number and the trusted header number.
the timestamp of latest header should be bigger than the predicted timestamp and less than the current timestamp.

Example

n/a

Changes

Notable changes:

  • parlia engine task

Potential Impacts

  • no

@j75689 j75689 changed the title fix: add header timestamp check in parlia task fix: add header timestamp checker in parlia task Jun 27, 2024
@j75689 j75689 changed the title fix: add header timestamp checker in parlia task fix: check header timestamp in parlia task Jun 27, 2024
@j75689 j75689 force-pushed the fix/parlia_task_engine branch from 42c7a03 to 3bf3d5f Compare June 27, 2024 03:37
// difference between the latest header number and the best header number
// the timestamp of latest header should be bigger than the predicted timestamp and
// less than the current timestamp.
let predicted_timestamp = best_header.timestamp +
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we compare to the latest persisted header, because it is trustworthy, but the best_header here is not trustworthy.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@unclezoro unclezoro merged commit 9452bef into develop Jun 27, 2024
32 checks passed
@unclezoro unclezoro deleted the fix/parlia_task_engine branch August 5, 2024 03:54
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.

2 participants