taproot-assets icon indicating copy to clipboard operation
taproot-assets copied to clipboard

Updated ListAssetRequest to include additional filter options

Open itsrachelfish opened this issue 1 year ago • 4 comments

Resolves #876

This PR adds new filter options to the ListAssets RPC call.

  • The ListAssetRequest proto definition was updated to include the new filter options.
  • The fetchRpcAssets function was refactored to accept a AssetQueryFilters argument so that separate arguments don't need to be added for each filter option.
  • The assets store constraintsToDbFilter function was updated to use the new filter options.
  • And the assets.sql file was updated to include a new maxAmount option.

itsrachelfish avatar Nov 16 '24 06:11 itsrachelfish

Pull Request Test Coverage Report for Build 14571628881

Details

  • 21 of 98 (21.43%) changed or added relevant lines in 4 files are covered.
  • 7 unchanged lines in 3 files lost coverage.
  • Overall coverage increased (+0.009%) to 28.572%

Changes Missing Coverage Covered Lines Changed/Added Lines %
tapdb/assets_store.go 20 27 74.07%
taprpc/taprootassets.pb.go 0 25 0.0%
rpcserver.go 0 45 0.0%
<!-- Total: 21 98
Files with Coverage Reduction New Missed Lines %
address/address.go 2 69.55%
tapchannel/aux_invoice_manager.go 2 85.37%
tapchannel/aux_leaf_signer.go 3 43.43%
<!-- Total: 7
Totals Coverage Status
Change from base Build 14520380113: 0.009%
Covered Lines: 26263
Relevant Lines: 91918

💛 - Coveralls

coveralls avatar Nov 20 '24 09:11 coveralls

I think this function can help resolve the issue w.r.t getting the internal ID, you can just specify all the normal bytes (script key, anchor point, etc): https://github.com/lightninglabs/taproot-assets/blob/ec84760f1f665d16cf730c7e6ee8b30261023d9c/tapdb/assets_store.go#L904-L935

Roasbeef avatar Dec 11 '24 10:12 Roasbeef

@GeorgeTsagk @guggero I updated the code to filter assets based on the tweaked script key instead of the internal script key ID. I ran into some weird issues with the automated tests, for some reason I was unable to filter the 10th asset:

assetGen:    assetGen.assetGens[9],
anchorPoint: assetGen.anchorPoints[4],
amt:         777,
scriptKey:   scriptKeyWithScript,

Oli said this might have something to do with an underlying issue with the specific anchor point or asset generation, but I'm not sure why this particular asset is "cursed" :sweat_smile:

I worked around the issue by adding a script key to the 3rd asset and was able to filter it as expected.

itsrachelfish avatar Mar 10 '25 19:03 itsrachelfish

@georgetsagk: review reminder @itsrachelfish, remember to re-request review from reviewers when ready

lightninglabs-deploy avatar Apr 18 '25 10:04 lightninglabs-deploy