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

Better timestamps on simulated chains #16326

Merged
merged 6 commits into from
Sep 16, 2023
Merged

Conversation

arvidn
Copy link
Contributor

@arvidn arvidn commented Sep 13, 2023

This PR is best reviewed one commit at a time.

Purpose:

This updates the BlockTools logic to generate more authentic simulated chains, and also lets us generate the long chains faster.

The highlights are:

  • The (simulated) timestamps on blocks are proportional to the number of iterations between the blocks
  • The logic to support tracking of sub-second simulated time is simplified to just use float, instead of integer seconds + residual

Current Behavior:

The timestamp between two transaction blocks is always 18 seconds, regardless of there being non-tx blocks in between
The timestamp between blocks is irrespective of the number of actual VDF iterations between the blocks. This effectively simulates a timelord that speeds up over time, making it increasingly expensive to generate the chain.

New Behavior:

The timestamp between two transaction blocks is (by default) 18.75 seconds for each block (including non-TX blocks). This time delta is scaled by the number of iterations.
The simulated chain does not simulate a timelord that speeds up over time. The cost of generating the chain is linear to the number of blocks.

Testing Notes:

I generated the chains, including the 10000 block one with the debug output to verify.

fchirica
fchirica previously approved these changes Sep 14, 2023
@arvidn arvidn added Changed Required label for PR that categorizes merge commit message as "Changed" for changelog Tests Changes to tests labels Sep 15, 2023
@arvidn arvidn marked this pull request as ready for review September 15, 2023 09:44
@arvidn arvidn requested a review from a team as a code owner September 15, 2023 09:44
…ous (more complicated) block-time-residual field, tracking fractions of seconds. This also makes high precision (simulated) timestamps mandatory in BlockTools
@arvidn arvidn closed this Sep 15, 2023
@arvidn arvidn reopened this Sep 15, 2023
Copy link
Contributor

@emlowe emlowe left a comment

Choose a reason for hiding this comment

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

Do we need new plots checked into the plot cache repo?

@arvidn
Copy link
Contributor Author

arvidn commented Sep 15, 2023

Do we need new plots checked into the plot cache repo?

Yes, see: Chia-Network/test-cache#7

@arvidn arvidn added the ready_to_merge Submitter and reviewers think this is ready label Sep 15, 2023
@cmmarslender cmmarslender merged commit 0c56e8f into main Sep 16, 2023
397 of 398 checks passed
@cmmarslender cmmarslender deleted the better-simulated-chains branch September 16, 2023 02:00
arvidn added a commit that referenced this pull request Sep 29, 2023
arvidn added a commit that referenced this pull request Oct 10, 2023
arvidn added a commit that referenced this pull request Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changed Required label for PR that categorizes merge commit message as "Changed" for changelog ready_to_merge Submitter and reviewers think this is ready Tests Changes to tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants