vocdoni / vocdoni-node

A set of libraries and tools for the Vocdoni decentralized backend infrastructure, the main ground of our universally verifiable, privacy-centric and scalable digital voting protocol
GNU Affero General Public License v3.0
86 stars 17 forks source link

feature: use timestamp as string for the rpc API #345

Open p4u opened 3 years ago

p4u commented 3 years ago

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

G10h4ck commented 2 years ago

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

G10h4ck commented 2 years ago

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.

jordipainan commented 2 years ago

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 commented 2 years ago

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