Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix nonce mechanism #566

Open
robertkowalski opened this issue Dec 23, 2020 · 1 comment
Open

fix nonce mechanism #566

robertkowalski opened this issue Dec 23, 2020 · 1 comment

Comments

@robertkowalski
Copy link
Contributor

robertkowalski commented Dec 23, 2020

when the api key way used with the node lib, the nonce does not work any more in the ruby lib and our other libraries

https://github.com/bitfinexcom/bfx-api-node-util/blob/master/lib/nonce.js#L11

the change was added in bitfinexcom/bfx-api-node-util@8980fe2 and is imho the wrong approach fixing it, because multiplying by 1000 does not fix the issue, am i missing something here?

the ruby lib still has the old code, where a normal timestamp is used
https://github.com/bitfinexcom/bitfinex-api-rb/blob/cac18d9b817663fef9b4a07b5730d1402272e709/lib/rest/rest_client.rb#L91-L93

not sure about the other implementations, like golang

Originally posted by @robertkowalski in bitfinexcom/bitfinex-api-rb#98 (comment)

@ezewer
Copy link
Contributor

ezewer commented Dec 23, 2020

The 1000 rule is kept as to do backward compatibility as the nodejs library already had it in previous versions, check the following: 036e20b#diff-005b36cbae2c8dbca1a%5B%E2%80%A6%5D53039360d359604a90260R23
If removing it would break all the bots and other software that are using it, that is what happened when utils was migrated as a separate library, this was not taken into consideration and was a huge issue. That commit was a to fix it.
As a great plus it allows to +1 if there are several calls on the same ms, so for example if there are 2 calls on ms 1608762134348, first call would be 1608762134348000 and second 1608762134348001
Recommendation would be too add *1000 to ruby also as using greater values would keep compatibility, on case where it does not matter if a call fails and can be done again.
If using different workers, software, etc best approach is to use different keys.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants