lightninglabs / lightninglabs/taproot-assets
[bug]: Planter cannot reply to requests while caretaker is finalizing a batch
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 525
- Forks
- 150
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 31
Description
Discovered while working on #693 .
When we finalize a batch ( `assets mint finalize` ), the planter starts a caretaker to handle the batch. As part of the finalize call, the planter waits for a response from the new caretaker:
https://github.com/lightninglabs/taproot-assets/blob/5318848252e331d64862f7c9173fdbe7dc5f1e27/tapgarden/planter.go#L621
This means that the finalize call will block on a response from the caretaker (or a quit signal). While the finalize call is blocked, the planter cannot respond to other requests like listing batches or cancelling a batch. In practice, I think this means that a user cannot actually cancel a batch owned by a caretaker right now, they can only cancel batches before `finalize` is called.
I think we didn't notice this earlier because in the unit tests we use the mock minter interfaces to essentially 'pause' the planter and caretaker at different spots, and we were starting batches directly via the batch ticker and not the finalize call, so this case was not exercised.
I'm not sure exactly what an appropriate change would be - IIUC the planter is set up to operate on one state request at a time vs. havving one request in-flight and another request being received.
One possibility would be moving part of the logic here:
https://github.com/lightninglabs/taproot-assets/blob/5318848252e331d64862f7c9173fdbe7dc5f1e27/tapgarden/planter.go#L593
Into a new & separate long-lived goroutine that accepts `*BatchCaretaker` and receives messages from a caretaker + resolves the original finalize request.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in tapgarden/planter.go around the finalize logic at lines 593 and 621, then trace how the assets mint finalize request waits for the caretaker. Reproduce the case with the existing unit-test mock minter interfaces, including a batch started through finalize rather than the batch ticker. Done means the planter can handle requests such as listing or cancelling batches while caretaker finalization is in progress, with coverage for this path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100