Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@lukaszcz
Copy link
Collaborator

@lukaszcz lukaszcz commented Jul 23, 2025

Nonce computation:

  • For consumed persistent resources the nonce must be available in the object.
  • For consumed ephemeral resources the nonce is random.
  • For created resources (persistent and ephemeral) the nonce is equal to the nullifier of the consumed resource in the same compliance unit.

@lukaszcz lukaszcz self-assigned this Jul 23, 2025
@lukaszcz lukaszcz marked this pull request as ready for review July 23, 2025 10:51
@lukaszcz lukaszcz requested review from Copilot and janmasrovira and removed request for Copilot July 23, 2025 10:51
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes the computation of nonces in the AVM system by properly generating and using random nonces (for consumed ephemeral resources) or nullifiers of corresponding consumed resources (for created resources). The changes ensure that each resource creation gets a unique, properly generated nonce value.

  • Removes the default parameter for nonces in Intent.toResource to make nonce generation explicit
  • Updates the nonce generation logic in Intent.action' to generate proper nonces
  • Refactors created object handling to defer nonce computation until action creation

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
AVM/Intent/Translation.lean Updates nonce generation to use proper random values and fixes variable naming
AVM/Intent.lean Removes default nonce parameter to enforce explicit nonce passing
AVM/Ecosystem/Translation.lean Removes todo nonce placeholder from created objects
AVM/Class/Translation.lean Simplifies created object construction by removing manual nonce handling
AVM/Action.lean Refactors created object structure and moves nonce computation to action creation time
Comments suppressed due to low confidence (3)

AVM/Intent/Translation.lean:61

  • [nitpick] The variable name 'r1' is not descriptive. Consider renaming to 'nonce1' or 'randomValue1' to clarify its purpose.
  let (r1, g2) := stdNext g1

AVM/Intent/Translation.lean:62

  • [nitpick] The variable name 'r2' is not descriptive. Consider renaming to 'nonce2' or 'randomValue2' to clarify its purpose.
  let (r2, g3) := stdNext g2

AVM/Intent/Translation.lean:63

  • [nitpick] The variable name 'r3' is not descriptive. Consider renaming to 'nonce3' or 'randomValue3' to clarify its purpose.
  let (r3, g4) := stdNext g3

@janmasrovira janmasrovira merged commit b92ae63 into main Jul 23, 2025
2 checks passed
@janmasrovira janmasrovira deleted the fix-nonces branch July 23, 2025 11:00
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.

Nonces for created resources are not computed correctly in AVM/Class/Translation.lean Properly compute the nonce of the Intent Resource

3 participants