accordproject / models

Accord Project Model Repository
https://models.accordproject.org
Apache License 2.0
29 stars 42 forks source link

Base/Cicero Accord Project Models Revisions for version 1.0 #93

Closed jeromesimeon closed 3 years ago

jeromesimeon commented 4 years ago

The Accord Project base models in https://github.com/accordproject/models/tree/master/src/cicero were designed very early on before we had a lot of experience with the programming model, with the Ergo type system, etc.

Before we go to Cicero 1.0 we should do a review of those models, decide whether any change would be useful/needed.

This revision should be aligned with whatever decision we make on whether we keep or remove support for Concerto systems models. (See https://github.com/accordproject/concerto/issues/62)

Also, this revision should ideally address the use of a slightly different base model for Ergo type checking. (See https://github.com/accordproject/ergo/issues/698)

jeromesimeon commented 4 years ago

A draft for what the base models could be like for 1.0 is in the branch: https://github.com/accordproject/models/tree/js-base-models-93 under src/accordproject (https://github.com/accordproject/models/tree/js-base-models-93/src/accordproject).

That draft assumes support for systems model will be removed from Concerto.

Some changes:

  1. no more base model. identifiers have been folded into the models as required
  2. a separate obligation model which reduces the dependencies of the core models to other parts (e.g., money is not required in Concerto Core anymore). (See also: https://github.com/accordproject/models/issues/94)
  3. Some parts of the runtime which AFAICT are not used have been removed (PayLoad, Success, Failure)
  4. Some general renaming, notably removing Accord prefixes which seem redundant with the namespace. AccordContract -> ContractData and AccordClause -> ClauseData
  5. State and Obligation are in the runtime rather than the contract model
  6. promisor and promisee are now accord Party rather than Participant and are mandatory (per the comment)
  7. A tentative support for storing contract obligations in the contract state is suggested.

There is a lot of room for discussion here, and will need review and iteration.

mttrbrts commented 4 years ago

Nothing to add from me here. The changes in your fork LGTM

jeromesimeon commented 4 years ago

Nothing to add from me here. The changes in your fork LGTM

@mttrbrts Are you also happy with 6. and 7. which I thought were a bit more controversial?

About 6. We do have a few templates which leave parties as blank.

About 7. Could go with specific Ergo support for storing/retrieving obligation from the state. This could provide much nicer support for the kind of logic currently used in the Supply Agreement template https://github.com/accordproject/cicero-template-library/tree/master/src/supplyagreement

jeromesimeon commented 4 years ago

Status update on this issue:

  1. A new revision for the models can be found in https://github.com/accordproject/models/tree/release-1.0 This branch is published at https://release-1-0--accordproject-models.netlify.com
  2. This new revision takes into account the current resolution for systems models in Concerto (see https://github.com/accordproject/concerto/issues/62)

Some observations:

  1. Because the change of support for systems models in Concerto is a breaking Concerto change, some of the existing models are not valid anymore. Here is the list of existing models which break:
    10:07:43 AM: Error handling /opt/build/repo/src/cicero/runtime.cto
    10:07:43 AM: Relationship promisor must be to a class that has an identifier, but this is to system.Participant File '/opt/build/repo/src/cicero/runtime.cto': line 41 column 3, to line 44 column 3.
    10:07:46 AM: Error handling /opt/build/repo/src/docusign/connect.cto
    10:07:46 AM: Unable to download external model dependency 'https://release-1-0--accordproject-models.netlify.com/cicero/runtime.cto'
    10:07:46 AM: Error handling /opt/build/repo/src/docusign/connect@0.2.0.cto
    10:07:46 AM: Unable to download external model dependency 'https://release-1-0--accordproject-models.netlify.com/cicero/runtime.cto'
    10:12:13 AM: Error handling /opt/build/repo/src/payment/payment.cto
    10:12:13 AM: Unable to download external model dependency 'https://release-1-0--accordproject-models.netlify.com/cicero/runtime.cto'
    10:12:16 AM: Error handling /opt/build/repo/src/signature/signature.cto
    10:12:16 AM: Unable to download external model dependency 'https://release-1-0--accordproject-models.netlify.com/cicero/runtime.cto'
  2. New versions for those have been added which import the new AP base models: docusign/connect@0.3.0.cto payment/payment@0.2.0.cto and signature/signature@0.2.0.cto
  3. This is likely not the final resolution, assuming we address remaining open issues on identifiers and relationships (see https://github.com/accordproject/concerto/issues/181 https://github.com/accordproject/ergo/issues/734)
jeromesimeon commented 3 years ago

New Accord Project base models can now be found in https://github.com/accordproject/models/tree/master/src/accordproject