Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collection of DEVEX improvements #1726

Open
Trivo25 opened this issue Jul 8, 2024 · 3 comments
Open

Collection of DEVEX improvements #1726

Trivo25 opened this issue Jul 8, 2024 · 3 comments

Comments

@Trivo25
Copy link
Member

Trivo25 commented Jul 8, 2024

collection of things that come to my mind while talking to people at the hackathon

  • conditional set of on-chain state
  • improved and easier to use branching and switch logic (it gets messy very easily)
@mitschabaude
Copy link
Member

nice feedback! setIf() is straight-forward to add at least.

maybe some dynamic array methods for the branching?

@Trivo25
Copy link
Member Author

Trivo25 commented Jul 8, 2024

We dont type check state fields, or at least we dont throw a helpful error message

eg

 @state(Field) playerA = State<PublicKey>();

should be

 @state(PublicKey) playerA = State<PublicKey>();

but results in a weird error

TypeError: x.toBigInt is not a function
    at Function.toValue (file:///Users/trivo/Downloads/zk-dice-roll/contracts/node_modules/o1js/dist/node/lib/provable/field.js:882:18)
    at file:///Users/trivo/Downloads/zk-dice-roll/contracts/node_modules/o1js/dist/node/bindings/lib/from-layout.js:365:48
    at Object.map (file:///Users/trivo/Downloads/zk-dice-roll/contracts/node_modules/o1js/dist/node/bindings/lib/from-layout.js:423:20)
    at genericLayoutFold (file:///Users/trivo/Downloads/zk-dice-roll/contracts/node_modules/o1js/dist/node/bindings/lib/from-layout.js:418:17)
    at genericLayoutFold (file:///Users/trivo/Downloads/zk-dice-roll/contracts/node_modules/o1js/dist/node/bindings/lib/from-layout.js:395:28)
    at file:///Users/trivo/Downloads/zk-dice-roll/contracts/node_modules/o1js/dist/node/bindings/lib/from-layout.js:384:35
    at Array.map (<anonymous>)
    ```

@mitschabaude
Copy link
Member

We could fix that with types on the decorator!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants