Comments (17)
See the npm package monotonic-timestamp
that Dominic created for this problem. It's used in ssb-validate
from go-ssb.
Yes, I that check seems wrong. In JS sometimes if you ask for time you'll get these fractional float values, that has always annoyed me. But they should all still be in the same ms format, and not in ns.
from go-ssb.
Exchanged some emails with @cryptix and this course of action was suggested:
- move the type to ssb-refs ssbc/go-ssb-refs#6
- tag a new go-ssb-refs version
- update https://github.com/ssbc/go-metafeed ssbc/go-metafeed#30
- update https://github.com/ssbc/go-gabbygrove ssbc/go-gabbygrove#3
- update https://github.com/ssbc/go-ssb #325
Opinions?
from go-ssb.
See the npm package
monotonic-timestamp
that Dominic created for this problem. It's used inssb-validate
I am not entirely sure that this is the same problem. I am specifically referring to the fact that sometimes the value of the timestamp field is decoded differently. I understand that monotonic-timestamp
just adds some extra stuff after the dot so the value itself is still in milliseconds.
That being said I don't understand why there is a requirement for the timestamp to always increase somewhere in the JS SSB codebase. If we measure in ms
then obviously quick calls return the same results and there is nothing weird about this.
Also just to be clear "monotonic" means "non-decreasing" or "non-increasing" so getting the same value many times still means something is monotonic so again there is some confusion in the naming here (in the context of clocks in computer programs at least I believe).
from go-ssb.
just while we are here anyhow: IIRC the increasing timestamps were intended to be used as a social "happened before" "proofs" but Dominic later realised that he could do that without taking the timestamp into account.
from go-ssb.
Nice! @boreq ssbc/go-ssb-refs#6 is merged and is out https://github.com/ssbc/go-ssb-refs/releases/tag/v0.5.2. Wanna do the update labours on #325 ssbc/go-gabbygrove#3 and ssbc/go-metafeed#30? Can also take a run if you like.
from go-ssb.
Oh wait, there is more: https://github.com/search?q=org%3Assbc+encodedTime&type=code?
Oh wait, that's old. I can't find anything on third look, so yeh, gonna close this off again 🙃
from go-ssb.
Perhaps @staltz knows more if the JavaScript stack also contains some kind of a fix for this quirk. If not I think we should drop this code.
from go-ssb.
Yes, I agree with you that the adherence to the definition of monotonic wasn't correct. Perhaps @arj03 can shed some light on why equal timestamps are a problem in SSB JS.
from go-ssb.
👍 But I think the problem here is not specifically with this monotonic timestamp library but rather the fact that sometime in the past there was a client which didn't encode the time as milliseconds but rather for example nanoseconds or something like that and this code that I found tries to correct for that by guessing that if a timestamp contains a dot in it then it means that it is in ns
and not ms
. This seems wrong as the code you linked produces fractional timestamps in ms
. Therefore we can't use the dot to guess if it was in ms
or something else.
from go-ssb.
If I'm reading this right, then you're GTG @boreq with your proposal?
I'm down to review/merge/migrate/click buttons.
from go-ssb.
Upstream doesn't indicate how to contribute patches but I will try sending a patch to the email address that I got from the git logs.
from go-ssb.
welcome having this of my turf! i already 👍 the root PR and the rest is just renaming references so take this nod as going forward with the others once that is merged and tagged!
from go-ssb.
Ok all three remaining pull requests have been updated.
- https://github.com/ssbc/go-metafeed ssbc/go-metafeed#30
- https://github.com/ssbc/go-gabbygrove ssbc/go-gabbygrove#3
- https://github.com/ssbc/go-ssb #325
from go-ssb.
Nice, merged. Annnd #326 is also in. All good to go here? Nice coordination folks!
from go-ssb.
I think we can close this unless we find more references to encodedTime in some packages? I am on my phone but I can check again in the evening.
from go-ssb.
Ah, I think ssbc/go-ssb-room#372 needs to be done but we can follow up there.
I didn't see another reference in the go-ssb stack but feel free to re-open if you find one and we get to it!
from go-ssb.
Related Issues (20)
- TestFSCK flaking HOT 2
- TestNullFetched is flaky
- TestMetafeedIndexes is flaky HOT 4
- TestPrivateGroupsManualDecrypt is flaky HOT 2
- Remove usage of PushSource?
- Fix REUSE badge HOT 3
- Where are the indexes actually being set? HOT 5
- What's the difference between the publish log and the receive log? HOT 3
- Figure out licensing problems
- Figure out why TestStartup seemingly always triggers a 30 second timeout
- Can we get rid of logBuilder?
- Probable race condition in Gossip plugin's FeedManager
- Require tests passing before merge once flaky tests go away HOT 1
- Race condition between index Margaret queries
- TestPrivMsgsFromGo failing HOT 2
- Capitalization in sbotcli's remoteKey flag HOT 2
- Ways forward for go-ssb? HOT 5
- Illegal slice reuse in Badger code HOT 2
- Possible problem with publishing before finishing syncing one's own feed from another node
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-ssb.