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

Skip to content

Conversation

@lukaszcz
Copy link
Collaborator

@lukaszcz lukaszcz commented Jun 25, 2025

  • Adds intents to the GOOSE prototype.
  • Intents are compiled to intent resources. Two RLs are generated: one for the intent logic checked on intent resource consumption, and one intent member logic for the objects consumed by the intent (checking that the right intent is created). The class of any object consumed by the intent needs to know about the intent and include the appropriate intent id among its member ids, so that the intent member logic can be selected when consuming the object of the class to create the intent resource.
  • The intents in this PR use fake nullifiers (to be addressed in a future PR).

Example intent from the Kudos app:

  intent SwapIntent (wantOriginator : ExternalIdentity) (wantQuantity : Nat)
   intentLogic 
      in (give : Kudos)  -- List of resources that we consume
      want (createdKudos : Set Kudo) (unused : Set OtherObject) : Bool := 
          let kudosToGet : Nat := 
               createdKudos
              |> select \{x => owner x == owner give && originator x == wantOriginator }
              |> map quantity
              |> sum
          in kudosToGet >= wantQuantity;

@lukaszcz lukaszcz self-assigned this Jun 25, 2025
@lukaszcz lukaszcz marked this pull request as ready for review July 2, 2025 10:35
@lukaszcz lukaszcz requested review from Copilot and janmasrovira July 2, 2025 10:35

This comment was marked as outdated.

@lukaszcz lukaszcz marked this pull request as draft July 3, 2025 14:36
@lukaszcz lukaszcz force-pushed the intents-v1 branch 3 times, most recently from 67040fd to dab17e4 Compare July 8, 2025 11:22
@lukaszcz lukaszcz marked this pull request as ready for review July 9, 2025 12:46
@lukaszcz lukaszcz requested a review from Copilot July 9, 2025 12:57
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 introduces intent support throughout the GOOSE AVM stack, allowing intents to be defined, translated into resources, and checked both on intent resource consumption and on consuming objects to create intents.

  • Adds a polymorphic UUnit type and updates TypeRep and list helpers to support intent parameters
  • Defines Intent and Intent.ResourceData in AVM/Intent.lean and implements translation to AVM actions/transactions in AVM/Intent/Translation.lean
  • Extends class labels, app data, object translation, and class‐member logic to include IntentId and intent checks

Reviewed Changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
Prelude/UUnit.lean Introduces UUnit for intent-member argument defaults.
AVM/Intent.lean Defines Intent struct and its resource data format.
AVM/Intent/Translation.lean Implements intent logic and action/transaction emission.
AVM/Class/Label.lean Extends Label with IntentId and parsing helpers.
AVM/Class/Translation.lean Integrates intent member logic into class translation.
Anoma/Resource.lean Adjusts Resource universes to align value/label types.
Apps/UniversalCounter.lean Registers empty Intents in the example counter class.
Apps/OwnedCounter.lean Registers empty Intents and fixes binding in fromObject.
Comments suppressed due to low confidence (2)

Anoma/Resource.lean:17

  • The universes for Val and Label were swapped, reversing the original parameters; this will misalign resources that expect the first parameter to be the value type. Please restore Val : SomeType.{u} and Label : SomeType.{v}.
  Val : SomeType.{v}

AVM/Class/Translation.lean:146

  • The record literal is indented under o.toResource, making the compiler parse it as an argument to toResource. Wrap the record in parentheses or adjust indentation so that let res := o.toResource is separate from the CreatedObject construction.
      { object := o.object

@lukaszcz lukaszcz requested a review from janmasrovira July 9, 2025 14:25
@@ -0,0 +1,10 @@

import Prelude.TypeRep
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think that when building a prelude it is convenient to have most of the definitions in the same file. Otherwise we might run quickly into mutual dependencies between different files.
You don't need to revert this change, I just wanted to provide some context about my original decision

@janmasrovira janmasrovira merged commit 5602bec into main Jul 9, 2025
2 checks passed
@janmasrovira janmasrovira deleted the intents-v1 branch July 9, 2025 15:47
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.

3 participants