vocdoni-node icon indicating copy to clipboard operation
vocdoni-node copied to clipboard

feature: use timestamp as string for the rpc API

Open p4u opened this issue 2 years ago • 4 comments

Describe the feature Use string timestamps instead of int32

Motivation Support timestamps > year 2038

Proposal Use integers stored in strings - it's just two more characters, and you entirely sidestep the issue of float precision in json :) In Go, they are natively supported like:

type T struct {
    IntAsString int64 `json:",string"`
}

Components affected vocdoni-node and dvote-js

Additional information (if required) This change should be perform in paralel for golang and javascript libraries

p4u avatar Nov 04 '21 09:11 p4u

Do we need to keep some kind of retro-compatibility with old RPC clients?

G10h4ck avatar Feb 18 '22 09:02 G10h4ck

Also the problem about 64bit integer is not withing JSON itself but in the languages on which are written the RPC clients, Dart and JavaScript are affected but Go/C++ etc. do not, I guess the RPC clients are written in JavaScript, am I wrong? In that case we have to change the representation of all 64bit integers and not just the timestamps in the RPC protocol.

G10h4ck avatar Feb 21 '22 09:02 G10h4ck

Do we need to keep some kind of retro-compatibility with old RPC clients?

Just saw this @G10h4ck I do not think we need to maintain this retro-compatibility given that the clients we have are updated or in process to be updated to the new specs.

jordipainan avatar Mar 02 '22 16:03 jordipainan

Also the problem about 64bit integer is not withing JSON itself but in the languages on which are written the RPC clients, Dart and JavaScript are affected but Go/C++ etc. do not, I guess the RPC clients are written in JavaScript, am I wrong? In that case we have to change the representation of all 64bit integers and not just the timestamps in the RPC protocol.

Yep you're right, we also have RPC client written in JS, but I do not know if some work around is already implemented, ping @brickpop or @marcvelmer for having better clarity on this. Thank you

jordipainan avatar Mar 02 '22 16:03 jordipainan