Skip to content

[group key addrs 5/6]: Add Pedersen unique script key type #1621

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

Merged
merged 6 commits into from
Jul 10, 2025

Conversation

guggero
Copy link
Member

@guggero guggero commented Jun 26, 2025

More commits extracted from #1587 that contain the last (mostly) non-functional changes that can be merged independently before we're starting to change the address behavior.

@coveralls
Copy link

coveralls commented Jun 26, 2025

Pull Request Test Coverage Report for Build 16141989592

Details

  • 441 of 572 (77.1%) changed or added relevant lines in 16 files are covered.
  • 10 unchanged lines in 4 files lost coverage.
  • Overall coverage increased (+17.2%) to 56.544%

Changes Missing Coverage Covered Lines Changed/Added Lines %
proof/records.go 40 41 97.56%
address/book.go 1 5 20.0%
tapdb/sqlc/assets.sql.go 46 52 88.46%
authmailbox/receive_subscription.go 8 15 53.33%
tapdb/addrs.go 44 58 75.86%
authmailbox/multi_subscription.go 71 86 82.56%
asset/asset.go 54 71 76.06%
proof/send.go 37 67 55.22%
proof/encoding.go 66 103 64.08%
Files with Coverage Reduction New Missed Lines %
address/mock.go 2 97.39%
asset/group_key.go 2 72.15%
tapdb/addrs.go 2 76.78%
tapgarden/caretaker.go 4 76.93%
Totals Coverage Status
Change from base Build 16132808680: 17.2%
Covered Lines: 57440
Relevant Lines: 101584

💛 - Coveralls

@levmi levmi moved this from 🆕 New to 🏗 In progress in Taproot-Assets Project Board Jun 26, 2025
@guggero guggero force-pushed the pedersen-keys-refactor branch from 46d9159 to e5fdf7e Compare June 26, 2025 16:06
@guggero
Copy link
Member Author

guggero commented Jun 26, 2025

Going to look into the test failures (I think the mock just needs some mutexes).
But requesting review on this anyway so folks can load up on context.

@guggero guggero requested review from Roasbeef and ffranr June 26, 2025 16:45
@guggero guggero force-pushed the pedersen-keys-refactor branch 3 times, most recently from 555c711 to 6a85168 Compare June 30, 2025 15:41
Comment on lines 60 to 68
// Subscribe adds a new subscription for the specified client URL and receiver
// key. It starts a new mailbox client if one does not already exist for the
// given URL. The subscription will receive messages that match the provided
// filter and will send them to the shared message queue.
func (m *MultiSubscription) Subscribe(serverURL url.URL,
receiverKey keychain.KeyDescriptor, filter MessageFilter) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe this should be thread safe? I'm not sure how this might be used. But if it's going to be called from an RPC endpoint then it probably needs to be thread safe.

Copy link
Member Author

Choose a reason for hiding this comment

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

Currently we only access this from a single Goroutine in the asset custodian. But doesn't hurt to make it thread safe, so I did that.

proof/send.go Outdated
Comment on lines 28 to 40
const (
// SendFragmentV0 is the first version of the send fragment.
SendFragmentV0 SendFragmentVersion = 0
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be useful to reserve 0 for "unspecified version". Useful for returning errors on version parsing.

Might also be useful to have a "latest version" var here.

@github-project-automation github-project-automation bot moved this from 🏗 In progress to 👀 In review in Taproot-Assets Project Board Jul 2, 2025
@guggero guggero force-pushed the pedersen-keys-refactor branch 3 times, most recently from d050a45 to 770baa6 Compare July 4, 2025 13:44
@guggero guggero requested review from ffranr and Roasbeef July 4, 2025 14:38
@guggero
Copy link
Member Author

guggero commented Jul 4, 2025

I addressed all comments, should be ready for another round of review.

@guggero guggero force-pushed the pedersen-keys-refactor branch from 770baa6 to d029ca6 Compare July 7, 2025 15:53
Copy link
Member

@Roasbeef Roasbeef left a comment

Choose a reason for hiding this comment

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

LGTM 💃🏾

Because we'll use the address' script key as the bare/raw public key
that will be tweaked for each individual output of an address v2 send,
we'll need to be able to find addresses by that script key.
We'll also make the script key unique for v2 addresses to avoid multiple
records being returned here.
guggero added 5 commits July 8, 2025 08:50
This introduces a workaround that gets us WHERE xxx IN (...) queries
working with a little trick. See the comment in
scripts/gen_sqlc_docker.sh for more information on how this works and
why the workaround is needed.
This MultiSubscription helper struct allows us to subscribe to receive
messages for multiple keys held by a receiving wallet but all
consolidated into a single message channel.
We need to place these types in the proof package because the proof
courier will need access to them. And because we already use the proof
package from the address package, we can't place the new types there, as
that would create a circular package dependency.
@guggero guggero force-pushed the pedersen-keys-refactor branch from d029ca6 to 7436356 Compare July 8, 2025 11:30
Copy link
Contributor

@ffranr ffranr left a comment

Choose a reason for hiding this comment

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

Nice!

SendFragmentVersionUnknown SendFragmentVersion = 0

// SendFragmentV0 is the first version of the send fragment.
SendFragmentV0 SendFragmentVersion = 1
Copy link
Contributor

Choose a reason for hiding this comment

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

might be nice to call this SendFragmentV1 so that the enum value corresponds to the version in code, might be confusing otherwise

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, makes sense. I'll rename it in the follow-up PR.

@Roasbeef Roasbeef merged commit a62b68d into main Jul 10, 2025
33 of 36 checks passed
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in Taproot-Assets Project Board Jul 10, 2025
@guggero guggero deleted the pedersen-keys-refactor branch July 10, 2025 06:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

4 participants