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

LNHANCE inquisition (CSFS, INTERNALKEY) #45

Open
wants to merge 3 commits into
base: 27.x
Choose a base branch
from

Conversation

reardencode
Copy link

This adds CHECKSIGFROMSTACK and INTERNALKEY to bitcoin inquisition for review and testing.

(Related to bitcoin#29198)

@reardencode reardencode force-pushed the lnhance-inquisition branch 2 times, most recently from f4a2f3f to bde4edd Compare January 14, 2024 16:02
Copy link

@ajtowns ajtowns left a comment

Choose a reason for hiding this comment

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

Deployment params should be the last commit not the first -- that way the implementation commits can more easily be cherry-picked, merged and tested first.

src/script/script.cpp Outdated Show resolved Hide resolved
src/validation.cpp Outdated Show resolved Hide resolved
src/script/interpreter.cpp Outdated Show resolved Hide resolved
@reardencode
Copy link
Author

Deployment params should be the last commit not the first -- that way the implementation commits can more easily be cherry-picked, merged and tested first.

IIUC it would have to be:

  1. implementation, with cpp unit tests
  2. deployment params
  3. functional tests

Because functional tests won't be possible until regtest deployment. This makes sense on this PR, but less so on my core one (from whence this was ported) because there it would have involved splitting the CTV functional testing commits from the rest of the CTV changes. For CSFS and IKEY I only did cpp unit tests, which may or may not be sufficient (especially here where they're split from CTV's deployment testing).

@reardencode
Copy link
Author

Addressed all of your comments except fully splitting out the deployment. Happy to do that too if you think it makes sense with the other changes in place. Thanks much for the review!

src/kernel/chainparams.cpp Outdated Show resolved Hide resolved
@reardencode
Copy link
Author

Updated for BINANA and to remove ECDSA verification from CHECKSIGFROMSTACKVERIFY on legacy/witnessv0 (BIN-2024-0003 rev1).

@ajtowns ajtowns added this to the 25.x milestone Feb 21, 2024
.revision = 1,
.start = 1705046400, // 2024-01-12
.timeout = 2020665600, // 2034-01-12
};

Choose a reason for hiding this comment

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

I was under the impression that LNHANCE is a proposal to do CTV+CSFS+IKEY as a unit. CTV is already on inquisition, but if we want to stay in the spirit of the proposal, might it make more sense to have CSFS and IKEY be deployed as a single unit?

Copy link
Author

Choose a reason for hiding this comment

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

Yeah, IDK about what @ajtowns wants to do here for inquisition purposes. For core I'd probably want to do something with fewer activations and fewer flags.

{
assert(sigbytes.size() == 64);
secp256k1_xonly_pubkey pubkey;
if (!secp256k1_xonly_pubkey_parse(secp256k1_context_static, &pubkey, m_keydata.data())) return false;
return secp256k1_schnorrsig_verify(secp256k1_context_static, sigbytes.data(), msg.begin(), 32, &pubkey);
return secp256k1_schnorrsig_verify(secp256k1_context_static, sigbytes.data(), msg.data(), msg.size(), &pubkey);

Choose a reason for hiding this comment

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

why did this change?

Copy link
Author

Choose a reason for hiding this comment

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

To allow data lengths other than 32. BIP340 explicitly allows it, but Taproot sighashes are all exactly 32-bytes so it wasn't needed previously.

@ajtowns
Copy link

ajtowns commented May 3, 2024

Did you want to continue with this on 25.x or skip straight to 27.x?

@ecdsa
Copy link

ecdsa commented May 21, 2024

@reardencode could you rebase this? I would love to test CSFS in combination with CAT

@reardencode reardencode changed the base branch from 25.x to 27.x July 12, 2024 23:19
@reardencode
Copy link
Author

Rebased on 27.x.

Testing is minimal, but so is the code.
Activates OP_CHECKSIGFROMSTACK, OP_CHECKSIGFROMSTACKVERIFY, and
OP_INTERNALKEY on regtest and signet.

always active on regtest
active from 2024-01-12 until 2034-01-12 on signet
never active on testnet, mainnet
@ajtowns ajtowns modified the milestones: 25.x, 27.x Sep 2, 2024
@@ -953,7 +953,7 @@ def taproot_construct(pubkey, scripts=None, *, keyver=None, treat_internal_as_in
return TaprootInfo(CScript([OP_1, tweaked]), pubkey, negated + 0, tweak, leaves, h, tweaked, keyver)

def is_op_success(o):
# assume OP_CAT is activated in tests
if o == OP_CAT:
Copy link

Choose a reason for hiding this comment

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

test/functional/test_framework/script.py:957:22: F821 undefined name 'OP_INTERNALKEY'
test/functional/test_framework/script.py:957:38: F821 undefined name 'OP_CHECKSIGFROMSTACK'

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.

6 participants