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

Add function to calculate rune unlock height #4097

Merged
merged 7 commits into from
Nov 22, 2024

Conversation

casey
Copy link
Collaborator

@casey casey commented Nov 22, 2024

See Rune::unlock_height. This works but makes me nervous. I noticed that my height calculation was one too high whenever we were 0/4, 1/4, 2/4, or 3/4ths of the way through an interval of runes with a given length. So I just fudged it and subtracted one in those cases.

I've exhaustively tested lengths 1 through 7, and they're all correct. (Checked by cross checking with asserts that the result of Rune::unlock_height matches Rune::minimum_at_height.) However, I'm worried that this pattern is actually the result of some deep number theory harmonic integer sequence or something, and is somehow wrong for larger intervals.

@t4t5
Copy link

t4t5 commented Nov 22, 2024

I think I know what the issue is. PR opened here: casey#3 👍

@casey
Copy link
Collaborator Author

casey commented Nov 22, 2024

@t4t5 Nice, that helps! I tweaked it a little bit to avoid floating point math. I think this version is now much less mysterious.

@casey casey enabled auto-merge (squash) November 22, 2024 22:00
@casey casey merged commit 2115bf2 into ordinals:master Nov 22, 2024
5 checks passed
@casey casey deleted the rune-unlock-height branch November 22, 2024 22:02
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

Successfully merging this pull request may close these issues.

3 participants