Pylons-tech / pylons

https://pylons.tech
Other
25 stars 123 forks source link

Custom randomness functions break CEL execution #1434

Closed afti-githobo closed 1 year ago

afti-githobo commented 1 year ago

Summary of Bug

Use of our custom randomness CEL declarations in a recipe causes that recipe to silently output nothing when executed.

Version

v1.0.3

Steps to Reproduce

Easiest way to do this is to run pylonsd tx pylons execute-recipe appTestCookbook RecipeTestAppRandomnessDemo 0 '[]' '[]' --from <key> at the CLI, which will execute a recipe that has been set up specifically to show this behavior off. It takes no inputs and outputs an item with some randomized fields. The transaction should go through and be committed normally!

However, if you then run pylonsd query pylons list-item-by-owner <addr> with the account that executed the recipe, you will find the recipe has actually output nothing. This is easiest to see by just using a new account that doesn't own anything yet - your expected console output would then just be {"items":[],"pagination":{"next_key":null,"total":"0"}}.

Cf. this gif for a quick example of what this looks like.

waow


For Admin Use

ahmedrns commented 1 year ago

@afti-githobo I have tested the execute recipe as you stated and list-item-by-owner, I suggest you to try again and wait for few seconds, and run pylonsd query pylons list-item-by-owner <addr> again. It takes few seconds to execute the recipe. recipe_5

afti-githobo commented 1 year ago

@ahmedrns @faisalnaveedRNS that recipe works fine b/c it doesn't have any random elements. please run the recipe I specified. read the issue. this is not a general issue w/ recipe execution, it is a bug with our custom randomness functions, specifically.

as an academic exercise i ran pylonsd query pylons list-item-by-owner pylo10yd38rtlezxwsckzcz9dmcnx4tyshal0lmrdf9 again tonight and that address still had no items until i ran a recipe w/o random outputs, at which point (as expected) it now has an item corresponding to that recipe's output.

faisalnaveedRNS commented 1 year ago

@afti-githobo can you please send me, create cook book and , create recipe inputs, so that we can better reproduce this issue

faisalnaveedRNS commented 1 year ago

@afti-githobo please share inputs, for

  1. Crate Cook Book
  2. Create Receipe
MikeSofaer commented 1 year ago

Are you not able to query for recipe RecipeTestAppRandomnessDemo

Any recipe with weights that are not 1 in the outputs will likely trigger this behavior, you don't need afti to craft a specific one.

StefanB90 commented 1 year ago

test on multiple nodes before release to ensure chain doesn't break

ahmedrns commented 1 year ago

issue resolved in #1490 PR