lbryio / lbry-sdk

The LBRY SDK for building decentralized, censorship resistant, monetized, digital content apps.
https://lbry.com
MIT License
7.19k stars 484 forks source link

If video is before its channel in a block, it will be considered anonymous in resolve #3610

Open keikari opened 2 years ago

keikari commented 2 years ago

If a stream claim creation happens before the creation of the channel the claim belongs to, the stream claim won't properly be considered belonging to the channel. (Not 100% sure if this is what happens)

Claim https://odysee.com/koifishresinpour:f on a channel https://odysee.com/@SacredMoonResinArt:6 has "is_channel_signature_valid": true, but following calls don't return it. And canonical_url doesn't include the channel.

lbrynet resolve 'lbry://@SacredMoonResinArt:6/koifishresinpour (gives NOT_FOUND) lbrynet claim search --claim_ids f3bdb94532facacd18457190f1417cf44cdcc1ea --valid_channel_signature

Claim and channel were created in same block. Maybe transaction that included claim was read before the creation of channel. (If that matters)

keikari commented 1 year ago

If I'm looking at the right thing(and looking the txs in a block in right order), it seems that the thing does happen if video tx ends up being before the channel tx in a block.

Looks like the txs are read through in the same order they appear in a block https://github.com/lbryio/hub/blob/master/hub/scribe/service.py#L1436 (line at the time this was written)

And I think this code ends up running, since the channel doesn't exist yet. But as channel tx hasn't been processed yet, channel is also missing from the pending channels. And claim doesn't get channel associated to it.(Maybe, though resolve does have claim_id in signing channel)
https://github.com/lbryio/hub/blob/master/hub/scribe/service.py#L339 (line at the time this was written)


Also managed to repro when trying to create channel and video in a same block (with normal sdk calls) Can see here: https://odysee.com/@order_test_channel:2 (The video page may require reload for the channel to show as anonymous, but it always has URL without channel)

The txs are in a block with the video tx first. And the claim shows as anonymous when resolved, but appears on the channel with a valid signature on claim_search. (Though canonical_url is missing the channel part on claim_search results)