Skip to content

[group key addrs 6/7]: bug fixes and refactors #1658

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

guggero
Copy link
Member

@guggero guggero commented Jul 18, 2025

Extracted some commits from #1587 as suggested.
Addressed comments on existing review in #1587 that were meant for these commits.

guggero added 8 commits July 18, 2025 16:42
To allow a sender to re-try sending a message easily, we return the same
response for a message that uses the same proof and receiver key as if
we saw that message for the first time.
We can't actually check the content of the message, since it's
encrypted, and might differ each time it is re-encrypted, even if the
cleartext remains the same.
Since with the address v2 scheme each outpoint can only have a single
recipient, we can make the assumption that a message that claims the
same outpoint and is for the same recipient also is the same message.
We'll want to use the same error being returned in all asset group related
database interactions.
For V2 addresses we need to know certain information from the address
when creating the final send fragment. Because we might be transporting
a vPSBT over RPC boundaries between funding and finalizing, we need to
also transport the address between those steps. The easiest way to do
that is to encode the address into the virtual output directly.
We'll need to know the last block height we processed for any event
based on the address version.
This was always a bit confusing and also unnecessarily complicated.
We'll need to manually re-create the tapscript root given a sibling in
the next commit, where we'll use similar code. This refactor shows that
the root with no sibling can easily be transformed into the root with a
sibling.
@coveralls
Copy link

coveralls commented Jul 18, 2025

Pull Request Test Coverage Report for Build 16373392934

Details

  • 152 of 266 (57.14%) changed or added relevant lines in 19 files are covered.
  • 10228 unchanged lines in 126 files lost coverage.
  • Overall coverage increased (+0.09%) to 56.502%

Changes Missing Coverage Covered Lines Changed/Added Lines %
authmailbox/server.go 25 26 96.15%
tapdb/assets_common.go 0 2 0.0%
tapfreighter/parcel.go 4 7 57.14%
tappsbt/encode.go 16 19 84.21%
address/book.go 0 4 0.0%
tapfreighter/chain_porter.go 14 18 77.78%
tappsbt/decode.go 18 23 78.26%
rpcserver.go 11 17 64.71%
tapdb/sqlc/addrs.sql.go 0 6 0.0%
tapdb/authmailbox.go 45 57 78.95%
Files with Coverage Reduction New Missed Lines %
fn/context_guard.go 1 88.71%
authmailbox/client.go 2 66.93%
commitment/proof.go 2 87.29%
tapsend/proof.go 2 85.99%
universe/archive.go 2 79.29%
universe_rpc_diff.go 2 76.0%
universe/syncer.go 2 85.68%
universe/interface.go 3 60.2%
commitment/encoding.go 4 68.75%
rpcutils/price_oracle_marshal.go 4 85.07%
Totals Coverage Status
Change from base Build 16373215090: 0.09%
Covered Lines: 57814
Relevant Lines: 102322

💛 - Coveralls

// It's a different recipient, so someone is
// attempting to re-use a proof for a different
// recipient.
return nil, proof.ErrTxMerkleProofExists
Copy link
Contributor

Choose a reason for hiding this comment

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

returned error type here doesn't make sense to me. I would expect an error type along the lines of: attempting to reuse outpoint for a different receiver.

@@ -174,3 +174,12 @@ WHERE addr_events.status >= @status_from
AND COALESCE(@addr_taproot_key, addrs.taproot_output_key) = addrs.taproot_output_key
AND addr_events.creation_time >= @created_after
ORDER by addr_events.creation_time;

-- name: QueryLastEventHeightByAddrVersion :one
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should just call this QueryLastEventHeight and the addr version could be thought of as an optional argument. But not a big deal.

Comment on lines +170 to +173
// The exclusive start message ID, meaning messages with this ID or higher
// will be included in the response. This allows the client to resume
// receiving messages from a specific point without missing any. One of
// start_message_id_exclusive, start_block_height_inclusive or
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be good to add doc comment for bytes receiver_id = 1; above also

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🆕 New
Development

Successfully merging this pull request may close these issues.

3 participants