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

64bit arithmetic op codes #1538

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

Christewart
Copy link
Contributor

@Christewart Christewart commented Jan 10, 2024

This BIP describes a soft fork to add 64-bit arithmetic op codes to bitcoin

Implementation: bitcoin/bitcoin#29221

@Christewart Christewart changed the title 64bit arithetmic op codes 64bit arithmetic op codes Jan 10, 2024
@Christewart Christewart marked this pull request as ready for review January 10, 2024 20:45
@EthanHeilman
Copy link
Contributor

Why not push the overflow amount and the result back on the stack?

Rather than $2^{64}-1 + 3 = \mbox{FALSE}$, do $2^{64}-1 + 3 = 2, 1$. Where $2 = 2^{64}-1 + 3 \mod 2^{64}$ is the result and 1 is the overflow.

This would simply doing 256-bit math from 64-bit stack elements and I don't see any downsides for 64-bit operations.

@Christewart
Copy link
Contributor Author

Why not push the overflow amount and the result back on the stack?

Rather than 264−1+3=FALSE, do 264−1+3=2,1. Where 2=264−1+3mod264 is the result and 1 is the overflow.

This would simply doing 256-bit math from 64-bit stack elements and I don't see any downsides for 64-bit operations.

Sorry I don't understand this. Could you maybe give a more concrete example, perhaps on delvingbitcoin? We have a thread going here: https://delvingbitcoin.org/t/64-bit-arithmetic-soft-fork/397/25

Copy link
Contributor

@murchandamus murchandamus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just did a light first pass. I noticed that this document may be missing a Rationale Section that describes design decisions, alternate approaches, and related work, and a Backwards Compatibility section.

You may want to add the "Post-History" header to the preamble to link to discussions of this proposal on the mailing list or forums.

Title: 64 bit arithmetic operations
Author: Chris Stewart <[email protected]>
Comments-Summary: No comments yet.
Comments-URI: https://github.com/bitcoin/bips/wiki/Comments:BIP-0364
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please refrain from issuing your own BIP numbers.

<pre>
BIP: TBD
Layer: Consensus (soft fork)
Title: 64 bit arithmetic operations
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe:

Suggested change
Title: 64 bit arithmetic operations
Title: 64-bit arithmetic operations

@murchandamus murchandamus added New BIP PR Author action required Needs updates, has unaddressed review comments, or is otherwise waiting for PR author labels May 8, 2024
@murchandamus
Copy link
Contributor

Hey @Christewart, are you still working on this?

@Christewart
Copy link
Contributor Author

Hey @Christewart, are you still working on this?

Yep i'm going to give it another go. I'll update soon.

@bitcoin bitcoin deleted a comment from Vahid1201 Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New BIP PR Author action required Needs updates, has unaddressed review comments, or is otherwise waiting for PR author
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants