Skip to content
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

tapdb+universe: implement initial version of universe ignore tree #1420

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

Conversation

Roasbeef
Copy link
Member

@Roasbeef Roasbeef commented Mar 5, 2025

In this PR, we implement the initial version of the universe Ignore Tree.

Along the way, we need a migration to the universe leaves, as the current unique index structure prevents us from adding two leaves that have the same script key, but distinct namespace (eg: transfer to a script key, then a burn of that).

With that in place, we're able to implement the ignore tree using the existing MS-SMT/Universe routines we already have in the database.

TODO

  • Consistent interfaces.
  • Unit tests for the database layer

@coveralls
Copy link

Pull Request Test Coverage Report for Build 13711567323

Details

  • 81 of 393 (20.61%) changed or added relevant lines in 4 files are covered.
  • 24150 unchanged lines in 166 files lost coverage.
  • Overall coverage decreased (-26.9%) to 27.736%

Changes Missing Coverage Covered Lines Changed/Added Lines %
tapdb/sqlc/assets.sql.go 0 6 0.0%
universe/interface.go 0 8 0.0%
universe/ignore_records.go 81 110 73.64%
tapdb/ignore_tree.go 0 269 0.0%
Files with Coverage Reduction New Missed Lines %
asset/witness.go 2 91.38%
mssmt/compacted_tree.go 2 83.27%
proof/util.go 2 81.63%
tapdb/mssmt.go 2 88.64%
tapdb/sqlc/mssmt.sql.go 2 52.98%
address/log.go 3 0.0%
commitment/log.go 3 0.0%
internal/pedersen/commitment.go 3 95.31%
rfq/log.go 3 0.0%
tapchannel/aux_leaf_signer.go 3 43.43%
Totals Coverage Status
Change from base Build 13688589819: -26.9%
Covered Lines: 25032
Relevant Lines: 90251

💛 - Coveralls

Roasbeef added 3 commits March 8, 2025 18:20
… table

This commit introduces a new migration (Migration 30) that modifies the
unique index on the `universe_leaves` table. The unique constraint is
updated from two columns (`minting_point`, `script_key_bytes`) to three
columns (`minting_point`, `script_key_bytes`, `leaf_node_namespace`).

Additionally, a new test case, `TestMigration30`, is added to verify the
behavior of the database before and after the migration. The test
ensures that inserting a duplicate row with the same `minting_point` and
`script_key_bytes` but a different `leaf_node_namespace` fails before
the migration and succeeds after the migration is applied.

Furthermore, the `universe_leaves` table schema is updated in the
generated SQL schema file to reflect the new unique constraint. Other
minor changes include the addition of new proof types in the `universe`
package and the introduction of new types related to ignore tuples,
enhancing the overall functionality of the codebase.
@Roasbeef Roasbeef marked this pull request as ready for review March 9, 2025 02:20
@Roasbeef Roasbeef requested review from a team, ffranr and GeorgeTsagk and removed request for a team March 9, 2025 02:20
@Roasbeef
Copy link
Member Author

Roasbeef commented Mar 9, 2025

Removed from draft.

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

Successfully merging this pull request may close these issues.

2 participants