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

fix(michelson-encoder): improvement extract schema #1316

Merged
merged 56 commits into from
Jan 22, 2022

Conversation

roxaneletourneau
Copy link
Collaborator

@roxaneletourneau roxaneletourneau commented Jan 14, 2022

ExtractSchema is missing some important details (i.e. there is no distinction between "or" and
"pair" types, "option" type is not marked as optional). A new method called generateSchema"has
been implemented and is intended to replace the ExtractSchema method.
generateSchema provides a
more accurate and uniform schema representation.

For each token, generateSchema returns an object of type TokenSchema. TokenSchema has a property called schema which contains information on the schema of the subtoken when applicable.

type TokenSchema = {
  __michelsonType: string;
  schema: string | TokenSchema | Record<string, TokenSchema | string>;
}

Examples:
The michelson type: { prim: 'option', args: [{ prim: 'int' }], annots: [] } will be represented as follow by the generateSchema method:

{
        __michelsonType: 'option',
        schema: {
          __michelsonType: 'int',
          schema: 'int'
        }
}

The michelson type: { prim: 'pair', args: [{ prim: 'int', annots: ['test'] }, { prim: 'string', annots: ['test2'] }], } will be represented as follow by the generateSchema method:

// Nested pair will be brought to the same level 
{
        __michelsonType: 'pair',
        schema: {
          test: {
            __michelsonType: 'int',
            schema: 'int'
          },
          test2: {
            __michelsonType: 'string',
            schema: 'string'
          }
        }
}

The michelson type: { prim: 'map', args: [{ prim: 'string' }, { prim: 'int' }], annots: [] } will be represented as follow by the generateSchema method:

// schema has a key and value property
{
        __michelsonType: 'map',
        schema: {
          key: {
            __michelsonType: 'string',
            schema: 'string'
          },
          value: {
            __michelsonType: 'int',
            schema: 'int'
          }
        }
      }

BREAKING CHANGE: The schema representation is different between ExtractSchema and generateSchema
method. ExtractSchema will be marked as deprecated and the migration to generateSchema will incur
breaking change.

re #1252, re #1303, re #1304

Thank you for your contribution to Taquito.

Before submitting this PR, please make sure:

  • Your code builds cleanly without any errors or warnings
  • You have added unit tests
  • You have added integration tests (if relevant/appropriate)
  • All public methods or types have TypeDoc coverage with a complete description, and ideally an @example
  • You have added or updated corresponding documentation
  • If relevant, you have written a first draft summary describing the change for inclusion in Release Notes.

Release Note Draft Snippet

If relevant, please write a summary of your change that will be suitable for
inclusion in the Release Notes for the next Taquito release.

ExtractSchema is missing some important details (i.e. there is no distinction between "or" and
"pair" types, "option" type is not marked as optional). A new method called "generateSchema" has
been implemented and is intended to replace the "ExtractSchema" method. "generateSchema" provides a
more accurate and uniform schema representation.

BREAKING CHANGE: The schema representation is different between ExtractSchema and generateSchema
method. ExtractSchema will be marked as deprecated and the migration to generateSchema will incur
breaking change.

re #1252, re #1303, re #1304
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jan 14, 2022

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 89ea471
Status: ✅  Deploy successful!
Preview URL: https://74360079.taquito.pages.dev

View logs

@github-actions
Copy link

A new deploy preview is available on Netlify at https://a7c8b6fe--tezostaquito.netlify.app

@github-actions
Copy link

New packages have been deployed to the preview repository at https://npm.preview.tezostaquito.io/.

Published packages:

npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/

@codecov-commenter
Copy link

codecov-commenter commented Jan 14, 2022

Codecov Report

Merging #1316 (077b436) into master (b595d17) will decrease coverage by 0.07%.
The diff coverage is 80.68%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1316      +/-   ##
==========================================
- Coverage   79.40%   79.33%   -0.08%     
==========================================
  Files         187      188       +1     
  Lines        9907    10090     +183     
  Branches     2369     2360       -9     
==========================================
+ Hits         7867     8005     +138     
- Misses       2030     2075      +45     
  Partials       10       10              
Impacted Files Coverage Δ
packages/taquito-local-forging/src/constants.ts 100.00% <ø> (ø)
...ages/taquito-michelson-encoder/src/tokens/token.ts 100.00% <ø> (ø)
packages/taquito-signer/src/import-key.ts 93.75% <ø> (ø)
packages/taquito/src/batch/rpc-batch-provider.ts 55.00% <22.22%> (-3.25%) ⬇️
packages/taquito/src/wallet/wallet.ts 14.81% <22.22%> (+0.67%) ⬆️
...ckages/taquito-michelson-encoder/src/tokens/set.ts 30.43% <33.33%> (-1.39%) ⬇️
packages/taquito-utils/src/errors.ts 55.55% <33.33%> (-44.45%) ⬇️
...taquito-remote-signer/src/taquito-remote-signer.ts 70.96% <50.00%> (-0.70%) ⬇️
...ages/taquito/src/contract/rpc-contract-provider.ts 94.21% <53.33%> (-3.89%) ⬇️
...ages/taquito/src/contract/rpc-estimate-provider.ts 80.33% <55.55%> (-1.32%) ⬇️
... and 45 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b595d17...077b436. Read the comment docs.

roxaneletourneau and others added 2 commits January 14, 2022 15:53
* added test changes to handle SUB MUTEZ change in michelson

* update signature.json to suit test change

* add test case detail

* added new test for SUB MUTEZ

* corrected contract to work on Ithaca

* remove console log from test

* changes per review

* mark some tests as skip until forger supports sub_mutez
@github-actions
Copy link

New packages have been deployed to the preview repository at https://npm.preview.tezostaquito.io/.

Published packages:

npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/

@github-actions
Copy link

A new deploy preview is available on Netlify at https://b9a32254--tezostaquito.netlify.app

roxaneletourneau and others added 13 commits January 17, 2022 15:19
chore: update supported versions in SECURITY.md file
Unit tests for generateSchema method
* changes for new op codes

* imprive handing for sub_mutez

* stabilize

* correction per review
…es/taquito-tzip16/shelljs-0.8.5

Bump shelljs from 0.8.4 to 0.8.5 in /packages/taquito-tzip16
Bumps [shelljs](https://github.com/shelljs/shelljs) from 0.8.4 to 0.8.5.
- [Release notes](https://github.com/shelljs/shelljs/releases)
- [Changelog](https://github.com/shelljs/shelljs/blob/master/CHANGELOG.md)
- [Commits](shelljs/shelljs@v0.8.4...v0.8.5)

---
updated-dependencies:
- dependency-name: shelljs
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <[email protected]>
Bumps [shelljs](https://github.com/shelljs/shelljs) from 0.8.4 to 0.8.5.
- [Release notes](https://github.com/shelljs/shelljs/releases)
- [Changelog](https://github.com/shelljs/shelljs/blob/master/CHANGELOG.md)
- [Commits](shelljs/shelljs@v0.8.4...v0.8.5)

---
updated-dependencies:
- dependency-name: shelljs
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <[email protected]>
roxaneletourneau and others added 25 commits January 19, 2022 15:45
…s-0.8.5

Bump shelljs from 0.8.4 to 0.8.5
Bip 39 had unneeded translation files increasing the bundle size.

fix #1110
#1333)

* docs(website ledger documentation): replace utf transport with web-hid

"@ledgerhq/hw-transport-u2f" expires in February and has been replaced by
"@ledgerhq/hw-transport-webhid" in the live code example

fix #1266

* correction as per review
…ff-newlines-1.0.3

Bump trim-off-newlines from 1.0.1 to 1.0.3
fix(signer): removed bip39 dependency
Added validation to some packages and updated unit tests, as well as added new error classes
Update setup-node and cache GH actions to their latest versions and fix caching in pipelines
Limit GH Action workflows concurrency
…ests

Run Taquito integration tests from public GH runners
ExtractSchema is missing some important details (i.e. there is no distinction between "or" and
"pair" types, "option" type is not marked as optional). A new method called "generateSchema" has
been implemented and is intended to replace the "ExtractSchema" method. "generateSchema" provides a
more accurate and uniform schema representation.

BREAKING CHANGE: The schema representation is different between ExtractSchema and generateSchema
method. ExtractSchema will be marked as deprecated and the migration to generateSchema will incur
breaking change.

re #1252, re #1303, re #1304
@github-actions
Copy link

New packages have been deployed to the preview repository at https://npm.preview.tezostaquito.io/.

Published packages:

npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/

@github-actions
Copy link

New packages have been deployed to the preview repository at https://npm.preview.tezostaquito.io/.

Published packages:

npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/
npm i @taquito/[email protected] --registry https://npm.preview.tezostaquito.io/

@github-actions
Copy link

A new deploy preview is available on Netlify at https://69f96b8f--tezostaquito.netlify.app

@roxaneletourneau roxaneletourneau merged commit ff4f6bb into master Jan 22, 2022
@roxaneletourneau roxaneletourneau deleted the extractSchema branch January 22, 2022 01:22
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.

6 participants