-
Notifications
You must be signed in to change notification settings - Fork 133
supplyverifier: add pull syncer and non-universe node verification #1777
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
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
74da783
tapdb: migrate supply tables to use 32-byte group keys
ffranr f1bfb7a
tapdb: use schnorr.ParsePubKey/SerializePubKey for group key columns
ffranr 74aaae2
supplyverifier: compare group pub keys by equivalence not equality
ffranr 8519931
mssmt: add helper function NewProofFromCompressedBytes
ffranr fdd48ec
supplysync_rpc: add support for FetchSupplyCommit RPC endpoint
ffranr bdebf6b
supplyverifier: add supply commit pull functionality to syncer
ffranr f984d6a
supplycommit: refactor by introducing startAssetSM method
ffranr 8d13b75
supplyverifier: refactor by introducing startAssetSM method
ffranr f102c40
tapdb: add TapAddressBook.FetchSupplyCommitAssets
ffranr 4215821
tapdb: add SQL query QueryLatestSupplyCommitment
ffranr adb6513
tapdb: add method FetchLatestCommitment to SupplyCommitMachine db store
ffranr 9e298a9
supplyverifier: init state machines for asset groups with commitments
ffranr fbf60f1
supplycommit: refactor asset check for reuse in supplyverifier package
ffranr c4b21fd
supplyverifier: validate asset group before starting state machine
ffranr 1703846
supplyverifier: remove state persistence; state can be regenerated
ffranr 98e2697
supplyverifier+tapcfg: add supply verifier manager config validation
ffranr ad3e985
supplyverifier: monitor universe syncer events to start state machines
ffranr fb3db91
supplycommit: use provided asset ID in metadata lookup if set
ffranr d0e9b79
supplycommit: reduce log level of tx/commit output to trace/debug
ffranr 9cc7019
supplycommit: avoid mock variable name shadowing with outer scope
ffranr 056591e
supplyverifier: rewrite supply verifier state machine
ffranr e0292dd
itest: extend testSupplyCommitIgnoreAsset to check peer commit retrieval
ffranr aa7dff3
docs: add release notes
ffranr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,6 +1,7 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| package mssmt | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "bytes" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "errors" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "fmt" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -41,6 +42,38 @@ func NewProof(nodes []Node) *Proof { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // NewProofFromCompressedBytes initializes a new merkle proof from its | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // compressed byte representation. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| func NewProofFromCompressedBytes(compressedProofBytes []byte) (Proof, error) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you aware that we already have this? taproot-assets/mssmt/encoding.go Lines 70 to 100 in 8519931
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var zero Proof | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if len(compressedProofBytes) == 0 { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return zero, fmt.Errorf("compressed proof bytes are empty") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var compressedProof CompressedProof | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| reader := bytes.NewReader(compressedProofBytes) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if err := compressedProof.Decode(reader); err != nil { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return zero, fmt.Errorf("decode compressed proof: %w", err) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Fail if extra data follows a valid proof encoding. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if remaining := reader.Len(); remaining != 0 { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return zero, fmt.Errorf("trailing data after compressed "+ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "proof: %d bytes", remaining) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| p, err := compressedProof.Decompress() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if err != nil { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return zero, fmt.Errorf("decompress proof: %w", err) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if p == nil { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return zero, fmt.Errorf("decompressor returned nil proof") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return *p, nil | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Root returns the root node obtained by walking up the tree. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| func (p Proof) Root(key [32]byte, leaf Node) *BranchNode { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Note that we don't need to check the error here since the only point | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
👍
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.
We should wrap this in a helper assertion (optional
VerifyFirst) and apply it to the other test as well, since that creates several supply commitments.