Skip to content

Conversation

SozinM
Copy link
Collaborator

@SozinM SozinM commented Jun 5, 2025

πŸ“ Summary

πŸ’‘ Motivation and Context


βœ… I have completed the following steps:

  • Run make lint
  • Run make test
  • Added tests (if applicable)

@SozinM SozinM force-pushed the msozin/flashblock-time-drift-account branch from 9b5a4b6 to 80d0eaf Compare June 5, 2025 16:50
@SozinM
Copy link
Collaborator Author

SozinM commented Jun 5, 2025

@danyalprout this is my take on the FB timing issue
We are testing it in staging right now, but locally it was running super smooth
It also adds some useful metrics regarding timings
You could give it a try too!

@SozinM SozinM force-pushed the msozin/flashblock-time-drift-account branch 3 times, most recently from 57428b1 to e161d65 Compare June 16, 2025 14:10
Solar Mithril added 5 commits June 17, 2025 17:43
@SozinM SozinM force-pushed the msozin/flashblock-time-drift-account branch from e161d65 to ee3ae84 Compare June 17, 2025 12:44
@SozinM SozinM force-pushed the msozin/flashblock-time-drift-account branch from d2ebe5b to 896046f Compare June 17, 2025 13:23
Copy link
Contributor

@krl krl left a comment

Choose a reason for hiding this comment

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

I am not familar enough with the logic of flashblocks to be authorative, but the code looks good apart from some code clarity issues.

// FCU(a) could arrive with `fb_time < delay < block_time - fb_time` - in this case we will issue less flashblocks
let time = std::time::SystemTime::UNIX_EPOCH + Duration::from_secs(timestamp)
- self.config.specific.leeway_time;
let time_drift = time.duration_since(std::time::SystemTime::now()).ok();
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it not be more clear to match on the error directly, instead of assigning and unpacking with .ok()?

something like

match time.duration_since(std::time::SystemTime::now()) { Ok(drift) , Err(SystemTimeError(amount) }

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

i'm using it later and it makes more sense for it to being the option imo

Solar Mithril added 2 commits June 17, 2025 18:57
@SozinM SozinM merged commit 19b271d into main Jun 17, 2025
2 checks passed
@SozinM SozinM deleted the msozin/flashblock-time-drift-account branch June 17, 2025 14:09
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