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

Refactor non-provable codebase to use value-types instead of provable types #201

Open
rpanic opened this issue Sep 24, 2024 · 0 comments
Open

Comments

@rpanic
Copy link
Member

rpanic commented Sep 24, 2024

In non-provable framework code (i.e. sequencer, workers, ...), we sometimes use the provable type representations (Field, PublicKey, ...) and sometimes we use the value types (bigint, string, ...)
The way o1js was refactored in the last year gives developers the right tools to only use value types and therefore achieve a better seperation between in-circuit and out-of-circuit code.

We should also use this pattern in our codebase to more clearly distinguish between the actual circuits and adjacent code. Additionally, this make our serializers leaner and saves us on conversions.

Potentially, since sometimes we use o1js-builtin functions to calculate something out of circuits (tree ops, hashing, signature verificatoin), this might also lead to some new conversions needing to happen that might offset the savings of above.
Also, we should think of how to correctly distinguish different conversations having the same js type (PublicKey and PrivateKey both encode to string).
Additionally, bigints aren't supported for json encoding yet - there are workarounds, but we should implement them framework-wide to not repeat ourselves

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

No branches or pull requests

1 participant