Skip to content

[group key addrs 1/?]: add new authmailbox RPC server and client #1502

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 6 commits into
base: main
Choose a base branch
from

Conversation

guggero
Copy link
Member

@guggero guggero commented May 1, 2025

Implements the mailbox server and client as described here: #874 (comment)

guggero added 6 commits May 1, 2025 16:12
To allow re-starting a server with a given listen address, we refactor
some of the code to export a new function to do just that.
TxProof is a struct that holds all components to prove a claimed
outpoint exists in a given block.
@guggero guggero requested review from Roasbeef and ffranr May 1, 2025 14:14
@coveralls
Copy link

Pull Request Test Coverage Report for Build 14776884033

Details

  • 999 of 2119 (47.14%) changed or added relevant lines in 17 files are covered.
  • 45 unchanged lines in 8 files lost coverage.
  • Overall coverage increased (+0.4%) to 29.14%

Changes Missing Coverage Covered Lines Changed/Added Lines %
taprpc/utils.go 4 6 66.67%
authmailbox/message.go 3 6 50.0%
internal/test/grpc.go 8 12 66.67%
authmailbox/stream.go 20 26 76.92%
authmailbox/mock.go 38 53 71.7%
proof/tx.go 0 21 0.0%
rpcutils/proof.go 63 93 67.74%
taprpc/authmailboxrpc/mailbox_grpc.pb.go 58 90 64.44%
internal/test/mock.go 17 55 30.91%
authmailbox/client.go 74 115 64.35%
Files with Coverage Reduction New Missed Lines %
asset/group_key.go 2 57.89%
tapgarden/planter.go 2 60.85%
commitment/tap.go 3 72.05%
rfqmsg/records.go 3 64.11%
tapchannel/aux_leaf_signer.go 5 43.08%
address/address.go 6 67.47%
tapgarden/caretaker.go 10 68.31%
address/mock.go 14 89.54%
Totals Coverage Status
Change from base Build 14776808586: 0.4%
Covered Lines: 27823
Relevant Lines: 95481

💛 - Coveralls

service Mailbox {
/*
Sends a single message to a receiver's mailbox. Requires a valid, unused
Bitcoin transaction outpoint as proof of work/stake.
Copy link
Contributor

Choose a reason for hiding this comment

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

/stake

/*
A simple ping-pong RPC to check the server's health and connectivity.
*/
rpc Ping (PingRequest) returns (PingResponse);
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe consider just calling this GetInfo. I think we have that elsewhere.

Comment on lines +1 to +11
package rpcutils

import (
"bytes"
"fmt"
"io"

"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/wire"
"github.com/lightninglabs/taproot-assets/proof"
mboxrpc "github.com/lightninglabs/taproot-assets/taprpc/authmailboxrpc"
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 file name here should be more specific to authmailboxrpc. IMO proof.go is too general.

Comment on lines +185 to +204
// TxProof is a struct that contains all the necessary elements to prove the
// existence of a certain outpoint in a block.
type TxProof struct {
// MsgTx is the transaction that contains the outpoint.
MsgTx wire.MsgTx

// BlockHeader is the header of the block that contains the transaction.
BlockHeader wire.BlockHeader

// BlockHeight is the height at which the block was mined.
BlockHeight uint32

// MerkleProof is the proof that the transaction is included in the
// block and its merkle root.
MerkleProof TxMerkleProof

// ClaimedOutPoint is the outpoint that is being proved to exist in the
// transaction.
ClaimedOutPoint wire.OutPoint
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Anyone can prove an outpoint in a block. The UTXO set is public. Any sender could use up all UTXOs.

Maybe I'm missing something, please see #874 (comment)

@levmi levmi moved this from 🏗 In progress to 👀 In review in Taproot-Assets Project Board May 8, 2025
@levmi levmi added the P1 label May 8, 2025
@lightninglabs-deploy
Copy link

@guggero, remember to re-request review from reviewers when ready

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: 👀 In review
Development

Successfully merging this pull request may close these issues.

5 participants