Commit 88f1815
authored
feat(iroh-sync): validate timestamps and move validation up (#1439)
## Description
* Moves validation of entries from the store to `sync.rs`
* Skip validation for locally-inserted entries (not needed, signature
was created by us)
* Reject entries that are more than 10 minutes in the future of our
local device's wall clock time
## Notes & open questions
* The validation uses `SystemTime::now()`. Maybe we could make `Replica`
generic over a `TimeSource`, with a default impl `SystemTimeSource` that
uses `SystemTime`. This would allow tests to plug in a mock time source.
But if its only for tests, it might not be worth it. I don't think
there's many realistic scenarios where you'd want to swap `SystemTime`
for something else - apart from platform support, where `SystemTime` has
a few gaps (e.g. wasm). So maybe let's keep it simple for now and add
the generic once a need outside of tests arise.
* Do we want to make the "max 10 minutes in the future" const
configurable?
## Change checklist
- [x] Self-review.
- [x] Documentation updates if relevant.
- [x] Tests if relevant.1 parent 599bb03 commit 88f1815
1 file changed
+1
-0
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments