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

script: static address taproot script #690

Merged
merged 2 commits into from
Jan 31, 2024

Conversation

hieblmi
Copy link
Collaborator

@hieblmi hieblmi commented Jan 25, 2024

In this PR we introduce taproot scripting for static loop-in addresses.

@hieblmi hieblmi self-assigned this Jan 25, 2024
@hieblmi hieblmi requested review from bhandras and sputn1ck January 25, 2024 13:44
Copy link
Member

@bhandras bhandras left a comment

Choose a reason for hiding this comment

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

LGTM 🎉

}
}

func MuSig2Sign(version input.MuSig2Version, privKeys []*btcec.PrivateKey,
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if it's worth moving this to say utils package?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There's a utils.go and a utils/htlc_utils.go. Should we create utils/musig.go. Although sometimes utils is an anti pattern.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah sgtm, it is somewhat of a too generic name I agree, but at least it is reusable.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ideally the server would also use this functionality.

@hieblmi hieblmi force-pushed the static-addr-script branch 3 times, most recently from 7827315 to 5931612 Compare January 25, 2024 14:34
@hieblmi hieblmi requested a review from GeorgeTsagk January 25, 2024 14:56
@hieblmi hieblmi force-pushed the static-addr-script branch from 5931612 to 249a493 Compare January 25, 2024 15:11
Copy link
Member

@sputn1ck sputn1ck left a comment

Choose a reason for hiding this comment

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

LGTM! Very nice addition with the tests!


// TaprootExpiryScriptSize evaluates to 39 bytes:
// - OP_DATA: 1 byte (trader_key length)
// - <trader_key>: 32 bytes
Copy link
Member

Choose a reason for hiding this comment

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

nit here and in other places: trader key is a relict from loop (that is also found in the reservations scripts cough cough)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

...from pool? Will change it caugh caugh.

}

// NewStaticAddress constructs a static address script.
func NewStaticAddress(muSig2Version input.MuSig2Version, csvExpiry int64,
Copy link
Member

Choose a reason for hiding this comment

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

IMO I think it makes sense to pass over *btcec.PublicKey, as a toplevel function should handle the parsing

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

@hieblmi hieblmi force-pushed the static-addr-script branch 4 times, most recently from 958a7b7 to 7c2640d Compare January 31, 2024 09:28
@hieblmi hieblmi merged commit 59e5460 into lightninglabs:master Jan 31, 2024
4 checks passed
@hieblmi hieblmi deleted the static-addr-script branch January 31, 2024 09:36
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