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

FLIP - Interaction Templates v1.1.0 #77

Merged
merged 28 commits into from
Nov 28, 2023

Conversation

JeffreyDoyle
Copy link
Member

@JeffreyDoyle JeffreyDoyle commented Mar 31, 2023

FLIP - Interaction Templates v1.1.0

Overview

This update to the InteractionTemplate and InteractionTemplateInterface data structures is the result of the need to better define the order of various properties of the InteractionTemplate and InteractionTemplateInterface, for use during the serialization process required for ID generation.

This change uses JSON Arrays to express the order of certain elements of the InteractionTemplate and InteractionTemplateInterface, instead of Objects as we're previously used which do not have a notion of order.

Required updates

@bjartek
Copy link
Contributor

bjartek commented Apr 4, 2023

Should we consider changing the way pins are generated as well here to be debth first since we are creating a new version?

I think the pin should be sha3(your_code, sha3(dep1), sha3(dep2)) or something like that so if you have done sha3(dep1) you can memoize that for all FLIX. Or even cache it.

@fotescodev fotescodev mentioned this pull request May 15, 2023
7 tasks
@m-Peter
Copy link

m-Peter commented May 23, 2023

After finding out about this from @bjartek, I am posting here the original message from a relevant message on Flow's discord:

I have a question about the "identity" of scripts & transactions, and would like the team's input on a possible solution. As @Destructor has initially pointed out here (onflow/Offers#1 (comment)), it is difficult to correlate script/transaction hash IDs, with their respective source files. This affects only scripts/transactions that are used during local development (excluding ones that might be generated dynamically, by string templates or something similar). After a call with @sideninja.find , we realized that this would be needed for other tools as well, besides code coverage/testing framework, e.g profilers. I understand that scripts&transactions do not reside on-chain, like contracts do, hence they do not need some human-friendly identifier. But it would enhance DevEx, if we could correlated them somehow, with the names of their respective source files. Where would be the ideal codebase to add such a functionality? (e.g Cadence/Emulator/CLI etc).

We would like, if it's somehow possible, to have https://github.com/onflow/flow-interaction-template-tools/tree/master/cli integrated in flow-cli, in order to have a more human-friendly identifier for scripts&transactions.

@sideninja
Copy link
Contributor

@m-Peter I think this could be an improvement to an existing solution that is currently lacking. The way I see is we have to solve this problem for any transaction or script, then after we solve the mapping we can improve the mapping for flix templates by integrating into flix. I don't see the other way around to be better.

@bthaile
Copy link
Contributor

bthaile commented Aug 8, 2023

Support new import syntax: In order to be consistent across all flow tools, it would be beneficial for flix to support new import syntax. This syntax does not have a contract address placeholder in the cadence code. It uses import "ContractName" which is interpreted by flow tools. The change needed is in the "dependencies" section, the contract address placeholder isn't needed. See below:

Pervious version:

dependencies: {
      "0xFUNGIBLETOKENADDRESS": { // Network (mainnet || testnet) dependent locations for 0xFUNGIBLETOKENADDRESS contract.
          "FungibleToken" : {
              mainnet: {
                  address: "0xf233dcee88fe0abe", // Address of the account the contract is located.
                  fq_address: "A.0xf233dcee88fe0abe.FungibleToken", // Fully qualified contract identifier.
                  pin: "asdfasdfasdfasdfasdfasdfsadf123123123123", // Unique identifier of the interactions dependency tree.
                  pin_block_height: 10123123123 // Block height the pin was generated against.
              },
              testnet: {
                  address: "0x9a0766d93b6608b7",
                  fq_address: "A.0x9a0766d93b6608b7.FungibleToken",
                  pin: "asdfasdfasdfasdfasdfasdfsadf123123123123",
                  pin_block_height: 10123123123
              }
          }
      }
  },

New version:

dependencies: {
    "FungibleToken" : {
        mainnet: {
            address: "0xf233dcee88fe0abe", // Address of the account the contract is located.
            fq_address: "A.0xf233dcee88fe0abe.FungibleToken", // Fully qualified contract identifier.
            pin: "asdfasdfasdfasdfasdfasdfsadf123123123123", // Unique identifier of the interactions dependency tree.
            pin_block_height: 10123123123 // Block height the pin was generated against.
        },
        testnet: {
            address: "0x9a0766d93b6608b7",
            fq_address: "A.0x9a0766d93b6608b7.FungibleToken",
            pin: "asdfasdfasdfasdfasdfasdfsadf123123123123",
            pin_block_height: 10123123123
        }
    }
},

Copy link
Member Author

@JeffreyDoyle JeffreyDoyle left a comment

Choose a reason for hiding this comment

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

Updates according to feedback from the Interaction Template working group on August 14 2023

protocol/20230330-interaction-templates-1.1.0.md Outdated Show resolved Hide resolved
protocol/20230330-interaction-templates-1.1.0.md Outdated Show resolved Hide resolved
…oftware engineering definitions, argument has to do with value passed to methods and functions, not the name of the variables of methods and functions
protocol/20230330-interaction-templates-1.1.0.md Outdated Show resolved Hide resolved
protocol/20230330-interaction-templates-1.1.0.md Outdated Show resolved Hide resolved
protocol/20230330-interaction-templates-1.1.0.md Outdated Show resolved Hide resolved
protocol/20230330-interaction-templates-1.1.0.md Outdated Show resolved Hide resolved
protocol/20230330-interaction-templates-1.1.0.md Outdated Show resolved Hide resolved
protocol/20230330-interaction-templates-1.1.0.md Outdated Show resolved Hide resolved
protocol/20230330-interaction-templates-1.1.0.md Outdated Show resolved Hide resolved
protocol/20230330-interaction-templates-1.1.0.md Outdated Show resolved Hide resolved
protocol/20230330-interaction-templates-1.1.0.md Outdated Show resolved Hide resolved
Copy link
Member Author

@JeffreyDoyle JeffreyDoyle left a comment

Choose a reason for hiding this comment

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

Adding comments from working group Nov 9

@JeffreyDoyle
Copy link
Member Author

Hello all!

As per the FLIX Working Group's previous meeting on November 9th 2023, the group has aligned on the following updates to the FLIX specification to be included in version 1.1:

  • Add support for the "new import syntax" in the cadence included in the Interaction Template
  • Add the full dependency tree inside the Interaction Template's dependency section.
  • Use the depth first search algorithm proposed by @bjartek for computing dependency pins (see: FLIP - Interaction Templates v1.1.0 #77 (comment))
  • Include hashes of the cadence included in the Interaction Template resolved per each supported network.

The following updates are reflected in the FLIP as of the date of this comment (Nov 14 2023). Please let us know if you have any thoughts or feedback!

--

If you're not in the FLIX working group and would like to be, please feel free to send an email to wallet-wg@flow.com and we will include you in the following meeting invites! 😄

protocol/20230330-interaction-templates-1.1.0.md Outdated Show resolved Hide resolved
protocol/20230330-interaction-templates-1.1.0.md Outdated Show resolved Hide resolved
protocol/20230330-interaction-templates-1.1.0.md Outdated Show resolved Hide resolved
protocol/20230330-interaction-templates-1.1.0.md Outdated Show resolved Hide resolved
protocol/20230330-interaction-templates-1.1.0.md Outdated Show resolved Hide resolved
lgtm

Co-authored-by: Bjarte S. Karlsen <bjarte@bjartek.org>
Co-authored-by: Jeff Doyle <jeffrey.doyle@dapperlabs.com>
Copy link
Contributor

@bthaile bthaile left a comment

Choose a reason for hiding this comment

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

congrates, looks good

Copy link
Member

@gregsantos gregsantos left a comment

Choose a reason for hiding this comment

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

lg2G

@JeffreyDoyle
Copy link
Member Author

Merging as accepted as per the decision in the FLIX working group on Nov 21 🎉

@JeffreyDoyle JeffreyDoyle merged commit 4152912 into main Nov 28, 2023
@JeffreyDoyle JeffreyDoyle deleted the flips/interaction-template-1.1.0 branch November 28, 2023 18:28
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.

7 participants