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

Use fixed point numbers instead of floats for orders #26

Open
clangenb opened this issue Mar 9, 2023 · 0 comments
Open

Use fixed point numbers instead of floats for orders #26

clangenb opened this issue Mar 9, 2023 · 0 comments

Comments

@clangenb
Copy link

clangenb commented Mar 9, 2023

Floats are, in general, bad practice in a blockchain environment, as they are not deterministic across different architectures. In essense our offchain-worker could handle this, but when it comes to verifying merkle-root hashes, we might have issues; the client might be unlucky and get a different leaf hash compared to the offchain-worker.

Options:

  1. Use fixed point numbers. This might be a bit hard to implement, depending on the client and its programming language.
  2. The orders are stored as a json-string, so instead of calculating the Merkle hashes over the actual data, we can always use strings in the hashing operations. A bit hacky, but maybe easier to implement for certain clients.
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

1 participant