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 lookup tables #12

Open
lrettig opened this issue May 31, 2023 · 0 comments
Open

Use lookup tables #12

lrettig opened this issue May 31, 2023 · 0 comments
Labels

Comments

@lrettig
Copy link
Member

lrettig commented May 31, 2023

Right now, issuance per layer is calculated dynamically every time the methods in this library are called. This is not ideal since the math is expensive and could, in theory, involve rounding errors on different architectures. Also reimplementing precisely the same math in a different language won't be trivial. (See spacemeshos/go-spacemesh#4268)

One easy fix here is to change this library to use lookup tables rather than recalculating per-layer issuance on demand. We could run a tool like the sim.go script here and generate a lookup table with the final per-layer issuance for an arbitrary number of layers and use that as the canonical issuance instead.

The size of such a table for the first ten years of issuance would be approximately [20 bits (layer ID) + 39 bits (layer subsidy)] * 1051200 layers =~ 8mb.

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

No branches or pull requests

1 participant