lbryio / hub

MIT License
16 stars 15 forks source link

"fee" parameter misbehaving #59

Open shyba opened 2 years ago

shyba commented 2 years ago

How to reproduce (July 11, spv19, the channel is probably not important):

$ lbrynet claim search --channel=@DistributedBarbecue:3 --fee_amount=0 | grep total_it
  "total_items": 4,
$ lbrynet claim search --channel=@DistributedBarbecue:3  | grep total_it
  "total_items": 13,
$ lbrynet claim search --channel=@DistributedBarbecue:3 --fee_currency=LBC | grep total_it
  "total_items": 0,
$ lbrynet claim search --channel=@DistributedBarbecue:3 --fee_amount=">=0" | grep total_it
  "total_items": 4,
$ lbrynet claim search --channel=@DistributedBarbecue:3 --fee_amount="<0" | grep total_it
  "total_items": 0,

Looks like reposts are gone? Not sure if only reposts are affected

shyba commented 2 years ago

Does not happens with new reposts, only old ones.

moodyjon commented 2 years ago

Was this query directed to (python) hub?

There is a possible related bug for the (go) herald https://github.com/lbryio/hub/issues/75

moodyjon commented 2 years ago

Would agree that the problem lies with reposts. However, I found an old repost (Nov 2020) on the channel (@DistributedBarbecue:3) that is returned even when fee_amount >= 0 is the query.

Older repost (Nov 2020): https://explorer.lbry.com/claims/045681bd7662a777575452ce0475aafc1b030d27

Newer repost (Jul 2022): https://explorer.lbry.com/claims/38ca5fed5863705b97acd6f3c299ba7eae159b25

Query:

curl -v -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","method":"claim_search","params":{"page_size":20,"page":1,"claim_type":["repost"],"no_totals":false,"not_tags":[],"channel":"@DistributedBarbecue:3","fee_amount":">=0"},"id":1668406}' localhost:5279

The problematic claims (9 reposts + 1 stream) span this range of block heights:

diff no_fee_amount.json fee_amount.json |egrep "<         \"claim_id\":|<         \"height\":|<         \"value_type\":"
<         "claim_id": "af641e4982676956823eb9402c3e43a1c17f9269",
<         "height": 1121659,
<         "value_type": "repost"
<         "claim_id": "215e55ae1113e31894b574543ed78703a3d8f816",
<         "height": 857369,
<         "value_type": "repost"
<         "claim_id": "faa1f9a569d686633ea279c2afc91c009457079b",
<         "height": 857369,
<         "value_type": "repost"
<         "claim_id": "38a04e359270b91c8eb5822a4f38b02b1a3f0df6",
<         "height": 848969,
<         "value_type": "repost"
<         "claim_id": "a2286b8e63a48d000b1cf4a720c16bc963123c81",
<         "height": 848966,
<         "claim_id": "9de0a28fc24061c6110c30360eb1c73a5e7f20a4",
<         "height": 848959,
<         "value_type": "repost"
<         "claim_id": "c6e2a6563e6b940f359561a16b43e8ffa3523606",
<         "height": 848956,
<         "value_type": "repost"
<         "claim_id": "d9e167940b47f3a33e3cd744a6f7c2cfb74d5e1f",
<         "height": 845187,
<         "value_type": "stream"
<         "claim_id": "7b38681a9ed63c115a925eadfccac86d3a9378de",
<         "height": 938479,
<         "value_type": "repost"
<         "claim_id": "3abaae4c7d6f54acd1b6d69f48c5258442d69814",
<         "height": 930886,
<         "value_type": "repost"
<         "claim_id": "cafd87f1fed676711cc54e3f1505369952d24240",
<         "height": 929503,
<         "value_type": "repost"
moodyjon commented 2 years ago

In Jun:

"height":[">=1180000","<=1180999"

swdev1@Jonathans-Mac-mini herald % tail fee2.json 
        },
        "value_type": "repost"
      }
    ],
    "page": 1,
    "page_size": 50,
    "total_items": 86,
    "total_pages": 2
  }
}
swdev1@Jonathans-Mac-mini herald % tail nofee2.json
        },
        "value_type": "repost"
      }
    ],
    "page": 1,
    "page_size": 50,
    "total_items": 1000,
    "total_pages": 20
  }
}

In July:

"height":[">=1190000","<=1190999"]

swdev1@Jonathans-Mac-mini herald % tail nofee4.json 
        },
        "value_type": "repost"
      }
    ],
    "page": 1,
    "page_size": 50,
    "total_items": 1000,
    "total_pages": 20
  }
}
swdev1@Jonathans-Mac-mini herald % tail fee4.json 
        },
        "value_type": "repost"
      }
    ],
    "page": 1,
    "page_size": 50,
    "total_items": 842,
    "total_pages": 17
  }
}

Most recently:

"height":[">=1209000"]

swdev1@Jonathans-Mac-mini herald % tail fee3.json 
        },
        "value_type": "repost"
      }
    ],
    "page": 1,
    "page_size": 50,
    "total_items": 999,
    "total_pages": 20
  }
}
swdev1@Jonathans-Mac-mini herald % tail nofee3.json
        },
        "value_type": "repost"
      }
    ],
    "page": 1,
    "page_size": 50,
    "total_items": 1000,
    "total_pages": 20
  }
}

The phenomenon seems to exist in many periods of time, and might be going away due to some software change. There has been work to add more fields to reposts, but I don't see the python hub being updated for this yet.

Use this to get a baseline for range of heights: curl -v -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","method":"claim_search","params":{"page_size":1000,"page":1,"claim_type":["repost"],"order_by":["height"],"no_totals":false,"height":[">=1190000","<=1190999"]},"id":1668406}' localhost:5279

Compare with: curl -v -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","method":"claim_search","params":{"page_size":1000,"page":1,"claim_type":["repost"],"order_by":["height"],"no_totals":false,"height":[">=1190000","<=1190999"],"fee_amount":">=0"},"id":1668406}' localhost:5279