-
Notifications
You must be signed in to change notification settings - Fork 133
RPC: Add Ignore Tree Endpoints #1554
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
base: main
Are you sure you want to change the base?
Conversation
This new field will be used to interact with ignore trees from the RPC server.
Add a new column to the asset_seedlings table to store a reference to the universe commitment delegation key. The delegation public key is included in the asset metadata. It can be used to query the internal_keys table to retrieve full key information, including key family and key index.
Adds a method to generate a Schnorr signature over the TLV serialization of an IgnoreTuple.
Introduce a new RPC endpoint to add an asset outpoint to the asset's ignore tree. This allows asset issuers to explicitly exclude certain asset outpoints.
Pull Request Test Coverage Report for Build 15165694648Details
💛 - Coveralls |
@@ -24,6 +25,10 @@ type ArchiveConfig struct { | |||
// if the identifier has never been seen before. | |||
NewBaseTree func(id Identifier) StorageBackend | |||
|
|||
// IgnoreTreeArchive is an archive of all known ignore trees across all | |||
// assets. | |||
IgnoreTreeArchive IgnoreTreeArchive |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, the I envisioned things originally is that you almost never serve the ignore tree by itself. It's always accompanied with two additional layers of inclusion proofs: first into the mains supply tree, and then the block header proof into the blockchain.
// | ||
// NOTE: Ignore proofs are not included in the multiverse, as they are purely | ||
// off-chain. Only issuance and transfer proofs are included in the multiverse. | ||
func (a *Archive) UpsertIgnoreTuples(ctx context.Context, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the context of the greater system, we wouldn't want to insert ignore tuples directly into the tree. We want to make sure that we're always serving information that's consistent with the latest commitment on chain. Hence the way we stage updates as state transitions in #1508.
|
||
// GenSig generates a Schnorr signature over the IgnoreTuple using the | ||
// provided SignerClient and key locator. | ||
func (i *IgnoreTuple) GenSig(ctx context.Context, signer lndclient.SignerClient, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about instead having a method that accepts the same params, but returns a SIgnedIgnoreTuple
?
@@ -569,6 +606,10 @@ func (id PrevID) Hash() [sha256.Size]byte { | |||
return *(*[sha256.Size]byte)(h.Sum(nil)) | |||
} | |||
|
|||
// OutPoint is a type alias for an asset outpoint. It links the anchor outpoint | |||
// to the asset it secures. | |||
type OutPoint = PrevID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PrevOut
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or AnchorPoint
(to be used as asset.AnchorPoint
which reads nicely IMO) to not confuse it with a purely on-chain wire.OutPoint
?
// Upsert a signed ignore tuple into the ignore tree archive and | ||
// get back the authenticated ignore tuples. | ||
signedIgnore := universe.NewSignedIgnoreTuple(ignoreTuple, ignoreSig) | ||
authIgnoreTuples, err := r.cfg.UniverseArchive.UpsertIgnoreTuples( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than insert directly into the DB, we should call into the supply commit state machine:
taproot-assets/universe/supplycommit/supply_commit_states.go
Lines 96 to 101 in 648cb72
// NewIgnoreEvent signals that a caller wishes to update the ignore portion of | |
// the supply tree with a new outpoint + script key combo. | |
type NewIgnoreEvent struct { | |
universe.SignedIgnoreTuple | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good, did a quick first pass.
@@ -569,6 +606,10 @@ func (id PrevID) Hash() [sha256.Size]byte { | |||
return *(*[sha256.Size]byte)(h.Sum(nil)) | |||
} | |||
|
|||
// OutPoint is a type alias for an asset outpoint. It links the anchor outpoint | |||
// to the asset it secures. | |||
type OutPoint = PrevID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or AnchorPoint
(to be used as asset.AnchorPoint
which reads nicely IMO) to not confuse it with a purely on-chain wire.OutPoint
?
|
||
// The 32-byte asset ID encoded as a hex string. Use this field when | ||
// interacting via REST. | ||
string asset_id_str = 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason for not just using the raw bytes for an asset ID? We don't have the same problem here as we have with TXIDs that the content is reversed in the bytes vs. the human-readable string version.
And if a response has a oneof
type, which one will be set?
oneof script_key { | ||
// The script key in raw byte form. Use this field when interacting | ||
// via gRPC. | ||
bytes script_key_bytes = 4; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question here: Why do we need both forms? On the CLI it should look the same. But in an itest I'd never easily know which field would actually be set by the RPC server (without looking up the code or calling the RPC).
Closes #1534
Sharing early to get early feedback on naming and architecture. Still missing itests and query RPC endpoint.
This PR will not include the verifier, I will add that in a separate PR.
This PR adds RPC endpoints to populate and query from ignore trees.