Skip to content

Conversation

ffranr
Copy link
Contributor

@ffranr ffranr commented Mar 3, 2025

This PR streamlines fundGenesisPsbt into a simpler, testable entry point and factors out ancillary logic to reduce coupling. Batch funding flows are exercised via updated unit test helpers, improving coverage and confidence around mint pre-commit scenarios. The mint batch helpers and mocks are aligned with the new shape, and the older seedling batch helper is retired. No behavioural changes are intended beyond improved structure and testability.

@ffranr ffranr added unit-test supply commit Work on the supply commitment feature, enabling issuers to attest to total asset supply on-chain. labels Mar 3, 2025
@ffranr ffranr self-assigned this Mar 3, 2025
@ffranr ffranr changed the base branch from main to unit-commitment-mint-output March 3, 2025 14:45
@coveralls
Copy link

coveralls commented Mar 3, 2025

Pull Request Test Coverage Report for Build 18406524442

Details

  • 111 of 123 (90.24%) changed or added relevant lines in 2 files are covered.
  • 17 unchanged lines in 6 files lost coverage.
  • Overall coverage increased (+7.0%) to 56.603%

Changes Missing Coverage Covered Lines Changed/Added Lines %
tapgarden/planter.go 79 91 86.81%
Files with Coverage Reduction New Missed Lines %
mssmt/compacted_tree.go 2 77.19%
tapdb/mssmt.go 2 89.55%
tapdb/sqlc/transfers.sql.go 2 83.33%
tapgarden/custodian.go 2 76.83%
universe/supplyverifier/manager.go 2 64.53%
tapdb/assets_store.go 7 79.61%
Totals Coverage Status
Change from base Build 18359865357: 7.0%
Covered Lines: 64036
Relevant Lines: 113131

💛 - Coveralls

@levmi levmi moved this from 🆕 New to 🏗 In progress in Taproot-Assets Project Board Mar 3, 2025
@ffranr ffranr force-pushed the unit-tests-mint-pre-commit branch from d41d194 to 83ba31c Compare March 5, 2025 11:42
@ffranr ffranr force-pushed the unit-commitment-mint-output branch 2 times, most recently from a2263f6 to cef2567 Compare March 6, 2025 00:59
@ffranr
Copy link
Contributor Author

ffranr commented Mar 6, 2025

Needs rebase.

@guggero guggero changed the base branch from unit-commitment-mint-output to main March 8, 2025 07:23
@ffranr ffranr force-pushed the unit-tests-mint-pre-commit branch from 83ba31c to 11aeea1 Compare October 9, 2025 23:21
@ffranr ffranr moved this from 🏗 In progress to 👀 In review in Taproot-Assets Project Board Oct 9, 2025
@ffranr ffranr marked this pull request as ready for review October 9, 2025 23:22
@ffranr ffranr requested review from GeorgeTsagk and jtobin October 9, 2025 23:23
@ffranr ffranr changed the title Unit tests for mint anchor transaction pre-commitment output Refactor fundGenesisPsbt and add high-level batch funding tests Oct 9, 2025
@ffranr ffranr changed the title Refactor fundGenesisPsbt and add high-level batch funding tests Refactor fundGenesisPsbt and enhance test helpers for coverage Oct 9, 2025
Separate the mint anchor transaction fee rate calculation from
fundGenesisPsbt into anchorTxFeeRate.

This refactor is part of a broader effort to simplify calling
fundGenesisPsbt from unit tests.
Extract the wallet funding call into a closure that is passed as an
argument. This prepares fundGenesisPsbt to become a standalone
function, making it easier to call in unit tests.
Pass the pending batch and chain params into fundGenesisPsbt and convert
it into a standalone function rather than a method on ChainPlanter. This
change makes it easier to call fundGenesisPsbt from unit tests.
The batch key was only used for logging. This commit moves the log
messages outside fundGenesisPsbt, simplifying the function for
better code health.
@ffranr ffranr force-pushed the unit-tests-mint-pre-commit branch from 11aeea1 to e2e3f79 Compare October 10, 2025 11:04
Copy link
Member

@jtobin jtobin left a comment

Choose a reason for hiding this comment

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

LGTM, only a single nit. The unit test fail in CI appears to be a flake; that test passes for me locally.

The mock helper FundGenesisTx now returns the index of the change
output. It also dynamically computes the index of the change output it
adds. These enhancements will be useful when handling packets with
supply pre-commitment outputs.
The funding routine now uses the refactored fundGenesisPsbt function,
introduced in a previous commit. Which adds test coverage for the batch
funding logic.

An optional argument is also added to allow skipping funding.
@ffranr ffranr force-pushed the unit-tests-mint-pre-commit branch from e2e3f79 to 10b3fb4 Compare October 10, 2025 12:29
@ffranr ffranr changed the base branch from main to 0-8-0-staging October 10, 2025 14:25
@ffranr ffranr changed the base branch from 0-8-0-staging to main October 10, 2025 14:25
@ffranr ffranr changed the base branch from main to 0-8-0-staging October 10, 2025 14:30
@ffranr ffranr added this to the v0.8 milestone Oct 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog supply commit Work on the supply commitment feature, enabling issuers to attest to total asset supply on-chain. unit-test

Projects

Status: 👀 In review

Development

Successfully merging this pull request may close these issues.

3 participants