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

Permisions precondition #306

Draft
wants to merge 121 commits into
base: develop
Choose a base branch
from
Draft

Conversation

Geometer1729
Copy link
Member

@Geometer1729 Geometer1729 commented Oct 10, 2024

Bindings portion of o1-labs/o1js#1862

luksgrin and others added 29 commits May 18, 2024 18:12
…t token usage permissions

The MayUseToken type and object were added to represent the permissions for token usage in a transaction. It includes two boolean fields: parentsOwnToken to indicate if the parent owns the token, and inheritFromParent to specify if the token usage should be inherited from the parent.

The check method was also added to enforce the constraint that a transaction cannot both have the parent own the token and inherit the token usage from the parent at the same time.

This addition provides a structured way to handle token usage permissions within the transaction leaves.
  - Check if parentsOwnToken and inheritFromParent are instances of Bool
  - Throw an error if the fields are not of type Bool
  - This ensures that the correct types are passed to the MayUseToken object, preventing potential runtime errors due to incorrect types being used in the check function
…ermissions

The MayUseToken type was added to the derivedLeafTypesSignable function to represent the token usage permissions for a zkApp account. It includes two boolean fields:
- parentsOwnToken: indicates if the parent account owns the token
- inheritFromParent: indicates if the token usage permission should be inherited from the parent account

This allows for more granular control over token usage permissions in zkApp accounts.

feat(transaction-leaves): export MayUseToken type in transaction leaf type definitions

The MayUseToken type is now exported from the transaction-leaves-bigint.ts and transaction-leaves-json.ts files. This makes the type available for use in other parts of the project that deal with transaction leaves and zkApp account permissions.

feat(gen): include MayUseToken in generated transaction types

The generated transaction types in transaction-bigint.ts and transaction.ts now include the MayUseToken type in the CustomTypes definition. This ensures that the MayUseToken type is properly integrated into the generated transaction types and can be used when working with transactions.
…en fields

The type checking for the `parentsOwnToken` and `inheritFromParent` fields in the `MayUseToken` object has been simplified. Instead of using an `if` statement with multiple conditions and throwing an error, the code now uses the `Bool.check()` method to ensure that each field is of type `Bool`. This change improves code readability and maintainability by utilizing the built-in type checking functionality provided by the `Bool` class.
…ify MayUseToken type

The createMayUseToken function was removed as it was not providing any additional functionality. The MayUseToken type was simplified to directly use the signable function with the parentsOwnToken and inheritFromParent fields of type Bool. This change reduces the complexity of the code without changing its behavior.
[v2] Fix MayUseToken vulnerability in AccountUpdates
Canonical representation of provable types
…ests

Regenerate bindings w.r.t. proof-systems update (external prover rng)
@Geometer1729 Geometer1729 changed the title Brian/permisions precondition Permisions precondition Oct 10, 2024
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

Successfully merging this pull request may close these issues.