archethic-foundation / archethic-node

Official Archethic Blockchain node, written in Elixir
GNU Affero General Public License v3.0
75 stars 22 forks source link

Avoid Hypergeometric calculation at runtime #1560

Open Neylix opened 2 months ago

Neylix commented 2 months ago

Is your feature request related to a problem?

Hypergeometric distribution is an algorithm determining how many nodes need to validate a transaction having X nodes in the network. For example, running the algo with 2000 nodes return 187 nodes. The issue with this algo is that it can takes some times to compute. On my PC it takes 5.3 sec to run for 10 000 nodes.

Describe the solution you'd like

The algorithm return a value between 1 and 197 and for different value it can returns the same result, we could just create a mapping function. For example if number of node is in the range 1848..2049 then it return 187. This would avoid heavy calculation as well as calling C program at runtime

Additional context

No response

Epic

No response