taproot-assets
taproot-assets copied to clipboard
tapgarden: implement SealBatch
Addresses #722. Depends on #827.
Remaining TODOs:
- [ ] Extend
tapdb/asset_minting
tests to cover new query params for script key, group key, etc. - [ ] Add tests for
tapdb/asset_minting/CommitBatchTx
,AddSeedlingGroups
,FetchSeedlingGroups
- [x] Update SealBatch to reject being called more than once
- [x] Add itest that mints with custom asset group witnesses, custom script keys
- [x] Add itest that spends an asset minted with a custom script key
- [x] Update existing minting itests as needed
- [x] Add itest that spends an anchor amount with a custom script instead of a signature
Have an external group witness working now in unit tests. Still looking at ways to prevent SealBatch
from being called multiple times.
Right now IIUC we don't explicitly reject new seedling requests after a batch is frozen, so one option is to just freeze the batch at the end of SealBatch
+ disallow all calls except for FinalizeBatch
on a frozen batch. So after calling SealBatch
, the only other calls available would be finalize or cancel.
Looks like a possible new flake in custodian event handling?
--- FAIL: TestTransactionConfirmedOnly (123.22s)
test_postgres.go:11: Creating new Postgres DB for testing
custodian_test.go:220:
Error Trace: /home/runner/work/taproot-assets/taproot-assets/tapgarden/custodian_test.go:220
/home/runner/work/taproot-assets/taproot-assets/tapgarden/custodian_test.go:740
/home/runner/work/taproot-assets/taproot-assets/tapgarden/custodian_test.go:669
Error: Received unexpected error:
method did not return within the timeout
Test: TestTransactionConfirmedOnly
FAIL
FAIL github.com/lightninglabs/taproot-assets/tapgarden 156.362s
FAIL
Posted some updates, mostly fixes where the group tapscript root wasn't being propogated correctly.
Also some changes in the MintAsset
RPC to accomodate all the new fields.
Still working out some marshalling issues when generating group witnesses.
Posted my latest state. The issue with the version of the test I was working on before was internal keys not derived from the backing tapd node. Example for derivation here:
https://github.com/lightninglabs/taproot-assets/blob/761212d32a794666bfb09a7ac52aeefc02fc1078/itest/mint_fund_seal_test.go#L70
The posted version generates a sig for a siglock external to the planter, but I could not get a similar witness working if that key was derived from the backing lnd node, for both the Taproot Assets key family, or a random key family.
I'm at the last steps of the PSBT flow, which is very similar to the multisig test.
Remaining tasks:
- [x] freeze batch at the end of SealBatch to prevent further calls to add seedlings, fund, or freeze
- [x] Add CLI support
There's a path toward external key support in the itest via some changes in buildGroupReqs
and how the key descriptor is set in the seedling:
https://github.com/lightninglabs/taproot-assets/issues/883#issuecomment-2059673703
I have a branch that resolves #883 , but the better fix for that would be switching to SignPsbt
for the VirtualTxSigner
.
From offline discussion, I think for this PR we'll continue to accept a non-local group internal key without any constraints on the keyDescriptor
/ won't require mutual exclusion of the pubkey and keyLocator
. I think having the family and index in the DB for a non-local internal key is useful in some cases, and shouldn't cause issues if it's for the group internal key.
CLI commands are added, but they omit the fields with non-trivial formatting like KeyDescriptor
or asset.ScriptKey
. Similar to the commands we have for generating addresses, some functionality is only available via the RPCs directly.
@georgetsagk: review reminder @guggero: review reminder
Updated to address all comments, itest should be more readable now + other small fixes.