GithubHelp home page GithubHelp logo

Comments (17)

staltz avatar staltz commented on June 15, 2024 2

See the npm package monotonic-timestamp that Dominic created for this problem. It's used in ssb-validate

from go-ssb.

arj03 avatar arj03 commented on June 15, 2024 2

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.

boreq avatar boreq commented on June 15, 2024 2

Exchanged some emails with @cryptix and this course of action was suggested:

Opinions?

from go-ssb.

boreq avatar boreq commented on June 15, 2024 1

See the npm package monotonic-timestamp that Dominic created for this problem. It's used in ssb-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.

cryptix avatar cryptix commented on June 15, 2024 1

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.

decentral1se avatar decentral1se commented on June 15, 2024 1

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.

decentral1se avatar decentral1se commented on June 15, 2024 1

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.

boreq avatar boreq commented on June 15, 2024

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.

staltz avatar staltz commented on June 15, 2024

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.

boreq avatar boreq commented on June 15, 2024

👍 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.

decentral1se avatar decentral1se commented on June 15, 2024

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.

boreq avatar boreq commented on June 15, 2024

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.

cryptix avatar cryptix commented on June 15, 2024

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.

boreq avatar boreq commented on June 15, 2024

Ok all three remaining pull requests have been updated.

from go-ssb.

decentral1se avatar decentral1se commented on June 15, 2024

Nice, merged. Annnd #326 is also in. All good to go here? Nice coordination folks!

from go-ssb.

boreq avatar boreq commented on June 15, 2024

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.

decentral1se avatar decentral1se commented on June 15, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.